diff --git a/ChangeLog.beta b/ChangeLog.beta new file mode 100644 index 0000000..6351887 --- /dev/null +++ b/ChangeLog.beta @@ -0,0 +1,208 @@ +------------------------------------------------------------------------------ +WANPIPE TDM VOICE - IP/WAN Package + +Linux Voice TDM/WAN Router Package +For more info visit: http://wiki.sangoma.com +------------------------------------------------------------------------------ +Author: Nenad Corbic +Copyright (c) 1995-2008 Sangoma Technologies Inc. +------------------------------------------------------------------------------ + +* Wed Feb 12 2008 Nenad Corbic - Beta - 3.3.2 +====================================================================== + +- Support for A500 hardware support with NetBricks BRI Stack +- Major A500 driver updates and fixes +- Serial A142/A144 hardware support +- AFT A056 56K hardware support + +- Support for HW DTMF + +- Updates for AFT PMC and MAXIM framers + PMC - lowered LOS sensitivity + Fixes fake up/down state changes on + started inactive lines. + + MAXIM - lowered sensistivy + Fixes cable cross talk on 8 port cards. + - Enabled Unframed E1 + - Enabled Tri-State Mode + - Fixed loopback commands + +- Updated loopback commands for AFT Maxim cards + +- Updated for AstLinux + The make file can now build all WAN and Voice Protocols + +- Updated legacy protocols for new front end architecture + +- + + +* Fri Feb 01 2008 Nenad Corbic - Beta - 3.3.2.p8 +====================================================================== + +- wancfg_zaptel now asks for the default_tei value for +- BRI cards in TE mode + +- Fix for HWEC not being enabled when non-consecutive modules are using +- in BRI cards + +* Fri Feb 01 2008 Nenad Corbic - Beta - 3.3.2.p4 +====================================================================== + +- Fixed AFT memory leak + Memory leak introduced in 3.3 release +- Fixed AFT 56K bug + Bug introduced in 3.3 releae + + +* Fri Feb 01 2008 Nenad Corbic - Beta - 3.3.2.p3 +====================================================================== + +- Fix bug in BRI protocol for fast local hangups. + +* Mon Jan 18 2008 Nenad Corbic - Beta - 3.3.2.p1 +====================================================================== + +- Bug fix in Hardware EC code for E1. + Bug introduced in 3.3 release. + + +* Mon Jan 18 2008 Nenad Corbic - Beta - 3.3.1 +==================================================================== + + +* Mon Jan 16 2008 Nenad Corbic - Beta - 3.3.0.22 +==================================================================== + +- BRI protocol:Increased internal timer that could cause issue in systems with +- more than 8 BRI spans + +* Mon Jan 15 2008 Nenad Corbic - Beta - 3.3.0.21 +==================================================================== + +- BRI protocol:Fix for smg_brid daemon crashing on race condition +- BRI protocol:default_tei parameter is not ignored when using point to +- multipoint anymore + +* Mon Jan 14 2008 Nenad Corbic - Beta - 3.3.0.20 +==================================================================== + +- BRI protocol: Additional prefix options. +- BRI protocol: Check is caller ID number is all digits on incoming calls +- Sangoma MGD: Removed dynamic user period causing skb panics +- chan_woomera: Fixed issue with rxgain and txgain values set to 0 if +- coding not set in woomera.conf +- wancfg_zaptel: Support for fractional T1/E1 spans. +- wancfg_zaptel: fix issue BRI always being configured as bri_net introduced in v3.3.0.19 + +* Mon Jan 07 2008 Nenad Corbic - Beta - 3.3.0.19 +==================================================================== + +- Support for national/international prefix in BRI stack + +* Mon Jan 07 2008 Nenad Corbic - Beta - 3.3.0.18 +==================================================================== + +- Changed Makefile in wanpipe/api/fr causing compilation errors + + +* Thu Dec 20 2007 Nenad Corbic - Beta - 3.3.0.17 +==================================================================== + +- Fix for smg_ctrl boot script starting before network services on some systems +- Support for language parameter in chan_woomera + +* Thu Dec 20 2007 Nenad Corbic - Beta - 3.3.0.16 +==================================================================== + +- Fix for Sangoma BRI Daemon crashing on incoming call if chan_woomera is not installed on that system + +* Tue Dec 18 2007 Nenad Corbic - Beta - 3.3.0.15 +==================================================================== + +- Fix for caller ID value being corrupted sometimes +- Support for call confirmation in chan_woomera + +* Tue Dec 18 2007 Nenad Corbic - Beta - 3.3.0.14 +==================================================================== + +- Fix in smg_brid not releasing some b-channels properly +- Fix in wancfg_smg not setting MTU to 80 when configuring cards for SS7 + +* Fri Dec 14 2007 Nenad Corbic - Beta - 3.3.0.13 +==================================================================== + +- Fix for Kernel panic on 64-bit systems when enabling hardware echo canceller + + +* Thu Dec 5 2007 Nenad Corbic - Beta - 3.3.0.11 +==================================================================== + +- Support for AFT Serial Cards +- Updates for AFT PMC and MAXIM framers + PMC - lowered LOS sensitivity + Fixes fake up/down state changes on + started inactive lines. + + MAXIM - lowered sensistivy + Fixes cable cross talk on 8 port cards. + - Enabled Unframed E1 + - Enabled Tri-State Mode + - Fixed loopback commands + +- Fixed HWEC_PERSIST_DISABLE + This option was broken in previous release + This option lets Asterisk control HWEC + on each call start/stop. + By default all hwec channels are enabled on + device startup. + +- Updated SMG/SS7 +- Updated loopback commands for AFT Maxim cards + +- Updated for AstLinux + The make file can now build all WAN and Voice Protocols + +- Fixed add_timer warnings for ALL AFT cards + Caused when a port is left in unconnected state. + +- Updated legacy protocols for new front end architecture + +- Updated Setup script + + + +* Thu Nov 8 2007 Nenad Corbic - Beta - 3.3.0.4 +==================================================================== + +- Fixed A101/2 (Old) bug introduced in previous releaes + +* Mon Oct 31 2007 Nenad Corbic - Beta - 3.3.0.4 +==================================================================== + +- Updated BRI caller name +- Updaged Setup + + +* Mon Oct 15 2007 Nenad Corbic - Beta - 3.3.0.1 +==================================================================== + +- Major Updates +- New BRI architecture/support + SMG with Netbricks BRI Stack +- Support for Hardware DTMF + + +* Thu Aug 22 2007 Nenad Corbic - Beta - 3.3.0.p3 +====================================================================== + +- Updated wancfg_zaptel to support HW DTMF + + +* Thu Aug 21 2007 Nenad Corbic - Beta - 3.3.0.p2 +====================================================================== + +- Major Updates +- Hardware DTMF for Asterisk and TDM API diff --git a/ChangeLog.stable b/ChangeLog.stable deleted file mode 100644 index 4521ba6..0000000 --- a/ChangeLog.stable +++ /dev/null @@ -1,404 +0,0 @@ ------------------------------------------------------------------------------- -WANPIPE - -Linux Voice TDM/WAN Router Package ------------------------------------------------------------------------------- -Author: Nenad Corbic -Copyright (c) 1995-2008 Sangoma Technologies Inc. ------------------------------------------------------------------------------- - -* Thu Aug 21 2008 Nenad Corbic - Stable - 3.2.7.1 -======================================================================== -- Fixed bug in wancfg_zaptel configuration utility - This bug was introduced in previous release. It will set d-channels - as "dchan" instead of "hardhdlc" for zaptel-1.4.x . - No driver changes. - -* Thu Jul 16 2008 Nenad Corbic - Stable - 3.2.7 -======================================================================== - -- Removed the Excessive Error check that disables the port. - This feature was introduced in 3.2.6 release. - Some lines are extremely noisy on startup which can cause - excessive crc errors (5000 per sec). In this case driver would - take the port down for few sec before bringing it back up in order to - avoid irq overlaod. This release will only print the - warning but will not take any up/down actions. - -- Added support for new PLX2 or TUNDRA PCIe chip. - - -* Thu Jun 4 2008 Nenad Corbic - Stable - 3.2.6 -======================================================================== - -- Updated hwprobe to add A056 card - -- Updated for 2.6.25 kernel - -- wanpipemon PRI/BRI wireshark tracing - http://wiki.sangoma.com/wanpipe-wireshark-pcap-pri-bri-wan-t1-e1-tracing - -- LIP Layer Update - Optimized packet handling in bh - -- Fixed WAN Protocol for 2.6.24 kernels and higher - -- AFT TE1 Code - Defaulted Maxim T1 Rx Level to 36DB - Defaulted Maxim E1 Rx Level to 42DB - This will improve T1/E1 connectivity on noisy or low power lines. - -- Wanpipemon PRI/BRI PCAP Tracing for Wireshark - Using wanpipemon dchan trace one can now capture - pcap files that can be opened by Wireshark. - http://wiki.sangoma.com/wanpipe-wireshark-pcap-pri-bri-wan-t1-e1-tracing - - -- Add pci parity check to wanrouter - wanrouter parity -> displays current system pci parity - wanrouter parity off -> disables system pci parity - wanrouter parity on -> enables system pci parity - - /etc/wanpipe/wanrouter.rc - WAN_PCI_PARITY=OFF -> on wanrouter start disable pci parity - -> event logged in /var/log/wanrouter - - On some servers pci parity can cause NMI interrupts that - can lead to reboots. Parity can be caused by unsuported - or buggy pci/bridge chipsets. The above commands can be used - to combat pci parity reboots. - - Another option is to disable PCI parity in BIOS :) - - - -* Thu Apr 4 2008 Nenad Corbic - Stable - 3.2.5.1 -======================================================================== - -- RTP TAP Bug fix - The driver was sending out invalid rtp tap header - http://wiki.sangoma.com/wanpipe-voice-rtp-tap - - -* Thu Apr 2 2008 Nenad Corbic - Stable - 3.2.5 -======================================================================== - -- T3/E3 Update - Fixed T3 Loopback commands - -- Updated T3/E3 Driver - Performance improvement on T3/E3 drivers when handling - VOIP and Data traffic. - -- Update ifconfig MTU change from protocol interface - - -* Thu Mar 6 2008 Nenad Corbic - Stable - 3.2.4 -======================================================================== - -- Updated for 2.6.24 kernels - TDM Voice (Zaptel) tested with 2.6.24 kernel. - Known issues: WAN protocols are broken for 2.6.24 kernels. - Its a compilation issue that will be fixed ASAP. - -- TDM API bug fix - Check for max frame size on audio stream - -- Updated for Zaptel 1.4.9 - -- AFT IRQ Throttling feature - This feature is use to protect the server from - terrible lines. In some cases a bad hdlc line can - cause thousands of interrupts per sec. Rx errors are now - throttled so that system does not get compromized. - -- AFT RTP TAP Feature - RTP TAP Feature allows user to tap voice channels during - Asterisk-Zaptel/TMD API operation at the driver/kernel level. - Each voice stream is encapsulated in UDP/RTP header and transmitted over - neghbouring ethernet address directly from kenrel space. - Tapping 4E1s worth of voice channels adds estra 2% system load :) - http://wiki.sangoma.com/wanpipe-voice-rtp-tap - -- AFT Software Ring Buffers on A200/A400 Analog Cards - This feature improves analog preformance under Asterisk/TDM API - mode. In particualr it improves faxing reliability and - minimizes frame slippage due to system load or bad incoming - clock from the line. - Note: All AFT T1/E1 cards have this feature in hardare :) - - -* Thu Jan 18 2008 Nenad Corbic - Stable - 3.2.3 -======================================================================== - -- No changes from 3.2.2 - Version updated for versioning sake. - -* Thu Jan 18 2008 Nenad Corbic - Stable - 3.2.2 -======================================================================== - -- AFT Maxim Front end update - Implemented graceful recovery on short circuit. - -- AFT Driver update - Added a check for TDM IRQ timeout. - On some machines its possible for TDM IRQ to timeout. - -- SMG updated - Fixed wancfg_smg - MTU not properly set on ports 2 and up - Voice only ports were not being added to startup sequence - Updated for callweaver - -- Added Zaptel 1.4 HW HDLC Support - No Sangoma zaptel patch needed with Zaptel 1.4 - -- Added HWEC Noise flag in wanpipe config file - -- Updated SMG -- Updated E1 Unframed on Maxim Cards - -- Updates for AFT PMC and MAXIM framers - PMC - lowered LOS sensitivity - Fixes fake up/down state changes on - started inactive lines. - - MAXIM - lowered sensistivy - Fixes cable cross talk on 8 port cards. - - Enabled Unframed E1 - - Enabled Tri-State Mode - - Fixed loopback commands - -- Fixed HWEC_PERSIST_DISABLE - This option was broken in previous release - This option lets Asterisk control HWEC - on each call start/stop. - By default all hwec channels are enabled on - device startup. - -- Updated SMG/SS7 -- Updated loopback commands for AFT Maxim cards - -- Updated for AstLinux - The make file can now build all WAN and Voice Protocols - -- Fixed add_timer warnings for ALL AFT cards - Caused when a port is left in unconnected state. - -- Updated legacy protocols for new front end architecture - -- Updated Setup script - - -* Wed Oct 6 2007 Nenad Corbic - Stable - 3.2.1 -===================================================================== - -- Setup Zap Chunk Size Patch updated for Zaptel 1.4 - Patch allows running zaptel in 8,16,40,80 chunk size. - However wct drivers must be removed from compilation :) - Patch is now fixed for Zaptel 1.4 - -- Update to All AFT drivers for 64bit 2.6.22 kernel. - Updated affects: AFT A101/2/4/8/200/400 (all cards) - The major 2.6.20+ updates extend to 64bit as well. - Previous drivers segfaulted under 2.6.22 64bit - kernels. This does not affect you if you are running - kennels lower than 2.6.22. - -- Updated legacy drivers for 2.6.22 kernel - - - -* Wed Oct 3 2007 Nenad Corbic - Stable - 3.2.0 -===================================================================== - -- The Beta 3.1.X releases has now been declared as STABLE 3.2.X - -- Fixed AMI/D4 on MAXIM (A101/2/4/8D) cards -- Fixed A200/A400 tip/ring no dial tone issues. -- Fixed 2.6.22 support and above -- Fixed RPM Build post install issue -- Updated Setup install script - Option to build for zaptel: ./Setup zaptel -- Working E&M/RBS/CAS Channel Bank support for MAXIM (A101/2/4/8) cards. -- Fixed wanpipe crashing on system shutdown on some machines. - Caused by RedHat /var/lock/subsys mandatory lock file. -- New Firmware for all MAXIM Cards (A101/2/4/8D) - Firmware V33: Fixes EC Chip Security errors that can cause - PRI to go down on some computers. Firmware is backward compatible - to any previous release. -- Faxes/Modems working through hardware echo canceler. - Tested at 56K from one port to another. - New octasic update. -- Analog Network SYNC Feature for Fax Support - Analog cards can be synced to T1/E1 clock - from adjacent A101/2/4/8 cards for flawless faxing - from FXO/FXS to T1/E1. - -- Known Issues: - T1/E1 High Impedance Tap for MAXIM (A101/2/4/8D) cards. - It works on original PMC A101/2/4 cards - -For more info: http://wiki.sangoma.com - - -* Mon Oct 1 2007 Nenad Corbic - Beta - 3.1.4.6 -==================================================================== - -- Fixed Makefile for 2.6.22.9 kernel. -- Fixed all gcc4 warnings. - - -* Tue Sep 26 2007 Nenad Corbic - Beta - 3.1.4.5 -==================================================================== - -- Updated Setup install script -- A200/A400 Analog driver update - Fixed noise issue introduced in 3.1.4.3 release -- Updated SMG for Asterisk 1.4 & Callweaver - - -* Tue Sep 18 2007 Nenad Corbic - Beta - 3.1.4.3 -==================================================================== - -- A200/A400 Analog driver update - Fixed a problem where analog port starts up without - dialtone. - -* Tue Sep 14 2007 Nenad Corbic - Beta - 3.1.4.2 -==================================================================== - -- Update for 2.6.22 kernel. -- wanrouter startup script update for redhat distros. - Fixes the issue on system shutdown, where wanpipe - module sometimes do not unload due to /var/lock/subsys/ - lockfile check. This issue is only related or RedHat style distros. - - -* Tue Aug 15 2007 Nenad Corbic - Beta - 3.1.4 -==================================================================== - -- Added A101-SH old config support. - So onld A101u or A101c config file can be used with new A101-SH cards. - -- Updated KATM support in the LIP Layer. - Used to connect Kernel ATM Layer to Wanpipe ATM AAL5 layer - over all AFT cards. - -- Added a sanity checker for enabling HWEC. - Used to prevent duble hwec enable. - -- Added wancfg_tdmapi configurator - -- Updated SMG - - -* Mon Jun 30 2007 Nenad Corbic - Beta - 3.1.3 -==================================================================== - -- Update to Ocatsic Hardware Echo Canceler Library - Turned of the NOISE suppression because it can interfere - with faxes. If you faxes did not work properly on 3.1.2 - release they will work fine with this one. - -- Cleaned up the Setup installation script. - - -* Mon Jun 16 2007 Nenad Corbic - Beta - 3.1.2 -==================================================================== - -- Update to Octasic Hardware Echo Canceler library - This is a very important update that affects all AFT cards - with octasic hardware echo canceler. The new octasic update - fixes faxing/modem issues over octasic hwec. The previous - release contained a bug that limited the faxing/modem speeds - to 26k. The new update properly detects fax/modem and works - with full speed of 33k fax and 56k modem. - -- A200/A400 Updated - This update fixes the offhook startup failure. - On startup if fxs is offhook driver will start correctly - -- Wanpipe Startup order changed - The wanpipe startup scripts on bootup were previously - set too early "S03wanrouter". This caused unpredictable - behaviour on some systems. We have now moved wanrouter - startup on boot up to "S11wanrouter", after networking - code. - -- Zaptel Adjustable Chunk Size Feature - Wanpipe drivers can work with 1,2,5 and 10ms - chunk size. Zaptel also supports this, however - the wct4xx driver breaks compilation when chunk - size is changed. ./Setup can how change the - zaptel chunk size for you and update zaptel - Makefiles to remove wct4xx driver out. - - Zaptel with 1ms generates 1000 interrupts per sec - Zaptel with 10ms generates 100 interrupts per sec. - - As you can see its a drastic interrupt performance - increase. - - NOTE: This breaks software echo cancelation, but - its not needed since we have hwec. - - -* Fri Jun 06 2007 Nenad Corbic - Beta - 3.1.1 -==================================================================== - -- A101/2/4/8 (MAXIM) AFT Update IMPORTANT - A major bug fix for AFT Maxim E1 cards for E1 CRC4 Mode. - On some lines the E1/CRC4 mode causes line errors on - the telco side which results in PRI not coming up. - - Symptiom: E1 is up (no alarms) on local side but pri is - not coming up! (Only in E1 CRC4 Mode) - -- A101/2/4/8 (MAXIM) Mandatory Firmware Update - An echo canceler bug has been fixed for all AFT - MAXIM Cards A101/2/4/8dm. New firmware version is V31. - If you are running MAXIM cards with hwec wiht older - firmware version you must upgrade. - -- Updated SMG - Fixed DTMF synchronization - - - -- Updated SMG - Fixed DTMF synchronization - - -* Fri Jun 06 2007 Nenad Corbic - Beta - 3.1.0.1 -==================================================================== - -- Minor release -- Contains zaptel patch for zaptel 1.2.17 and above. -- No driver changes - -* Fri May 17 2007 Nenad Corbic - Beta - 3.1.0 -==================================================================== - -- Major new BETA wanpipe release - Changed wanpipe versioning: - Release: A.B.C.D - A - Major Relase number - B - Indicates Stable or Beta - Odd number is Beta - Even number is Stable - C - Minor Release number - D - Optional pre-release and custom releases - -- Fixed RBS Support for all Maxim cards A101/2/4/8. - -- Support for 2.6.20 kernels. - -- Support for New: A101D A102D A104D Maxim cards - : -- Support for New: AFT 56K DDS card - -- Redesigned TDM API Events - -- TDM API Analog Support - diff --git a/Makefile b/Makefile index 145ff76..d534e2a 100644 --- a/Makefile +++ b/Makefile @@ -19,29 +19,6 @@ ifndef ZAPDIR ZAPDIR=/usr/src/zaptel endif -#Check if zaptel exists -ifneq (,$(wildcard $(ZAPDIR)/zaptel.h)) - ZAPDIR_PRIV=$(ZAPDIR) - ENABLE_WANPIPEMON_ZAP=YES - EXTRA_CFLGS+= -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE - ZAP_OPTS= --zaptel-path=$(ZAPDIR) - ZAP_PROT=TDM -else - ifneq (,$(wildcard $(ZAPDIR)/kernel/zaptel.h)) - ZAPDIR=/usr/src/zaptel/kernel - ZAPDIR_PRIV=$(ZAPDIR) - ENABLE_WANPIPEMON_ZAP=YES - EXTRA_CFLGS+= -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE - ZAP_OPTS= --zaptel-path=$(ZAPDIR) - ZAP_PROT=TDM - else - ZAP_OPTS= - ZAP_PROT= - ZAPDIR_PRIV= - ENABLE_WANPIPEMON_ZAP=NO - endif -endif - #Kernel version and location ifndef KVER KVER=$(shell uname -r) @@ -59,6 +36,10 @@ endif ifndef ARCH ARCH=$(shell uname -m) endif +ifndef ASTDIR + ASTDIR=/usr/src/asterisk +endif + INSTALLPREFIX= @@ -84,32 +65,23 @@ EXTRA_UTIL_FLAGS += -I$(PWD)/patches/kdrivers/wanec -I$(PWD)/patches/kdrivers/wa ENABLE_WANPIPEMON_ZAP=NO ZAPHDLC_PRIV=/etc/wanpipe/.zaphdlc -RM = @rm -rf -JUNK = *~ *.bak DEADJOE #Check if zaptel exists -#ifneq (,$(wildcard $(ZAPDIR)/zaptel.h)) -# ZAPDIR_PRIV=$(ZAPDIR) -# ENABLE_WANPIPEMON_ZAP=YES -# EXTRA_CFLGS+= -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE -# ZAP_OPTS= --zaptel-path=$(ZAPDIR) -# ZAP_PROT=TDM -#else -# ifneq (,$(wildcard $(ZAPDIR)/kernel/zaptel.h)) -# ZAPDIR=/usr/src/zaptel/kernel -# ZAPDIR_PRIV=$(ZAPDIR) -# ENABLE_WANPIPEMON_ZAP=YES -# EXTRA_CFLGS+= -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE -# ZAP_OPTS= --zaptel-path=$(ZAPDIR) -# ZAP_PROT=TDM -# else -# ZAP_OPTS= -# ZAP_PROT= -# ZAPDIR_PRIV= -# ENABLE_WANPIPEMON_ZAP=NO -# endif -#endif +ifneq (,$(wildcard $(ZAPDIR)/zaptel.h)) + ZAPDIR_PRIV=$(ZAPDIR) + ENABLE_WANPIPEMON_ZAP=YES + EXTRA_CFLGS+= -DSTANDALONE_ZAPATA -DBUILDING_TONEZONE + ZAP_OPTS= --zaptel-path=$(ZAPDIR) + ZAP_PROT=TDM +else + ZAP_OPTS= + ZAP_PROT= + ZAPDIR_PRIV= + ENABLE_WANPIPEMON_ZAP=NO +endif +RM = @rm -rf +JUNK = *~ *.bak DEADJOE # First pass, kernel Makefile reads module objects @@ -121,17 +93,13 @@ else #This will check for zaptel, kenrel source and build utilites and kernel modules #within local directory structure +all: _checkzap _checksrc all_bin_kmod all_util -#Build with all binaries -all: _checkzap _checksrc all_bin_kmod all_util - -#Build only source (NO WAN protocols) all_src: _checkzap _checksrc all_kmod all_util - #Build only kernel modules all_kmod: _checkzap _checksrc _cleanoldwanpipe _check_kver - $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KDIR) SUBDIRS=$(WAN_DIR) EXTRA_FLAGS="$(EXTRA_CFLAGS) $(shell cat ./patches/kfeatures)" ZAPDIR=$(ZAPDIR_PRIV) ZAPHDLC=$(ZAPHDLC_PRIV) HOMEDIR=$(PWD) modules + $(MAKE) KBUILD_VERBOSE=$(KBUILD_VERBOSE) -C $(KDIR) SUBDIRS=$(WAN_DIR) EXTRA_FLAGS="$(EXTRA_CFLAGS) $(shell cat ./patches/kfeatures)" ZAPDIR=$(ZAPDIR_PRIV) ZAPHDLC=$(ZAPHDLC_PRIV) HOMEDIR=$(PWD) modules all_bin_kmod: _checkzap _checksrc _cleanoldwanpipe _check_kver @if [ -e $(PWD)/ast_build_dir ]; then \ @@ -183,7 +151,7 @@ _check_kver: _checkzap: @echo @echo " +--------- Wanpipe Build Info --------------+" - @echo + @echo @if [ ! -e $(ZAPDIR)/zaptel.h ]; then \ echo " Compiling Wanpipe without ZAPTEL Support!"; \ ZAPDIR_PRIV=; \ @@ -215,12 +183,12 @@ install_kmod: install -m 644 -D $(WAN_DIR)/sdladrv.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/sdladrv.${MODTYPE} install -m 644 -D $(WAN_DIR)/wanpipe.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/wanpipe.${MODTYPE} @rm -f $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/wanpipe_syncppp.${MODTYPE} - @if [ -e $(WAN_DIR)/wanpipe_syncppp.${MODTYPE} ]; then \ + @if [ -f $(WAN_DIR)/wanpipe_syncppp.${MODTYPE} ]; then \ echo "install -m 644 -D $(WAN_DIR)/wanpipe_syncppp.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/wanpipe_syncppp.${MODTYPE}"; \ install -m 644 -D $(WAN_DIR)/wanpipe_syncppp.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/drivers/net/wan/wanpipe_syncppp.${MODTYPE}; \ fi @rm -f $(INSTALLPREFIX)/$(KINSTDIR)/net/wanrouter/wanpipe_lip.${MODTYPE}; - @if [ -e $(WAN_DIR)/wanpipe_lip.${MODTYPE} ]; then \ + @if [ -f $(WAN_DIR)/wanpipe_lip.${MODTYPE} ]; then \ echo "install -m 644 -D $(WAN_DIR)/wanpipe_lip.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/net/wanrouter/wanpipe_lip.${MODTYPE}"; \ install -m 644 -D $(WAN_DIR)/wanpipe_lip.${MODTYPE} $(INSTALLPREFIX)/$(KINSTDIR)/net/wanrouter/wanpipe_lip.${MODTYPE}; \ fi @@ -243,6 +211,14 @@ clean_util: install_util: $(MAKE) -C util install SYSINC=$(PWD)/$(WINCLUDE) CC=$(CC) PREFIX=$(INSTALLPREFIX) +install_smgbri: + $(MAKE) -C ssmg/sangoma_mgd.trunk/ install SYSINC=$(PWD)/$(WINCLUDE) CC=$(CC) PREFIX=$(INSTALLPREFIX) + install -D -m 755 ssmg/sangoma_bri/smg_ctrl $(INSTALLPREFIX)/usr/sbin/smg_ctrl + install -D -m 755 ssmg/sangoma_bri/sangoma_brid $(INSTALLPREFIX)/usr/sbin/sangoma_brid + $(MAKE) -C ssmg/libsangoma.trunk/ install DESTDIR=$(INSTALLPREFIX) + $(MAKE) -C ssmg/sangoma_mgd.trunk/lib/libteletone install DESTDIR=$(INSTALLPREFIX) + + #Install etc files install_etc: @if [ ! -e $(INSTALLPREFIX)/etc/wanpipe ]; then \ @@ -277,3 +253,17 @@ install_inc: @\cp -f $(PWD)/patches/kdrivers/include/*.h $(INSTALLPREFIX)/usr/include/wanpipe/ @\cp -rf $(PWD)/patches/kdrivers/wanec/oct6100_api/include/ $(INSTALLPREFIX)/usr/include/wanpipe/oct6100_api @\cp -rf $(PWD)/patches/kdrivers/wanec/*.h $(INSTALLPREFIX)/usr/include/wanpipe/ + +smgbri: + @cd ssmg/libsangoma.trunk; ./configure --prefix=/usr ; cd ../..; + $(MAKE) -C ssmg/libsangoma.trunk/ CC=$(CC) PREFIX=$(INSTALLPREFIX) KDIR=$(KDIR) + @cd ssmg/sangoma_mgd.trunk/lib/libteletone; ./configure --prefix=/usr ; cd ../../..; + $(MAKE) -C ssmg/sangoma_mgd.trunk/lib/libteletone CC=$(CC) PREFIX=$(INSTALLPREFIX) KDIR=$(KDIR) + $(MAKE) -C ssmg/sangoma_mgd.trunk/ CC=$(CC) PREFIX=$(INSTALLPREFIX) KDIR=$(KDIR) ASTDIR=$(ASTDIR) + + +clean_smgbri: + $(MAKE) -C ssmg/libsangoma.trunk/ clean CC=$(CC) PREFIX=$(INSTALLPREFIX) KDIR=$(KDIR) + $(MAKE) -C ssmg/sangoma_mgd.trunk/lib/libteletone clean CC=$(CC) PREFIX=$(INSTALLPREFIX) KDIR=$(KDIR) + $(MAKE) -C ssmg/sangoma_mgd.trunk/ clean CC=$(CC) PREFIX=$(INSTALLPREFIX) KDIR=$(KDIR) + diff --git a/README-2.config b/README-2.config index b00f7d6..792a91f 100644 --- a/README-2.config +++ b/README-2.config @@ -2,29 +2,31 @@ Wanpipe Configuration ====================== For Latest Info please visit -------------------------------------------------- http://wiki.sangoma.com -------------------------------------------------- -Asterisk/Zaptel Configuration --> /usr/sbin/wancfg_zaptel - -TDM API Config --> /usr/sbin/wancfg_tdmapi - -SMG/SS7 Config --> /usr/sbin/wancfg_smg - -WAN Configuration --> /usr/sbin/wancfg - Before starting WANPIPE, a configuration file (wanpipeN.conf, where N=1,2,3..etc.)must be created in /etc/wanpipe directory. This file contains the line, hardware and interface definitions for the WAN connection. +RELEASE 2.3.2 and on: + The new WANCFG utility has been release. It should + be used to configure standard WAN protocols like: + FR, PPP, CHDLC, + MULTILINK PPP (TTY), TDM_VOICE + HDLC API + ADSL + + + For both AFT and S514 series cards. + + The old WANCFG utility has been renamed to wancfg_legacy. + This utility should be used for all API protocols like: + X25, SDLC, BITSTREAMING ... + + The program /usr/sbin/wancfg should be used to create the configuration file(s). It is a GUI, ncurses based, configurator that contains all wanpipe options @@ -38,16 +40,11 @@ the sample configuration files located in Things you should know before starting /usr/sbin/wancfg: - 1. Operatoin Mode: - VOICE : Asterisk/Zaptel, TDM API - WAN/IP: Frame Relay, MultiLink PPP etc.. - - 2. Protocol: - Asterisk/Voice/TDM, + 1. Protocol: Frame Relay, MulitPort Frame Relay, CHDLC, PPP, MultiPort PPP, ADSL, X25 ... - 3. Protocol/IP Info: + 2. Protocol/IP Info: Frame Relay: Type of Status Signaling (LMI, ANSI, or Q.933 Number of DLCI to configure @@ -94,7 +91,7 @@ Things you should know before starting /usr/sbin/wancfg: IP Info: (Not needed for PPPoE) - 4. CSU/DSU Info: + 3. CSU/DSU Info: T1/E1: Encoding Framing diff --git a/README.changes b/README.changes deleted file mode 120000 index 7d3ae4f..0000000 --- a/README.changes +++ /dev/null @@ -1 +0,0 @@ -ChangeLog.stable \ No newline at end of file diff --git a/README.changes b/README.changes new file mode 100644 index 0000000..55a688e --- /dev/null +++ b/README.changes @@ -0,0 +1,87 @@ +WANPIPE OFFICIAL RELEASE CHANGE LOG +=================================== + + +Author: Nenad Corbic + + +Wanpipe Linux Web Page: +------------------- +For latest docs please visit Sangoma Wiki +Sangoma Wiki: http://wiki.sangoma.com + + +MAJOR CHANGES +------------- + + o The 2.3.4 release contains: + + AFT A108 & A108D Drivers. + Updated TDMV Channelized Driver for Asterisk + with support for hardware echo cancellation. + + TDM API Drivers. + Used to create custom TDM applications over + sangoma AFT devices. + + Sangoma Signal Media Gateway: + SS7 Support for Asterisk + + LIP Protocol Layer: + New protocols: ATM (AAL5), Frame Relay EEK + + + o The 2.3.3 release contains: + + AFT A104 TDMV Channelized Driver for Asterisk + The A104 TDMV Driver uses the channelization feature + of the A104 Card, to DMA 8byte chunks directly + into Zaptel buffers. + + AFT A104 TDMV DCHAN Feature + The DCHAN PRI has hardware HDLC support. + + o The 2.3.2 release contains: + + Stable TDMV Wanpipe drivers for Asterisk. + The TDMV drivers support both A102 and A104 cars. + Please read wanpipe/doc/README.asterisk + + Stable TE3 Drivers for AFT A301 TE3 Unchannelized Card. + All WAN protocols are supported: Frame Relay, PPP, CHDLC.. + + Stable LIP Network Layer: Separates Wanpipe hardware from + the Network Protocols: Frame Relay, CHDLC, + PPP, LAPB API, XDLC API + + o The 2.3.1 contains major structural driver changes. + The new Hardware Abstraction layer cleanly separates, the + physical layer from the driver/protocol layers. + + Support for 2.6.X kernel. + + o The 2.3.0 contains major structural driver changes + most notably the ADSL OS abstraction layer. ADLS drivers + can now be compiled against any custom kernel. + + o From 2.2.6 release forward the new S514-7 Dual T/E1, + S514-8 Single TE1 and S518 ADSL cards are supproted. + + o From 2.2.4 release forward the new S514-4 T/E1 and S514-5 56K + cards are supported. + + o From 2.2.3 release forward ALL wanpipe modules + including API modules, can be recompiled from + ./Setup installation script! + NO KERNEL RE-COMPILATION is necessary. + + o From 2.2.3 release forward, wanpipe directory + architecture has been changed. New home directory + for wanpipe is /etc/wanpipe. + + o All old releases are in ../old_releases/wanpipe directory. + + o Custom RPMs can be build based on current kernel image + by using the ./Setup buildrpm command. + Read the README.rpmbuild. + diff --git a/Setup b/Setup index 9997c58..9507417 100755 --- a/Setup +++ b/Setup @@ -1,4 +1,4 @@ -#!/bin/bash -p +#!/bin/sh # # Setup WANPIPE WAN Router Installation/Removal Script. # @@ -9,8 +9,9 @@ # as published by the Free Software Foundation; either version # 2 of the License, or (at your option) any later version. # ---------------------------------------------------------------------------- -# May 30, 2008 Jignesh Patel Fixed bootscript installation failure -# Oct 26, 2007 Konrad Hammel Updated minor start script bug +# Mar 12, 2008 Konrad Hammel Updated for Zaptel-1.4.9 (kernel sub-dir) +# Jan 24, 2008 Jignesh Patel Zaptel Patch Update for 1.4.x +# Nov 13, 2007 Konrad Hammel Minor Updates for aesthetics and usability # Nov 27, 2005 David Rokhvarg Added Echo Debugging option # Mar 18, 2002 Nenad Corbic Added BSCSTRM protocol # Mar 01, 2002 Nenad Corbic Added option to split rpm build into @@ -540,13 +541,13 @@ prepare() missing_packages=$missing_packages"libtermcap-devel " fi - echo -n "Checking for bison..." - eval "type bison 2> /dev/null > /dev/null" + echo -n "Checking for yacc..." + eval "type yacc 2> /dev/null > /dev/null" if [ $? -eq 0 ]; then echo "OK" - else - echo "Failed!" - missing_packages=$missing_packages"bison " + else + echo "Failed!" + missing_packages=$missing_packages"yacc " fi echo @@ -601,10 +602,10 @@ prepare() echo -e " Required for Wancfg configuration utility." echo -e " Install flex package (e.g yum install flex)." ;; - bison) - echo -e "\n Bison." + yacc) + echo -e "\n Yacc." echo -e " Required for Wanpipe Utilities." - echo -e " Install bison package (e.g yum install bison)." + echo -e " Install byacc package (e.g yum install byacc)." ;; esac @@ -1275,7 +1276,7 @@ There are two configuration files associated with WANPIPE. - defines interfaces, hardware and protocol information. - this file can be created using the 'wancfg' GUI utility or manually based on sample files located - in $WAN_CONF_DIR/samples. + in /etc/wanpipe/samples. Please read the WanpipeInstallation.(pdf/txt) manual for further information. @@ -1298,7 +1299,7 @@ function get_conf_dir () #banner if test -z $NONINTERACTIVE; then echo -e "\nPlease specify a desired location for ${DISTR_NAME} configuration files." - echo -e "\n\t(Press Enter for Default: $WAN_CONF_DIR)\n" + echo -e "\n\t(Press Enter for Default: /etc/wanpipe)\n" echo -n "" read response @@ -1334,17 +1335,17 @@ function get_bin_dir () #banner if test -z $NONINTERACTIVE; then echo -e "\nPlease specify a location for WANPIPE binary, firmware files." - echo -e "\n\t(Press Enter for Default: $WAN_CONF_DIR/firmware)\n" + echo -e "\n\t(Press Enter for Default: /etc/wanpipe/firmware)\n" echo -n "" read response if [ $response ]; then WAN_FIRMWARE_DIR=$response else - WAN_FIRMWARE_DIR=$WAN_CONF_DIR/firmware + WAN_FIRMWARE_DIR=/etc/wanpipe/firmware fi else - WAN_FIRMWARE_DIR=$WAN_CONF_DIR/firmware + WAN_FIRMWARE_DIR=/etc/wanpipe/firmware fi if [ ! -d $WAN_FIRMWARE_DIR ]; then @@ -1355,7 +1356,7 @@ function get_bin_dir () echo -e "\nERROR: Directory $WAN_FIRMWARE_DIR not found !\n" getyn "Would you like to try again?" if [ $? -ne 0 ]; then - WAN_FIRMWARE_DIR=$WAN_CONF_DIR/firmware + WAN_FIRMWARE_DIR=/etc/wanpipe/firmware else get_bin_dir fi @@ -1368,7 +1369,7 @@ function get_intr_dir () local response=no local response1 - WAN_INTR_DIR=$WAN_CONF_DIR/interfaces + WAN_INTR_DIR=/etc/wanpipe/interfaces if [ ! -d $WAN_INTR_DIR ]; then \mkdir -p $WAN_INTR_DIR @@ -1404,7 +1405,7 @@ function get_intr_dir () echo -n "" read response1 - WAN_INTR_DIR=$WAN_CONF_DIR/interfaces + WAN_INTR_DIR=/etc/wanpipe/interfaces if [ $response1 ]; then WAN_INTR_DIR=$response1 @@ -1418,7 +1419,7 @@ function get_intr_dir () echo -e "\nERROR: Directory $WAN_INTR_DIR not found !\n" getyn "Would you like to try again?" if [ $? -ne 0 ]; then - WAN_INTR_DIR=$WAN_CONF_DIR/interfaces + WAN_INTR_DIR=/etc/wanpipe/interfaces else get_intr_dir fi @@ -1440,7 +1441,7 @@ create_mataconf() elif [ -d /var/adm wanpipe1]; then LOG_FILE=/var/adm/$PROD else - LOG_FILE=$WAN_CONF_DIR/$PROD.log + LOG_FILE=/etc/wanpipe/$PROD.log fi # Select directory for the lock file. @@ -1451,20 +1452,20 @@ create_mataconf() LOCK_FILE=/var/lock/$PROD LOCK_DIR=/var/lock else - LOCK_FILE=$WAN_CONF_DIR/$PROD.lck - LOCK_DIR=$WAN_CONF_DIR + LOCK_FILE=/etc/wanpipe/$PROD.lck + LOCK_DIR=/etc/wanpipe fi - if [ -f $ROOT$WAN_CONF_DIR/wanrouter.rc ]; then - . $ROOT$WAN_CONF_DIR/wanrouter.rc + if [ -f $ROOT/etc/wanpipe/wanrouter.rc ]; then + . /etc/wanpipe/wanrouter.rc fi if [ "$WAN_DEVICES" = "" ]; then WAN_DEVICES="wanpipe1" else echo - echo "Wanpipe META config file found in $WAN_CONF_DIR directory" + echo "Wanpipe META config file found in /etc/wanpipe directory" echo echo "Wanpipe startup sequence: $WAN_DEVICES" echo @@ -1518,11 +1519,11 @@ create_mataconf() fi cat > $META_CONF << ENDOFTEXT -#!/bin/bash +#!/bin/sh # router.rc WAN router meta-configuration file. # # This file defines variables used by the router shell scripts -# and should be located in $WAN_CONF_DIR directory. These are: +# and should be located in /etc/wanpipe directory. These are: # # ROUTER_BOOT = Boot flag (YES/NO). # WAN_CONF_DIR = Where to put wanpipe config files. @@ -1553,13 +1554,13 @@ ENDOFTEXT echo "WAN_LOCK_DIR=$LOCK_DIR" >> $META_CONF echo "WAN_IP_FORWARD=$ENABLE_IP_FWD" >> $META_CONF echo "NEW_IF_TYPE=$NEW_IF_TYPE" >> $META_CONF - echo "WAN_LIB_DIR=$WAN_CONF_DIR/lib" >> $META_CONF - echo "WAN_ADSL_LIST=$WAN_CONF_DIR/wan_adsl.list" >> $META_CONF + echo "WAN_LIB_DIR=/etc/wanpipe/lib" >> $META_CONF + echo "WAN_ADSL_LIST=/etc/wanpipe/wan_adsl.list" >> $META_CONF echo "WAN_ANNEXG_LOAD=$ANNEXG_LOAD" >> $META_CONF echo "WAN_SCTP_LOAD=$SCTP_LOAD" >> $META_CONF echo "WAN_LIP_LOAD=$LIP_LOAD" >> $META_CONF echo "WAN_DYN_WANCONFIG=NO" >> $META_CONF - echo "WAN_SCRIPTS_DIR=$WAN_CONF_DIR/scripts" >> $META_CONF + echo "WAN_SCRIPTS_DIR=/etc/wanpipe/scripts" >> $META_CONF echo "WAN_FIRMWARE_DIR=$WAN_FIRMWARE_DIR" >> $META_CONF echo "WAN_DEVICES_REV_STOP_ORDER=YES" >> $META_CONF echo "WAN_DEVICES=\"$WAN_DEVICES\"" >> $META_CONF @@ -1568,19 +1569,19 @@ ENDOFTEXT } # ---------------------------------------------------------------------------- -# Install initialization scripts. +#Install initialization scripts. # ---------------------------------------------------------------------------- install_init() { - if [ "$PKG_NAME" = "wanpipe-lite" ]; then + if [ "$PKG_NAME" = "wanpipe-lite" ]; then return 0 fi if [ $NO_AUTO_START -eq 1 ]; then return 0; fi - banner + banner cat << ENDOFTEXT WANPIPE BOOTSTRAP CONFIGURATION @@ -1594,35 +1595,35 @@ i.e. By selecting this option WANPIPE will startup on system bootup and stop on system shutdown. ENDOFTEXT - - getyn "Would you like to install WANPIPE start-up scripts?" || return 0 - - cd $PROD_HOME/util/wancfg_zaptel - eval "./wancfg_zaptel.pl --silent --install_boot_script" - - if [ $? -ne 0 ]; then - echo "Failed to install boot scripts" - fi - - if [ "$TDM_PROT" = "YES" ]; then + + getyn "Would you like to install WANPIPE start-up scripts?" || return 0 + + cd $PROD_HOME/util/wancfg_zaptel + eval "./wancfg_zaptel.pl --silent --install_boot_script" + + if [ $? -ne 0 ]; then + echo "Failed to install boot scripts" + fi + + if [ "$TDM_PROT" = "YES" ]; then getyn "Would you like to auto-execute ztcfg after wanrouter start?" || return 0 - if [ ! -d $WAN_CONF_DIR/scripts ]; then - eval "\mkdir -p $WAN_CONF_DIR/scripts >/dev/null 2>/dev/null" + if [ ! -d $ROOT$WAN_CONF_DIR/scripts ]; then + eval "\mkdir -p $ROOT$WAN_CONF_DIR/scripts >/dev/null 2>/dev/null" fi - eval "\cp -f $PROD_HOME/samples/wanpipe_zaptel_start $WAN_CONF_DIR/scripts/start > /dev/null 2> /dev/null" - if [ ! -f $WAN_CONF_DIR/scripts/start ]; then + eval "\cp -f $PROD_HOME/samples/wanpipe_zaptel_start $ROOT$WAN_CONF_DIR/scripts/start > /dev/null 2> /dev/null" + if [ ! -f $ROOT$WAN_CONF_DIR/scripts/start ]; then echo "Error: Could not copy auto-ztcfg script" fi fi - cd $PROD_HOME - + cd $PROD_HOME + } + # ---------------------------------------------------------------------------- # Old Install initialization scripts. # ---------------------------------------------------------------------------- - install_init_old() { if [ "$PKG_NAME" = "wanpipe-lite" ]; then @@ -1695,8 +1696,8 @@ ENDOFTEXT getyn "Would you like to auto-execute ztcfg after wanrouter start?" || return 0 if [ ! -d $WAN_CONF_DIR/scripts ]; then eval "\mkdir -p $WAN_CONF_DIR/scripts >/dev/null 2>/dev/null" - fi - eval "\cp -f $PROD_HOME/samples/wanpipe_zaptel_start $WAN_CONF_DIR/scripts/start > /dev/null 2> /dev/null" + fi + eval "\cp -f $PROD_HOME/samples/wanpipe_zaptel_start $WAN_CONF_DIR/scripts/start >/dev/null 2>/dev/null" if [ ! -f $WAN_CONF_DIR/scripts/start ]; then echo "Error: Could not copy auto-ztcfg script" fi @@ -1757,11 +1758,11 @@ remove() #FIXME: Find a better way of doing this if [ "$PKG_NAME" != "wanpipe-lite" ]; then - if [ -d $WAN_CONF_DIR ]; then - rm -rf $WAN_CONF_DIR + if [ -d /etc/wanpipe ]; then + rm -rf /etc/wanpipe fi else - IFCFG_LIST=`ls $WAN_CONF_DIR/ifcfg-* 2>/dev/null` + IFCFG_LIST=`ls /etc/wanpipe/ifcfg-* 2>/dev/null` for ifcfg in $IFCFG_LIST; do [ -f "$ifcfg" ] && rm -f $ifcfg done @@ -1846,7 +1847,7 @@ WANPIPE utilities are used to: 4) debug line, protocol and driver problems. (/usr/sbin/wanpipemon) 5) aid in WANPIPE API development - ($WAN_CONF_DIR/api) + (/etc/wanpipe/api) Refer to the WanpipeInstallation.(pdf/txt) for more information. @@ -1915,6 +1916,7 @@ WARNING: The Linux source in $SOURCEDIR has not been configured. MAKEINC=$MAKEINC" ENABLE_WANPIPEMON_ZAP=YES " fi eval "make CC=$CC SYSINC=$SOURCEDIR/include WANINCDIR=$WANPIPE_INCLUDE_DIR $MAKEINC >> $CMP_LOG 2>> $CMP_LOG" + #eval "make CC=$CC SYSINC=$DRIVER_INC_DIR WANINCDIR=$WANPIPE_INCLUDE_DIR $MAKEINC >> $CMP_LOG 2>> $CMP_LOG" if [ $? -eq 0 ] then @@ -1922,6 +1924,7 @@ WARNING: The Linux source in $SOURCEDIR has not been configured. else echo echo "make CC=$CC SYSINC=$SOURCEDIR/include $MAKEINC" + echo "make CC=$CC SYSINC=$SOURCEDIR/include $MAKEINC" echo echo -e "Failed!\n" echo -e "\n\t\t!!! ${DISTR_NAME} Tools Compilation Failed !!!" @@ -1996,8 +1999,37 @@ WARNING: The Linux source in $SOURCEDIR has not been configured. if [ $superuser = "YES" ] && [ -z $ROOT ]; then eval "ldconfig > /dev/null 2> /dev/null" - fi + fi + #Default install in /usr/lib no need for additional +# if [ 0 ]; then +# if [ $superuser = "YES" ]; then +# if [ -d /etc/ld.so.conf.d ]; then +# if [ ! -e $ROOT/etc/ld.so.conf.d/ ]; then +# \mkdir -p $ROOT/etc/ld.so.conf.d/ +# fi +# \cp -f libsangoma.so.conf $ROOT/etc/ld.so.conf.d/ +# +# if [ $superuser = "YES" ]; then +# eval "ldconfig" +# fi +# elif [ -f /etc/ld.so.conf ]; then +# if [ $superuser = "YES" ]; then +# cat /etc/ld.so.conf libsangoma.so.conf > ldconf.$$ +# mv ldconf.$$ /etc/ld.so.conf +# eval "ldconfig" +# fi +# else +# echo +# echo "Warning: LD Conf files not found in /etc directory" +# echo "Please add /usr/local/lib to the LD_LIBRARY_PATH" +# echo +# eval "ldconfig" +# pause +# fi +# fi +# fi + echo echo -n "Compiling WANPIPE API Development Utilities ..." @@ -2382,7 +2414,7 @@ function build_wanec_module () local files="wanec_iface wanec_cmd wanec_utils wanec_dev $BTDIR/octapi_bt0 $LARGMATHDIR/octapi_largmath $LLMANDIR/octapi_llman $OCTAPIMIDIR/oct6100_mask_interrupts $OCTAPIDIR/oct6100_adpcm_chan $OCTAPIDIR/oct6100_channel $OCTAPIDIR/oct6100_chip_open $OCTAPIDIR/oct6100_chip_stats $OCTAPIDIR/oct6100_conf_bridge $OCTAPIDIR/oct6100_debug $OCTAPIDIR/oct6100_events $OCTAPIDIR/oct6100_interrupts $OCTAPIDIR/oct6100_memory $OCTAPIDIR/oct6100_miscellaneous $OCTAPIDIR/oct6100_mixer $OCTAPIDIR/oct6100_phasing_tsst $OCTAPIDIR/oct6100_playout_buf $OCTAPIDIR/oct6100_remote_debug $OCTAPIDIR/oct6100_tlv $OCTAPIDIR/oct6100_tone_detection $OCTAPIDIR/oct6100_tsi_cnct $OCTAPIDIR/oct6100_tsst $OCTAPIDIR/oct6100_user " - eval "make SUBDIRS=$PWD clean >> $CMP_BUILD 2>> $CMP_BUILD" + eval "make SUBDIRS=$PWD clean >> $CMP_BUILD 2>> $CMP_BUILD " if [ $KERN_VER -eq 24 ]; then if [ -e wanectmp ]; then @@ -2533,23 +2565,28 @@ function select_compilation_mode() 3. TDM Voice (Zaptel) + WAN Protocol Support -4. SMG (SS7) (Default for Asterisk/CallWeaver SMG/SS7 install) +4. SMG (SS7) (Default for Asterisk SMG/SS7 install) 5. SMG (SS7) + TDM Voice (Zaptel) - Default for: Asterisk/CallWeaver SS7 + PRI + Default for: Asterisk SS7 + PRI -6. TDM API +6. SMG (BRI) (Default for Asterisk SMG/BRI install) + +7. SMG (BRI) + TDM Voice (Zaptel) + Default for: Asterisk BRI + PRI + Analog + +8. TDM API Protocols: TDM API on AFT adapters: Default for: FreeSwitch, Yate, Sunrise Custom voice development -7. Custom Compilation Mode +9. Custom Compilation Mode Specify protocols to be added into the WANPIPE kernel drivers. ENDOFTEXT -echo -n "Please select (1,2,3,4,5,6 or 7) [Default: 1]: " +echo -n "Please select (1,2,3,4,5,6,7,8 or 9) [Default: 1]: " if test -z $NONINTERACTIVE; then @@ -2583,8 +2620,14 @@ if test -z $NONINTERACTIVE; then elif [ "$response" -eq 6 ]; then enable_protocols "AFT_TE1" + SSMG_BRI=YES elif [ "$response" -eq 7 ]; then + enable_protocols "AFT_TE1" + enable_protocols "TDM" + SSMG_BRI=YES + + elif [ "$response" -eq 9 ]; then enable_custom_protocols else select_compilation_mode @@ -3321,35 +3364,20 @@ CFLAGS="$CC -Wp,-MD,.wanpipe.o.d -nostdinc -iwithprefix include -D__LINUX__ -Dli -e s/s390x/s390/ -e s/parisc64/parisc/ \ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ ) - #New way of checking REGPARM because its enabled - #by default on 2.6.20 kernel and up - if [ $SUBARCH != "" ]; then - if [ -f $SOURCEDIR/arch/$SUBARCH/Makefile ]; then - eval "grep \"CFLAGS.*=.*regparm\" $SOURCEDIR/arch/$SUBARCH/Makefile*" > /dev/null 2> /dev/null - res=$? - elif [ -d $SOURCEDIR/arch/x86 ]; then - eval "grep \"CFLAGS.*=*regparm\" $SOURCEDIR/arch/x86/Makefile*" > /dev/null 2> /dev/null - res=$? - else - echo - echo "Warning: Failed to determine regparm from Makefile defaulting to YES!" - echo - res=0 - fi - if [ $res -eq 0 ]; then - echo -e "Enabled.\n" - REGPARM_OPT=".regparm" - else - echo -e "Disabled.\n" - fi - else - echo - echo "Warning: Failed to determine ARCH: regparm defaulting to YES!" - echo - REGPARM_OPT=".regparm" - echo -e "Enabled.\n" - fi + #New way of checking REGPARM because its enabled + #by default on 2.6.20 kernel and up + if [ $SUBARCH != "" ]; then + eval "grep \"CFLAGS.*=.*-pipe.*regparm\" $SOURCEDIR/arch/$SUBARCH/Makefile" > /dev/null 2> /dev/null + if [ $? -eq 0 ]; then + echo -e "Enabled.\n" + REGPARM_OPT=".regparm" + else + echo -e "Disabled.\n" + fi + else + echo -e "Disabled.\n" + fi fi @@ -3441,7 +3469,7 @@ CFLAGS="$CC -Wp,-MD,.wanpipe.o.d -nostdinc -iwithprefix include -D__LINUX__ -Dli eval "$CFLAGS $PROTOCOL_DEFINES -DKBUILD_BASENAME=sdla_abstr -DKBUILD_MODNAME=wanpipe_lite \ -c -o tmp/wanpipe_abstr.o wanpipe_abstr.c" eval "$CFLAGS $PROTOCOL_DEFINES -DKBUILD_BASENAME=sdladrv -DKBUILD_MODNAME=wanpipe_lite \ - -c -o tmp/sdladrv.o sdladrv.c sdladrv_fe.c" + -c -o tmp/sdladrv.o sdladrv.c sdladrv_fe.c sdladrv_utils.c" eval "$CFLAGS $PROTOCOL_DEFINES -DKBUILD_BASENAME=sdla_xilinx -DKBUILD_MODNAME=wanpipe_lite \ -c -o tmp/sdla_xilinx.o sdla_xilinx.c" eval "$CFLAGS $PROTOCOL_DEFINES -DKBUILD_BASENAME=sdla_aft_te1 -DKBUILD_MODNAME=wanpipe_lite \ @@ -3491,7 +3519,7 @@ CFLAGS="$CC -Wp,-MD,.wanpipe.o.d -nostdinc -iwithprefix include -D__LINUX__ -Dli cat < $PROD_HOME/Compile_Setup.sh -#!/bin/bash +#!/bin/sh if [ -e kdrvcmp ]; then rm -rf kdrvcmp @@ -3525,7 +3553,7 @@ ENDOFTEXT tmp=${CFLAGS/$CC/} cat < $PROD_HOME/Compile.sh -#!/bin/bash +#!/bin/sh make CFLAGS="$tmp" PROTOCOL_DEFINES="$PROTOCOL_DEFINES" @@ -3542,7 +3570,7 @@ WANPIPE_OBJS= rm -f sdladrv_src.c ln -s sdladrv.c sdladrv_src.c - build_kernel_module sdladrv "sdladrv_src sdladrv_fe" + build_kernel_module sdladrv "sdladrv_src sdladrv_fe sdladrv_utils" build_kernel_module wanrouter "wanmain wanproc waniface" @@ -3737,7 +3765,8 @@ WANPIPE_OBJS= if [ "$TDM_PROT" = "YES" ]; then \cp $DRIVER_UPDATE_DIR/src/net/sdla_tdmv.c . \cp $DRIVER_UPDATE_DIR/src/net/sdla_remora_tdmv.c . - WANPIPE_OBJS=$WANPIPE_OBJS"sdla_tdmv sdla_remora_tdmv " + \cp $DRIVER_UPDATE_DIR/src/net/sdla_bri_tdmv.c . + WANPIPE_OBJS=$WANPIPE_OBJS"sdla_tdmv sdla_remora_tdmv sdla_bri_tdmv " WANPIPE_EXTRA_CFLAGS=$WANPIPE_EXTRA_CFLAGS"-I$ZAPTEL_SOURCE_DIR " fi @@ -3745,6 +3774,14 @@ WANPIPE_OBJS= WANPIPE_OBJS=$WANPIPE_OBJS"sdla_xilinx sdla_aft_te1 aft_a104 sdla_remora aft_analog " fi + if [ "$AFT_BRI_PROT" = "YES" ]; then + WANPIPE_OBJS=$WANPIPE_OBJS"sdla_bri aft_bri " + fi + + if [ "$AFT_SERIAL_PROT" = "YES" ]; then + WANPIPE_OBJS=$WANPIPE_OBJS"sdla_serial " + fi + if [ "$AFT_TE3_PROT" = "YES" ]; then WANPIPE_OBJS=$WANPIPE_OBJS"sdla_aft_te3 " fi @@ -4159,7 +4196,7 @@ WANPIPE_OBJS= cat < $CMP_INSTALL -#!/bin/bash +#!/bin/sh mv *.ko mod/ > /dev/null 2> /dev/null @@ -4204,7 +4241,7 @@ ENDOFTEXT chmod 755 $CMP_INSTALL cat < .clean.$$ -#!/bin/bash +#!/bin/sh rm -f *.ko rm -f tmp/*.*o @@ -4371,7 +4408,7 @@ function install_chan_woomera() if [ "$install_failures" = "" ]; then echo - echo "Installatoin Complete" + echo "Installation Complete" echo else echo @@ -4389,6 +4426,63 @@ function install_chan_woomera() return 0 } +function install_ssmg_bri() +{ + + if [ $SSMG_BRI != "YES" ]; then + return 0 + fi + + SSMG="YES" + eval "install_ssmg" + if [ $? -ne 0 ]; then + echo "-------------------------------------" + echo "Error: SMG Libraries Failed to install" + echo "Please Contact Sangoma Support!" + echo "-------------------------------------" + exit 1; + fi + echo + + cd $PROD_HOME/$SSMG_DIR + cd sangoma_mgd.trunk + + echo "Installing SMG Daemon..." + echo + if [ -z $ROOT ]; then + eval "./install -noss7" + else + eval "./install -noss7 -rootdir $ROOT" + fi + if [ $? -ne 0 ]; then + echo "-------------------------------------" + echo "Error: SMG Failed to install" + echo "Please Contact Sangoma Support!" + echo "-------------------------------------" + exit 1; + fi + echo + + cd $PROD_HOME/$SSMG_DIR + cd sangoma_bri + echo + echo "Installing SMG BRI Daemon..." + eval "make INSTALLPREFIX=$ROOT install > /dev/null " + + echo + echo "----------------------------------------" + echo "Sangoma BRI Installation Complete" + echo + echo " -> To configure for BRI run:" + echo " -> /usr/bin/wancfg_smg" + echo + echo "----------------------------------------" + echo + install_smg_samples_bri + pause +} + + function install_ssmg () { if [ "$SSMG" != "YES" ]; then @@ -4399,35 +4493,16 @@ function install_ssmg () banner - echo "Installing LibSangoma Library..." - - cd libsangoma.trunk - eval "./configure; make clean; make; make install" > /dev/null - if [ $? -ne 0 ]; then - echo "FAILED" - return 1 - fi - - if [ -d /etc/ld.so.conf.d ]; then - \cp -f libsangoma.so.conf /etc/ld.so.conf.d/ - eval "ldconfig" - elif [ -f /etc/ld.so.conf ]; then - cat /etc/ld.so.conf libsangoma.so.conf > ldconf.$$ - mv ldconf.$$ /etc/ld.so.conf - eval "ldconfig" - else - echo "Warning: LD Conf files not found in /etc directory" - echo "Please add /usr/local/lib to the LD_LIBRARY_PATH" - echo - pause - fi - - echo "Installing LibSangoma Library...DONE" - echo - cd $PROD_HOME/$SSMG_DIR cd sangoma_mgd.trunk + if [ $superuser = "YES" ] && [ -z $ROOT ]; then + eval "find /usr/local/lib -name 'libteletone*' > /dev/null 2>/dev/null" + if [ $? -eq 0 ]; then + eval "find /usr/local/lib -name 'libteletone*' | xargs rm > /dev/null 2>/dev/null" + fi + fi + echo "Installing Sangoma Media Gateway Daemon..." cd lib/libteletone/ eval "./configure --prefix=$ROOT/usr; make clean; make CC=$CC; make install " > /dev/null @@ -4435,24 +4510,29 @@ function install_ssmg () echo "FAILED" return 1 fi - if [ $superuser = "YES" ]; then eval "ldconfig" fi - cd $PROD_HOME/$SSMG_DIR - cd sangoma_mgd.trunk + if [ $SSMG_BRI != "YES" ]; then + install_smg_samples_ss7 + fi +} + +function install_smg_samples_bri() +{ getyn "Add Woomera config in Asterisk Extensions and Iax Conf" if [ $? -ne 0 ]; then return 0; fi - + cd $PROD_HOME/$SSMG_DIR + cd sangoma_mgd.trunk if [ -f $ROOT/etc/asterisk/extensions.conf ]; then - eval "grep -i woomera $ROOT/etc/asterisk/extensions.conf 2> /dev/null > /dev/null" + eval "grep -i outb-bri $ROOT/etc/asterisk/extensions.conf 2> /dev/null > /dev/null" if [ $? -ne 0 ]; then - cat $ROOT/etc/asterisk/extensions.conf ./conf/woomera_ext.conf > conf.$$ + cat $ROOT/etc/asterisk/extensions.conf ./conf_bri/woomera_ext.conf > conf.$$ mv conf.$$ $ROOT/etc/asterisk/extensions.conf echo "Asterisk extensions.conf file updated with woomera config" else @@ -4462,9 +4542,47 @@ function install_ssmg () fi if [ -f $ROOT/etc/asterisk/iax.conf ]; then - eval "grep -i ss7 $ROOT/etc/asterisk/iax.conf 2> /dev/null > /dev/null" + eval "grep -i outb-bri $ROOT/etc/asterisk/iax.conf 2> /dev/null > /dev/null" if [ $? -ne 0 ]; then - cat $ROOT/etc/asterisk/iax.conf ./conf/woomera_iax.conf > conf.$$ + cat $ROOT/etc/asterisk/iax.conf ./conf_bri/woomera_iax.conf > conf.$$ + mv conf.$$ $ROOT/etc/asterisk/iax.conf + echo "Asterisk iax.conf file updated with bri guest config" + else + echo "Asterisk iax.conf already updated" + fi + fi + + pause + + return 0 +} + + + +function install_smg_samples_ss7() +{ + cd $PROD_HOME/$SSMG_DIR + cd sangoma_mgd.trunk + getyn "Add Woomera config in Asterisk Extensions and Iax Conf" + if [ $? -ne 0 ]; then + return 0; + fi + if [ -f $ROOT/etc/asterisk/extensions.conf ]; then + eval "grep -i outb-ss7 $ROOT/etc/asterisk/extensions.conf 2> /dev/null > /dev/null" + if [ $? -ne 0 ]; then + cat $ROOT/etc/asterisk/extensions.conf ./conf_ss7/woomera_ext.conf > conf.$$ + mv conf.$$ $ROOT/etc/asterisk/extensions.conf + echo "Asterisk extensions.conf file updated with woomera config" + else + echo "Asterisk extensions.conf already updated" + + fi + fi + + if [ -f $ROOT/etc/asterisk/iax.conf ]; then + eval "grep -i outb-ss7 $ROOT/etc/asterisk/iax.conf 2> /dev/null > /dev/null" + if [ $? -ne 0 ]; then + cat $ROOT/etc/asterisk/iax.conf ./conf_ss7/woomera_iax.conf > conf.$$ mv conf.$$ $ROOT/etc/asterisk/iax.conf echo "Asterisk iax.conf file updated with ss7 guest config" else @@ -4472,7 +4590,6 @@ function install_ssmg () fi fi - pause return 0 @@ -4494,7 +4611,7 @@ function install_all () if [ "$PKG_NAME" = "wanpipe-lite" ]; then cd $PROD_HOME - \cp -rf samples $ROOT$WAN_CONF_DIR + \cp -rf samples $ROOT/etc/wanpipe install -D -m 755 $PROD_HOME/scripts/wanlite $ROOT/usr/sbin/wanlite pause return 0 @@ -4505,20 +4622,20 @@ function install_all () cd $PROD_HOME/util/misc make install WAN_VIRTUAL=$ROOT > /dev/null 2> /dev/null - echo "Installing wanrouter.rc in $ROOT$WAN_CONF_DIR" + echo "Installing wanrouter.rc in $ROOT/etc/wanpipe" cd $PROD_HOME - install -D -m 644 wanrouter.rc $ROOT$WAN_CONF_DIR/wanrouter.rc + install -D -m 644 wanrouter.rc $ROOT/etc/wanpipe/wanrouter.rc - echo "Installing wanpipe libraries in $ROOT$WAN_CONF_DIR" + echo "Installing wanpipe libraries in $ROOT/etc/wanpipe" - \mkdir -p $ROOT$WAN_CONF_DIR/lib/ - \cp -f $PROD_HOME/util/wancfg_legacy/lib/* $ROOT$WAN_CONF_DIR/lib/ + \mkdir -p $ROOT/etc/wanpipe/lib/ + \cp -f $PROD_HOME/util/wancfg_legacy/lib/* $ROOT/etc/wanpipe/lib/ - echo "Installing firmware in $ROOT$WAN_CONF_DIR/firmware" - \cp -rf firmware $ROOT$WAN_CONF_DIR/ + echo "Installing firmware in $ROOT/etc/wanpipe/firmware" + \cp -rf firmware $ROOT/etc/wanpipe/ - if [ ! -f $ROOT$WAN_CONF_DIR/interfaces ]; then - \mkdir -p $ROOT$WAN_CONF_DIR/interfaces + if [ ! -f $ROOT/etc/wanpipe/interfaces ]; then + \mkdir -p $ROOT/etc/wanpipe/interfaces fi echo "Installing documentation in $ROOT/usr/share/doc/wanpipe" @@ -4528,10 +4645,9 @@ function install_all () \cp -f doc/* $ROOT/usr/share/doc/wanpipe \cp -f README* $ROOT/usr/share/doc/wanpipe - echo "Installing sample api code in $ROOT$WAN_CONF_DIR/api" - \cp -rf api $ROOT$WAN_CONF_DIR - \cp -rf samples $ROOT$WAN_CONF_DIR - + echo "Installing sample api code in $ROOT/etc/wanpipe/api" + \cp -rf api $ROOT/etc/wanpipe + \cp -rf samples $ROOT/etc/wanpipe echo "Installing AFT Firmware update utility in $ROOT$WAN_CONF_DIR/util" \cp -rf util/wanec_apilib/ $ROOT$WAN_CONF_DIR/util @@ -4543,22 +4659,20 @@ function install_all () fi \ln -s ../util/wan_aftup wan_aftup - cd $PROD_HOME - - if [ ! -d $ROOT$WAN_CONF_DIR/scripts ]; then - \mkdir -p $ROOT$WAN_CONF_DIR/scripts + if [ ! -d $ROOT/etc/wanpipe/scripts ]; then + \mkdir -p $ROOT/etc/wanpipe/scripts fi - echo "Installing driver headers in $ROOT$WAN_CONF_DIR/api/include/linux" - if [ ! -d $ROOT$WAN_CONF_DIR/api/include/linux ]; then - \mkdir -p $ROOT$WAN_CONF_DIR/api/include/linux + echo "Installing driver headers in $ROOT/etc/wanpipe/api/include/linux" + if [ ! -d $ROOT/etc/wanpipe/api/include/linux ]; then + \mkdir -p $ROOT/etc/wanpipe/api/include/linux fi cd $PROD_HOME if [ -d wan_ec ]; then - cp -rf wan_ec $ROOT$WAN_CONF_DIR + cp -rf wan_ec $ROOT/etc/wanpipe echo "Installing Hardware Echo Cancel Utilites" cd util/wanec_client make install WAN_VIRTUAL=$ROOT > /dev/null 2> /dev/null @@ -4573,11 +4687,11 @@ function install_all () cd $PROD_HOME - if [ ! -f $ROOT$WAN_CONF_DIR/api/include/linux/ ]; then - \mkdir -p $ROOT$WAN_CONF_DIR/api/include/linux/ + if [ ! -f $ROOT/etc/wanpipe/api/include/linux/ ]; then + \mkdir -p $ROOT/etc/wanpipe/api/include/linux/ fi - \cp -f $DRIVER_UPDATE_DIR/include/*.* $ROOT$WAN_CONF_DIR/api/include/linux/ + \cp -f $DRIVER_UPDATE_DIR/include/*.* $ROOT/etc/wanpipe/api/include/linux/ pause return 0 @@ -4601,7 +4715,7 @@ function uninstall_all () cd $PROD_HOME rm -f $ROOT/usr/sbin/wp_pppconfig rm -rf $ROOT/usr/doc/wanpipe - rm -rf $ROOT/$WAN_CONF_DIR + rm -rf $ROOT/etc/wanpipe pause return 0 @@ -4857,53 +4971,48 @@ search_and_replace() } function tdmv_get_zaptel_path () { + if [ $ZAPTEL_PATH_OP != "YES" ]; then find_zap_dirs fi - if [ 0 ]; then - if [ $ZAPTEL_PATH_OP != "YES" ]; then - echo - echo -e "\nPlease specify absolute path to Zaptel source directory" - echo -e "\n[default:$ZAPTEL_SOURCE_DIR]\n" - echo -n " " - if [ ! -d $ZAPTEL_SOURCE_DIR ]; then - echo -e "Warning: $ZAPTEL_SOURCE_DIR does not exist\n" - fi - if test -z $NONINTERACTIVE; then - read response - - [ $response ] && { - ZAPTEL_SOURCE_DIR=$response - } - fi - fi - - #Check if this post Zaptel-1.4.9 - if [ -d $ZAPTEL_SOURCE_DIR/kernel ]; then - ZAPTEL_INSTALL_DIR=$ZAPTEL_SOURCE_DIR - ZAPTEL_SOURCE_DIR=$ZAPTEL_SOURCE_DIR/kernel - else - if [ -z $ZAPTEL_INSTALL_DIR ]; then - ZAPTEL_INSTALL_DIR=$ZAPTEL_SOURCE_DIR - fi +if [ 0 ]; then + if [ $ZAPTEL_PATH_OP != "YES" ]; then + echo + echo -e "\nPlease specify absolute path to Zaptel source directory" + echo -e "\n[default:$ZAPTEL_INSTALL_DIR]\n" + echo -n " " + if [ ! -d $ZAPTEL_INSTALL_DIR ]; then + echo -e "Warning: $ZAPTEL_INSTALL_DIR does not exist\n" fi - - if [ ! -f $ZAPTEL_SOURCE_DIR/zaptel.h ]; then - echo " Zaptel source not found in $ZAPTEL_INSTALL_DIR" - ZAPTEL_SOURCE_DIR="/usr/src/zaptel" - ZAPTEL_INSTALL_DIR=$ZAPTEL_SOURCE_DIR - if test $NONINTERACTIVE; then - return 1 - else - getyn " Press Y to specify another Zaptel source directory, N to exit" - if [ $? -ne 0 ]; then - exit 1; - fi - tdmv_get_zaptel_path - fi - fi - fi + if test -z $NONINTERACTIVE; then + read response + + [ $response ] && { + ZAPTEL_INSTALL_DIR=$response + if [ -d $ZAPTEL_INSTALL_DIR/kernel ]; then + ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR/kernel + else + ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR + fi + } + fi + fi + if [ ! -f $ZAPTEL_SOURCE_DIR/zaptel.h ]; then + echo " Zaptel source not found in $ZAPTEL_SOURCE_DIR" + ZAPTEL_SOURCE_DIR="/usr/src/zaptel" + ZAPTEL_INSTALL_DIR=$ZAPTEL_SOURCE_DIR + if test $NONINTERACTIVE; then + return 1 + else + getyn " Press Y to specify another Zaptel source directory, N to exit" + if [ $? -ne 0 ]; then + exit 1; + fi + tdmv_get_zaptel_path + fi + fi +fi #zaptel.c renamed to zaptel-base.c in zaptel v1.2.13 and later if [ -e $ZAPTEL_SOURCE_DIR/zaptel-base.c ]; then ZAPTEL_C_FILE="zaptel-base.c"; @@ -4986,8 +5095,8 @@ function tdmv_apply_zaptel_dchan_patch_old () function tdmv_apply_zaptel_chunk_patch () { lhome=`pwd` TEMP=tmp - cd $ZAPTEL_SOURCE_DIR - echo "Applying Zaptel Chunk patch..." + cd $ZAPTEL_SOURCE_DIR + echo "Applying Zaptel Chunk patch..." echo " " #modify zaptel.h eval "cat zaptel.h | sed '/^#define ZT_CHUNKSIZE/c\#define ZT_CHUNKSIZE $ZAP_CHUNK' >$TEMP 2>/dev/null" @@ -5005,7 +5114,6 @@ function tdmv_apply_zaptel_chunk_patch () { fi fi - cd $ZAPTEL_INSTALL_DIR #remove wct4xxp module from Makefile eval "cat Makefile |sed 's/wct1xxp wct4xxp wcte11xp/wct1xxp wcte11xp/g'>$TEMP 2>/dev/null " if [ $? -ne 0 ]; then @@ -5022,6 +5130,7 @@ function tdmv_apply_zaptel_chunk_patch () { fi fi + cd $ZAPTEL_INSTALL_DIR eval "cat Makefile |sed 's/^SUBDIR_MODULES:=.*//g'>$TEMP 2>/dev/null " if [ $? -ne 0 ]; then echo " Failed to remove wct4xxp from Makefile" @@ -5418,12 +5527,11 @@ function find_zap_dirs () echo echo "Looking for zaptel directory in /usr/src ..." echo "-------------------------------------------" - if [ "$zapdirs" = "" ]; then zapdirs=`find /usr/src -maxdepth 2 -name 'zaptel*' | xargs ` - if [ -d "/usr/src/zaptel" ]; then - zapdirs="/usr/src/zaptel "$zapdirs - fi + if [ -d "/usr/src/zaptel" ]; then + zapdirs="/usr/src/zaptel "$zapdirs + fi fi @@ -5432,6 +5540,7 @@ function find_zap_dirs () if [ -f $PROD_HOME/zaptel/zaptel.path ]; then zapextradir=`cat $PROD_HOME/zaptel/zaptel.path` fi + cnt=1 for dir in $zapdirs do @@ -5439,21 +5548,21 @@ function find_zap_dirs () continue fi - if [ ! -f $dir/zaptel.h ] && [ ! -f $dir/kernel/zaptel.h ];then + if [ ! -f $dir/zaptel.h ] && [ ! -f $dir/kernel/zaptel.h ]; then continue; fi - + if [ "$dir" = "/usr/src/zaptel" ] && [ $cnt -ne 1 ]; then - continue; - fi + continue; + fi + zapdir_array[$cnt]=$dir; echo "$cnt : $dir " cnt=$((cnt+1)) done - if [ $cnt -eq 1 ]; then echo echo "No zaptel dirs found in /usr/src " @@ -5468,7 +5577,7 @@ function find_zap_dirs () continue fi - if [ ! -f $dir/zaptel.h ]; then + if [ ! -f $dir/zaptel.h ] && [ ! -f $dir/kernel/zaptel.h ]; then continue; fi @@ -5487,7 +5596,6 @@ function find_zap_dirs () echo "(ctrl-c to Exit)" echo -n "Please select working zaptel directory [1-$((cnt-1))][m]: " - response=1 if [ -z $NONINTERACTIVE ] || [ $zaptel_auto_install = "YES" ]; then @@ -5503,9 +5611,9 @@ function find_zap_dirs () read response if [ "$response" = "" ]; then - ZAPTEL_SOURCE_DIR=$ZAPTEL_DFLT_INSTALL_DIR + ZAPTEL_INSTALL_DIR=$ZAPTEL_DFLT_INSTALL_DIR else - ZAPTEL_SOURCE_DIR=$response + ZAPTEL_INSTALL_DIR=$response fi zapdir_manual=1 @@ -5515,19 +5623,18 @@ function find_zap_dirs () # return 1; elif [ $response -gt 0 ] && [ $response -lt $cnt ]; then - ZAPTEL_SOURCE_DIR=${zapdir_array[$response]} + ZAPTEL_INSTALL_DIR=${zapdir_array[$response]} else find_zap_dirs_invalid "$zapdirs" fi - #Check if this post Zaptel-1.4.9 - if [ -d $ZAPTEL_SOURCE_DIR/kernel ]; then - ZAPTEL_INSTALL_DIR=$ZAPTEL_SOURCE_DIR - ZAPTEL_SOURCE_DIR=$ZAPTEL_SOURCE_DIR/kernel + #Check if this is post Zaptel-1.4.9 + if [ -d $ZAPTEL_INSTALL_DIR/kernel ]; then + ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR/kernel else - ZAPTEL_INSTALL_DIR=$ZAPTEL_SOURCE_DIR + ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR fi - + if [ ! -f $ZAPTEL_SOURCE_DIR/zaptel.h ]; then echo echo "Error: zaptel.h not found in $ZAPTEL_SOURCE_DIR" @@ -5540,14 +5647,14 @@ function find_zap_dirs () fi if [ $find_zap_dir_quit -eq 1 ] ; then - ZAPTEL_SOURCE_DIR=$ZAPTEL_DFLT_INSTALL_DIR + ZAPTEL_INSTALL_DIR=$ZAPTEL_DFLT_INSTALL_DIR return 1 fi if [ $zapdir_manual -eq 1 ]; then - eval "grep \"$ZAPTEL_SOURCE_DIR\" $PROD_HOME/zaptel/zaptel.path 2> /dev/null > /dev/null " + eval "grep \"$ZAPTEL_INSTALL_DIR\" $PROD_HOME/zaptel/zaptel.path 2> /dev/null > /dev/null " if [ $? -ne 0 ]; then - echo "$ZAPTEL_SOURCE_DIR" >> $PROD_HOME/zaptel/zaptel.path + echo "$ZAPTEL_INSTALL_DIR" >> $PROD_HOME/zaptel/zaptel.path fi fi @@ -5559,6 +5666,7 @@ function find_zap_dirs () if [ -e $ZAPTEL_SOURCE_DIR/zaptel-base.c ]; then ZAPTEL_C_FILE="zaptel-base.c"; fi + return 0; } @@ -5598,6 +5706,13 @@ function enable_protocols () ARG=${2:-NO} + echo "$PROTOCOL" | grep "BRI" > /dev/null + if [ $? -eq 0 ]; then + echo "Enabling the AFT BRI SMG Support" + SSMG_BRI="YES" + PROT_MATCH=YES + fi + echo "$PROTOCOL" | grep "FR" > /dev/null if [ $? -eq 0 ]; then if [ $FR_PROT != YES ]; then @@ -5838,9 +5953,11 @@ ENDOFTEXT if [ $? -eq 0 ]; then if [ $AFT_TE1_PROT != YES ]; then echo "Enabling the AFT TE1 Support" - PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_AFT -DCONFIG_PRODUCT_WANPIPE_AFT_TE1 -DCONFIG_PRODUCT_WANPIPE_CODEC_SLINEAR_LAW" + PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_AFT -DCONFIG_PRODUCT_WANPIPE_AFT_CORE -DCONFIG_PRODUCT_WANPIPE_AFT_TE1 -DCONFIG_PRODUCT_WANPIPE_AFT_56K -DCONFIG_PRODUCT_WANPIPE_AFT_RM -DCONFIG_PRODUCT_WANPIPE_CODEC_SLINEAR_LAW -DCONFIG_PRODUCT_WANPIPE_AFT_BRI -DCONFIG_PRODUCT_WANPIPE_AFT_SERIAL " fi AFT_TE1_PROT=YES + AFT_BRI_PROT=YES + AFT_SERIAL_PROT=YES PROT_MATCH=YES fi @@ -5873,7 +5990,7 @@ ENDOFTEXT echo "$PROTOCOL" | grep "TDM" > /dev/null if [ $? -eq 0 ]; then tdmv_get_zaptel_path - if [ $? -eq 0 ]; then + if [ $? -eq 0 ]; then ZAP_MOD_DIR=/lib/modules/$(uname -r) if [ $KERN_VER -eq 24 ]; then @@ -5915,29 +6032,25 @@ ENDOFTEXT if [ $TDM_PROT != YES ]; then echo "Enabling the TDM Voice Asterisk Support" PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE " - ASTERISK_IFLAGS="-I$ZAPTEL_SOURCE_DIR" + ASTERISK_IFLAGS="-I$ZAPTEL_INSTALL_DIR" WANCFG_ZAPTEL_CFG=YES fi - #Check for new zaptel hw hdlc option if [ -f $ZAPTEL_SOURCE_DIR/zaptel-base.c ]; then eval "grep hdlc_hard_xmit $ZAPTEL_SOURCE_DIR/zaptel-base.c > /dev/null 2> /dev/null" if [ $? -eq 0 ] ; then - echo + echo " " + echo "Zaptel HW HDLC Support Detected: Enabling DCHAN Feature" echo "Native Zaptel HW HDLC Support Detected - No patch required" - echo "Zaptel source unmodified, no zaptel re-compilation needed!" - echo - pause + echo "Zaptel source unmodified" + echo " " - echo - echo - TDM_DCHAN="(DCHAN)" PROTOCOL_DEFINES="$PROTOCOL_DEFINES -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN_ZAPTEL " fi fi - + #Check if dchan patch is already enabled if [ "$TDM_DCHAN" = "" ]; then eval "grep ZT_DCHAN_TX_V2 $ZAPTEL_SOURCE_DIR/* 2> /dev/null > /dev/null" @@ -5949,6 +6062,7 @@ ENDOFTEXT fi fi + #If DCHAN patch is not enabled give option to enable it if [ "$TDM_DCHAN" = "" ]; then echo echo @@ -5966,8 +6080,8 @@ ENDOFTEXT zaptel_modified=1 elif [ $result -eq 1 ]; then TDM_DCHAN="(DCHAN)" - echo zaptel_modified=1 + echo else echo "Zaptel Update Failed!" echo @@ -5983,7 +6097,7 @@ ENDOFTEXT fi fi if [ $ZAP_CHUNK_OP == "YES" ] ; then - tdmv_apply_zaptel_chunk_patch + tdmv_apply_zaptel_chunk_patch fi #################################################################### @@ -6062,7 +6176,6 @@ ENDOFTEXT fi fi tdmv_check_zaptel_udev - echo fi fi PROT_MATCH=YES @@ -6155,7 +6268,11 @@ PPP_PROT=NO CHDLC_PROT=NO X25_PROT=NO AFT_TE1_PROT=NO +AFT_BRI_PROT=NO +AFT_SERIAL_PROT=NO AFT_TE3_PROT=NO +SSMG=NO +SSMG_BRI=NO WAN_FRM_UPDATE_DRIVER=YES @@ -6221,6 +6338,29 @@ function detect_rpm_build_utility() fi } +function compile_aft_firmware_util() +{ + lhome=`pwd` + \cp -f $PROD_HOME/util/wan_aftup $PROD_HOME/rpmbuild/etc/wanpipe/firmware/ -r + + cd $PROD_HOME/rpmbuild/etc/wanpipe/firmware/wan_aftup + echo "Compiling firmware update utilities..." + eval "make wan_aftup" >/dev/null 2>/dev/null + if [ ! $? -eq 0 ]; then + echo "failed" + exit + else + echo "done" + fi + + + \rm -f *.c + \rm -f *.o + \rm -f *.h + \rm -f Makefile + cd $lhome +} + function usage() { if [ "$PKG_NAME" != "wanpipe-lite" ]; then @@ -6357,12 +6497,12 @@ KERNEL_UNAME=`uname -r` PKG_NAME=wanpipe DISTR_NAME="WANPIPE" PROD=wanrouter -PROD_VER=3.2.7.1 +PROD_VER=3.3.2 PROD_HOME=`pwd` -WAN_CONF_DIR=/etc/wanpipe -META_CONF=$PROD_HOME/$PROD.rc +META_CONF=$PROD_HOME/$PROD.rc WAN_INTR_DIR=$PROD_HOME/interfaces -PROD_CONF=$WAN_CONF_DIR/wanpipe1.conf +WAN_CONF_DIR=/etc/wanpipe +PROD_CONF=$PROD_HOME/wanpipe1.conf PROD_PATCH=$PROD_HOME/patches PROD_INIT=/usr/sbin/ FILELIST=$PROD_HOME/Filelist @@ -6396,6 +6536,7 @@ SSMG_DIR=ssmg WANPIPE_INCLUDE_DIR=/usr/include/wanpipe WANCFG_ZAPTEL_CFG=NO WANCFG_ZAPTEL=/usr/sbin/wancfg_zaptel +WANCFG_SMG=/usr/sbin/wancfg_smg find_zap_dir_quit=0 zaptel_auto_install="NO" @@ -6416,6 +6557,7 @@ DRIVERS_MPAPI_X25="x25_api_iface.c x25_dsp_iface.c x25_facils.c x25_iface.c x25_ DRIVER_UPDATE_DIR=$PROD_PATCH/kdrivers +DRIVER_INC_DIR=$PROD_PATCH/kdrivers/include DRIVER_TMP_DIR=$PROD_HOME/kdrvtmp DRIVERS_COMPILED=no NEW_IF_TYPE=NO @@ -6442,8 +6584,8 @@ ANNEXG_LOAD=NO SCTP_LOAD=NO ZAPTEL_DFLT_INSTALL_DIR="/usr/src/zaptel" -ZAPTEL_SOURCE_DIR=$ZAPTEL_DFLT_INSTALL_DIR #Location of Zaptel Source Files -ZAPTEL_INSTALL_DIR="" #Location of Zaptel Install Files +ZAPTEL_SOURCE_DIR=$ZAPTEL_DFLT_INSTALL_DIR +ZAPTEL_INSTALL_DIR=$ZAPTEL_DFLT_INSTALL_DIR ZAPTEL_C_FILE="zaptel.c" ASTERISK_IFLAGS= EDAC_ZAP_PATCH_FILE=ed_zaptel.patch @@ -6717,13 +6859,23 @@ if [ "$PKG_NAME" != "wanpipe-lite" ]; then echo "Error invalid --zaptel-path option"; exit 1; fi - ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR + if [ ! -d "$ZAPTEL_INSTALL_DIR" ]; then + echo "Error: Zaptel source directory not found: $ZAPTEL_INSTALL_DIR"; + exit 1; + fi if [ ! -f "$ZAPTEL_INSTALL_DIR/Makefile" ]; then echo "Error: Invalid zaptel source found in $ZAPTEL_INSTALL_DIR"; exit 1; fi ZAPTEL_PATH_OP="YES"; echo "Zaptel path defined as: $ZAPTEL_INSTALL_DIR" + + if [ -d $ZAPTEL_INSTALL_DIR/kernel ]; then + ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR/kernel + else + ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR + fi + ;; --with-zaptel*) @@ -6732,16 +6884,27 @@ if [ "$PKG_NAME" != "wanpipe-lite" ]; then echo "Error invalid --with-zaptel option"; exit 1; fi - ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR + if [ ! -d "$ZAPTEL_INSTALL_DIR" ]; then + echo "Error: Zaptel source directory not found: $ZAPTEL_INSTALL_DIR"; + exit 1; + fi if [ ! -f "$ZAPTEL_INSTALL_DIR/Makefile" ]; then echo "Error: Invalid zaptel source found in $ZAPTEL_INSTALL_DIR"; exit 1; fi ZAPTEL_PATH_OP="YES"; echo "Zaptel path defined as: $ZAPTEL_INSTALL_DIR" + + + if [ -d $ZAPTEL_INSTALL_DIR/kernel ]; then + ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR/kernel + else + ZAPTEL_SOURCE_DIR=$ZAPTEL_INSTALL_DIR + fi + ;; - - --no-zaptel-compile*) + + --no-zaptel-compile*) ZAPTEL_COMPILE_DISABLE="YES"; ;; @@ -6762,7 +6925,7 @@ if [ "$PKG_NAME" != "wanpipe-lite" ]; then fi export ASTBROOT=$ROOT; ASTBROOT=$ROOT; - + TMP_123=${WANPIPE_INCLUDE_DIR#/*} WANPIPE_INCLUDE_DIR=$ROOT/$TMP_123 TMP_123=${WANCFG_ZAPTEL#/*} @@ -6865,6 +7028,12 @@ if [ "$PKG_NAME" != "wanpipe-lite" ]; then enable_protocols AFT_TE1 "YES" fi + echo "$PROTS" | grep "BRI" > /dev/null + if [ $? -eq 0 ]; then + enable_protocols AFT_TE1 "YES" + enable_protocols BRI "YES" + fi + enable_protocols "$PROTS" "YES" if [ $? -ne 0 ]; then exit 1 @@ -6878,6 +7047,14 @@ if [ "$PKG_NAME" != "wanpipe-lite" ]; then exit; fi + if [ "$setup_cmd" = "smgbri" ]; then + SSMG=YES + SSMG_BRI=YES + NONINTERACTIVE=1; + install_ssmg_bri; + exit; + fi + if [ "$setup_cmd" = "utility" ]; then compile_src; exit; @@ -6952,7 +7129,7 @@ following Environment variables. " if [ $TDM_PROT = "YES" ]; then -echo " 7. Zaptel Build Dir : $ZAPTEL_SOURCE_DIR " +echo " 7. Zaptel Build Dir : $ZAPTEL_INSTALL_DIR " fi echo echo @@ -6975,18 +7152,17 @@ you know what you are doing :) exit 1 fi - if [ $TDM_PROT = "YES" ]; then - $PROD_HOME/Setup install --silent --builddir=$PROD_HOME/$build_dir --with-linux=$SOURCEDIR --arch=$ARCH --protocol=$PROTS --ss7_user_id=$SS7_USER_ID --noautostart --no-zaptel-compile --zaptel-path=$ZAPTEL_SOURCE_DIR --usr-cc=$CC - else - $PROD_HOME/Setup install --silent --builddir=$PROD_HOME/$build_dir --with-linux=$SOURCEDIR --arch=$ARCH --protocol=$PROTS --ss7_user_id=$SS7_USER_ID --noautostart --usr-cc=$CC - fi + + $PROD_HOME/Setup install --silent --builddir=$PROD_HOME/$build_dir --with-linux=$SOURCEDIR --arch=$ARCH --protocol=$PROTS --ss7_user_id=$SS7_USER_ID --noautostart --no-zaptel-compile --zaptel-path=$ZAPTEL_INSTALL_DIR if [ $? -ne 0 ]; then echo "Error: WANPIPE Installation Failed!" exit 1; fi + if [ "$setup_cmd" = "buildrpm" ]; then + compile_aft_firmware_util detect_rpm_build_utility @@ -7157,11 +7333,12 @@ welcome || exit 0 prepare || exit 1 apply_patches || exit 1 compile_drivers || exit 1 -install_config || exit 1 +install_init || exit 1 +install_config || exit 1 compile_src || exit 1 install_all -install_init || exit 1 install_ssmg +install_ssmg_bri clean_up goodbye @@ -7177,7 +7354,11 @@ if [ -z $NONINTERACTIVE ] && [ "$WANCFG_ZAPTEL_CFG" = "YES" ] && [ -e $WANCFG_ZA echo "-----------------------------------------------------" getyn "Would you like to configure wanpipe devices for ZAPTEL?" if [ $? -eq 0 ]; then - eval "$WANCFG_ZAPTEL" + if [ $SSMG_BRI == "YES" ]; then + eval "$WANCFG_SMG" + else + eval "$WANCFG_ZAPTEL" + fi else echo "Wanpipe Installation Complete" echo "-----------------------------" diff --git a/api/aft/Makefile b/api/aft/Makefile index a91b46a..0e16fe4 100644 --- a/api/aft/Makefile +++ b/api/aft/Makefile @@ -16,7 +16,7 @@ SYSINC=/usr/src/linux/include endif VPATH = $(SYSINC) -DIR_EC_APILIB=../wanec_apilib +DIR_EC_APILIB=/common/wantools/wanec_apilib SRC_EC_APILIB=$(DIR_EC_APILIB)/wanec_api.c $(DIR_EC_APILIB)/wanec_api_lib.c INC_EC_APILIB=-I/usr/include/wanpipe/oct6100_api -I$(DIR_EC_APILIB) @@ -26,8 +26,7 @@ CFLAGS += -I/usr/include/wanpipe TARGETS=aft_api TARGETS+= aft_api_events -TARGETS+= aft_integrity -TARGETS+= aft_echo +TARGETS+= aft_api_repeater #TARGETS+= aft_api_ss7 #TARGETS+= aft_api_check #TARGETS+= aft_tdm_api @@ -43,6 +42,9 @@ aft_api: aft_api.c ../lib/lib_api.c aft_api_events: aft_api_events.c $(SRC_EC_APILIB) ../lib/lib_api.c $(CC) $(CFLAGS) $(INC_EC_APILIB) -o $@ $^ +aft_api_repeater: aft_api_repeater.c ../lib/lib_api.c + $(CC) $(CFLAGS) -o $@ $^ + aft_api_check: aft_api_check.c ../lib/lib_api.c $(CC) $(CFLAGS) -o $@ $^ @@ -52,11 +54,5 @@ aft_tdm_api: aft_tdm_api.c ../lib/lib_api.c aft_api_ss7: aft_api_ss7.c ../lib/lib_api.c $(CC) $(CFLAGS) -o $@ $^ -aft_integrity: aft_integrity.c ../lib/lib_api.c - $(CC) $(CFLAGS) -o $@ $^ - -aft_echo: aft_echo.c ../lib/lib_api.c - $(CC) $(CFLAGS) -o $@ $^ - clean: rm -f $(TARGETS) diff --git a/api/aft/aft_api b/api/aft/aft_api deleted file mode 100755 index 4e54e6a..0000000 Binary files a/api/aft/aft_api and /dev/null differ diff --git a/api/aft/aft_api.c b/api/aft/aft_api.c index 53bc59a..a6bacd0 100644 --- a/api/aft/aft_api.c +++ b/api/aft/aft_api.c @@ -34,10 +34,10 @@ #include #include "lib_api.h" -#define MAX_TX_DATA 5000 /* Size of tx data */ +#define MAX_TX_DATA 1024*10 /* Size of tx data */ #define MAX_FRAMES 5000 /* Number of frames to transmit */ -#define MAX_RX_DATA 5000 +#define MAX_RX_DATA 1024*10 unsigned short Rx_lgth; @@ -90,8 +90,8 @@ int MakeConnection(void) printf("\nConnecting to card %s, interface %s prot %x\n", card_name, if_name,htons(PVC_PROT)); - strcpy( (char*)sa.sll_device, if_name); - strcpy( (char*)sa.sll_card, card_name); + strcpy( sa.sll_device, if_name); + strcpy( sa.sll_card, card_name); sa.sll_protocol = htons(PVC_PROT); sa.sll_family=AF_WANPIPE; @@ -543,7 +543,7 @@ int main(int argc, char* argv[]) proceed=init_args(argc,argv); if (proceed != WAN_TRUE){ - usage((unsigned char*)argv[0]); + usage(argv[0]); return -1; } diff --git a/api/aft/aft_api_events b/api/aft/aft_api_events deleted file mode 100755 index 0356331..0000000 Binary files a/api/aft/aft_api_events and /dev/null differ diff --git a/api/aft/aft_api_events.c b/api/aft/aft_api_events.c index 3dc039e..d830c88 100644 --- a/api/aft/aft_api_events.c +++ b/api/aft/aft_api_events.c @@ -85,8 +85,8 @@ int MakeConnection(void) printf("\nConnecting to card %s, interface %s prot %x\n", card_name, if_name,htons(PVC_PROT)); - strcpy( (char*)sa.sll_device, if_name); - strcpy( (char*)sa.sll_card, card_name); + strcpy( sa.sll_device, if_name); + strcpy( sa.sll_card, card_name); sa.sll_protocol = htons(PVC_PROT); sa.sll_family=AF_WANPIPE; @@ -234,7 +234,6 @@ tone_try_again: return 0; } -#if 0 static int ringdetect_event_ctrl(u_int8_t mode, int channel, int tone) { api_tx_hdr_t api_tx_hdr; @@ -259,7 +258,6 @@ ringdetect_try_again: return 0; } -#endif static int event_decode(api_rx_hdr_t *rx_hdr) { @@ -729,7 +727,7 @@ int main(int argc, char* argv[]) proceed=init_args(argc,argv); if (proceed != WAN_TRUE){ - usage((unsigned char*)argv[0]); + usage(argv[0]); return -1; } diff --git a/api/aft/aft_api_repeater.c b/api/aft/aft_api_repeater.c new file mode 100644 index 0000000..f3adf99 --- /dev/null +++ b/api/aft/aft_api_repeater.c @@ -0,0 +1,596 @@ +/***************************************************************************** +* aft_api.c AFT T1/E1: HDLC API Sample Code +* +* Author(s): Nenad Corbic +* +* Copyright: (c) 2003-2004 Sangoma Technologies 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. +* ============================================================================ +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "lib_api.h" + +#define MAX_TX_DATA 5000 /* Size of tx data */ +#define MAX_FRAMES 5000 /* Number of frames to transmit */ + +#define MAX_RX_DATA 5000 + +unsigned short Rx_lgth; + +unsigned char Rx_data[MAX_RX_DATA]; +unsigned char Tx_data[MAX_TX_DATA + sizeof(api_tx_hdr_t)]; + +/* Prototypes */ +int MakeConnection(void); +void handle_socket( void); +void sig_end(int sigid); + +int sock; +FILE *tx_fd=NULL,*rx_fd=NULL; + +/*************************************************** +* MakeConnection +* +* o Create a Socket +* o Bind a socket to a wanpipe network interface +* (Interface name is supplied by the user) +*/ + +void print_packet(unsigned char *buf, int len) +{ + int x; + printf("{ | "); + for (x=0;xdata[i] = (unsigned char)i; + }else{ +#if 0 + api_tx_el->data[i] = (unsigned char)tx_data+(i%4); +#else + api_tx_el->data[i] = (unsigned char)tx_data; +#endif + } + } + } + + memset(api_tx_el->api_tx_hdr.wp_api_tx_hdr_hdlc_rpt_data,tx_data+1,4); + api_tx_el->api_tx_hdr.wp_api_tx_hdr_hdlc_rpt_len=4; + + /* Main Rx Tx OOB routine */ + for(;;) { + + /* Initialize all select() descriptors */ + FD_ZERO(&ready); + FD_ZERO(&write); + FD_ZERO(&oob); + FD_SET(sock,&oob); + FD_SET(sock,&ready); + + if (write_enable){ + FD_SET(sock,&write); + } + + /* Select will block, until: + * 1: OOB event, link level change + * 2: Rx data available + * 3: Interface able to Tx */ + + if(select(sock + 1,&ready, &write, &oob, NULL)){ + + fflush(stdout); + if (FD_ISSET(sock,&oob)){ + + /* An OOB event is pending, usually indicating + * a link level change */ + + err = recv(sock, Rx_data, MAX_RX_DATA, MSG_OOB); + + if(err < 0 ) { + printf("Failed to receive OOB %i , %i\n", Rx_count, err); + err = ioctl(sock,SIOC_WANPIPE_SOCK_STATE,0); + printf("Sock state is %s\n", + (err == 0) ? "CONNECTED" : + (err == 1) ? "DISCONNECTED" : + "CONNECTING"); + break; + } + + printf("GOT OOB EXCEPTION CMD Exiting\n"); + + break; + } + + + if (FD_ISSET(sock,&ready)){ + + /* An Rx packet is pending + * 1: Read the rx packet into the Rx_data + * buffer. Confirm len > 0 + * + * 2: Cast Rx_data to the api_rx_element. + * Thus, removing a 16 byte header + * attached by the driver. + * + * 3. Check error_flag: + * CRC,Abort..etc + */ + + memset(Rx_data, 0, sizeof(Rx_data)); + +#if 1 + err = sangoma_readmsg_socket(sock, + Rx_data,16, + &Rx_data[16], MAX_RX_DATA-16, + 0); +#else + err = sangoma_read_socket(sock, Rx_data, MAX_RX_DATA, 0); +#endif + if (!read_enable){ + goto bitstrm_skip_read; + } + + + /* err indicates bytes received */ + if(err <= 0) { + printf("\nError receiving data\n"); + break; + } + + api_rx_el = (api_rx_element_t*)&Rx_data[0]; + + /* Check the packet length */ + Rx_lgth = err - sizeof(api_rx_hdr_t); + if(Rx_lgth<=0) { + printf("\nShort frame received (%d)\n", + Rx_lgth); + return; + } + + if (api_rx_el->api_rx_hdr.error_flag){ + printf("Data: "); + for(i=0;iapi_rx_hdr.error_flag & (1<api_rx_hdr.error_flag,Rx_lgth); + continue; + } + + if (api_rx_el->api_rx_hdr.error_flag & (1<api_rx_hdr.error_flag,Rx_lgth); + continue; + } + + if (api_rx_el->api_rx_hdr.error_flag & (1<api_rx_hdr.error_flag,Rx_lgth); + continue; + } + +#if 0 + if (api_rx_el->data[0] == tx_data && api_rx_el->data[1] == (tx_data+1)){ + if (!stream_sync){ + printf("GOT SYNC %x\n",api_rx_el->data[0]); + } + stream_sync=1; + }else{ + if (stream_sync){ + printf("OUT OF SYNC: %x\n",api_rx_el->data[0]); + } + } +#endif + + if ((files_used & RX_FILE_USED) && rx_fd){ + fwrite((void*)&Rx_data[sizeof(api_rx_hdr_t)], + sizeof(char), + Rx_lgth, + rx_fd); + } + + ++Rx_count; + + //printf("RECEIVE:\n"); + //print_packet(&Rx_data[16],Rx_lgth); + + if (Rx_lgth > 8) { + verbose=3; + } else { + if (verbose) { + verbose--; + } + } + + if (verbose){ + printf("Received %i Olen=%i Length = %i\n", + Rx_count, err,Rx_lgth); +#if 1 + printf("Data: "); + for(i=0;idata[i]); + } + printf("\n"); +#endif + }else{ + //putchar('R'); + } + + if (rx_cnt > 0 && Rx_count >= rx_cnt){ + break; + } +bitstrm_skip_read: +; + } + + if (FD_ISSET(sock,&write)){ + + + if (Tx_count == 0){ + //printf("SEND: Len=%i\n",Tx_length); + //print_packet(&Tx_data[16],Tx_length); + } + +#if 1 + err = sangoma_sendmsg_socket(sock, + Tx_data,16, + &Tx_data[16], Tx_length, + 0); +#else + err = sangoma_send_socket(sock,Tx_data, + Tx_length + sizeof(api_tx_hdr_t), 0); +#endif + if (err <= 0){ + if (errno == EBUSY){ + if (verbose){ + printf("Sock busy try again!\n"); + } + /* Socket busy try sending again !*/ + }else{ + /* Check socket state */ + err = ioctl(sock,SIOC_WANPIPE_SOCK_STATE,0); + printf("Sock state is %s\n", + (err == 0) ? "CONNECTED" : + (err == 1) ? "DISCONNECTED" : + "CONNECTING"); + + printf("Failed to send errno=%i len=%i \n",errno,Tx_length); + perror("Send: "); + break; + } + }else{ + ++Tx_count; + tx_data++; + + memset(api_tx_el->data,tx_data,Tx_length); + memset(api_tx_el->api_tx_hdr.wp_api_tx_hdr_hdlc_rpt_data,tx_data+1,4); + api_tx_el->api_tx_hdr.wp_api_tx_hdr_hdlc_rpt_len=4; + + + if (verbose){ + printf("Packet sent: Sent %i : %i\n", + err,Tx_count); + }else{ + //putchar('T'); + } + + if ((files_used & TX_FILE_USED) && tx_fd){ + rlen=fread((void*)&Tx_data[sizeof(api_tx_hdr_t)], + sizeof(char), + Tx_length,tx_fd); + if (!rlen){ + printf("\nTx of file %s is done!\n", + tx_file); + break; + } + if (Tx_length != rlen){ + Tx_length = rlen; + } + } + } + } + + if (tx_delay){ + usleep(tx_delay); + } + + if (tx_cnt && tx_size && Tx_count >= tx_cnt && !(files_used & TX_FILE_USED)){ + + write_enable=0; + if (rx_cnt > 0){ + /* Dont break let rx finish */ + }else{ + break; + } + } + } + } + + if (tx_fd){ + fclose(tx_fd); + } + if (rx_fd){ + fclose(rx_fd); + } + close (sock); +} + + + +/*************************************************************** + * Main: + * + * o Make a socket connection to the driver. + * o Call handle_socket() to read the socket + * + **************************************************************/ + + +int main(int argc, char* argv[]) +{ + int proceed; + + proceed=init_args(argc,argv); + if (proceed != WAN_TRUE){ + usage(argv[0]); + return -1; + } + + signal(SIGINT,&sig_end); + + proceed = MakeConnection(); + if( proceed == WAN_TRUE){ + handle_socket(); + return 0; + } + + return 0; +}; + + +void sig_end(int sigid) +{ + + printf("Got Signal %i\n",sigid); + + if (tx_fd){ + fclose(tx_fd); + } + if (rx_fd){ + fclose(rx_fd); + } + + if (sock){ + close (sock); + } + + exit(1); +} + + + diff --git a/api/aft/aft_echo b/api/aft/aft_echo deleted file mode 100755 index 5ba2b46..0000000 Binary files a/api/aft/aft_echo and /dev/null differ diff --git a/api/aft/aft_echo.c b/api/aft/aft_echo.c deleted file mode 100644 index 73cc25e..0000000 --- a/api/aft/aft_echo.c +++ /dev/null @@ -1,316 +0,0 @@ -/***************************************************************************** -* chdlc_api.c CHDLC API: Receive Module -* -* Author(s): Gideon Hack & Nenad Corbic -* -* Copyright: (c) 1995-2001 Sangoma Technologies 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. -* ============================================================================ -* Description: -* -* The chdlc_api.c utility will bind to a socket to a chdlc network -* interface, and continously tx and rx packets to an from the sockets. -* -* This example has been written for a single interface in mind, -* where the same process handles tx and rx data. -* -* A real world example, should use different processes to handle -* tx and rx spearately. -*/ - - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "lib_api.h" - -#define FALSE 0 -#define TRUE 1 - -#define LGTH_CRC_BYTES 0 -#define MAX_TX_DATA 5000 /* Size of tx data */ -#define MAX_RX_DATA MAX_TX_DATA - - -#define SOCK_TIMEOUT 1 - - -/*=================================================== - * Golobal data - *==================================================*/ - -unsigned char HDLC_streaming = FALSE; -unsigned short Rx_lgth; - -unsigned char Rx_data[MAX_RX_DATA]; -unsigned char Tx_data[MAX_TX_DATA]; -int sock; - - -/*=================================================== - * Function Prototypes - *==================================================*/ -int MakeConnection(void); -void handle_socket( void); - - - - -/*=================================================== - * MakeConnection - * - * o Create a Socket - * o Bind a socket to a wanpipe network interface - * (Interface name is supplied by the user) - *==================================================*/ - -int MakeConnection(void) -{ - struct wan_sockaddr_ll sa; - - memset(&sa,0,sizeof(struct wan_sockaddr_ll)); - errno = 0; - sock = socket(AF_WANPIPE, SOCK_RAW, 0); - if( sock < 0 ) { - perror("Socket"); - return(FALSE); - } /* if */ - - printf("\nConnecting to router %s, interface %s\n", card_name, if_name); - - strcpy( (char*)sa.sll_device, if_name); - strcpy( (char*)sa.sll_card, card_name); - sa.sll_protocol = htons(PVC_PROT); - sa.sll_family=AF_WANPIPE; - - if(bind(sock, (struct sockaddr *)&sa, sizeof(struct wan_sockaddr_ll)) < 0){ - perror("bind"); - printf("Failed to bind a socket to %s interface\n",if_name); - exit(0); - } - printf("Socket bound to %s\n\n",if_name); - - return(TRUE); - -} - - -/*=========================================================== - * handle_socket - * - * o Tx/Rx data to and from the socket - * o Cast received data to an api_rx_element_t data type - * o The received packet contains 16 bytes header - * - * ------------------------------------------ - * | 16 bytes | X bytes ... - * ------------------------------------------ - * Header Data - * - * RX DATA: - * -------- - * Each rx data packet contains the 16 byte header! - * - * o Rx 16 byte data structure: - * - * typedef struct { - * unsigned char error_flag PACKED; - * unsigned short time_stamp PACKED; - * unsigned char reserved[13] PACKED; - * } api_rx_hdr_t; - * - * typedef struct { - * api_rx_hdr_t api_rx_hdr PACKED; - * void * data PACKED; - * } api_rx_element_t; - * - * error_flag: - * bit 0: incoming frame was aborted - * bit 1: incoming frame has a CRC error - * bit 2: incoming frame has an overrun eror - * - * time_stamp: - * absolute time value in ms. - * - * TX_DATA: - * -------- - * Each tx data packet MUST contain a 16 byte header! - * - * o Tx 16 byte data structure - * - * typedef struct { - * unsigned char attr PACKED; - * unsigned char reserved[15] PACKED; - * } api_tx_hdr_t; - * - * typedef struct { - * api_tx_hdr_t api_tx_hdr PACKED; - * void * data PACKED; - * } api_tx_element_t; - * - * Currently the chdlc device driver doesn't use any of - * the above fields. Thus, the user can set the 16 bytes - * to ZERO. - * - */ - -void handle_socket(void) -{ - unsigned int Rx_count,Tx_count,Tx_length; - api_tx_element_t * api_tx_el; - fd_set ready,write,oob; - int err; - struct timeval tv; - tv.tv_usec = 0; - tv.tv_sec = SOCK_TIMEOUT; - - - Rx_count = 0; - Tx_count = 0; - Tx_length = tx_size; - - printf("\n\nSocket Handler: Rx=%d Tx=%i TxCnt=%i TxLen=%i TxDelay=%i RxCnt=%i\n", - read_enable,write_enable,tx_cnt,tx_size,tx_delay,rx_cnt); - - /* If running HDLC_STREAMING then the received CRC bytes - * will be passed to the application as part of the - * received data. - */ - - api_tx_el = (api_tx_element_t*)&Tx_data[0]; - memset(&Tx_data[0],0,MAX_TX_DATA); - - while (1) { - err = ioctl(sock,SIOC_WANPIPE_SOCK_STATE,0); - printf("Interface %s state is %s (%d)\n", - if_name, - (err == 0) ? "CONNECTED" : - (err == 1) ? "DISCONNECTED" : - "CONNECTING",err); - - if (err < 0) { - printf("Error interface down %s sock disconnected! (%s)\n", - if_name,strerror(errno)); - return; - } - - if (err > 0) { - printf("Waiting for interface %s to come up!\n",if_name); - sleep(10); - } else { - break; - } - } - - for(;;) { - FD_ZERO(&ready); - FD_ZERO(&write); - FD_ZERO(&oob); - FD_SET(sock,&oob); - FD_SET(sock,&ready); - - tv.tv_usec = 0; - tv.tv_sec = SOCK_TIMEOUT; - - if (write_enable){ - FD_SET(sock,&write); - } - - fflush(stdout); - err= select(sock + 1,&ready, NULL, &oob, NULL); - - if (err < 0) { - printf("Error: inteface down: %s socket disconnected %s\n", - if_name,strerror(errno)); - break; - - } else if (err == 0) { - /* Timeout do something */ - - } else { - - if (FD_ISSET(sock,&oob)){ - - err = recv(sock, Rx_data, MAX_RX_DATA, MSG_OOB); - - if(err < 0 ) { - printf("Failed to receive OOB %i , %i\n", Rx_count, err); - err = ioctl(sock,SIOC_WANPIPE_SOCK_STATE,0); - printf("Sock state is %s\n", - (err == 0) ? "CONNECTED" : - (err == 1) ? "DISCONNECTED" : - "CONNECTING"); - break; - } - - printf("Got OOB exception: Link Down !\n"); - break; - } - - - if (FD_ISSET(sock,&ready)){ - - err = recv(sock, Rx_data, MAX_RX_DATA, 0); - - /* err indicates bytes received */ - if (err > 0){ - Rx_count++; - err = send(sock, Rx_data, err, 0); - Tx_count++; - printf("Rx Len=%i Rx=%i Tx=%i : Echo Ok\r", - err-sizeof(api_rx_hdr_t), Tx_count,Rx_count); - } else { - printf("\nError receiving data\n"); - break; - } - - } - } - } - - close (sock); -} - -/*************************************************************** - * Main: - * - * o Make a socket connection to the driver. - * o Call handle_socket() to read/write the socket - * - **************************************************************/ - - -int main(int argc, char* argv[]) -{ - int proceed; - - proceed=init_args(argc,argv); - if (proceed != WAN_TRUE){ - usage((unsigned char*)argv[0]); - return -1; - } - - proceed = MakeConnection(); - if(proceed == WAN_TRUE){ - handle_socket(); - return 0; - } - - return 1; -}; diff --git a/api/aft/aft_integrity b/api/aft/aft_integrity deleted file mode 100755 index de6c382..0000000 Binary files a/api/aft/aft_integrity and /dev/null differ diff --git a/api/chdlc/Makefile b/api/chdlc/Makefile index c4a83c8..2ec2d42 100644 --- a/api/chdlc/Makefile +++ b/api/chdlc/Makefile @@ -11,8 +11,8 @@ OS_TYPE = __LINUX__ DEBUG = 2 # Project file paths. -SYSINC = /usr/src/linux/include -APIINC = /usr/src/linux/include +SYSINC = /usr/include/wanpipe +APIINC = /usr/include/wanpipe # Tools options. CFLAGS = -Wall -O2 -D$(OS_TYPE) -D_DEBUG_=$(DEBUG) -D_GNUC_ -I../lib -I$(SYSINC) -I$(APIINC) @@ -22,6 +22,7 @@ CFLAGS = -Wall -O2 -D$(OS_TYPE) -D_DEBUG_=$(DEBUG) -D_GNUC_ -I../lib -I$(SYSINC) all: chdlc_api \ chdlc_rts_cts \ chdlc_integrity \ + chdlc_modem_cmd \ chdlc_echo @echo "Ok." @@ -38,6 +39,9 @@ chdlc_rts_cts: chdlc_rts_cts.c chdlc_integrity: chdlc_integrity.c ../lib/lib_api.c $(CC) $(CFLAGS) -o $@ $^ +chdlc_modem_cmd: chdlc_modem_cmd.c ../lib/lib_api.c + $(CC) $(CFLAGS) -o $@ $^ + clean: rm -f chdlc_api rm -f chdlc_rts_cts diff --git a/api/chdlc/chdlc_modem_cmd b/api/chdlc/chdlc_modem_cmd new file mode 100755 index 0000000..9b276cc Binary files /dev/null and b/api/chdlc/chdlc_modem_cmd differ diff --git a/api/aft/aft_integrity.c b/api/chdlc/chdlc_modem_cmd.c similarity index 57% rename from api/aft/aft_integrity.c rename to api/chdlc/chdlc_modem_cmd.c index 7844900..ffcd9fa 100644 --- a/api/aft/aft_integrity.c +++ b/api/chdlc/chdlc_modem_cmd.c @@ -1,9 +1,9 @@ /***************************************************************************** -* chdlc_api.c CHDLC API: Receive Module +* chdlc_modem_cmd.c CHDLC API: Modem CMD Example * -* Author(s): Gideon Hack & Nenad Corbic +* Author(s): Nenad Corbic * -* Copyright: (c) 1995-2001 Sangoma Technologies Inc. +* Copyright: (c) 1995-2008 Sangoma Technologies Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -37,24 +37,26 @@ #include #include #include -#include +#include #include "lib_api.h" #define FALSE 0 #define TRUE 1 -#define LGTH_CRC_BYTES 0 +#define LGTH_CRC_BYTES 2 #define MAX_TX_DATA 5000 /* Size of tx data */ #define MAX_RX_DATA MAX_TX_DATA -#define SOCK_TIMEOUT 1 +FILE *tx_fd=NULL,*rx_fd=NULL; +wan_mbox_t gmbox; /*=================================================== * Golobal data *==================================================*/ +unsigned short no_CRC_bytes_Rx; unsigned char HDLC_streaming = FALSE; unsigned short Rx_lgth; @@ -69,10 +71,6 @@ int sock; int MakeConnection(void); void handle_socket( void); -static unsigned char test_data[]={0x00,0x5A, 0xAA, 0xA5, 0xFF}; -static unsigned char tx_index=0; - - /*=================================================== * MakeConnection @@ -96,8 +94,8 @@ int MakeConnection(void) printf("\nConnecting to router %s, interface %s\n", card_name, if_name); - strcpy( (char*)sa.sll_device, if_name); - strcpy( (char*)sa.sll_card, card_name); + strcpy( sa.sll_device, if_name); + strcpy( sa.sll_card, card_name); sa.sll_protocol = htons(PVC_PROT); sa.sll_family=AF_WANPIPE; @@ -113,31 +111,90 @@ int MakeConnection(void) } -void init_tx_pattern(void) +static int exec_cmd(int fd, wan_mbox_t * mb) { - api_tx_element_t * api_tx_el; - unsigned char *data; - int i; - - memset(&Tx_data[0],0,MAX_TX_DATA); - - /* Initialize the tx packet. The 16 byte header must - * be inserted before tx data. In CHDLC protocol, - * the tx x25 header is not used, thus it can be - * set to zero */ - api_tx_el = (api_tx_element_t*)&Tx_data[0]; - data = (unsigned char *)api_tx_el->data; - - for (i=0;i= sizeof(test_data)){ - tx_index=0; - } + int err = ioctl(sock,SIOC_MBOX_CMD,mb); + if (err) { + perror("SIOC_MBOX_CMD"); + return -1; } + + switch (mb->wan_return_code) { + + case 0: + return 0; + default: + printf("Error: CMD returned 0x%0X\n", + mb->wan_return_code); + return -1; + } + + return 0; } +static unsigned char gstatus=0; +static int exec_read_modem_cmd(int fd, wan_mbox_t * mb) +{ + MODEM_STATUS_STRUCT *mstat; + int err=0; + memset(mb,0,sizeof(wan_mbox_t)); + + mb->wan_data_len = 0; + mb->wan_command = READ_MODEM_STATUS; + + err=exec_cmd(fd,mb); + if (err) { + return err; + } + mstat=(MODEM_STATUS_STRUCT*)mb->wan_data; + + if (mstat->modem_status == gstatus) { + return 0; + } + gstatus = mstat->modem_status; + + printf("MODEM CMD rc=0x%02X data_len=%i data=0x%02X\n", + mb->wan_return_code, mb->wan_data_len, mb->wan_data[0]); + + mstat=(MODEM_STATUS_STRUCT*)mb->wan_data; + + printf("MODEM STATUS (Data=0x%02X) DCD=%i CTS=%i\n", + mstat->modem_status, + (mstat->modem_status&MODEM_DCD_MASK)?1:0, + (mstat->modem_status&MODEM_CTS_MASK)?1:0); +} + +static int exec_set_modem_cmd(int fd, wan_mbox_t * mb, int dtr, int rts) +{ + MODEM_STATUS_STRUCT *mstat=(MODEM_STATUS_STRUCT*)mb->wan_data; + + int err=0; + memset(mb,0,sizeof(wan_mbox_t)); + + mb->wan_data_len = 0; + mb->wan_command = SET_MODEM_STATUS; + mb->wan_data_len = 1; + + mstat->modem_status = 0; + if (dtr) { + mstat->modem_status |= SET_MODEM_DTR_HIGH; + } + if (rts) { + mstat->modem_status |= SET_MODEM_RTS_HIGH; + } + + + err=exec_cmd(fd,mb); + if (err) { + return err; + } + + printf("MODEM CMD rc=0x%02X data_len=%i data=0x%02X (dtr=%i rts=%i)\n", + mb->wan_return_code, mb->wan_data_len, mb->wan_data[0],dtr,rts); + +} + + /*=========================================================== * handle_socket @@ -205,12 +262,16 @@ void handle_socket(void) api_tx_element_t * api_tx_el; fd_set ready,write,oob; int err,i; + int rlen; + int ferr; + int txfile_bytes=0; + void *pRx_data,*pTx_data; int no_CRC_bytes_Rx = LGTH_CRC_BYTES; - struct timeval tv; - tv.tv_usec = 0; - tv.tv_sec = SOCK_TIMEOUT; + pRx_data = (void*)&Rx_data[sizeof(api_rx_hdr_t)]; + pTx_data = (void*)&Tx_data[sizeof(api_tx_hdr_t)]; + Rx_count = 0; Tx_count = 0; Tx_length = tx_size; @@ -223,33 +284,73 @@ void handle_socket(void) * received data. */ - api_tx_el = (api_tx_element_t*)&Tx_data[0]; memset(&Tx_data[0],0,MAX_TX_DATA); - init_tx_pattern(); + if (files_used & RX_FILE_USED){ + rx_fd=fopen(rx_file,"wb"); + if (!rx_fd){ + printf("Failed to open file %s\n",rx_file); + perror("File: "); + return; + } + printf("Opening %s rx file\n",rx_file); + } - while (1) { - err = ioctl(sock,SIOC_WANPIPE_SOCK_STATE,0); - printf("Interface %s state is %s (%d)\n", - if_name, - (err == 0) ? "CONNECTED" : - (err == 1) ? "DISCONNECTED" : - "CONNECTING",err); + + if (files_used & TX_FILE_USED){ - if (err < 0) { - printf("Error interface down %s sock disconnected! (%s)\n", - if_name,strerror(errno)); + tx_fd=fopen(tx_file,"rb"); + if (!tx_fd){ + printf("Failed to open file %s\n",tx_file); + perror("File: "); return; } - if (err > 0) { - printf("Waiting for interface %s to come up!\n",if_name); - sleep(10); - } else { - break; + printf("Opening %s tx file\n",tx_file); + + rlen=fread(pTx_data, + sizeof(char), + Tx_length,tx_fd); + + + if (!rlen){ + printf("%s: File empty!\n", + tx_file); + return; + } + }else{ + api_tx_el = (api_tx_element_t*)&Tx_data[0]; + + for (i=0;idata[i] = (unsigned char)i; + }else{ + api_tx_el->data[i] = (unsigned char)tx_data; + } } } + if (!write_enable) { + while (1) { + exec_read_modem_cmd(sock, &gmbox); + sleep(1); + } + } + + + sleep(4); + exec_set_modem_cmd(sock, &gmbox, 0, 0); + sleep(4); + exec_set_modem_cmd(sock, &gmbox, 1, 0); + sleep(4); + exec_set_modem_cmd(sock, &gmbox, 0, 1); + sleep(4); + exec_set_modem_cmd(sock, &gmbox, 1, 1); + sleep(4); + + exit(1); + + for(;;) { FD_ZERO(&ready); FD_ZERO(&write); @@ -257,25 +358,12 @@ void handle_socket(void) FD_SET(sock,&oob); FD_SET(sock,&ready); - tv.tv_usec = 0; - tv.tv_sec = SOCK_TIMEOUT; - if (write_enable){ FD_SET(sock,&write); } fflush(stdout); - err= select(sock + 1,&ready, &write, &oob, &tv); - - if (err < 0) { - printf("Error: inteface down: %s socket disconnected %s\n", - if_name,strerror(errno)); - break; - - } else if (err == 0) { - /* Timeout do someting if you like */ - - } else { + if(select(sock + 1,&ready, &write, &oob, NULL)){ if (FD_ISSET(sock,&oob)){ @@ -300,6 +388,10 @@ void handle_socket(void) err = recv(sock, Rx_data, MAX_RX_DATA, 0); + if (!read_enable){ + goto bitstrm_skip_read; + } + /* err indicates bytes received */ if (err > 0){ @@ -310,36 +402,64 @@ void handle_socket(void) if(Rx_lgth<=0) { printf("\nShort frame received (%d)\n", Rx_lgth); - Rx_count++; - continue; + return; } - ++Rx_count; - - if (Rx_lgth != Tx_length){ - printf("Rx Error cnt %i: Rx length %i not equal to %i\n", - Rx_count,Rx_lgth,Tx_length); + switch (api_rx_el->api_rx_hdr.error_flag){ + + case 0: + /* Rx packet is good */ + break; + + case RX_FRM_ABORT: + /* Frame was aborted */ + break; + case RX_FRM_CRC_ERROR: + /* Frame has crc error */ + break; + case RX_FRM_OVERRUN_ERROR: + /* Frame has an overrun error */ + break; + default: + /* Error with the rx packet + * handle it ... */ break; } - for (i=0;idata)[i] != - ((unsigned char*)api_tx_el->data)[i]){ - printf("Rx Error cnt=%i: Packet corruption on offset %i\n", - Rx_count,i); - break; + + + if ((files_used & RX_FILE_USED) && rx_fd){ + ferr=fwrite(pRx_data, + sizeof(char), + Rx_lgth, + rx_fd); + if (ferr != Rx_lgth){ + printf("Error: fwrite failed: written=%i should have %i\n", + ferr,Rx_lgth); } - } - - if (verbose) { - printf("Tx Len=%i Tx=%i Rx=%i : Data Ok\r", - Tx_length, Tx_count,Rx_count); } + + ++Rx_count; - if (Rx_count == tx_cnt){ - init_tx_pattern(); - Rx_count=0; - write_enable=1; + if (verbose){ + printf("Received %i Olen=%i Length = %i\n", + Rx_count, err,Rx_lgth); + }else{ + putchar('R'); + } +#if 1 + if (verbose){ + printf("Data: "); + for(i=0;(idata[i]); + } + printf("\n"); + } +#endif + + if (rx_cnt == Rx_count){ + printf("Rxcnt %i == RxCount=%i\n",rx_cnt,Rx_count); + break; } } else { @@ -349,12 +469,16 @@ void handle_socket(void) } +bitstrm_skip_read: if (FD_ISSET(sock,&write)){ err = send(sock,Tx_data, Tx_length + sizeof(api_tx_hdr_t), 0); if (err <= 0){ if (errno == EBUSY){ + if (verbose){ + printf("Sock busy try again!\n"); + } /* Socket busy try sending again !*/ }else{ /* Check socket state */ @@ -369,12 +493,31 @@ void handle_socket(void) break; } }else{ - ++Tx_count; - if (verbose && Rx_count < 1) { - printf("Tx Len=%i Tx=%i Rx=%i : Data Ok\r", - Tx_length, Tx_count,Rx_count); - } + ++Tx_count; + + if (verbose){ + printf("Packet sent: Sent %i : %i\n", + err,Tx_count); + }else{ + //putchar('T'); + } + txfile_bytes+=Tx_length; + + if ((files_used & TX_FILE_USED) && tx_fd){ + rlen=fread(pTx_data, + sizeof(char), + Tx_length,tx_fd); + + if (!rlen){ + printf("\nTx of file %s is done %i bytes!\n", + tx_file,txfile_bytes); + break; + } + if (Tx_length != rlen){ + Tx_length = rlen; + } + } } } @@ -382,13 +525,22 @@ void handle_socket(void) sleep(tx_delay); } - if (tx_size && Tx_count == tx_cnt){ + if (tx_size && Tx_count == tx_cnt && !(files_used & TX_FILE_USED)){ write_enable=0; - Tx_count=0; + if (!rx_cnt){ + break; + } } } } + if (tx_fd){ + fclose(tx_fd); + } + if (rx_fd){ + fclose(rx_fd); + } + close (sock); } @@ -407,7 +559,7 @@ int main(int argc, char* argv[]) proceed=init_args(argc,argv); if (proceed != WAN_TRUE){ - usage((unsigned char*)argv[0]); + usage(argv[0]); return -1; } diff --git a/api/fr/Makefile b/api/fr/Makefile index 74bcaba..0cf20af 100644 --- a/api/fr/Makefile +++ b/api/fr/Makefile @@ -16,13 +16,19 @@ SYSINC = /usr/src/linux/include # Tools options. CFLAGS = -Wall -O2 -D$(OS_TYPE) -D_DEBUG_=$(DEBUG) -D_GNUC_ -I$(SYSINC) -I$(APIINC) +TARGETS = fr_api +#TARGETS += fr_api_fast + + ####### RULES ################################################################ -all: fr_api +all: $(TARGETS) @echo "Ok." fr_api: fr_api.c $(CC) $(CFLAGS) -c -o $@ $< +#fr_api_fast: fr_api_fast.c +# $(CC) $(CFLAGS) -c -o $@ $< clean: - rm -f fr_api + rm -f $(TARGETS) diff --git a/api/lib/lib_api.c b/api/lib/lib_api.c index a2f873f..f78f8cb 100644 --- a/api/lib/lib_api.c +++ b/api/lib/lib_api.c @@ -407,7 +407,7 @@ int init_args(int argc, char *argv[]) return WAN_TRUE; } -static unsigned char api_usage[]="\n" +static char api_usage[]="\n" "\n" ":\n" " -i #interface name\n" @@ -466,7 +466,7 @@ static unsigned char api_usage[]="\n" " -diagn #disconnect diagnostic (dflt=0)\n" "\n"; -void usage(unsigned char *api_name) +void usage(char *api_name) { printf ("\n\nAPI %s USAGE:\n\n%s \n\n%s\n", api_name,api_name,api_usage); diff --git a/api/lib/lib_api.h b/api/lib/lib_api.h index fc33b2e..419cba1 100644 --- a/api/lib/lib_api.h +++ b/api/lib/lib_api.h @@ -38,14 +38,14 @@ extern int cause; extern int card_cnt; extern int i_cnt; -extern char tx_file[WAN_IFNAME_SZ]; -extern char rx_file[WAN_IFNAME_SZ]; +extern char tx_file[WAN_IFNAME_SZ]; +extern char rx_file[WAN_IFNAME_SZ]; #define TX_ADDR_STR_SZ 100 -extern char daddr[TX_ADDR_STR_SZ]; -extern char saddr[TX_ADDR_STR_SZ]; -extern char udata[TX_ADDR_STR_SZ]; +extern char daddr[TX_ADDR_STR_SZ]; +extern char saddr[TX_ADDR_STR_SZ]; +extern char udata[TX_ADDR_STR_SZ]; #define TX_FILE_USED 1 @@ -55,11 +55,11 @@ extern char udata[TX_ADDR_STR_SZ]; extern int init_args(int argc, char *argv[]); -extern void usage(unsigned char *api_name); +extern void usage(char *api_name); extern void u_delay(int usec); extern char card_name[WAN_IFNAME_SZ]; extern char if_name[WAN_IFNAME_SZ]; -extern char sw_if_name[WAN_IFNAME_SZ]; -extern char sw_card_name[WAN_IFNAME_SZ]; +extern char sw_if_name[WAN_IFNAME_SZ]; +extern char sw_card_name[WAN_IFNAME_SZ]; diff --git a/api/libsangoma/.deps/libsangoma_la-libsangoma.Plo b/api/libsangoma/.deps/libsangoma_la-libsangoma.Plo index 1a925df..24f589c 100644 --- a/api/libsangoma/.deps/libsangoma_la-libsangoma.Plo +++ b/api/libsangoma/.deps/libsangoma_la-libsangoma.Plo @@ -66,12 +66,16 @@ libsangoma_la-libsangoma.lo libsangoma_la-libsangoma.o: libsangoma.c \ ../../patches/kdrivers/include/linux/wanpipe_version.h \ ../../patches/kdrivers/include/linux/wanpipe_kernel.h \ /lib/modules/2.6.18-8.1.15.el5/build/include/linux/version.h \ + ../../patches/kdrivers/include/linux/wanpipe_abstr_types.h \ ../../patches/kdrivers/include/linux/wanpipe_cfg.h \ ../../patches/kdrivers/include/linux/sdla_56k.h \ ../../patches/kdrivers/include/linux/sdla_te1.h \ ../../patches/kdrivers/include/linux/sdla_te3.h \ ../../patches/kdrivers/include/linux/sdla_remora.h \ ../../patches/kdrivers/include/linux/sdla_remora_proslic.h \ + ../../patches/kdrivers/include/linux/sdla_bri.h \ + ../../patches/kdrivers/include/linux/xhfc24succ.h \ + ../../patches/kdrivers/include/linux/sdla_serial.h \ ../../patches/kdrivers/include/linux/sdla_front_end.h \ ../../patches/kdrivers/include/linux/wanpipe.h \ ../../patches/kdrivers/include/linux/wanpipe_debug.h \ @@ -82,7 +86,8 @@ libsangoma_la-libsangoma.lo libsangoma_la-libsangoma.o: libsangoma.c \ ../../patches/kdrivers/include/linux/wanpipe_includes.h \ ../../patches/kdrivers/include/linux/if_wanpipe.h \ /lib/modules/2.6.18-8.1.15.el5/build/include/linux/sockios.h \ - ../../patches/kdrivers/include/linux/wanpipe_codec_iface.h + ../../patches/kdrivers/include/linux/wanpipe_codec_iface.h \ + ../../patches/kdrivers/include/linux/wanpipe_tdm_api_iface.h libsangoma.h: @@ -302,6 +307,8 @@ libsangoma.h: /lib/modules/2.6.18-8.1.15.el5/build/include/linux/version.h: +../../patches/kdrivers/include/linux/wanpipe_abstr_types.h: + ../../patches/kdrivers/include/linux/wanpipe_cfg.h: ../../patches/kdrivers/include/linux/sdla_56k.h: @@ -314,6 +321,12 @@ libsangoma.h: ../../patches/kdrivers/include/linux/sdla_remora_proslic.h: +../../patches/kdrivers/include/linux/sdla_bri.h: + +../../patches/kdrivers/include/linux/xhfc24succ.h: + +../../patches/kdrivers/include/linux/sdla_serial.h: + ../../patches/kdrivers/include/linux/sdla_front_end.h: ../../patches/kdrivers/include/linux/wanpipe.h: @@ -335,3 +348,5 @@ libsangoma.h: /lib/modules/2.6.18-8.1.15.el5/build/include/linux/sockios.h: ../../patches/kdrivers/include/linux/wanpipe_codec_iface.h: + +../../patches/kdrivers/include/linux/wanpipe_tdm_api_iface.h: diff --git a/api/libsangoma/.deps/libsangoma_la-sangoma_pri.Plo b/api/libsangoma/.deps/libsangoma_la-sangoma_pri.Plo index e638078..9ce06a8 100644 --- a/api/libsangoma/.deps/libsangoma_la-sangoma_pri.Plo +++ b/api/libsangoma/.deps/libsangoma_la-sangoma_pri.Plo @@ -1,336 +1 @@ -libsangoma_la-sangoma_pri.lo libsangoma_la-sangoma_pri.o: sangoma_pri.c \ - ./libsangoma.h /usr/include/stdlib.h /usr/include/features.h \ - /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.3/include/stddef.h \ - /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h \ - /usr/include/endian.h /usr/include/bits/endian.h /usr/include/xlocale.h \ - /usr/include/sys/types.h /usr/include/bits/types.h \ - /usr/include/bits/wordsize.h /usr/include/bits/typesizes.h \ - /usr/include/time.h /usr/include/sys/select.h \ - /usr/include/bits/select.h /usr/include/bits/sigset.h \ - /usr/include/bits/time.h /usr/include/sys/sysmacros.h \ - /usr/include/bits/pthreadtypes.h /usr/include/bits/sched.h \ - /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \ - /usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \ - /usr/include/gconv.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.3/include/stdarg.h \ - /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \ - /usr/include/bits/stdio.h /usr/include/ctype.h /usr/include/unistd.h \ - /usr/include/bits/posix_opt.h /usr/include/bits/environments.h \ - /usr/include/bits/confname.h /usr/include/getopt.h \ - /usr/include/sys/time.h /usr/include/sys/socket.h \ - /usr/include/sys/uio.h /usr/include/bits/uio.h \ - /usr/include/bits/socket.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.3/include/limits.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.3/include/syslimits.h \ - /usr/include/limits.h /usr/include/bits/posix1_lim.h \ - /usr/include/bits/local_lim.h /usr/src/linux/include/linux/limits.h \ - /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h \ - /usr/include/bits/sockaddr.h /usr/src/linux/include/asm/socket.h \ - /usr/src/linux/include/asm/sockios.h /usr/include/netinet/in.h \ - /usr/include/stdint.h /usr/include/bits/in.h \ - /usr/include/bits/byteswap.h /usr/include/string.h \ - /usr/include/bits/string.h /usr/include/bits/string2.h \ - /usr/include/errno.h /usr/include/bits/errno.h \ - /usr/src/linux/include/linux/errno.h /usr/src/linux/include/asm/errno.h \ - /usr/src/linux/include/asm-generic/errno.h \ - /usr/src/linux/include/asm-generic/errno-base.h /usr/include/fcntl.h \ - /usr/include/bits/fcntl.h /usr/include/sys/stat.h \ - /usr/include/bits/stat.h /usr/include/sys/ioctl.h \ - /usr/include/bits/ioctls.h /usr/src/linux/include/asm/ioctls.h \ - /usr/src/linux/include/asm/ioctl.h /usr/include/bits/ioctl-types.h \ - /usr/include/sys/ttydefaults.h /usr/src/linux/include/linux/if.h \ - /usr/src/linux/include/linux/types.h \ - /usr/src/linux/include/linux/posix_types.h \ - /usr/src/linux/include/linux/stddef.h \ - /usr/src/linux/include/linux/compiler.h \ - /usr/src/linux/include/asm/posix_types.h \ - /usr/src/linux/include/asm/types.h \ - /usr/src/linux/include/linux/socket.h \ - /usr/src/linux/include/linux/hdlc/ioctl.h \ - /usr/src/linux/include/linux/wanpipe_defines.h \ - /usr/src/linux/include/linux/wanpipe_version.h \ - /usr/src/linux/include/linux/wanpipe_kernel.h \ - /usr/src/linux/include/linux/version.h \ - /usr/src/linux/include/linux/wanpipe_cfg.h \ - /usr/src/linux/include/linux/sdla_56k.h \ - /usr/src/linux/include/linux/sdla_te1.h \ - /usr/src/linux/include/linux/sdla_te3.h \ - /usr/src/linux/include/linux/sdla_remora.h \ - /usr/src/linux/include/linux/sdla_remora_proslic.h \ - /usr/src/linux/include/linux/sdla_front_end.h \ - /usr/src/linux/include/linux/wanpipe.h \ - /usr/src/linux/include/linux/wanpipe_debug.h \ - /usr/src/linux/include/linux/wanpipe_common.h \ - /usr/src/linux/include/linux/wanpipe_events.h \ - /usr/src/linux/include/linux/wanrouter.h /usr/include/poll.h \ - /usr/include/sys/poll.h /usr/include/bits/poll.h \ - /usr/src/linux/include/linux/wanpipe_tdm_api.h \ - /usr/src/linux/include/linux/wanpipe_includes.h \ - /usr/src/linux/include/linux/if_wanpipe.h \ - /usr/src/linux/include/linux/sockios.h \ - /usr/src/linux/include/linux/wanpipe_codec_iface.h \ - /usr/include/signal.h /usr/include/bits/signum.h \ - /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h \ - /usr/include/bits/sigcontext.h /usr/src/linux/include/asm/sigcontext.h \ - /usr/include/bits/sigstack.h /usr/include/sys/ucontext.h \ - /usr/include/bits/sigthread.h /usr/include/sys/signal.h \ - /usr/include/sys/wait.h /usr/include/sys/resource.h \ - /usr/include/bits/resource.h ./sangoma_pri.h /usr/src/libpri/libpri.h \ - /usr/src/libpri/pri_internal.h - -./libsangoma.h: - -/usr/include/stdlib.h: - -/usr/include/features.h: - -/usr/include/sys/cdefs.h: - -/usr/include/gnu/stubs.h: - -/usr/lib/gcc/i386-redhat-linux/3.4.3/include/stddef.h: - -/usr/include/bits/waitflags.h: - -/usr/include/bits/waitstatus.h: - -/usr/include/endian.h: - -/usr/include/bits/endian.h: - -/usr/include/xlocale.h: - -/usr/include/sys/types.h: - -/usr/include/bits/types.h: - -/usr/include/bits/wordsize.h: - -/usr/include/bits/typesizes.h: - -/usr/include/time.h: - -/usr/include/sys/select.h: - -/usr/include/bits/select.h: - -/usr/include/bits/sigset.h: - -/usr/include/bits/time.h: - -/usr/include/sys/sysmacros.h: - -/usr/include/bits/pthreadtypes.h: - -/usr/include/bits/sched.h: - -/usr/include/alloca.h: - -/usr/include/stdio.h: - -/usr/include/libio.h: - -/usr/include/_G_config.h: - -/usr/include/wchar.h: - -/usr/include/bits/wchar.h: - -/usr/include/gconv.h: - -/usr/lib/gcc/i386-redhat-linux/3.4.3/include/stdarg.h: - -/usr/include/bits/stdio_lim.h: - -/usr/include/bits/sys_errlist.h: - -/usr/include/bits/stdio.h: - -/usr/include/ctype.h: - -/usr/include/unistd.h: - -/usr/include/bits/posix_opt.h: - -/usr/include/bits/environments.h: - -/usr/include/bits/confname.h: - -/usr/include/getopt.h: - -/usr/include/sys/time.h: - -/usr/include/sys/socket.h: - -/usr/include/sys/uio.h: - -/usr/include/bits/uio.h: - -/usr/include/bits/socket.h: - -/usr/lib/gcc/i386-redhat-linux/3.4.3/include/limits.h: - -/usr/lib/gcc/i386-redhat-linux/3.4.3/include/syslimits.h: - -/usr/include/limits.h: - -/usr/include/bits/posix1_lim.h: - -/usr/include/bits/local_lim.h: - -/usr/src/linux/include/linux/limits.h: - -/usr/include/bits/posix2_lim.h: - -/usr/include/bits/xopen_lim.h: - -/usr/include/bits/sockaddr.h: - -/usr/src/linux/include/asm/socket.h: - -/usr/src/linux/include/asm/sockios.h: - -/usr/include/netinet/in.h: - -/usr/include/stdint.h: - -/usr/include/bits/in.h: - -/usr/include/bits/byteswap.h: - -/usr/include/string.h: - -/usr/include/bits/string.h: - -/usr/include/bits/string2.h: - -/usr/include/errno.h: - -/usr/include/bits/errno.h: - -/usr/src/linux/include/linux/errno.h: - -/usr/src/linux/include/asm/errno.h: - -/usr/src/linux/include/asm-generic/errno.h: - -/usr/src/linux/include/asm-generic/errno-base.h: - -/usr/include/fcntl.h: - -/usr/include/bits/fcntl.h: - -/usr/include/sys/stat.h: - -/usr/include/bits/stat.h: - -/usr/include/sys/ioctl.h: - -/usr/include/bits/ioctls.h: - -/usr/src/linux/include/asm/ioctls.h: - -/usr/src/linux/include/asm/ioctl.h: - -/usr/include/bits/ioctl-types.h: - -/usr/include/sys/ttydefaults.h: - -/usr/src/linux/include/linux/if.h: - -/usr/src/linux/include/linux/types.h: - -/usr/src/linux/include/linux/posix_types.h: - -/usr/src/linux/include/linux/stddef.h: - -/usr/src/linux/include/linux/compiler.h: - -/usr/src/linux/include/asm/posix_types.h: - -/usr/src/linux/include/asm/types.h: - -/usr/src/linux/include/linux/socket.h: - -/usr/src/linux/include/linux/hdlc/ioctl.h: - -/usr/src/linux/include/linux/wanpipe_defines.h: - -/usr/src/linux/include/linux/wanpipe_version.h: - -/usr/src/linux/include/linux/wanpipe_kernel.h: - -/usr/src/linux/include/linux/version.h: - -/usr/src/linux/include/linux/wanpipe_cfg.h: - -/usr/src/linux/include/linux/sdla_56k.h: - -/usr/src/linux/include/linux/sdla_te1.h: - -/usr/src/linux/include/linux/sdla_te3.h: - -/usr/src/linux/include/linux/sdla_remora.h: - -/usr/src/linux/include/linux/sdla_remora_proslic.h: - -/usr/src/linux/include/linux/sdla_front_end.h: - -/usr/src/linux/include/linux/wanpipe.h: - -/usr/src/linux/include/linux/wanpipe_debug.h: - -/usr/src/linux/include/linux/wanpipe_common.h: - -/usr/src/linux/include/linux/wanpipe_events.h: - -/usr/src/linux/include/linux/wanrouter.h: - -/usr/include/poll.h: - -/usr/include/sys/poll.h: - -/usr/include/bits/poll.h: - -/usr/src/linux/include/linux/wanpipe_tdm_api.h: - -/usr/src/linux/include/linux/wanpipe_includes.h: - -/usr/src/linux/include/linux/if_wanpipe.h: - -/usr/src/linux/include/linux/sockios.h: - -/usr/src/linux/include/linux/wanpipe_codec_iface.h: - -/usr/include/signal.h: - -/usr/include/bits/signum.h: - -/usr/include/bits/siginfo.h: - -/usr/include/bits/sigaction.h: - -/usr/include/bits/sigcontext.h: - -/usr/src/linux/include/asm/sigcontext.h: - -/usr/include/bits/sigstack.h: - -/usr/include/sys/ucontext.h: - -/usr/include/bits/sigthread.h: - -/usr/include/sys/signal.h: - -/usr/include/sys/wait.h: - -/usr/include/sys/resource.h: - -/usr/include/bits/resource.h: - -./sangoma_pri.h: - -/usr/src/libpri/libpri.h: - -/usr/src/libpri/pri_internal.h: +# dummy diff --git a/api/libsangoma/.svn/all-wcprops b/api/libsangoma/.svn/all-wcprops new file mode 100644 index 0000000..9481f6c --- /dev/null +++ b/api/libsangoma/.svn/all-wcprops @@ -0,0 +1,215 @@ +K 25 +svn:wc:ra_dav:version-url +V 32 +/svn/libsangoma/!svn/ver/1/trunk +END +configure +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/libsangoma/!svn/ver/1/trunk/configure +END +Makefile.in +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/libsangoma/!svn/ver/1/trunk/Makefile.in +END +config.log +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/libsangoma/!svn/ver/1/trunk/config.log +END +AUTHORS +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/libsangoma/!svn/ver/1/trunk/AUTHORS +END +depcomp +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/libsangoma/!svn/ver/1/trunk/depcomp +END +compile +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/libsangoma/!svn/ver/1/trunk/compile +END +config.guess +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/libsangoma/!svn/ver/1/trunk/config.guess +END +svn-commit.2.tmp +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/libsangoma/!svn/ver/1/trunk/svn-commit.2.tmp +END +ltmain.sh +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/libsangoma/!svn/ver/1/trunk/ltmain.sh +END +config.sub +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/libsangoma/!svn/ver/1/trunk/config.sub +END +libsangoma.c +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/libsangoma/!svn/ver/1/trunk/libsangoma.c +END +libsangoma.dsp +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/libsangoma/!svn/ver/1/trunk/libsangoma.dsp +END +libsangoma.h +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/libsangoma/!svn/ver/1/trunk/libsangoma.h +END +g711.h +K 25 +svn:wc:ra_dav:version-url +V 39 +/svn/libsangoma/!svn/ver/1/trunk/g711.h +END +INSTALL +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/libsangoma/!svn/ver/1/trunk/INSTALL +END +libsangoma.dsw +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/libsangoma/!svn/ver/1/trunk/libsangoma.dsw +END +COPYING +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/libsangoma/!svn/ver/1/trunk/COPYING +END +NEWS +K 25 +svn:wc:ra_dav:version-url +V 37 +/svn/libsangoma/!svn/ver/1/trunk/NEWS +END +Makefile +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/libsangoma/!svn/ver/1/trunk/Makefile +END +sangoma_pri.c +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/libsangoma/!svn/ver/1/trunk/sangoma_pri.c +END +libsangoma.so.conf +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/libsangoma/!svn/ver/1/trunk/libsangoma.so.conf +END +win_api_common.h +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/libsangoma/!svn/ver/1/trunk/win_api_common.h +END +sangoma_pri.h +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/libsangoma/!svn/ver/1/trunk/sangoma_pri.h +END +version +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/libsangoma/!svn/ver/1/trunk/version +END +configure.in +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/libsangoma/!svn/ver/1/trunk/configure.in +END +ChangeLog +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/libsangoma/!svn/ver/1/trunk/ChangeLog +END +config.status +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/libsangoma/!svn/ver/1/trunk/config.status +END +svn-commit.tmp +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/libsangoma/!svn/ver/1/trunk/svn-commit.tmp +END +README +K 25 +svn:wc:ra_dav:version-url +V 39 +/svn/libsangoma/!svn/ver/1/trunk/README +END +config.h.in +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/libsangoma/!svn/ver/1/trunk/config.h.in +END +libtool +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/libsangoma/!svn/ver/1/trunk/libtool +END +missing +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/libsangoma/!svn/ver/1/trunk/missing +END +Makefile.am +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/libsangoma/!svn/ver/1/trunk/Makefile.am +END +install-sh +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/libsangoma/!svn/ver/1/trunk/install-sh +END +libsangoma.vcproj +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/libsangoma/!svn/ver/1/trunk/libsangoma.vcproj +END diff --git a/api/libsangoma/.svn/entries b/api/libsangoma/.svn/entries index 79f3175..af1aa24 100644 --- a/api/libsangoma/.svn/entries +++ b/api/libsangoma/.svn/entries @@ -1,15 +1,15 @@ 8 dir -237 -svn://sangoma.freeswitch.org/libsangoma/trunk -svn://sangoma.freeswitch.org +1 +https://www.sangomapbx.com/svn/libsangoma/trunk +https://www.sangomapbx.com/svn/libsangoma -2007-07-24T23:10:36.931930Z -231 -ncorbic +2008-02-28T18:51:53.196120Z +1 +root svn:special svn:externals svn:needs-lock @@ -24,7 +24,7 @@ svn:special svn:externals svn:needs-lock -2028fedf-720c-0410-83b8-d54a3e729fb0 +8fe45b59-3c47-0410-bdf9-e5d932a076a6 configure file @@ -32,11 +32,11 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z cdcb22cae8ad2d0de88542d1adf5b13d -2007-02-07T19:00:12.109961Z -166 -ncorbic +2008-02-28T18:51:53.196120Z +1 +root has-props Makefile.in @@ -45,11 +45,23 @@ file -2007-07-24T22:45:02.000000Z +2008-02-28T19:04:34.000000Z 1c05e844314274f082a74abf3f446239 -2007-05-29T18:03:36.038276Z -206 -ncorbic +2008-02-28T18:51:53.196120Z +1 +root + +config.log +file + + + + +2008-02-28T19:04:34.000000Z +1584c0969324cd96c0864b8e43ee0b0f +2008-02-28T18:51:53.196120Z +1 +root AUTHORS file @@ -57,11 +69,11 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z d41d8cd98f00b204e9800998ecf8427e -2006-02-10T16:20:41.709688Z +2008-02-28T18:51:53.196120Z 1 -anthm +root depcomp file @@ -69,11 +81,11 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z e181e2c8720c60522c4c4c981108e367 -2006-02-10T16:20:41.709688Z +2008-02-28T18:51:53.196120Z 1 -anthm +root has-props compile @@ -82,11 +94,11 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z a7ecc032b527a0d578545f19d3418073 -2006-02-10T16:20:41.709688Z +2008-02-28T18:51:53.196120Z 1 -anthm +root has-props config.guess @@ -95,11 +107,48 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z 9ae396244b8f138c76514a6b7531e696 -2006-02-10T16:20:41.709688Z +2008-02-28T18:51:53.196120Z 1 -anthm +root +has-props + +svn-commit.2.tmp +file + + + + +2008-02-28T19:04:34.000000Z +9bf5427f205140ba936f4feb06d54cac +2008-02-28T18:51:53.196120Z +1 +root + +ltmain.sh +file + + + + +2008-02-28T19:04:34.000000Z +c8215e3aa0858d700783015614f53b79 +2008-02-28T18:51:53.196120Z +1 +root + +config.sub +file + + + + +2008-02-28T19:04:34.000000Z +3d36962d51070d30b7554203b0d7c01c +2008-02-28T18:51:53.196120Z +1 +root has-props libsangoma.c @@ -108,36 +157,11 @@ file -2007-07-24T23:09:55.000000Z -cb02ecd239d3d3d37cf6d5e704a0dc39 -2007-07-24T23:10:36.931930Z -231 -ncorbic - -ltmain.sh -file - - - - -2007-05-17T23:49:20.000000Z -c8215e3aa0858d700783015614f53b79 -2006-02-10T16:20:41.709688Z +2008-02-28T19:04:34.000000Z +20fa69ba4181e245e810703d4c1787bd +2008-02-28T18:51:53.196120Z 1 -anthm - -config.sub -file - - - - -2007-05-17T23:49:20.000000Z -3d36962d51070d30b7554203b0d7c01c -2006-02-10T16:20:41.709688Z -1 -anthm -has-props +root libsangoma.dsp file @@ -145,11 +169,11 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z f934aab66c529599725686f321d182e6 -2006-12-04T20:48:10.874618Z -156 -anthm +2008-02-28T18:51:53.196120Z +1 +root libsangoma.h file @@ -157,11 +181,11 @@ file -2007-07-24T22:47:49.000000Z -19c2545ffa4e1a11f2a1b5f4850a10bd -2007-07-24T22:47:39.060265Z -230 -ncorbic +2008-02-28T19:04:34.000000Z +3a381ddb82700688b9ea1dcdb1f10d6a +2008-02-28T18:51:53.196120Z +1 +root g711.h file @@ -169,11 +193,11 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z 0f725f95ced42af15dcaef21f3a1722b -2006-11-06T23:11:15.401413Z -119 -ncorbic +2008-02-28T18:51:53.196120Z +1 +root INSTALL file @@ -181,23 +205,11 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z 40539bd3eff06e4b82f380103145415b -2006-08-08T19:52:23.727343Z -94 -ncorbic - -libsangoma.dsw -file - - - - -2007-05-17T23:49:20.000000Z -f13496d2105bae2add104c36a1d656f6 -2006-12-04T20:48:10.874618Z -156 -anthm +2008-02-28T18:51:53.196120Z +1 +root COPYING file @@ -205,11 +217,47 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z d41d8cd98f00b204e9800998ecf8427e -2006-02-10T16:20:41.709688Z +2008-02-28T18:51:53.196120Z 1 -anthm +root + +libsangoma.dsw +file + + + + +2008-02-28T19:04:34.000000Z +f13496d2105bae2add104c36a1d656f6 +2008-02-28T18:51:53.196120Z +1 +root + +diff +file +2 + + + + + + + + + + + + + + + + + + + +deleted NEWS file @@ -217,11 +265,23 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z d41d8cd98f00b204e9800998ecf8427e -2006-02-10T16:20:41.709688Z +2008-02-28T18:51:53.196120Z 1 -anthm +root + +Makefile +file + + + + +2008-02-28T19:04:34.000000Z +c4406ae0adf00115003a0530d2e2c5d0 +2008-02-28T18:51:53.196120Z +1 +root libsangoma.so.conf file @@ -229,11 +289,11 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z bcdcb23c5d5fb460cee2ce315ef7bd32 -2006-10-19T19:27:09.335085Z -101 -ncorbic +2008-02-28T18:51:53.196120Z +1 +root sangoma_pri.c file @@ -241,11 +301,11 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z e2a6c68fadfefb2d2b16c52534e85675 -2006-12-04T20:47:20.283144Z -155 -anthm +2008-02-28T18:51:53.196120Z +1 +root win_api_common.h file @@ -253,11 +313,11 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z b6be170d18fa90b79f7264cf8b0f7348 -2006-12-04T22:21:07.339224Z -157 -mikej +2008-02-28T18:51:53.196120Z +1 +root version file @@ -265,11 +325,11 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z 35f672d1fb01b542f667952c9dbb26fe -2006-02-10T16:20:41.709688Z +2008-02-28T18:51:53.196120Z 1 -anthm +root sangoma_pri.h file @@ -277,11 +337,11 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z f24c6cf396aeaa6df2747f7f6b32969d -2006-03-24T14:19:31.976520Z -28 -anthm +2008-02-28T18:51:53.196120Z +1 +root configure.in file @@ -289,11 +349,24 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z 5b9888fc365c4ebffdbb55656c091a2f -2007-02-07T19:00:12.109961Z -166 -ncorbic +2008-02-28T18:51:53.196120Z +1 +root + +config.status +file + + + + +2008-02-28T19:04:34.000000Z +75ac9809637055fcbd3f4be64fab529f +2008-02-28T18:51:53.196120Z +1 +root +has-props ChangeLog file @@ -301,11 +374,23 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z d41d8cd98f00b204e9800998ecf8427e -2006-02-10T16:20:41.709688Z +2008-02-28T18:51:53.196120Z 1 -anthm +root + +svn-commit.tmp +file + + + + +2008-02-28T19:04:34.000000Z +4ac38b24bcff9c3975171af8ccbcfa36 +2008-02-28T18:51:53.196120Z +1 +root README file @@ -313,11 +398,11 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z e8a0abce86211364eb60bbe6e07d4b05 -2006-02-14T19:06:52.853886Z -6 -nenad +2008-02-28T18:51:53.196120Z +1 +root config.h.in file @@ -325,23 +410,24 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z 5c51918deee8d041af37226bd4b4271e -2006-02-10T16:20:41.709688Z +2008-02-28T18:51:53.196120Z 1 -anthm +root -Makefile.am +libtool file -2007-07-24T22:45:02.000000Z -061d814c4cf9a1066e4ff2501fa0a100 -2007-05-29T18:03:36.038276Z -206 -ncorbic +2008-02-28T19:04:34.000000Z +898515184ba0d7df32a1913b7f3ee099 +2008-02-28T18:51:53.196120Z +1 +root +has-props missing file @@ -349,24 +435,27 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z fd5dd60aa8cefab9462677280ea74a61 -2006-02-10T16:20:41.709688Z +2008-02-28T18:51:53.196120Z 1 -anthm +root has-props -aclocal.m4 +Makefile.am file -2007-05-17T23:49:20.000000Z -dd02d76e53ac83f5112d68797e8f52e3 -2007-02-07T19:00:12.109961Z -166 -ncorbic +2008-02-28T19:04:34.000000Z +061d814c4cf9a1066e4ff2501fa0a100 +2008-02-28T18:51:53.196120Z +1 +root + +examples +dir install-sh file @@ -374,25 +463,22 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z 92067666ddce97609bd0ec67d36460cd -2006-02-10T16:20:41.709688Z +2008-02-28T18:51:53.196120Z 1 -anthm +root has-props -examples -dir - libsangoma.vcproj file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z a09711e3b6aac93dd48d8e9b3014955f -2006-12-04T22:24:41.715361Z -158 -mikej +2008-02-28T18:51:53.196120Z +1 +root diff --git a/api/libsangoma/.svn/prop-base/config.status.svn-base b/api/libsangoma/.svn/prop-base/config.status.svn-base new file mode 100644 index 0000000..a669705 --- /dev/null +++ b/api/libsangoma/.svn/prop-base/config.status.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 0 + +END diff --git a/api/libsangoma/.svn/prop-base/libtool.svn-base b/api/libsangoma/.svn/prop-base/libtool.svn-base new file mode 100644 index 0000000..a669705 --- /dev/null +++ b/api/libsangoma/.svn/prop-base/libtool.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 0 + +END diff --git a/api/libsangoma/.svn/text-base/Makefile.svn-base b/api/libsangoma/.svn/text-base/Makefile.svn-base new file mode 100644 index 0000000..ac4db0c --- /dev/null +++ b/api/libsangoma/.svn/text-base/Makefile.svn-base @@ -0,0 +1,679 @@ +# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 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. + + + + + +SOURCES = $(libsangoma_a_SOURCES) $(libsangoma_la_SOURCES) + +srcdir = . +top_srcdir = . + +pkgdatadir = $(datadir)/libsangoma +pkglibdir = $(libdir)/libsangoma +pkgincludedir = $(includedir)/libsangoma +top_builddir = . +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = /usr/bin/install -c +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 = i686-pc-linux-gnu +host_triplet = i686-pc-linux-gnu +#am__append_1 = sangoma_pri.c sangoma_pri.h +#am__append_2 = sangoma_pri.h +#am__append_3 = -I$(libpripath) +#am__append_4 = -L$(libpripath) -lpri +DIST_COMMON = README $(am__configure_deps) \ + $(am__library_include_HEADERS_DIST) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \ + ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \ + install-sh ltmain.sh missing +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(install_sh) -d +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)" "$(DESTDIR)$(libdir)" \ + "$(DESTDIR)$(library_includedir)" +libLIBRARIES_INSTALL = $(INSTALL_DATA) +LIBRARIES = $(lib_LIBRARIES) +ARFLAGS = cru +libsangoma_a_AR = $(AR) $(ARFLAGS) +libsangoma_a_LIBADD = +am_libsangoma_a_OBJECTS = +libsangoma_a_OBJECTS = $(am_libsangoma_a_OBJECTS) +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +libsangoma_la_LIBADD = +am__libsangoma_la_SOURCES_DIST = libsangoma.c libsangoma.h \ + sangoma_pri.c sangoma_pri.h +#am__objects_1 = libsangoma_la-sangoma_pri.lo +am__objects_2 = libsangoma_la-libsangoma.lo $(am__objects_1) +am_libsangoma_la_OBJECTS = $(am__objects_2) +libsangoma_la_OBJECTS = $(am_libsangoma_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libsangoma_a_SOURCES) $(libsangoma_la_SOURCES) +DIST_SOURCES = $(libsangoma_a_SOURCES) \ + $(am__libsangoma_la_SOURCES_DIST) +am__library_include_HEADERS_DIST = libsangoma.h sangoma_pri.h +library_includeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(library_include_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = ${SHELL} /usr/src/libsangoma/trunk/missing --run aclocal-1.9 +AMDEP_FALSE = # +AMDEP_TRUE = +AMTAR = ${SHELL} /usr/src/libsangoma/trunk/missing --run tar +AR = ar +AUTOCONF = ${SHELL} /usr/src/libsangoma/trunk/missing --run autoconf +AUTOHEADER = ${SHELL} /usr/src/libsangoma/trunk/missing --run autoheader +AUTOMAKE = ${SHELL} /usr/src/libsangoma/trunk/missing --run automake-1.9 +AWK = gawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -g -O2 +CPP = gcc -E +CPPFLAGS = +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DPACKAGE_NAME=\"libsangoma\" -DPACKAGE_TARNAME=\"libsangoma\" -DPACKAGE_VERSION=\"1.0.0\" -DPACKAGE_STRING=\"libsangoma\ 1.0.0\" -DPACKAGE_BUGREPORT=\"anthmct@yahoo.com\" -DPACKAGE=\"libsangoma\" -DVERSION=\"1.0.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FCNTL_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MATH_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_SOCKET_H=1 -DSELECT_TYPE_ARG1=int -DSELECT_TYPE_ARG234=\(fd_set\ \*\) -DSELECT_TYPE_ARG5=\(struct\ timeval\ \*\) -DHAVE_GETTIMEOFDAY=1 -DHAVE_MEMSET=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1 +DEPDIR = .deps +ECHO = echo +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = grep -E +EXEEXT = +F77 = g77 +FFLAGS = -g -O2 +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s +LDFLAGS = +LIBOBJS = +LIBPRI_FALSE = +LIBPRI_TRUE = # +LIBS = +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LN_S = ln -s +LTLIBOBJS = +MAKEINFO = ${SHELL} /usr/src/libsangoma/trunk/missing --run makeinfo +OBJEXT = o +PACKAGE = libsangoma +PACKAGE_BUGREPORT = anthmct@yahoo.com +PACKAGE_NAME = libsangoma +PACKAGE_STRING = libsangoma 1.0.0 +PACKAGE_TARNAME = libsangoma +PACKAGE_VERSION = 1.0.0 +PATH_SEPARATOR = : +RANLIB = ranlib +SET_MAKE = +SHELL = /bin/sh +STRIP = strip +VERSION = 1.0.0 +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_F77 = g77 +ac_ct_RANLIB = ranlib +ac_ct_STRIP = strip +am__fastdepCC_FALSE = # +am__fastdepCC_TRUE = +am__fastdepCXX_FALSE = # +am__fastdepCXX_TRUE = +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +bindir = ${exec_prefix}/bin +build = i686-pc-linux-gnu +build_alias = +build_cpu = i686 +build_os = linux-gnu +build_vendor = pc +datadir = ${prefix}/share +exec_prefix = ${prefix} +host = i686-pc-linux-gnu +host_alias = +host_cpu = i686 +host_os = linux-gnu +host_vendor = pc +includedir = ${prefix}/include +infodir = ${prefix}/info +install_sh = /usr/src/libsangoma/trunk/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +libpripath = +localstatedir = ${prefix}/var +mandir = ${prefix}/man +mkdir_p = mkdir -p -- +oldincludedir = /usr/include +prefix = /usr/local +program_transform_name = s,x,x, +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +sysconfdir = ${prefix}/etc +target_alias = +KINC = /lib/modules/$(shell uname -r)/build +WINC = ../../patches/kdrivers/include +AM_CFLAGS = -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes -g -I$(WINC) -I$(KINC)/include -I. \ + -D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O2 -D_DEBUG_=2 -D_GNUC_ -I../lib -I$(KINC)/include + +LIB_SOURCES = libsangoma.c libsangoma.h $(am__append_1) +library_includedir = $(includedir) +library_include_HEADERS = libsangoma.h $(am__append_2) +lib_LTLIBRARIES = libsangoma.la +libsangoma_la_CFLAGS = $(AM_CFLAGS) $(am__append_3) +libsangoma_la_LDFLAGS = -version-info 1:0:0 $(am__append_4) +libsangoma_la_SOURCES = $(LIB_SOURCES) +lib_LIBRARIES = libsangoma.a +libsangoma_a_CFLAGS = $(AM_CFLAGS) +libsangoma_a_SOURCES = $(LIB_SOUCES) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +install-libLIBRARIES: $(lib_LIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + @$(POST_INSTALL) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + p=$(am__strip_dir) \ + echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \ + $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \ + else :; fi; \ + done + +uninstall-libLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLIBRARIES: + -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) +libsangoma.a: $(libsangoma_a_OBJECTS) $(libsangoma_a_DEPENDENCIES) + -rm -f libsangoma.a + $(libsangoma_a_AR) libsangoma.a $(libsangoma_a_OBJECTS) $(libsangoma_a_LIBADD) + $(RANLIB) libsangoma.a +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 +libsangoma.la: $(libsangoma_la_OBJECTS) $(libsangoma_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libsangoma_la_LDFLAGS) $(libsangoma_la_OBJECTS) $(libsangoma_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/libsangoma_la-libsangoma.Plo +include ./$(DEPDIR)/libsangoma_la-sangoma_pri.Plo + +.c.o: + if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c $< + +.c.obj: + if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: + if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LTCOMPILE) -c -o $@ $< + +libsangoma_la-libsangoma.lo: libsangoma.c + if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -MT libsangoma_la-libsangoma.lo -MD -MP -MF "$(DEPDIR)/libsangoma_la-libsangoma.Tpo" -c -o libsangoma_la-libsangoma.lo `test -f 'libsangoma.c' || echo '$(srcdir)/'`libsangoma.c; \ + then mv -f "$(DEPDIR)/libsangoma_la-libsangoma.Tpo" "$(DEPDIR)/libsangoma_la-libsangoma.Plo"; else rm -f "$(DEPDIR)/libsangoma_la-libsangoma.Tpo"; exit 1; fi +# source='libsangoma.c' object='libsangoma_la-libsangoma.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -c -o libsangoma_la-libsangoma.lo `test -f 'libsangoma.c' || echo '$(srcdir)/'`libsangoma.c + +libsangoma_la-sangoma_pri.lo: sangoma_pri.c + if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -MT libsangoma_la-sangoma_pri.lo -MD -MP -MF "$(DEPDIR)/libsangoma_la-sangoma_pri.Tpo" -c -o libsangoma_la-sangoma_pri.lo `test -f 'sangoma_pri.c' || echo '$(srcdir)/'`sangoma_pri.c; \ + then mv -f "$(DEPDIR)/libsangoma_la-sangoma_pri.Tpo" "$(DEPDIR)/libsangoma_la-sangoma_pri.Plo"; else rm -f "$(DEPDIR)/libsangoma_la-sangoma_pri.Tpo"; exit 1; fi +# source='sangoma_pri.c' object='libsangoma_la-sangoma_pri.lo' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -c -o libsangoma_la-sangoma_pri.lo `test -f 'sangoma_pri.c' || echo '$(srcdir)/'`sangoma_pri.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-library_includeHEADERS: $(library_include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(library_includedir)" || $(mkdir_p) "$(DESTDIR)$(library_includedir)" + @list='$(library_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(library_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(library_includedir)/$$f'"; \ + $(library_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(library_includedir)/$$f"; \ + done + +uninstall-library_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(library_include_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(library_includedir)/$$f'"; \ + rm -f "$(DESTDIR)$(library_includedir)/$$f"; \ + done + +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) + $(am__remove_distdir) + mkdir $(distdir) + @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 + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(library_includedir)"; 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-generic clean-libLIBRARIES clean-libLTLIBRARIES \ + clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -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-library_includeHEADERS + +install-exec-am: install-libLIBRARIES install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -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-libLIBRARIES \ + uninstall-libLTLIBRARIES uninstall-library_includeHEADERS + +.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ + clean-generic clean-libLIBRARIES clean-libLTLIBRARIES \ + clean-libtool ctags dist dist-all dist-bzip2 dist-gzip \ + dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck 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-libLIBRARIES \ + install-libLTLIBRARIES install-library_includeHEADERS \ + 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-libLIBRARIES \ + uninstall-libLTLIBRARIES uninstall-library_includeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/api/libsangoma/.svn/text-base/aclocal.m4.svn-base b/api/libsangoma/.svn/text-base/aclocal.m4.svn-base deleted file mode 100644 index 8a90c6a..0000000 --- a/api/libsangoma/.svn/text-base/aclocal.m4.svn-base +++ /dev/null @@ -1,6945 +0,0 @@ -# generated automatically by aclocal 1.9.2 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# 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 47 AC_PROG_LIBTOOL - - -# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -# ----------------------------------------------------------- -# If this macro is not defined by Autoconf, define it here. -m4_ifdef([AC_PROVIDE_IFELSE], - [], - [m4_define([AC_PROVIDE_IFELSE], - [m4_ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - - -# AC_PROG_LIBTOOL -# --------------- -AC_DEFUN([AC_PROG_LIBTOOL], -[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl -dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX -dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. - AC_PROVIDE_IFELSE([AC_PROG_CXX], - [AC_LIBTOOL_CXX], - [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX - ])]) -dnl And a similar setup for Fortran 77 support - AC_PROVIDE_IFELSE([AC_PROG_F77], - [AC_LIBTOOL_F77], - [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 -])]) - -dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. -dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run -dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. - AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [ifdef([AC_PROG_GCJ], - [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([A][M_PROG_GCJ], - [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([LT_AC_PROG_GCJ], - [define([LT_AC_PROG_GCJ], - defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) -])])# AC_PROG_LIBTOOL - - -# _AC_PROG_LIBTOOL -# ---------------- -AC_DEFUN([_AC_PROG_LIBTOOL], -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -# Prevent multiple expansion -define([AC_PROG_LIBTOOL], []) -])# _AC_PROG_LIBTOOL - - -# AC_LIBTOOL_SETUP -# ---------------- -AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.50)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl -AC_REQUIRE([AC_PROG_NM])dnl - -AC_REQUIRE([AC_PROG_LN_S])dnl -AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! -AC_REQUIRE([AC_OBJEXT])dnl -AC_REQUIRE([AC_EXEEXT])dnl -dnl - -AC_LIBTOOL_SYS_MAX_CMD_LEN -AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -AC_LIBTOOL_OBJDIR - -AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -_LT_AC_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] - -# Same as above, but do not quote variable references. -[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -AC_CHECK_TOOL(AR, ar, false) -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - AC_PATH_MAGIC - fi - ;; -esac - -AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -enable_win32_dll=yes, enable_win32_dll=no) - -AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -AC_ARG_WITH([pic], - [AC_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) -test -z "$pic_mode" && pic_mode=default - -# Use C for the default configuration in the libtool script -tagname= -AC_LIBTOOL_LANG_C_CONFIG -_LT_AC_TAGCONFIG -])# AC_LIBTOOL_SETUP - - -# _LT_AC_SYS_COMPILER -# ------------------- -AC_DEFUN([_LT_AC_SYS_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_AC_SYS_COMPILER - - -# _LT_AC_SYS_LIBPATH_AIX -# ---------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_AC_SYS_LIBPATH_AIX - - -# _LT_AC_SHELL_INIT(ARG) -# ---------------------- -AC_DEFUN([_LT_AC_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_AC_SHELL_INIT - - -# _LT_AC_PROG_ECHO_BACKSLASH -# -------------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. -AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[_LT_AC_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; -esac - -echo=${ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -fi - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null && - echo_test_string="`eval $cmd`" && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null - then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL [$]0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "[$]0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi - -AC_SUBST(ECHO) -])])# _LT_AC_PROG_ECHO_BACKSLASH - - -# _LT_AC_LOCK -# ----------- -AC_DEFUN([_LT_AC_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|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-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw* | *-*-pw32*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; - ]) -esac - -need_locks="$enable_libtool_lock" - -])# _LT_AC_LOCK - - -# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], -[AC_REQUIRE([LT_AC_PROG_SED]) -AC_CACHE_CHECK([$1], [$2], - [$2=no - ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - $2=yes - fi - fi - $rm conftest* -]) - -if test x"[$]$2" = xyes; then - ifelse([$5], , :, [$5]) -else - ifelse([$6], , :, [$6]) -fi -])# AC_LIBTOOL_COMPILER_OPTION - - -# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ------------------------------------------------------------ -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - else - $2=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - ifelse([$4], , :, [$4]) -else - ifelse([$5], , :, [$5]) -fi -])# AC_LIBTOOL_LINKER_OPTION - - -# AC_LIBTOOL_SYS_MAX_CMD_LEN -# -------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], -[# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - 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; - ;; - - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$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` - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -])# AC_LIBTOOL_SYS_MAX_CMD_LEN - - -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h)dnl -])# _LT_AC_CHECK_DLFCN - - -# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ------------------------------------------------------------------ -AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -}] -EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_unknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_AC_TRY_DLOPEN_SELF - - -# AC_LIBTOOL_DLOPEN_SELF -# ------------------- -AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -])# AC_LIBTOOL_DLOPEN_SELF - - -# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) -# --------------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler -AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . - $rm conftest* - # 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" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) -fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -])# AC_LIBTOOL_SYS_LIB_STRIP - - -# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# ----------------------------- -# PORTME Fill in your ld.so characteristics -AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -[AC_MSG_CHECKING([dynamic linker characteristics]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_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 - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext_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' - 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)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - else - sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -kfreebsd*-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='GNU ld.so' - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext_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' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # find out which ABI we are using - libsuff= - case "$host_cpu" in - x86_64*|s390x*|powerpc64*) - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *64-bit*) - libsuff=64 - sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" - ;; - esac - fi - rm -rf conftest* - ;; - esac - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $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' - ;; - -knetbsd*-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='GNU ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${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 - need_lib_prefix=no - need_version=yes - 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" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no -])# AC_LIBTOOL_SYS_DYNAMIC_LINKER - - -# _LT_AC_TAGCONFIG -# ---------------- -AC_DEFUN([_LT_AC_TAGCONFIG], -[AC_ARG_WITH([tags], - [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], - [include additional configurations @<:@automatic@:>@])], - [tagnames="$withval"]) - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - AC_MSG_WARN([output file `$ofile' does not exist]) - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) - else - AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in - "") ;; - *) AC_MSG_ERROR([invalid tag name: $tagname]) - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - AC_MSG_ERROR([tag name \"$tagname\" already exists]) - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then - AC_LIBTOOL_LANG_CXX_CONFIG - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - AC_LIBTOOL_LANG_F77_CONFIG - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - AC_LIBTOOL_LANG_GCJ_CONFIG - else - tagname="" - fi - ;; - - RC) - AC_LIBTOOL_LANG_RC_CONFIG - ;; - - *) - AC_MSG_ERROR([Unsupported tag name: $tagname]) - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - AC_MSG_ERROR([unable to update list of available tagged configurations.]) - fi -fi -])# _LT_AC_TAGCONFIG - - -# AC_LIBTOOL_DLOPEN -# ----------------- -# enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], - [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_DLOPEN - - -# AC_LIBTOOL_WIN32_DLL -# -------------------- -# declare package support for building win32 dll's -AC_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_WIN32_DLL - - -# AC_ENABLE_SHARED([DEFAULT]) -# --------------------------- -# implement the --enable-shared flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_SHARED], -[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([shared], - [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]AC_ENABLE_SHARED_DEFAULT) -])# AC_ENABLE_SHARED - - -# AC_DISABLE_SHARED -# ----------------- -#- set the default shared flag to --disable-shared -AC_DEFUN([AC_DISABLE_SHARED], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no) -])# AC_DISABLE_SHARED - - -# AC_ENABLE_STATIC([DEFAULT]) -# --------------------------- -# implement the --enable-static flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_STATIC], -[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([static], - [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]AC_ENABLE_STATIC_DEFAULT) -])# AC_ENABLE_STATIC - - -# AC_DISABLE_STATIC -# ----------------- -# set the default static flag to --disable-static -AC_DEFUN([AC_DISABLE_STATIC], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no) -])# AC_DISABLE_STATIC - - -# AC_ENABLE_FAST_INSTALL([DEFAULT]) -# --------------------------------- -# implement the --enable-fast-install flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_FAST_INSTALL], -[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([fast-install], - [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) -])# AC_ENABLE_FAST_INSTALL - - -# AC_DISABLE_FAST_INSTALL -# ----------------------- -# set the default to --disable-fast-install -AC_DEFUN([AC_DISABLE_FAST_INSTALL], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no) -])# AC_DISABLE_FAST_INSTALL - - -# AC_LIBTOOL_PICMODE([MODE]) -# -------------------------- -# implement the --with-pic flag -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -AC_DEFUN([AC_LIBTOOL_PICMODE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -pic_mode=ifelse($#,1,$1,default) -])# AC_LIBTOOL_PICMODE - - -# AC_PROG_EGREP -# ------------- -# This is predefined starting with Autoconf 2.54, so this conditional -# definition can be removed once we require Autoconf 2.54 or later. -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], -[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], - [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi]) - EGREP=$ac_cv_prog_egrep - AC_SUBST([EGREP]) -])]) - - -# AC_PATH_TOOL_PREFIX -# ------------------- -# find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="ifelse([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -])# AC_PATH_TOOL_PREFIX - - -# AC_PATH_MAGIC -# ------------- -# find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# AC_PATH_MAGIC - - -# AC_PROG_LD -# ---------- -# find the 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 GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6* | nonstopux*) - case $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*) - case $host_cpu in - alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64*) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -nto-qnx*) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' - else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown -])# AC_DEPLIBS_CHECK_METHOD - - -# AC_PROG_NM -# ---------- -# find the 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_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/${ac_tool_prefix}nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - esac - fi - done - IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -])# AC_PROG_NM - - -# AC_CHECK_LIBM -# ------------- -# check for math library -AC_DEFUN([AC_CHECK_LIBM], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -])# AC_CHECK_LIBM - - -# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl convenience library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -AC_DEFUN([AC_LIBLTDL_CONVENIENCE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case $enable_ltdl_convenience in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_CONVENIENCE - - -# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl installable library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided and an installed libltdl is not found, it is -# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' -# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single -# quotes!). If your package is not flat and you're not using automake, -# define top_builddir and top_srcdir appropriately in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN([AC_LIBLTDL_INSTALLABLE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, lt_dlinit, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_INSTALLABLE - - -# AC_LIBTOOL_CXX -# -------------- -# enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], -[AC_REQUIRE([_LT_AC_LANG_CXX]) -])# AC_LIBTOOL_CXX - - -# _LT_AC_LANG_CXX -# --------------- -AC_DEFUN([_LT_AC_LANG_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) -_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) -])# _LT_AC_LANG_CXX - - -# AC_LIBTOOL_F77 -# -------------- -# enable support for Fortran 77 libraries -AC_DEFUN([AC_LIBTOOL_F77], -[AC_REQUIRE([_LT_AC_LANG_F77]) -])# AC_LIBTOOL_F77 - - -# _LT_AC_LANG_F77 -# --------------- -AC_DEFUN([_LT_AC_LANG_F77], -[AC_REQUIRE([AC_PROG_F77]) -_LT_AC_SHELL_INIT([tagnames=${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;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - -_LT_AC_SYS_COMPILER - -# -# Check for any special shared library compilation flags. -# -_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' - ;; - esac -fi -if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then - AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) - _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), - $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), - [], - [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) - - -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($1) - -# Report which librarie types wil actually be built -AC_MSG_CHECKING([if libtool supports shared libraries]) -AC_MSG_RESULT([$can_build_shared]) - -AC_MSG_CHECKING([whether to build shared libraries]) -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4* | aix5*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - darwin* | rhapsody*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $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 ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=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([AC_PROG_CXXCPP]) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Dependencies to place before and after the object being linked: -_LT_AC_TAGVAR(predep_objects, $1)= -_LT_AC_TAGVAR(postdep_objects, $1)= -_LT_AC_TAGVAR(predeps, $1)= -_LT_AC_TAGVAR(postdeps, $1)= -_LT_AC_TAGVAR(compiler_lib_search_path, $1)= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' -else - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - AC_PROG_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -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 - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - darwin* | rhapsody*) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $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 ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - 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* | kfreebsd*-gnu) - # 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 - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - cxx) - # Compaq C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - m88k*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - sco*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; -esac -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$GXX" -_LT_AC_TAGVAR(LD, $1)="$LD" - -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_SYS_LIB_STRIP -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -])# AC_LIBTOOL_LANG_CXX_CONFIG - -# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) -# ------------------------ -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" -ifelse([$1], [], -[#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG], -[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) - -# Is the compiler the GNU C compiler? -with_gcc=$_LT_AC_TAGVAR(GCC, $1) - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_[]_LT_AC_TAGVAR(LD, $1) - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$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 library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" - -# Set to yes if exported symbols are required. -always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) - -# The commands to list exported symbols. -export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) - -# Symbols that must always be exported. -include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) - -ifelse([$1],[], -[# ### END LIBTOOL CONFIG], -[# ### END LIBTOOL TAG CONFIG: $tagname]) - -__EOF__ - -ifelse([$1],[], [ - case $host_os in - aix3*) - cat <<\EOF >> "$cfgfile" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -]) -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - 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([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDRT]]' - ;; -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 - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[[]] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - - -# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) -# --------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], -[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) - ifelse([$1],[CXX],[ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | kfreebsd*-gnu) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - icpc) - # Intel C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx) - # Digital/Compaq C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc) - # Lucid - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - newsos6) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - linux*) - case $CC in - icc* | ecc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - ccc*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' - ;; - - solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sunos4*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - uts4*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then - AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), - [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" - ;; -esac -]) - - -# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) -# ------------------------------------ -# See if the linker supports building shared libraries. -AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -ifelse([$1],[CXX],[ - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -],[ - runpath_var= - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)= - _LT_AC_TAGVAR(archive_expsym_cmds, $1)= - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown - _LT_AC_TAGVAR(hardcode_automatic, $1)=no - _LT_AC_TAGVAR(module_cmds, $1)= - _LT_AC_TAGVAR(module_expsym_cmds, $1)= - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_AC_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sunos4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" - 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 - 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 -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds" - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - # see comment about different semantics on the GNU ld section - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - bsdi4*) - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_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' - fix_srcfile_path='`cygpath -w "$srcfile"`' - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - if test "$GXX" = yes ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $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 ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - 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* | kfreebsd*-gnu) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4.2uw2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv5*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_AC_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac -])# AC_LIBTOOL_PROG_LD_SHLIBS - - -# _LT_AC_FILE_LTDLL_C -# ------------------- -# Be careful that the start marker always follows a newline. -AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include -# #undef WIN32_LEAN_AND_MEAN -# #include -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ -])# _LT_AC_FILE_LTDLL_C - - -# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) -# --------------------------------- -AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) - - -# old names -AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) -AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) -AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) -AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) -AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) - -# This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL]) - -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - -AC_DEFUN([LT_AC_PROG_RC], -[AC_CHECK_TOOL(RC, windres, no) -]) - -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -# LT_AC_PROG_SED -# -------------- -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -AC_DEFUN([LT_AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -SED=$lt_cv_path_SED -]) -AC_MSG_RESULT([$SED]) -]) - -# -*- Autoconf -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. -# Generated from amversion.in; do not edit by hand. - -# 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., 59 Temple Place - Suite 330, Boston, MA - -# 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.2])]) - -# AM_AUX_DIR_EXPAND - -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# 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 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 6 - -# 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])]) - -# serial 7 -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 -# 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - - -# 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 -# 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -#serial 2 - -# _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 -*- - -# 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. - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 11 - -# 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]) - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. - -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -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)]) - -# -*- Autoconf -*- -# Copyright (C) 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 1 - -# 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 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 - -# 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 -]) - -# -*- Autoconf -*- - - -# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - -# 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 -]) - -# AM_PROG_MKDIR_P -# --------------- -# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. - -# Copyright (C) 2003, 2004 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# 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 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 - -# _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. -# - -# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - -# 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)]) - -# AM_PROG_INSTALL_STRIP - -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# 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 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 1 - - -# _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 - diff --git a/api/libsangoma/.svn/text-base/config.log.svn-base b/api/libsangoma/.svn/text-base/config.log.svn-base new file mode 100644 index 0000000..02c7292 --- /dev/null +++ b/api/libsangoma/.svn/text-base/config.log.svn-base @@ -0,0 +1,1053 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by libsangoma configure 1.0.0, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ ./configure --no-create --no-recursion + +## --------- ## +## Platform. ## +## --------- ## + +hostname = sangoma_mantis +uname -m = i686 +uname -r = 2.6.9-22.EL +uname -s = Linux +uname -v = #1 Sat Oct 8 17:48:27 CDT 2005 + +/usr/bin/uname -p = unknown +/bin/uname -X = unknown + +/bin/arch = i686 +/usr/bin/arch -k = unknown +/usr/convex/getsysinfo = unknown +hostinfo = unknown +/bin/machine = unknown +/usr/bin/oslevel = unknown +/bin/universe = unknown + +PATH: /usr/kerberos/sbin +PATH: /usr/kerberos/bin +PATH: /usr/local/sbin +PATH: /usr/local/bin +PATH: /sbin +PATH: /bin +PATH: /usr/sbin +PATH: /usr/bin +PATH: /usr/X11R6/bin +PATH: /root/bin + + +## ----------- ## +## Core tests. ## +## ----------- ## + +configure:1551: checking for a BSD-compatible install +configure:1606: result: /usr/bin/install -c +configure:1617: checking whether build environment is sane +configure:1660: result: yes +configure:1725: checking for gawk +configure:1741: found /bin/gawk +configure:1751: result: gawk +configure:1761: checking whether make sets $(MAKE) +configure:1781: result: yes +configure:1996: checking for gcc +configure:2012: found /usr/bin/gcc +configure:2022: result: gcc +configure:2266: checking for C compiler version +configure:2269: gcc --version &5 +gcc (GCC) 3.4.4 20050721 (Red Hat 3.4.4-2) +Copyright (C) 2004 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. + +configure:2272: $? = 0 +configure:2274: gcc -v &5 +Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.4/specs +Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux +Thread model: posix +gcc version 3.4.4 20050721 (Red Hat 3.4.4-2) +configure:2277: $? = 0 +configure:2279: gcc -V &5 +gcc: `-V' option must have argument +configure:2282: $? = 1 +configure:2305: checking for C compiler default output file name +configure:2308: gcc conftest.c >&5 +configure:2311: $? = 0 +configure:2357: result: a.out +configure:2362: checking whether the C compiler works +configure:2368: ./a.out +configure:2371: $? = 0 +configure:2388: result: yes +configure:2395: checking whether we are cross compiling +configure:2397: result: no +configure:2400: checking for suffix of executables +configure:2402: gcc -o conftest conftest.c >&5 +configure:2405: $? = 0 +configure:2430: result: +configure:2436: checking for suffix of object files +configure:2457: gcc -c conftest.c >&5 +configure:2460: $? = 0 +configure:2482: result: o +configure:2486: checking whether we are using the GNU C compiler +configure:2510: gcc -c conftest.c >&5 +configure:2516: $? = 0 +configure:2520: test -z + || test ! -s conftest.err +configure:2523: $? = 0 +configure:2526: test -s conftest.o +configure:2529: $? = 0 +configure:2542: result: yes +configure:2548: checking whether gcc accepts -g +configure:2569: gcc -c -g conftest.c >&5 +configure:2575: $? = 0 +configure:2579: test -z + || test ! -s conftest.err +configure:2582: $? = 0 +configure:2585: test -s conftest.o +configure:2588: $? = 0 +configure:2599: result: yes +configure:2616: checking for gcc option to accept ANSI C +configure:2686: gcc -c -g -O2 conftest.c >&5 +configure:2692: $? = 0 +configure:2696: test -z + || test ! -s conftest.err +configure:2699: $? = 0 +configure:2702: test -s conftest.o +configure:2705: $? = 0 +configure:2723: result: none needed +configure:2741: gcc -c -g -O2 conftest.c >&5 +conftest.c:2: error: syntax error before "me" +configure:2747: $? = 1 +configure: failed program was: +| #ifndef __cplusplus +| choke me +| #endif +configure:2891: checking for style of include used by make +configure:2919: result: GNU +configure:2947: checking dependency style of gcc +configure:3037: result: gcc3 +configure:3132: checking build system type +configure:3150: result: i686-pc-linux-gnu +configure:3158: checking host system type +configure:3172: result: i686-pc-linux-gnu +configure:3180: checking for a sed that does not truncate output +configure:3234: result: /bin/sed +configure:3237: checking for egrep +configure:3247: result: grep -E +configure:3263: checking for ld used by gcc +configure:3330: result: /usr/bin/ld +configure:3339: checking if the linker (/usr/bin/ld) is GNU ld +configure:3354: result: yes +configure:3359: checking for /usr/bin/ld option to reload object files +configure:3366: result: -r +configure:3375: checking for BSD-compatible nm +configure:3417: result: /usr/bin/nm -B +configure:3421: checking whether ln -s works +configure:3425: result: yes +configure:3432: checking how to recognise dependent libraries +configure:3615: result: pass_all +configure:3829: checking how to run the C preprocessor +configure:3864: gcc -E conftest.c +configure:3870: $? = 0 +configure:3902: gcc -E conftest.c +conftest.c:11:28: ac_nonexistent.h: No such file or directory +configure:3908: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "libsangoma" +| #define PACKAGE_TARNAME "libsangoma" +| #define PACKAGE_VERSION "1.0.0" +| #define PACKAGE_STRING "libsangoma 1.0.0" +| #define PACKAGE_BUGREPORT "anthmct@yahoo.com" +| #define PACKAGE "libsangoma" +| #define VERSION "1.0.0" +| /* end confdefs.h. */ +| #include +configure:3947: result: gcc -E +configure:3971: gcc -E conftest.c +configure:3977: $? = 0 +configure:4009: gcc -E conftest.c +conftest.c:11:28: ac_nonexistent.h: No such file or directory +configure:4015: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "libsangoma" +| #define PACKAGE_TARNAME "libsangoma" +| #define PACKAGE_VERSION "1.0.0" +| #define PACKAGE_STRING "libsangoma 1.0.0" +| #define PACKAGE_BUGREPORT "anthmct@yahoo.com" +| #define PACKAGE "libsangoma" +| #define VERSION "1.0.0" +| /* end confdefs.h. */ +| #include +configure:4059: checking for ANSI C header files +configure:4084: gcc -c -g -O2 conftest.c >&5 +configure:4090: $? = 0 +configure:4094: test -z + || test ! -s conftest.err +configure:4097: $? = 0 +configure:4100: test -s conftest.o +configure:4103: $? = 0 +configure:4192: gcc -o conftest -g -O2 conftest.c >&5 +configure:4195: $? = 0 +configure:4197: ./conftest +configure:4200: $? = 0 +configure:4215: result: yes +configure:4239: checking for sys/types.h +configure:4255: gcc -c -g -O2 conftest.c >&5 +configure:4261: $? = 0 +configure:4265: test -z + || test ! -s conftest.err +configure:4268: $? = 0 +configure:4271: test -s conftest.o +configure:4274: $? = 0 +configure:4285: result: yes +configure:4239: checking for sys/stat.h +configure:4255: gcc -c -g -O2 conftest.c >&5 +configure:4261: $? = 0 +configure:4265: test -z + || test ! -s conftest.err +configure:4268: $? = 0 +configure:4271: test -s conftest.o +configure:4274: $? = 0 +configure:4285: result: yes +configure:4239: checking for stdlib.h +configure:4255: gcc -c -g -O2 conftest.c >&5 +configure:4261: $? = 0 +configure:4265: test -z + || test ! -s conftest.err +configure:4268: $? = 0 +configure:4271: test -s conftest.o +configure:4274: $? = 0 +configure:4285: result: yes +configure:4239: checking for string.h +configure:4255: gcc -c -g -O2 conftest.c >&5 +configure:4261: $? = 0 +configure:4265: test -z + || test ! -s conftest.err +configure:4268: $? = 0 +configure:4271: test -s conftest.o +configure:4274: $? = 0 +configure:4285: result: yes +configure:4239: checking for memory.h +configure:4255: gcc -c -g -O2 conftest.c >&5 +configure:4261: $? = 0 +configure:4265: test -z + || test ! -s conftest.err +configure:4268: $? = 0 +configure:4271: test -s conftest.o +configure:4274: $? = 0 +configure:4285: result: yes +configure:4239: checking for strings.h +configure:4255: gcc -c -g -O2 conftest.c >&5 +configure:4261: $? = 0 +configure:4265: test -z + || test ! -s conftest.err +configure:4268: $? = 0 +configure:4271: test -s conftest.o +configure:4274: $? = 0 +configure:4285: result: yes +configure:4239: checking for inttypes.h +configure:4255: gcc -c -g -O2 conftest.c >&5 +configure:4261: $? = 0 +configure:4265: test -z + || test ! -s conftest.err +configure:4268: $? = 0 +configure:4271: test -s conftest.o +configure:4274: $? = 0 +configure:4285: result: yes +configure:4239: checking for stdint.h +configure:4255: gcc -c -g -O2 conftest.c >&5 +configure:4261: $? = 0 +configure:4265: test -z + || test ! -s conftest.err +configure:4268: $? = 0 +configure:4271: test -s conftest.o +configure:4274: $? = 0 +configure:4285: result: yes +configure:4239: checking for unistd.h +configure:4255: gcc -c -g -O2 conftest.c >&5 +configure:4261: $? = 0 +configure:4265: test -z + || test ! -s conftest.err +configure:4268: $? = 0 +configure:4271: test -s conftest.o +configure:4274: $? = 0 +configure:4285: result: yes +configure:4311: checking dlfcn.h usability +configure:4323: gcc -c -g -O2 conftest.c >&5 +configure:4329: $? = 0 +configure:4333: test -z + || test ! -s conftest.err +configure:4336: $? = 0 +configure:4339: test -s conftest.o +configure:4342: $? = 0 +configure:4352: result: yes +configure:4356: checking dlfcn.h presence +configure:4366: gcc -E conftest.c +configure:4372: $? = 0 +configure:4392: result: yes +configure:4427: checking for dlfcn.h +configure:4434: result: yes +configure:4499: checking for g++ +configure:4515: found /usr/bin/g++ +configure:4525: result: g++ +configure:4541: checking for C++ compiler version +configure:4544: g++ --version &5 +g++ (GCC) 3.4.4 20050721 (Red Hat 3.4.4-2) +Copyright (C) 2004 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. + +configure:4547: $? = 0 +configure:4549: g++ -v &5 +Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.4/specs +Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux +Thread model: posix +gcc version 3.4.4 20050721 (Red Hat 3.4.4-2) +configure:4552: $? = 0 +configure:4554: g++ -V &5 +g++: `-V' option must have argument +configure:4557: $? = 1 +configure:4560: checking whether we are using the GNU C++ compiler +configure:4584: g++ -c conftest.cc >&5 +configure:4590: $? = 0 +configure:4594: test -z + || test ! -s conftest.err +configure:4597: $? = 0 +configure:4600: test -s conftest.o +configure:4603: $? = 0 +configure:4616: result: yes +configure:4622: checking whether g++ accepts -g +configure:4643: g++ -c -g conftest.cc >&5 +configure:4649: $? = 0 +configure:4653: test -z + || test ! -s conftest.err +configure:4656: $? = 0 +configure:4659: test -s conftest.o +configure:4662: $? = 0 +configure:4673: result: yes +configure:4715: g++ -c -g -O2 conftest.cc >&5 +configure:4721: $? = 0 +configure:4725: test -z + || test ! -s conftest.err +configure:4728: $? = 0 +configure:4731: test -s conftest.o +configure:4734: $? = 0 +configure:4760: g++ -c -g -O2 conftest.cc >&5 +conftest.cc: In function `int main()': +conftest.cc:26: error: `exit' undeclared (first use this function) +conftest.cc:26: error: (Each undeclared identifier is reported only once for each function it appears in.) +configure:4766: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "libsangoma" +| #define PACKAGE_TARNAME "libsangoma" +| #define PACKAGE_VERSION "1.0.0" +| #define PACKAGE_STRING "libsangoma 1.0.0" +| #define PACKAGE_BUGREPORT "anthmct@yahoo.com" +| #define PACKAGE "libsangoma" +| #define VERSION "1.0.0" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define HAVE_DLFCN_H 1 +| /* end confdefs.h. */ +| +| int +| main () +| { +| exit (42); +| ; +| return 0; +| } +configure:4715: g++ -c -g -O2 conftest.cc >&5 +configure:4721: $? = 0 +configure:4725: test -z + || test ! -s conftest.err +configure:4728: $? = 0 +configure:4731: test -s conftest.o +configure:4734: $? = 0 +configure:4760: g++ -c -g -O2 conftest.cc >&5 +configure:4766: $? = 0 +configure:4770: test -z + || test ! -s conftest.err +configure:4773: $? = 0 +configure:4776: test -s conftest.o +configure:4779: $? = 0 +configure:4804: checking dependency style of g++ +configure:4894: result: gcc3 +configure:4916: checking how to run the C++ preprocessor +configure:4947: g++ -E conftest.cc +configure:4953: $? = 0 +configure:4985: g++ -E conftest.cc +conftest.cc:25:28: ac_nonexistent.h: No such file or directory +configure:4991: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "libsangoma" +| #define PACKAGE_TARNAME "libsangoma" +| #define PACKAGE_VERSION "1.0.0" +| #define PACKAGE_STRING "libsangoma 1.0.0" +| #define PACKAGE_BUGREPORT "anthmct@yahoo.com" +| #define PACKAGE "libsangoma" +| #define VERSION "1.0.0" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define HAVE_DLFCN_H 1 +| #ifdef __cplusplus +| extern "C" void std::exit (int) throw (); using std::exit; +| #endif +| /* end confdefs.h. */ +| #include +configure:5030: result: g++ -E +configure:5054: g++ -E conftest.cc +configure:5060: $? = 0 +configure:5092: g++ -E conftest.cc +conftest.cc:25:28: ac_nonexistent.h: No such file or directory +configure:5098: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "libsangoma" +| #define PACKAGE_TARNAME "libsangoma" +| #define PACKAGE_VERSION "1.0.0" +| #define PACKAGE_STRING "libsangoma 1.0.0" +| #define PACKAGE_BUGREPORT "anthmct@yahoo.com" +| #define PACKAGE "libsangoma" +| #define VERSION "1.0.0" +| #define STDC_HEADERS 1 +| #define HAVE_SYS_TYPES_H 1 +| #define HAVE_SYS_STAT_H 1 +| #define HAVE_STDLIB_H 1 +| #define HAVE_STRING_H 1 +| #define HAVE_MEMORY_H 1 +| #define HAVE_STRINGS_H 1 +| #define HAVE_INTTYPES_H 1 +| #define HAVE_STDINT_H 1 +| #define HAVE_UNISTD_H 1 +| #define HAVE_DLFCN_H 1 +| #ifdef __cplusplus +| extern "C" void std::exit (int) throw (); using std::exit; +| #endif +| /* end confdefs.h. */ +| #include +configure:5193: checking for g77 +configure:5209: found /usr/bin/g77 +configure:5219: result: g77 +configure:5234: checking for Fortran 77 compiler version +configure:5237: g77 --version &5 +GNU Fortran (GCC) 3.4.4 20050721 (Red Hat 3.4.4-2) +Copyright (C) 2004 Free Software Foundation, Inc. + +GNU Fortran comes with NO WARRANTY, to the extent permitted by law. +You may redistribute copies of GNU Fortran +under the terms of the GNU General Public License. +For more information about these matters, see the file named COPYING +or type the command `info -f g77 Copying'. +configure:5240: $? = 0 +configure:5242: g77 -v &5 +Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.4/specs +Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux +Thread model: posix +gcc version 3.4.4 20050721 (Red Hat 3.4.4-2) +configure:5245: $? = 0 +configure:5247: g77 -V &5 +g77: `-V' option must have argument +configure:5250: $? = 1 +configure:5258: checking whether we are using the GNU Fortran 77 compiler +configure:5272: g77 -c conftest.F >&5 +configure:5278: $? = 0 +configure:5282: test -z + || test ! -s conftest.err +configure:5285: $? = 0 +configure:5288: test -s conftest.o +configure:5291: $? = 0 +configure:5304: result: yes +configure:5310: checking whether g77 accepts -g +configure:5322: g77 -c -g conftest.f >&5 +configure:5328: $? = 0 +configure:5332: test -z + || test ! -s conftest.err +configure:5335: $? = 0 +configure:5338: test -s conftest.o +configure:5341: $? = 0 +configure:5353: result: yes +configure:5383: checking the maximum length of command line arguments +configure:5448: result: 32768 +configure:5459: checking command to parse /usr/bin/nm -B output from gcc object +configure:5548: gcc -c -g -O2 conftest.c >&5 +configure:5551: $? = 0 +configure:5555: /usr/bin/nm -B conftest.o \| sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\(\)\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2\3 \3/p' \> conftest.nm +configure:5558: $? = 0 +configure:5610: gcc -o conftest -g -O2 conftest.c conftstm.o >&5 +configure:5613: $? = 0 +configure:5651: result: ok +configure:5655: checking for objdir +configure:5670: result: .libs +configure:5760: checking for ar +configure:5776: found /usr/bin/ar +configure:5787: result: ar +configure:5840: checking for ranlib +configure:5856: found /usr/bin/ranlib +configure:5867: result: ranlib +configure:5920: checking for strip +configure:5936: found /usr/bin/strip +configure:5947: result: strip +configure:6209: checking if gcc static flag works +configure:6232: result: yes +configure:6250: checking if gcc supports -fno-rtti -fno-exceptions +configure:6268: gcc -c -g -O2 -fno-rtti -fno-exceptions conftest.c >&5 +cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not for C +configure:6272: $? = 0 +configure:6283: result: no +configure:6298: checking for gcc option to produce PIC +configure:6475: result: -fPIC +configure:6483: checking if gcc PIC flag -fPIC works +configure:6501: gcc -c -g -O2 -fPIC -DPIC conftest.c >&5 +configure:6505: $? = 0 +configure:6516: result: yes +configure:6540: checking if gcc supports -c -o file.o +configure:6561: gcc -c -g -O2 -o out/conftest2.o conftest.c >&5 +configure:6565: $? = 0 +configure:6585: result: yes +configure:6611: checking whether the gcc linker (/usr/bin/ld) supports shared libraries +configure:7459: result: yes +configure:7485: checking whether -lc should be explicitly linked in +configure:7490: gcc -c -g -O2 conftest.c >&5 +configure:7493: $? = 0 +configure:7507: gcc -shared conftest.o -v -Wl,-soname -Wl,conftest -o conftest 2\>\&1 \| grep -lc \>/dev/null 2\>\&1 +configure:7510: $? = 0 +configure:7522: result: no +configure:7530: checking dynamic linker characteristics +configure:8091: result: GNU/Linux ld.so +configure:8095: checking how to hardcode library paths into programs +configure:8120: result: immediate +configure:8134: checking whether stripping libraries is possible +configure:8139: result: yes +configure:8969: checking if libtool supports shared libraries +configure:8971: result: yes +configure:8974: checking whether to build shared libraries +configure:9032: result: yes +configure:9035: checking whether to build static libraries +configure:9039: result: yes +configure:9131: creating libtool +configure:9678: checking for ld used by g++ +configure:9745: result: /usr/bin/ld +configure:9754: checking if the linker (/usr/bin/ld) is GNU ld +configure:9769: result: yes +configure:9820: checking whether the g++ linker (/usr/bin/ld) supports shared libraries +configure:10648: result: yes +configure:10666: g++ -c -g -O2 conftest.cc >&5 +configure:10669: $? = 0 +configure:10765: checking for g++ option to produce PIC +configure:11017: result: -fPIC +configure:11025: checking if g++ PIC flag -fPIC works +configure:11043: g++ -c -g -O2 -fPIC -DPIC conftest.cc >&5 +configure:11047: $? = 0 +configure:11058: result: yes +configure:11082: checking if g++ supports -c -o file.o +configure:11103: g++ -c -g -O2 -o out/conftest2.o conftest.cc >&5 +configure:11107: $? = 0 +configure:11127: result: yes +configure:11153: checking whether the g++ linker (/usr/bin/ld) supports shared libraries +configure:11178: result: yes +configure:11249: checking dynamic linker characteristics +configure:11810: result: GNU/Linux ld.so +configure:11814: checking how to hardcode library paths into programs +configure:11839: result: immediate +configure:11853: checking whether stripping libraries is possible +configure:11858: result: yes +configure:13165: checking if libtool supports shared libraries +configure:13167: result: yes +configure:13170: checking whether to build shared libraries +configure:13188: result: yes +configure:13191: checking whether to build static libraries +configure:13195: result: yes +configure:13207: checking for g77 option to produce PIC +configure:13384: result: -fPIC +configure:13392: checking if g77 PIC flag -fPIC works +configure:13410: g77 -c -g -O2 -fPIC conftest.f >&5 +configure:13414: $? = 0 +configure:13425: result: yes +configure:13449: checking if g77 supports -c -o file.o +configure:13470: g77 -c -g -O2 -o out/conftest2.o conftest.f >&5 +configure:13474: $? = 0 +configure:13494: result: yes +configure:13520: checking whether the g77 linker (/usr/bin/ld) supports shared libraries +configure:14348: result: yes +configure:14419: checking dynamic linker characteristics +configure:14980: result: GNU/Linux ld.so +configure:14984: checking how to hardcode library paths into programs +configure:15009: result: immediate +configure:15023: checking whether stripping libraries is possible +configure:15028: result: yes +configure:19176: checking for ranlib +configure:19203: result: ranlib +configure:19239: checking fcntl.h usability +configure:19251: gcc -c -g -O2 conftest.c >&5 +configure:19257: $? = 0 +configure:19261: test -z + || test ! -s conftest.err +configure:19264: $? = 0 +configure:19267: test -s conftest.o +configure:19270: $? = 0 +configure:19280: result: yes +configure:19284: checking fcntl.h presence +configure:19294: gcc -E conftest.c +configure:19300: $? = 0 +configure:19320: result: yes +configure:19355: checking for fcntl.h +configure:19362: result: yes +configure:19239: checking netinet/in.h usability +configure:19251: gcc -c -g -O2 conftest.c >&5 +configure:19257: $? = 0 +configure:19261: test -z + || test ! -s conftest.err +configure:19264: $? = 0 +configure:19267: test -s conftest.o +configure:19270: $? = 0 +configure:19280: result: yes +configure:19284: checking netinet/in.h presence +configure:19294: gcc -E conftest.c +configure:19300: $? = 0 +configure:19320: result: yes +configure:19355: checking for netinet/in.h +configure:19362: result: yes +configure:19230: checking for stdlib.h +configure:19235: result: yes +configure:19230: checking for string.h +configure:19235: result: yes +configure:19239: checking sys/ioctl.h usability +configure:19251: gcc -c -g -O2 conftest.c >&5 +configure:19257: $? = 0 +configure:19261: test -z + || test ! -s conftest.err +configure:19264: $? = 0 +configure:19267: test -s conftest.o +configure:19270: $? = 0 +configure:19280: result: yes +configure:19284: checking sys/ioctl.h presence +configure:19294: gcc -E conftest.c +configure:19300: $? = 0 +configure:19320: result: yes +configure:19355: checking for sys/ioctl.h +configure:19362: result: yes +configure:19239: checking sys/socket.h usability +configure:19251: gcc -c -g -O2 conftest.c >&5 +configure:19257: $? = 0 +configure:19261: test -z + || test ! -s conftest.err +configure:19264: $? = 0 +configure:19267: test -s conftest.o +configure:19270: $? = 0 +configure:19280: result: yes +configure:19284: checking sys/socket.h presence +configure:19294: gcc -E conftest.c +configure:19300: $? = 0 +configure:19320: result: yes +configure:19355: checking for sys/socket.h +configure:19362: result: yes +configure:19239: checking sys/time.h usability +configure:19251: gcc -c -g -O2 conftest.c >&5 +configure:19257: $? = 0 +configure:19261: test -z + || test ! -s conftest.err +configure:19264: $? = 0 +configure:19267: test -s conftest.o +configure:19270: $? = 0 +configure:19280: result: yes +configure:19284: checking sys/time.h presence +configure:19294: gcc -E conftest.c +configure:19300: $? = 0 +configure:19320: result: yes +configure:19355: checking for sys/time.h +configure:19362: result: yes +configure:19230: checking for unistd.h +configure:19235: result: yes +configure:19239: checking math.h usability +configure:19251: gcc -c -g -O2 conftest.c >&5 +configure:19257: $? = 0 +configure:19261: test -z + || test ! -s conftest.err +configure:19264: $? = 0 +configure:19267: test -s conftest.o +configure:19270: $? = 0 +configure:19280: result: yes +configure:19284: checking math.h presence +configure:19294: gcc -E conftest.c +configure:19300: $? = 0 +configure:19320: result: yes +configure:19355: checking for math.h +configure:19362: result: yes +configure:19396: checking whether time.h and sys/time.h may both be included +configure:19421: gcc -c -g -O2 conftest.c >&5 +configure:19427: $? = 0 +configure:19431: test -z + || test ! -s conftest.err +configure:19434: $? = 0 +configure:19437: test -s conftest.o +configure:19440: $? = 0 +configure:19451: result: yes +configure:19478: checking sys/select.h usability +configure:19490: gcc -c -g -O2 conftest.c >&5 +configure:19496: $? = 0 +configure:19500: test -z + || test ! -s conftest.err +configure:19503: $? = 0 +configure:19506: test -s conftest.o +configure:19509: $? = 0 +configure:19519: result: yes +configure:19523: checking sys/select.h presence +configure:19533: gcc -E conftest.c +configure:19539: $? = 0 +configure:19559: result: yes +configure:19594: checking for sys/select.h +configure:19601: result: yes +configure:19469: checking for sys/socket.h +configure:19474: result: yes +configure:19614: checking types of arguments for select +configure:19647: gcc -c -g -O2 conftest.c >&5 +configure:19653: $? = 0 +configure:19657: test -z + || test ! -s conftest.err +configure:19660: $? = 0 +configure:19663: test -s conftest.o +configure:19666: $? = 0 +configure:19682: result: int,fd_set *,struct timeval * +configure:19712: checking for gettimeofday +configure:19769: gcc -o conftest -g -O2 conftest.c >&5 +configure:19775: $? = 0 +configure:19779: test -z + || test ! -s conftest.err +configure:19782: $? = 0 +configure:19785: test -s conftest +configure:19788: $? = 0 +configure:19800: result: yes +configure:19712: checking for memset +configure:19769: gcc -o conftest -g -O2 conftest.c >&5 +conftest.c:65: warning: conflicting types for built-in function 'memset' +configure:19775: $? = 0 +configure:19779: test -z + || test ! -s conftest.err +configure:19782: $? = 0 +configure:19785: test -s conftest +configure:19788: $? = 0 +configure:19800: result: yes +configure:19712: checking for select +configure:19769: gcc -o conftest -g -O2 conftest.c >&5 +configure:19775: $? = 0 +configure:19779: test -z + || test ! -s conftest.err +configure:19782: $? = 0 +configure:19785: test -s conftest +configure:19788: $? = 0 +configure:19800: result: yes +configure:19712: checking for socket +configure:19769: gcc -o conftest -g -O2 conftest.c >&5 +configure:19775: $? = 0 +configure:19779: test -z + || test ! -s conftest.err +configure:19782: $? = 0 +configure:19785: test -s conftest +configure:19788: $? = 0 +configure:19800: result: yes +configure:19966: creating ./config.status + +## ---------------- ## +## Cache variables. ## +## ---------------- ## + +ac_cv_build=i686-pc-linux-gnu +ac_cv_build_alias=i686-pc-linux-gnu +ac_cv_c_compiler_gnu=yes +ac_cv_cxx_compiler_gnu=yes +ac_cv_env_CC_set= +ac_cv_env_CC_value= +ac_cv_env_CFLAGS_set= +ac_cv_env_CFLAGS_value= +ac_cv_env_CPPFLAGS_set= +ac_cv_env_CPPFLAGS_value= +ac_cv_env_CPP_set= +ac_cv_env_CPP_value= +ac_cv_env_CXXCPP_set= +ac_cv_env_CXXCPP_value= +ac_cv_env_CXXFLAGS_set= +ac_cv_env_CXXFLAGS_value= +ac_cv_env_CXX_set= +ac_cv_env_CXX_value= +ac_cv_env_F77_set= +ac_cv_env_F77_value= +ac_cv_env_FFLAGS_set= +ac_cv_env_FFLAGS_value= +ac_cv_env_LDFLAGS_set= +ac_cv_env_LDFLAGS_value= +ac_cv_env_build_alias_set= +ac_cv_env_build_alias_value= +ac_cv_env_host_alias_set= +ac_cv_env_host_alias_value= +ac_cv_env_target_alias_set= +ac_cv_env_target_alias_value= +ac_cv_exeext= +ac_cv_f77_compiler_gnu=yes +ac_cv_func_gettimeofday=yes +ac_cv_func_memset=yes +ac_cv_func_select=yes +ac_cv_func_select_args='int,fd_set *,struct timeval *' +ac_cv_func_socket=yes +ac_cv_header_dlfcn_h=yes +ac_cv_header_fcntl_h=yes +ac_cv_header_inttypes_h=yes +ac_cv_header_math_h=yes +ac_cv_header_memory_h=yes +ac_cv_header_netinet_in_h=yes +ac_cv_header_stdc=yes +ac_cv_header_stdint_h=yes +ac_cv_header_stdlib_h=yes +ac_cv_header_string_h=yes +ac_cv_header_strings_h=yes +ac_cv_header_sys_ioctl_h=yes +ac_cv_header_sys_select_h=yes +ac_cv_header_sys_socket_h=yes +ac_cv_header_sys_stat_h=yes +ac_cv_header_sys_time_h=yes +ac_cv_header_sys_types_h=yes +ac_cv_header_time=yes +ac_cv_header_unistd_h=yes +ac_cv_host=i686-pc-linux-gnu +ac_cv_host_alias=i686-pc-linux-gnu +ac_cv_objext=o +ac_cv_path_install='/usr/bin/install -c' +ac_cv_prog_AWK=gawk +ac_cv_prog_CPP='gcc -E' +ac_cv_prog_CXXCPP='g++ -E' +ac_cv_prog_ac_ct_AR=ar +ac_cv_prog_ac_ct_CC=gcc +ac_cv_prog_ac_ct_CXX=g++ +ac_cv_prog_ac_ct_F77=g77 +ac_cv_prog_ac_ct_RANLIB=ranlib +ac_cv_prog_ac_ct_STRIP=strip +ac_cv_prog_cc_g=yes +ac_cv_prog_cc_stdc= +ac_cv_prog_cxx_g=yes +ac_cv_prog_egrep='grep -E' +ac_cv_prog_f77_g=yes +ac_cv_prog_make_make_set=yes +am_cv_CC_dependencies_compiler_type=gcc3 +am_cv_CXX_dependencies_compiler_type=gcc3 +lt_cv_deplibs_check_method=pass_all +lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file='/lib/libc.so.6 /lib/libc-2.3.4.so' +lt_cv_ld_reload_flag=-r +lt_cv_objdir=.libs +lt_cv_path_LD=/usr/bin/ld +lt_cv_path_LDCXX=/usr/bin/ld +lt_cv_path_NM='/usr/bin/nm -B' +lt_cv_path_SED=/bin/sed +lt_cv_prog_compiler_c_o=yes +lt_cv_prog_compiler_c_o_CXX=yes +lt_cv_prog_compiler_c_o_F77=yes +lt_cv_prog_compiler_rtti_exceptions=no +lt_cv_prog_gnu_ld=yes +lt_cv_prog_gnu_ldcxx=yes +lt_cv_sys_global_symbol_pipe='sed -n -e '\''s/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\(\)\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2\3 \3/p'\''' +lt_cv_sys_global_symbol_to_c_name_address='sed -n -e '\''s/^: \([^ ]*\) $/ {\"\1\", (lt_ptr) 0},/p'\'' -e '\''s/^[BCDEGRST] \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr) \&\2},/p'\''' +lt_cv_sys_global_symbol_to_cdecl='sed -n -e '\''s/^. .* \(.*\)$/extern int \1;/p'\''' +lt_cv_sys_max_cmd_len=32768 +lt_lt_cv_prog_compiler_c_o='"yes"' +lt_lt_cv_prog_compiler_c_o_CXX='"yes"' +lt_lt_cv_prog_compiler_c_o_F77='"yes"' +lt_lt_cv_sys_global_symbol_pipe='"sed -n -e '\''s/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'\''"' +lt_lt_cv_sys_global_symbol_to_c_name_address='"sed -n -e '\''s/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p'\'' -e '\''s/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'\''"' +lt_lt_cv_sys_global_symbol_to_cdecl='"sed -n -e '\''s/^. .* \\(.*\\)\$/extern int \\1;/p'\''"' + +## ----------------- ## +## Output variables. ## +## ----------------- ## + +ACLOCAL='${SHELL} /usr/src/libsangoma/trunk/missing --run aclocal-1.9' +AMDEPBACKSLASH='\' +AMDEP_FALSE='#' +AMDEP_TRUE='' +AMTAR='${SHELL} /usr/src/libsangoma/trunk/missing --run tar' +AR='ar' +AUTOCONF='${SHELL} /usr/src/libsangoma/trunk/missing --run autoconf' +AUTOHEADER='${SHELL} /usr/src/libsangoma/trunk/missing --run autoheader' +AUTOMAKE='${SHELL} /usr/src/libsangoma/trunk/missing --run automake-1.9' +AWK='gawk' +CC='gcc' +CCDEPMODE='depmode=gcc3' +CFLAGS='-g -O2' +CPP='gcc -E' +CPPFLAGS='' +CXX='g++' +CXXCPP='g++ -E' +CXXDEPMODE='depmode=gcc3' +CXXFLAGS='-g -O2' +CYGPATH_W='echo' +DEFS='-DPACKAGE_NAME=\"libsangoma\" -DPACKAGE_TARNAME=\"libsangoma\" -DPACKAGE_VERSION=\"1.0.0\" -DPACKAGE_STRING=\"libsangoma\ 1.0.0\" -DPACKAGE_BUGREPORT=\"anthmct@yahoo.com\" -DPACKAGE=\"libsangoma\" -DVERSION=\"1.0.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FCNTL_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MATH_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_SOCKET_H=1 -DSELECT_TYPE_ARG1=int -DSELECT_TYPE_ARG234=\(fd_set\ \*\) -DSELECT_TYPE_ARG5=\(struct\ timeval\ \*\) -DHAVE_GETTIMEOFDAY=1 -DHAVE_MEMSET=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1 ' +DEPDIR='.deps' +ECHO='echo' +ECHO_C='' +ECHO_N='-n' +ECHO_T='' +EGREP='grep -E' +EXEEXT='' +F77='g77' +FFLAGS='-g -O2' +INSTALL_DATA='${INSTALL} -m 644' +INSTALL_PROGRAM='${INSTALL}' +INSTALL_SCRIPT='${INSTALL}' +INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s' +LDFLAGS='' +LIBOBJS='' +LIBPRI_FALSE='' +LIBPRI_TRUE='#' +LIBS='' +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +LN_S='ln -s' +LTLIBOBJS='' +MAKEINFO='${SHELL} /usr/src/libsangoma/trunk/missing --run makeinfo' +OBJEXT='o' +PACKAGE='libsangoma' +PACKAGE_BUGREPORT='anthmct@yahoo.com' +PACKAGE_NAME='libsangoma' +PACKAGE_STRING='libsangoma 1.0.0' +PACKAGE_TARNAME='libsangoma' +PACKAGE_VERSION='1.0.0' +PATH_SEPARATOR=':' +RANLIB='ranlib' +SET_MAKE='' +SHELL='/bin/sh' +STRIP='strip' +VERSION='1.0.0' +ac_ct_AR='ar' +ac_ct_CC='gcc' +ac_ct_CXX='g++' +ac_ct_F77='g77' +ac_ct_RANLIB='ranlib' +ac_ct_STRIP='strip' +am__fastdepCC_FALSE='#' +am__fastdepCC_TRUE='' +am__fastdepCXX_FALSE='#' +am__fastdepCXX_TRUE='' +am__include='include' +am__leading_dot='.' +am__quote='' +am__tar='${AMTAR} chof - "$$tardir"' +am__untar='${AMTAR} xf -' +bindir='${exec_prefix}/bin' +build='i686-pc-linux-gnu' +build_alias='' +build_cpu='i686' +build_os='linux-gnu' +build_vendor='pc' +datadir='${prefix}/share' +exec_prefix='${prefix}' +host='i686-pc-linux-gnu' +host_alias='' +host_cpu='i686' +host_os='linux-gnu' +host_vendor='pc' +includedir='${prefix}/include' +infodir='${prefix}/info' +install_sh='/usr/src/libsangoma/trunk/install-sh' +libdir='${exec_prefix}/lib' +libexecdir='${exec_prefix}/libexec' +libpripath='' +localstatedir='${prefix}/var' +mandir='${prefix}/man' +mkdir_p='mkdir -p --' +oldincludedir='/usr/include' +prefix='/usr/local' +program_transform_name='s,x,x,' +sbindir='${exec_prefix}/sbin' +sharedstatedir='${prefix}/com' +sysconfdir='${prefix}/etc' +target_alias='' + +## ----------- ## +## confdefs.h. ## +## ----------- ## + +#define HAVE_DLFCN_H 1 +#define HAVE_FCNTL_H 1 +#define HAVE_GETTIMEOFDAY 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_MATH_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_MEMSET 1 +#define HAVE_NETINET_IN_H 1 +#define HAVE_SELECT 1 +#define HAVE_SOCKET 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_IOCTL_H 1 +#define HAVE_SYS_SELECT_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_SYS_SOCKET_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UNISTD_H 1 +#define PACKAGE "libsangoma" +#define PACKAGE_BUGREPORT "anthmct@yahoo.com" +#define PACKAGE_NAME "libsangoma" +#define PACKAGE_STRING "libsangoma 1.0.0" +#define PACKAGE_TARNAME "libsangoma" +#define PACKAGE_VERSION "1.0.0" +#define SELECT_TYPE_ARG1 int +#define SELECT_TYPE_ARG234 (fd_set *) +#define SELECT_TYPE_ARG5 (struct timeval *) +#define STDC_HEADERS 1 +#define TIME_WITH_SYS_TIME 1 +#define VERSION "1.0.0" +#endif +#ifdef __cplusplus +extern "C" void std::exit (int) throw (); using std::exit; + +configure: exit 0 + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by libsangoma config.status 1.0.0, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on sangoma_mantis + +config.status:709: creating Makefile +config.status:892: executing depfiles commands diff --git a/api/libsangoma/.svn/text-base/config.status.svn-base b/api/libsangoma/.svn/text-base/config.status.svn-base new file mode 100644 index 0000000..310587a --- /dev/null +++ b/api/libsangoma/.svn/text-base/config.status.svn-base @@ -0,0 +1,983 @@ +#! /bin/sh +# Generated by configure. +# 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-/bin/sh} +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +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 + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; 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'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# 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 + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + 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 + + ;; + 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_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + 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=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # 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 before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, 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 + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +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 sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +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$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# 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'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by libsangoma $as_me 1.0.0, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +config_files=" Makefile" +config_commands=" depfiles" + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Configuration commands: +$config_commands + +Report bugs to ." +ac_cs_version="\ +libsangoma config.status 1.0.0 +configured by ./configure, generated by GNU Autoconf 2.59, + with options \"\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=. +INSTALL="/usr/bin/install -c" +# 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 + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +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 0 ;; + --debug | --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;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +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" ;; + + 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 + +if $ac_cs_recheck; then + echo "running /bin/sh ./configure " $ac_configure_extra_args " --no-create --no-recursion" >&6 + exec /bin/sh ./configure $ac_configure_extra_args --no-create --no-recursion +fi + +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="" ac_aux_dir="." + +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + *) { { 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_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 to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $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 -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + + +# +# 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 + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t$/@;t t/; /@;t t$/s/[\\&,]/\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t$/,;t t/' >$tmp/subs.sed <<\CEOF +s,@SHELL@,/bin/sh,;t t +s,@PATH_SEPARATOR@,:,;t t +s,@PACKAGE_NAME@,libsangoma,;t t +s,@PACKAGE_TARNAME@,libsangoma,;t t +s,@PACKAGE_VERSION@,1.0.0,;t t +s,@PACKAGE_STRING@,libsangoma 1.0.0,;t t +s,@PACKAGE_BUGREPORT@,anthmct@yahoo.com,;t t +s,@exec_prefix@,${prefix},;t t +s,@prefix@,/usr/local,;t t +s,@program_transform_name@,s,x,x,,;t t +s,@bindir@,${exec_prefix}/bin,;t t +s,@sbindir@,${exec_prefix}/sbin,;t t +s,@libexecdir@,${exec_prefix}/libexec,;t t +s,@datadir@,${prefix}/share,;t t +s,@sysconfdir@,${prefix}/etc,;t t +s,@sharedstatedir@,${prefix}/com,;t t +s,@localstatedir@,${prefix}/var,;t t +s,@libdir@,${exec_prefix}/lib,;t t +s,@includedir@,${prefix}/include,;t t +s,@oldincludedir@,/usr/include,;t t +s,@infodir@,${prefix}/info,;t t +s,@mandir@,${prefix}/man,;t t +s,@build_alias@,,;t t +s,@host_alias@,,;t t +s,@target_alias@,,;t t +s,@DEFS@,-DPACKAGE_NAME=\"libsangoma\" -DPACKAGE_TARNAME=\"libsangoma\" -DPACKAGE_VERSION=\"1.0.0\" -DPACKAGE_STRING=\"libsangoma\ 1.0.0\" -DPACKAGE_BUGREPORT=\"anthmct@yahoo.com\" -DPACKAGE=\"libsangoma\" -DVERSION=\"1.0.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_FCNTL_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MATH_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_SOCKET_H=1 -DSELECT_TYPE_ARG1=int -DSELECT_TYPE_ARG234=\(fd_set\ \*\) -DSELECT_TYPE_ARG5=\(struct\ timeval\ \*\) -DHAVE_GETTIMEOFDAY=1 -DHAVE_MEMSET=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1 ,;t t +s,@ECHO_C@,,;t t +s,@ECHO_N@,-n,;t t +s,@ECHO_T@,,;t t +s,@LIBS@,,;t t +s,@INSTALL_PROGRAM@,${INSTALL},;t t +s,@INSTALL_SCRIPT@,${INSTALL},;t t +s,@INSTALL_DATA@,${INSTALL} -m 644,;t t +s,@CYGPATH_W@,echo,;t t +s,@PACKAGE@,libsangoma,;t t +s,@VERSION@,1.0.0,;t t +s,@ACLOCAL@,${SHELL} /usr/src/libsangoma/trunk/missing --run aclocal-1.9,;t t +s,@AUTOCONF@,${SHELL} /usr/src/libsangoma/trunk/missing --run autoconf,;t t +s,@AUTOMAKE@,${SHELL} /usr/src/libsangoma/trunk/missing --run automake-1.9,;t t +s,@AUTOHEADER@,${SHELL} /usr/src/libsangoma/trunk/missing --run autoheader,;t t +s,@MAKEINFO@,${SHELL} /usr/src/libsangoma/trunk/missing --run makeinfo,;t t +s,@install_sh@,/usr/src/libsangoma/trunk/install-sh,;t t +s,@STRIP@,strip,;t t +s,@ac_ct_STRIP@,strip,;t t +s,@INSTALL_STRIP_PROGRAM@,${SHELL} $(install_sh) -c -s,;t t +s,@mkdir_p@,mkdir -p --,;t t +s,@AWK@,gawk,;t t +s,@SET_MAKE@,,;t t +s,@am__leading_dot@,.,;t t +s,@AMTAR@,${SHELL} /usr/src/libsangoma/trunk/missing --run tar,;t t +s,@am__tar@,${AMTAR} chof - "$$tardir",;t t +s,@am__untar@,${AMTAR} xf -,;t t +s,@CC@,gcc,;t t +s,@CFLAGS@,-g -O2,;t t +s,@LDFLAGS@,,;t t +s,@CPPFLAGS@,,;t t +s,@ac_ct_CC@,gcc,;t t +s,@EXEEXT@,,;t t +s,@OBJEXT@,o,;t t +s,@DEPDIR@,.deps,;t t +s,@am__include@,include,;t t +s,@am__quote@,,;t t +s,@AMDEP_TRUE@,,;t t +s,@AMDEP_FALSE@,#,;t t +s,@AMDEPBACKSLASH@,\,;t t +s,@CCDEPMODE@,depmode=gcc3,;t t +s,@am__fastdepCC_TRUE@,,;t t +s,@am__fastdepCC_FALSE@,#,;t t +s,@build@,i686-pc-linux-gnu,;t t +s,@build_cpu@,i686,;t t +s,@build_vendor@,pc,;t t +s,@build_os@,linux-gnu,;t t +s,@host@,i686-pc-linux-gnu,;t t +s,@host_cpu@,i686,;t t +s,@host_vendor@,pc,;t t +s,@host_os@,linux-gnu,;t t +s,@EGREP@,grep -E,;t t +s,@LN_S@,ln -s,;t t +s,@ECHO@,echo,;t t +s,@AR@,ar,;t t +s,@ac_ct_AR@,ar,;t t +s,@RANLIB@,ranlib,;t t +s,@ac_ct_RANLIB@,ranlib,;t t +s,@CPP@,gcc -E,;t t +s,@CXX@,g++,;t t +s,@CXXFLAGS@,-g -O2,;t t +s,@ac_ct_CXX@,g++,;t t +s,@CXXDEPMODE@,depmode=gcc3,;t t +s,@am__fastdepCXX_TRUE@,,;t t +s,@am__fastdepCXX_FALSE@,#,;t t +s,@CXXCPP@,g++ -E,;t t +s,@F77@,g77,;t t +s,@FFLAGS@,-g -O2,;t t +s,@ac_ct_F77@,g77,;t t +s,@LIBTOOL@,$(SHELL) $(top_builddir)/libtool,;t t +s,@LIBPRI_TRUE@,#,;t t +s,@LIBPRI_FALSE@,,;t t +s,@libpripath@,,;t t +s,@LIBOBJS@,,;t t +s,@LTLIBOBJS@,,;t t +CEOF + + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$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'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$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'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # 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. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + sed "/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +} + +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;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,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$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'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) 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=`(dirname "$mf") 2>/dev/null || +$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=`(dirname "$file") 2>/dev/null || +$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'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$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'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + esac +done + +{ (exit 0); exit 0; } diff --git a/api/libsangoma/.svn/text-base/libsangoma.c.svn-base b/api/libsangoma/.svn/text-base/libsangoma.c.svn-base index 1fea515..aaea8a8 100644 --- a/api/libsangoma/.svn/text-base/libsangoma.c.svn-base +++ b/api/libsangoma/.svn/text-base/libsangoma.c.svn-base @@ -22,16 +22,17 @@ #include "libsangoma.h" #define DFT_CARD "wanpipe1" - -#ifndef WP_TDM_EVENT_FE_ALARM +#ifndef WP_TDM_FEATURE_FE_ALARM #warning "Warning: TDM FE ALARM not supported by driver" #endif - -#ifndef WP_TDMAPI_EVENT_DTMF -#warning "Warning: TDM EVENTS not supported by driver" +#ifndef WP_TDM_FEATURE_DTMF_EVENTS +#warning "Warning: TDM DTMF not supported by driver" #endif +#ifndef WP_TDM_FEATURE_EVENTS +#warning "Warning: TDM EVENTS not supported by driver" +#endif #if defined(WIN32) @@ -520,7 +521,7 @@ int sangoma_get_full_cfg(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) printf("\tusr_mtu_mru:\t%d\n",tdm_api->wp_tdm_cmd.usr_mtu_mru); printf("\tidle flag:\t0x%02X\n",tdm_api->wp_tdm_cmd.idle_flag); -#ifdef WP_TDM_EVENT_FE_ALARM +#ifdef WP_TDM_FEATURE_FE_ALARM printf("\tfe alarms:\t0x%02X\n",tdm_api->wp_tdm_cmd.fe_alarms); #endif @@ -765,7 +766,7 @@ int sangoma_tdm_write_rbs(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) { -#ifdef WP_TDM_EVENT_TDM_API_EVENTS +#ifdef WP_TDM_FEATURE_EVENTS wp_tdm_api_event_t *rx_event; @@ -793,7 +794,8 @@ int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) } break; - + +#ifdef WP_TDM_FEATURE_DTMF_EVENTS case WP_TDMAPI_EVENT_DTMF: printf("%d: GOT DTMF EVENT\n",(int)fd); if (tdm_api->wp_tdm_event.wp_dtmf_event) { @@ -803,6 +805,7 @@ int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) rx_event->wp_tdm_api_event_dtmf_port); } break; +#endif case WP_TDMAPI_EVENT_RXHOOK: printf("%d: GOT RXHOOK EVENT\n",(int)fd); @@ -828,13 +831,13 @@ int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) } break; -#ifdef WP_TDM_EVENT_FE_ALARM - case WP_TDMAPI_EVENT_FE_ALARM: +#ifdef WP_TDM_FEATURE_FE_ALARM + case WP_TDMAPI_EVENT_ALARM: printf("%d: GOT FE ALARMS EVENT %i\n",(int)fd, - rx_event->wp_tdm_api_event_fe_alarm); + rx_event->wp_tdm_api_event_alarm); if (tdm_api->wp_tdm_event.wp_fe_alarm_event) { tdm_api->wp_tdm_event.wp_fe_alarm_event(fd, - rx_event->wp_tdm_api_event_fe_alarm); + rx_event->wp_tdm_api_event_alarm); } #endif @@ -845,13 +848,12 @@ int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) return 0; #else - return -EINVAL; + printf("Error: Read Event not supported!\n"); + return -1; #endif } - -#ifdef WP_TDMAPI_EVENT_DTMF - +#ifdef WP_TDM_FEATURE_DTMF_EVENTS int sangoma_tdm_enable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) { int err; @@ -911,6 +913,7 @@ int sangoma_tdm_disable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) return 0; } +#endif int sangoma_tdm_enable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) { @@ -927,33 +930,6 @@ int sangoma_tdm_enable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) return 0; } -int sangoma_tdm_enable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) -{ - int err; - - tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_ENABLE_HWEC; - err=sangoma_tdm_cmd_exec(fd,tdm_api); - if (err){ - return err; - } - - return 0; -} - -int sangoma_tdm_disable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) -{ - int err; - - tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_DISABLE_HWEC; - err=sangoma_tdm_cmd_exec(fd,tdm_api); - if (err){ - return err; - } - - return 0; -} - - int sangoma_tdm_disable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) { int err; @@ -1156,13 +1132,39 @@ int sangoma_tdm_disable_tone_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) { return tdm_api->wp_tdm_cmd.rbs_poll; } -#endif + +int sangoma_tdm_enable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) +{ + int err; + + tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_ENABLE_HWEC; + err=sangoma_tdm_cmd_exec(fd,tdm_api); + if (err){ + return err; + } + + return 0; +} + +int sangoma_tdm_disable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) +{ + int err; + + tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_DISABLE_HWEC; + err=sangoma_tdm_cmd_exec(fd,tdm_api); + if (err){ + return err; + } + + return 0; +} + /*======================================================== * GET Front End Alarms * */ -#ifdef WP_TDM_EVENT_FE_ALARM +#ifdef WP_TDM_FEATURE_FE_ALARM int sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) { int err; @@ -1178,4 +1180,26 @@ int sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) } #endif +/* get current Line Connection state - Connected/Disconnected */ +int sangoma_tdm_get_fe_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char *current_status) +{ + int err; + + tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_FE_STATUS; + err = sangoma_tdm_cmd_exec(fd, tdm_api); + *current_status = tdm_api->wp_tdm_cmd.fe_status; + + return err; +} + + +/* set current Line Connection state - Connected/Disconnected. valid only for ISDN BRI */ +int sangoma_tdm_set_fe_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char new_status) +{ + tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_SET_FE_STATUS; + tdm_api->wp_tdm_cmd.fe_status = new_status; + + return sangoma_tdm_cmd_exec(fd, tdm_api); +} + #endif /* WANPIPE_TDM_API */ diff --git a/api/libsangoma/.svn/text-base/libsangoma.h.svn-base b/api/libsangoma/.svn/text-base/libsangoma.h.svn-base index 438307a..fab9646 100644 --- a/api/libsangoma/.svn/text-base/libsangoma.h.svn-base +++ b/api/libsangoma/.svn/text-base/libsangoma.h.svn-base @@ -50,6 +50,7 @@ typedef unsigned __int32 u_int32_t; typedef HANDLE sng_fd_t; #else +/* L I N U X */ #include #include #include @@ -76,6 +77,7 @@ typedef HANDLE sng_fd_t; #ifdef WANPIPE_TDM_API # include #endif + #endif #define FNAME_LEN 50 @@ -176,15 +178,20 @@ int sangoma_tdm_disable_tone_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); int sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); -int sangoma_tdm_enable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); -int sangoma_tdm_disable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); - - int sangoma_tdm_txsig_onhook(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); int sangoma_tdm_txsig_offhook(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); int sangoma_tdm_txsig_start(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); int sangoma_tdm_txsig_kewl(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); +int sangoma_tdm_enable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); +int sangoma_tdm_disable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); + +/* get current Line Connection state - Connected/Disconnected */ +int sangoma_tdm_get_fe_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char *current_status); +/* set current Line Connection state - Connected/Disconnected. valid only for ISDN BRI */ +int sangoma_tdm_set_fe_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char new_status); + + #ifndef LIBSANGOMA_GET_HWCODING #define LIBSANGOMA_GET_HWCODING 1 #endif @@ -193,3 +200,4 @@ int sangoma_tdm_get_hw_coding(int fd, wanpipe_tdm_api_t *tdm_api); #endif /* WANPIPE_TDM_API */ #endif + diff --git a/api/libsangoma/.svn/text-base/libtool.svn-base b/api/libsangoma/.svn/text-base/libtool.svn-base new file mode 100644 index 0000000..ff4763a --- /dev/null +++ b/api/libsangoma/.svn/text-base/libtool.svn-base @@ -0,0 +1,7340 @@ +#! /bin/sh + +# libtoolT - Provide generalized library-building support services. +# Generated automatically by (GNU libsangoma 1.0.0) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED="/bin/sed" + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="/bin/sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# The names of the tagged configurations supported by this script. +available_tags=" CXX F77" + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host sangoma_mantis: + +# Shell to use when invoking shell scripts. +SHELL="/bin/sh" + +# Whether or not to build shared libraries. +build_libtool_libs=yes + +# Whether or not to build static libraries. +build_old_libs=yes + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=no + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=no + +# Whether or not to optimize for fast installation. +fast_install=yes + +# The host system. +host_alias= +host=i686-pc-linux-gnu + +# An echo program that does not interpret backslashes. +echo="echo" + +# The archiver. +AR="ar" +AR_FLAGS="cru" + +# A C compiler. +LTCC="gcc" + +# A language-specific compiler. +CC="gcc" + +# Is the compiler the GNU C compiler? +with_gcc=yes + +# An ERE matcher. +EGREP="grep -E" + +# The linker used to build libraries. +LD="/usr/bin/ld" + +# Whether we need hard or soft links. +LN_S="ln -s" + +# A BSD-compatible nm program. +NM="/usr/bin/nm -B" + +# A symbol stripping program +STRIP="strip" + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=file + +# 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=.libs + +# How to create reloadable object files. +reload_flag=" -r" +reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" + +# How to pass a linker flag through the compiler. +wl="-Wl," + +# Object file suffix (normally "o"). +objext="o" + +# Old archive suffix (normally "a"). +libext="a" + +# Shared library suffix (normally ".so"). +shrext_cmds='.so' + +# Executable file suffix (normally ""). +exeext="" + +# Additional compiler flags for building library objects. +pic_flag=" -fPIC -DPIC" +pic_mode=default + +# What is the maximum length of a command? +max_cmd_len=32768 + +# Does compiler simultaneously support -c and -o options? +compiler_c_o="yes" + +# Must we lock files when doing compilation ? +need_locks="no" + +# Do we need the lib prefix for modules? +need_lib_prefix=no + +# Do we need a version for libraries? +need_version=no + +# Whether dlopen is supported. +dlopen_support=unknown + +# Whether dlopen of programs is supported. +dlopen_self=unknown + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=unknown + +# Compiler flag to prevent dynamic linking. +link_static_flag="-static" + +# Compiler flag to turn off builtin functions. +no_builtin_flag=" -fno-builtin" + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec="\${wl}--export-dynamic" + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec="" + +# Library versioning type. +version_type=linux + +# Format of library name prefix. +libname_spec="lib\$name" + +# 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="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}" + +# The coded name of the library, if different from the real name. +soname_spec="\${libname}\${release}\${shared_ext}\$major" + +# Commands used to build and install an old-style archive. +RANLIB="ranlib" +old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib" +old_postinstall_cmds="\$RANLIB \$oldlib~chmod 644 \$oldlib" +old_postuninstall_cmds="" + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds="" + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds="" + +# Commands used to build and install a shared archive. +archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" +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 -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib" +postinstall_cmds="" +postuninstall_cmds="" + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds="" +module_expsym_cmds="" + +# Commands to strip libraries. +old_striplib="strip --strip-debug" +striplib="strip --strip-unneeded" + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects="" + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects="" + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps="" + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps="" + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path="" + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method="pass_all" + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd="\$MAGIC_CMD" + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag="" + +# Flag that forces no undefined symbols. +no_undefined_flag="" + +# Commands used to finish a libtool library installation in a directory. +finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval="" + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'" + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'" + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'" + +# This is the shared library runtime path variable. +runpath_var=LD_RUN_PATH + +# This is the shared library path variable. +shlibpath_var=LD_LIBRARY_PATH + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=no + +# How to hardcode a shared library path into an executable. +hardcode_action=immediate + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=yes + +# Flag to hardcode $libdir into a binary during linking. +# This must work even if $libdir does not exist. +hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir" + +# 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="" + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator="" + +# Set to yes if using DIR/libNAME during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=no + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=no + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=unsupported + +# 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=no + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=unknown + +# Compile-time system search path for libraries +sys_lib_search_path_spec=" /usr/lib/gcc/i386-redhat-linux/3.4.4/ /usr/lib/gcc/i386-redhat-linux/3.4.4/ /usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../i386-redhat-linux/lib/i386-redhat-linux/3.4.4/ /usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/3.4.4/../../../i386-redhat-linux/3.4.4/ /usr/lib/gcc/i386-redhat-linux/3.4.4/../../../ /lib/i386-redhat-linux/3.4.4/ /lib/ /usr/lib/i386-redhat-linux/3.4.4/ /usr/lib/" + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec="/lib /usr/lib include ld.so.conf.d/*.conf " + +# Fix the shell variable $srcfile for the compiler. +fix_srcfile_path="" + +# Set to yes if exported symbols are required. +always_export_symbols=no + +# The commands to list exported symbols. +export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds="" + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + +# Symbols that must always be exported. +include_expsyms="" + +# ### END LIBTOOL CONFIG + +# 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 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +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.10 +TIMESTAMP=" (1.1220.2.130 2004/09/19 12:13:49)" + +# 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 + +# 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= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# 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 /{x;/import/!{s/^/import/;h;p;};x;};}'` + if test "X$win32_nmres" = "Ximport" ; then + win32_libid_type="x86 archive import" + else + win32_libid_type="x86 archive static" + fi + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + + +# 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_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_xdir="$my_gentop/$my_xlib" + + $show "${rm}r $my_xdir" + $run ${rm}r "$my_xdir" + $show "$mkdir $my_xdir" + $run $mkdir "$my_xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$my_xdir"; then + 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=`basename $darwin_archive` + 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}" + # Remove the table of contents from the thin files. + $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true + $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $AR -xo "${darwin_base_archive}" + rm "${darwin_base_archive}" + cd "$darwin_curdir" + done # $darwin_arches + ## Okay now we have a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f | 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 -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + (cd $my_xdir && $AR x $my_xabs) || exit $? + fi # $darwin_arches + fi # $run + ;; + *) + # We will extract separately just the conflicting names and we will + # no longer touch any unique names. It is faster to leave these + # extract automatically by $AR in one run. + $show "(cd $my_xdir && $AR x $my_xabs)" + $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? + if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$my_xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi + ;; + 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\" + +# 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" + $echo + $echo "Copyright (C) 2003 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit $EXIT_SUCCESS + ;; + + --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 $EXIT_SUCCESS + ;; + + --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 $EXIT_SUCCESS + ;; + + --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 ;; + --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 + +# 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, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + base_compile="$base_compile $lastarg" + done # for arg + + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit $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 ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + *.java) xform=java ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit $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 + + 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 + + $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 + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + 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 + 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 + ;; + *) + 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 + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + exit $EXIT_FAILURE + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-mingw* | *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" + continue + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # gcc -m* arguments should be passed to the linker via $compiler_flags + # in order to pass architecture information to the linker + # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo + # but this is not reliable with gcc because gcc may use -mfoo to + # select a different linker, different libraries, etc, while + # -Wl,-mfoo simply passes -mfoo to the linker. + -m*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + if test "$with_gcc" = "yes" ; then + compiler_flags="$compiler_flags $arg" + fi + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -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) + # 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 + 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 + status=$? + if test "$status" -ne 0 && test ! -d "$output_objdir"; then + exit $status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit $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 + notinst_path= # paths that contain not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit $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% $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) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + continue + fi + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + 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'" 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 + + # 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 + 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 -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + # This is a shared library + + # Warn about portability, can't link against -module's on + # some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + 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* ) 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 + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="$absdir/$objdir" + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit $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` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + # 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 + *" $depdepl "*) ;; + *) deplibs="$depdepl $deplibs" ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext_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) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $revision in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $EXIT_FAILURE + ;; + esac + + case $age in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit $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` + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix | nonstopux) + major=`expr $current - $age + 1` + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=.`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit $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*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for file magic test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name="`expr $a_deplib : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo + if test "X$deplibs_check_method" = "Xnone"; then + $echo "*** Warning: inter-library dependencies are not supported in this platform." + else + $echo "*** Warning: inter-library dependencies are not known to be supported." + fi + $echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_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" + 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=: + 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" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$save_output-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + fi + last_robj=$output_objdir/$save_output-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$save_output-${k}.$objext + objlist=$obj + len=1 + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadale object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$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" || exit $? + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + exit $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) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit $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 + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + 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 + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols + $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + $echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit $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" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit $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" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $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* ) + cwrappersource=`$echo ${objdir}/lt-${output}.c` + cwrapper=`$echo ${output}.exe` + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + cat > $cwrappersource <> $cwrappersource<<"EOF" +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +#define DIR_SEPARATOR '/' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +#define HAVE_DOS_BASED_FILE_SYSTEM +#ifndef DIR_SEPARATOR_2 +#define DIR_SEPARATOR_2 '\\' +#endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +char * basename (const char *name); +char * fnqualify(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup ((char *) basename (argv[0])); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" + newargz[1] = fnqualify(argv[0]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +char * +basename (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha (name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return (char *) base; +} + +char * +fnqualify(const char *path) +{ + size_t size; + char *p; + char tmp[LT_PATHMAX + 1]; + + assert(path != NULL); + + /* Is it qualified already? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha (path[0]) && path[1] == ':') + return xstrdup (path); +#endif + if (IS_DIR_SEPARATOR (path[0])) + return xstrdup (path); + + /* prepend the current directory */ + /* doesn't handle '~' */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ + p = XMALLOC(char, size); + sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); + return p; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC -s -o $cwrapper $cwrappersource + ;; + esac + $rm $output + trap "$rm $output; exit $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' + +# 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 \${1+\"\$@\"}\" + 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 + 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 + # GNU ar 2.10+ was changed to match POSIX; thus no paths are + # encoded into archives. This makes 'ar r' malfunction in + # this piecewise linking case whenever conflicting object + # names appear in distinct ar calls; check, warn and compensate. + if (for obj in $save_oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 + $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 + AR_FLAGS=cq + fi + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + 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" | $Xsed -e "$sed_quote_subst"` + 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" | $Xsed | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit $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" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + exit $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. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + cmds=$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" + 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= + + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac + # If there is no directory component, then add one. + case $file in + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 + exit $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= + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac + # If there is no directory component, then add one. + case $file in + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir="$tmpdir/libtool-$$" + save_umask=`umask` + umask 0077 + if $mkdir "$tmpdir"; then + umask $save_umask + else + umask $save_umask + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyways + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$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 "----------------------------------------------------------------------" + $echo "Libraries have been installed in:" + for libdir in $libdirs; do + $echo " $libdir" + done + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" + fi + if test -n "$runpath_var"; then + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "----------------------------------------------------------------------" + exit $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 + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit $EXIT_FAILURE + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit $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" + test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + + if test "$mode" = uninstall; then + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + 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. + fi + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit $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 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 $EXIT_SUCCESS + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: +# ### BEGIN LIBTOOL TAG CONFIG: CXX + +# Libtool was configured on host sangoma_mantis: + +# Shell to use when invoking shell scripts. +SHELL="/bin/sh" + +# Whether or not to build shared libraries. +build_libtool_libs=yes + +# Whether or not to build static libraries. +build_old_libs=yes + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=no + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=no + +# Whether or not to optimize for fast installation. +fast_install=yes + +# The host system. +host_alias= +host=i686-pc-linux-gnu + +# An echo program that does not interpret backslashes. +echo="echo" + +# The archiver. +AR="ar" +AR_FLAGS="cru" + +# A C compiler. +LTCC="gcc" + +# A language-specific compiler. +CC="g++" + +# Is the compiler the GNU C compiler? +with_gcc=yes + +# An ERE matcher. +EGREP="grep -E" + +# The linker used to build libraries. +LD="/usr/bin/ld" + +# Whether we need hard or soft links. +LN_S="ln -s" + +# A BSD-compatible nm program. +NM="/usr/bin/nm -B" + +# A symbol stripping program +STRIP="strip" + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=file + +# 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=.libs + +# How to create reloadable object files. +reload_flag=" -r" +reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" + +# How to pass a linker flag through the compiler. +wl="-Wl," + +# Object file suffix (normally "o"). +objext="o" + +# Old archive suffix (normally "a"). +libext="a" + +# Shared library suffix (normally ".so"). +shrext_cmds='.so' + +# Executable file suffix (normally ""). +exeext="" + +# Additional compiler flags for building library objects. +pic_flag=" -fPIC -DPIC" +pic_mode=default + +# What is the maximum length of a command? +max_cmd_len=32768 + +# Does compiler simultaneously support -c and -o options? +compiler_c_o="yes" + +# Must we lock files when doing compilation ? +need_locks="no" + +# Do we need the lib prefix for modules? +need_lib_prefix=no + +# Do we need a version for libraries? +need_version=no + +# Whether dlopen is supported. +dlopen_support=unknown + +# Whether dlopen of programs is supported. +dlopen_self=unknown + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=unknown + +# Compiler flag to prevent dynamic linking. +link_static_flag="-static" + +# Compiler flag to turn off builtin functions. +no_builtin_flag=" -fno-builtin" + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec="\${wl}--export-dynamic" + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec="" + +# Library versioning type. +version_type=linux + +# Format of library name prefix. +libname_spec="lib\$name" + +# 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="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}" + +# The coded name of the library, if different from the real name. +soname_spec="\${libname}\${release}\${shared_ext}\$major" + +# Commands used to build and install an old-style archive. +RANLIB="ranlib" +old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib" +old_postinstall_cmds="\$RANLIB \$oldlib~chmod 644 \$oldlib" +old_postuninstall_cmds="" + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds="" + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds="" + +# Commands used to build and install a shared archive. +archive_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" +archive_expsym_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib" +postinstall_cmds="" +postuninstall_cmds="" + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds="" +module_expsym_cmds="" + +# Commands to strip libraries. +old_striplib="strip --strip-debug" +striplib="strip --strip-unneeded" + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects="/usr/lib/gcc/i386-redhat-linux/3.4.4/../../../crti.o /usr/lib/gcc/i386-redhat-linux/3.4.4/crtbeginS.o" + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects="/usr/lib/gcc/i386-redhat-linux/3.4.4/crtendS.o /usr/lib/gcc/i386-redhat-linux/3.4.4/../../../crtn.o" + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps="" + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s" + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path="-L/usr/lib/gcc/i386-redhat-linux/3.4.4 -L/usr/lib/gcc/i386-redhat-linux/3.4.4 -L/usr/lib/gcc/i386-redhat-linux/3.4.4/../../.." + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method="pass_all" + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd="\$MAGIC_CMD" + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag="" + +# Flag that forces no undefined symbols. +no_undefined_flag="" + +# Commands used to finish a libtool library installation in a directory. +finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval="" + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'" + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'" + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'" + +# This is the shared library runtime path variable. +runpath_var=LD_RUN_PATH + +# This is the shared library path variable. +shlibpath_var=LD_LIBRARY_PATH + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=no + +# How to hardcode a shared library path into an executable. +hardcode_action=immediate + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=yes + +# Flag to hardcode $libdir into a binary during linking. +# This must work even if $libdir does not exist. +hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir" + +# 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="" + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator="" + +# Set to yes if using DIR/libNAME during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=no + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=no + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +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=no + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=unknown + +# Compile-time system search path for libraries +sys_lib_search_path_spec=" /usr/lib/gcc/i386-redhat-linux/3.4.4/ /usr/lib/gcc/i386-redhat-linux/3.4.4/ /usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../i386-redhat-linux/lib/i386-redhat-linux/3.4.4/ /usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/3.4.4/../../../i386-redhat-linux/3.4.4/ /usr/lib/gcc/i386-redhat-linux/3.4.4/../../../ /lib/i386-redhat-linux/3.4.4/ /lib/ /usr/lib/i386-redhat-linux/3.4.4/ /usr/lib/" + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec="/lib /usr/lib include ld.so.conf.d/*.conf " + +# Fix the shell variable $srcfile for the compiler. +fix_srcfile_path="" + +# Set to yes if exported symbols are required. +always_export_symbols=no + +# The commands to list exported symbols. +export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds="" + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms="" + +# Symbols that must always be exported. +include_expsyms="" + +# ### END LIBTOOL TAG CONFIG: CXX + +# ### BEGIN LIBTOOL TAG CONFIG: F77 + +# Libtool was configured on host sangoma_mantis: + +# Shell to use when invoking shell scripts. +SHELL="/bin/sh" + +# Whether or not to build shared libraries. +build_libtool_libs=yes + +# Whether or not to build static libraries. +build_old_libs=yes + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=no + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=no + +# Whether or not to optimize for fast installation. +fast_install=yes + +# The host system. +host_alias= +host=i686-pc-linux-gnu + +# An echo program that does not interpret backslashes. +echo="echo" + +# The archiver. +AR="ar" +AR_FLAGS="cru" + +# A C compiler. +LTCC="gcc" + +# A language-specific compiler. +CC="g77" + +# Is the compiler the GNU C compiler? +with_gcc=yes + +# An ERE matcher. +EGREP="grep -E" + +# The linker used to build libraries. +LD="/usr/bin/ld" + +# Whether we need hard or soft links. +LN_S="ln -s" + +# A BSD-compatible nm program. +NM="/usr/bin/nm -B" + +# A symbol stripping program +STRIP="strip" + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=file + +# 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=.libs + +# How to create reloadable object files. +reload_flag=" -r" +reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" + +# How to pass a linker flag through the compiler. +wl="-Wl," + +# Object file suffix (normally "o"). +objext="o" + +# Old archive suffix (normally "a"). +libext="a" + +# Shared library suffix (normally ".so"). +shrext_cmds='.so' + +# Executable file suffix (normally ""). +exeext="" + +# Additional compiler flags for building library objects. +pic_flag=" -fPIC" +pic_mode=default + +# What is the maximum length of a command? +max_cmd_len=32768 + +# Does compiler simultaneously support -c and -o options? +compiler_c_o="yes" + +# Must we lock files when doing compilation ? +need_locks="no" + +# Do we need the lib prefix for modules? +need_lib_prefix=no + +# Do we need a version for libraries? +need_version=no + +# Whether dlopen is supported. +dlopen_support=unknown + +# Whether dlopen of programs is supported. +dlopen_self=unknown + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=unknown + +# Compiler flag to prevent dynamic linking. +link_static_flag="-static" + +# Compiler flag to turn off builtin functions. +no_builtin_flag="" + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec="\${wl}--export-dynamic" + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec="" + +# Library versioning type. +version_type=linux + +# Format of library name prefix. +libname_spec="lib\$name" + +# 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="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}" + +# The coded name of the library, if different from the real name. +soname_spec="\${libname}\${release}\${shared_ext}\$major" + +# Commands used to build and install an old-style archive. +RANLIB="ranlib" +old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib" +old_postinstall_cmds="\$RANLIB \$oldlib~chmod 644 \$oldlib" +old_postuninstall_cmds="" + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds="" + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds="" + +# Commands used to build and install a shared archive. +archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" +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 -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib" +postinstall_cmds="" +postuninstall_cmds="" + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds="" +module_expsym_cmds="" + +# Commands to strip libraries. +old_striplib="strip --strip-debug" +striplib="strip --strip-unneeded" + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects="" + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects="" + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps="" + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps="" + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path="" + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method="pass_all" + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd="\$MAGIC_CMD" + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag="" + +# Flag that forces no undefined symbols. +no_undefined_flag="" + +# Commands used to finish a libtool library installation in a directory. +finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval="" + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'" + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'" + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'" + +# This is the shared library runtime path variable. +runpath_var=LD_RUN_PATH + +# This is the shared library path variable. +shlibpath_var=LD_LIBRARY_PATH + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=no + +# How to hardcode a shared library path into an executable. +hardcode_action=immediate + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=yes + +# Flag to hardcode $libdir into a binary during linking. +# This must work even if $libdir does not exist. +hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir" + +# 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="" + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator="" + +# Set to yes if using DIR/libNAME during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=no + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=no + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=unsupported + +# 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=no + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=unknown + +# Compile-time system search path for libraries +sys_lib_search_path_spec=" /usr/lib/gcc/i386-redhat-linux/3.4.4/ /usr/lib/gcc/i386-redhat-linux/3.4.4/ /usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../i386-redhat-linux/lib/i386-redhat-linux/3.4.4/ /usr/lib/gcc/i386-redhat-linux/3.4.4/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/3.4.4/../../../i386-redhat-linux/3.4.4/ /usr/lib/gcc/i386-redhat-linux/3.4.4/../../../ /lib/i386-redhat-linux/3.4.4/ /lib/ /usr/lib/i386-redhat-linux/3.4.4/ /usr/lib/" + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec="/lib /usr/lib include ld.so.conf.d/*.conf " + +# Fix the shell variable $srcfile for the compiler. +fix_srcfile_path="" + +# Set to yes if exported symbols are required. +always_export_symbols=no + +# The commands to list exported symbols. +export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds="" + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + +# Symbols that must always be exported. +include_expsyms="" + +# ### END LIBTOOL TAG CONFIG: F77 + diff --git a/api/libsangoma/.svn/text-base/svn-commit.2.tmp.svn-base b/api/libsangoma/.svn/text-base/svn-commit.2.tmp.svn-base new file mode 100644 index 0000000..48940b9 --- /dev/null +++ b/api/libsangoma/.svn/text-base/svn-commit.2.tmp.svn-base @@ -0,0 +1,5 @@ +Added new event support +--This line, and those below, will be ignored-- + +M libsangoma.c +M libsangoma.h diff --git a/api/libsangoma/.svn/text-base/svn-commit.tmp.svn-base b/api/libsangoma/.svn/text-base/svn-commit.tmp.svn-base new file mode 100644 index 0000000..4965420 --- /dev/null +++ b/api/libsangoma/.svn/text-base/svn-commit.tmp.svn-base @@ -0,0 +1,5 @@ +Added new event features +--This line, and those below, will be ignored-- + +M libsangoma.c +M libsangoma.h diff --git a/api/libsangoma/Makefile b/api/libsangoma/Makefile index fce2039..6d7b323 100644 --- a/api/libsangoma/Makefile +++ b/api/libsangoma/Makefile @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# Makefile.in generated by automake 1.9.6 from Makefile.am. # Makefile. Generated from Makefile.in by configure. # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 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. @@ -16,8 +16,6 @@ -SOURCES = $(libsangoma_a_SOURCES) $(libsangoma_la_SOURCES) - srcdir = . top_srcdir = . @@ -87,11 +85,11 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libsangoma_a_SOURCES) $(libsangoma_la_SOURCES) DIST_SOURCES = $(libsangoma_a_SOURCES) \ @@ -112,14 +110,14 @@ DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print -ACLOCAL = ${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run aclocal-1.9 +ACLOCAL = ${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run aclocal-1.9 AMDEP_FALSE = # AMDEP_TRUE = -AMTAR = ${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run tar +AMTAR = ${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run tar AR = ar -AUTOCONF = ${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run autoconf -AUTOHEADER = ${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run autoheader -AUTOMAKE = ${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run automake-1.9 +AUTOCONF = ${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run autoconf +AUTOHEADER = ${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run autoheader +AUTOMAKE = ${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run automake-1.9 AWK = gawk CC = gcc CCDEPMODE = depmode=gcc3 @@ -153,7 +151,7 @@ LIBS = LIBTOOL = $(SHELL) $(top_builddir)/libtool LN_S = ln -s LTLIBOBJS = -MAKEINFO = ${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run makeinfo +MAKEINFO = ${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run makeinfo OBJEXT = o PACKAGE = libsangoma PACKAGE_BUGREPORT = anthmct@yahoo.com @@ -163,6 +161,7 @@ PACKAGE_TARNAME = libsangoma PACKAGE_VERSION = 1.0.0 PATH_SEPARATOR = : RANLIB = ranlib +SED = /bin/sed SET_MAKE = SHELL = /bin/sh STRIP = strip @@ -197,7 +196,7 @@ host_os = linux-gnu host_vendor = pc includedir = ${prefix}/include infodir = ${prefix}/info -install_sh = /root/3.2/wanpipe/api/libsangoma/install-sh +install_sh = /root/3.3/wanpipe/api/libsangoma/install-sh libdir = ${exec_prefix}/lib libexecdir = ${exec_prefix}/libexec libpripath = @@ -357,18 +356,18 @@ include ./$(DEPDIR)/libsangoma_la-sangoma_pri.Plo # $(LTCOMPILE) -c -o $@ $< libsangoma_la-libsangoma.lo: libsangoma.c - if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -MT libsangoma_la-libsangoma.lo -MD -MP -MF "$(DEPDIR)/libsangoma_la-libsangoma.Tpo" -c -o libsangoma_la-libsangoma.lo `test -f 'libsangoma.c' || echo '$(srcdir)/'`libsangoma.c; \ + if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -MT libsangoma_la-libsangoma.lo -MD -MP -MF "$(DEPDIR)/libsangoma_la-libsangoma.Tpo" -c -o libsangoma_la-libsangoma.lo `test -f 'libsangoma.c' || echo '$(srcdir)/'`libsangoma.c; \ then mv -f "$(DEPDIR)/libsangoma_la-libsangoma.Tpo" "$(DEPDIR)/libsangoma_la-libsangoma.Plo"; else rm -f "$(DEPDIR)/libsangoma_la-libsangoma.Tpo"; exit 1; fi # source='libsangoma.c' object='libsangoma_la-libsangoma.lo' libtool=yes \ # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -c -o libsangoma_la-libsangoma.lo `test -f 'libsangoma.c' || echo '$(srcdir)/'`libsangoma.c +# $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -c -o libsangoma_la-libsangoma.lo `test -f 'libsangoma.c' || echo '$(srcdir)/'`libsangoma.c libsangoma_la-sangoma_pri.lo: sangoma_pri.c - if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -MT libsangoma_la-sangoma_pri.lo -MD -MP -MF "$(DEPDIR)/libsangoma_la-sangoma_pri.Tpo" -c -o libsangoma_la-sangoma_pri.lo `test -f 'sangoma_pri.c' || echo '$(srcdir)/'`sangoma_pri.c; \ + if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -MT libsangoma_la-sangoma_pri.lo -MD -MP -MF "$(DEPDIR)/libsangoma_la-sangoma_pri.Tpo" -c -o libsangoma_la-sangoma_pri.lo `test -f 'sangoma_pri.c' || echo '$(srcdir)/'`sangoma_pri.c; \ then mv -f "$(DEPDIR)/libsangoma_la-sangoma_pri.Tpo" "$(DEPDIR)/libsangoma_la-sangoma_pri.Plo"; else rm -f "$(DEPDIR)/libsangoma_la-sangoma_pri.Tpo"; exit 1; fi # source='sangoma_pri.c' object='libsangoma_la-sangoma_pri.lo' libtool=yes \ # DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ -# $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -c -o libsangoma_la-sangoma_pri.lo `test -f 'sangoma_pri.c' || echo '$(srcdir)/'`sangoma_pri.c +# $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -c -o libsangoma_la-sangoma_pri.lo `test -f 'sangoma_pri.c' || echo '$(srcdir)/'`sangoma_pri.c mostlyclean-libtool: -rm -f *.lo diff --git a/api/libsangoma/Makefile.in b/api/libsangoma/Makefile.in index 41ebb2c..251a1de 100644 --- a/api/libsangoma/Makefile.in +++ b/api/libsangoma/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.2 from Makefile.am. +# 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 Free Software Foundation, Inc. +# 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. @@ -16,8 +16,6 @@ -SOURCES = $(libsangoma_a_SOURCES) $(libsangoma_la_SOURCES) - srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -87,11 +85,11 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \ +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libsangoma_a_SOURCES) $(libsangoma_la_SOURCES) DIST_SOURCES = $(libsangoma_a_SOURCES) \ @@ -163,6 +161,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -357,18 +356,18 @@ distclean-compile: @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< libsangoma_la-libsangoma.lo: libsangoma.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -MT libsangoma_la-libsangoma.lo -MD -MP -MF "$(DEPDIR)/libsangoma_la-libsangoma.Tpo" -c -o libsangoma_la-libsangoma.lo `test -f 'libsangoma.c' || echo '$(srcdir)/'`libsangoma.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -MT libsangoma_la-libsangoma.lo -MD -MP -MF "$(DEPDIR)/libsangoma_la-libsangoma.Tpo" -c -o libsangoma_la-libsangoma.lo `test -f 'libsangoma.c' || echo '$(srcdir)/'`libsangoma.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsangoma_la-libsangoma.Tpo" "$(DEPDIR)/libsangoma_la-libsangoma.Plo"; else rm -f "$(DEPDIR)/libsangoma_la-libsangoma.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libsangoma.c' object='libsangoma_la-libsangoma.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -c -o libsangoma_la-libsangoma.lo `test -f 'libsangoma.c' || echo '$(srcdir)/'`libsangoma.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -c -o libsangoma_la-libsangoma.lo `test -f 'libsangoma.c' || echo '$(srcdir)/'`libsangoma.c libsangoma_la-sangoma_pri.lo: sangoma_pri.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -MT libsangoma_la-sangoma_pri.lo -MD -MP -MF "$(DEPDIR)/libsangoma_la-sangoma_pri.Tpo" -c -o libsangoma_la-sangoma_pri.lo `test -f 'sangoma_pri.c' || echo '$(srcdir)/'`sangoma_pri.c; \ +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -MT libsangoma_la-sangoma_pri.lo -MD -MP -MF "$(DEPDIR)/libsangoma_la-sangoma_pri.Tpo" -c -o libsangoma_la-sangoma_pri.lo `test -f 'sangoma_pri.c' || echo '$(srcdir)/'`sangoma_pri.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libsangoma_la-sangoma_pri.Tpo" "$(DEPDIR)/libsangoma_la-sangoma_pri.Plo"; else rm -f "$(DEPDIR)/libsangoma_la-sangoma_pri.Tpo"; exit 1; fi @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sangoma_pri.c' object='libsangoma_la-sangoma_pri.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -c -o libsangoma_la-sangoma_pri.lo `test -f 'sangoma_pri.c' || echo '$(srcdir)/'`sangoma_pri.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsangoma_la_CFLAGS) $(CFLAGS) -c -o libsangoma_la-sangoma_pri.lo `test -f 'sangoma_pri.c' || echo '$(srcdir)/'`sangoma_pri.c mostlyclean-libtool: -rm -f *.lo diff --git a/api/libsangoma/aclocal.m4 b/api/libsangoma/aclocal.m4 index 8a90c6a..b9e32cf 100644 --- a/api/libsangoma/aclocal.m4 +++ b/api/libsangoma/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.9.2 -*- Autoconf -*- +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. +# 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. @@ -13,7 +13,7 @@ # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# serial 47 AC_PROG_LIBTOOL +# serial 48 AC_PROG_LIBTOOL # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) @@ -123,7 +123,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' +Xsed='sed -e 1s/^X//' [sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] # Same as above, but do not quote variable references. @@ -143,7 +143,7 @@ rm="rm -f" default_ofile=libtool can_build_shared=yes -# All known linkers require a `.a' archive for static linking (except M$VC, +# All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" @@ -163,6 +163,7 @@ 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" @@ -182,15 +183,17 @@ old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + 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*) @@ -231,11 +234,56 @@ AC_DEFUN([_LT_AC_SYS_COMPILER], # 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_outfile=conftest.$ac_objext +printf "$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_outfile=conftest.$ac_objext +printf "$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 conftest* +])# _LT_LINKER_BOILERPLATE + + # _LT_AC_SYS_LIBPATH_AIX # ---------------------- # Links a minimal program and checks the executable @@ -308,15 +356,15 @@ fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/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`" && + 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 @@ -485,7 +533,7 @@ 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 + case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*linux*) @@ -536,6 +584,22 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) 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" ;; + *) LD="${LD-ld} -64" ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], [*-*-cygwin* | *-*-mingw* | *-*-pw32*) AC_CHECK_TOOL(DLLTOOL, dlltool, false) @@ -567,7 +631,7 @@ AC_CACHE_CHECK([$1], [$2], # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*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) @@ -577,8 +641,10 @@ AC_CACHE_CHECK([$1], [$2], echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # 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 @@ -604,11 +670,16 @@ AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], LDFLAGS="$LDFLAGS $3" printf "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized + # 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 @@ -667,11 +738,55 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl 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 + ;; + *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \ + 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 && @@ -697,7 +812,7 @@ fi # _LT_AC_CHECK_DLFCN -# -------------------- +# ------------------ AC_DEFUN([_LT_AC_CHECK_DLFCN], [AC_CHECK_HEADERS(dlfcn.h)dnl ])# _LT_AC_CHECK_DLFCN @@ -705,7 +820,7 @@ AC_DEFUN([_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 : @@ -771,17 +886,19 @@ int main () 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; ) 2>/dev/null + (./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_unknown|x*) $3 ;; + x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed @@ -793,7 +910,7 @@ rm -fr conftest* # AC_LIBTOOL_DLOPEN_SELF -# ------------------- +# ---------------------- AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl if test "x$enable_dlopen" != xyes; then @@ -864,7 +981,7 @@ else test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" @@ -877,7 +994,7 @@ else ]) if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" + 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( @@ -925,7 +1042,7 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*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) @@ -937,11 +1054,13 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $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 . + chmod u+w . 2>&AS_MESSAGE_LOG_FD $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation @@ -1005,8 +1124,8 @@ 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 + 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 && @@ -1173,7 +1292,7 @@ beos*) shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -1201,7 +1320,8 @@ cygwin* | mingw* | pw32*) 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' + $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' @@ -1231,7 +1351,7 @@ cygwin* | mingw* | pw32*) ;; 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}' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac ;; @@ -1254,7 +1374,7 @@ darwin* | rhapsody*) 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)' + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` @@ -1289,8 +1409,17 @@ kfreebsd*-gnu) dynamic_linker='GNU ld.so' ;; -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` +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*) @@ -1308,14 +1437,19 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.[01]* | freebsdelf3.[01]*) + freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; - *) # from 3.2 on + 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 ;; + freebsd*) # from 4.6 on + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; esac ;; @@ -1335,7 +1469,7 @@ hpux9* | hpux10* | hpux11*) version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in + case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes @@ -1375,6 +1509,18 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; +interix3*) + 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 ;; @@ -1451,7 +1597,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' /etc/ld.so.conf | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" fi @@ -1513,8 +1659,13 @@ nto-qnx*) openbsd*) version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no - need_version=yes + # 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 @@ -1552,13 +1703,6 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - solaris*) version_type=linux need_lib_prefix=no @@ -1584,7 +1728,7 @@ sunos4*) need_version=yes ;; -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) +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' @@ -1617,6 +1761,29 @@ sysv4*MP*) 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}' @@ -1630,6 +1797,11 @@ uts4*) esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi ])# AC_LIBTOOL_SYS_DYNAMIC_LINKER @@ -1654,6 +1826,9 @@ if test -f "$ltmain" && test -n "$tagnames"; then 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. @@ -1680,7 +1855,9 @@ if test -f "$ltmain" && test -n "$tagnames"; then case $tagname in CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then + 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="" @@ -1742,7 +1919,7 @@ AC_DEFUN([AC_LIBTOOL_DLOPEN], # AC_LIBTOOL_WIN32_DLL # -------------------- -# declare package support for building win32 dll's +# declare package support for building win32 DLLs AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) ])# AC_LIBTOOL_WIN32_DLL @@ -1780,7 +1957,7 @@ AC_ARG_ENABLE([shared], # AC_DISABLE_SHARED # ----------------- -#- set the default shared flag to --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) @@ -1916,7 +2093,7 @@ dnl not every word. This closes a longstanding sh security hole. if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"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 @@ -2026,7 +2203,7 @@ AC_CACHE_VAL(lt_cv_path_LD, if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. + # 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; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_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.*` ;; @@ -2163,7 +2349,7 @@ gnu*) hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file - case "$host_cpu" in + 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 @@ -2179,6 +2365,11 @@ hpux10.20* | hpux11*) esac ;; +interix3*) + # 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;; @@ -2191,15 +2382,6 @@ irix5* | irix6* | nonstopux*) # This must be Linux ELF. linux*) - case $host_cpu in - alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64*) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` lt_cv_deplibs_check_method=pass_all ;; @@ -2222,12 +2404,10 @@ nto-qnx*) ;; openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; @@ -2235,15 +2415,11 @@ osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - solaris*) lt_cv_deplibs_check_method=pass_all ;; -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) +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]]' @@ -2264,10 +2440,13 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) siemens) lt_cv_deplibs_check_method=pass_all ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; esac ;; -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac @@ -2287,36 +2466,43 @@ AC_DEFUN([AC_PROG_NM], # Let the user override the test. lt_cv_path_NM="$NM" else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/${ac_tool_prefix}nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" + 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 ;; *) - 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 + 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 - esac - fi + fi + done + IFS="$lt_save_ifs" done - IFS="$lt_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi]) NM="$lt_cv_path_NM" @@ -2348,13 +2534,13 @@ esac # ----------------------------------- # sets LIBLTDL to the link flags for the libltdl convenience library and # LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. +# --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 @@ -2373,13 +2559,13 @@ AC_DEFUN([AC_LIBLTDL_CONVENIENCE], # ----------------------------------- # sets LIBLTDL to the link flags for the libltdl installable library and # LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided and an installed libltdl is not found, it is -# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' -# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single -# quotes!). If your package is not flat and you're not using automake, -# define top_builddir and top_srcdir appropriately in the Makefiles. +# --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 @@ -2417,10 +2603,21 @@ AC_DEFUN([AC_LIBTOOL_CXX], # --------------- AC_DEFUN([_LT_AC_LANG_CXX], [AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) +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 # -------------- @@ -2460,7 +2657,7 @@ _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ]) # AC_LIBTOOL_RC -# -------------- +# ------------- # enable support for Windows resource files AC_DEFUN([AC_LIBTOOL_RC], [AC_REQUIRE([LT_AC_PROG_RC]) @@ -2493,36 +2690,9 @@ lt_simple_link_test_code='int main(){return(0);}\n' _LT_AC_SYS_COMPILER -# -# Check for any special shared library compilation flags. -# -_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' - ;; - esac -fi -if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then - AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) - _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), - $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), - [], - [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) - +# 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) @@ -2532,9 +2702,9 @@ 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($1) +AC_LIBTOOL_DLOPEN_SELF -# Report which librarie types wil actually be built +# Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -2543,7 +2713,7 @@ 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 +case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then @@ -2555,43 +2725,6 @@ aix3*) aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no - fi - ;; - darwin* | rhapsody*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC $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 ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; esac @@ -2618,7 +2751,7 @@ AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], [AC_LANG_PUSH(C++) AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) +AC_REQUIRE([_LT_AC_PROG_CXXCPP]) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no _LT_AC_TAGVAR(allow_undefined_flag, $1)= @@ -2630,6 +2763,7 @@ _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)= @@ -2647,7 +2781,7 @@ _LT_AC_TAGVAR(postdeps, $1)= _LT_AC_TAGVAR(compiler_lib_search_path, $1)= # Source file extension for C++ test sources. -ac_ext=cc +ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o @@ -2657,11 +2791,15 @@ _LT_AC_TAGVAR(objext, $1)=$objext lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' +lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_AC_SYS_COMPILER +# 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 @@ -2672,18 +2810,18 @@ lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else - unset lt_cv_prog_gnu_ld + $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 - unset lt_cv_path_LD + $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) # We don't want -fno-exception wen compiling C++ code, so set the # no_builtin_flag separately @@ -2772,6 +2910,7 @@ case $host_os in ;; esac done + ;; esac exp_sym_flag='-bexport' @@ -2790,7 +2929,7 @@ case $host_os in _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) + 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` @@ -2809,8 +2948,12 @@ case $host_os in _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 @@ -2837,12 +2980,12 @@ case $host_os in _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + _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 $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + _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 @@ -2851,16 +2994,26 @@ case $host_os in # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + # 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 *) @@ -2879,7 +3032,7 @@ case $host_os in _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + _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 @@ -2888,70 +3041,81 @@ case $host_os in echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + $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*) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; + 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 - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + _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 - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC $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 + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + 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` $verstring' + _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 $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $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++) + ec++*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - ghcx) + ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -2962,14 +3126,14 @@ case $host_os in ;; esac ;; - freebsd[12]*) + 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* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_AC_TAGVAR(ld_shlibs, $1)=yes @@ -2986,11 +3150,11 @@ case $host_os in # location of the library. case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC) + 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 @@ -3000,7 +3164,7 @@ case $host_os in # 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' + 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 @@ -3014,34 +3178,23 @@ case $host_os in ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $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_libdir_separator, $1)=: - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi - case "$host_cpu" in - hppa*64*) + case $host_cpu in + hppa*64*|ia64*) _LT_AC_TAGVAR(hardcode_direct, $1)=no _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; - ia64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; *) _LT_AC_TAGVAR(hardcode_direct, $1)=yes _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, @@ -3051,14 +3204,17 @@ case $host_os in esac case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + 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' @@ -3077,9 +3233,12 @@ case $host_os in *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + 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' @@ -3093,11 +3252,25 @@ case $host_os in ;; esac ;; + interix3*) + _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) + CC*) # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _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 @@ -3108,7 +3281,7 @@ case $host_os in *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _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 @@ -3121,7 +3294,7 @@ case $host_os in ;; linux*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3146,17 +3319,41 @@ case $host_os in # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc) + 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(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - cxx) + pgCC*) + # 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' @@ -3187,7 +3384,7 @@ case $host_os in ;; mvs*) case $cc_basename in - cxx) + cxx*) # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; @@ -3208,9 +3405,25 @@ case $host_os in # 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*) + _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' + ;; osf3*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3226,14 +3439,14 @@ case $host_os in _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx) + cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(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)=: @@ -3251,7 +3464,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(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)=: @@ -3270,7 +3483,7 @@ case $host_os in ;; osf4* | osf5*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -3285,17 +3498,17 @@ case $host_os in # the KAI C++ compiler. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - cxx) + cxx*) _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_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 $objdir/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -3314,7 +3527,7 @@ case $host_os in *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(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)=: @@ -3335,27 +3548,14 @@ case $host_os in # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - sco*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - lcc) + lcc*) # Lucid # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3368,36 +3568,33 @@ case $host_os in ;; solaris*) case $cc_basename in - CC) + 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} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _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} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $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].*) ;; + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + 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 @@ -3405,7 +3602,7 @@ case $host_os in # in the archive. _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; - gcx) + 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' @@ -3443,12 +3640,63 @@ case $host_os in ;; esac ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + 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) + NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_AC_TAGVAR(ld_shlibs, $1)=no @@ -3481,8 +3729,6 @@ 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($1) AC_LIBTOOL_CONFIG($1) @@ -3500,7 +3746,7 @@ 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 @@ -3554,7 +3800,7 @@ if AC_TRY_EVAL(ac_compile); then # 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\"`" + 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 @@ -3630,13 +3876,37 @@ fi $rm -f confest.$objext +# PORTME: override above test on systems where it is broken +ifelse([$1],[CXX], +[case $host_os in +interix3*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_AC_TAGVAR(predep_objects,$1)= + _LT_AC_TAGVAR(postdep_objects,$1)= + _LT_AC_TAGVAR(postdeps,$1)= + ;; + +solaris*) + case $cc_basename in + CC*) + # 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. + _LT_AC_TAGVAR(postdeps,$1)='-lCstd -lCrun' + ;; + 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'. @@ -3680,12 +3950,16 @@ lt_simple_link_test_code=" program t\n end\n" # 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 -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +_LT_CC_BASENAME([$compiler]) AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) @@ -3695,7 +3969,7 @@ 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 +case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then @@ -3704,7 +3978,9 @@ aix3*) fi ;; aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no + 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]) @@ -3714,8 +3990,6 @@ AC_MSG_CHECKING([whether to build static libraries]) test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - _LT_AC_TAGVAR(GCC, $1)="$G77" _LT_AC_TAGVAR(LD, $1)="$LD" @@ -3725,8 +3999,6 @@ 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_CONFIG($1) @@ -3755,20 +4027,27 @@ _LT_AC_TAGVAR(objext, $1)=$objext lt_simple_compile_test_code="class foo {}\n" # Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _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) @@ -3776,8 +4055,6 @@ 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($1) AC_LIBTOOL_CONFIG($1) @@ -3787,7 +4064,7 @@ CC="$lt_save_CC" # 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'. @@ -3811,11 +4088,16 @@ 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) @@ -3845,7 +4127,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + 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 \ @@ -3951,7 +4233,7 @@ ifelse([$1], [], # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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 @@ -3962,11 +4244,11 @@ ifelse([$1], [], SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags= @@ -3997,6 +4279,12 @@ 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 @@ -4008,12 +4296,18 @@ 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) +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + # An ERE matcher. EGREP=$lt_EGREP @@ -4073,7 +4367,7 @@ 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 ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -4147,11 +4441,11 @@ 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) +predep_objects=\`echo $lt_[]_LT_AC_TAGVAR(predep_objects, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) +postdep_objects=\`echo $lt_[]_LT_AC_TAGVAR(postdep_objects, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place before the objects being linked to create a # shared library. @@ -4163,7 +4457,7 @@ postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) +compiler_lib_search_path=\`echo $lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -4243,7 +4537,7 @@ variables_saved_for_relink="$variables_saved_for_relink" 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 +sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -4347,9 +4641,6 @@ symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" @@ -4371,15 +4662,31 @@ hpux*) # Its linker distinguishes data from code symbols 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*) + 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* | sysv5*) +solaris*) symcode='[[BDRT]]' ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; sysv4) symcode='[[DFNSTU]]' ;; @@ -4402,8 +4709,11 @@ 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'" + 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 @@ -4559,6 +4869,10 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) # DJGPP does not support shared libraries at all _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= ;; + interix3*) + # 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 @@ -4567,7 +4881,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) ;; *) @@ -4592,18 +4906,28 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; chorus*) case $cc_basename in - cxch68) + 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++) + ec++*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; - ghcx) + ghcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4611,22 +4935,22 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; esac ;; - freebsd* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC) + CC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + _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) + aCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -4639,9 +4963,13 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; 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) + 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. @@ -4652,18 +4980,24 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; linux*) case $cc_basename in - KCC) + KCC*) # KAI C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; - icpc) + 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' ;; - cxx) + pgCC*) + # 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. @@ -4680,7 +5014,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; mvs*) case $cc_basename in - cxx) + cxx*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) @@ -4691,14 +5025,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC) + KCC*) _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; - RCC) + RCC*) # Rational C++ 2.4.1 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; - cxx) + 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 @@ -4712,24 +5046,15 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; psos*) ;; - sco*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - *) - ;; - esac - ;; solaris*) case $cc_basename in - CC) + 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) + gcx*) # Green Hills C++ Compiler _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; @@ -4739,12 +5064,12 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - lcc) + lcc*) # Lucid _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; @@ -4754,7 +5079,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; @@ -4762,7 +5087,14 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; esac ;; - unixware*) + 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*) ;; @@ -4809,6 +5141,11 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; + interix3*) + # 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. @@ -4825,7 +5162,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -4851,6 +5188,16 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _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* | pw32* | os2*) # This hack is so that the source file can tell whether it is being @@ -4862,7 +5209,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _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 + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -4886,12 +5233,19 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) ;; linux*) - case $CC in + 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. @@ -4906,15 +5260,15 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' - ;; - solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + 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*) @@ -4923,7 +5277,7 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + 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' @@ -4936,6 +5290,17 @@ AC_MSG_CHECKING([for $compiler option to produce PIC]) 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' @@ -4963,7 +5328,7 @@ if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi -case "$host_os" in +case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= @@ -4972,6 +5337,16 @@ case "$host_os" in _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_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) ]) @@ -4996,7 +5371,7 @@ ifelse([$1],[CXX],[ _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' ;; *) _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' @@ -5039,7 +5414,8 @@ ifelse([$1],[CXX],[ # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. 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 @@ -5049,6 +5425,10 @@ ifelse([$1],[CXX],[ 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 ;; @@ -5059,6 +5439,27 @@ ifelse([$1],[CXX],[ # 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 aix3* | aix4* | aix5*) @@ -5109,10 +5510,10 @@ EOF _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_AC_TAGVAR(always_export_symbols, $1)=no _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + _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 @@ -5121,9 +5522,55 @@ EOF echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + $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 + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + interix3*) + _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' + ;; + + linux*) + 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 + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$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 -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no fi ;; @@ -5137,7 +5584,7 @@ EOF fi ;; - solaris* | sysv5*) + solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then _LT_AC_TAGVAR(ld_shlibs, $1)=no cat <&2 @@ -5158,6 +5605,33 @@ EOF 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= @@ -5165,31 +5639,6 @@ EOF _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_cmds, $1)="$tmp_archive_cmds" - 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 - 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 -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="$tmp_archive_cmds" - fi - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - *) 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' @@ -5200,16 +5649,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi + 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) @@ -5221,7 +5665,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then + 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 @@ -5255,6 +5699,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ break fi done + ;; esac exp_sym_flag='-bexport' @@ -5273,7 +5718,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) + 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` @@ -5292,8 +5737,12 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _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 @@ -5301,11 +5750,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else - if test "$aix_use_runtimelinking" = yes; then + if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' - fi + fi fi fi @@ -5319,12 +5768,12 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ # Determine the default libpath from the value encoded in an empty executable. _LT_AC_SYS_LIBPATH_AIX _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + _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 $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + _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 @@ -5333,13 +5782,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ # -berok will link without error, but may produce a broken library. _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + # 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 ;; @@ -5352,7 +5799,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(ld_shlibs, $1)=no ;; - bsdi4*) + bsdi[[45]]*) _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; @@ -5373,57 +5820,57 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; darwin* | rhapsody*) - if test "$GXX" = yes ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - 10.*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined dynamic_lookup' - ;; - esac - fi - ;; + 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_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC ${wl}-bind_at_load $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 ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _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)='-all_load $convenience' + _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_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 -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - _LT_AC_TAGVAR(ld_shlibs, $1)=no + 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` $verstring' + _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 $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $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 ;; @@ -5457,7 +5904,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | 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 @@ -5480,47 +5927,62 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; - hpux10* | hpux11*) + hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -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*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + 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)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_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 - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - # 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 + 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_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' @@ -5568,6 +6030,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _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 @@ -5613,7 +6076,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $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' @@ -5621,21 +6084,15 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: ;; - sco3.2v5*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - solaris*) _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' if test "$GCC" = yes; then + 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' @@ -5644,8 +6101,18 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes ;; @@ -5702,36 +6169,45 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ fi ;; - sysv4.2uw2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*) + _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 - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; + runpath_var='LD_RUN_PATH' - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _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 ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _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 - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no ;; - sysv5*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + 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*) @@ -5749,11 +6225,6 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - # # Do we need to explicitly link libc? # @@ -5781,6 +6252,7 @@ x|xyes) 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= @@ -5901,12 +6373,13 @@ do 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 && break + test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in @@ -5931,28 +6404,17 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do fi done done -SED=$lt_cv_path_SED ]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ]) -# -*- Autoconf -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. -# Generated from amversion.in; do not edit by hand. - -# 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., 59 Temple Place - Suite 330, Boston, MA +# 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) # ---------------------------- @@ -5965,26 +6427,15 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) # 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.2])]) + [AM_AUTOMAKE_VERSION([1.9.6])]) -# AM_AUX_DIR_EXPAND +# AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. +# 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 @@ -6031,26 +6482,16 @@ AC_PREREQ([2.50])dnl am_aux_dir=`cd $ac_aux_dir && pwd` ]) -# AM_CONDITIONAL -*- Autoconf -*- +# AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. +# 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. -# 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 6 +# serial 7 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- @@ -6074,26 +6515,15 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# serial 7 -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 +# 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. -# 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - +# 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, @@ -6102,7 +6532,6 @@ fi])]) # CC etc. in the Makefile, will ask for an AC_PROG_CC use... - # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. @@ -6242,27 +6671,16 @@ AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) -# Generate code to set up dependency tracking. -*- Autoconf -*- +# Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. +# 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. -# 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -#serial 2 +#serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ @@ -6321,30 +6739,19 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Do all the work for Automake. -*- Autoconf -*- +# Do all the work for Automake. -*- Autoconf -*- -# 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. - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +# 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 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. +# serial 12 -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 11 +# 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]) @@ -6446,51 +6853,27 @@ for _am_header in $config_headers :; do 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. - -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - 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)]) -# -*- Autoconf -*- -# Copyright (C) 2003 Free Software Foundation, Inc. +# 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. -# 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 1 +# serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. @@ -6505,26 +6888,15 @@ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) -# Check to see how 'make' treats includes. -*- Autoconf -*- +# Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# 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. -# 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 +# serial 3 # AM_MAKE_INCLUDE() # ----------------- @@ -6568,27 +6940,16 @@ AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) -# -*- Autoconf -*- +# 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. -# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 +# serial 4 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ @@ -6614,27 +6975,16 @@ else 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. - -# Copyright (C) 2003, 2004 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - +# # 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). @@ -6688,26 +7038,15 @@ else fi AC_SUBST([mkdir_p])]) -# Helper functions for option handling. -*- Autoconf -*- +# Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# 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. -# 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 +# serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- @@ -6732,28 +7071,16 @@ AC_DEFUN([_AM_SET_OPTIONS], 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. # -# Check to make sure that the build environment is sane. -# +# 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. -# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 +# serial 4 # AM_SANITY_CHECK # --------------- @@ -6796,25 +7123,14 @@ 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 - -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - +# --------------------- # 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 @@ -6837,25 +7153,13 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004 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., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 1 +# 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) # -------------------- diff --git a/api/libsangoma/autom4te.cache/output.0 b/api/libsangoma/autom4te.cache/output.0 new file mode 100644 index 0000000..2b3e017 --- /dev/null +++ b/api/libsangoma/autom4te.cache/output.0 @@ -0,0 +1,20518 @@ +@%:@! /bin/sh +@%:@ Guess values for system-dependent variables and create Makefiles. +@%:@ Generated by GNU Autoconf 2.59 for libsangoma 1.0.0. +@%:@ +@%:@ Report bugs to . +@%:@ +@%:@ Copyright (C) 2003 Free Software Foundation, Inc. +@%:@ This configure script is free software; the Free Software Foundation +@%:@ gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +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 + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; 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'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# 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 + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + 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 + + ;; + 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_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + 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=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # 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 before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, 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 + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\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 sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +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$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# 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'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + + +# 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 + +# 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` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='libsangoma' +PACKAGE_TARNAME='libsangoma' +PACKAGE_VERSION='1.0.0' +PACKAGE_STRING='libsangoma 1.0.0' +PACKAGE_BUGREPORT='anthmct@yahoo.com' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar 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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBPRI_TRUE LIBPRI_FALSE libpripath LIB@&t@OBJS LTLIBOBJS' +ac_subst_files='' + +# 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. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_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 | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$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" ;; + + -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'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -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 ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -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 ;; + + -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'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + 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; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + 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 paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +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 + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$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 + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP +ac_env_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS +ac_env_CXXCPP_set=${CXXCPP+set} +ac_env_CXXCPP_value=$CXXCPP +ac_cv_env_CXXCPP_set=${CXXCPP+set} +ac_cv_env_CXXCPP_value=$CXXCPP +ac_env_F77_set=${F77+set} +ac_env_F77_value=$F77 +ac_cv_env_F77_set=${F77+set} +ac_cv_env_F77_value=$F77 +ac_env_FFLAGS_set=${FFLAGS+set} +ac_env_FFLAGS_value=$FFLAGS +ac_cv_env_FFLAGS_set=${FFLAGS+set} +ac_cv_env_FFLAGS_value=$FFLAGS + +# +# 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 libsangoma 1.0.0 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 \`..'] + +_ACEOF + + cat <<_ACEOF +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] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --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] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of libsangoma 1.0.0:";; + esac + 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-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@:>@ + --with-libpri= enable pri support + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ 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. + +Report bugs to . +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style 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 + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +libsangoma configure 1.0.0 +generated by GNU Autoconf 2.59 + +Copyright (C) 2003 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 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by libsangoma $as_me 1.0.0, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +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` +hostinfo = `(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 + +} >&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_sep= +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_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + 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: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +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, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +@%:@@%:@ ----------------- @%:@@%:@ +@%:@@%:@ Output variables. @%:@@%:@ +@%:@@%:@ ----------------- @%:@@%:@ +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +@%:@@%:@ ------------- @%:@@%:@ +@%:@@%:@ Output files. @%:@@%:@ +@%:@@%:@ ------------- @%:@@%:@ +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +@%:@@%:@ ----------- @%:@@%:@ +@%:@@%:@ confdefs.h. @%:@@%:@ +@%:@@%:@ ----------- @%:@@%:@ +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf 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 -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >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 -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$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 `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + +am__api_version="1.9" +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 +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# 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 $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$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 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 $as_executable_p "$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 + +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 dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$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=libsangoma + VERSION=1.0.0 + + +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +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 + + STRIP=$ac_ct_STRIP +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 -' + + + + + +# Checks for programs. +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 $as_executable_p "$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 + +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 $as_executable_p "$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 + +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 + + CC=$ac_ct_CC +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 $as_executable_p "$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 + +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 "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +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 $as_executable_p "$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 + +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 + 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&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[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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 { (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); }; 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 | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + 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 { (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 + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f 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 +CFLAGS="-g" +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 + 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +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 ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=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 -std1 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 -std1. */ +int osf4_cc_array ['\x00' == 0 ? 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 +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +@%:@ifndef __cplusplus + choke me +@%:@endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +@%:@include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +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 or --disable-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 or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + 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 or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + 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 or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + 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; + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_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_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { 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=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_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 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +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 + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +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 egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_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_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$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 recognise dependent libraries" >&5 +echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +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'. + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | kfreebsd*-gnu | 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 + ;; + +interix3*) + # 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*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + 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 + ;; + +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 or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && 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 __oline__ "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|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-*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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + lt_cv_cc_needs_belf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +lt_cv_cc_needs_belf=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +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" ;; + *) LD="${LD-ld} -64" ;; + 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@ifdef __STDC__ +@%:@ include +@%:@else +@%:@ include +@%:@endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f 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 +#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)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +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); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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 eval "test \"\${$as_ac_Header+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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +@%:@@%:@ -------------------------------- @%:@@%:@ +@%:@@%:@ Report this to anthmct@yahoo.com @%:@@%:@ +@%:@@%:@ -------------------------------- @%:@@%:@ +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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=cc +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 -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 $CCC g++ c++ gpp aCC CC cxx cc++ cl 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +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` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f 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 +CXXFLAGS="-g" +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 + 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cxx_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +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 +for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +@%:@include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +ac_ext=cc +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=cc +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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +echo "$as_me:$LINENO: result: $CXXCPP" >&5 +echo "${ECHO_T}$CXXCPP" >&6 +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@ifdef __STDC__ +@%:@ include +@%:@else +@%:@ include +@%:@endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=cc +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 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran + 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_F77="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + echo "$as_me:$LINENO: result: $F77" >&5 +echo "${ECHO_T}$F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$F77" && break + done +fi +if test -z "$F77"; then + ac_ct_F77=$F77 + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_F77="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 + + F77=$ac_ct_F77 +fi + + +# Provide some information about the compiler. +echo "$as_me:__oline__:" \ + "checking for Fortran 77 compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_f77_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_f77_g=no +fi +rm -f 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 + ;; + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + 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` + ;; + 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*) + 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 -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +if test "${lt_cv_objdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 +echo "${ECHO_T}$lt_cv_objdir" >&6 +objdir=$lt_cv_objdir + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false" +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 + + AR=$ac_ct_AR +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +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 + + RANLIB=$ac_ct_RANLIB +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +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 + + STRIP=$ac_ct_STRIP +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_deplibs' +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 + +enable_dlopen=no +enable_win32_dll=no + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + + +# Check whether --with-pic or --without-pic was given. +if test "${with_pic+set}" = set; then + withval="$with_pic" + pic_mode="$withval" +else + pic_mode=default +fi; +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# 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 +printf "$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 +printf "$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 conftest* + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{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\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + interix3*) + # 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* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + linux*) + case $cc_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' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + 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_prog_compiler_pic_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{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\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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_prog_compiler_pic_works=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 + +if test x"$lt_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +# +# 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_prog_compiler_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + printf "$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_prog_compiler_static_works=yes + fi + else + lt_prog_compiler_static_works=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 + +if test x"$lt_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + 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\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:__oline__: \$? = $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_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # 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 + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # 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 + ;; + + interix3*) + 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' + ;; + + linux*) + 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 + archive_cmds='$CC -shared'"$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 -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + 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 + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # 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' + 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 -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + 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` $verstring' + 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 $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $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* | kfreebsd*-gnu | 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*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + 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 + ;; + + 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 linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + 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*) + 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* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + 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 + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +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`' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-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='GNU ld.so' + ;; + +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 + ;; + freebsd*) # from 4.6 on + 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' + ;; + +interix3*) + 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*) + 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 + + # find out which ABI we are using + libsuff= + case "$host_cpu" in + x86_64*|s390x*|powerpc64*) + echo '#line __oline__ "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 + case `/usr/bin/file conftest.$ac_objext` in + *64-bit*) + libsuff=64 + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + ;; + esac + fi + rm -rf conftest* + ;; + esac + + # 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/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $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' + ;; + +knetbsd*-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='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${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" + ;; + +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 + +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" + 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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +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 +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +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 +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dld_link (); +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + 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 + ;; + +aix4* | aix5*) + 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 \ + archive_cmds \ + archive_expsym_cmds \ + postinstall_cmds \ + postuninstall_cmds \ + old_archive_from_expsyms_cmds \ + allow_undefined_flag \ + no_undefined_flag \ + export_symbols_cmds \ + hardcode_libdir_flag_spec \ + hardcode_libdir_flag_spec_ld \ + hardcode_libdir_separator \ + hardcode_automatic \ + module_cmds \ + module_expsym_cmds \ + lt_cv_prog_compiler_c_o \ + exclude_expsyms \ + include_expsyms; do + + case $var in + old_archive_cmds | \ + old_archive_from_new_cmds | \ + archive_cmds | \ + archive_expsym_cmds | \ + module_cmds | \ + module_expsym_cmds | \ + old_archive_from_expsyms_cmds | \ + export_symbols_cmds | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + { echo "$as_me:$LINENO: creating $ofile" >&5 +echo "$as_me: creating $ofile" >&6;} + + cat <<__EOF__ >> "$cfgfile" +#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 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 + +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + +# 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=\`echo $lt_predep_objects | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=\`echo $lt_postdep_objects | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# 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=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + 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 or --without-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=cc +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= + +# 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;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# 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 +printf "$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 +printf "$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 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 or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$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 + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_CXX=yes + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + ;; + esac + shared_flag='-shared' + 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + # 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*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + 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 + + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_CXX='$CC $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 + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + 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` $verstring' + 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 $verstring~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* | kfreebsd*-gnu | 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*) + hardcode_libdir_flag_spec_ld_CXX='+b $libdir' + ;; + *) + 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 + ;; + interix3*) + 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*) + 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*) + # 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' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + ld_shlibs_CXX=no + ;; + openbsd*) + 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' + ;; + 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 C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}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' + 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" + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... + +cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"` + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX="${prev}${p}" + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX="${prev}${p}" + else + postdeps_CXX="${postdeps_CXX} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX="$p" + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX="$p" + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$rm -f confest.$objext + +# PORTME: override above test on systems where it is broken +case $host_os in +interix3*) + # 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= + ;; + +solaris*) + case $cc_basename in + CC*) + # 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. + postdeps_CXX='-lCstd -lCrun' + ;; + 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* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + interix3*) + # 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 + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + 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* | kfreebsd*-gnu | 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*) + 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*) + # 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' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx*) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + 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_prog_compiler_pic_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{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\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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_prog_compiler_pic_works_CXX=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 + +if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +# +# 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_prog_compiler_static_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works_CXX=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + printf "$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_prog_compiler_static_works_CXX=yes + fi + else + lt_prog_compiler_static_works_CXX=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6 + +if test x"$lt_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 + printf "$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\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:__oline__: \$? = $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 + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw*) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + 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" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +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`' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-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='GNU ld.so' + ;; + +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 + ;; + freebsd*) # from 4.6 on + 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' + ;; + +interix3*) + 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*) + 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 + + # find out which ABI we are using + libsuff= + case "$host_cpu" in + x86_64*|s390x*|powerpc64*) + echo '#line __oline__ "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 + case `/usr/bin/file conftest.$ac_objext` in + *64-bit*) + libsuff=64 + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + ;; + esac + fi + rm -rf conftest* + ;; + esac + + # 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/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $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' + ;; + +knetbsd*-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='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${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" + ;; + +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 + +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 \ + archive_cmds_CXX \ + archive_expsym_cmds_CXX \ + postinstall_cmds_CXX \ + postuninstall_cmds_CXX \ + old_archive_from_expsyms_cmds_CXX \ + allow_undefined_flag_CXX \ + no_undefined_flag_CXX \ + export_symbols_cmds_CXX \ + hardcode_libdir_flag_spec_CXX \ + hardcode_libdir_flag_spec_ld_CXX \ + hardcode_libdir_separator_CXX \ + hardcode_automatic_CXX \ + module_cmds_CXX \ + module_expsym_cmds_CXX \ + lt_cv_prog_compiler_c_o_CXX \ + exclude_expsyms_CXX \ + include_expsyms_CXX; do + + case $var in + old_archive_cmds_CXX | \ + old_archive_from_new_cmds_CXX | \ + archive_cmds_CXX | \ + archive_expsym_cmds_CXX | \ + module_cmds_CXX | \ + module_expsym_cmds_CXX | \ + old_archive_from_expsyms_cmds_CXX | \ + export_symbols_cmds_CXX | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +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 + +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + +# 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=\`echo $lt_predep_objects_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=\`echo $lt_postdep_objects_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# 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=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_CXX" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + 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\n return\n end\n" + +# Code to be used in simple link tests +lt_simple_link_test_code=" program t\n end\n" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# 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 +printf "$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 +printf "$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 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 + ;; +aix4* | aix5*) + 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* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_F77='-fno-common' + ;; + + interix3*) + # 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* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_F77='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_F77='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + linux*) + case $cc_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' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_F77='-Wl,' + # All OSF/1 code is PIC. + 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_prog_compiler_pic_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_F77=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_F77" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{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\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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_prog_compiler_pic_works_F77=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 + +if test x"$lt_prog_compiler_pic_works_F77" = xyes; then + case $lt_prog_compiler_pic_F77 in + "" | " "*) ;; + *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; + esac +else + lt_prog_compiler_pic_F77= + lt_prog_compiler_can_build_shared_F77=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_F77= + ;; + *) + lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" + ;; +esac + +# +# 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_prog_compiler_static_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works_F77=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + printf "$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_prog_compiler_static_works_F77=yes + fi + else + lt_prog_compiler_static_works_F77=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6 + +if test x"$lt_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 + printf "$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\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:__oline__: \$? = $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_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # 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 + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_F77=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_F77=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_F77='-L$libdir' + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=no + enable_shared_with_static_runtimes_F77=yes + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_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 + ;; + + interix3*) + 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' + ;; + + linux*) + 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 + archive_cmds_F77='$CC -shared'"$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 -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_F77=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + 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 + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_F77='' + hardcode_direct_F77=yes + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_F77=yes + else + # We have old collect2 + hardcode_direct_F77=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_F77=yes + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_libdir_separator_F77= + fi + ;; + esac + shared_flag='-shared' + 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_F77=' ${wl}-bernotok' + allow_undefined_flag_F77=' ${wl}-berok' + # 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' + 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 -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_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}' + 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` $verstring' + 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 $verstring~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* | kfreebsd*-gnu | 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*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + newsos6) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_shlibpath_var_F77=no + ;; + + openbsd*) + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + 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 + ;; + + 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 linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + 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*) + 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* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_F77 + 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" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +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`' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-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='GNU ld.so' + ;; + +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 + ;; + freebsd*) # from 4.6 on + 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' + ;; + +interix3*) + 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*) + 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 + + # find out which ABI we are using + libsuff= + case "$host_cpu" in + x86_64*|s390x*|powerpc64*) + echo '#line __oline__ "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 + case `/usr/bin/file conftest.$ac_objext` in + *64-bit*) + libsuff=64 + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + ;; + esac + fi + rm -rf conftest* + ;; + esac + + # 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/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $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' + ;; + +knetbsd*-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='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${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" + ;; + +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 + +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 \ + archive_cmds_F77 \ + archive_expsym_cmds_F77 \ + postinstall_cmds_F77 \ + postuninstall_cmds_F77 \ + old_archive_from_expsyms_cmds_F77 \ + allow_undefined_flag_F77 \ + no_undefined_flag_F77 \ + export_symbols_cmds_F77 \ + hardcode_libdir_flag_spec_F77 \ + hardcode_libdir_flag_spec_ld_F77 \ + hardcode_libdir_separator_F77 \ + hardcode_automatic_F77 \ + module_cmds_F77 \ + module_expsym_cmds_F77 \ + lt_cv_prog_compiler_c_o_F77 \ + exclude_expsyms_F77 \ + include_expsyms_F77; do + + case $var in + old_archive_cmds_F77 | \ + old_archive_from_new_cmds_F77 | \ + archive_cmds_F77 | \ + archive_expsym_cmds_F77 | \ + module_cmds_F77 | \ + module_expsym_cmds_F77 | \ + old_archive_from_expsyms_cmds_F77 | \ + export_symbols_cmds_F77 | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_F77 + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +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 + +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + +# 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=\`echo $lt_predep_objects_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=\`echo $lt_postdep_objects_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_F77 + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# 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=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_F77" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_F77 + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_F77 + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_F77 + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_F77 + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + 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 {}\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# 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 +printf "$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 +printf "$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 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 + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... + +lt_prog_compiler_no_builtin_flag_GCJ= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' + + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{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\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_GCJ='-fno-common' + ;; + + interix3*) + # 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* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + linux*) + case $cc_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' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All OSF/1 code is PIC. + 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_prog_compiler_pic_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_GCJ=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_GCJ" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{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\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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_prog_compiler_pic_works_GCJ=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 + +if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then + case $lt_prog_compiler_pic_GCJ in + "" | " "*) ;; + *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; + esac +else + lt_prog_compiler_pic_GCJ= + lt_prog_compiler_can_build_shared_GCJ=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_GCJ= + ;; + *) + lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" + ;; +esac + +# +# 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_prog_compiler_static_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works_GCJ=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + printf "$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_prog_compiler_static_works_GCJ=yes + fi + else + lt_prog_compiler_static_works_GCJ=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6 + +if test x"$lt_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 + printf "$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\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:__oline__: \$? = $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_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # 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 + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_GCJ=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_GCJ=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_GCJ='-L$libdir' + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=no + enable_shared_with_static_runtimes_GCJ=yes + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_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 + ;; + + interix3*) + 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' + ;; + + linux*) + 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 + archive_cmds_GCJ='$CC -shared'"$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 -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_GCJ=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + 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 + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_GCJ='' + hardcode_direct_GCJ=yes + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_GCJ=yes + else + # We have old collect2 + hardcode_direct_GCJ=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_GCJ=yes + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_libdir_separator_GCJ= + fi + ;; + esac + shared_flag='-shared' + 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_GCJ=' ${wl}-bernotok' + allow_undefined_flag_GCJ=' ${wl}-berok' + # 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' + 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 -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_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}' + 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` $verstring' + 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 $verstring~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* | kfreebsd*-gnu | 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*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + newsos6) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_shlibpath_var_GCJ=no + ;; + + openbsd*) + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + 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 + ;; + + 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 linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + 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*) + 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* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_GCJ + 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" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +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`' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-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='GNU ld.so' + ;; + +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 + ;; + freebsd*) # from 4.6 on + 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' + ;; + +interix3*) + 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*) + 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 + + # find out which ABI we are using + libsuff= + case "$host_cpu" in + x86_64*|s390x*|powerpc64*) + echo '#line __oline__ "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 + case `/usr/bin/file conftest.$ac_objext` in + *64-bit*) + libsuff=64 + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + ;; + esac + fi + rm -rf conftest* + ;; + esac + + # 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/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $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' + ;; + +knetbsd*-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='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${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" + ;; + +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 + +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 \ + archive_cmds_GCJ \ + archive_expsym_cmds_GCJ \ + postinstall_cmds_GCJ \ + postuninstall_cmds_GCJ \ + old_archive_from_expsyms_cmds_GCJ \ + allow_undefined_flag_GCJ \ + no_undefined_flag_GCJ \ + export_symbols_cmds_GCJ \ + hardcode_libdir_flag_spec_GCJ \ + hardcode_libdir_flag_spec_ld_GCJ \ + hardcode_libdir_separator_GCJ \ + hardcode_automatic_GCJ \ + module_cmds_GCJ \ + module_expsym_cmds_GCJ \ + lt_cv_prog_compiler_c_o_GCJ \ + exclude_expsyms_GCJ \ + include_expsyms_GCJ; do + + case $var in + old_archive_cmds_GCJ | \ + old_archive_from_new_cmds_GCJ | \ + archive_cmds_GCJ | \ + archive_expsym_cmds_GCJ | \ + module_cmds_GCJ | \ + module_expsym_cmds_GCJ | \ + old_archive_from_expsyms_cmds_GCJ | \ + export_symbols_cmds_GCJ | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_GCJ + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +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 + +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + +# 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=\`echo $lt_predep_objects_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=\`echo $lt_postdep_objects_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_GCJ + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# 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=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_GCJ" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_GCJ + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_GCJ + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_GCJ + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_GCJ + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + 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 }\n' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# 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 +printf "$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 +printf "$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 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 \ + archive_cmds_RC \ + archive_expsym_cmds_RC \ + postinstall_cmds_RC \ + postuninstall_cmds_RC \ + old_archive_from_expsyms_cmds_RC \ + allow_undefined_flag_RC \ + no_undefined_flag_RC \ + export_symbols_cmds_RC \ + hardcode_libdir_flag_spec_RC \ + hardcode_libdir_flag_spec_ld_RC \ + hardcode_libdir_separator_RC \ + hardcode_automatic_RC \ + module_cmds_RC \ + module_expsym_cmds_RC \ + lt_cv_prog_compiler_c_o_RC \ + exclude_expsyms_RC \ + include_expsyms_RC; do + + case $var in + old_archive_cmds_RC | \ + old_archive_from_new_cmds_RC | \ + archive_cmds_RC | \ + archive_expsym_cmds_RC | \ + module_cmds_RC | \ + module_expsym_cmds_RC | \ + old_archive_from_expsyms_cmds_RC | \ + export_symbols_cmds_RC | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_RC + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +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 + +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + +# 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=\`echo $lt_predep_objects_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=\`echo $lt_postdep_objects_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_RC + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# 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=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_RC" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_RC + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_RC + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_RC + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_RC + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + 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 + + + + + + + + + + + + + + + + + + + + +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +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 + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +# Checks for libraries. + + + + + + + + + + +for ac_header in fcntl.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h math.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +@%:@@%:@ -------------------------------- @%:@@%:@ +@%:@@%:@ Report this to anthmct@yahoo.com @%:@@%:@ +@%:@@%:@ -------------------------------- @%:@@%:@ +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 + + + +# Check whether --with-libpri or --without-libpri was given. +if test "${with_libpri+set}" = set; then + withval="$with_libpri" + libpripath="$withval" +fi; + + + +if test -d "$libpripath" ; then + LIBPRI_TRUE= + LIBPRI_FALSE='#' +else + LIBPRI_TRUE='#' + LIBPRI_FALSE= +fi + + + +# Checks for typedefs, structures, and compiler characteristics. +echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 +if test "${ac_cv_header_time+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include + +int +main () +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_time=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_time=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6 +if test $ac_cv_header_time = yes; then + +cat >>confdefs.h <<\_ACEOF +@%:@define TIME_WITH_SYS_TIME 1 +_ACEOF + +fi + + +# Checks for library functions. + + +for ac_header in sys/select.h sys/socket.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +@%:@@%:@ -------------------------------- @%:@@%:@ +@%:@@%:@ Report this to anthmct@yahoo.com @%:@@%:@ +@%:@@%:@ -------------------------------- @%:@@%:@ +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +echo "$as_me:$LINENO: checking types of arguments for select" >&5 +echo $ECHO_N "checking types of arguments for select... $ECHO_C" >&6 +if test "${ac_cv_func_select_args+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + for ac_arg234 in 'fd_set *' 'int *' 'void *'; do + for ac_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do + for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#if HAVE_SYS_SELECT_H +# include +#endif +#if HAVE_SYS_SOCKET_H +# include +#endif + +int +main () +{ +extern int select ($ac_arg1, + $ac_arg234, $ac_arg234, $ac_arg234, + $ac_arg5); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done + done +done +# Provide a safe default value. +: ${ac_cv_func_select_args='int,int *,struct timeval *'} + +fi +echo "$as_me:$LINENO: result: $ac_cv_func_select_args" >&5 +echo "${ECHO_T}$ac_cv_func_select_args" >&6 +ac_save_IFS=$IFS; IFS=',' +set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'` +IFS=$ac_save_IFS +shift + +cat >>confdefs.h <<_ACEOF +@%:@define SELECT_TYPE_ARG1 $1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define SELECT_TYPE_ARG234 ($2) +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define SELECT_TYPE_ARG5 ($3) +_ACEOF + +rm -f conftest* + + + + + +for ac_func in gettimeofday memset select socket +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 eval "test \"\${$as_ac_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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&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 + + ac_config_files="$ac_config_files Makefile" + +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, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "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 \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!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 "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + 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}' + +# 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 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIB@&t@OBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIB@&t@OBJS=$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 +if test -z "${LIBPRI_TRUE}" && test -z "${LIBPRI_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"LIBPRI\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"LIBPRI\" 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 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+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +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 + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; 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'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# 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 + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + 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 + + ;; + 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_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + 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=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # 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 before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, 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 + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +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 sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +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$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# 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'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX +@%:@@%:@ Running $as_me. @%:@@%:@ +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by libsangoma $as_me 1.0.0, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +libsangoma config.status 1.0.0 +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +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 + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +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 0 ;; + --debug | --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;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +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" ;; + + 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 $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + *) { { 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_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 to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $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 -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# 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 + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CYGPATH_W@,$CYGPATH_W,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@mkdir_p@,$mkdir_p,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@am__leading_dot@,$am__leading_dot,;t t +s,@AMTAR@,$AMTAR,;t t +s,@am__tar@,$am__tar,;t t +s,@am__untar@,$am__untar,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t +s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@SED@,$SED,;t t +s,@EGREP@,$EGREP,;t t +s,@LN_S@,$LN_S,;t t +s,@ECHO@,$ECHO,;t t +s,@AR@,$AR,;t t +s,@ac_ct_AR@,$ac_ct_AR,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@CPP@,$CPP,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@CXXDEPMODE@,$CXXDEPMODE,;t t +s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t +s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t +s,@CXXCPP@,$CXXCPP,;t t +s,@F77@,$F77,;t t +s,@FFLAGS@,$FFLAGS,;t t +s,@ac_ct_F77@,$ac_ct_F77,;t t +s,@LIBTOOL@,$LIBTOOL,;t t +s,@LIBPRI_TRUE@,$LIBPRI_TRUE,;t t +s,@LIBPRI_FALSE@,$LIBPRI_FALSE,;t t +s,@libpripath@,$libpripath,;t t +s,@LIB@&t@OBJS@,$LIB@&t@OBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$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'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$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'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # 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. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +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,@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,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$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'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) 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=`(dirname "$mf") 2>/dev/null || +$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=`(dirname "$file") 2>/dev/null || +$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'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$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'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/api/libsangoma/autom4te.cache/output.1 b/api/libsangoma/autom4te.cache/output.1 new file mode 100644 index 0000000..a949c8a --- /dev/null +++ b/api/libsangoma/autom4te.cache/output.1 @@ -0,0 +1,20506 @@ +@%:@! /bin/sh +@%:@ Guess values for system-dependent variables and create Makefiles. +@%:@ Generated by GNU Autoconf 2.59 for libsangoma 1.0.0. +@%:@ +@%:@ Report bugs to . +@%:@ +@%:@ Copyright (C) 2003 Free Software Foundation, Inc. +@%:@ This configure script is free software; the Free Software Foundation +@%:@ gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +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 + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; 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'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# 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 + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + 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 + + ;; + 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_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + 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=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # 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 before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, 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 + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\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 sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +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$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# 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'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + + +# 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 + +# 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` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='libsangoma' +PACKAGE_TARNAME='libsangoma' +PACKAGE_VERSION='1.0.0' +PACKAGE_STRING='libsangoma 1.0.0' +PACKAGE_BUGREPORT='anthmct@yahoo.com' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar 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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBPRI_TRUE LIBPRI_FALSE libpripath LIB@&t@OBJS LTLIBOBJS' +ac_subst_files='' + +# 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. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_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 | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$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" ;; + + -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'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -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 ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -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 ;; + + -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'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + 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; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + 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 paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +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 + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$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 + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP +ac_env_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS +ac_env_CXXCPP_set=${CXXCPP+set} +ac_env_CXXCPP_value=$CXXCPP +ac_cv_env_CXXCPP_set=${CXXCPP+set} +ac_cv_env_CXXCPP_value=$CXXCPP +ac_env_F77_set=${F77+set} +ac_env_F77_value=$F77 +ac_cv_env_F77_set=${F77+set} +ac_cv_env_F77_value=$F77 +ac_env_FFLAGS_set=${FFLAGS+set} +ac_env_FFLAGS_value=$FFLAGS +ac_cv_env_FFLAGS_set=${FFLAGS+set} +ac_cv_env_FFLAGS_value=$FFLAGS + +# +# 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 libsangoma 1.0.0 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 \`..'] + +_ACEOF + + cat <<_ACEOF +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] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --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] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of libsangoma 1.0.0:";; + esac + 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-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@:>@ + --with-libpri= enable pri support + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ 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. + +Report bugs to . +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style 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 + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +libsangoma configure 1.0.0 +generated by GNU Autoconf 2.59 + +Copyright (C) 2003 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 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by libsangoma $as_me 1.0.0, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +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` +hostinfo = `(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 + +} >&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_sep= +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_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + 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: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +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, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +@%:@@%:@ ----------------- @%:@@%:@ +@%:@@%:@ Output variables. @%:@@%:@ +@%:@@%:@ ----------------- @%:@@%:@ +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +@%:@@%:@ ------------- @%:@@%:@ +@%:@@%:@ Output files. @%:@@%:@ +@%:@@%:@ ------------- @%:@@%:@ +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +@%:@@%:@ ----------- @%:@@%:@ +@%:@@%:@ confdefs.h. @%:@@%:@ +@%:@@%:@ ----------- @%:@@%:@ +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf 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 -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >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 -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$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 `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + +am__api_version="1.9" +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 +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# 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 $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$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 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 $as_executable_p "$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 + +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 dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$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=libsangoma + VERSION=1.0.0 + + +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +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 + + STRIP=$ac_ct_STRIP +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 -' + + + + + +# Checks for programs. +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 $as_executable_p "$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 + +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 $as_executable_p "$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 + +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 + + CC=$ac_ct_CC +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 $as_executable_p "$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 + +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 "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +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 $as_executable_p "$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 + +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 + 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&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[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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 { (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); }; 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 | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + 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 { (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 + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f 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 +CFLAGS="-g" +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 + 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +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 ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=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 -std1 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 -std1. */ +int osf4_cc_array ['\x00' == 0 ? 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 +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +@%:@ifndef __cplusplus + choke me +@%:@endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +@%:@include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +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 or --disable-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 or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + 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 or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + 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 or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + 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; + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_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_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { 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=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_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 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +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 + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +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 egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_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_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$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 recognise dependent libraries" >&5 +echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +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'. + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | kfreebsd*-gnu | 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 + ;; + +interix3*) + # 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*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + 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 + ;; + +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 or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && 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 __oline__ "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|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-*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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + lt_cv_cc_needs_belf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +lt_cv_cc_needs_belf=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +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" ;; + *) LD="${LD-ld} -64" ;; + 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@ifdef __STDC__ +@%:@ include +@%:@else +@%:@ include +@%:@endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f 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 +#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)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +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); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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 eval "test \"\${$as_ac_Header+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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +@%:@@%:@ -------------------------------- @%:@@%:@ +@%:@@%:@ Report this to anthmct@yahoo.com @%:@@%:@ +@%:@@%:@ -------------------------------- @%:@@%:@ +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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=cc +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 -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 $CCC g++ c++ gpp aCC CC cxx cc++ cl 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +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` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f 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 +CXXFLAGS="-g" +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 + 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cxx_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +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 +for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +@%:@include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +ac_ext=cc +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=cc +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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +echo "$as_me:$LINENO: result: $CXXCPP" >&5 +echo "${ECHO_T}$CXXCPP" >&6 +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +@%:@ifdef __STDC__ +@%:@ include +@%:@else +@%:@ include +@%:@endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=cc +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 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran + 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_F77="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + echo "$as_me:$LINENO: result: $F77" >&5 +echo "${ECHO_T}$F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$F77" && break + done +fi +if test -z "$F77"; then + ac_ct_F77=$F77 + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_F77="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 + + F77=$ac_ct_F77 +fi + + +# Provide some information about the compiler. +echo "$as_me:__oline__:" \ + "checking for Fortran 77 compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_f77_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_f77_g=no +fi +rm -f 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 + ;; + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + 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` + ;; + 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*) + 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 -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +if test "${lt_cv_objdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 +echo "${ECHO_T}$lt_cv_objdir" >&6 +objdir=$lt_cv_objdir + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false" +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 + + AR=$ac_ct_AR +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +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 + + RANLIB=$ac_ct_RANLIB +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +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 + + STRIP=$ac_ct_STRIP +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_deplibs' +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 + +enable_dlopen=no +enable_win32_dll=no + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + + +# Check whether --with-pic or --without-pic was given. +if test "${with_pic+set}" = set; then + withval="$with_pic" + pic_mode="$withval" +else + pic_mode=default +fi; +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# 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 +printf "$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 +printf "$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 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 + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{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\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + interix3*) + # 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* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + linux*) + case $cc_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' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + 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_prog_compiler_pic_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{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\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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_prog_compiler_pic_works=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 + +if test x"$lt_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +# +# 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_prog_compiler_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + printf "$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_prog_compiler_static_works=yes + fi + else + lt_prog_compiler_static_works=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 + +if test x"$lt_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + 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\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:__oline__: \$? = $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_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # 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 + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # 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 + ;; + + interix3*) + 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' + ;; + + linux*) + 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 + archive_cmds='$CC -shared'"$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 -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + 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 + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # 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' + 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 -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + 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` $verstring' + 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 $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $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* | kfreebsd*-gnu | 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*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + 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 + ;; + + 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 linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + 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*) + 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* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + 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 + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +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`' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-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='GNU ld.so' + ;; + +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 + ;; + freebsd*) # from 4.6 on + 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' + ;; + +interix3*) + 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*) + 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 + + # find out which ABI we are using + libsuff= + case "$host_cpu" in + x86_64*|s390x*|powerpc64*) + echo '#line __oline__ "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 + case `/usr/bin/file conftest.$ac_objext` in + *64-bit*) + libsuff=64 + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + ;; + esac + fi + rm -rf conftest* + ;; + esac + + # 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/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $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' + ;; + +knetbsd*-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='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${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" + ;; + +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 + +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" + 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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +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 +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +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 +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dld_link (); +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + 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 + ;; + +aix4* | aix5*) + 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 \ + archive_cmds \ + archive_expsym_cmds \ + postinstall_cmds \ + postuninstall_cmds \ + old_archive_from_expsyms_cmds \ + allow_undefined_flag \ + no_undefined_flag \ + export_symbols_cmds \ + hardcode_libdir_flag_spec \ + hardcode_libdir_flag_spec_ld \ + hardcode_libdir_separator \ + hardcode_automatic \ + module_cmds \ + module_expsym_cmds \ + lt_cv_prog_compiler_c_o \ + exclude_expsyms \ + include_expsyms; do + + case $var in + old_archive_cmds | \ + old_archive_from_new_cmds | \ + archive_cmds | \ + archive_expsym_cmds | \ + module_cmds | \ + module_expsym_cmds | \ + old_archive_from_expsyms_cmds | \ + export_symbols_cmds | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + { echo "$as_me:$LINENO: creating $ofile" >&5 +echo "$as_me: creating $ofile" >&6;} + + cat <<__EOF__ >> "$cfgfile" +#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 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 + +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + +# 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=\`echo $lt_predep_objects | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=\`echo $lt_postdep_objects | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# 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=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + 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 or --without-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=cc +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= + +# 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;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# 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 +printf "$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 +printf "$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 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 or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$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 + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_CXX=yes + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + ;; + esac + shared_flag='-shared' + 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + # 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*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; + esac + 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 + + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_CXX='$CC $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 + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + 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` $verstring' + 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 $verstring~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* | kfreebsd*-gnu | 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*) + hardcode_libdir_flag_spec_ld_CXX='+b $libdir' + ;; + *) + 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 + ;; + interix3*) + 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*) + 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*) + # 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' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + ld_shlibs_CXX=no + ;; + openbsd*) + 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' + ;; + 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 C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}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' + 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 + +# PORTME: override above test on systems where it is broken +case $host_os in +interix3*) + # 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= + ;; + +solaris*) + case $cc_basename in + CC*) + # 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. + postdeps_CXX='-lCstd -lCrun' + ;; + 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* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + interix3*) + # 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 + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + 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* | kfreebsd*-gnu | 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*) + 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*) + # 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' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx*) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + 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_prog_compiler_pic_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{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\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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_prog_compiler_pic_works_CXX=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 + +if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +# +# 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_prog_compiler_static_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works_CXX=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + printf "$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_prog_compiler_static_works_CXX=yes + fi + else + lt_prog_compiler_static_works_CXX=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6 + +if test x"$lt_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 + printf "$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\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:__oline__: \$? = $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 + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw*) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + 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" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +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`' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-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='GNU ld.so' + ;; + +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 + ;; + freebsd*) # from 4.6 on + 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' + ;; + +interix3*) + 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*) + 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 + + # find out which ABI we are using + libsuff= + case "$host_cpu" in + x86_64*|s390x*|powerpc64*) + echo '#line __oline__ "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 + case `/usr/bin/file conftest.$ac_objext` in + *64-bit*) + libsuff=64 + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + ;; + esac + fi + rm -rf conftest* + ;; + esac + + # 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/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $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' + ;; + +knetbsd*-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='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${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" + ;; + +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 + +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 \ + archive_cmds_CXX \ + archive_expsym_cmds_CXX \ + postinstall_cmds_CXX \ + postuninstall_cmds_CXX \ + old_archive_from_expsyms_cmds_CXX \ + allow_undefined_flag_CXX \ + no_undefined_flag_CXX \ + export_symbols_cmds_CXX \ + hardcode_libdir_flag_spec_CXX \ + hardcode_libdir_flag_spec_ld_CXX \ + hardcode_libdir_separator_CXX \ + hardcode_automatic_CXX \ + module_cmds_CXX \ + module_expsym_cmds_CXX \ + lt_cv_prog_compiler_c_o_CXX \ + exclude_expsyms_CXX \ + include_expsyms_CXX; do + + case $var in + old_archive_cmds_CXX | \ + old_archive_from_new_cmds_CXX | \ + archive_cmds_CXX | \ + archive_expsym_cmds_CXX | \ + module_cmds_CXX | \ + module_expsym_cmds_CXX | \ + old_archive_from_expsyms_cmds_CXX | \ + export_symbols_cmds_CXX | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +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 + +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + +# 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=\`echo $lt_predep_objects_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=\`echo $lt_postdep_objects_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# 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=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_CXX" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + 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\n return\n end\n" + +# Code to be used in simple link tests +lt_simple_link_test_code=" program t\n end\n" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# 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 +printf "$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 +printf "$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 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 + ;; +aix4* | aix5*) + 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* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_F77='-fno-common' + ;; + + interix3*) + # 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* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_F77='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_F77='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + linux*) + case $cc_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' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_F77='-Wl,' + # All OSF/1 code is PIC. + 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_prog_compiler_pic_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_F77=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_F77" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{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\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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_prog_compiler_pic_works_F77=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 + +if test x"$lt_prog_compiler_pic_works_F77" = xyes; then + case $lt_prog_compiler_pic_F77 in + "" | " "*) ;; + *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; + esac +else + lt_prog_compiler_pic_F77= + lt_prog_compiler_can_build_shared_F77=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_F77= + ;; + *) + lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" + ;; +esac + +# +# 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_prog_compiler_static_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works_F77=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + printf "$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_prog_compiler_static_works_F77=yes + fi + else + lt_prog_compiler_static_works_F77=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6 + +if test x"$lt_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 + printf "$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\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:__oline__: \$? = $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_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # 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 + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_F77=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_F77=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_F77='-L$libdir' + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=no + enable_shared_with_static_runtimes_F77=yes + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_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 + ;; + + interix3*) + 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' + ;; + + linux*) + 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 + archive_cmds_F77='$CC -shared'"$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 -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_F77=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + 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 + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_F77='' + hardcode_direct_F77=yes + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_F77=yes + else + # We have old collect2 + hardcode_direct_F77=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_F77=yes + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_libdir_separator_F77= + fi + ;; + esac + shared_flag='-shared' + 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_F77=' ${wl}-bernotok' + allow_undefined_flag_F77=' ${wl}-berok' + # 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' + 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 -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_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}' + 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` $verstring' + 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 $verstring~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* | kfreebsd*-gnu | 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*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + newsos6) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_shlibpath_var_F77=no + ;; + + openbsd*) + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + 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 + ;; + + 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 linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + 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*) + 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* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_F77 + 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" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +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`' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-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='GNU ld.so' + ;; + +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 + ;; + freebsd*) # from 4.6 on + 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' + ;; + +interix3*) + 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*) + 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 + + # find out which ABI we are using + libsuff= + case "$host_cpu" in + x86_64*|s390x*|powerpc64*) + echo '#line __oline__ "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 + case `/usr/bin/file conftest.$ac_objext` in + *64-bit*) + libsuff=64 + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + ;; + esac + fi + rm -rf conftest* + ;; + esac + + # 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/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $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' + ;; + +knetbsd*-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='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${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" + ;; + +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 + +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 \ + archive_cmds_F77 \ + archive_expsym_cmds_F77 \ + postinstall_cmds_F77 \ + postuninstall_cmds_F77 \ + old_archive_from_expsyms_cmds_F77 \ + allow_undefined_flag_F77 \ + no_undefined_flag_F77 \ + export_symbols_cmds_F77 \ + hardcode_libdir_flag_spec_F77 \ + hardcode_libdir_flag_spec_ld_F77 \ + hardcode_libdir_separator_F77 \ + hardcode_automatic_F77 \ + module_cmds_F77 \ + module_expsym_cmds_F77 \ + lt_cv_prog_compiler_c_o_F77 \ + exclude_expsyms_F77 \ + include_expsyms_F77; do + + case $var in + old_archive_cmds_F77 | \ + old_archive_from_new_cmds_F77 | \ + archive_cmds_F77 | \ + archive_expsym_cmds_F77 | \ + module_cmds_F77 | \ + module_expsym_cmds_F77 | \ + old_archive_from_expsyms_cmds_F77 | \ + export_symbols_cmds_F77 | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_F77 + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +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 + +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + +# 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=\`echo $lt_predep_objects_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=\`echo $lt_postdep_objects_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_F77 + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# 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=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_F77" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_F77 + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_F77 + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_F77 + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_F77 + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + 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 {}\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# 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 +printf "$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 +printf "$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 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 + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{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\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_GCJ='-fno-common' + ;; + + interix3*) + # 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* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + linux*) + case $cc_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' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All OSF/1 code is PIC. + 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_prog_compiler_pic_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_GCJ=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_GCJ" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{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\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:__oline__: \$? = $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_prog_compiler_pic_works_GCJ=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 + +if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then + case $lt_prog_compiler_pic_GCJ in + "" | " "*) ;; + *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; + esac +else + lt_prog_compiler_pic_GCJ= + lt_prog_compiler_can_build_shared_GCJ=no +fi + +fi +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_GCJ= + ;; + *) + lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" + ;; +esac + +# +# 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_prog_compiler_static_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works_GCJ=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + printf "$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_prog_compiler_static_works_GCJ=yes + fi + else + lt_prog_compiler_static_works_GCJ=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6 + +if test x"$lt_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 + printf "$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\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:__oline__: \$? = $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_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # 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 + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_GCJ=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_GCJ=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_GCJ='-L$libdir' + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=no + enable_shared_with_static_runtimes_GCJ=yes + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_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 + ;; + + interix3*) + 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' + ;; + + linux*) + 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 + archive_cmds_GCJ='$CC -shared'"$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 -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_GCJ=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + 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 + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_GCJ='' + hardcode_direct_GCJ=yes + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_GCJ=yes + else + # We have old collect2 + hardcode_direct_GCJ=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_GCJ=yes + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_libdir_separator_GCJ= + fi + ;; + esac + shared_flag='-shared' + 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_GCJ=' ${wl}-bernotok' + allow_undefined_flag_GCJ=' ${wl}-berok' + # 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' + 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 -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_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}' + 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` $verstring' + 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 $verstring~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* | kfreebsd*-gnu | 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*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + newsos6) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_shlibpath_var_GCJ=no + ;; + + openbsd*) + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + 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 + ;; + + 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 linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + 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*) + 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* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_GCJ + 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" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +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`' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-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='GNU ld.so' + ;; + +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 + ;; + freebsd*) # from 4.6 on + 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' + ;; + +interix3*) + 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*) + 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 + + # find out which ABI we are using + libsuff= + case "$host_cpu" in + x86_64*|s390x*|powerpc64*) + echo '#line __oline__ "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 + case `/usr/bin/file conftest.$ac_objext` in + *64-bit*) + libsuff=64 + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + ;; + esac + fi + rm -rf conftest* + ;; + esac + + # 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/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $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' + ;; + +knetbsd*-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='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${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" + ;; + +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 + +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 \ + archive_cmds_GCJ \ + archive_expsym_cmds_GCJ \ + postinstall_cmds_GCJ \ + postuninstall_cmds_GCJ \ + old_archive_from_expsyms_cmds_GCJ \ + allow_undefined_flag_GCJ \ + no_undefined_flag_GCJ \ + export_symbols_cmds_GCJ \ + hardcode_libdir_flag_spec_GCJ \ + hardcode_libdir_flag_spec_ld_GCJ \ + hardcode_libdir_separator_GCJ \ + hardcode_automatic_GCJ \ + module_cmds_GCJ \ + module_expsym_cmds_GCJ \ + lt_cv_prog_compiler_c_o_GCJ \ + exclude_expsyms_GCJ \ + include_expsyms_GCJ; do + + case $var in + old_archive_cmds_GCJ | \ + old_archive_from_new_cmds_GCJ | \ + archive_cmds_GCJ | \ + archive_expsym_cmds_GCJ | \ + module_cmds_GCJ | \ + module_expsym_cmds_GCJ | \ + old_archive_from_expsyms_cmds_GCJ | \ + export_symbols_cmds_GCJ | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_GCJ + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +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 + +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + +# 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=\`echo $lt_predep_objects_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=\`echo $lt_postdep_objects_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_GCJ + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# 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=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_GCJ" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_GCJ + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_GCJ + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_GCJ + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_GCJ + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + 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 }\n' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# 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 +printf "$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 +printf "$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 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 \ + archive_cmds_RC \ + archive_expsym_cmds_RC \ + postinstall_cmds_RC \ + postuninstall_cmds_RC \ + old_archive_from_expsyms_cmds_RC \ + allow_undefined_flag_RC \ + no_undefined_flag_RC \ + export_symbols_cmds_RC \ + hardcode_libdir_flag_spec_RC \ + hardcode_libdir_flag_spec_ld_RC \ + hardcode_libdir_separator_RC \ + hardcode_automatic_RC \ + module_cmds_RC \ + module_expsym_cmds_RC \ + lt_cv_prog_compiler_c_o_RC \ + exclude_expsyms_RC \ + include_expsyms_RC; do + + case $var in + old_archive_cmds_RC | \ + old_archive_from_new_cmds_RC | \ + archive_cmds_RC | \ + archive_expsym_cmds_RC | \ + module_cmds_RC | \ + module_expsym_cmds_RC | \ + old_archive_from_expsyms_cmds_RC | \ + export_symbols_cmds_RC | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_RC + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host +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 + +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + +# 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=\`echo $lt_predep_objects_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=\`echo $lt_postdep_objects_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_RC + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# 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=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_RC" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_RC + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_RC + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_RC + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_RC + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + 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 + + + + + + + + + + + + + + + + + + + + +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +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 + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +# Checks for libraries. + + + + + + + + + + +for ac_header in fcntl.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h math.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +@%:@@%:@ -------------------------------- @%:@@%:@ +@%:@@%:@ Report this to anthmct@yahoo.com @%:@@%:@ +@%:@@%:@ -------------------------------- @%:@@%:@ +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 + + + +# Check whether --with-libpri or --without-libpri was given. +if test "${with_libpri+set}" = set; then + withval="$with_libpri" + libpripath="$withval" +fi; + + + +if test -d "$libpripath" ; then + LIBPRI_TRUE= + LIBPRI_FALSE='#' +else + LIBPRI_TRUE='#' + LIBPRI_FALSE= +fi + + + +# Checks for typedefs, structures, and compiler characteristics. +echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 +if test "${ac_cv_header_time+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include + +int +main () +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_time=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_time=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6 +if test $ac_cv_header_time = yes; then + +cat >>confdefs.h <<\_ACEOF +@%:@define TIME_WITH_SYS_TIME 1 +_ACEOF + +fi + + +# Checks for library functions. + + +for ac_header in sys/select.h sys/socket.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f 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 { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +@%:@@%:@ -------------------------------- @%:@@%:@ +@%:@@%:@ Report this to anthmct@yahoo.com @%:@@%:@ +@%:@@%:@ -------------------------------- @%:@@%:@ +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +@%:@define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +echo "$as_me:$LINENO: checking types of arguments for select" >&5 +echo $ECHO_N "checking types of arguments for select... $ECHO_C" >&6 +if test "${ac_cv_func_select_args+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + for ac_arg234 in 'fd_set *' 'int *' 'void *'; do + for ac_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do + for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#if HAVE_SYS_SELECT_H +# include +#endif +#if HAVE_SYS_SOCKET_H +# include +#endif + +int +main () +{ +extern int select ($ac_arg1, + $ac_arg234, $ac_arg234, $ac_arg234, + $ac_arg5); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done + done +done +# Provide a safe default value. +: ${ac_cv_func_select_args='int,int *,struct timeval *'} + +fi +echo "$as_me:$LINENO: result: $ac_cv_func_select_args" >&5 +echo "${ECHO_T}$ac_cv_func_select_args" >&6 +ac_save_IFS=$IFS; IFS=',' +set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'` +IFS=$ac_save_IFS +shift + +cat >>confdefs.h <<_ACEOF +@%:@define SELECT_TYPE_ARG1 $1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define SELECT_TYPE_ARG234 ($2) +_ACEOF + + +cat >>confdefs.h <<_ACEOF +@%:@define SELECT_TYPE_ARG5 ($3) +_ACEOF + +rm -f conftest* + + + + + +for ac_func in gettimeofday memset select socket +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 eval "test \"\${$as_ac_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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&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 + + ac_config_files="$ac_config_files Makefile" + +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, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "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 \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!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 "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + 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}' + +# 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 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIB@&t@OBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIB@&t@OBJS=$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 +if test -z "${LIBPRI_TRUE}" && test -z "${LIBPRI_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"LIBPRI\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"LIBPRI\" 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 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+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +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 + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; 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'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# 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 + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + 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 + + ;; + 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_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + 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=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # 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 before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, 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 + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +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 sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +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$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# 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'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX +@%:@@%:@ Running $as_me. @%:@@%:@ +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by libsangoma $as_me 1.0.0, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +libsangoma config.status 1.0.0 +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +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 + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +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 0 ;; + --debug | --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;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +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" ;; + + 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 $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + *) { { 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_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 to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $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 -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# 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 + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CYGPATH_W@,$CYGPATH_W,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@mkdir_p@,$mkdir_p,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@am__leading_dot@,$am__leading_dot,;t t +s,@AMTAR@,$AMTAR,;t t +s,@am__tar@,$am__tar,;t t +s,@am__untar@,$am__untar,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t +s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@SED@,$SED,;t t +s,@EGREP@,$EGREP,;t t +s,@LN_S@,$LN_S,;t t +s,@ECHO@,$ECHO,;t t +s,@AR@,$AR,;t t +s,@ac_ct_AR@,$ac_ct_AR,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@CPP@,$CPP,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@CXXDEPMODE@,$CXXDEPMODE,;t t +s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t +s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t +s,@CXXCPP@,$CXXCPP,;t t +s,@F77@,$F77,;t t +s,@FFLAGS@,$FFLAGS,;t t +s,@ac_ct_F77@,$ac_ct_F77,;t t +s,@LIBTOOL@,$LIBTOOL,;t t +s,@LIBPRI_TRUE@,$LIBPRI_TRUE,;t t +s,@LIBPRI_FALSE@,$LIBPRI_FALSE,;t t +s,@libpripath@,$libpripath,;t t +s,@LIB@&t@OBJS@,$LIB@&t@OBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$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'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$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'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # 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. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +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,@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,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$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'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) 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=`(dirname "$mf") 2>/dev/null || +$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=`(dirname "$file") 2>/dev/null || +$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'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$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'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/api/libsangoma/autom4te.cache/requests b/api/libsangoma/autom4te.cache/requests new file mode 100644 index 0000000..12a5597 --- /dev/null +++ b/api/libsangoma/autom4te.cache/requests @@ -0,0 +1,350 @@ +# This file was generated. +# It contains the lists of macros which have been traced. +# It can be safely removed. + +@request = ( + bless( [ + '0', + 1, + [ + '/usr/share/autoconf' + ], + [ + '/usr/share/autoconf/autoconf/autoconf.m4f', + '/usr/share/aclocal/libtool.m4', + '/usr/share/aclocal-1.9/amversion.m4', + '/usr/share/aclocal-1.9/auxdir.m4', + '/usr/share/aclocal-1.9/cond.m4', + '/usr/share/aclocal-1.9/depend.m4', + '/usr/share/aclocal-1.9/depout.m4', + '/usr/share/aclocal-1.9/init.m4', + '/usr/share/aclocal-1.9/install-sh.m4', + '/usr/share/aclocal-1.9/lead-dot.m4', + '/usr/share/aclocal-1.9/make.m4', + '/usr/share/aclocal-1.9/missing.m4', + '/usr/share/aclocal-1.9/mkdirp.m4', + '/usr/share/aclocal-1.9/options.m4', + '/usr/share/aclocal-1.9/runlog.m4', + '/usr/share/aclocal-1.9/sanity.m4', + '/usr/share/aclocal-1.9/strip.m4', + '/usr/share/aclocal-1.9/tar.m4', + 'configure.in' + ], + { + 'AM_ENABLE_STATIC' => 1, + 'AC_LIBTOOL_LANG_RC_CONFIG' => 1, + 'AC_TYPE_OFF_T' => 1, + 'AC_C_VOLATILE' => 1, + 'AC_FUNC_CLOSEDIR_VOID' => 1, + '_LT_AC_SHELL_INIT' => 1, + 'AC_REPLACE_FNMATCH' => 1, + 'AC_DEFUN' => 1, + '_LT_AC_LANG_CXX_CONFIG' => 1, + 'AC_PROG_LIBTOOL' => 1, + 'AC_FUNC_STAT' => 1, + 'AM_PROG_MKDIR_P' => 1, + 'AC_FUNC_WAIT3' => 1, + 'AC_STRUCT_TM' => 1, + 'AC_FUNC_LSTAT' => 1, + 'AM_AUTOMAKE_VERSION' => 1, + 'AC_FUNC_STRTOD' => 1, + 'AC_CHECK_HEADERS' => 1, + 'AM_MISSING_PROG' => 1, + 'AC_FUNC_STRNLEN' => 1, + 'AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH' => 1, + 'AC_PROG_CXX' => 1, + '_LT_AC_LANG_C_CONFIG' => 1, + 'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1, + 'AM_PROG_INSTALL_STRIP' => 1, + 'AC_PROG_AWK' => 1, + '_m4_warn' => 1, + 'AC_LIBTOOL_OBJDIR' => 1, + 'AC_HEADER_MAJOR' => 1, + 'AM_SANITY_CHECK' => 1, + 'AC_LIBTOOL_PROG_COMPILER_PIC' => 1, + 'AC_LIBTOOL_LANG_GCJ_CONFIG' => 1, + '_LT_AC_CHECK_DLFCN' => 1, + 'AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE' => 1, + '_AM_PROG_TAR' => 1, + 'AC_LIBTOOL_GCJ' => 1, + 'AC_PROG_GCC_TRADITIONAL' => 1, + 'AC_LIBSOURCE' => 1, + 'AC_STRUCT_ST_BLOCKS' => 1, + 'AC_LIBTOOL_CONFIG' => 1, + '_LT_AC_LANG_F77' => 1, + 'AC_CONFIG_AUX_DIR' => 1, + 'AC_PROG_MAKE_SET' => 1, + 'sinclude' => 1, + 'AM_DISABLE_SHARED' => 1, + 'AM_PROG_LIBTOOL' => 1, + '_LT_AC_LANG_CXX' => 1, + 'AM_PROG_LD' => 1, + '_LT_AC_FILE_LTDLL_C' => 1, + 'AC_FUNC_STRERROR_R' => 1, + 'AC_FUNC_FORK' => 1, + 'AC_DECL_SYS_SIGLIST' => 1, + 'AC_FUNC_VPRINTF' => 1, + 'AU_DEFUN' => 1, + 'AC_PROG_NM' => 1, + 'AC_LIBTOOL_DLOPEN' => 1, + 'AC_PROG_LD' => 1, + 'AC_PROG_LD_GNU' => 1, + 'AC_ENABLE_FAST_INSTALL' => 1, + 'AC_INIT' => 1, + 'AC_STRUCT_TIMEZONE' => 1, + 'AC_SUBST' => 1, + 'AC_FUNC_ALLOCA' => 1, + '_AM_SET_OPTION' => 1, + 'AC_CANONICAL_HOST' => 1, + '_LT_LINKER_BOILERPLATE' => 1, + 'AC_PROG_RANLIB' => 1, + 'AC_LIBTOOL_LANG_CXX_CONFIG' => 1, + 'AC_LIBTOOL_PROG_CC_C_O' => 1, + 'AC_FUNC_SETPGRP' => 1, + 'AC_CONFIG_SUBDIRS' => 1, + 'AC_FUNC_MMAP' => 1, + 'AC_TYPE_SIZE_T' => 1, + 'AC_CHECK_TYPES' => 1, + 'AM_OUTPUT_DEPENDENCY_COMMANDS' => 1, + 'AC_CHECK_MEMBERS' => 1, + 'AC_DEFUN_ONCE' => 1, + 'AC_FUNC_UTIME_NULL' => 1, + 'AC_FUNC_SELECT_ARGTYPES' => 1, + '_LT_AC_LANG_GCJ' => 1, + 'AC_HEADER_STAT' => 1, + 'AC_FUNC_STRFTIME' => 1, + 'AC_C_INLINE' => 1, + 'AC_LIBTOOL_RC' => 1, + 'AC_DISABLE_FAST_INSTALL' => 1, + '_LT_AC_PROG_ECHO_BACKSLASH' => 1, + 'AC_CONFIG_FILES' => 1, + 'include' => 1, + '_LT_AC_SYS_LIBPATH_AIX' => 1, + '_LT_AC_TRY_DLOPEN_SELF' => 1, + 'LT_AC_PROG_SED' => 1, + 'AM_ENABLE_SHARED' => 1, + 'AM_GNU_GETTEXT' => 1, + '_LT_AC_LANG_GCJ_CONFIG' => 1, + 'AC_FUNC_OBSTACK' => 1, + 'AC_CHECK_LIB' => 1, + 'AC_ENABLE_SHARED' => 1, + 'AC_FUNC_MALLOC' => 1, + 'AC_FUNC_GETGROUPS' => 1, + 'AC_FUNC_GETLOADAVG' => 1, + 'AC_FUNC_FSEEKO' => 1, + 'AC_ENABLE_STATIC' => 1, + 'AC_LIBTOOL_SYS_HARD_LINK_LOCKS' => 1, + 'AM_PROG_CC_C_O' => 1, + '_LT_AC_TAGVAR' => 1, + 'AC_LIBTOOL_LANG_F77_CONFIG' => 1, + 'AC_FUNC_MKTIME' => 1, + 'AM_CONDITIONAL' => 1, + 'AC_HEADER_SYS_WAIT' => 1, + 'AC_PROG_LN_S' => 1, + 'AC_FUNC_MEMCMP' => 1, + 'm4_include' => 1, + 'AM_PROG_INSTALL_SH' => 1, + 'AC_HEADER_DIRENT' => 1, + 'AC_PROG_EGREP' => 1, + '_AC_AM_CONFIG_HEADER_HOOK' => 1, + 'AC_PATH_MAGIC' => 1, + 'AM_MAKE_INCLUDE' => 1, + '_LT_AC_TAGCONFIG' => 1, + 'm4_pattern_forbid' => 1, + 'AC_CONFIG_LIBOBJ_DIR' => 1, + 'AC_LIBTOOL_COMPILER_OPTION' => 1, + 'AC_DISABLE_SHARED' => 1, + '_LT_COMPILER_BOILERPLATE' => 1, + 'AC_LIBTOOL_SETUP' => 1, + 'AC_LIBTOOL_WIN32_DLL' => 1, + 'AC_PROG_LD_RELOAD_FLAG' => 1, + 'AC_HEADER_TIME' => 1, + 'AC_TYPE_MODE_T' => 1, + 'AC_FUNC_GETMNTENT' => 1, + 'AM_MISSING_HAS_RUN' => 1, + 'm4_sinclude' => 1, + 'AC_LIBTOOL_DLOPEN_SELF' => 1, + 'AC_PATH_X' => 1, + 'AC_LIBTOOL_PROG_LD_SHLIBS' => 1, + 'AC_HEADER_STDC' => 1, + 'AC_LIBTOOL_LINKER_OPTION' => 1, + 'AC_LIBTOOL_CXX' => 1, + 'LT_AC_PROG_RC' => 1, + 'LT_AC_PROG_GCJ' => 1, + 'AC_FUNC_ERROR_AT_LINE' => 1, + 'AM_DEP_TRACK' => 1, + '_LT_AC_PROG_CXXCPP' => 1, + 'AM_DISABLE_STATIC' => 1, + 'AC_FUNC_MBRTOWC' => 1, + '_AC_PROG_LIBTOOL' => 1, + 'AC_TYPE_SIGNAL' => 1, + 'AC_TYPE_UID_T' => 1, + '_AM_IF_OPTION' => 1, + 'AC_PATH_TOOL_PREFIX' => 1, + 'AC_LIBTOOL_F77' => 1, + 'm4_pattern_allow' => 1, + 'AM_SET_LEADING_DOT' => 1, + 'AC_DEFINE_TRACE_LITERAL' => 1, + '_AM_DEPENDENCIES' => 1, + 'AC_LIBTOOL_LANG_C_CONFIG' => 1, + 'AC_PROG_CC' => 1, + '_LT_AC_SYS_COMPILER' => 1, + 'AM_PROG_NM' => 1, + 'AC_FUNC_STRCOLL' => 1, + 'AC_PROG_YACC' => 1, + 'AC_LIBLTDL_CONVENIENCE' => 1, + 'AC_DEPLIBS_CHECK_METHOD' => 1, + 'AM_SET_CURRENT_AUTOMAKE_VERSION' => 1, + 'AC_LIBLTDL_INSTALLABLE' => 1, + 'AC_FUNC_CHOWN' => 1, + 'AC_LIBTOOL_SYS_DYNAMIC_LINKER' => 1, + 'AC_FUNC_GETPGRP' => 1, + 'AM_INIT_AUTOMAKE' => 1, + 'AC_FUNC_REALLOC' => 1, + 'AC_DISABLE_STATIC' => 1, + 'AC_CONFIG_LINKS' => 1, + 'AM_MAINTAINER_MODE' => 1, + '_LT_AC_LOCK' => 1, + '_LT_AC_LANG_RC_CONFIG' => 1, + 'AC_PROG_CPP' => 1, + 'AC_TYPE_PID_T' => 1, + 'AC_PROG_LEX' => 1, + 'AC_C_CONST' => 1, + 'AC_LIBTOOL_POSTDEP_PREDEP' => 1, + 'AC_FUNC_SETVBUF_REVERSED' => 1, + 'AC_PROG_INSTALL' => 1, + 'AM_AUX_DIR_EXPAND' => 1, + 'AC_LIBTOOL_PROG_COMPILER_NO_RTTI' => 1, + '_LT_AC_LANG_F77_CONFIG' => 1, + '_AM_SET_OPTIONS' => 1, + 'AM_RUN_LOG' => 1, + '_AM_OUTPUT_DEPENDENCY_COMMANDS' => 1, + 'AC_LIBTOOL_PICMODE' => 1, + 'AH_OUTPUT' => 1, + 'AC_CHECK_LIBM' => 1, + 'AC_LIBTOOL_SYS_LIB_STRIP' => 1, + '_AM_MANGLE_OPTION' => 1, + 'AC_CANONICAL_SYSTEM' => 1, + 'AC_CONFIG_HEADERS' => 1, + 'AC_LIBTOOL_SYS_MAX_CMD_LEN' => 1, + 'AM_SET_DEPDIR' => 1, + '_LT_CC_BASENAME' => 1, + 'AC_CHECK_FUNCS' => 1 + } + ], 'Autom4te::Request' ), + bless( [ + '1', + 1, + [ + '/usr/share/autoconf' + ], + [ + '/usr/share/autoconf/autoconf/autoconf.m4f', + 'aclocal.m4', + 'configure.in' + ], + { + '_LT_AC_TAGCONFIG' => 1, + 'm4_pattern_forbid' => 1, + 'AC_CANONICAL_TARGET' => 1, + 'AC_CONFIG_LIBOBJ_DIR' => 1, + 'AC_C_VOLATILE' => 1, + 'AC_TYPE_OFF_T' => 1, + 'AC_FUNC_CLOSEDIR_VOID' => 1, + 'AC_REPLACE_FNMATCH' => 1, + 'AC_PROG_LIBTOOL' => 1, + 'AC_FUNC_STAT' => 1, + 'AC_FUNC_WAIT3' => 1, + 'AC_HEADER_TIME' => 1, + 'AM_AUTOMAKE_VERSION' => 1, + 'AC_FUNC_LSTAT' => 1, + 'AC_STRUCT_TM' => 1, + 'AC_FUNC_GETMNTENT' => 1, + 'AC_TYPE_MODE_T' => 1, + 'AC_CHECK_HEADERS' => 1, + 'AC_FUNC_STRTOD' => 1, + 'AC_FUNC_STRNLEN' => 1, + 'm4_sinclude' => 1, + 'AC_PROG_CXX' => 1, + 'AC_PATH_X' => 1, + 'AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK' => 1, + 'AC_PROG_AWK' => 1, + '_m4_warn' => 1, + 'AC_HEADER_STDC' => 1, + 'AC_HEADER_MAJOR' => 1, + 'AC_FUNC_ERROR_AT_LINE' => 1, + 'AC_PROG_GCC_TRADITIONAL' => 1, + 'AC_LIBSOURCE' => 1, + 'AC_FUNC_MBRTOWC' => 1, + 'AC_STRUCT_ST_BLOCKS' => 1, + 'AC_CANONICAL_BUILD' => 1, + 'AC_TYPE_SIGNAL' => 1, + 'AC_TYPE_UID_T' => 1, + 'AC_CONFIG_AUX_DIR' => 1, + 'AC_PROG_MAKE_SET' => 1, + 'm4_pattern_allow' => 1, + 'sinclude' => 1, + 'AC_DEFINE_TRACE_LITERAL' => 1, + 'AC_FUNC_STRERROR_R' => 1, + 'AC_PROG_CC' => 1, + 'AC_DECL_SYS_SIGLIST' => 1, + 'AC_FUNC_FORK' => 1, + 'AC_FUNC_STRCOLL' => 1, + 'AC_FUNC_VPRINTF' => 1, + 'AC_PROG_YACC' => 1, + 'AC_STRUCT_TIMEZONE' => 1, + 'AC_INIT' => 1, + 'AC_FUNC_CHOWN' => 1, + 'AC_SUBST' => 1, + 'AC_FUNC_ALLOCA' => 1, + 'AC_CANONICAL_HOST' => 1, + 'AC_FUNC_GETPGRP' => 1, + 'AC_PROG_RANLIB' => 1, + 'AM_INIT_AUTOMAKE' => 1, + 'AC_FUNC_SETPGRP' => 1, + 'AC_CONFIG_SUBDIRS' => 1, + 'AC_FUNC_MMAP' => 1, + 'AC_FUNC_REALLOC' => 1, + 'AC_TYPE_SIZE_T' => 1, + 'AC_CONFIG_LINKS' => 1, + 'AC_CHECK_TYPES' => 1, + 'LT_SUPPORTED_TAG' => 1, + 'AC_CHECK_MEMBERS' => 1, + 'AM_MAINTAINER_MODE' => 1, + 'AC_FUNC_UTIME_NULL' => 1, + 'AC_FUNC_SELECT_ARGTYPES' => 1, + 'AC_FUNC_STRFTIME' => 1, + 'AC_HEADER_STAT' => 1, + 'AC_C_INLINE' => 1, + 'AC_PROG_CPP' => 1, + 'AM_ENABLE_MULTILIB' => 1, + 'AC_C_CONST' => 1, + 'AC_PROG_LEX' => 1, + 'AC_TYPE_PID_T' => 1, + 'AC_CONFIG_FILES' => 1, + 'include' => 1, + 'AC_FUNC_SETVBUF_REVERSED' => 1, + 'AC_PROG_INSTALL' => 1, + 'AM_GNU_GETTEXT' => 1, + 'AC_FUNC_OBSTACK' => 1, + 'AC_CHECK_LIB' => 1, + 'AC_FUNC_MALLOC' => 1, + 'AC_FUNC_GETGROUPS' => 1, + 'AC_FUNC_GETLOADAVG' => 1, + 'AH_OUTPUT' => 1, + 'AC_FUNC_FSEEKO' => 1, + 'AM_PROG_CC_C_O' => 1, + 'AC_FUNC_MKTIME' => 1, + 'AM_CONDITIONAL' => 1, + 'AC_CANONICAL_SYSTEM' => 1, + 'AC_CONFIG_HEADERS' => 1, + 'AC_HEADER_SYS_WAIT' => 1, + 'AC_FUNC_MEMCMP' => 1, + 'AC_PROG_LN_S' => 1, + 'm4_include' => 1, + 'AC_HEADER_DIRENT' => 1, + 'AC_CHECK_FUNCS' => 1 + } + ], 'Autom4te::Request' ) + ); + diff --git a/api/libsangoma/autom4te.cache/traces.0 b/api/libsangoma/autom4te.cache/traces.0 new file mode 100644 index 0000000..9ead66f --- /dev/null +++ b/api/libsangoma/autom4te.cache/traces.0 @@ -0,0 +1,9212 @@ +m4trace:/usr/share/aclocal/libtool.m4:55: -1- 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 AM_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or AM_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])])])]) +])]) +m4trace:/usr/share/aclocal/libtool.m4:75: -1- 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], []) +]) +m4trace:/usr/share/aclocal/libtool.m4:220: -1- 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_deplibs' +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 + +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 +]) +m4trace:/usr/share/aclocal/libtool.m4:236: -1- 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 +]) +m4trace:/usr/share/aclocal/libtool.m4:252: -1- 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-%%"` +]) +m4trace:/usr/share/aclocal/libtool.m4:265: -1- AC_DEFUN([_LT_COMPILER_BOILERPLATE], [ac_outfile=conftest.$ac_objext +printf "$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* +]) +m4trace:/usr/share/aclocal/libtool.m4:278: -1- AC_DEFUN([_LT_LINKER_BOILERPLATE], [ac_outfile=conftest.$ac_objext +printf "$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 conftest* +]) +m4trace:/usr/share/aclocal/libtool.m4:297: -1- AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], [AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +]) +m4trace:/usr/share/aclocal/libtool.m4:308: -1- AC_DEFUN([_LT_AC_SHELL_INIT], [ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +]) +m4trace:/usr/share/aclocal/libtool.m4:464: -1- 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) +])]) +m4trace:/usr/share/aclocal/libtool.m4:608: -1- AC_DEFUN([_LT_AC_LOCK], [AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|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-*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" ;; + *) LD="${LD-ld} -64" ;; + 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" + +]) +m4trace:/usr/share/aclocal/libtool.m4:653: -1- 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]) + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{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 +]) +m4trace:/usr/share/aclocal/libtool.m4:690: -1- AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The 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 conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +]) +m4trace:/usr/share/aclocal/libtool.m4:805: -1- 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 + ;; + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + 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` + ;; + 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 +]) +m4trace:/usr/share/aclocal/libtool.m4:812: -1- AC_DEFUN([_LT_AC_CHECK_DLFCN], [AC_CHECK_HEADERS(dlfcn.h)dnl +]) +m4trace:/usr/share/aclocal/libtool.m4:903: -1- 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* +]) +m4trace:/usr/share/aclocal/libtool.m4:1016: -1- AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + 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 +]) +m4trace:/usr/share/aclocal/libtool.m4:1067: -1- AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], [AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + 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* +]) +]) +m4trace:/usr/share/aclocal/libtool.m4:1094: -1- 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 +]) +m4trace:/usr/share/aclocal/libtool.m4:1111: -1- 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 +]) +m4trace:/usr/share/aclocal/libtool.m4:1152: -1- 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 +]) +m4trace:/usr/share/aclocal/libtool.m4:1181: -1- AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], [striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) +fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +]) +m4trace:/usr/share/aclocal/libtool.m4:1799: -1- AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [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" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +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`' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-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='GNU ld.so' + ;; + +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 + ;; + freebsd*) # from 4.6 on + 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' + ;; + +interix3*) + 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*) + 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 + + # find out which ABI we are using + libsuff= + case "$host_cpu" in + x86_64*|s390x*|powerpc64*) + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *64-bit*) + libsuff=64 + sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}" + ;; + esac + fi + rm -rf conftest* + ;; + esac + + # 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/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $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' + ;; + +knetbsd*-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='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${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" + ;; + +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 + +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 +]) +m4trace:/usr/share/aclocal/libtool.m4:1903: -1- AC_DEFUN([_LT_AC_TAGCONFIG], [AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + 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 +]) +m4trace:/usr/share/aclocal/libtool.m4:1911: -1- AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +]) +m4trace:/usr/share/aclocal/libtool.m4:1919: -1- AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) +]) +m4trace:/usr/share/aclocal/libtool.m4:1949: -1- 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) +]) +m4trace:/usr/share/aclocal/libtool.m4:1958: -1- AC_DEFUN([AC_DISABLE_SHARED], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no) +]) +m4trace:/usr/share/aclocal/libtool.m4:1988: -1- 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) +]) +m4trace:/usr/share/aclocal/libtool.m4:1997: -1- AC_DEFUN([AC_DISABLE_STATIC], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no) +]) +m4trace:/usr/share/aclocal/libtool.m4:2027: -1- 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) +]) +m4trace:/usr/share/aclocal/libtool.m4:2036: -1- AC_DEFUN([AC_DISABLE_FAST_INSTALL], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no) +]) +m4trace:/usr/share/aclocal/libtool.m4:2046: -1- AC_DEFUN([AC_LIBTOOL_PICMODE], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default) +]) +m4trace:/usr/share/aclocal/libtool.m4:2124: -1- 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 +]) +m4trace:/usr/share/aclocal/libtool.m4:2139: -1- 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 +]) +m4trace:/usr/share/aclocal/libtool.m4:2224: -1- 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; 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 + ;; + +interix3*) + # 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*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + 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 + ;; + +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 +]) +m4trace:/usr/share/aclocal/libtool.m4:2503: -1- 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" +]) +m4trace:/usr/share/aclocal/libtool.m4:2524: -1- 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 +]) +m4trace:/usr/share/aclocal/libtool.m4:2549: -1- 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" +]) +m4trace:/usr/share/aclocal/libtool.m4:2585: -1- 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" +]) +m4trace:/usr/share/aclocal/libtool.m4:2593: -1- AC_DEFUN([AC_LIBTOOL_CXX], [AC_REQUIRE([_LT_AC_LANG_CXX]) +]) +m4trace:/usr/share/aclocal/libtool.m4:2602: -1- 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]) +]) +m4trace:/usr/share/aclocal/libtool.m4:2614: -1- 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 +]) +m4trace:/usr/share/aclocal/libtool.m4:2621: -1- AC_DEFUN([AC_LIBTOOL_F77], [AC_REQUIRE([_LT_AC_LANG_F77]) +]) +m4trace:/usr/share/aclocal/libtool.m4:2629: -1- AC_DEFUN([_LT_AC_LANG_F77], [AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +]) +m4trace:/usr/share/aclocal/libtool.m4:2637: -1- AC_DEFUN([AC_LIBTOOL_GCJ], [AC_REQUIRE([_LT_AC_LANG_GCJ]) +]) +m4trace:/usr/share/aclocal/libtool.m4:2650: -1- 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]) +]) +m4trace:/usr/share/aclocal/libtool.m4:2659: -1- AC_DEFUN([AC_LIBTOOL_RC], [AC_REQUIRE([LT_AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC]) +]) +m4trace:/usr/share/aclocal/libtool.m4:2667: -1- AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +m4trace:/usr/share/aclocal/libtool.m4:2740: -1- AC_DEFUN([_LT_AC_LANG_C_CONFIG], [lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + +_LT_AC_SYS_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_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 + ;; + +aix4* | aix5*) + 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" +]) +m4trace:/usr/share/aclocal/libtool.m4:2748: -1- AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +m4trace:/usr/share/aclocal/libtool.m4:3748: -1- 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)= + +# 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;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# 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 + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + 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*) + 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 "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + _LT_AC_TAGVAR(module_cmds, $1)='$CC $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 + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + 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` $verstring' + _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 $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $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* | kfreebsd*-gnu | 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(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + ;; + *) + _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 + ;; + interix3*) + _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*) + 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*) + # 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' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + openbsd2*) + # C++ shared libraries are fairly broken + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + openbsd*) + _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' + ;; + 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 C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}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' + 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" + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_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 +]) +m4trace:/usr/share/aclocal/libtool.m4:3908: -1- AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP], [ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 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) + +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + +# 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=\`echo $lt_[]_LT_AC_TAGVAR(predep_objects, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=\`echo $lt_[]_LT_AC_TAGVAR(postdep_objects, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=\`echo $lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# 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=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +fi +]) +m4trace:/usr/share/aclocal/libtool.m4:4628: -1- 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 +]) +m4trace:/usr/share/aclocal/libtool.m4:4830: -1- AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform 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*) + 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 -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) +m4trace:/usr/share/aclocal/libtool.m4:5356: -1- AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], [_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + interix3*) + # 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 + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + 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* | kfreebsd*-gnu | 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*) + 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*) + # 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' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + 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* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + interix3*) + # 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* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + linux*) + case $cc_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' + ;; + 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' + ;; + + 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_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_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) +]) +m4trace:/usr/share/aclocal/libtool.m4:6286: -1- AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(hardcode_automatic, $1)=no + _LT_AC_TAGVAR(module_cmds, $1)= + _LT_AC_TAGVAR(module_expsym_cmds, $1)= + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + # 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 + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--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 + ;; + + interix3*) + _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' + ;; + + linux*) + 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 + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$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 -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + 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 + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + 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_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 -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + 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` $verstring' + _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 $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $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* | kfreebsd*-gnu | 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*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(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 + ;; + + 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 linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + *) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; + 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*) + _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* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + 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 +]) +m4trace:/usr/share/aclocal/libtool.m4:6326: -1- 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 */ +]) +m4trace:/usr/share/aclocal/libtool.m4:6331: -1- AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) +m4trace:/usr/share/aclocal/libtool.m4:6335: -1- AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +m4trace:/usr/share/aclocal/libtool.m4:6336: -1- AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +m4trace:/usr/share/aclocal/libtool.m4:6337: -1- AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +m4trace:/usr/share/aclocal/libtool.m4:6338: -1- AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +m4trace:/usr/share/aclocal/libtool.m4:6339: -1- AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +m4trace:/usr/share/aclocal/libtool.m4:6340: -1- AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +m4trace:/usr/share/aclocal/libtool.m4:6341: -1- AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) +m4trace:/usr/share/aclocal/libtool.m4:6350: -1- AC_DEFUN([LT_AC_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) +m4trace:/usr/share/aclocal/libtool.m4:6354: -1- AC_DEFUN([LT_AC_PROG_RC], [AC_CHECK_TOOL(RC, windres, no) +]) +m4trace:/usr/share/aclocal/libtool.m4:6419: -1- 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]) +]) +m4trace:/usr/share/aclocal-1.9/amversion.m4:13: -1- AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) +m4trace:/usr/share/aclocal-1.9/amversion.m4:20: -1- AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.9.6])]) +m4trace:/usr/share/aclocal-1.9/auxdir.m4:52: -1- 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` +]) +m4trace:/usr/share/aclocal-1.9/cond.m4:32: -1- 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])]) +m4trace:/usr/share/aclocal-1.9/depend.m4:131: -1- 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]) +]) +m4trace:/usr/share/aclocal-1.9/depend.m4:141: -1- AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) +m4trace:/usr/share/aclocal-1.9/depend.m4:156: -1- 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]) +]) +m4trace:/usr/share/aclocal-1.9/depout.m4:53: -1- 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 +]) +m4trace:/usr/share/aclocal-1.9/depout.m4:67: -1- 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"]) +]) +m4trace:/usr/share/aclocal-1.9/init.m4:92: -1- 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 +]) +]) +m4trace:/usr/share/aclocal-1.9/init.m4:113: -1- 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]) +m4trace:/usr/share/aclocal-1.9/install-sh.m4:14: -1- 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)]) +m4trace:/usr/share/aclocal-1.9/lead-dot.m4:21: -1- 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])]) +m4trace:/usr/share/aclocal-1.9/make.m4:51: -1- 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 +]) +m4trace:/usr/share/aclocal-1.9/missing.m4:17: -1- AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) +m4trace:/usr/share/aclocal-1.9/missing.m4:34: -1- 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 +]) +m4trace:/usr/share/aclocal-1.9/mkdirp.m4:63: -1- 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])]) +m4trace:/usr/share/aclocal-1.9/options.m4:14: -1- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) +m4trace:/usr/share/aclocal-1.9/options.m4:20: -1- AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) +m4trace:/usr/share/aclocal-1.9/options.m4:26: -1- AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) +m4trace:/usr/share/aclocal-1.9/options.m4:32: -1- AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) +m4trace:/usr/share/aclocal-1.9/runlog.m4:17: -1- AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) +m4trace:/usr/share/aclocal-1.9/sanity.m4:51: -1- 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)]) +m4trace:/usr/share/aclocal-1.9/strip.m4:28: -1- 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])]) +m4trace:/usr/share/aclocal-1.9/tar.m4:95: -1- 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]) +]) +m4trace:configure.in:5: -1- AC_INIT([libsangoma], [1.0.0], [anthmct@yahoo.com]) +m4trace:configure.in:5: -1- m4_pattern_forbid([^_?A[CHUM]_]) +m4trace:configure.in:5: -1- m4_pattern_forbid([_AC_]) +m4trace:configure.in:5: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) +m4trace:configure.in:5: -1- m4_pattern_allow([^AS_FLAGS$]) +m4trace:configure.in:5: -1- m4_pattern_forbid([^_?m4_]) +m4trace:configure.in:5: -1- m4_pattern_forbid([^dnl$]) +m4trace:configure.in:5: -1- m4_pattern_forbid([^_?AS_]) +m4trace:configure.in:5: -1- AC_SUBST([SHELL], [${CONFIG_SHELL-/bin/sh}]) +m4trace:configure.in:5: -1- AC_SUBST([PATH_SEPARATOR]) +m4trace:configure.in:5: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])]) +m4trace:configure.in:5: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])]) +m4trace:configure.in:5: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])]) +m4trace:configure.in:5: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])]) +m4trace:configure.in:5: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])]) +m4trace:configure.in:5: -1- AC_SUBST([exec_prefix], [NONE]) +m4trace:configure.in:5: -1- AC_SUBST([prefix], [NONE]) +m4trace:configure.in:5: -1- AC_SUBST([program_transform_name], [s,x,x,]) +m4trace:configure.in:5: -1- AC_SUBST([bindir], ['${exec_prefix}/bin']) +m4trace:configure.in:5: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin']) +m4trace:configure.in:5: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec']) +m4trace:configure.in:5: -1- AC_SUBST([datadir], ['${prefix}/share']) +m4trace:configure.in:5: -1- AC_SUBST([sysconfdir], ['${prefix}/etc']) +m4trace:configure.in:5: -1- AC_SUBST([sharedstatedir], ['${prefix}/com']) +m4trace:configure.in:5: -1- AC_SUBST([localstatedir], ['${prefix}/var']) +m4trace:configure.in:5: -1- AC_SUBST([libdir], ['${exec_prefix}/lib']) +m4trace:configure.in:5: -1- AC_SUBST([includedir], ['${prefix}/include']) +m4trace:configure.in:5: -1- AC_SUBST([oldincludedir], ['/usr/include']) +m4trace:configure.in:5: -1- AC_SUBST([infodir], ['${prefix}/info']) +m4trace:configure.in:5: -1- AC_SUBST([mandir], ['${prefix}/man']) +m4trace:configure.in:5: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME]) +m4trace:configure.in:5: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */ +#undef PACKAGE_NAME]) +m4trace:configure.in:5: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME]) +m4trace:configure.in:5: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME]) +m4trace:configure.in:5: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION]) +m4trace:configure.in:5: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */ +#undef PACKAGE_VERSION]) +m4trace:configure.in:5: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING]) +m4trace:configure.in:5: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING]) +m4trace:configure.in:5: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT]) +m4trace:configure.in:5: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT]) +m4trace:configure.in:5: -1- AC_SUBST([build_alias]) +m4trace:configure.in:5: -1- AC_SUBST([host_alias]) +m4trace:configure.in:5: -1- AC_SUBST([target_alias]) +m4trace:configure.in:5: -1- AC_SUBST([DEFS]) +m4trace:configure.in:5: -1- AC_SUBST([ECHO_C]) +m4trace:configure.in:5: -1- AC_SUBST([ECHO_N]) +m4trace:configure.in:5: -1- AC_SUBST([ECHO_T]) +m4trace:configure.in:5: -1- AC_SUBST([LIBS]) +m4trace:configure.in:6: -1- AM_INIT_AUTOMAKE([libsangoma], [1.0.0]) +m4trace:configure.in:6: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$]) +m4trace:configure.in:6: -1- AM_SET_CURRENT_AUTOMAKE_VERSION +m4trace:configure.in:6: -1- AM_AUTOMAKE_VERSION([1.9.6]) +m4trace:configure.in:6: -1- AC_PROG_INSTALL +m4trace:configure.in:6: -1- AC_SUBST([INSTALL_PROGRAM]) +m4trace:configure.in:6: -1- AC_SUBST([INSTALL_SCRIPT]) +m4trace:configure.in:6: -1- AC_SUBST([INSTALL_DATA]) +m4trace:configure.in:6: -1- AC_SUBST([CYGPATH_W]) +m4trace:configure.in:6: -1- AC_SUBST([PACKAGE], [libsangoma]) +m4trace:configure.in:6: -1- AC_SUBST([VERSION], [1.0.0]) +m4trace:configure.in:6: -1- _AM_IF_OPTION([no-define], [], [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])]) +m4trace:configure.in:6: -2- _AM_MANGLE_OPTION([no-define]) +m4trace:configure.in:6: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE]) +m4trace:configure.in:6: -1- AH_OUTPUT([PACKAGE], [/* Name of package */ +#undef PACKAGE]) +m4trace:configure.in:6: -1- AC_DEFINE_TRACE_LITERAL([VERSION]) +m4trace:configure.in:6: -1- AH_OUTPUT([VERSION], [/* Version number of package */ +#undef VERSION]) +m4trace:configure.in:6: -1- AM_SANITY_CHECK +m4trace:configure.in:6: -1- AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +m4trace:configure.in:6: -1- AM_MISSING_HAS_RUN +m4trace:configure.in:6: -1- AM_AUX_DIR_EXPAND +m4trace:configure.in:6: -1- AC_SUBST([ACLOCAL]) +m4trace:configure.in:6: -1- AM_MISSING_PROG([AUTOCONF], [autoconf]) +m4trace:configure.in:6: -1- AC_SUBST([AUTOCONF]) +m4trace:configure.in:6: -1- AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +m4trace:configure.in:6: -1- AC_SUBST([AUTOMAKE]) +m4trace:configure.in:6: -1- AM_MISSING_PROG([AUTOHEADER], [autoheader]) +m4trace:configure.in:6: -1- AC_SUBST([AUTOHEADER]) +m4trace:configure.in:6: -1- AM_MISSING_PROG([MAKEINFO], [makeinfo]) +m4trace:configure.in:6: -1- AC_SUBST([MAKEINFO]) +m4trace:configure.in:6: -1- AM_PROG_INSTALL_SH +m4trace:configure.in:6: -1- AC_SUBST([install_sh]) +m4trace:configure.in:6: -1- AM_PROG_INSTALL_STRIP +m4trace:configure.in:6: -1- AC_SUBST([STRIP]) +m4trace:configure.in:6: -1- AC_SUBST([ac_ct_STRIP]) +m4trace:configure.in:6: -1- AC_SUBST([INSTALL_STRIP_PROGRAM]) +m4trace:configure.in:6: -1- AM_PROG_MKDIR_P +m4trace:configure.in:6: -1- AC_SUBST([mkdir_p]) +m4trace:configure.in:6: -1- AC_PROG_AWK +m4trace:configure.in:6: -1- AC_SUBST([AWK]) +m4trace:configure.in:6: -1- AC_PROG_MAKE_SET +m4trace:configure.in:6: -1- AC_SUBST([SET_MAKE]) +m4trace:configure.in:6: -1- AM_SET_LEADING_DOT +m4trace:configure.in:6: -1- AC_SUBST([am__leading_dot]) +m4trace:configure.in:6: -1- _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +m4trace:configure.in:6: -2- _AM_MANGLE_OPTION([tar-ustar]) +m4trace:configure.in:6: -1- _AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])]) +m4trace:configure.in:6: -2- _AM_MANGLE_OPTION([tar-pax]) +m4trace:configure.in:6: -1- _AM_PROG_TAR([v7]) +m4trace:configure.in:6: -1- AM_MISSING_PROG([AMTAR], [tar]) +m4trace:configure.in:6: -1- AC_SUBST([AMTAR]) +m4trace:configure.in:6: -1- AC_SUBST([am__tar]) +m4trace:configure.in:6: -1- AC_SUBST([am__untar]) +m4trace:configure.in:6: -1- _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 +]) +m4trace:configure.in:6: -2- _AM_MANGLE_OPTION([no-dependencies]) +m4trace:configure.in:8: -1- AC_PROG_CC +m4trace:configure.in:8: -1- AC_SUBST([CC]) +m4trace:configure.in:8: -1- AC_SUBST([CFLAGS]) +m4trace:configure.in:8: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.in:8: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:8: -1- AC_SUBST([CC]) +m4trace:configure.in:8: -1- AC_SUBST([ac_ct_CC]) +m4trace:configure.in:8: -1- AC_SUBST([CC]) +m4trace:configure.in:8: -1- AC_SUBST([ac_ct_CC]) +m4trace:configure.in:8: -1- AC_SUBST([CC]) +m4trace:configure.in:8: -1- AC_SUBST([CC]) +m4trace:configure.in:8: -1- AC_SUBST([ac_ct_CC]) +m4trace:configure.in:8: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext]) +m4trace:configure.in:8: -1- AC_SUBST([OBJEXT], [$ac_cv_objext]) +m4trace:configure.in:8: -1- _AM_DEPENDENCIES([CC]) +m4trace:configure.in:8: -1- AM_SET_DEPDIR +m4trace:configure.in:8: -1- AC_SUBST([DEPDIR], ["${am__leading_dot}deps"]) +m4trace:configure.in:8: -1- AM_OUTPUT_DEPENDENCY_COMMANDS +m4trace:configure.in:8: -1- AM_MAKE_INCLUDE +m4trace:configure.in:8: -1- AC_SUBST([am__include]) +m4trace:configure.in:8: -1- AC_SUBST([am__quote]) +m4trace:configure.in:8: -1- AM_DEP_TRACK +m4trace:configure.in:8: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +m4trace:configure.in:8: -1- AC_SUBST([AMDEP_TRUE]) +m4trace:configure.in:8: -1- AC_SUBST([AMDEP_FALSE]) +m4trace:configure.in:8: -1- AC_SUBST([AMDEPBACKSLASH]) +m4trace:configure.in:8: -1- AC_SUBST([CCDEPMODE], [depmode=$am_cv_CC_dependencies_compiler_type]) +m4trace:configure.in:8: -1- AM_CONDITIONAL([am__fastdepCC], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3]) +m4trace:configure.in:8: -1- AC_SUBST([am__fastdepCC_TRUE]) +m4trace:configure.in:8: -1- AC_SUBST([am__fastdepCC_FALSE]) +m4trace:configure.in:9: -1- AC_PROG_LIBTOOL +m4trace:configure.in:9: -1- _AC_PROG_LIBTOOL +m4trace:configure.in:9: -1- AC_LIBTOOL_SETUP +m4trace:configure.in:9: -1- AC_ENABLE_SHARED +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [autoconf/general.m4:219: AC_HELP_STRING is expanded from... +autoconf/general.m4:1303: AC_ARG_ENABLE is expanded from... +/usr/share/aclocal/libtool.m4:1949: AC_ENABLE_SHARED is expanded from... +configure.in:9: AC_ENABLE_SHARED is required by... +/usr/share/aclocal/libtool.m4:220: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +/usr/share/aclocal/libtool.m4:75: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +/usr/share/aclocal/libtool.m4:55: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- AC_ENABLE_STATIC +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [autoconf/general.m4:219: AC_HELP_STRING is expanded from... +autoconf/general.m4:1303: AC_ARG_ENABLE is expanded from... +/usr/share/aclocal/libtool.m4:1988: AC_ENABLE_STATIC is expanded from... +configure.in:9: AC_ENABLE_STATIC is required by... +/usr/share/aclocal/libtool.m4:220: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +/usr/share/aclocal/libtool.m4:75: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +/usr/share/aclocal/libtool.m4:55: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- AC_ENABLE_FAST_INSTALL +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [autoconf/general.m4:219: AC_HELP_STRING is expanded from... +autoconf/general.m4:1303: AC_ARG_ENABLE is expanded from... +/usr/share/aclocal/libtool.m4:2027: AC_ENABLE_FAST_INSTALL is expanded from... +configure.in:9: AC_ENABLE_FAST_INSTALL is required by... +/usr/share/aclocal/libtool.m4:220: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +/usr/share/aclocal/libtool.m4:75: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +/usr/share/aclocal/libtool.m4:55: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- AC_CANONICAL_HOST +m4trace:configure.in:9: -1- AC_SUBST([build], [$ac_cv_build]) +m4trace:configure.in:9: -1- AC_SUBST([build_cpu], [`echo $ac_cv_build | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\1/'`]) +m4trace:configure.in:9: -1- AC_SUBST([build_vendor], [`echo $ac_cv_build | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\2/'`]) +m4trace:configure.in:9: -1- AC_SUBST([build_os], [`echo $ac_cv_build | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\3/'`]) +m4trace:configure.in:9: -1- AC_SUBST([host], [$ac_cv_host]) +m4trace:configure.in:9: -1- AC_SUBST([host_cpu], [`echo $ac_cv_host | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\1/'`]) +m4trace:configure.in:9: -1- AC_SUBST([host_vendor], [`echo $ac_cv_host | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\2/'`]) +m4trace:configure.in:9: -1- AC_SUBST([host_os], [`echo $ac_cv_host | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\3/'`]) +m4trace:configure.in:9: -1- AC_PROG_LD +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [autoconf/general.m4:219: AC_HELP_STRING is expanded from... +autoconf/general.m4:1331: AC_ARG_WITH is expanded from... +/usr/share/aclocal/libtool.m4:2224: AC_PROG_LD is expanded from... +configure.in:9: AC_PROG_LD is required by... +/usr/share/aclocal/libtool.m4:220: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +/usr/share/aclocal/libtool.m4:75: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +/usr/share/aclocal/libtool.m4:55: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- LT_AC_PROG_SED +m4trace:configure.in:9: -1- AC_SUBST([SED]) +m4trace:configure.in:9: -1- AC_PROG_LD_GNU +m4trace:configure.in:9: -1- AC_PROG_EGREP +m4trace:configure.in:9: -1- AC_SUBST([EGREP]) +m4trace:configure.in:9: -1- AC_PROG_LD_RELOAD_FLAG +m4trace:configure.in:9: -1- AC_PROG_NM +m4trace:configure.in:9: -1- AC_PROG_LN_S +m4trace:configure.in:9: -1- AC_SUBST([LN_S], [$as_ln_s]) +m4trace:configure.in:9: -1- AC_DEPLIBS_CHECK_METHOD +m4trace:configure.in:9: -1- AC_LIBTOOL_SYS_MAX_CMD_LEN +m4trace:configure.in:9: -1- AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], []) +m4trace:configure.in:9: -1- AC_LIBTOOL_OBJDIR +m4trace:configure.in:9: -1- _LT_AC_SYS_COMPILER +m4trace:configure.in:9: -1- _LT_AC_PROG_ECHO_BACKSLASH +m4trace:configure.in:9: -1- _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) +]) +m4trace:configure.in:9: -1- AC_SUBST([ECHO]) +m4trace:configure.in:9: -1- AC_SUBST([AR]) +m4trace:configure.in:9: -1- AC_SUBST([ac_ct_AR]) +m4trace:configure.in:9: -1- AC_SUBST([RANLIB]) +m4trace:configure.in:9: -1- AC_SUBST([ac_ct_RANLIB]) +m4trace:configure.in:9: -1- AC_SUBST([STRIP]) +m4trace:configure.in:9: -1- AC_SUBST([ac_ct_STRIP]) +m4trace:configure.in:9: -1- _LT_CC_BASENAME([$compiler]) +m4trace:configure.in:9: -1- AC_PATH_MAGIC +m4trace:configure.in:9: -1- AC_PATH_TOOL_PREFIX([${ac_tool_prefix}file], [/usr/bin$PATH_SEPARATOR$PATH]) +m4trace:configure.in:9: -1- AC_PATH_TOOL_PREFIX([file], [/usr/bin$PATH_SEPARATOR$PATH]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [autoconf/general.m4:219: AC_HELP_STRING is expanded from... +autoconf/general.m4:1303: AC_ARG_ENABLE is expanded from... +/usr/share/aclocal/libtool.m4:220: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +/usr/share/aclocal/libtool.m4:75: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +/usr/share/aclocal/libtool.m4:55: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [autoconf/general.m4:219: AC_HELP_STRING is expanded from... +autoconf/general.m4:1331: AC_ARG_WITH is expanded from... +/usr/share/aclocal/libtool.m4:220: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +/usr/share/aclocal/libtool.m4:75: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +/usr/share/aclocal/libtool.m4:55: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- AC_LIBTOOL_LANG_C_CONFIG +m4trace:configure.in:9: -1- _LT_AC_LANG_C_CONFIG +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([objext], []) +m4trace:configure.in:9: -1- _LT_AC_SYS_COMPILER +m4trace:configure.in:9: -1- _LT_COMPILER_BOILERPLATE +m4trace:configure.in:9: -1- _LT_LINKER_BOILERPLATE +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_COMPILER_NO_RTTI([]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], []) +m4trace:configure.in:9: -1- 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, )="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, ) -fno-rtti -fno-exceptions"]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], []) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_COMPILER_PIC([]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_can_build_shared], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_can_build_shared], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_can_build_shared], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -2- _LT_AC_TAGVAR([lt_prog_compiler_pic_works], []) +m4trace:configure.in:9: -1- AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, ) works], [lt_prog_compiler_pic_works], [$_LT_AC_TAGVAR(lt_prog_compiler_pic, )ifelse([],[],[ -DPIC],[ifelse([],[CXX],[ -DPIC],[])])], [], [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, ) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, )=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, )" ;; + esac], [_LT_AC_TAGVAR(lt_prog_compiler_pic, )= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, )=no]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_can_build_shared], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -2- _LT_AC_TAGVAR([lt_prog_compiler_static_works], []) +m4trace:configure.in:9: -1- AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], [lt_prog_compiler_static_works], [$lt_tmp_static_flag], [], [_LT_AC_TAGVAR(lt_prog_compiler_static, )=]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_CC_C_O([]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], []) +m4trace:configure.in:9: -1- AC_LIBTOOL_SYS_HARD_LINK_LOCKS([]) +m4trace:configure.in:9: -1- _LT_AC_LOCK +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... +autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... +autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... +/usr/share/aclocal/libtool.m4:608: _LT_AC_LOCK is expanded from... +configure.in:9: _LT_AC_LOCK is required by... +/usr/share/aclocal/libtool.m4:1094: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from... +/usr/share/aclocal/libtool.m4:2740: _LT_AC_LANG_C_CONFIG is expanded from... +/usr/share/aclocal/libtool.m4:2667: AC_LIBTOOL_LANG_C_CONFIG is expanded from... +/usr/share/aclocal/libtool.m4:220: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +/usr/share/aclocal/libtool.m4:75: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +/usr/share/aclocal/libtool.m4:55: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], []) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_LD_SHLIBS([]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_From_new_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([thread_safe_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([include_expsyms], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([exclude_expsyms], []) +m4trace:configure.in:9: -1- _LT_CC_BASENAME([$compiler]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_SYS_LIBPATH_AIX +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_SYS_LIBPATH_AIX +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_From_new_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([fix_srcfile_path], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_From_new_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([reload_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -2- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], []) +m4trace:configure.in:9: -1- AC_LIBTOOL_SYS_DYNAMIC_LINKER([]) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([runpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], []) +m4trace:configure.in:9: -1- AC_LIBTOOL_SYS_LIB_STRIP +m4trace:configure.in:9: -1- AC_LIBTOOL_DLOPEN_SELF +m4trace:configure.in:9: -1- _LT_AC_CHECK_DLFCN +m4trace:configure.in:9: -1- AC_CHECK_HEADERS([dlfcn.h]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_DLFCN_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H]) +m4trace:configure.in:9: -1- AC_HEADER_STDC +m4trace:configure.in:9: -1- AC_PROG_CPP +m4trace:configure.in:9: -1- AC_SUBST([CPP]) +m4trace:configure.in:9: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:9: -1- AC_SUBST([CPP]) +m4trace:configure.in:9: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS]) +m4trace:configure.in:9: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS]) +m4trace:configure.in:9: -1- AC_CHECK_HEADERS([sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h], [], [], [$ac_includes_default]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H]) +m4trace:configure.in:9: -1- 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 + ]) +m4trace:configure.in:9: -1- AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) +m4trace:configure.in:9: -1- AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) +m4trace:configure.in:9: -1- AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) +m4trace:configure.in:9: -1- AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) +m4trace:configure.in:9: -1- _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]) +m4trace:configure.in:9: -1- _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]) +m4trace:configure.in:9: -1- AC_LIBTOOL_CONFIG([]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([CC], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([LD], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([thread_safe_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_new_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predep_objects], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdep_objects], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predeps], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler_lib_search_path], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postinstall_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postuninstall_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([exclude_expsyms], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([include_expsyms], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_new_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([GCC], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([LD], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([thread_safe_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_new_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predep_objects], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdep_objects], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predeps], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler_lib_search_path], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([fix_srcfile_path], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([exclude_expsyms], []) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([include_expsyms], []) +m4trace:configure.in:9: -1- _LT_AC_TAGCONFIG +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [autoconf/general.m4:219: AC_HELP_STRING is expanded from... +autoconf/general.m4:1331: AC_ARG_WITH is expanded from... +/usr/share/aclocal/libtool.m4:1903: _LT_AC_TAGCONFIG is expanded from... +/usr/share/aclocal/libtool.m4:220: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +/usr/share/aclocal/libtool.m4:75: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +/usr/share/aclocal/libtool.m4:55: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [back quotes and double quotes must not be escaped in: $as_me:$LINENO: error: tag name \"$tagname\" already exists], [/usr/share/aclocal/libtool.m4:1903: _LT_AC_TAGCONFIG is expanded from... +/usr/share/aclocal/libtool.m4:220: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +/usr/share/aclocal/libtool.m4:75: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +/usr/share/aclocal/libtool.m4:55: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [back quotes and double quotes must not be escaped in: $as_me: error: tag name \"$tagname\" already exists], [/usr/share/aclocal/libtool.m4:1903: _LT_AC_TAGCONFIG is expanded from... +/usr/share/aclocal/libtool.m4:220: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +/usr/share/aclocal/libtool.m4:75: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +/usr/share/aclocal/libtool.m4:55: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- AC_LIBTOOL_LANG_CXX_CONFIG +m4trace:configure.in:9: -1- _LT_AC_LANG_CXX_CONFIG([CXX]) +m4trace:configure.in:9: -1- AC_PROG_CXX +m4trace:configure.in:9: -1- AC_SUBST([CXX]) +m4trace:configure.in:9: -1- AC_SUBST([CXXFLAGS]) +m4trace:configure.in:9: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.in:9: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:9: -1- AC_SUBST([CXX]) +m4trace:configure.in:9: -1- AC_SUBST([ac_ct_CXX]) +m4trace:configure.in:9: -1- _AM_DEPENDENCIES([CXX]) +m4trace:configure.in:9: -1- AC_SUBST([CXXDEPMODE], [depmode=$am_cv_CXX_dependencies_compiler_type]) +m4trace:configure.in:9: -1- AM_CONDITIONAL([am__fastdepCXX], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3]) +m4trace:configure.in:9: -1- AC_SUBST([am__fastdepCXX_TRUE]) +m4trace:configure.in:9: -1- AC_SUBST([am__fastdepCXX_FALSE]) +m4trace:configure.in:9: -1- _LT_AC_PROG_CXXCPP +m4trace:configure.in:9: -1- AC_SUBST([CXXCPP]) +m4trace:configure.in:9: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:9: -1- AC_SUBST([CXXCPP]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predep_objects], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdep_objects], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predeps], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler_lib_search_path], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([objext], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_SYS_COMPILER +m4trace:configure.in:9: -1- _LT_COMPILER_BOILERPLATE +m4trace:configure.in:9: -1- _LT_LINKER_BOILERPLATE +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler], [CXX]) +m4trace:configure.in:9: -1- _LT_CC_BASENAME([$compiler]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], [CXX]) +m4trace:configure.in:9: -1- AC_PROG_LD +m4trace:configure.in:9: -1- AC_PROG_LD_GNU +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_SYS_LIBPATH_AIX +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_SYS_LIBPATH_AIX +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([GCC], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([LD], [CXX]) +m4trace:configure.in:9: -1- AC_LIBTOOL_POSTDEP_PREDEP([CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler_lib_search_path], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler_lib_search_path], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler_lib_search_path], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler_lib_search_path], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predep_objects], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predep_objects], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predep_objects], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predep_objects], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdep_objects], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdep_objects], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdep_objects], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdep_objects], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predep_objects], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdep_objects], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [CXX]) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_COMPILER_PIC([CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_can_build_shared], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -2- _LT_AC_TAGVAR([lt_prog_compiler_pic_works], [CXX]) +m4trace:configure.in:9: -1- AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, CXX) works], [lt_prog_compiler_pic_works_CXX], [$_LT_AC_TAGVAR(lt_prog_compiler_pic, CXX)ifelse([CXX],[],[ -DPIC],[ifelse([CXX],[CXX],[ -DPIC],[])])], [], [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, CXX) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, CXX)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, CXX)" ;; + esac], [_LT_AC_TAGVAR(lt_prog_compiler_pic, CXX)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, CXX)=no]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_can_build_shared], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -2- _LT_AC_TAGVAR([lt_prog_compiler_static_works], [CXX]) +m4trace:configure.in:9: -1- AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], [lt_prog_compiler_static_works_CXX], [$lt_tmp_static_flag], [], [_LT_AC_TAGVAR(lt_prog_compiler_static, CXX)=]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_CC_C_O([CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [CXX]) +m4trace:configure.in:9: -1- AC_LIBTOOL_SYS_HARD_LINK_LOCKS([CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [CXX]) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_LD_SHLIBS([CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -2- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [CXX]) +m4trace:configure.in:9: -1- AC_LIBTOOL_SYS_DYNAMIC_LINKER([CXX]) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([runpath_var], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [CXX]) +m4trace:configure.in:9: -1- AC_LIBTOOL_CONFIG([CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([CC], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([LD], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([thread_safe_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_new_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predep_objects], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdep_objects], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predeps], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler_lib_search_path], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postinstall_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postuninstall_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([exclude_expsyms], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([include_expsyms], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_new_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([GCC], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([LD], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([thread_safe_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_new_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predep_objects], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdep_objects], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predeps], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler_lib_search_path], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([fix_srcfile_path], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([exclude_expsyms], [CXX]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([include_expsyms], [CXX]) +m4trace:configure.in:9: -1- AC_LIBTOOL_LANG_F77_CONFIG +m4trace:configure.in:9: -1- _LT_AC_LANG_F77_CONFIG([F77]) +m4trace:configure.in:9: -1- AC_SUBST([F77]) +m4trace:configure.in:9: -1- AC_SUBST([FFLAGS]) +m4trace:configure.in:9: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.in:9: -1- AC_SUBST([F77]) +m4trace:configure.in:9: -1- AC_SUBST([ac_ct_F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([objext], [F77]) +m4trace:configure.in:9: -1- _LT_AC_SYS_COMPILER +m4trace:configure.in:9: -1- _LT_COMPILER_BOILERPLATE +m4trace:configure.in:9: -1- _LT_LINKER_BOILERPLATE +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler], [F77]) +m4trace:configure.in:9: -1- _LT_CC_BASENAME([$compiler]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([GCC], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([LD], [F77]) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_COMPILER_PIC([F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_can_build_shared], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_can_build_shared], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_can_build_shared], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -2- _LT_AC_TAGVAR([lt_prog_compiler_pic_works], [F77]) +m4trace:configure.in:9: -1- AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, F77) works], [lt_prog_compiler_pic_works_F77], [$_LT_AC_TAGVAR(lt_prog_compiler_pic, F77)ifelse([F77],[],[ -DPIC],[ifelse([F77],[CXX],[ -DPIC],[])])], [], [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, F77) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, F77)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, F77)" ;; + esac], [_LT_AC_TAGVAR(lt_prog_compiler_pic, F77)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, F77)=no]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_can_build_shared], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -2- _LT_AC_TAGVAR([lt_prog_compiler_static_works], [F77]) +m4trace:configure.in:9: -1- AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], [lt_prog_compiler_static_works_F77], [$lt_tmp_static_flag], [], [_LT_AC_TAGVAR(lt_prog_compiler_static, F77)=]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_CC_C_O([F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [F77]) +m4trace:configure.in:9: -1- AC_LIBTOOL_SYS_HARD_LINK_LOCKS([F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [F77]) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_LD_SHLIBS([F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_From_new_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([thread_safe_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([include_expsyms], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([exclude_expsyms], [F77]) +m4trace:configure.in:9: -1- _LT_CC_BASENAME([$compiler]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_SYS_LIBPATH_AIX +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_SYS_LIBPATH_AIX +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_From_new_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([fix_srcfile_path], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_From_new_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([reload_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -2- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [F77]) +m4trace:configure.in:9: -1- AC_LIBTOOL_SYS_DYNAMIC_LINKER([F77]) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([runpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [F77]) +m4trace:configure.in:9: -1- AC_LIBTOOL_CONFIG([F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([CC], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([LD], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([thread_safe_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_new_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predep_objects], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdep_objects], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predeps], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler_lib_search_path], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postinstall_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postuninstall_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([exclude_expsyms], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([include_expsyms], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_new_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([GCC], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([LD], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([thread_safe_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_new_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predep_objects], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdep_objects], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predeps], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler_lib_search_path], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([fix_srcfile_path], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([exclude_expsyms], [F77]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([include_expsyms], [F77]) +m4trace:configure.in:9: -1- AC_LIBTOOL_LANG_GCJ_CONFIG +m4trace:configure.in:9: -1- _LT_AC_LANG_GCJ_CONFIG([GCJ]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_LANG_SAVE' is obsolete. +You should run autoupdate.], [autoconf/lang.m4:166: AC_LANG_SAVE is expanded from... +/usr/share/aclocal/libtool.m4:4069: _LT_AC_LANG_GCJ_CONFIG is expanded from... +/usr/share/aclocal/libtool.m4:4017: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... +/usr/share/aclocal/libtool.m4:1903: _LT_AC_TAGCONFIG is expanded from... +/usr/share/aclocal/libtool.m4:220: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +/usr/share/aclocal/libtool.m4:75: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +/usr/share/aclocal/libtool.m4:55: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [instead of using `AC_LANG', `AC_LANG_SAVE', +and `AC_LANG_RESTORE', you should use `AC_LANG_PUSH' and `AC_LANG_POP'.], [autoconf/lang.m4:166: AC_LANG_SAVE is expanded from... +/usr/share/aclocal/libtool.m4:4069: _LT_AC_LANG_GCJ_CONFIG is expanded from... +/usr/share/aclocal/libtool.m4:4017: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... +/usr/share/aclocal/libtool.m4:1903: _LT_AC_TAGCONFIG is expanded from... +/usr/share/aclocal/libtool.m4:220: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +/usr/share/aclocal/libtool.m4:75: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +/usr/share/aclocal/libtool.m4:55: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([objext], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_SYS_COMPILER +m4trace:configure.in:9: -1- _LT_COMPILER_BOILERPLATE +m4trace:configure.in:9: -1- _LT_LINKER_BOILERPLATE +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler], [GCJ]) +m4trace:configure.in:9: -1- _LT_CC_BASENAME([$compiler]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_COMPILER_NO_RTTI([GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], [GCJ]) +m4trace:configure.in:9: -1- 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, GCJ)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, GCJ) -fno-rtti -fno-exceptions"]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], [GCJ]) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_COMPILER_PIC([GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_can_build_shared], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_can_build_shared], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_can_build_shared], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -2- _LT_AC_TAGVAR([lt_prog_compiler_pic_works], [GCJ]) +m4trace:configure.in:9: -1- AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, GCJ) works], [lt_prog_compiler_pic_works_GCJ], [$_LT_AC_TAGVAR(lt_prog_compiler_pic, GCJ)ifelse([GCJ],[],[ -DPIC],[ifelse([GCJ],[CXX],[ -DPIC],[])])], [], [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, GCJ) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, GCJ)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, GCJ)" ;; + esac], [_LT_AC_TAGVAR(lt_prog_compiler_pic, GCJ)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, GCJ)=no]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_can_build_shared], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -2- _LT_AC_TAGVAR([lt_prog_compiler_static_works], [GCJ]) +m4trace:configure.in:9: -1- AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], [lt_prog_compiler_static_works_GCJ], [$lt_tmp_static_flag], [], [_LT_AC_TAGVAR(lt_prog_compiler_static, GCJ)=]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_CC_C_O([GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [GCJ]) +m4trace:configure.in:9: -1- AC_LIBTOOL_SYS_HARD_LINK_LOCKS([GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [GCJ]) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_LD_SHLIBS([GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_From_new_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([thread_safe_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([include_expsyms], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([exclude_expsyms], [GCJ]) +m4trace:configure.in:9: -1- _LT_CC_BASENAME([$compiler]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_SYS_LIBPATH_AIX +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_SYS_LIBPATH_AIX +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_From_new_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([fix_srcfile_path], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_From_new_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([reload_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([ld_shlibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -2- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [GCJ]) +m4trace:configure.in:9: -1- AC_LIBTOOL_SYS_DYNAMIC_LINKER([GCJ]) +m4trace:configure.in:9: -1- AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([runpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [GCJ]) +m4trace:configure.in:9: -1- AC_LIBTOOL_CONFIG([GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([CC], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([LD], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([thread_safe_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_new_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predep_objects], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdep_objects], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predeps], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler_lib_search_path], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postinstall_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postuninstall_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([exclude_expsyms], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([include_expsyms], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_new_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([GCC], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([LD], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([thread_safe_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_new_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predep_objects], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdep_objects], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predeps], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler_lib_search_path], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([fix_srcfile_path], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([exclude_expsyms], [GCJ]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([include_expsyms], [GCJ]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_LANG_RESTORE' is obsolete. +You should run autoupdate.], [autoconf/lang.m4:172: AC_LANG_RESTORE is expanded from... +/usr/share/aclocal/libtool.m4:4069: _LT_AC_LANG_GCJ_CONFIG is expanded from... +/usr/share/aclocal/libtool.m4:4017: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... +/usr/share/aclocal/libtool.m4:1903: _LT_AC_TAGCONFIG is expanded from... +/usr/share/aclocal/libtool.m4:220: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +/usr/share/aclocal/libtool.m4:75: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +/usr/share/aclocal/libtool.m4:55: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- AC_LIBTOOL_LANG_RC_CONFIG +m4trace:configure.in:9: -1- _LT_AC_LANG_RC_CONFIG([RC]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_LANG_SAVE' is obsolete. +You should run autoupdate.], [autoconf/lang.m4:166: AC_LANG_SAVE is expanded from... +/usr/share/aclocal/libtool.m4:4113: _LT_AC_LANG_RC_CONFIG is expanded from... +/usr/share/aclocal/libtool.m4:4077: AC_LIBTOOL_LANG_RC_CONFIG is expanded from... +/usr/share/aclocal/libtool.m4:1903: _LT_AC_TAGCONFIG is expanded from... +/usr/share/aclocal/libtool.m4:220: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +/usr/share/aclocal/libtool.m4:75: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +/usr/share/aclocal/libtool.m4:55: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [instead of using `AC_LANG', `AC_LANG_SAVE', +and `AC_LANG_RESTORE', you should use `AC_LANG_PUSH' and `AC_LANG_POP'.], [autoconf/lang.m4:166: AC_LANG_SAVE is expanded from... +/usr/share/aclocal/libtool.m4:4113: _LT_AC_LANG_RC_CONFIG is expanded from... +/usr/share/aclocal/libtool.m4:4077: AC_LIBTOOL_LANG_RC_CONFIG is expanded from... +/usr/share/aclocal/libtool.m4:1903: _LT_AC_TAGCONFIG is expanded from... +/usr/share/aclocal/libtool.m4:220: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +/usr/share/aclocal/libtool.m4:75: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +/usr/share/aclocal/libtool.m4:55: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([objext], [RC]) +m4trace:configure.in:9: -1- _LT_AC_SYS_COMPILER +m4trace:configure.in:9: -1- _LT_COMPILER_BOILERPLATE +m4trace:configure.in:9: -1- _LT_LINKER_BOILERPLATE +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler], [RC]) +m4trace:configure.in:9: -1- _LT_CC_BASENAME([$compiler]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [RC]) +m4trace:configure.in:9: -1- AC_LIBTOOL_CONFIG([RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([CC], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([LD], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([thread_safe_flag_spec], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_new_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predep_objects], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdep_objects], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predeps], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler_lib_search_path], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postinstall_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postuninstall_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([exclude_expsyms], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([include_expsyms], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_new_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds_need_lc], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([enable_shared_with_static_runtimes], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([GCC], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([LD], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_wl], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_pic], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_cv_prog_compiler_c_o], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_static], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([lt_prog_compiler_no_builtin_flag], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_dynamic_flag_spec], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([whole_archive_flag_spec], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([thread_safe_flag_spec], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_new_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([old_archive_from_expsyms_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([archive_expsym_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([module_expsym_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predep_objects], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdep_objects], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([predeps], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([postdeps], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([compiler_lib_search_path], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([allow_undefined_flag], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([no_undefined_flag], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_action], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_flag_spec_ld], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_libdir_separator], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_direct], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_minus_L], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_shlibpath_var], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([hardcode_automatic], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([link_all_deplibs], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([fix_srcfile_path], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([always_export_symbols], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([export_symbols_cmds], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([exclude_expsyms], [RC]) +m4trace:configure.in:9: -1- _LT_AC_TAGVAR([include_expsyms], [RC]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_LANG_RESTORE' is obsolete. +You should run autoupdate.], [autoconf/lang.m4:172: AC_LANG_RESTORE is expanded from... +/usr/share/aclocal/libtool.m4:4113: _LT_AC_LANG_RC_CONFIG is expanded from... +/usr/share/aclocal/libtool.m4:4077: AC_LIBTOOL_LANG_RC_CONFIG is expanded from... +/usr/share/aclocal/libtool.m4:1903: _LT_AC_TAGCONFIG is expanded from... +/usr/share/aclocal/libtool.m4:220: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +/usr/share/aclocal/libtool.m4:75: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +/usr/share/aclocal/libtool.m4:55: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- AC_SUBST([LIBTOOL]) +m4trace:configure.in:9: -1- AC_LIBTOOL_CXX +m4trace:configure.in:9: -1- _LT_AC_LANG_CXX +m4trace:configure.in:9: -1- _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX]) +m4trace:configure.in:9: -1- AC_LIBTOOL_F77 +m4trace:configure.in:9: -1- _LT_AC_LANG_F77 +m4trace:configure.in:9: -1- _LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77]) +m4trace:configure.in:10: -1- AC_PROG_RANLIB +m4trace:configure.in:10: -1- AC_SUBST([RANLIB]) +m4trace:configure.in:10: -1- AC_SUBST([ac_ct_RANLIB]) +m4trace:configure.in:13: -1- AC_CHECK_HEADERS([fcntl.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h math.h]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_FCNTL_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_NETINET_IN_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_SYS_IOCTL_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_SYS_SOCKET_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_SYS_TIME_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_MATH_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_MATH_H]) +m4trace:configure.in:18: -1- AM_CONDITIONAL([LIBPRI], [test -d "$libpripath" ]) +m4trace:configure.in:18: -1- AC_SUBST([LIBPRI_TRUE]) +m4trace:configure.in:18: -1- AC_SUBST([LIBPRI_FALSE]) +m4trace:configure.in:19: -1- AC_SUBST([libpripath]) +m4trace:configure.in:22: -1- AC_HEADER_TIME +m4trace:configure.in:22: -1- AC_DEFINE_TRACE_LITERAL([TIME_WITH_SYS_TIME]) +m4trace:configure.in:22: -1- AH_OUTPUT([TIME_WITH_SYS_TIME], [/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME]) +m4trace:configure.in:25: -1- AC_FUNC_SELECT_ARGTYPES +m4trace:configure.in:25: -1- AC_CHECK_HEADERS([sys/select.h sys/socket.h]) +m4trace:configure.in:25: -1- AH_OUTPUT([HAVE_SYS_SELECT_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H]) +m4trace:configure.in:25: -1- AH_OUTPUT([HAVE_SYS_SOCKET_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H]) +m4trace:configure.in:25: -1- AC_DEFINE_TRACE_LITERAL([SELECT_TYPE_ARG1]) +m4trace:configure.in:25: -1- AH_OUTPUT([SELECT_TYPE_ARG1], [/* Define to the type of arg 1 for `select\'. */ +#undef SELECT_TYPE_ARG1]) +m4trace:configure.in:25: -1- AC_DEFINE_TRACE_LITERAL([SELECT_TYPE_ARG234]) +m4trace:configure.in:25: -1- AH_OUTPUT([SELECT_TYPE_ARG234], [/* Define to the type of args 2, 3 and 4 for `select\'. */ +#undef SELECT_TYPE_ARG234]) +m4trace:configure.in:25: -1- AC_DEFINE_TRACE_LITERAL([SELECT_TYPE_ARG5]) +m4trace:configure.in:25: -1- AH_OUTPUT([SELECT_TYPE_ARG5], [/* Define to the type of arg 5 for `select\'. */ +#undef SELECT_TYPE_ARG5]) +m4trace:configure.in:26: -1- AC_CHECK_FUNCS([gettimeofday memset select socket]) +m4trace:configure.in:26: -1- AH_OUTPUT([HAVE_GETTIMEOFDAY], [/* Define to 1 if you have the `gettimeofday\' function. */ +#undef HAVE_GETTIMEOFDAY]) +m4trace:configure.in:26: -1- AH_OUTPUT([HAVE_MEMSET], [/* Define to 1 if you have the `memset\' function. */ +#undef HAVE_MEMSET]) +m4trace:configure.in:26: -1- AH_OUTPUT([HAVE_SELECT], [/* Define to 1 if you have the `select\' function. */ +#undef HAVE_SELECT]) +m4trace:configure.in:26: -1- AH_OUTPUT([HAVE_SOCKET], [/* Define to 1 if you have the `socket\' function. */ +#undef HAVE_SOCKET]) +m4trace:configure.in:27: -1- AC_CONFIG_FILES([Makefile]) +m4trace:configure.in:28: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) +m4trace:configure.in:28: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) +m4trace:configure.in:28: -1- _AM_OUTPUT_DEPENDENCY_COMMANDS diff --git a/api/libsangoma/autom4te.cache/traces.1 b/api/libsangoma/autom4te.cache/traces.1 new file mode 100644 index 0000000..75a4030 --- /dev/null +++ b/api/libsangoma/autom4te.cache/traces.1 @@ -0,0 +1,441 @@ +m4trace:configure.in:5: -1- AC_INIT([libsangoma], [1.0.0], [anthmct@yahoo.com]) +m4trace:configure.in:5: -1- m4_pattern_forbid([^_?A[CHUM]_]) +m4trace:configure.in:5: -1- m4_pattern_forbid([_AC_]) +m4trace:configure.in:5: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS']) +m4trace:configure.in:5: -1- m4_pattern_allow([^AS_FLAGS$]) +m4trace:configure.in:5: -1- m4_pattern_forbid([^_?m4_]) +m4trace:configure.in:5: -1- m4_pattern_forbid([^dnl$]) +m4trace:configure.in:5: -1- m4_pattern_forbid([^_?AS_]) +m4trace:configure.in:5: -1- AC_SUBST([SHELL], [${CONFIG_SHELL-/bin/sh}]) +m4trace:configure.in:5: -1- AC_SUBST([PATH_SEPARATOR]) +m4trace:configure.in:5: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])]) +m4trace:configure.in:5: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])]) +m4trace:configure.in:5: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])]) +m4trace:configure.in:5: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])]) +m4trace:configure.in:5: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])]) +m4trace:configure.in:5: -1- AC_SUBST([exec_prefix], [NONE]) +m4trace:configure.in:5: -1- AC_SUBST([prefix], [NONE]) +m4trace:configure.in:5: -1- AC_SUBST([program_transform_name], [s,x,x,]) +m4trace:configure.in:5: -1- AC_SUBST([bindir], ['${exec_prefix}/bin']) +m4trace:configure.in:5: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin']) +m4trace:configure.in:5: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec']) +m4trace:configure.in:5: -1- AC_SUBST([datadir], ['${prefix}/share']) +m4trace:configure.in:5: -1- AC_SUBST([sysconfdir], ['${prefix}/etc']) +m4trace:configure.in:5: -1- AC_SUBST([sharedstatedir], ['${prefix}/com']) +m4trace:configure.in:5: -1- AC_SUBST([localstatedir], ['${prefix}/var']) +m4trace:configure.in:5: -1- AC_SUBST([libdir], ['${exec_prefix}/lib']) +m4trace:configure.in:5: -1- AC_SUBST([includedir], ['${prefix}/include']) +m4trace:configure.in:5: -1- AC_SUBST([oldincludedir], ['/usr/include']) +m4trace:configure.in:5: -1- AC_SUBST([infodir], ['${prefix}/info']) +m4trace:configure.in:5: -1- AC_SUBST([mandir], ['${prefix}/man']) +m4trace:configure.in:5: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME]) +m4trace:configure.in:5: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */ +#undef PACKAGE_NAME]) +m4trace:configure.in:5: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME]) +m4trace:configure.in:5: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME]) +m4trace:configure.in:5: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION]) +m4trace:configure.in:5: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */ +#undef PACKAGE_VERSION]) +m4trace:configure.in:5: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING]) +m4trace:configure.in:5: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING]) +m4trace:configure.in:5: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT]) +m4trace:configure.in:5: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT]) +m4trace:configure.in:5: -1- AC_SUBST([build_alias]) +m4trace:configure.in:5: -1- AC_SUBST([host_alias]) +m4trace:configure.in:5: -1- AC_SUBST([target_alias]) +m4trace:configure.in:5: -1- AC_SUBST([DEFS]) +m4trace:configure.in:5: -1- AC_SUBST([ECHO_C]) +m4trace:configure.in:5: -1- AC_SUBST([ECHO_N]) +m4trace:configure.in:5: -1- AC_SUBST([ECHO_T]) +m4trace:configure.in:5: -1- AC_SUBST([LIBS]) +m4trace:configure.in:6: -1- AM_INIT_AUTOMAKE([libsangoma], [1.0.0]) +m4trace:configure.in:6: -1- m4_pattern_allow([^AM_[A-Z]+FLAGS$]) +m4trace:configure.in:6: -1- AM_AUTOMAKE_VERSION([1.9.6]) +m4trace:configure.in:6: -1- AC_PROG_INSTALL +m4trace:configure.in:6: -1- AC_SUBST([INSTALL_PROGRAM]) +m4trace:configure.in:6: -1- AC_SUBST([INSTALL_SCRIPT]) +m4trace:configure.in:6: -1- AC_SUBST([INSTALL_DATA]) +m4trace:configure.in:6: -1- AC_SUBST([CYGPATH_W]) +m4trace:configure.in:6: -1- AC_SUBST([PACKAGE], [libsangoma]) +m4trace:configure.in:6: -1- AC_SUBST([VERSION], [1.0.0]) +m4trace:configure.in:6: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE]) +m4trace:configure.in:6: -1- AH_OUTPUT([PACKAGE], [/* Name of package */ +#undef PACKAGE]) +m4trace:configure.in:6: -1- AC_DEFINE_TRACE_LITERAL([VERSION]) +m4trace:configure.in:6: -1- AH_OUTPUT([VERSION], [/* Version number of package */ +#undef VERSION]) +m4trace:configure.in:6: -1- AC_SUBST([ACLOCAL]) +m4trace:configure.in:6: -1- AC_SUBST([AUTOCONF]) +m4trace:configure.in:6: -1- AC_SUBST([AUTOMAKE]) +m4trace:configure.in:6: -1- AC_SUBST([AUTOHEADER]) +m4trace:configure.in:6: -1- AC_SUBST([MAKEINFO]) +m4trace:configure.in:6: -1- AC_SUBST([install_sh]) +m4trace:configure.in:6: -1- AC_SUBST([STRIP]) +m4trace:configure.in:6: -1- AC_SUBST([ac_ct_STRIP]) +m4trace:configure.in:6: -1- AC_SUBST([INSTALL_STRIP_PROGRAM]) +m4trace:configure.in:6: -1- AC_SUBST([mkdir_p]) +m4trace:configure.in:6: -1- AC_PROG_AWK +m4trace:configure.in:6: -1- AC_SUBST([AWK]) +m4trace:configure.in:6: -1- AC_PROG_MAKE_SET +m4trace:configure.in:6: -1- AC_SUBST([SET_MAKE]) +m4trace:configure.in:6: -1- AC_SUBST([am__leading_dot]) +m4trace:configure.in:6: -1- AC_SUBST([AMTAR]) +m4trace:configure.in:6: -1- AC_SUBST([am__tar]) +m4trace:configure.in:6: -1- AC_SUBST([am__untar]) +m4trace:configure.in:8: -1- AC_PROG_CC +m4trace:configure.in:8: -1- AC_SUBST([CC]) +m4trace:configure.in:8: -1- AC_SUBST([CFLAGS]) +m4trace:configure.in:8: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.in:8: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:8: -1- AC_SUBST([CC]) +m4trace:configure.in:8: -1- AC_SUBST([ac_ct_CC]) +m4trace:configure.in:8: -1- AC_SUBST([CC]) +m4trace:configure.in:8: -1- AC_SUBST([ac_ct_CC]) +m4trace:configure.in:8: -1- AC_SUBST([CC]) +m4trace:configure.in:8: -1- AC_SUBST([CC]) +m4trace:configure.in:8: -1- AC_SUBST([ac_ct_CC]) +m4trace:configure.in:8: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext]) +m4trace:configure.in:8: -1- AC_SUBST([OBJEXT], [$ac_cv_objext]) +m4trace:configure.in:8: -1- AC_SUBST([DEPDIR], ["${am__leading_dot}deps"]) +m4trace:configure.in:8: -1- AC_SUBST([am__include]) +m4trace:configure.in:8: -1- AC_SUBST([am__quote]) +m4trace:configure.in:8: -1- AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +m4trace:configure.in:8: -1- AC_SUBST([AMDEP_TRUE]) +m4trace:configure.in:8: -1- AC_SUBST([AMDEP_FALSE]) +m4trace:configure.in:8: -1- AC_SUBST([AMDEPBACKSLASH]) +m4trace:configure.in:8: -1- AC_SUBST([CCDEPMODE], [depmode=$am_cv_CC_dependencies_compiler_type]) +m4trace:configure.in:8: -1- AM_CONDITIONAL([am__fastdepCC], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3]) +m4trace:configure.in:8: -1- AC_SUBST([am__fastdepCC_TRUE]) +m4trace:configure.in:8: -1- AC_SUBST([am__fastdepCC_FALSE]) +m4trace:configure.in:9: -1- AC_PROG_LIBTOOL +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [autoconf/general.m4:219: AC_HELP_STRING is expanded from... +autoconf/general.m4:1303: AC_ARG_ENABLE is expanded from... +aclocal.m4:1955: AC_ENABLE_SHARED is expanded from... +configure.in:9: AC_ENABLE_SHARED is required by... +aclocal.m4:226: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +aclocal.m4:81: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +aclocal.m4:61: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [autoconf/general.m4:219: AC_HELP_STRING is expanded from... +autoconf/general.m4:1303: AC_ARG_ENABLE is expanded from... +aclocal.m4:1994: AC_ENABLE_STATIC is expanded from... +configure.in:9: AC_ENABLE_STATIC is required by... +aclocal.m4:226: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +aclocal.m4:81: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +aclocal.m4:61: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [autoconf/general.m4:219: AC_HELP_STRING is expanded from... +autoconf/general.m4:1303: AC_ARG_ENABLE is expanded from... +aclocal.m4:2033: AC_ENABLE_FAST_INSTALL is expanded from... +configure.in:9: AC_ENABLE_FAST_INSTALL is required by... +aclocal.m4:226: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +aclocal.m4:81: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +aclocal.m4:61: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- AC_CANONICAL_HOST +m4trace:configure.in:9: -1- AC_CANONICAL_BUILD +m4trace:configure.in:9: -1- AC_SUBST([build], [$ac_cv_build]) +m4trace:configure.in:9: -1- AC_SUBST([build_cpu], [`echo $ac_cv_build | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\1/'`]) +m4trace:configure.in:9: -1- AC_SUBST([build_vendor], [`echo $ac_cv_build | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\2/'`]) +m4trace:configure.in:9: -1- AC_SUBST([build_os], [`echo $ac_cv_build | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\3/'`]) +m4trace:configure.in:9: -1- AC_SUBST([host], [$ac_cv_host]) +m4trace:configure.in:9: -1- AC_SUBST([host_cpu], [`echo $ac_cv_host | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\1/'`]) +m4trace:configure.in:9: -1- AC_SUBST([host_vendor], [`echo $ac_cv_host | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\2/'`]) +m4trace:configure.in:9: -1- AC_SUBST([host_os], [`echo $ac_cv_host | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\3/'`]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [autoconf/general.m4:219: AC_HELP_STRING is expanded from... +autoconf/general.m4:1331: AC_ARG_WITH is expanded from... +aclocal.m4:2230: AC_PROG_LD is expanded from... +configure.in:9: AC_PROG_LD is required by... +aclocal.m4:226: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +aclocal.m4:81: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +aclocal.m4:61: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- AC_SUBST([SED]) +m4trace:configure.in:9: -1- AC_SUBST([EGREP]) +m4trace:configure.in:9: -1- AC_PROG_LN_S +m4trace:configure.in:9: -1- AC_SUBST([LN_S], [$as_ln_s]) +m4trace:configure.in:9: -1- AC_SUBST([ECHO]) +m4trace:configure.in:9: -1- AC_SUBST([AR]) +m4trace:configure.in:9: -1- AC_SUBST([ac_ct_AR]) +m4trace:configure.in:9: -1- AC_SUBST([RANLIB]) +m4trace:configure.in:9: -1- AC_SUBST([ac_ct_RANLIB]) +m4trace:configure.in:9: -1- AC_SUBST([STRIP]) +m4trace:configure.in:9: -1- AC_SUBST([ac_ct_STRIP]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [autoconf/general.m4:219: AC_HELP_STRING is expanded from... +autoconf/general.m4:1303: AC_ARG_ENABLE is expanded from... +aclocal.m4:226: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +aclocal.m4:81: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +aclocal.m4:61: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [autoconf/general.m4:219: AC_HELP_STRING is expanded from... +autoconf/general.m4:1331: AC_ARG_WITH is expanded from... +aclocal.m4:226: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +aclocal.m4:81: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +aclocal.m4:61: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_TRY_LINK' is obsolete. +You should run autoupdate.], [autoconf/general.m4:2223: AC_TRY_LINK is expanded from... +autoconf/general.m4:1799: AC_CACHE_VAL is expanded from... +autoconf/general.m4:1808: AC_CACHE_CHECK is expanded from... +aclocal.m4:614: _LT_AC_LOCK is expanded from... +configure.in:9: _LT_AC_LOCK is required by... +aclocal.m4:1100: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from... +aclocal.m4:2742: _LT_AC_LANG_C_CONFIG is expanded from... +aclocal.m4:2673: AC_LIBTOOL_LANG_C_CONFIG is expanded from... +aclocal.m4:226: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +aclocal.m4:81: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +aclocal.m4:61: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- AC_CHECK_HEADERS([dlfcn.h]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_DLFCN_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H]) +m4trace:configure.in:9: -1- AC_HEADER_STDC +m4trace:configure.in:9: -1- AC_PROG_CPP +m4trace:configure.in:9: -1- AC_SUBST([CPP]) +m4trace:configure.in:9: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:9: -1- AC_SUBST([CPP]) +m4trace:configure.in:9: -1- AC_DEFINE_TRACE_LITERAL([STDC_HEADERS]) +m4trace:configure.in:9: -1- AH_OUTPUT([STDC_HEADERS], [/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS]) +m4trace:configure.in:9: -1- AC_CHECK_HEADERS([sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h], [], [], [$ac_includes_default]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_SYS_TYPES_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_SYS_STAT_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_MEMORY_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_STRINGS_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_INTTYPES_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_STDINT_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H]) +m4trace:configure.in:9: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H]) +m4trace:configure.in:9: -1- 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 + ]) +m4trace:configure.in:9: -1- AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) +m4trace:configure.in:9: -1- AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) +m4trace:configure.in:9: -1- AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) +m4trace:configure.in:9: -1- AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) +m4trace:configure.in:9: -1- _LT_AC_TAGCONFIG +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_HELP_STRING' is obsolete. +You should run autoupdate.], [autoconf/general.m4:219: AC_HELP_STRING is expanded from... +autoconf/general.m4:1331: AC_ARG_WITH is expanded from... +aclocal.m4:1909: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:226: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +aclocal.m4:81: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +aclocal.m4:61: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [back quotes and double quotes must not be escaped in: $as_me:$LINENO: error: tag name \"$tagname\" already exists], [aclocal.m4:1909: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:226: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +aclocal.m4:81: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +aclocal.m4:61: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [back quotes and double quotes must not be escaped in: $as_me: error: tag name \"$tagname\" already exists], [aclocal.m4:1909: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:226: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +aclocal.m4:81: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +aclocal.m4:61: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- AC_PROG_CXX +m4trace:configure.in:9: -1- AC_SUBST([CXX]) +m4trace:configure.in:9: -1- AC_SUBST([CXXFLAGS]) +m4trace:configure.in:9: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.in:9: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:9: -1- AC_SUBST([CXX]) +m4trace:configure.in:9: -1- AC_SUBST([ac_ct_CXX]) +m4trace:configure.in:9: -1- AC_SUBST([CXXDEPMODE], [depmode=$am_cv_CXX_dependencies_compiler_type]) +m4trace:configure.in:9: -1- AM_CONDITIONAL([am__fastdepCXX], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3]) +m4trace:configure.in:9: -1- AC_SUBST([am__fastdepCXX_TRUE]) +m4trace:configure.in:9: -1- AC_SUBST([am__fastdepCXX_FALSE]) +m4trace:configure.in:9: -1- AC_SUBST([CXXCPP]) +m4trace:configure.in:9: -1- AC_SUBST([CPPFLAGS]) +m4trace:configure.in:9: -1- AC_SUBST([CXXCPP]) +m4trace:configure.in:9: -1- AC_SUBST([F77]) +m4trace:configure.in:9: -1- AC_SUBST([FFLAGS]) +m4trace:configure.in:9: -1- AC_SUBST([LDFLAGS]) +m4trace:configure.in:9: -1- AC_SUBST([F77]) +m4trace:configure.in:9: -1- AC_SUBST([ac_ct_F77]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_LANG_SAVE' is obsolete. +You should run autoupdate.], [autoconf/lang.m4:166: AC_LANG_SAVE is expanded from... +aclocal.m4:4063: _LT_AC_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:4015: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:1909: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:226: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +aclocal.m4:81: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +aclocal.m4:61: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [instead of using `AC_LANG', `AC_LANG_SAVE', +and `AC_LANG_RESTORE', you should use `AC_LANG_PUSH' and `AC_LANG_POP'.], [autoconf/lang.m4:166: AC_LANG_SAVE is expanded from... +aclocal.m4:4063: _LT_AC_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:4015: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:1909: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:226: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +aclocal.m4:81: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +aclocal.m4:61: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_LANG_RESTORE' is obsolete. +You should run autoupdate.], [autoconf/lang.m4:172: AC_LANG_RESTORE is expanded from... +aclocal.m4:4063: _LT_AC_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:4015: AC_LIBTOOL_LANG_GCJ_CONFIG is expanded from... +aclocal.m4:1909: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:226: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +aclocal.m4:81: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +aclocal.m4:61: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_LANG_SAVE' is obsolete. +You should run autoupdate.], [autoconf/lang.m4:166: AC_LANG_SAVE is expanded from... +aclocal.m4:4107: _LT_AC_LANG_RC_CONFIG is expanded from... +aclocal.m4:4071: AC_LIBTOOL_LANG_RC_CONFIG is expanded from... +aclocal.m4:1909: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:226: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +aclocal.m4:81: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +aclocal.m4:61: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [instead of using `AC_LANG', `AC_LANG_SAVE', +and `AC_LANG_RESTORE', you should use `AC_LANG_PUSH' and `AC_LANG_POP'.], [autoconf/lang.m4:166: AC_LANG_SAVE is expanded from... +aclocal.m4:4107: _LT_AC_LANG_RC_CONFIG is expanded from... +aclocal.m4:4071: AC_LIBTOOL_LANG_RC_CONFIG is expanded from... +aclocal.m4:1909: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:226: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +aclocal.m4:81: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +aclocal.m4:61: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- _m4_warn([obsolete], [The macro `AC_LANG_RESTORE' is obsolete. +You should run autoupdate.], [autoconf/lang.m4:172: AC_LANG_RESTORE is expanded from... +aclocal.m4:4107: _LT_AC_LANG_RC_CONFIG is expanded from... +aclocal.m4:4071: AC_LIBTOOL_LANG_RC_CONFIG is expanded from... +aclocal.m4:1909: _LT_AC_TAGCONFIG is expanded from... +aclocal.m4:226: AC_LIBTOOL_SETUP is expanded from... +configure.in:9: AC_LIBTOOL_SETUP is required by... +aclocal.m4:81: _AC_PROG_LIBTOOL is expanded from... +configure.in:9: _AC_PROG_LIBTOOL is required by... +aclocal.m4:61: AC_PROG_LIBTOOL is expanded from... +configure.in:9: the top level]) +m4trace:configure.in:9: -1- AC_SUBST([LIBTOOL]) +m4trace:configure.in:10: -1- AC_PROG_RANLIB +m4trace:configure.in:10: -1- AC_SUBST([RANLIB]) +m4trace:configure.in:10: -1- AC_SUBST([ac_ct_RANLIB]) +m4trace:configure.in:13: -1- AC_CHECK_HEADERS([fcntl.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h math.h]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_FCNTL_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_NETINET_IN_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_STDLIB_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_STRING_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_SYS_IOCTL_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_SYS_SOCKET_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_SYS_TIME_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_UNISTD_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H]) +m4trace:configure.in:13: -1- AH_OUTPUT([HAVE_MATH_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_MATH_H]) +m4trace:configure.in:18: -1- AM_CONDITIONAL([LIBPRI], [test -d "$libpripath" ]) +m4trace:configure.in:18: -1- AC_SUBST([LIBPRI_TRUE]) +m4trace:configure.in:18: -1- AC_SUBST([LIBPRI_FALSE]) +m4trace:configure.in:19: -1- AC_SUBST([libpripath]) +m4trace:configure.in:22: -1- AC_HEADER_TIME +m4trace:configure.in:22: -1- AC_DEFINE_TRACE_LITERAL([TIME_WITH_SYS_TIME]) +m4trace:configure.in:22: -1- AH_OUTPUT([TIME_WITH_SYS_TIME], [/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME]) +m4trace:configure.in:25: -1- AC_FUNC_SELECT_ARGTYPES +m4trace:configure.in:25: -1- AC_CHECK_HEADERS([sys/select.h sys/socket.h]) +m4trace:configure.in:25: -1- AH_OUTPUT([HAVE_SYS_SELECT_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H]) +m4trace:configure.in:25: -1- AH_OUTPUT([HAVE_SYS_SOCKET_H], [/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H]) +m4trace:configure.in:25: -1- AC_DEFINE_TRACE_LITERAL([SELECT_TYPE_ARG1]) +m4trace:configure.in:25: -1- AH_OUTPUT([SELECT_TYPE_ARG1], [/* Define to the type of arg 1 for `select\'. */ +#undef SELECT_TYPE_ARG1]) +m4trace:configure.in:25: -1- AC_DEFINE_TRACE_LITERAL([SELECT_TYPE_ARG234]) +m4trace:configure.in:25: -1- AH_OUTPUT([SELECT_TYPE_ARG234], [/* Define to the type of args 2, 3 and 4 for `select\'. */ +#undef SELECT_TYPE_ARG234]) +m4trace:configure.in:25: -1- AC_DEFINE_TRACE_LITERAL([SELECT_TYPE_ARG5]) +m4trace:configure.in:25: -1- AH_OUTPUT([SELECT_TYPE_ARG5], [/* Define to the type of arg 5 for `select\'. */ +#undef SELECT_TYPE_ARG5]) +m4trace:configure.in:26: -1- AC_CHECK_FUNCS([gettimeofday memset select socket]) +m4trace:configure.in:26: -1- AH_OUTPUT([HAVE_GETTIMEOFDAY], [/* Define to 1 if you have the `gettimeofday\' function. */ +#undef HAVE_GETTIMEOFDAY]) +m4trace:configure.in:26: -1- AH_OUTPUT([HAVE_MEMSET], [/* Define to 1 if you have the `memset\' function. */ +#undef HAVE_MEMSET]) +m4trace:configure.in:26: -1- AH_OUTPUT([HAVE_SELECT], [/* Define to 1 if you have the `select\' function. */ +#undef HAVE_SELECT]) +m4trace:configure.in:26: -1- AH_OUTPUT([HAVE_SOCKET], [/* Define to 1 if you have the `socket\' function. */ +#undef HAVE_SOCKET]) +m4trace:configure.in:27: -1- AC_CONFIG_FILES([Makefile]) +m4trace:configure.in:28: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs]) +m4trace:configure.in:28: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs]) diff --git a/api/libsangoma/config.log b/api/libsangoma/config.log index 5a17b0e..676ae3e 100644 --- a/api/libsangoma/config.log +++ b/api/libsangoma/config.log @@ -140,27 +140,27 @@ configure:3150: result: i686-pc-linux-gnu configure:3158: checking host system type configure:3172: result: i686-pc-linux-gnu configure:3180: checking for a sed that does not truncate output -configure:3234: result: /bin/sed -configure:3237: checking for egrep -configure:3247: result: grep -E -configure:3263: checking for ld used by gcc -configure:3330: result: /usr/bin/ld -configure:3339: checking if the linker (/usr/bin/ld) is GNU ld -configure:3354: result: yes -configure:3359: checking for /usr/bin/ld option to reload object files -configure:3366: result: -r -configure:3375: checking for BSD-compatible nm -configure:3417: result: /usr/bin/nm -B -configure:3421: checking whether ln -s works -configure:3425: result: yes -configure:3432: checking how to recognise dependent libraries -configure:3615: result: pass_all -configure:3829: checking how to run the C preprocessor -configure:3864: gcc -E conftest.c -configure:3870: $? = 0 -configure:3902: gcc -E conftest.c +configure:3236: result: /bin/sed +configure:3239: checking for egrep +configure:3249: result: grep -E +configure:3265: checking for ld used by gcc +configure:3332: result: /usr/bin/ld +configure:3341: checking if the linker (/usr/bin/ld) is GNU ld +configure:3356: result: yes +configure:3361: checking for /usr/bin/ld option to reload object files +configure:3368: result: -r +configure:3386: checking for BSD-compatible nm +configure:3435: result: /usr/bin/nm -B +configure:3439: checking whether ln -s works +configure:3443: result: yes +configure:3450: checking how to recognise dependent libraries +configure:3626: result: pass_all +configure:3863: checking how to run the C preprocessor +configure:3898: gcc -E conftest.c +configure:3904: $? = 0 +configure:3936: gcc -E conftest.c conftest.c:11:28: error: ac_nonexistent.h: No such file or directory -configure:3908: $? = 1 +configure:3942: $? = 1 configure: failed program was: | /* confdefs.h. */ | @@ -173,12 +173,12 @@ configure: failed program was: | #define VERSION "1.0.0" | /* end confdefs.h. */ | #include -configure:3947: result: gcc -E -configure:3971: gcc -E conftest.c -configure:3977: $? = 0 -configure:4009: gcc -E conftest.c +configure:3981: result: gcc -E +configure:4005: gcc -E conftest.c +configure:4011: $? = 0 +configure:4043: gcc -E conftest.c conftest.c:11:28: error: ac_nonexistent.h: No such file or directory -configure:4015: $? = 1 +configure:4049: $? = 1 configure: failed program was: | /* confdefs.h. */ | @@ -191,167 +191,167 @@ configure: failed program was: | #define VERSION "1.0.0" | /* end confdefs.h. */ | #include -configure:4059: checking for ANSI C header files -configure:4084: gcc -c -g -O2 conftest.c >&5 -configure:4090: $? = 0 -configure:4094: test -z +configure:4093: checking for ANSI C header files +configure:4118: gcc -c -g -O2 conftest.c >&5 +configure:4124: $? = 0 +configure:4128: test -z || test ! -s conftest.err -configure:4097: $? = 0 -configure:4100: test -s conftest.o -configure:4103: $? = 0 -configure:4192: gcc -o conftest -g -O2 conftest.c >&5 +configure:4131: $? = 0 +configure:4134: test -s conftest.o +configure:4137: $? = 0 +configure:4226: gcc -o conftest -g -O2 conftest.c >&5 conftest.c: In function 'main': conftest.c:28: warning: incompatible implicit declaration of built-in function 'exit' -configure:4195: $? = 0 -configure:4197: ./conftest -configure:4200: $? = 0 -configure:4215: result: yes -configure:4239: checking for sys/types.h -configure:4255: gcc -c -g -O2 conftest.c >&5 -configure:4261: $? = 0 -configure:4265: test -z +configure:4229: $? = 0 +configure:4231: ./conftest +configure:4234: $? = 0 +configure:4249: result: yes +configure:4273: checking for sys/types.h +configure:4289: gcc -c -g -O2 conftest.c >&5 +configure:4295: $? = 0 +configure:4299: test -z || test ! -s conftest.err -configure:4268: $? = 0 -configure:4271: test -s conftest.o -configure:4274: $? = 0 -configure:4285: result: yes -configure:4239: checking for sys/stat.h -configure:4255: gcc -c -g -O2 conftest.c >&5 -configure:4261: $? = 0 -configure:4265: test -z +configure:4302: $? = 0 +configure:4305: test -s conftest.o +configure:4308: $? = 0 +configure:4319: result: yes +configure:4273: checking for sys/stat.h +configure:4289: gcc -c -g -O2 conftest.c >&5 +configure:4295: $? = 0 +configure:4299: test -z || test ! -s conftest.err -configure:4268: $? = 0 -configure:4271: test -s conftest.o -configure:4274: $? = 0 -configure:4285: result: yes -configure:4239: checking for stdlib.h -configure:4255: gcc -c -g -O2 conftest.c >&5 -configure:4261: $? = 0 -configure:4265: test -z +configure:4302: $? = 0 +configure:4305: test -s conftest.o +configure:4308: $? = 0 +configure:4319: result: yes +configure:4273: checking for stdlib.h +configure:4289: gcc -c -g -O2 conftest.c >&5 +configure:4295: $? = 0 +configure:4299: test -z || test ! -s conftest.err -configure:4268: $? = 0 -configure:4271: test -s conftest.o -configure:4274: $? = 0 -configure:4285: result: yes -configure:4239: checking for string.h -configure:4255: gcc -c -g -O2 conftest.c >&5 -configure:4261: $? = 0 -configure:4265: test -z +configure:4302: $? = 0 +configure:4305: test -s conftest.o +configure:4308: $? = 0 +configure:4319: result: yes +configure:4273: checking for string.h +configure:4289: gcc -c -g -O2 conftest.c >&5 +configure:4295: $? = 0 +configure:4299: test -z || test ! -s conftest.err -configure:4268: $? = 0 -configure:4271: test -s conftest.o -configure:4274: $? = 0 -configure:4285: result: yes -configure:4239: checking for memory.h -configure:4255: gcc -c -g -O2 conftest.c >&5 -configure:4261: $? = 0 -configure:4265: test -z +configure:4302: $? = 0 +configure:4305: test -s conftest.o +configure:4308: $? = 0 +configure:4319: result: yes +configure:4273: checking for memory.h +configure:4289: gcc -c -g -O2 conftest.c >&5 +configure:4295: $? = 0 +configure:4299: test -z || test ! -s conftest.err -configure:4268: $? = 0 -configure:4271: test -s conftest.o -configure:4274: $? = 0 -configure:4285: result: yes -configure:4239: checking for strings.h -configure:4255: gcc -c -g -O2 conftest.c >&5 -configure:4261: $? = 0 -configure:4265: test -z +configure:4302: $? = 0 +configure:4305: test -s conftest.o +configure:4308: $? = 0 +configure:4319: result: yes +configure:4273: checking for strings.h +configure:4289: gcc -c -g -O2 conftest.c >&5 +configure:4295: $? = 0 +configure:4299: test -z || test ! -s conftest.err -configure:4268: $? = 0 -configure:4271: test -s conftest.o -configure:4274: $? = 0 -configure:4285: result: yes -configure:4239: checking for inttypes.h -configure:4255: gcc -c -g -O2 conftest.c >&5 -configure:4261: $? = 0 -configure:4265: test -z +configure:4302: $? = 0 +configure:4305: test -s conftest.o +configure:4308: $? = 0 +configure:4319: result: yes +configure:4273: checking for inttypes.h +configure:4289: gcc -c -g -O2 conftest.c >&5 +configure:4295: $? = 0 +configure:4299: test -z || test ! -s conftest.err -configure:4268: $? = 0 -configure:4271: test -s conftest.o -configure:4274: $? = 0 -configure:4285: result: yes -configure:4239: checking for stdint.h -configure:4255: gcc -c -g -O2 conftest.c >&5 -configure:4261: $? = 0 -configure:4265: test -z +configure:4302: $? = 0 +configure:4305: test -s conftest.o +configure:4308: $? = 0 +configure:4319: result: yes +configure:4273: checking for stdint.h +configure:4289: gcc -c -g -O2 conftest.c >&5 +configure:4295: $? = 0 +configure:4299: test -z || test ! -s conftest.err -configure:4268: $? = 0 -configure:4271: test -s conftest.o -configure:4274: $? = 0 -configure:4285: result: yes -configure:4239: checking for unistd.h -configure:4255: gcc -c -g -O2 conftest.c >&5 -configure:4261: $? = 0 -configure:4265: test -z +configure:4302: $? = 0 +configure:4305: test -s conftest.o +configure:4308: $? = 0 +configure:4319: result: yes +configure:4273: checking for unistd.h +configure:4289: gcc -c -g -O2 conftest.c >&5 +configure:4295: $? = 0 +configure:4299: test -z || test ! -s conftest.err -configure:4268: $? = 0 -configure:4271: test -s conftest.o -configure:4274: $? = 0 -configure:4285: result: yes -configure:4311: checking dlfcn.h usability -configure:4323: gcc -c -g -O2 conftest.c >&5 -configure:4329: $? = 0 -configure:4333: test -z +configure:4302: $? = 0 +configure:4305: test -s conftest.o +configure:4308: $? = 0 +configure:4319: result: yes +configure:4345: checking dlfcn.h usability +configure:4357: gcc -c -g -O2 conftest.c >&5 +configure:4363: $? = 0 +configure:4367: test -z || test ! -s conftest.err -configure:4336: $? = 0 -configure:4339: test -s conftest.o -configure:4342: $? = 0 -configure:4352: result: yes -configure:4356: checking dlfcn.h presence -configure:4366: gcc -E conftest.c -configure:4372: $? = 0 -configure:4392: result: yes -configure:4427: checking for dlfcn.h -configure:4434: result: yes -configure:4499: checking for g++ -configure:4515: found /usr/bin/g++ -configure:4525: result: g++ -configure:4541: checking for C++ compiler version -configure:4544: g++ --version &5 +configure:4370: $? = 0 +configure:4373: test -s conftest.o +configure:4376: $? = 0 +configure:4386: result: yes +configure:4390: checking dlfcn.h presence +configure:4400: gcc -E conftest.c +configure:4406: $? = 0 +configure:4426: result: yes +configure:4461: checking for dlfcn.h +configure:4468: result: yes +configure:4533: checking for g++ +configure:4549: found /usr/bin/g++ +configure:4559: result: g++ +configure:4575: checking for C++ compiler version +configure:4578: g++ --version &5 g++ (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52) Copyright (C) 2006 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. -configure:4547: $? = 0 -configure:4549: g++ -v &5 +configure:4581: $? = 0 +configure:4583: g++ -v &5 Using built-in specs. Target: i386-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux Thread model: posix gcc version 4.1.1 20070105 (Red Hat 4.1.1-52) -configure:4552: $? = 0 -configure:4554: g++ -V &5 +configure:4586: $? = 0 +configure:4588: g++ -V &5 g++: '-V' option must have argument -configure:4557: $? = 1 -configure:4560: checking whether we are using the GNU C++ compiler -configure:4584: g++ -c conftest.cc >&5 -configure:4590: $? = 0 -configure:4594: test -z +configure:4591: $? = 1 +configure:4594: checking whether we are using the GNU C++ compiler +configure:4618: g++ -c conftest.cc >&5 +configure:4624: $? = 0 +configure:4628: test -z || test ! -s conftest.err -configure:4597: $? = 0 -configure:4600: test -s conftest.o -configure:4603: $? = 0 -configure:4616: result: yes -configure:4622: checking whether g++ accepts -g -configure:4643: g++ -c -g conftest.cc >&5 -configure:4649: $? = 0 -configure:4653: test -z +configure:4631: $? = 0 +configure:4634: test -s conftest.o +configure:4637: $? = 0 +configure:4650: result: yes +configure:4656: checking whether g++ accepts -g +configure:4677: g++ -c -g conftest.cc >&5 +configure:4683: $? = 0 +configure:4687: test -z || test ! -s conftest.err -configure:4656: $? = 0 -configure:4659: test -s conftest.o -configure:4662: $? = 0 -configure:4673: result: yes -configure:4715: g++ -c -g -O2 conftest.cc >&5 -configure:4721: $? = 0 -configure:4725: test -z +configure:4690: $? = 0 +configure:4693: test -s conftest.o +configure:4696: $? = 0 +configure:4707: result: yes +configure:4749: g++ -c -g -O2 conftest.cc >&5 +configure:4755: $? = 0 +configure:4759: test -z || test ! -s conftest.err -configure:4728: $? = 0 -configure:4731: test -s conftest.o -configure:4734: $? = 0 -configure:4760: g++ -c -g -O2 conftest.cc >&5 +configure:4762: $? = 0 +configure:4765: test -s conftest.o +configure:4768: $? = 0 +configure:4794: g++ -c -g -O2 conftest.cc >&5 conftest.cc: In function 'int main()': conftest.cc:26: error: 'exit' was not declared in this scope -configure:4766: $? = 1 +configure:4800: $? = 1 configure: failed program was: | /* confdefs.h. */ | @@ -382,28 +382,28 @@ configure: failed program was: | ; | return 0; | } -configure:4715: g++ -c -g -O2 conftest.cc >&5 -configure:4721: $? = 0 -configure:4725: test -z +configure:4749: g++ -c -g -O2 conftest.cc >&5 +configure:4755: $? = 0 +configure:4759: test -z || test ! -s conftest.err -configure:4728: $? = 0 -configure:4731: test -s conftest.o -configure:4734: $? = 0 -configure:4760: g++ -c -g -O2 conftest.cc >&5 -configure:4766: $? = 0 -configure:4770: test -z +configure:4762: $? = 0 +configure:4765: test -s conftest.o +configure:4768: $? = 0 +configure:4794: g++ -c -g -O2 conftest.cc >&5 +configure:4800: $? = 0 +configure:4804: test -z || test ! -s conftest.err -configure:4773: $? = 0 -configure:4776: test -s conftest.o -configure:4779: $? = 0 -configure:4804: checking dependency style of g++ -configure:4894: result: gcc3 -configure:4916: checking how to run the C++ preprocessor -configure:4947: g++ -E conftest.cc -configure:4953: $? = 0 -configure:4985: g++ -E conftest.cc +configure:4807: $? = 0 +configure:4810: test -s conftest.o +configure:4813: $? = 0 +configure:4838: checking dependency style of g++ +configure:4928: result: gcc3 +configure:4955: checking how to run the C++ preprocessor +configure:4986: g++ -E conftest.cc +configure:4992: $? = 0 +configure:5024: g++ -E conftest.cc conftest.cc:25:28: error: ac_nonexistent.h: No such file or directory -configure:4991: $? = 1 +configure:5030: $? = 1 configure: failed program was: | /* confdefs.h. */ | @@ -430,12 +430,12 @@ configure: failed program was: | #endif | /* end confdefs.h. */ | #include -configure:5030: result: g++ -E -configure:5054: g++ -E conftest.cc -configure:5060: $? = 0 -configure:5092: g++ -E conftest.cc +configure:5069: result: g++ -E +configure:5093: g++ -E conftest.cc +configure:5099: $? = 0 +configure:5131: g++ -E conftest.cc conftest.cc:25:28: error: ac_nonexistent.h: No such file or directory -configure:5098: $? = 1 +configure:5137: $? = 1 configure: failed program was: | /* confdefs.h. */ | @@ -462,35 +462,35 @@ configure: failed program was: | #endif | /* end confdefs.h. */ | #include -configure:5193: checking for g77 -configure:5222: result: no -configure:5193: checking for f77 -configure:5222: result: no -configure:5193: checking for xlf -configure:5222: result: no -configure:5193: checking for frt -configure:5222: result: no -configure:5193: checking for pgf77 -configure:5222: result: no -configure:5193: checking for fort77 -configure:5222: result: no -configure:5193: checking for fl32 -configure:5222: result: no -configure:5193: checking for af77 -configure:5222: result: no -configure:5193: checking for f90 -configure:5222: result: no -configure:5193: checking for xlf90 -configure:5222: result: no -configure:5193: checking for pgf90 -configure:5222: result: no -configure:5193: checking for epcf90 -configure:5222: result: no -configure:5193: checking for f95 -configure:5209: found /usr/bin/f95 -configure:5219: result: f95 -configure:5234: checking for Fortran 77 compiler version -configure:5237: f95 --version &5 +configure:5234: checking for g77 +configure:5263: result: no +configure:5234: checking for f77 +configure:5263: result: no +configure:5234: checking for xlf +configure:5263: result: no +configure:5234: checking for frt +configure:5263: result: no +configure:5234: checking for pgf77 +configure:5263: result: no +configure:5234: checking for fort77 +configure:5263: result: no +configure:5234: checking for fl32 +configure:5263: result: no +configure:5234: checking for af77 +configure:5263: result: no +configure:5234: checking for f90 +configure:5263: result: no +configure:5234: checking for xlf90 +configure:5263: result: no +configure:5234: checking for pgf90 +configure:5263: result: no +configure:5234: checking for epcf90 +configure:5263: result: no +configure:5234: checking for f95 +configure:5250: found /usr/bin/f95 +configure:5260: result: f95 +configure:5275: checking for Fortran 77 compiler version +configure:5278: f95 --version &5 GNU Fortran 95 (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52) Copyright (C) 2006 Free Software Foundation, Inc. @@ -499,315 +499,315 @@ You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING -configure:5240: $? = 0 -configure:5242: f95 -v &5 +configure:5281: $? = 0 +configure:5283: f95 -v &5 Using built-in specs. Target: i386-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux Thread model: posix gcc version 4.1.1 20070105 (Red Hat 4.1.1-52) -configure:5245: $? = 0 -configure:5247: f95 -V &5 +configure:5286: $? = 0 +configure:5288: f95 -V &5 f95: '-V' option must have argument -configure:5250: $? = 1 -configure:5258: checking whether we are using the GNU Fortran 77 compiler -configure:5272: f95 -c conftest.F >&5 -configure:5278: $? = 0 -configure:5282: test -z +configure:5291: $? = 1 +configure:5299: checking whether we are using the GNU Fortran 77 compiler +configure:5313: f95 -c conftest.F >&5 +configure:5319: $? = 0 +configure:5323: test -z || test ! -s conftest.err -configure:5285: $? = 0 -configure:5288: test -s conftest.o -configure:5291: $? = 0 -configure:5304: result: yes -configure:5310: checking whether f95 accepts -g -configure:5322: f95 -c -g conftest.f >&5 -configure:5328: $? = 0 -configure:5332: test -z +configure:5326: $? = 0 +configure:5329: test -s conftest.o +configure:5332: $? = 0 +configure:5345: result: yes +configure:5351: checking whether f95 accepts -g +configure:5363: f95 -c -g conftest.f >&5 +configure:5369: $? = 0 +configure:5373: test -z || test ! -s conftest.err -configure:5335: $? = 0 -configure:5338: test -s conftest.o -configure:5341: $? = 0 -configure:5353: result: yes -configure:5383: checking the maximum length of command line arguments -configure:5448: result: 32768 -configure:5459: checking command to parse /usr/bin/nm -B output from gcc object -configure:5548: gcc -c -g -O2 conftest.c >&5 -configure:5551: $? = 0 -configure:5555: /usr/bin/nm -B conftest.o \| sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\(\)\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2\3 \3/p' \> conftest.nm -configure:5558: $? = 0 -configure:5610: gcc -o conftest -g -O2 conftest.c conftstm.o >&5 -configure:5613: $? = 0 -configure:5651: result: ok -configure:5655: checking for objdir -configure:5670: result: .libs -configure:5760: checking for ar -configure:5776: found /usr/bin/ar -configure:5787: result: ar -configure:5840: checking for ranlib -configure:5856: found /usr/bin/ranlib -configure:5867: result: ranlib -configure:5920: checking for strip -configure:5936: found /usr/bin/strip -configure:5947: result: strip -configure:6209: checking if gcc static flag works -configure:6232: result: yes -configure:6250: checking if gcc supports -fno-rtti -fno-exceptions -configure:6268: gcc -c -g -O2 -fno-rtti -fno-exceptions conftest.c >&5 +configure:5376: $? = 0 +configure:5379: test -s conftest.o +configure:5382: $? = 0 +configure:5394: result: yes +configure:5424: checking the maximum length of command line arguments +configure:5533: result: 32768 +configure:5544: checking command to parse /usr/bin/nm -B output from gcc object +configure:5649: gcc -c -g -O2 conftest.c >&5 +configure:5652: $? = 0 +configure:5656: /usr/bin/nm -B conftest.o \| sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' \> conftest.nm +configure:5659: $? = 0 +configure:5711: gcc -o conftest -g -O2 conftest.c conftstm.o >&5 +configure:5714: $? = 0 +configure:5752: result: ok +configure:5756: checking for objdir +configure:5771: result: .libs +configure:5861: checking for ar +configure:5877: found /usr/bin/ar +configure:5888: result: ar +configure:5941: checking for ranlib +configure:5957: found /usr/bin/ranlib +configure:5968: result: ranlib +configure:6021: checking for strip +configure:6037: found /usr/bin/strip +configure:6048: result: strip +configure:6320: checking if gcc supports -fno-rtti -fno-exceptions +configure:6338: gcc -c -g -O2 -fno-rtti -fno-exceptions conftest.c >&5 cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not for C -configure:6272: $? = 0 -configure:6283: result: no -configure:6298: checking for gcc option to produce PIC -configure:6475: result: -fPIC -configure:6483: checking if gcc PIC flag -fPIC works -configure:6501: gcc -c -g -O2 -fPIC -DPIC conftest.c >&5 -configure:6505: $? = 0 -configure:6516: result: yes -configure:6540: checking if gcc supports -c -o file.o -configure:6561: gcc -c -g -O2 -o out/conftest2.o conftest.c >&5 -configure:6565: $? = 0 -configure:6585: result: yes -configure:6611: checking whether the gcc linker (/usr/bin/ld) supports shared libraries -configure:7459: result: yes -configure:7485: checking whether -lc should be explicitly linked in -configure:7490: gcc -c -g -O2 conftest.c >&5 -configure:7493: $? = 0 -configure:7507: gcc -shared conftest.o -v -Wl,-soname -Wl,conftest -o conftest 2\>\&1 \| grep -lc \>/dev/null 2\>\&1 -configure:7510: $? = 0 -configure:7522: result: no -configure:7530: checking dynamic linker characteristics -configure:8091: result: GNU/Linux ld.so -configure:8095: checking how to hardcode library paths into programs -configure:8120: result: immediate -configure:8134: checking whether stripping libraries is possible -configure:8139: result: yes -configure:8969: checking if libtool supports shared libraries -configure:8971: result: yes -configure:8974: checking whether to build shared libraries -configure:9032: result: yes -configure:9035: checking whether to build static libraries -configure:9039: result: yes -configure:9131: creating libtool -configure:9678: checking for ld used by g++ -configure:9745: result: /usr/bin/ld -configure:9754: checking if the linker (/usr/bin/ld) is GNU ld -configure:9769: result: yes -configure:9820: checking whether the g++ linker (/usr/bin/ld) supports shared libraries -configure:10648: result: yes -configure:10666: g++ -c -g -O2 conftest.cc >&5 -configure:10669: $? = 0 -configure:10765: checking for g++ option to produce PIC -configure:11017: result: -fPIC -configure:11025: checking if g++ PIC flag -fPIC works -configure:11043: g++ -c -g -O2 -fPIC -DPIC conftest.cc >&5 -configure:11047: $? = 0 -configure:11058: result: yes -configure:11082: checking if g++ supports -c -o file.o -configure:11103: g++ -c -g -O2 -o out/conftest2.o conftest.cc >&5 -configure:11107: $? = 0 -configure:11127: result: yes -configure:11153: checking whether the g++ linker (/usr/bin/ld) supports shared libraries -configure:11178: result: yes -configure:11249: checking dynamic linker characteristics -configure:11810: result: GNU/Linux ld.so -configure:11814: checking how to hardcode library paths into programs -configure:11839: result: immediate -configure:11853: checking whether stripping libraries is possible -configure:11858: result: yes -configure:13165: checking if libtool supports shared libraries -configure:13167: result: yes -configure:13170: checking whether to build shared libraries -configure:13188: result: yes -configure:13191: checking whether to build static libraries -configure:13195: result: yes -configure:13207: checking for f95 option to produce PIC -configure:13384: result: -fPIC -configure:13392: checking if f95 PIC flag -fPIC works -configure:13410: f95 -c -g -O2 -fPIC conftest.f >&5 -configure:13414: $? = 0 -configure:13425: result: yes -configure:13449: checking if f95 supports -c -o file.o -configure:13470: f95 -c -g -O2 -o out/conftest2.o conftest.f >&5 -configure:13474: $? = 0 -configure:13494: result: yes -configure:13520: checking whether the f95 linker (/usr/bin/ld) supports shared libraries -configure:14348: result: yes -configure:14419: checking dynamic linker characteristics -configure:14980: result: GNU/Linux ld.so -configure:14984: checking how to hardcode library paths into programs -configure:15009: result: immediate -configure:15023: checking whether stripping libraries is possible -configure:15028: result: yes -configure:19176: checking for ranlib -configure:19203: result: ranlib -configure:19239: checking fcntl.h usability -configure:19251: gcc -c -g -O2 conftest.c >&5 -configure:19257: $? = 0 -configure:19261: test -z +configure:6342: $? = 0 +configure:6355: result: no +configure:6370: checking for gcc option to produce PIC +configure:6580: result: -fPIC +configure:6588: checking if gcc PIC flag -fPIC works +configure:6606: gcc -c -g -O2 -fPIC -DPIC conftest.c >&5 +configure:6610: $? = 0 +configure:6623: result: yes +configure:6651: checking if gcc static flag -static works +configure:6679: result: yes +configure:6689: checking if gcc supports -c -o file.o +configure:6710: gcc -c -g -O2 -o out/conftest2.o conftest.c >&5 +configure:6714: $? = 0 +configure:6736: result: yes +configure:6762: checking whether the gcc linker (/usr/bin/ld) supports shared libraries +configure:7720: result: yes +configure:7741: checking whether -lc should be explicitly linked in +configure:7746: gcc -c -g -O2 conftest.c >&5 +configure:7749: $? = 0 +configure:7764: gcc -shared conftest.o -v -Wl,-soname -Wl,conftest -o conftest 2\>\&1 \| grep -lc \>/dev/null 2\>\&1 +configure:7767: $? = 0 +configure:7779: result: no +configure:7787: checking dynamic linker characteristics +configure:8396: result: GNU/Linux ld.so +configure:8405: checking how to hardcode library paths into programs +configure:8430: result: immediate +configure:8444: checking whether stripping libraries is possible +configure:8449: result: yes +configure:9283: checking if libtool supports shared libraries +configure:9285: result: yes +configure:9288: checking whether to build shared libraries +configure:9309: result: yes +configure:9312: checking whether to build static libraries +configure:9316: result: yes +configure:9408: creating libtool +configure:9999: checking for ld used by g++ +configure:10066: result: /usr/bin/ld +configure:10075: checking if the linker (/usr/bin/ld) is GNU ld +configure:10090: result: yes +configure:10141: checking whether the g++ linker (/usr/bin/ld) supports shared libraries +configure:11079: result: yes +configure:11097: g++ -c -g -O2 conftest.cpp >&5 +configure:11100: $? = 0 +configure:11219: checking for g++ option to produce PIC +configure:11493: result: -fPIC +configure:11501: checking if g++ PIC flag -fPIC works +configure:11519: g++ -c -g -O2 -fPIC -DPIC conftest.cpp >&5 +configure:11523: $? = 0 +configure:11536: result: yes +configure:11564: checking if g++ static flag -static works +configure:11592: result: yes +configure:11602: checking if g++ supports -c -o file.o +configure:11623: g++ -c -g -O2 -o out/conftest2.o conftest.cpp >&5 +configure:11627: $? = 0 +configure:11649: result: yes +configure:11675: checking whether the g++ linker (/usr/bin/ld) supports shared libraries +configure:11700: result: yes +configure:11767: checking dynamic linker characteristics +configure:12376: result: GNU/Linux ld.so +configure:12385: checking how to hardcode library paths into programs +configure:12410: result: immediate +configure:12939: checking if libtool supports shared libraries +configure:12941: result: yes +configure:12944: checking whether to build shared libraries +configure:12964: result: yes +configure:12967: checking whether to build static libraries +configure:12971: result: yes +configure:12981: checking for f95 option to produce PIC +configure:13191: result: -fPIC +configure:13199: checking if f95 PIC flag -fPIC works +configure:13217: f95 -c -g -O2 -fPIC conftest.f >&5 +configure:13221: $? = 0 +configure:13234: result: yes +configure:13262: checking if f95 static flag -static works +configure:13290: result: yes +configure:13300: checking if f95 supports -c -o file.o +configure:13321: f95 -c -g -O2 -o out/conftest2.o conftest.f >&5 +configure:13325: $? = 0 +configure:13347: result: yes +configure:13373: checking whether the f95 linker (/usr/bin/ld) supports shared libraries +configure:14311: result: yes +configure:14378: checking dynamic linker characteristics +configure:14987: result: GNU/Linux ld.so +configure:14996: checking how to hardcode library paths into programs +configure:15021: result: immediate +configure:18655: checking for ranlib +configure:18682: result: ranlib +configure:18718: checking fcntl.h usability +configure:18730: gcc -c -g -O2 conftest.c >&5 +configure:18736: $? = 0 +configure:18740: test -z || test ! -s conftest.err -configure:19264: $? = 0 -configure:19267: test -s conftest.o -configure:19270: $? = 0 -configure:19280: result: yes -configure:19284: checking fcntl.h presence -configure:19294: gcc -E conftest.c -configure:19300: $? = 0 -configure:19320: result: yes -configure:19355: checking for fcntl.h -configure:19362: result: yes -configure:19239: checking netinet/in.h usability -configure:19251: gcc -c -g -O2 conftest.c >&5 -configure:19257: $? = 0 -configure:19261: test -z +configure:18743: $? = 0 +configure:18746: test -s conftest.o +configure:18749: $? = 0 +configure:18759: result: yes +configure:18763: checking fcntl.h presence +configure:18773: gcc -E conftest.c +configure:18779: $? = 0 +configure:18799: result: yes +configure:18834: checking for fcntl.h +configure:18841: result: yes +configure:18718: checking netinet/in.h usability +configure:18730: gcc -c -g -O2 conftest.c >&5 +configure:18736: $? = 0 +configure:18740: test -z || test ! -s conftest.err -configure:19264: $? = 0 -configure:19267: test -s conftest.o -configure:19270: $? = 0 -configure:19280: result: yes -configure:19284: checking netinet/in.h presence -configure:19294: gcc -E conftest.c -configure:19300: $? = 0 -configure:19320: result: yes -configure:19355: checking for netinet/in.h -configure:19362: result: yes -configure:19230: checking for stdlib.h -configure:19235: result: yes -configure:19230: checking for string.h -configure:19235: result: yes -configure:19239: checking sys/ioctl.h usability -configure:19251: gcc -c -g -O2 conftest.c >&5 -configure:19257: $? = 0 -configure:19261: test -z +configure:18743: $? = 0 +configure:18746: test -s conftest.o +configure:18749: $? = 0 +configure:18759: result: yes +configure:18763: checking netinet/in.h presence +configure:18773: gcc -E conftest.c +configure:18779: $? = 0 +configure:18799: result: yes +configure:18834: checking for netinet/in.h +configure:18841: result: yes +configure:18709: checking for stdlib.h +configure:18714: result: yes +configure:18709: checking for string.h +configure:18714: result: yes +configure:18718: checking sys/ioctl.h usability +configure:18730: gcc -c -g -O2 conftest.c >&5 +configure:18736: $? = 0 +configure:18740: test -z || test ! -s conftest.err -configure:19264: $? = 0 -configure:19267: test -s conftest.o -configure:19270: $? = 0 -configure:19280: result: yes -configure:19284: checking sys/ioctl.h presence -configure:19294: gcc -E conftest.c -configure:19300: $? = 0 -configure:19320: result: yes -configure:19355: checking for sys/ioctl.h -configure:19362: result: yes -configure:19239: checking sys/socket.h usability -configure:19251: gcc -c -g -O2 conftest.c >&5 -configure:19257: $? = 0 -configure:19261: test -z +configure:18743: $? = 0 +configure:18746: test -s conftest.o +configure:18749: $? = 0 +configure:18759: result: yes +configure:18763: checking sys/ioctl.h presence +configure:18773: gcc -E conftest.c +configure:18779: $? = 0 +configure:18799: result: yes +configure:18834: checking for sys/ioctl.h +configure:18841: result: yes +configure:18718: checking sys/socket.h usability +configure:18730: gcc -c -g -O2 conftest.c >&5 +configure:18736: $? = 0 +configure:18740: test -z || test ! -s conftest.err -configure:19264: $? = 0 -configure:19267: test -s conftest.o -configure:19270: $? = 0 -configure:19280: result: yes -configure:19284: checking sys/socket.h presence -configure:19294: gcc -E conftest.c -configure:19300: $? = 0 -configure:19320: result: yes -configure:19355: checking for sys/socket.h -configure:19362: result: yes -configure:19239: checking sys/time.h usability -configure:19251: gcc -c -g -O2 conftest.c >&5 -configure:19257: $? = 0 -configure:19261: test -z +configure:18743: $? = 0 +configure:18746: test -s conftest.o +configure:18749: $? = 0 +configure:18759: result: yes +configure:18763: checking sys/socket.h presence +configure:18773: gcc -E conftest.c +configure:18779: $? = 0 +configure:18799: result: yes +configure:18834: checking for sys/socket.h +configure:18841: result: yes +configure:18718: checking sys/time.h usability +configure:18730: gcc -c -g -O2 conftest.c >&5 +configure:18736: $? = 0 +configure:18740: test -z || test ! -s conftest.err -configure:19264: $? = 0 -configure:19267: test -s conftest.o -configure:19270: $? = 0 -configure:19280: result: yes -configure:19284: checking sys/time.h presence -configure:19294: gcc -E conftest.c -configure:19300: $? = 0 -configure:19320: result: yes -configure:19355: checking for sys/time.h -configure:19362: result: yes -configure:19230: checking for unistd.h -configure:19235: result: yes -configure:19239: checking math.h usability -configure:19251: gcc -c -g -O2 conftest.c >&5 -configure:19257: $? = 0 -configure:19261: test -z +configure:18743: $? = 0 +configure:18746: test -s conftest.o +configure:18749: $? = 0 +configure:18759: result: yes +configure:18763: checking sys/time.h presence +configure:18773: gcc -E conftest.c +configure:18779: $? = 0 +configure:18799: result: yes +configure:18834: checking for sys/time.h +configure:18841: result: yes +configure:18709: checking for unistd.h +configure:18714: result: yes +configure:18718: checking math.h usability +configure:18730: gcc -c -g -O2 conftest.c >&5 +configure:18736: $? = 0 +configure:18740: test -z || test ! -s conftest.err -configure:19264: $? = 0 -configure:19267: test -s conftest.o -configure:19270: $? = 0 -configure:19280: result: yes -configure:19284: checking math.h presence -configure:19294: gcc -E conftest.c -configure:19300: $? = 0 -configure:19320: result: yes -configure:19355: checking for math.h -configure:19362: result: yes -configure:19396: checking whether time.h and sys/time.h may both be included -configure:19421: gcc -c -g -O2 conftest.c >&5 -configure:19427: $? = 0 -configure:19431: test -z +configure:18743: $? = 0 +configure:18746: test -s conftest.o +configure:18749: $? = 0 +configure:18759: result: yes +configure:18763: checking math.h presence +configure:18773: gcc -E conftest.c +configure:18779: $? = 0 +configure:18799: result: yes +configure:18834: checking for math.h +configure:18841: result: yes +configure:18875: checking whether time.h and sys/time.h may both be included +configure:18900: gcc -c -g -O2 conftest.c >&5 +configure:18906: $? = 0 +configure:18910: test -z || test ! -s conftest.err -configure:19434: $? = 0 -configure:19437: test -s conftest.o -configure:19440: $? = 0 -configure:19451: result: yes -configure:19478: checking sys/select.h usability -configure:19490: gcc -c -g -O2 conftest.c >&5 -configure:19496: $? = 0 -configure:19500: test -z +configure:18913: $? = 0 +configure:18916: test -s conftest.o +configure:18919: $? = 0 +configure:18930: result: yes +configure:18957: checking sys/select.h usability +configure:18969: gcc -c -g -O2 conftest.c >&5 +configure:18975: $? = 0 +configure:18979: test -z || test ! -s conftest.err -configure:19503: $? = 0 -configure:19506: test -s conftest.o -configure:19509: $? = 0 -configure:19519: result: yes -configure:19523: checking sys/select.h presence -configure:19533: gcc -E conftest.c -configure:19539: $? = 0 -configure:19559: result: yes -configure:19594: checking for sys/select.h -configure:19601: result: yes -configure:19469: checking for sys/socket.h -configure:19474: result: yes -configure:19614: checking types of arguments for select -configure:19647: gcc -c -g -O2 conftest.c >&5 -configure:19653: $? = 0 -configure:19657: test -z +configure:18982: $? = 0 +configure:18985: test -s conftest.o +configure:18988: $? = 0 +configure:18998: result: yes +configure:19002: checking sys/select.h presence +configure:19012: gcc -E conftest.c +configure:19018: $? = 0 +configure:19038: result: yes +configure:19073: checking for sys/select.h +configure:19080: result: yes +configure:18948: checking for sys/socket.h +configure:18953: result: yes +configure:19093: checking types of arguments for select +configure:19126: gcc -c -g -O2 conftest.c >&5 +configure:19132: $? = 0 +configure:19136: test -z || test ! -s conftest.err -configure:19660: $? = 0 -configure:19663: test -s conftest.o -configure:19666: $? = 0 -configure:19682: result: int,fd_set *,struct timeval * -configure:19712: checking for gettimeofday -configure:19769: gcc -o conftest -g -O2 conftest.c >&5 -configure:19775: $? = 0 -configure:19779: test -z +configure:19139: $? = 0 +configure:19142: test -s conftest.o +configure:19145: $? = 0 +configure:19161: result: int,fd_set *,struct timeval * +configure:19191: checking for gettimeofday +configure:19248: gcc -o conftest -g -O2 conftest.c >&5 +configure:19254: $? = 0 +configure:19258: test -z || test ! -s conftest.err -configure:19782: $? = 0 -configure:19785: test -s conftest -configure:19788: $? = 0 -configure:19800: result: yes -configure:19712: checking for memset -configure:19769: gcc -o conftest -g -O2 conftest.c >&5 +configure:19261: $? = 0 +configure:19264: test -s conftest +configure:19267: $? = 0 +configure:19279: result: yes +configure:19191: checking for memset +configure:19248: gcc -o conftest -g -O2 conftest.c >&5 conftest.c:65: warning: conflicting types for built-in function 'memset' -configure:19775: $? = 0 -configure:19779: test -z +configure:19254: $? = 0 +configure:19258: test -z || test ! -s conftest.err -configure:19782: $? = 0 -configure:19785: test -s conftest -configure:19788: $? = 0 -configure:19800: result: yes -configure:19712: checking for select -configure:19769: gcc -o conftest -g -O2 conftest.c >&5 -configure:19775: $? = 0 -configure:19779: test -z +configure:19261: $? = 0 +configure:19264: test -s conftest +configure:19267: $? = 0 +configure:19279: result: yes +configure:19191: checking for select +configure:19248: gcc -o conftest -g -O2 conftest.c >&5 +configure:19254: $? = 0 +configure:19258: test -z || test ! -s conftest.err -configure:19782: $? = 0 -configure:19785: test -s conftest -configure:19788: $? = 0 -configure:19800: result: yes -configure:19712: checking for socket -configure:19769: gcc -o conftest -g -O2 conftest.c >&5 -configure:19775: $? = 0 -configure:19779: test -z +configure:19261: $? = 0 +configure:19264: test -s conftest +configure:19267: $? = 0 +configure:19279: result: yes +configure:19191: checking for socket +configure:19248: gcc -o conftest -g -O2 conftest.c >&5 +configure:19254: $? = 0 +configure:19258: test -z || test ! -s conftest.err -configure:19782: $? = 0 -configure:19785: test -s conftest -configure:19788: $? = 0 -configure:19800: result: yes -configure:19966: creating ./config.status +configure:19261: $? = 0 +configure:19264: test -s conftest +configure:19267: $? = 0 +configure:19279: result: yes +configure:19445: creating ./config.status ## ---------------------- ## ## Running config.status. ## @@ -824,8 +824,8 @@ generated by GNU Autoconf 2.59. Invocation command line was on tesla -config.status:709: creating Makefile -config.status:892: executing depfiles commands +config.status:710: creating Makefile +config.status:893: executing depfiles commands ## ---------------- ## ## Cache variables. ## @@ -910,7 +910,7 @@ am_cv_CC_dependencies_compiler_type=gcc3 am_cv_CXX_dependencies_compiler_type=gcc3 lt_cv_deplibs_check_method=pass_all lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file='/lib/libc.so.6 /lib/libc-2.5.so' +lt_cv_file_magic_test_file= lt_cv_ld_reload_flag=-r lt_cv_objdir=.libs lt_cv_path_LD=/usr/bin/ld @@ -923,14 +923,14 @@ lt_cv_prog_compiler_c_o_F77=yes lt_cv_prog_compiler_rtti_exceptions=no lt_cv_prog_gnu_ld=yes lt_cv_prog_gnu_ldcxx=yes -lt_cv_sys_global_symbol_pipe='sed -n -e '\''s/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\(\)\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2\3 \3/p'\''' +lt_cv_sys_global_symbol_pipe='sed -n -e '\''s/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p'\''' lt_cv_sys_global_symbol_to_c_name_address='sed -n -e '\''s/^: \([^ ]*\) $/ {\"\1\", (lt_ptr) 0},/p'\'' -e '\''s/^[BCDEGRST] \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr) \&\2},/p'\''' lt_cv_sys_global_symbol_to_cdecl='sed -n -e '\''s/^. .* \(.*\)$/extern int \1;/p'\''' lt_cv_sys_max_cmd_len=32768 lt_lt_cv_prog_compiler_c_o='"yes"' lt_lt_cv_prog_compiler_c_o_CXX='"yes"' lt_lt_cv_prog_compiler_c_o_F77='"yes"' -lt_lt_cv_sys_global_symbol_pipe='"sed -n -e '\''s/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'\''"' +lt_lt_cv_sys_global_symbol_pipe='"sed -n -e '\''s/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'\''"' lt_lt_cv_sys_global_symbol_to_c_name_address='"sed -n -e '\''s/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p'\'' -e '\''s/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'\''"' lt_lt_cv_sys_global_symbol_to_cdecl='"sed -n -e '\''s/^. .* \\(.*\\)\$/extern int \\1;/p'\''"' @@ -938,15 +938,15 @@ lt_lt_cv_sys_global_symbol_to_cdecl='"sed -n -e '\''s/^. .* \\(.*\\)\$/extern in ## Output variables. ## ## ----------------- ## -ACLOCAL='${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run aclocal-1.9' +ACLOCAL='${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run aclocal-1.9' AMDEPBACKSLASH='\' AMDEP_FALSE='#' AMDEP_TRUE='' -AMTAR='${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run tar' +AMTAR='${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run tar' AR='ar' -AUTOCONF='${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run autoconf' -AUTOHEADER='${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run autoheader' -AUTOMAKE='${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run automake-1.9' +AUTOCONF='${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run autoconf' +AUTOHEADER='${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run autoheader' +AUTOMAKE='${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run automake-1.9' AWK='gawk' CC='gcc' CCDEPMODE='depmode=gcc3' @@ -980,7 +980,7 @@ LIBS='' LIBTOOL='$(SHELL) $(top_builddir)/libtool' LN_S='ln -s' LTLIBOBJS='' -MAKEINFO='${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run makeinfo' +MAKEINFO='${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run makeinfo' OBJEXT='o' PACKAGE='libsangoma' PACKAGE_BUGREPORT='anthmct@yahoo.com' @@ -990,6 +990,7 @@ PACKAGE_TARNAME='libsangoma' PACKAGE_VERSION='1.0.0' PATH_SEPARATOR=':' RANLIB='ranlib' +SED='/bin/sed' SET_MAKE='' SHELL='/bin/sh' STRIP='strip' @@ -1024,7 +1025,7 @@ host_os='linux-gnu' host_vendor='pc' includedir='${prefix}/include' infodir='${prefix}/info' -install_sh='/root/3.2/wanpipe/api/libsangoma/install-sh' +install_sh='/root/3.3/wanpipe/api/libsangoma/install-sh' libdir='${exec_prefix}/lib' libexecdir='${exec_prefix}/libexec' libpripath='' diff --git a/api/libsangoma/config.status b/api/libsangoma/config.status index c68e011..01ede5c 100755 --- a/api/libsangoma/config.status +++ b/api/libsangoma/config.status @@ -480,12 +480,12 @@ s,@INSTALL_DATA@,${INSTALL} -m 644,;t t s,@CYGPATH_W@,echo,;t t s,@PACKAGE@,libsangoma,;t t s,@VERSION@,1.0.0,;t t -s,@ACLOCAL@,${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run aclocal-1.9,;t t -s,@AUTOCONF@,${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run autoconf,;t t -s,@AUTOMAKE@,${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run automake-1.9,;t t -s,@AUTOHEADER@,${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run autoheader,;t t -s,@MAKEINFO@,${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run makeinfo,;t t -s,@install_sh@,/root/3.2/wanpipe/api/libsangoma/install-sh,;t t +s,@ACLOCAL@,${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run aclocal-1.9,;t t +s,@AUTOCONF@,${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run autoconf,;t t +s,@AUTOMAKE@,${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run automake-1.9,;t t +s,@AUTOHEADER@,${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run autoheader,;t t +s,@MAKEINFO@,${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run makeinfo,;t t +s,@install_sh@,/root/3.3/wanpipe/api/libsangoma/install-sh,;t t s,@STRIP@,strip,;t t s,@ac_ct_STRIP@,strip,;t t s,@INSTALL_STRIP_PROGRAM@,${SHELL} $(install_sh) -c -s,;t t @@ -493,7 +493,7 @@ s,@mkdir_p@,mkdir -p --,;t t s,@AWK@,gawk,;t t s,@SET_MAKE@,,;t t s,@am__leading_dot@,.,;t t -s,@AMTAR@,${SHELL} /root/3.2/wanpipe/api/libsangoma/missing --run tar,;t t +s,@AMTAR@,${SHELL} /root/3.3/wanpipe/api/libsangoma/missing --run tar,;t t s,@am__tar@,${AMTAR} chof - "$$tardir",;t t s,@am__untar@,${AMTAR} xf -,;t t s,@CC@,gcc,;t t @@ -520,6 +520,7 @@ s,@host@,i686-pc-linux-gnu,;t t s,@host_cpu@,i686,;t t s,@host_vendor@,pc,;t t s,@host_os@,linux-gnu,;t t +s,@SED@,/bin/sed,;t t s,@EGREP@,grep -E,;t t s,@LN_S@,ln -s,;t t s,@ECHO@,echo,;t t diff --git a/api/libsangoma/configure b/api/libsangoma/configure index d2a220b..a773968 100755 --- a/api/libsangoma/configure +++ b/api/libsangoma/configure @@ -280,15 +280,15 @@ fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/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`" && + 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 @@ -464,7 +464,7 @@ ac_includes_default="\ # 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 datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar 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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBPRI_TRUE LIBPRI_FALSE libpripath LIBOBJS LTLIBOBJS' +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 datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar 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 build build_cpu build_vendor build_os host host_cpu host_vendor host_os SED EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBPRI_TRUE LIBPRI_FALSE libpripath LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -3197,12 +3197,13 @@ do 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 && break + test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in @@ -3227,10 +3228,11 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do fi done done -SED=$lt_cv_path_SED fi +SED=$lt_cv_path_SED + echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6 @@ -3307,7 +3309,7 @@ else if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. + # 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 &6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. + # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 @@ -3381,36 +3392,43 @@ else # Let the user override the test. lt_cv_path_NM="$NM" else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/${ac_tool_prefix}nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" + 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 ;; *) - 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 + 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 - esac - fi + fi + done + IFS="$lt_save_ifs" done - IFS="$lt_save_ifs" test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm fi fi @@ -3457,7 +3475,7 @@ beos*) lt_cv_deplibs_check_method=pass_all ;; -bsdi4*) +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 @@ -3480,13 +3498,13 @@ darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; -freebsd* | kfreebsd*-gnu) +freebsd* | kfreebsd*-gnu | 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)/i[3-9]86 (compact )?demand paged shared library' + 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.*` ;; @@ -3502,7 +3520,7 @@ gnu*) hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file - case "$host_cpu" in + 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 @@ -3518,6 +3536,11 @@ hpux10.20* | hpux11*) esac ;; +interix3*) + # 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;; @@ -3530,15 +3553,6 @@ irix5* | irix6* | nonstopux*) # This must be Linux ELF. linux*) - case $host_cpu in - alpha*|hppa*|i*86|ia64*|m68*|mips*|powerpc*|sparc*|s390*|sh*|x86_64*) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` lt_cv_deplibs_check_method=pass_all ;; @@ -3561,12 +3575,10 @@ nto-qnx*) ;; openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; @@ -3574,15 +3586,11 @@ osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - solaris*) lt_cv_deplibs_check_method=pass_all ;; -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) +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]' @@ -3603,10 +3611,13 @@ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) siemens) lt_cv_deplibs_check_method=pass_all ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; esac ;; -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; esac @@ -3624,6 +3635,9 @@ 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 @@ -3659,7 +3673,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3662 "configure"' > conftest.$ac_ext + echo '#line 3676 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -3702,7 +3716,7 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - case "`/usr/bin/file conftest.o`" in + case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*linux*) @@ -3815,6 +3829,26 @@ echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 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" ;; + *) LD="${LD-ld} -64" ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + esac @@ -4908,7 +4942,12 @@ else fi -ac_ext=cc + + +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=cc 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' @@ -5138,6 +5177,8 @@ 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' @@ -5231,7 +5272,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5234:" \ +echo "$as_me:5275:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -5421,11 +5462,55 @@ else 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 + ;; + *) # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while (test "X"`$CONFIG_SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \ + 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 && @@ -5471,9 +5556,6 @@ symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - # Transform an extracted symbol line into a proper C declaration lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" @@ -5495,15 +5577,31 @@ hpux*) # Its linker distinguishes data from code symbols 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*) + 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* | sysv5*) +solaris*) symcode='[BDRT]' ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; sysv4) symcode='[DFNSTU]' ;; @@ -5526,8 +5624,11 @@ 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'" + 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 @@ -5689,7 +5790,7 @@ esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' +Xsed='sed -e 1s/^X//' sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' # Same as above, but do not quote variable references. @@ -5709,7 +5810,7 @@ rm="rm -f" default_ofile=libtool can_build_shared=yes -# All known linkers require a `.a' archive for static linking (except M$VC, +# All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a ltmain="$ac_aux_dir/ltmain.sh" @@ -5966,6 +6067,7 @@ 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" @@ -5985,15 +6087,26 @@ old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + 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*) @@ -6019,7 +6132,7 @@ else if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"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 @@ -6081,7 +6194,7 @@ else if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"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 @@ -6176,68 +6289,25 @@ lt_simple_link_test_code='int main(){return(0);}\n' # 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 for any special shared library compilation flags. -# -lt_prog_cc_shlib= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - lt_prog_cc_shlib='-belf' - ;; - esac -fi -if test -n "$lt_prog_cc_shlib"; then - { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 -echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} - if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : - else - { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 -echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} - lt_cv_prog_cc_can_build_shared=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6 -if test "${lt_prog_compiler_static_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_prog_compiler_static" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - else - lt_prog_compiler_static_works=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" - -fi -echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 -echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 - -if test x"$lt_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +printf "$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 +printf "$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 conftest* @@ -6262,18 +6332,20 @@ else # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6268: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6338: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6272: \$? = $ac_status" >&5 + echo "$as_me:6342: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # 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 @@ -6334,6 +6406,11 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic='-fno-common' ;; + interix3*) + # 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. @@ -6350,7 +6427,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -6376,6 +6453,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 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* | pw32* | os2*) # This hack is so that the source file can tell whether it is being @@ -6387,7 +6474,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 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 + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -6411,12 +6498,19 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) - case $CC in + 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. @@ -6431,15 +6525,15 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_static='-non_shared' ;; - sco3.2v5*) - lt_prog_compiler_pic='-Kpic' - lt_prog_compiler_static='-dn' - ;; - solaris*) - lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac ;; sunos4*) @@ -6448,7 +6542,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_static='-Bstatic' ;; - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' @@ -6461,6 +6555,17 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 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' @@ -6495,18 +6600,20 @@ else # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6501: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6606: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6505: \$? = $ac_status" >&5 + echo "$as_me:6610: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # 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_prog_compiler_pic_works=yes fi fi @@ -6527,7 +6634,7 @@ else fi fi -case "$host_os" in +case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= @@ -6537,6 +6644,48 @@ case "$host_os" in ;; 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_prog_compiler_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + printf "$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_prog_compiler_static_works=yes + fi + else + lt_prog_compiler_static_works=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 + +if test x"$lt_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + 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 @@ -6555,23 +6704,25 @@ else # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6561: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6710: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6565: \$? = $ac_status" >&5 + echo "$as_me:6714: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $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 . + chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation @@ -6647,6 +6798,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. 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*) @@ -6657,6 +6818,10 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar 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 ;; @@ -6667,6 +6832,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # 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 aix3* | aix4* | aix5*) @@ -6717,10 +6903,10 @@ EOF allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + 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 @@ -6729,7 +6915,53 @@ EOF echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + $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 + ;; + + interix3*) + 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' + ;; + + linux*) + 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 + archive_cmds='$CC -shared'"$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 -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi else ld_shlibs=no fi @@ -6745,7 +6977,7 @@ EOF fi ;; - solaris* | sysv5*) + solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <&2 @@ -6766,6 +6998,33 @@ EOF 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= @@ -6773,31 +7032,6 @@ EOF hardcode_shlibpath_var=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds="$tmp_archive_cmds" - 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 - 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 -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds="$tmp_archive_cmds" - fi - else - ld_shlibs=no - fi - ;; - *) 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' @@ -6808,16 +7042,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi + 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) @@ -6829,7 +7058,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then + 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 @@ -6863,6 +7092,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ break fi done + ;; esac exp_sym_flag='-bexport' @@ -6881,7 +7111,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ link_all_deplibs=yes if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) + 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` @@ -6900,8 +7130,12 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ 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 @@ -6909,11 +7143,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else - if test "$aix_use_runtimelinking" = yes; then + if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' - fi + fi fi fi @@ -6978,12 +7212,12 @@ rm -f conftest.err conftest.$ac_objext \ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + 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 $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + 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 @@ -7043,13 +7277,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols=yes # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec=' ' + whole_archive_flag_spec='$convenience' archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + # 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 ;; @@ -7062,7 +7294,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ld_shlibs=no ;; - bsdi4*) + bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; @@ -7088,52 +7320,52 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; darwin* | rhapsody*) - if test "$GXX" = yes ; then - archive_cmds_need_lc=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag='-undefined dynamic_lookup' - ;; - esac - fi - ;; + 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 - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds='$CC ${wl}-bind_at_load $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 ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='-all_load $convenience' + 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' + 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 -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' else - ld_shlibs=no + 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` $verstring' + 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 $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + ;; + *) + ld_shlibs=no + ;; + esac fi ;; @@ -7167,7 +7399,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes @@ -7190,47 +7422,62 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi export_dynamic_flag_spec='${wl}-E' ;; - hpux10* | hpux11*) + hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) + 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*|ia64*) - archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + 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='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_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 - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_libdir_separator=: - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - ia64*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=no - hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes + case $host_cpu in + hppa*64*|ia64*) + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_direct=no + hardcode_shlibpath_var=no ;; *) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: hardcode_direct=yes export_dynamic_flag_spec='${wl}-E' @@ -7278,6 +7525,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi 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 @@ -7323,7 +7571,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $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' @@ -7331,21 +7579,15 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_separator=: ;; - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - solaris*) no_undefined_flag=' -z text' if test "$GCC" = yes; then + 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' @@ -7354,8 +7596,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs=yes ;; @@ -7412,36 +7664,45 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi ;; - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; + runpath_var='LD_RUN_PATH' - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + 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 ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + 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 - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no ;; - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= + 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*) @@ -7460,11 +7721,6 @@ echo "$as_me:$LINENO: result: $ld_shlibs" >&5 echo "${ECHO_T}$ld_shlibs" >&6 test "$ld_shlibs" = no && can_build_shared=no -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - # # Do we need to explicitly link libc? # @@ -7497,6 +7753,7 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >& libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= @@ -7629,7 +7886,7 @@ beos*) shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -7657,7 +7914,8 @@ cygwin* | mingw* | pw32*) 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' + $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' @@ -7687,7 +7945,7 @@ cygwin* | mingw* | pw32*) ;; 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}' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; @@ -7710,7 +7968,7 @@ darwin* | rhapsody*) 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)' + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` @@ -7745,8 +8003,17 @@ kfreebsd*-gnu) dynamic_linker='GNU ld.so' ;; -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` +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*) @@ -7764,14 +8031,19 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.01* | freebsdelf3.01*) + freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; - *) # from 3.2 on + 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 ;; + freebsd*) # from 4.6 on + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; esac ;; @@ -7791,7 +8063,7 @@ hpux9* | hpux10* | hpux11*) version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in + case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes @@ -7831,6 +8103,18 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; +interix3*) + 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 ;; @@ -7892,7 +8176,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 7895 "configure"' > conftest.$ac_ext + echo '#line 8179 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7911,7 +8195,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" fi @@ -7973,8 +8257,13 @@ nto-qnx*) openbsd*) version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no - need_version=yes + # 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 @@ -8012,13 +8301,6 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - solaris*) version_type=linux need_lib_prefix=no @@ -8044,7 +8326,7 @@ sunos4*) need_version=yes ;; -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) +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' @@ -8077,6 +8359,29 @@ sysv4*MP*) 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}' @@ -8092,12 +8397,17 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + 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 + test -n "$runpath_var" || \ + test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct" != no && @@ -8747,7 +9057,7 @@ fi test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" @@ -8763,7 +9073,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null + (./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_unknown|x*) lt_cv_dlopen_self=no ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed @@ -8849,7 +9161,7 @@ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 echo "${ECHO_T}$lt_cv_dlopen_self" >&6 if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" + 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 @@ -8861,7 +9173,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <&5 (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null + (./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_unknown|x*) lt_cv_dlopen_self_static=no ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed @@ -8965,7 +9279,7 @@ echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 fi -# Report which librarie types wil actually be built +# 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 @@ -8977,7 +9291,7 @@ 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 +case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then @@ -8989,43 +9303,6 @@ aix3*) aix4* | aix5*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no - fi - ;; - darwin* | rhapsody*) - if test "$GCC" = yes; then - archive_cmds_need_lc=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag='-undefined dynamic_lookup' - ;; - esac - fi - ;; - esac - output_verbose_link_cmd='echo' - archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - module_cmds='$CC $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 ld's - archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - whole_archive_flag_spec='-all_load $convenience' - link_all_deplibs=yes - else - ld_shlibs=no fi ;; esac @@ -9052,7 +9329,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + 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 \ @@ -9156,7 +9433,7 @@ echo "$as_me: creating $ofile" >&6;} # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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 @@ -9167,11 +9444,11 @@ echo "$as_me: creating $ofile" >&6;} SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" +Xsed="$SED -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags= @@ -9201,6 +9478,12 @@ 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 @@ -9212,12 +9495,18 @@ 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 +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + # An ERE matcher. EGREP=$lt_EGREP @@ -9277,7 +9566,7 @@ 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 ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -9351,11 +9640,11 @@ striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=$lt_predep_objects +predep_objects=\`echo $lt_predep_objects | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=$lt_postdep_objects +postdep_objects=\`echo $lt_postdep_objects | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place before the objects being linked to create a # shared library. @@ -9367,7 +9656,7 @@ postdeps=$lt_postdeps # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -9447,7 +9736,7 @@ variables_saved_for_relink="$variables_saved_for_relink" link_all_deplibs=$link_all_deplibs # Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec +sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -9542,6 +9831,9 @@ echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script 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. @@ -9572,7 +9864,9 @@ echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} case $tagname in CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then + 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=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -9592,6 +9886,7 @@ 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= @@ -9609,7 +9904,7 @@ postdeps_CXX= compiler_lib_search_path_CXX= # Source file extension for C++ test sources. -ac_ext=cc +ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o @@ -9619,17 +9914,34 @@ objext_CXX=$objext lt_simple_compile_test_code="int some_variable = 0;\n" # Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *) { return(0); }\n' +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} +# 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 +printf "$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 +printf "$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 conftest* + + # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD @@ -9640,18 +9952,27 @@ lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else - unset lt_cv_prog_gnu_ld + $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 - unset lt_cv_path_LD + $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC compiler_CXX=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +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 @@ -9722,7 +10043,7 @@ else if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. + # 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 &6 if test "${lt_cv_prog_gnu_ld+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. + # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 conftest.$ac_ext <<_ACEOF @@ -10028,16 +10354,26 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # -berok will link without error, but may produce a broken library. no_undefined_flag_CXX=' ${wl}-bernotok' allow_undefined_flag_CXX=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_CXX=yes # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_CXX=' ' + whole_archive_flag_spec_CXX='$convenience' archive_cmds_need_lc_CXX=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + # 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 *) @@ -10056,7 +10392,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + 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 @@ -10065,70 +10401,81 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + $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*) - if test "$GXX" = yes; then - archive_cmds_need_lc_CXX=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_CXX='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_CXX='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_CXX='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag_CXX='-undefined dynamic_lookup' - ;; + darwin* | rhapsody*) + case $host_os in + rhapsody* | darwin1.[012]) + allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' + ;; + 10.*) + allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup' + ;; + esac + fi + ;; esac - fi - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_CXX='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + 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 - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - hardcode_direct_CXX=no - hardcode_automatic_CXX=yes - hardcode_shlibpath_var_CXX=unsupported - whole_archive_flag_spec_CXX='-all_load $convenience' - link_all_deplibs_CXX=yes - else - ld_shlibs_CXX=no - fi - ;; + if test "$GXX" = yes ; then + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_CXX='$CC $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 + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + 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` $verstring' + 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 $verstring~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++) + ec++*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - ghcx) + ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10139,14 +10486,14 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; esac ;; - freebsd12*) + 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* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions ld_shlibs_CXX=yes @@ -10163,11 +10510,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # location of the library. case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC) + 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 @@ -10177,7 +10524,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # 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' + 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 @@ -10191,34 +10538,23 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + case $host_cpu in + hppa*64*|ia64*) hardcode_libdir_flag_spec_ld_CXX='+b $libdir' - hardcode_libdir_separator_CXX=: - ;; - ia64*) - hardcode_libdir_flag_spec_CXX='-L$libdir' ;; *) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi - case "$host_cpu" in - hppa*64*) + case $host_cpu in + hppa*64*|ia64*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no ;; - ia64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; *) hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, @@ -10228,14 +10564,17 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi esac case $cc_basename in - CC) + CC*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + 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' @@ -10254,9 +10593,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + 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' @@ -10270,11 +10612,25 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; esac ;; + interix3*) + 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) + CC*) # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + 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 @@ -10285,7 +10641,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + 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 @@ -10298,7 +10654,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; linux*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10323,17 +10679,41 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # "CC -Bstatic", where "CC" is the KAI C++ compiler. old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - icpc) + 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 - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' export_dynamic_flag_spec_CXX='${wl}--export-dynamic' whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; - cxx) + pgCC*) + # 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' @@ -10364,7 +10744,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; mvs*) case $cc_basename in - cxx) + cxx*) # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; @@ -10385,9 +10765,25 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; 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*) + 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' + ;; osf3*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10403,14 +10799,14 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx) + cxx*) allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + 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=: @@ -10428,7 +10824,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + 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=: @@ -10447,7 +10843,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; osf4* | osf5*) case $cc_basename in - KCC) + KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file @@ -10462,17 +10858,17 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # the KAI C++ compiler. old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - RCC) + RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - cxx) + cxx*) allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_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 $objdir/so_locations -o $lib~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~ $rm $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' @@ -10491,7 +10887,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + 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=: @@ -10512,27 +10908,14 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - sco*) - archive_cmds_need_lc_CXX=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support ld_shlibs_CXX=no ;; - lcc) + lcc*) # Lucid # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10545,36 +10928,33 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; solaris*) case $cc_basename in - CC) + 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} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + 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} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $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.*) ;; + solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac link_all_deplibs_CXX=yes - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + 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 @@ -10582,7 +10962,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # in the archive. old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' ;; - gcx) + gcx*) # Green Hills C++ Compiler archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' @@ -10620,12 +11000,63 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; esac ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + 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) + NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -10678,7 +11109,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 # 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\"`" + 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 @@ -10754,6 +11185,29 @@ fi $rm -f confest.$objext +# PORTME: override above test on systems where it is broken +case $host_os in +interix3*) + # 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= + ;; + +solaris*) + case $cc_basename in + CC*) + # 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. + postdeps_CXX='-lCstd -lCrun' + ;; + esac + ;; +esac + + case " $postdeps_CXX " in *" -lc "*) archive_cmds_need_lc_CXX=no ;; esac @@ -10801,6 +11255,10 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 # DJGPP does not support shared libraries at all lt_prog_compiler_pic_CXX= ;; + interix3*) + # 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 @@ -10809,7 +11267,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) ;; *) @@ -10834,18 +11292,28 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; chorus*) case $cc_basename in - cxch68) + 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++) + ec++*) lt_prog_compiler_pic_CXX='-KPIC' ;; - ghcx) + ghcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-pic' ;; @@ -10853,22 +11321,22 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; esac ;; - freebsd* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in - CC) + CC*) lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; - aCC) + aCC*) lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -10881,9 +11349,13 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; 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) + CC*) lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-non_shared' # CC pic flag -KPIC is the default. @@ -10894,18 +11366,24 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) case $cc_basename in - KCC) + KCC*) # KAI C++ Compiler lt_prog_compiler_wl_CXX='--backend -Wl,' lt_prog_compiler_pic_CXX='-fPIC' ;; - icpc) + icpc* | ecpc*) # Intel C++ lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' ;; - cxx) + pgCC*) + # 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. @@ -10922,7 +11400,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; mvs*) case $cc_basename in - cxx) + cxx*) lt_prog_compiler_pic_CXX='-W c,exportall' ;; *) @@ -10933,14 +11411,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; osf3* | osf4* | osf5*) case $cc_basename in - KCC) + KCC*) lt_prog_compiler_wl_CXX='--backend -Wl,' ;; - RCC) + RCC*) # Rational C++ 2.4.1 lt_prog_compiler_pic_CXX='-pic' ;; - cxx) + cxx*) # Digital/Compaq C++ lt_prog_compiler_wl_CXX='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha @@ -10954,24 +11432,15 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; psos*) ;; - sco*) - case $cc_basename in - CC) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - *) - ;; - esac - ;; solaris*) case $cc_basename in - CC) + 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) + gcx*) # Green Hills C++ Compiler lt_prog_compiler_pic_CXX='-PIC' ;; @@ -10981,12 +11450,12 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; sunos4*) case $cc_basename in - CC) + CC*) # Sun C++ 4.x lt_prog_compiler_pic_CXX='-pic' lt_prog_compiler_static_CXX='-Bstatic' ;; - lcc) + lcc*) # Lucid lt_prog_compiler_pic_CXX='-pic' ;; @@ -10996,7 +11465,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; tandem*) case $cc_basename in - NCC) + NCC*) # NonStop-UX NCC 3.20 lt_prog_compiler_pic_CXX='-KPIC' ;; @@ -11004,7 +11473,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; esac ;; - unixware*) + 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*) ;; @@ -11037,18 +11513,20 @@ else # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11043: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11519: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11047: \$? = $ac_status" >&5 + echo "$as_me:11523: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # 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_prog_compiler_pic_works_CXX=yes fi fi @@ -11069,7 +11547,7 @@ else fi fi -case "$host_os" in +case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= @@ -11079,6 +11557,48 @@ case "$host_os" in ;; 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_prog_compiler_static_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works_CXX=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + printf "$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_prog_compiler_static_works_CXX=yes + fi + else + lt_prog_compiler_static_works_CXX=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6 + +if test x"$lt_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 @@ -11097,23 +11617,25 @@ else # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11103: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11623: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11107: \$? = $ac_status" >&5 + echo "$as_me:11627: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $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 . + chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation @@ -11168,7 +11690,7 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw*) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([^ ]*\) [^ ]*/\1 DATA/;/^I /d;/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' @@ -11179,11 +11701,6 @@ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 echo "${ECHO_T}$ld_shlibs_CXX" >&6 test "$ld_shlibs_CXX" = no && can_build_shared=no -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - # # Do we need to explicitly link libc? # @@ -11216,6 +11733,7 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >& 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= @@ -11348,7 +11866,7 @@ beos*) shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -11376,7 +11894,8 @@ cygwin* | mingw* | pw32*) 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' + $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' @@ -11406,7 +11925,7 @@ cygwin* | mingw* | pw32*) ;; 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}' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; @@ -11429,7 +11948,7 @@ darwin* | rhapsody*) 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)' + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` @@ -11464,8 +11983,17 @@ kfreebsd*-gnu) dynamic_linker='GNU ld.so' ;; -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` +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*) @@ -11483,14 +12011,19 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.01* | freebsdelf3.01*) + freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; - *) # from 3.2 on + 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 ;; + freebsd*) # from 4.6 on + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; esac ;; @@ -11510,7 +12043,7 @@ hpux9* | hpux10* | hpux11*) version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in + case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes @@ -11550,6 +12083,18 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; +interix3*) + 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 ;; @@ -11611,7 +12156,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 11614 "configure"' > conftest.$ac_ext + echo '#line 12159 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -11630,7 +12175,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" fi @@ -11692,8 +12237,13 @@ nto-qnx*) openbsd*) version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no - need_version=yes + # 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 @@ -11731,13 +12281,6 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - solaris*) version_type=linux need_lib_prefix=no @@ -11763,7 +12306,7 @@ sunos4*) need_version=yes ;; -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) +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' @@ -11796,6 +12339,29 @@ sysv4*MP*) 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}' @@ -11811,12 +12377,17 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + 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 + test -n "$runpath_var_CXX" || \ + test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_CXX" != no && @@ -11848,841 +12419,6 @@ elif test "$shlibpath_overrides_runpath" = yes || enable_fast_install=needless fi -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - -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 gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = shl_load; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != shl_load; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = dlopen; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != dlopen; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh @@ -12697,7 +12433,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + 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 \ @@ -12798,6 +12534,12 @@ 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 @@ -12809,12 +12551,18 @@ 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 +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + # An ERE matcher. EGREP=$lt_EGREP @@ -12874,7 +12622,7 @@ 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 ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -12948,11 +12696,11 @@ striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=$lt_predep_objects_CXX +predep_objects=\`echo $lt_predep_objects_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=$lt_postdep_objects_CXX +postdep_objects=\`echo $lt_postdep_objects_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place before the objects being linked to create a # shared library. @@ -12964,7 +12712,7 @@ postdeps=$lt_postdeps_CXX # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_CXX +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_CXX | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -13044,7 +12792,7 @@ variables_saved_for_relink="$variables_saved_for_relink" 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 +sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -13151,16 +12899,42 @@ lt_simple_link_test_code=" program t\n end\n" # 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 +printf "$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 +printf "$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 conftest* + + # Allow CC to be a program name with arguments. lt_save_CC="$CC" CC=${F77-"f77"} compiler=$CC compiler_F77=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` +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 @@ -13173,7 +12947,7 @@ 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 +case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then @@ -13182,7 +12956,9 @@ aix3*) fi ;; aix4* | aix5*) - test "$enable_shared" = yes && enable_static=no + 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 @@ -13195,8 +12971,6 @@ test "$enable_shared" = yes || enable_static=yes echo "$as_me:$LINENO: result: $enable_static" >&5 echo "${ECHO_T}$enable_static" >&6 -test "$ld_shlibs_F77" = no && can_build_shared=no - GCC_F77="$G77" LD_F77="$LD" @@ -13243,6 +13017,11 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_F77='-fno-common' ;; + interix3*) + # 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. @@ -13259,7 +13038,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -13285,6 +13064,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 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* | pw32* | os2*) # This hack is so that the source file can tell whether it is being @@ -13296,7 +13085,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 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 + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -13320,12 +13109,19 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) - case $CC in + 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. @@ -13340,15 +13136,15 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_static_F77='-non_shared' ;; - sco3.2v5*) - lt_prog_compiler_pic_F77='-Kpic' - lt_prog_compiler_static_F77='-dn' - ;; - solaris*) - lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_F77='-Qoption ld ';; + *) + lt_prog_compiler_wl_F77='-Wl,';; + esac ;; sunos4*) @@ -13357,7 +13153,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_static_F77='-Bstatic' ;; - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_F77='-Wl,' lt_prog_compiler_pic_F77='-KPIC' lt_prog_compiler_static_F77='-Bstatic' @@ -13370,6 +13166,17 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 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' @@ -13404,18 +13211,20 @@ else # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13410: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13217: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13414: \$? = $ac_status" >&5 + echo "$as_me:13221: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # 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_prog_compiler_pic_works_F77=yes fi fi @@ -13436,7 +13245,7 @@ else fi fi -case "$host_os" in +case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_F77= @@ -13446,6 +13255,48 @@ case "$host_os" in ;; 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_prog_compiler_static_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works_F77=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + printf "$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_prog_compiler_static_works_F77=yes + fi + else + lt_prog_compiler_static_works_F77=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6 + +if test x"$lt_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 @@ -13464,23 +13315,25 @@ else # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13470: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13321: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13474: \$? = $ac_status" >&5 + echo "$as_me:13325: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $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 . + chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation @@ -13556,6 +13409,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. 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*) @@ -13566,6 +13429,10 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar 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 ;; @@ -13576,6 +13443,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # 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 aix3* | aix4* | aix5*) @@ -13626,10 +13514,10 @@ EOF allow_undefined_flag_F77=unsupported always_export_symbols_F77=no enable_shared_with_static_runtimes_F77=yes - export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + 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 @@ -13638,9 +13526,55 @@ EOF echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + $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 + ld_shlibs_F77=no + fi + ;; + + interix3*) + 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' + ;; + + linux*) + 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 + archive_cmds_F77='$CC -shared'"$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 -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_F77=no fi ;; @@ -13654,7 +13588,7 @@ EOF fi ;; - solaris* | sysv5*) + solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_F77=no cat <&2 @@ -13675,6 +13609,33 @@ EOF 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= @@ -13682,31 +13643,6 @@ EOF hardcode_shlibpath_var_F77=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds_F77="$tmp_archive_cmds" - 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 - 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 -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_F77="$tmp_archive_cmds" - fi - else - ld_shlibs_F77=no - fi - ;; - *) 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' @@ -13717,16 +13653,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs_F77" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_F77='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_F77= - fi + 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) @@ -13738,7 +13669,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_F77=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then + 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 @@ -13772,6 +13703,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ break fi done + ;; esac exp_sym_flag='-bexport' @@ -13790,7 +13722,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ link_all_deplibs_F77=yes if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) + 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` @@ -13809,8 +13741,12 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ 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 @@ -13818,11 +13754,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else - if test "$aix_use_runtimelinking" = yes; then + if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' - fi + fi fi fi @@ -13877,12 +13813,12 @@ rm -f conftest.err conftest.$ac_objext \ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + 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 $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + 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 @@ -13932,13 +13868,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # -berok will link without error, but may produce a broken library. no_undefined_flag_F77=' ${wl}-bernotok' allow_undefined_flag_F77=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_F77=yes # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_F77=' ' + whole_archive_flag_spec_F77='$convenience' archive_cmds_need_lc_F77=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + # 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 ;; @@ -13951,7 +13885,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ld_shlibs_F77=no ;; - bsdi4*) + bsdi[45]*) export_dynamic_flag_spec_F77=-rdynamic ;; @@ -13972,57 +13906,57 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi old_archive_From_new_cmds_F77='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' + fix_srcfile_path_F77='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_F77=yes ;; darwin* | rhapsody*) - if test "$GXX" = yes ; then - archive_cmds_need_lc_F77=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_F77='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_F77='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_F77='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag_F77='-undefined dynamic_lookup' - ;; - esac - fi - ;; + 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 - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_F77='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_F77='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_F77='$CC ${wl}-bind_at_load $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 ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_cmds_need_lc_F77=no hardcode_direct_F77=no hardcode_automatic_F77=yes hardcode_shlibpath_var_F77=unsupported - whole_archive_flag_spec_F77='-all_load $convenience' + 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' + 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 -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_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}' else - ld_shlibs_F77=no + 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` $verstring' + 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 $verstring~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 ;; @@ -14056,7 +13990,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_F77='-R$libdir' hardcode_direct_F77=yes @@ -14079,47 +14013,62 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi export_dynamic_flag_spec_F77='${wl}-E' ;; - hpux10* | hpux11*) + hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) + 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*|ia64*) - archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + 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='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_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 - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_F77='+b $libdir' - hardcode_libdir_separator_F77=: - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no - ;; - ia64*) - hardcode_libdir_flag_spec_F77='-L$libdir' - hardcode_direct_F77=no - hardcode_shlibpath_var_F77=no + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_F77=yes + 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_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_F77=: hardcode_direct_F77=yes export_dynamic_flag_spec_F77='${wl}-E' @@ -14167,6 +14116,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi 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 @@ -14212,7 +14162,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_F77=' -expect_unresolved \*' archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $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' @@ -14220,21 +14170,15 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_separator_F77=: ;; - sco3.2v5*) - archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_F77=no - export_dynamic_flag_spec_F77='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - solaris*) no_undefined_flag_F77=' -z text' if test "$GCC" = yes; then + 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' @@ -14243,8 +14187,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_F77=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_F77='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs_F77=yes ;; @@ -14301,36 +14255,45 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi ;; - sysv4.2uw2*) - archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_F77=yes - hardcode_minus_L_F77=no + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) + no_undefined_flag_F77='${wl}-z,text' + archive_cmds_need_lc_F77=no hardcode_shlibpath_var_F77=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; + runpath_var='LD_RUN_PATH' - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag_F77='${wl}-z ${wl}text' if test "$GCC" = yes; then - archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + 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 ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + 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 - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_F77=no ;; - sysv5*) - no_undefined_flag_F77=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec_F77= + 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*) @@ -14349,11 +14312,6 @@ echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 echo "${ECHO_T}$ld_shlibs_F77" >&6 test "$ld_shlibs_F77" = no && can_build_shared=no -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - # # Do we need to explicitly link libc? # @@ -14386,6 +14344,7 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >& 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= @@ -14518,7 +14477,7 @@ beos*) shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -14546,7 +14505,8 @@ cygwin* | mingw* | pw32*) 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' + $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' @@ -14576,7 +14536,7 @@ cygwin* | mingw* | pw32*) ;; 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}' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; @@ -14599,7 +14559,7 @@ darwin* | rhapsody*) 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)' + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` @@ -14634,8 +14594,17 @@ kfreebsd*-gnu) dynamic_linker='GNU ld.so' ;; -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` +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*) @@ -14653,14 +14622,19 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.01* | freebsdelf3.01*) + freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; - *) # from 3.2 on + 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 ;; + freebsd*) # from 4.6 on + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; esac ;; @@ -14680,7 +14654,7 @@ hpux9* | hpux10* | hpux11*) version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in + case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes @@ -14720,6 +14694,18 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; +interix3*) + 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 ;; @@ -14781,7 +14767,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 14784 "configure"' > conftest.$ac_ext + echo '#line 14770 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14800,7 +14786,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" fi @@ -14862,8 +14848,13 @@ nto-qnx*) openbsd*) version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no - need_version=yes + # 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 @@ -14901,13 +14892,6 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - solaris*) version_type=linux need_lib_prefix=no @@ -14933,7 +14917,7 @@ sunos4*) need_version=yes ;; -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) +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' @@ -14966,6 +14950,29 @@ sysv4*MP*) 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}' @@ -14981,12 +14988,17 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + 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 + test -n "$runpath_var_F77" || \ + test "X$hardcode_automatic_F77" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_F77" != no && @@ -15018,36 +15030,6 @@ elif test "$shlibpath_overrides_runpath" = yes || enable_fast_install=needless fi -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - - # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh @@ -15062,7 +15044,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + 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 \ @@ -15163,6 +15145,12 @@ 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 @@ -15174,12 +15162,18 @@ 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 +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + # An ERE matcher. EGREP=$lt_EGREP @@ -15239,7 +15233,7 @@ 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 ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -15313,11 +15307,11 @@ striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=$lt_predep_objects_F77 +predep_objects=\`echo $lt_predep_objects_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=$lt_postdep_objects_F77 +postdep_objects=\`echo $lt_postdep_objects_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place before the objects being linked to create a # shared library. @@ -15329,7 +15323,7 @@ postdeps=$lt_postdeps_F77 # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_F77 +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_F77 | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -15409,7 +15403,7 @@ variables_saved_for_relink="$variables_saved_for_relink" 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 +sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -15477,26 +15471,55 @@ objext_GCJ=$objext lt_simple_compile_test_code="class foo {}\n" # Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n' +lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }\n' # ltmain only uses $CC for tagged configurations so make sure $CC is set. # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} +# 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 +printf "$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 +printf "$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 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= @@ -15519,18 +15542,20 @@ else # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15525: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15548: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15529: \$? = $ac_status" >&5 + echo "$as_me:15552: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # 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 @@ -15591,6 +15616,11 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_pic_GCJ='-fno-common' ;; + interix3*) + # 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. @@ -15607,7 +15637,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 hpux*) # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. - case "$host_cpu" in + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -15633,6 +15663,16 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 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* | pw32* | os2*) # This hack is so that the source file can tell whether it is being @@ -15644,7 +15684,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 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 + case $host_cpu in hppa*64*|ia64*) # +Z the default ;; @@ -15668,12 +15708,19 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 ;; linux*) - case $CC in + 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. @@ -15688,15 +15735,15 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_static_GCJ='-non_shared' ;; - sco3.2v5*) - lt_prog_compiler_pic_GCJ='-Kpic' - lt_prog_compiler_static_GCJ='-dn' - ;; - solaris*) - lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' + case $cc_basename in + f77* | f90* | f95*) + lt_prog_compiler_wl_GCJ='-Qoption ld ';; + *) + lt_prog_compiler_wl_GCJ='-Wl,';; + esac ;; sunos4*) @@ -15705,7 +15752,7 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 lt_prog_compiler_static_GCJ='-Bstatic' ;; - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl_GCJ='-Wl,' lt_prog_compiler_pic_GCJ='-KPIC' lt_prog_compiler_static_GCJ='-Bstatic' @@ -15718,6 +15765,17 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 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' @@ -15752,18 +15810,20 @@ else # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15758: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15816: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15762: \$? = $ac_status" >&5 + echo "$as_me:15820: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then + # 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_prog_compiler_pic_works_GCJ=yes fi fi @@ -15784,7 +15844,7 @@ else fi fi -case "$host_os" in +case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_GCJ= @@ -15794,6 +15854,48 @@ case "$host_os" in ;; 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_prog_compiler_static_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works_GCJ=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + printf "$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_prog_compiler_static_works_GCJ=yes + fi + else + lt_prog_compiler_static_works_GCJ=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6 + +if test x"$lt_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 @@ -15812,23 +15914,25 @@ else # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15818: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15920: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15822: \$? = $ac_status" >&5 + echo "$as_me:15924: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings - if test ! -s out/conftest.err; then + $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 . + chmod u+w . 2>&5 $rm conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation @@ -15904,6 +16008,16 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. 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*) @@ -15914,6 +16028,10 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar 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 ;; @@ -15924,6 +16042,27 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar # 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 aix3* | aix4* | aix5*) @@ -15974,10 +16113,10 @@ EOF allow_undefined_flag_GCJ=unsupported always_export_symbols_GCJ=no enable_shared_with_static_runtimes_GCJ=yes - export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + 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 @@ -15986,9 +16125,55 @@ EOF echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + $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 + ld_shlibs_GCJ=no + fi + ;; + + interix3*) + 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' + ;; + + linux*) + 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 + archive_cmds_GCJ='$CC -shared'"$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 -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + else + ld_shlibs_GCJ=no fi ;; @@ -16002,7 +16187,7 @@ EOF fi ;; - solaris* | sysv5*) + solaris*) if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then ld_shlibs_GCJ=no cat <&2 @@ -16023,6 +16208,33 @@ EOF 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= @@ -16030,31 +16242,6 @@ EOF hardcode_shlibpath_var_GCJ=no ;; - linux*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_cmds_GCJ="$tmp_archive_cmds" - 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 - 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 -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - else - archive_expsym_cmds_GCJ="$tmp_archive_cmds" - fi - else - ld_shlibs_GCJ=no - fi - ;; - *) 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' @@ -16065,16 +16252,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ ;; esac - if test "$ld_shlibs_GCJ" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GCJ= - fi + 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) @@ -16086,7 +16268,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L_GCJ=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then + 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 @@ -16120,6 +16302,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ break fi done + ;; esac exp_sym_flag='-bexport' @@ -16138,7 +16321,7 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ link_all_deplibs_GCJ=yes if test "$GCC" = yes; then - case $host_os in aix4.012|aix4.012.*) + 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` @@ -16157,8 +16340,12 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ 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 @@ -16166,11 +16353,11 @@ $echo "local: *; };" >> $output_objdir/$libname.ver~ # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else - if test "$aix_use_runtimelinking" = yes; then + if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' - fi + fi fi fi @@ -16235,12 +16422,12 @@ rm -f conftest.err conftest.$ac_objext \ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + 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 $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + 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 @@ -16300,13 +16487,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # -berok will link without error, but may produce a broken library. no_undefined_flag_GCJ=' ${wl}-bernotok' allow_undefined_flag_GCJ=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - always_export_symbols_GCJ=yes # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_GCJ=' ' + whole_archive_flag_spec_GCJ='$convenience' archive_cmds_need_lc_GCJ=yes - # This is similar to how AIX traditionally builds it's shared libraries. - archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + # 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 ;; @@ -16319,7 +16504,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ld_shlibs_GCJ=no ;; - bsdi4*) + bsdi[45]*) export_dynamic_flag_spec_GCJ=-rdynamic ;; @@ -16340,57 +16525,57 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi old_archive_From_new_cmds_GCJ='true' # FIXME: Should let the user specify the lib program. old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' + fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`' enable_shared_with_static_runtimes_GCJ=yes ;; darwin* | rhapsody*) - if test "$GXX" = yes ; then - archive_cmds_need_lc_GCJ=no - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag_GCJ='-undefined suppress' - ;; - *) # Darwin 1.3 on - if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then - allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' - else - case ${MACOSX_DEPLOYMENT_TARGET} in - 10.[012]) - allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' - ;; - 10.*) - allow_undefined_flag_GCJ='-undefined dynamic_lookup' - ;; - esac - fi - ;; + 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 - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_cmds_GCJ='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - archive_cmds_GCJ='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - module_cmds_GCJ='$CC ${wl}-bind_at_load $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 ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + archive_cmds_need_lc_GCJ=no hardcode_direct_GCJ=no hardcode_automatic_GCJ=yes hardcode_shlibpath_var_GCJ=unsupported - whole_archive_flag_spec_GCJ='-all_load $convenience' + 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' + 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 -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds_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}' else - ld_shlibs_GCJ=no + 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` $verstring' + 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 $verstring~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 ;; @@ -16424,7 +16609,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | kfreebsd*-gnu) + freebsd* | kfreebsd*-gnu | dragonfly*) archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec_GCJ='-R$libdir' hardcode_direct_GCJ=yes @@ -16447,47 +16632,62 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi export_dynamic_flag_spec_GCJ='${wl}-E' ;; - hpux10* | hpux11*) + hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) + 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*|ia64*) - archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + 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='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_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 - case "$host_cpu" in - hppa*64*) - hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' - hardcode_libdir_separator_GCJ=: - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no - ;; - ia64*) - hardcode_libdir_flag_spec_GCJ='-L$libdir' - hardcode_direct_GCJ=no - hardcode_shlibpath_var_GCJ=no + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GCJ=yes + 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_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GCJ=: hardcode_direct_GCJ=yes export_dynamic_flag_spec_GCJ='${wl}-E' @@ -16535,6 +16735,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi 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 @@ -16580,7 +16781,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi allow_undefined_flag_GCJ=' -expect_unresolved \*' archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + $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' @@ -16588,21 +16789,15 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_separator_GCJ=: ;; - sco3.2v5*) - archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GCJ=no - export_dynamic_flag_spec_GCJ='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - solaris*) no_undefined_flag_GCJ=' -z text' if test "$GCC" = yes; then + 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' @@ -16611,8 +16806,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_shlibpath_var_GCJ=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + *) + # The compiler driver will combine linker options so we + # cannot just pass the convience library names through + # without $wl, iff we do not link with $LD. + # Luckily, gcc supports the same syntax we need for Sun Studio. + # Supported since Solaris 2.6 (maybe 2.5.1?) + case $wlarc in + '') + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + *) + whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; + esac ;; esac link_all_deplibs_GCJ=yes ;; @@ -16669,36 +16874,45 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi fi ;; - sysv4.2uw2*) - archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GCJ=yes - hardcode_minus_L_GCJ=no + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*) + no_undefined_flag_GCJ='${wl}-z,text' + archive_cmds_need_lc_GCJ=no hardcode_shlibpath_var_GCJ=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; + runpath_var='LD_RUN_PATH' - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) - no_undefined_flag_GCJ='${wl}-z ${wl}text' if test "$GCC" = yes; then - archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + 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 ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + 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 - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GCJ=no ;; - sysv5*) - no_undefined_flag_GCJ=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec_GCJ= + 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*) @@ -16717,11 +16931,6 @@ echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 echo "${ECHO_T}$ld_shlibs_GCJ" >&6 test "$ld_shlibs_GCJ" = no && can_build_shared=no -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - # # Do we need to explicitly link libc? # @@ -16754,6 +16963,7 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >& 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= @@ -16886,7 +17096,7 @@ beos*) shlibpath_var=LIBRARY_PATH ;; -bsdi4*) +bsdi[45]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' @@ -16914,7 +17124,8 @@ cygwin* | mingw* | pw32*) 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' + $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' @@ -16944,7 +17155,7 @@ cygwin* | mingw* | pw32*) ;; 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}' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac ;; @@ -16967,7 +17178,7 @@ darwin* | rhapsody*) 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)' + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. if test "$GCC" = yes; then sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` @@ -17002,8 +17213,17 @@ kfreebsd*-gnu) dynamic_linker='GNU ld.so' ;; -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` +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*) @@ -17021,14 +17241,19 @@ freebsd*) freebsd2*) shlibpath_overrides_runpath=yes ;; - freebsd3.01* | freebsdelf3.01*) + freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; - *) # from 3.2 on + 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 ;; + freebsd*) # from 4.6 on + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; esac ;; @@ -17048,7 +17273,7 @@ hpux9* | hpux10* | hpux11*) version_type=sunos need_lib_prefix=no need_version=no - case "$host_cpu" in + case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes @@ -17088,6 +17313,18 @@ hpux9* | hpux10* | hpux11*) postinstall_cmds='chmod 555 $lib' ;; +interix3*) + 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 ;; @@ -17149,7 +17386,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 17152 "configure"' > conftest.$ac_ext + echo '#line 17389 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -17168,7 +17405,7 @@ linux*) # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then - lt_ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf | tr '\n' ' '` + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} $lt_ld_extra" fi @@ -17230,8 +17467,13 @@ nto-qnx*) openbsd*) version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no - need_version=yes + # 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 @@ -17269,13 +17511,6 @@ osf3* | osf4* | osf5*) sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - solaris*) version_type=linux need_lib_prefix=no @@ -17301,7 +17536,7 @@ sunos4*) need_version=yes ;; -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) +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' @@ -17334,6 +17569,29 @@ sysv4*MP*) 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}' @@ -17349,12 +17607,17 @@ echo "$as_me:$LINENO: result: $dynamic_linker" >&5 echo "${ECHO_T}$dynamic_linker" >&6 test "$dynamic_linker" = no && can_build_shared=no +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + 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 + test -n "$runpath_var_GCJ" || \ + test "X$hardcode_automatic_GCJ" = "Xyes" ; then # We can hardcode non-existant directories. if test "$hardcode_direct_GCJ" != no && @@ -17386,841 +17649,6 @@ elif test "$shlibpath_overrides_runpath" = yes || enable_fast_install=needless fi -striplib= -old_striplib= -echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - ;; - *) - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac -fi - -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 gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - echo "$as_me:$LINENO: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define shl_load to an innocuous variant, in case declares shl_load. - For example, HP-UX 11i declares gettimeofday. */ -#define shl_load innocuous_shl_load - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef shl_load - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = shl_load; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != shl_load; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:$LINENO: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define dlopen to an innocuous variant, in case declares dlopen. - For example, HP-UX 11i declares gettimeofday. */ -#define dlopen innocuous_dlopen - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef dlopen - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -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 -#else -char (*f) () = dlopen; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != dlopen; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - # The else clause should only fire when bootstrapping the # libtool distribution, otherwise you forgot to ship ltmain.sh @@ -18235,7 +17663,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + 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 \ @@ -18336,6 +17764,12 @@ 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 @@ -18347,12 +17781,18 @@ 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 +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + # An ERE matcher. EGREP=$lt_EGREP @@ -18412,7 +17852,7 @@ 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 ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -18486,11 +17926,11 @@ striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=$lt_predep_objects_GCJ +predep_objects=\`echo $lt_predep_objects_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=$lt_postdep_objects_GCJ +postdep_objects=\`echo $lt_postdep_objects_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place before the objects being linked to create a # shared library. @@ -18502,7 +17942,7 @@ postdeps=$lt_postdeps_GCJ # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_GCJ | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -18582,7 +18022,7 @@ variables_saved_for_relink="$variables_saved_for_relink" 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 +sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -18656,15 +18096,42 @@ lt_simple_link_test_code="$lt_simple_compile_test_code" # 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 +printf "$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 +printf "$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 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 @@ -18680,7 +18147,7 @@ if test -f "$ltmain"; then # Now quote all the things that may contain metacharacters while being # careful not to overquote the AC_SUBSTed values. We take copies of the # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + 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 \ @@ -18781,6 +18248,12 @@ 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 @@ -18792,12 +18265,18 @@ 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 +gcc_dir=\`gcc -print-file-name=. | $SED 's,/\.$,,'\` +gcc_ver=\`gcc -dumpversion\` + # An ERE matcher. EGREP=$lt_EGREP @@ -18857,7 +18336,7 @@ 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 ? +# Must we lock files when doing compilation? need_locks=$lt_need_locks # Do we need the lib prefix for modules? @@ -18931,11 +18410,11 @@ striplib=$lt_striplib # Dependencies to place before the objects being linked to create a # shared library. -predep_objects=$lt_predep_objects_RC +predep_objects=\`echo $lt_predep_objects_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects=$lt_postdep_objects_RC +postdep_objects=\`echo $lt_postdep_objects_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Dependencies to place before the objects being linked to create a # shared library. @@ -18947,7 +18426,7 @@ postdeps=$lt_postdeps_RC # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_RC +compiler_lib_search_path=\`echo $lt_compiler_lib_search_path_RC | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method @@ -19027,7 +18506,7 @@ variables_saved_for_relink="$variables_saved_for_relink" 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 +sys_lib_search_path_spec=\`echo $lt_sys_lib_search_path_spec | \$SED -e "s@\${gcc_dir}@\\\${gcc_dir}@g;s@\${gcc_ver}@\\\${gcc_ver}@g"\` # Run-time system search path for libraries sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec @@ -20530,6 +20009,7 @@ s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t +s,@SED@,$SED,;t t s,@EGREP@,$EGREP,;t t s,@LN_S@,$LN_S,;t t s,@ECHO@,$ECHO,;t t diff --git a/api/libsangoma/examples/.svn/all-wcprops b/api/libsangoma/examples/.svn/all-wcprops new file mode 100644 index 0000000..c22dd3c --- /dev/null +++ b/api/libsangoma/examples/.svn/all-wcprops @@ -0,0 +1,35 @@ +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/libsangoma/!svn/ver/1/trunk/examples +END +sound.raw +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/libsangoma/!svn/ver/1/trunk/examples/sound.raw +END +priserver.c +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/libsangoma/!svn/ver/1/trunk/examples/priserver.c +END +librc +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/libsangoma/!svn/ver/1/trunk/examples/librc +END +Makefile +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/libsangoma/!svn/ver/1/trunk/examples/Makefile +END +README +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/libsangoma/!svn/ver/1/trunk/examples/README +END diff --git a/api/libsangoma/examples/.svn/entries b/api/libsangoma/examples/.svn/entries index df020f5..f2cd7d0 100644 --- a/api/libsangoma/examples/.svn/entries +++ b/api/libsangoma/examples/.svn/entries @@ -1,15 +1,15 @@ 8 dir -237 -svn://sangoma.freeswitch.org/libsangoma/trunk/examples -svn://sangoma.freeswitch.org +1 +https://www.sangomapbx.com/svn/libsangoma/trunk/examples +https://www.sangomapbx.com/svn/libsangoma -2007-05-29T18:03:36.038276Z -206 -ncorbic +2008-02-28T18:51:53.196120Z +1 +root svn:special svn:externals svn:needs-lock @@ -24,7 +24,7 @@ svn:special svn:externals svn:needs-lock -2028fedf-720c-0410-83b8-d54a3e729fb0 +8fe45b59-3c47-0410-bdf9-e5d932a076a6 sound.raw file @@ -32,11 +32,11 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z da36acc78b83d5047481df0cca63d969 -2006-03-23T23:03:41.659017Z -26 -mikej +2008-02-28T18:51:53.196120Z +1 +root has-props priserver.c @@ -45,11 +45,11 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z 9f83030c20158d91b7ec6bb7a9392dcb -2006-03-23T23:54:12.054610Z -27 -ncorbic +2008-02-28T18:51:53.196120Z +1 +root librc file @@ -57,11 +57,11 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z 5c222b74d68b1c7df3f937a9d6321d40 -2006-03-23T23:03:41.659017Z -26 -mikej +2008-02-28T18:51:53.196120Z +1 +root Makefile file @@ -69,11 +69,11 @@ file -2007-07-24T22:45:02.000000Z +2008-02-28T19:04:34.000000Z b58ee42eeb2d5e921bdab940a9fda738 -2007-05-29T18:03:36.038276Z -206 -ncorbic +2008-02-28T18:51:53.196120Z +1 +root README file @@ -81,9 +81,9 @@ file -2007-05-17T23:49:20.000000Z +2008-02-28T19:04:34.000000Z 40538792592cd766e4941d9b37dbaf56 -2006-03-23T23:03:41.659017Z -26 -mikej +2008-02-28T18:51:53.196120Z +1 +root diff --git a/api/libsangoma/libsangoma.c b/api/libsangoma/libsangoma.c index 6fc9025..aaea8a8 100644 --- a/api/libsangoma/libsangoma.c +++ b/api/libsangoma/libsangoma.c @@ -22,26 +22,18 @@ #include "libsangoma.h" #define DFT_CARD "wanpipe1" - -#ifndef WP_TDM_EVENT_FE_ALARM -#warning "Note: TDM FE ALARM not supported by driver" +#ifndef WP_TDM_FEATURE_FE_ALARM +#warning "Warning: TDM FE ALARM not supported by driver" #endif - -#ifndef WP_TDMAPI_EVENT_DTMF -#warning "Note: TDM DTMF EVENTS not supported by driver" +#ifndef WP_TDM_FEATURE_DTMF_EVENTS +#warning "Warning: TDM DTMF not supported by driver" #endif -#ifndef WP_TDMAPI_EVENT_RING -#warning "Note: TDM RING EVENTS not supported by driver" +#ifndef WP_TDM_FEATURE_EVENTS +#warning "Warning: TDM EVENTS not supported by driver" #endif -#ifndef WP_TDMAPI_EVENT_RXHOOK -#warning "Note: TDM RXHOOK EVENTS not supported by driver" -#endif - - - #if defined(WIN32) //extern int verbose; @@ -529,7 +521,7 @@ int sangoma_get_full_cfg(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) printf("\tusr_mtu_mru:\t%d\n",tdm_api->wp_tdm_cmd.usr_mtu_mru); printf("\tidle flag:\t0x%02X\n",tdm_api->wp_tdm_cmd.idle_flag); -#ifdef WP_TDM_EVENT_FE_ALARM +#ifdef WP_TDM_FEATURE_FE_ALARM printf("\tfe alarms:\t0x%02X\n",tdm_api->wp_tdm_cmd.fe_alarms); #endif @@ -774,7 +766,7 @@ int sangoma_tdm_write_rbs(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) { -#ifdef WP_TDM_EVENT_TDM_API_EVENTS +#ifdef WP_TDM_FEATURE_EVENTS wp_tdm_api_event_t *rx_event; @@ -802,7 +794,8 @@ int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) } break; - + +#ifdef WP_TDM_FEATURE_DTMF_EVENTS case WP_TDMAPI_EVENT_DTMF: printf("%d: GOT DTMF EVENT\n",(int)fd); if (tdm_api->wp_tdm_event.wp_dtmf_event) { @@ -812,6 +805,7 @@ int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) rx_event->wp_tdm_api_event_dtmf_port); } break; +#endif case WP_TDMAPI_EVENT_RXHOOK: printf("%d: GOT RXHOOK EVENT\n",(int)fd); @@ -837,13 +831,13 @@ int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) } break; -#ifdef WP_TDM_EVENT_FE_ALARM - case WP_TDMAPI_EVENT_FE_ALARM: +#ifdef WP_TDM_FEATURE_FE_ALARM + case WP_TDMAPI_EVENT_ALARM: printf("%d: GOT FE ALARMS EVENT %i\n",(int)fd, - rx_event->wp_tdm_api_event_fe_alarm); + rx_event->wp_tdm_api_event_alarm); if (tdm_api->wp_tdm_event.wp_fe_alarm_event) { tdm_api->wp_tdm_event.wp_fe_alarm_event(fd, - rx_event->wp_tdm_api_event_fe_alarm); + rx_event->wp_tdm_api_event_alarm); } #endif @@ -854,13 +848,12 @@ int sangoma_tdm_read_event(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) return 0; #else - return -EINVAL; + printf("Error: Read Event not supported!\n"); + return -1; #endif } - -#ifdef WP_TDMAPI_EVENT_DTMF - +#ifdef WP_TDM_FEATURE_DTMF_EVENTS int sangoma_tdm_enable_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) { int err; @@ -920,12 +913,8 @@ int sangoma_tdm_disable_rm_dtmf_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) return 0; } - #endif - -#ifdef WP_TDMAPI_EVENT_RXHOOK - int sangoma_tdm_enable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) { int err; @@ -940,8 +929,6 @@ int sangoma_tdm_enable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) return 0; } -NNN - int sangoma_tdm_disable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) { @@ -958,10 +945,6 @@ int sangoma_tdm_disable_rxhook_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) return 0; } -#endif - -#ifdef WP_TDMAPI_EVENT_RING - int sangoma_tdm_enable_ring_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) { int err; @@ -1149,40 +1132,39 @@ int sangoma_tdm_disable_tone_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) { return tdm_api->wp_tdm_cmd.rbs_poll; } -#endif - -int sangoma_tdm_enable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) +int sangoma_tdm_enable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) { - int err; + int err; - tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_ENABLE_HWEC; - err=sangoma_tdm_cmd_exec(fd,tdm_api); - if (err){ - return err; - } + tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_ENABLE_HWEC; + err=sangoma_tdm_cmd_exec(fd,tdm_api); + if (err){ + return err; + } - return 0; + return 0; } -int sangoma_tdm_disable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) +int sangoma_tdm_disable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) { - int err; + int err; - tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_DISABLE_HWEC; - err=sangoma_tdm_cmd_exec(fd,tdm_api); - if (err){ - return err; - } + tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_DISABLE_HWEC; + err=sangoma_tdm_cmd_exec(fd,tdm_api); + if (err){ + return err; + } - return 0; + return 0; } + /*======================================================== * GET Front End Alarms * */ -#ifdef WP_TDM_EVENT_FE_ALARM +#ifdef WP_TDM_FEATURE_FE_ALARM int sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) { int err; @@ -1198,4 +1180,26 @@ int sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api) } #endif +/* get current Line Connection state - Connected/Disconnected */ +int sangoma_tdm_get_fe_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char *current_status) +{ + int err; + + tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_GET_FE_STATUS; + err = sangoma_tdm_cmd_exec(fd, tdm_api); + *current_status = tdm_api->wp_tdm_cmd.fe_status; + + return err; +} + + +/* set current Line Connection state - Connected/Disconnected. valid only for ISDN BRI */ +int sangoma_tdm_set_fe_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char new_status) +{ + tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_SET_FE_STATUS; + tdm_api->wp_tdm_cmd.fe_status = new_status; + + return sangoma_tdm_cmd_exec(fd, tdm_api); +} + #endif /* WANPIPE_TDM_API */ diff --git a/api/libsangoma/libsangoma.h b/api/libsangoma/libsangoma.h index 438307a..fab9646 100644 --- a/api/libsangoma/libsangoma.h +++ b/api/libsangoma/libsangoma.h @@ -50,6 +50,7 @@ typedef unsigned __int32 u_int32_t; typedef HANDLE sng_fd_t; #else +/* L I N U X */ #include #include #include @@ -76,6 +77,7 @@ typedef HANDLE sng_fd_t; #ifdef WANPIPE_TDM_API # include #endif + #endif #define FNAME_LEN 50 @@ -176,15 +178,20 @@ int sangoma_tdm_disable_tone_events(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); int sangoma_tdm_get_fe_alarms(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); -int sangoma_tdm_enable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); -int sangoma_tdm_disable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); - - int sangoma_tdm_txsig_onhook(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); int sangoma_tdm_txsig_offhook(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); int sangoma_tdm_txsig_start(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); int sangoma_tdm_txsig_kewl(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); +int sangoma_tdm_enable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); +int sangoma_tdm_disable_hwec(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api); + +/* get current Line Connection state - Connected/Disconnected */ +int sangoma_tdm_get_fe_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char *current_status); +/* set current Line Connection state - Connected/Disconnected. valid only for ISDN BRI */ +int sangoma_tdm_set_fe_status(sng_fd_t fd, wanpipe_tdm_api_t *tdm_api, unsigned char new_status); + + #ifndef LIBSANGOMA_GET_HWCODING #define LIBSANGOMA_GET_HWCODING 1 #endif @@ -193,3 +200,4 @@ int sangoma_tdm_get_hw_coding(int fd, wanpipe_tdm_api_t *tdm_api); #endif /* WANPIPE_TDM_API */ #endif + diff --git a/api/libsangoma/libtool b/api/libsangoma/libtool index f9613b6..513bbc3 100755 --- a/api/libsangoma/libtool +++ b/api/libsangoma/libtool @@ -22,7 +22,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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 @@ -33,11 +33,11 @@ SED="/bin/sed" # Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="/bin/sed -e s/^X//" +Xsed="/bin/sed -e 1s/^X//" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # The names of the tagged configurations supported by this script. available_tags=" CXX F77" @@ -67,6 +67,12 @@ fast_install=yes # The host system. host_alias= host=i686-pc-linux-gnu +host_os=linux-gnu + +# The build system. +build_alias= +build=i686-pc-linux-gnu +build_os=linux-gnu # An echo program that does not interpret backslashes. echo="echo" @@ -78,12 +84,18 @@ AR_FLAGS="cru" # A C compiler. LTCC="gcc" +# LTCC compiler flags. +LTCFLAGS="-g -O2" + # A language-specific compiler. CC="gcc" # Is the compiler the GNU C compiler? with_gcc=yes +gcc_dir=`gcc -print-file-name=. | /bin/sed 's,/\.$,,'` +gcc_ver=`gcc -dumpversion` + # An ERE matcher. EGREP="grep -E" @@ -143,7 +155,7 @@ max_cmd_len=32768 # Does compiler simultaneously support -c and -o options? compiler_c_o="yes" -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks="no" # Do we need the lib prefix for modules? @@ -192,7 +204,7 @@ soname_spec="\${libname}\${release}\${shared_ext}\$major" # Commands used to build and install an old-style archive. RANLIB="ranlib" old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib" -old_postinstall_cmds="\$RANLIB \$oldlib~chmod 644 \$oldlib" +old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib" old_postuninstall_cmds="" # Create an old-style archive from a shared archive. @@ -204,9 +216,9 @@ old_archive_from_expsyms_cmds="" # Commands used to build and install a shared archive. archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" 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 -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib" + cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~ + \$echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~ + \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib" postinstall_cmds="" postuninstall_cmds="" @@ -220,11 +232,11 @@ striplib="strip --strip-unneeded" # Dependencies to place before the objects being linked to create a # shared library. -predep_objects="" +predep_objects=`echo "" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects="" +postdep_objects=`echo "" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # Dependencies to place before the objects being linked to create a # shared library. @@ -236,7 +248,7 @@ postdeps="" # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path="" +compiler_lib_search_path=`echo "" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # Method to check whether dependent libraries are shared objects. deplibs_check_method="pass_all" @@ -257,7 +269,7 @@ finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" finish_eval="" # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'" +global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'" # Transform the output of nm in a proper C declaration global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'" @@ -310,16 +322,16 @@ hardcode_automatic=no # Variables whose values should be saved in libtool wrapper scripts and # restored at relink time. -variables_saved_for_relink="PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=unknown # Compile-time system search path for libraries -sys_lib_search_path_spec=" /usr/lib/gcc/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../i386-redhat-linux/lib/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../ /lib/i386-redhat-linux/4.1.1/ /lib/ /usr/lib/i386-redhat-linux/4.1.1/ /usr/lib/" +sys_lib_search_path_spec=`echo " /usr/lib/gcc/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../i386-redhat-linux/lib/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../ /lib/i386-redhat-linux/4.1.1/ /lib/ /usr/lib/i386-redhat-linux/4.1.1/ /usr/lib/" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # Run-time system search path for libraries -sys_lib_dlsearch_path_spec="/lib /usr/lib include ld.so.conf.d/*.conf /usr/local/lib " +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/local/lib /usr/lib/qt-3.3/lib " # Fix the shell variable $srcfile for the compiler. fix_srcfile_path="" @@ -6768,6 +6780,12 @@ fast_install=yes # The host system. host_alias= host=i686-pc-linux-gnu +host_os=linux-gnu + +# The build system. +build_alias= +build=i686-pc-linux-gnu +build_os=linux-gnu # An echo program that does not interpret backslashes. echo="echo" @@ -6779,12 +6797,18 @@ AR_FLAGS="cru" # A C compiler. LTCC="gcc" +# LTCC compiler flags. +LTCFLAGS="-g -O2" + # A language-specific compiler. CC="g++" # Is the compiler the GNU C compiler? with_gcc=yes +gcc_dir=`gcc -print-file-name=. | /bin/sed 's,/\.$,,'` +gcc_ver=`gcc -dumpversion` + # An ERE matcher. EGREP="grep -E" @@ -6844,7 +6868,7 @@ max_cmd_len=32768 # Does compiler simultaneously support -c and -o options? compiler_c_o="yes" -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks="no" # Do we need the lib prefix for modules? @@ -6893,7 +6917,7 @@ soname_spec="\${libname}\${release}\${shared_ext}\$major" # Commands used to build and install an old-style archive. RANLIB="ranlib" old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib" -old_postinstall_cmds="\$RANLIB \$oldlib~chmod 644 \$oldlib" +old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib" old_postuninstall_cmds="" # Create an old-style archive from a shared archive. @@ -6918,11 +6942,11 @@ striplib="strip --strip-unneeded" # Dependencies to place before the objects being linked to create a # shared library. -predep_objects="/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../crti.o /usr/lib/gcc/i386-redhat-linux/4.1.1/crtbeginS.o" +predep_objects=`echo "/usr/lib/gcc/i386-redhat-linux/4.1.1/../../../crti.o /usr/lib/gcc/i386-redhat-linux/4.1.1/crtbeginS.o" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects="/usr/lib/gcc/i386-redhat-linux/4.1.1/crtendS.o /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../crtn.o" +postdep_objects=`echo "/usr/lib/gcc/i386-redhat-linux/4.1.1/crtendS.o /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../crtn.o" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # Dependencies to place before the objects being linked to create a # shared library. @@ -6934,7 +6958,7 @@ postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s" # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path="-L/usr/lib/gcc/i386-redhat-linux/4.1.1 -L/usr/lib/gcc/i386-redhat-linux/4.1.1 -L/usr/lib/gcc/i386-redhat-linux/4.1.1/../../.." +compiler_lib_search_path=`echo "-L/usr/lib/gcc/i386-redhat-linux/4.1.1 -L/usr/lib/gcc/i386-redhat-linux/4.1.1 -L/usr/lib/gcc/i386-redhat-linux/4.1.1/../../.." | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # Method to check whether dependent libraries are shared objects. deplibs_check_method="pass_all" @@ -6955,7 +6979,7 @@ finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" finish_eval="" # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'" +global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'" # Transform the output of nm in a proper C declaration global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'" @@ -7000,7 +7024,7 @@ hardcode_minus_L=no # Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into # the resulting binary. -hardcode_shlibpath_var= +hardcode_shlibpath_var=unsupported # Set to yes if building a shared library automatically hardcodes DIR into the library # and all subsequent libraries and executables linked against it. @@ -7014,10 +7038,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM link_all_deplibs=unknown # Compile-time system search path for libraries -sys_lib_search_path_spec=" /usr/lib/gcc/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../i386-redhat-linux/lib/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../ /lib/i386-redhat-linux/4.1.1/ /lib/ /usr/lib/i386-redhat-linux/4.1.1/ /usr/lib/" +sys_lib_search_path_spec=`echo " /usr/lib/gcc/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../i386-redhat-linux/lib/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../ /lib/i386-redhat-linux/4.1.1/ /lib/ /usr/lib/i386-redhat-linux/4.1.1/ /usr/lib/" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # Run-time system search path for libraries -sys_lib_dlsearch_path_spec="/lib /usr/lib include ld.so.conf.d/*.conf /usr/local/lib " +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/local/lib /usr/lib/qt-3.3/lib " # Fix the shell variable $srcfile for the compiler. fix_srcfile_path="" @@ -7064,6 +7088,12 @@ fast_install=yes # The host system. host_alias= host=i686-pc-linux-gnu +host_os=linux-gnu + +# The build system. +build_alias= +build=i686-pc-linux-gnu +build_os=linux-gnu # An echo program that does not interpret backslashes. echo="echo" @@ -7075,12 +7105,18 @@ AR_FLAGS="cru" # A C compiler. LTCC="gcc" +# LTCC compiler flags. +LTCFLAGS="-g -O2" + # A language-specific compiler. CC="f95" # Is the compiler the GNU C compiler? with_gcc=yes +gcc_dir=`gcc -print-file-name=. | /bin/sed 's,/\.$,,'` +gcc_ver=`gcc -dumpversion` + # An ERE matcher. EGREP="grep -E" @@ -7140,7 +7176,7 @@ max_cmd_len=32768 # Does compiler simultaneously support -c and -o options? compiler_c_o="yes" -# Must we lock files when doing compilation ? +# Must we lock files when doing compilation? need_locks="no" # Do we need the lib prefix for modules? @@ -7189,7 +7225,7 @@ soname_spec="\${libname}\${release}\${shared_ext}\$major" # Commands used to build and install an old-style archive. RANLIB="ranlib" old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs\$old_deplibs~\$RANLIB \$oldlib" -old_postinstall_cmds="\$RANLIB \$oldlib~chmod 644 \$oldlib" +old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib" old_postuninstall_cmds="" # Create an old-style archive from a shared archive. @@ -7201,9 +7237,9 @@ old_archive_from_expsyms_cmds="" # Commands used to build and install a shared archive. archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" 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 -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib" + cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~ + \$echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~ + \$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib" postinstall_cmds="" postuninstall_cmds="" @@ -7217,11 +7253,11 @@ striplib="strip --strip-unneeded" # Dependencies to place before the objects being linked to create a # shared library. -predep_objects="" +predep_objects=`echo "" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects="" +postdep_objects=`echo "" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # Dependencies to place before the objects being linked to create a # shared library. @@ -7233,7 +7269,7 @@ postdeps="" # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path="" +compiler_lib_search_path=`echo "" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # Method to check whether dependent libraries are shared objects. deplibs_check_method="pass_all" @@ -7254,7 +7290,7 @@ finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" finish_eval="" # Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\(\\)\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2\\3 \\3/p'" +global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'" # Transform the output of nm in a proper C declaration global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'" @@ -7313,10 +7349,10 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM link_all_deplibs=unknown # Compile-time system search path for libraries -sys_lib_search_path_spec=" /usr/lib/gcc/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../i386-redhat-linux/lib/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../ /lib/i386-redhat-linux/4.1.1/ /lib/ /usr/lib/i386-redhat-linux/4.1.1/ /usr/lib/" +sys_lib_search_path_spec=`echo " /usr/lib/gcc/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../i386-redhat-linux/lib/i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../../i386-redhat-linux/lib/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../i386-redhat-linux/4.1.1/ /usr/lib/gcc/i386-redhat-linux/4.1.1/../../../ /lib/i386-redhat-linux/4.1.1/ /lib/ /usr/lib/i386-redhat-linux/4.1.1/ /usr/lib/" | $SED -e "s@${gcc_dir}@\${gcc_dir}@g;s@${gcc_ver}@\${gcc_ver}@g"` # Run-time system search path for libraries -sys_lib_dlsearch_path_spec="/lib /usr/lib include ld.so.conf.d/*.conf /usr/local/lib " +sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/local/lib /usr/lib/qt-3.3/lib " # Fix the shell variable $srcfile for the compiler. fix_srcfile_path="" diff --git a/api/libsangoma/svn-commit.2.tmp b/api/libsangoma/svn-commit.2.tmp new file mode 100644 index 0000000..48940b9 --- /dev/null +++ b/api/libsangoma/svn-commit.2.tmp @@ -0,0 +1,5 @@ +Added new event support +--This line, and those below, will be ignored-- + +M libsangoma.c +M libsangoma.h diff --git a/api/libsangoma/svn-commit.tmp b/api/libsangoma/svn-commit.tmp index d2cd19d..4965420 100644 --- a/api/libsangoma/svn-commit.tmp +++ b/api/libsangoma/svn-commit.tmp @@ -1,4 +1,5 @@ - +Added new event features --This line, and those below, will be ignored-- -A libsangoma.so.conf +M libsangoma.c +M libsangoma.h diff --git a/api/tdmapi/Makefile b/api/tdmapi/Makefile index 95689cd..5618efe 100644 --- a/api/tdmapi/Makefile +++ b/api/tdmapi/Makefile @@ -12,18 +12,21 @@ DEBUG = 2 SYSINC=$(shell if [ -f ../../.sysinclude ]; then cat ../../.sysinclude; else echo ""; fi) ifeq "$(SYSINC)" "" -SYSINC=/lib/modules/$(shell uname -r)/build/include +SYSINC=/usr/src/linux/include endif -SRCINC=../../patches/kdrivers/include VPATH = $(SYSINC) # Tools options. -CFLAGS = -Wall -O2 -D$(OS_TYPE) -D_DEBUG_=$(DEBUG) -D_GNUC_ -I../lib/hdlc -I../lib -I$(SYSINC) -I$(SRCINC) +CFLAGS = -Wall -O2 -D$(OS_TYPE) -DWANPIPE_TDM_API -D_DEBUG_=$(DEBUG) -D_GNUC_ -I../lib/hdlc -I../lib +CFLAGS += -I/usr/include/wanpipe +#CFLAGS = -I$(SYSINC) TARGETS = aft_tdm_voice_api +TARGETS += aft_tdm_voice_api_switch TARGETS += aft_tdm_hdlc_test TARGETS += aft_tdm_voice_api_rbs -#TARGETS += aft_tdm_voice_api_dtmf +TARGETS += aft_tdm_voice_api_dtmf +TARGETS += aft_tdm_voice_api_rm_events #TARGETS += aft_tdm_voice_api_rm_dtmf #TARGETS += aft_tdm_voice_api_rxhook @@ -32,9 +35,18 @@ TARGETS += aft_tdm_voice_api_rbs all: $(TARGETS) @echo "Ok." +install: + for x in $(TARGETS); do \ + install -D -m 755 $$x /usr/bin/$$x; \ + done; + + aft_tdm_voice_api: aft_tdm_voice_api.c ../lib/lib_api.c $(CC) $(CFLAGS) -o $@ $^ -lsangoma -lm +aft_tdm_voice_api_switch: aft_tdm_voice_api_switch.c ../lib/lib_api.c + $(CC) $(CFLAGS) -o $@ $^ -lsangoma -lm + aft_tdm_hdlc_test: aft_tdm_hdlc_test.c ../lib/hdlc/wanpipe_hdlc.c $(CC) $(CFLAGS) -o $@ $^ -lsangoma -lm @@ -44,6 +56,9 @@ aft_tdm_voice_api_rbs: aft_tdm_voice_api_rbs.c ../lib/lib_api.c aft_tdm_voice_api_dtmf: aft_tdm_voice_api_dtmf.c ../lib/lib_api.c $(CC) $(CFLAGS) -o $@ $^ -lsangoma -lm +aft_tdm_voice_api_rm_events: aft_tdm_voice_api_rm_events.c ../lib/lib_api.c + $(CC) $(CFLAGS) -o $@ $^ -lsangoma -lm + aft_tdm_voice_api_rm_dtmf: aft_tdm_voice_api_rm_dtmf.c ../lib/lib_api.c $(CC) $(CFLAGS) -o $@ $^ -lsangoma -lm diff --git a/api/tdmapi/aft_tdm_hdlc_test b/api/tdmapi/aft_tdm_hdlc_test new file mode 100755 index 0000000..9b8d37b Binary files /dev/null and b/api/tdmapi/aft_tdm_hdlc_test differ diff --git a/api/tdmapi/aft_tdm_hdlc_test.c b/api/tdmapi/aft_tdm_hdlc_test.c index 06b09e1..67944d4 100644 --- a/api/tdmapi/aft_tdm_hdlc_test.c +++ b/api/tdmapi/aft_tdm_hdlc_test.c @@ -48,12 +48,12 @@ #define TRUE 1 /* Enable/Disable tx of random frames */ -#define RAND_FRAME 1 +#define RAND_FRAME 0 #define MAX_NUM_OF_TIMESLOTS 31*16 #define LGTH_CRC_BYTES 2 -#define MAX_TX_DATA 5000 //MAX_NUM_OF_TIMESLOTS*10 /* Size of tx data */ +#define MAX_TX_DATA 1000 //MAX_NUM_OF_TIMESLOTS*10 /* Size of tx data */ #define MAX_TX_FRAMES 1000000 /* Number of frames to transmit */ #define WRITE 1 @@ -126,7 +126,6 @@ int MakeConnection(timeslot_t *slot, char *router_name ) int span,chan; sangoma_span_chan_fromif(slot->if_name,&span,&chan); - printf("Socket bound %s to Span=%i Chan=%i\n\n",slot->if_name,span,chan); if (span > 0 && chan > 0) { wanpipe_tdm_api_t tdm_api; @@ -432,7 +431,7 @@ void process_con_tx(timeslot_t *slot) */ memset(&Tx_data[0],0,MAX_TX_DATA + sizeof(wp_tdm_api_tx_hdr_t)); - slot->data=1; + slot->data=0; for (i=0;idata){ Tx_data[i+sizeof(wp_tdm_api_tx_hdr_t)] = slot->data; @@ -480,7 +479,7 @@ void process_con_tx(timeslot_t *slot) printf("TX DATA ORIG: Len=%i\n",Tx_hdlc_len); print_packet(&Tx_data[sizeof(wp_tdm_api_tx_hdr_t)],Tx_hdlc_len); #endif - wanpipe_hdlc_encode(hdlc_eng,&Tx_data[16],Tx_hdlc_len,&Tx_hdlc_data[16],(int*)&Tx_encoded_hdlc_len,&next_idle); + wanpipe_hdlc_encode(hdlc_eng,&Tx_data[16],Tx_hdlc_len,&Tx_hdlc_data[16],&Tx_encoded_hdlc_len,&next_idle); if (Tx_encoded_hdlc_len < (max_tx_len*2)){ int j; for (j=0;j<((max_tx_len*2) - Tx_encoded_hdlc_len);j++){ diff --git a/api/tdmapi/aft_tdm_voice_api b/api/tdmapi/aft_tdm_voice_api new file mode 100755 index 0000000..bc238c9 Binary files /dev/null and b/api/tdmapi/aft_tdm_voice_api differ diff --git a/api/tdmapi/aft_tdm_voice_api.c b/api/tdmapi/aft_tdm_voice_api.c index 4f1682e..c3bc330 100644 --- a/api/tdmapi/aft_tdm_voice_api.c +++ b/api/tdmapi/aft_tdm_voice_api.c @@ -414,7 +414,7 @@ int main(int argc, char* argv[]) proceed=init_args(argc,argv); if (proceed != WAN_TRUE){ - usage((unsigned char*)argv[0]); + usage(argv[0]); return -1; } diff --git a/api/tdmapi/aft_tdm_voice_api_dtmf b/api/tdmapi/aft_tdm_voice_api_dtmf new file mode 100755 index 0000000..3ff0382 Binary files /dev/null and b/api/tdmapi/aft_tdm_voice_api_dtmf differ diff --git a/api/tdmapi/aft_tdm_voice_api_dtmf.c b/api/tdmapi/aft_tdm_voice_api_dtmf.c new file mode 100644 index 0000000..492db3f --- /dev/null +++ b/api/tdmapi/aft_tdm_voice_api_dtmf.c @@ -0,0 +1,254 @@ +/***************************************************************************** +* aft_api.c AFT T1/E1: HDLC API Sample Code +* +* Author(s): Nenad Corbic +* +* Copyright: (c) 2003-2004 Sangoma Technologies 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. +* ============================================================================ +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "lib_api.h" + +#define MAX_TX_DATA 5000 /* Size of tx data */ +#define MAX_FRAMES 5000 /* Number of frames to transmit */ + +#define MAX_RX_DATA 5000 + +unsigned short Rx_lgth; + +unsigned char Rx_data[MAX_RX_DATA]; +unsigned char Tx_data[MAX_TX_DATA + sizeof(wp_tdm_api_rx_hdr_t)]; + +/* Prototypes */ +int MakeConnection(void); +void handle_span_chan( void); +void sig_end(int sigid); + +int dev_fd; +FILE *tx_fd=NULL,*rx_fd=NULL; +wanpipe_tdm_api_t tdm_api; + + +/*************************************************** +* HANDLE SOCKET +* +* o Read a socket +* o Cast data received to api_rx_element_t data type +* o The received packet contains 16 bytes header +* +* ------------------------------------------ +* | 16 bytes | X bytes ... +* ------------------------------------------ +* Header Data +* +* o Data structures: +* ------------------ +* typedef struct { +* union { +* struct { +* unsigned char _event_type; +* unsigned char _rbs_rx_bits; +* unsigned int _time_stamp; +* }wp_event; +* struct { +* unsigned char _rbs_rx_bits; +* unsigned int _time_stamp; +* }wp_rx; +* unsigned char reserved[16]; +* }wp_rx_hdr_u; +* #define wp_api_event_type wp_rx_hdr_u.wp_event._event_type +* #define wp_api_event_rbs_rx_bits wp_rx_hdr_u.wp_event._rbs_rx_bits +* #define wp_api_event_time_stamp wp_rx_hdr_u.wp_event._time_stamp +* } wp_tdm_api_rx_hdr_t; +* +* typedef struct { +* wp_tdm_api_rx_hdr_t hdr; +* unsigned char data[1]; +* } wp_tdm_api_rx_element_t; +* +* typedef struct { +* union { +* struct { +* unsigned char _rbs_rx_bits; +* unsigned int _time_stamp; +* }wp_tx; +* unsigned char reserved[16]; +* }wp_tx_hdr_u; +* #define wp_api_time_stamp wp_tx_hdr_u.wp_tx._time_stamp +* } wp_tdm_api_tx_hdr_t; +* +* typedef struct { +* wp_tdm_api_tx_hdr_t hdr; +* unsigned char data[1]; +* } wp_tdm_api_tx_element_t; +* +* #define WPTDM_A_BIT 0x08 +* #define WPTDM_B_BIT 0x04 +* #define WPTDM_C_BIT 0x02 +* #define WPTDM_D_BIT 0x01 +* +*/ + +void handle_span_chan(void) +{ + unsigned int Rx_count,Tx_count,Tx_length; + int err; + +#if 0 + int rlen; + int stream_sync=0; +#endif + + Rx_count = 0; + Tx_count = 0; + + if (tdm_api.wp_tdm_cmd.hdlc) { + Tx_length = tx_size; + } else { + Tx_length = tdm_api.wp_tdm_cmd.usr_mtu_mru; + } + + printf("\n\nSocket Handler: Rx=%d Tx=%i TxCnt=%i TxLen=%i TxDelay=%i\n", + read_enable,write_enable,tx_cnt,tx_size,tx_delay); + + sangoma_tdm_enable_dtmf_events(dev_fd, &tdm_api); + + /* Main Rx Tx OOB routine */ + for(;;) { + + err = sangoma_socket_waitfor(dev_fd, 1000, POLLPRI); + printf("ret:%d\n", err); + if (err){ + err=sangoma_tdm_read_event(dev_fd,&tdm_api); + if(err < 0 ) { + printf("Failed to receive EVENT %d\n", err); + break; + } + + printf("GOT OOB EXCEPTION CMD Exiting\n"); + } + + if (++Rx_count >= rx_cnt){ + break; + } + + } + + sangoma_tdm_disable_dtmf_events(dev_fd, &tdm_api); + if (tx_fd){ + fclose(tx_fd); + } + if (rx_fd){ + fclose(rx_fd); + } + close (dev_fd); + + return; +} + +int dtmf_event (int fd, unsigned char digit, unsigned char type, unsigned char port) +{ + printf("%d: DTMV Event: %c (%s:%s)!\n", + fd, + digit, + (port == WAN_EC_CHANNEL_PORT_ROUT)?"ROUT":"SOUT", + (type == WAN_EC_TONE_PRESENT)?"PRESET":"STOP"); + return 0; +} + + +/*************************************************************** + * Main: + * + * o Make a socket connection to the driver. + * o Call handle_span_chan() to read the socket + * + **************************************************************/ + + +int main(int argc, char* argv[]) +{ + int proceed; + + proceed=init_args(argc,argv); + if (proceed != WAN_TRUE){ + usage(argv[0]); + return -1; + } + + signal(SIGINT,&sig_end); + memset(&tdm_api,0,sizeof(tdm_api)); + tdm_api.wp_tdm_event.wp_dtmf_event = &dtmf_event; + + printf("TDM DTMF PTR = %p\n",tdm_api.wp_tdm_event.wp_dtmf_event); + + dev_fd =-1; + + dev_fd = sangoma_open_tdmapi_span_chan(atoi(card_name),atoi(if_name)); + if( dev_fd < 0){ + printf("Failed to open span chan(%s:%d,%s:%d)\n", + card_name,atoi(card_name),if_name,atoi(if_name)); + exit (1); + } + printf("HANDLING SPAN %i CHAN %i FD=%i\n", + atoi(card_name),atoi(if_name),dev_fd); + + sangoma_tdm_set_codec(dev_fd,&tdm_api,WP_NONE); + sangoma_get_full_cfg(dev_fd, &tdm_api); + + handle_span_chan(); + close(dev_fd); + return 0; + + return 0; +}; + + +void sig_end(int sigid) +{ + + printf("Got Signal %i\n",sigid); + + sangoma_tdm_disable_dtmf_events(dev_fd, &tdm_api); + + if (tx_fd){ + fclose(tx_fd); + } + if (rx_fd){ + fclose(rx_fd); + } + + if (dev_fd){ + close (dev_fd); + } + + exit(1); +} + + + diff --git a/api/tdmapi/aft_tdm_voice_api_rbs b/api/tdmapi/aft_tdm_voice_api_rbs new file mode 100755 index 0000000..d81f68c Binary files /dev/null and b/api/tdmapi/aft_tdm_voice_api_rbs differ diff --git a/api/tdmapi/aft_tdm_voice_api_rbs.c b/api/tdmapi/aft_tdm_voice_api_rbs.c index efaa45f..7e1a696 100644 --- a/api/tdmapi/aft_tdm_voice_api_rbs.c +++ b/api/tdmapi/aft_tdm_voice_api_rbs.c @@ -449,7 +449,7 @@ int main(int argc, char* argv[]) proceed=init_args(argc,argv); if (proceed != WAN_TRUE){ - usage((unsigned char*)argv[0]); + usage(argv[0]); return -1; } diff --git a/api/tdmapi/aft_tdm_voice_api_rm_dtmf b/api/tdmapi/aft_tdm_voice_api_rm_dtmf new file mode 100755 index 0000000..8163761 Binary files /dev/null and b/api/tdmapi/aft_tdm_voice_api_rm_dtmf differ diff --git a/api/tdmapi/aft_tdm_voice_api_rm_dtmf.c b/api/tdmapi/aft_tdm_voice_api_rm_dtmf.c new file mode 100644 index 0000000..872947a --- /dev/null +++ b/api/tdmapi/aft_tdm_voice_api_rm_dtmf.c @@ -0,0 +1,445 @@ +/***************************************************************************** +* aft_api.c AFT T1/E1: HDLC API Sample Code +* +* Author(s): Nenad Corbic +* +* Copyright: (c) 2003-2004 Sangoma Technologies 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. +* ============================================================================ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "lib_api.h" + +#define MAX_TX_DATA 5000 /* Size of tx data */ +#define MAX_FRAMES 5000 /* Number of frames to transmit */ + +#define MAX_RX_DATA 5000 + +unsigned short Rx_lgth; + +unsigned char Rx_data[MAX_RX_DATA]; +unsigned char Tx_data[MAX_TX_DATA + sizeof(wp_tdm_api_rx_hdr_t)]; + +/* Prototypes */ +int MakeConnection(void); +void handle_span_chan( void); +void sig_end(int sigid); + +int dev_fd; +FILE *tx_fd=NULL,*rx_fd=NULL; +wanpipe_tdm_api_t tdm_api; + + +/*************************************************** +* HANDLE SOCKET +* +* o Read a socket +* o Cast data received to api_rx_element_t data type +* o The received packet contains 16 bytes header +* +* ------------------------------------------ +* | 16 bytes | X bytes ... +* ------------------------------------------ +* Header Data +* +* o Data structures: +* ------------------ +* typedef struct { +* union { +* struct { +* unsigned char _event_type; +* unsigned char _rbs_rx_bits; +* unsigned int _time_stamp; +* }wp_event; +* struct { +* unsigned char _rbs_rx_bits; +* unsigned int _time_stamp; +* }wp_rx; +* unsigned char reserved[16]; +* }wp_rx_hdr_u; +* #define wp_api_event_type wp_rx_hdr_u.wp_event._event_type +* #define wp_api_event_rbs_rx_bits wp_rx_hdr_u.wp_event._rbs_rx_bits +* #define wp_api_event_time_stamp wp_rx_hdr_u.wp_event._time_stamp +* } wp_tdm_api_rx_hdr_t; +* +* typedef struct { +* wp_tdm_api_rx_hdr_t hdr; +* unsigned char data[1]; +* } wp_tdm_api_rx_element_t; +* +* typedef struct { +* union { +* struct { +* unsigned char _rbs_rx_bits; +* unsigned int _time_stamp; +* }wp_tx; +* unsigned char reserved[16]; +* }wp_tx_hdr_u; +* #define wp_api_time_stamp wp_tx_hdr_u.wp_tx._time_stamp +* } wp_tdm_api_tx_hdr_t; +* +* typedef struct { +* wp_tdm_api_tx_hdr_t hdr; +* unsigned char data[1]; +* } wp_tdm_api_tx_element_t; +* +* #define WPTDM_A_BIT 0x08 +* #define WPTDM_B_BIT 0x04 +* #define WPTDM_C_BIT 0x02 +* #define WPTDM_D_BIT 0x01 +* +*/ + +void handle_span_chan(void) +{ + unsigned int Rx_count,Tx_count,Tx_length; + wp_tdm_api_rx_element_t* api_rx_el; + wp_tdm_api_tx_element_t * api_tx_el; + fd_set ready,write,oob; + int err,i; + +#if 0 + int rlen; + int stream_sync=0; +#endif + + Rx_count = 0; + Tx_count = 0; + + if (tdm_api.wp_tdm_cmd.hdlc) { + Tx_length = tx_size; + } else { + Tx_length = tdm_api.wp_tdm_cmd.usr_mtu_mru; + } + + printf("\n\nSocket Handler: Rx=%d Tx=%i TxCnt=%i TxLen=%i TxDelay=%i\n", + read_enable,write_enable,tx_cnt,tx_size,tx_delay); + + /* Initialize the Tx Data buffer */ + memset(&Tx_data[0],0,MAX_TX_DATA + sizeof(wp_tdm_api_rx_hdr_t)); + + /* Cast the Tx data packet with the tx element + * structure. We must insert a 16 byte + * driver header, which driver will remove + * before passing packet out the physical port */ + api_tx_el = (wp_tdm_api_tx_element_t*)&Tx_data[0]; + + + /* Create a Tx packet based on user info, or + * by deafult incrementing number starting from 0 */ + for (i=0;idata[i] = (unsigned char)i; + }else{ +#if 0 + api_tx_el->data[i] = (unsigned char)tx_data+(i%4); +#else + api_tx_el->data[i] = (unsigned char)tx_data; +#endif + } + } + + sangoma_tdm_enable_rm_dtmf_events(dev_fd, &tdm_api); + + /* Main Rx Tx OOB routine */ + for(;;) { + + /* Initialize all select() descriptors */ + FD_ZERO(&ready); + FD_ZERO(&write); + FD_ZERO(&oob); + FD_SET(dev_fd,&oob); + FD_SET(dev_fd,&ready); + + if (write_enable){ + FD_SET(dev_fd,&write); + } + + /* Select will block, until: + * 1: OOB event, link level change + * 2: Rx data available + * 3: Interface able to Tx */ + + if(select(dev_fd + 1,&ready, &write, &oob, NULL)){ + + fflush(stdout); + if (FD_ISSET(dev_fd,&oob)){ + + /* An OOB event is pending, usually indicating + * a link level change */ + + err=sangoma_tdm_read_event(dev_fd,&tdm_api); + + if(err < 0 ) { + printf("Failed to receive OOB %i , %i\n", Rx_count, err); + err = ioctl(dev_fd,SIOC_WANPIPE_SOCK_STATE,0); + printf("Sock state is %s\n", + (err == 0) ? "CONNECTED" : + (err == 1) ? "DISCONNECTED" : + "CONNECTING"); + break; + } + + printf("GOT OOB EXCEPTION CMD Exiting\n"); + } + + + if (FD_ISSET(dev_fd,&ready)){ + + /* An Rx packet is pending + * 1: Read the rx packet into the Rx_data + * buffer. Confirm len > 0 + * + * 2: Cast Rx_data to the api_rx_element. + * Thus, removing a 16 byte header + * attached by the driver. + * + * 3. Check error_flag: + * CRC,Abort..etc + */ + + memset(Rx_data, 0, sizeof(Rx_data)); + + err = sangoma_readmsg_tdm(dev_fd, + Rx_data, + sizeof(wp_tdm_api_rx_hdr_t), + &Rx_data[sizeof(wp_tdm_api_rx_hdr_t)], + MAX_RX_DATA, 0); + + + if (!read_enable){ + goto bitstrm_skip_read; + } + + /* err indicates bytes received */ + if(err <= 0) { + printf("\nError receiving data\n"); + break; + } + + api_rx_el = (wp_tdm_api_rx_element_t*)&Rx_data[0]; + + /* Check the packet length */ + Rx_lgth = err; + if(Rx_lgth<=0) { + printf("\nShort frame received (%d)\n", + Rx_lgth); + return; + } + +#if 0 + if (api_rx_el->data[0] == tx_data && api_rx_el->data[1] == (tx_data+1)){ + if (!stream_sync){ + printf("GOT SYNC %x\n",api_rx_el->data[0]); + } + stream_sync=1; + }else{ + if (stream_sync){ + printf("OUT OF SYNC: %x\n",api_rx_el->data[0]); + } + } +#endif + + ++Rx_count; + + if (verbose){ + printf("Received %i Length = %i\n", + Rx_count,Rx_lgth); +#if 1 + printf("Data: "); + for(i=0;idata[i]); + } + printf("\n"); +#endif + }else{ + //putchar('R'); + } + + +#if 0 + switch(api_rx_el->hdr.wp_api_event_type){ + case WP_TDM_EVENT_DTMF: + printf("DTMV Event: %c (%s:%s)!\n", + api_rx_el->hdr.wp_api_event_dtmf_digit, + (api_rx_el->hdr.wp_api_event_dtmf_type&WP_TDM_EVENT_DTMF_ROUT)?"ROUT":"SOUT", + (api_rx_el->hdr.wp_api_event_dtmf_type&WP_TDM_EVENT_DTMF_PRESET)?"PRESET":"STOP"); + break; + case WP_TDM_EVENT_RXHOOK: + printf("RXHOOK Event: %s!\n", + (api_rx_el->hdr.wp_api_event_rxhook_state&WP_TDM_EVENT_RXHOOK_OFF)?"OFF-HOOK":"ON-HOOK"); + break; + case WP_TDM_EVENT_RING: + printf("RING Event: %s!\n", + (api_rx_el->hdr.wp_api_event_ring_state&WP_TDM_EVENT_RING_PRESENT)?"PRESENT":"STOP"); + break; + } +#endif + if (rx_cnt > 0 && Rx_count >= rx_cnt){ + break; + } +bitstrm_skip_read: +; + } + + if (FD_ISSET(dev_fd,&write)){ + + + err = sangoma_writemsg_tdm(dev_fd, + Tx_data,16, + &Tx_data[16], Tx_length, + 0); + if (err <= 0){ + if (errno == EBUSY){ + if (verbose){ + printf("Sock busy try again!\n"); + } + /* Socket busy try sending again !*/ + }else{ + printf("Faild to send %i \n",errno); + perror("Send: "); + break; + } + }else{ + + ++Tx_count; + + if (verbose){ + printf("Packet sent: Sent %i : %i\n", + err,Tx_count); + }else{ + //putchar('T'); + } + } + } + + if (tx_delay){ + usleep(tx_delay); + } + + if (tx_cnt && tx_size && Tx_count >= tx_cnt && !(files_used & TX_FILE_USED)){ + + write_enable=0; + if (rx_cnt > 0){ + /* Dont break let rx finish */ + }else{ + break; + } + } + } + } + + sangoma_tdm_disable_rm_dtmf_events(dev_fd, &tdm_api); + if (tx_fd){ + fclose(tx_fd); + } + if (rx_fd){ + fclose(rx_fd); + } + close (dev_fd); + + return; +} + +int dtmf_event (int fd, unsigned char digit, unsigned char type, unsigned char port) +{ + printf("%d: DTMV Event: %c (%s:%s)!\n", + fd, + digit, + (port == WAN_EC_CHANNEL_PORT_ROUT)?"ROUT":"SOUT", + (type == WAN_EC_TONE_PRESENT)?"PRESET":"STOP"); + return 0; +} + +/*************************************************************** + * Main: + * + * o Make a socket connection to the driver. + * o Call handle_span_chan() to read the socket + * + **************************************************************/ + + +int main(int argc, char* argv[]) +{ + int proceed; + + proceed=init_args(argc,argv); + if (proceed != WAN_TRUE){ + usage(argv[0]); + return -1; + } + + signal(SIGINT,&sig_end); + memset(&tdm_api,0,sizeof(tdm_api)); + tdm_api.wp_tdm_event.wp_dtmf_event = &dtmf_event; + + printf("TDM DTMF PTR = %p\n",tdm_api.wp_tdm_event.wp_dtmf_event); + + dev_fd =-1; + + dev_fd = sangoma_open_tdmapi_span_chan(1,1/*atoi(card_name),atoi(if_name)*/); + if( dev_fd < 0){ + printf("Failed to open span chan:%s:%s\n",card_name,if_name); + exit (1); + } + printf("HANDLING SPAN %i CHAN %i FD=%i\n", + atoi(card_name),atoi(if_name),dev_fd); + + sangoma_tdm_set_codec(dev_fd,&tdm_api,WP_NONE); + sangoma_get_full_cfg(dev_fd, &tdm_api); + + handle_span_chan(); + close(dev_fd); + return 0; + + return 0; +}; + + +void sig_end(int sigid) +{ + + printf("Got Signal %i\n",sigid); + + sangoma_tdm_disable_rm_dtmf_events(dev_fd, &tdm_api); + + if (tx_fd){ + fclose(tx_fd); + } + if (rx_fd){ + fclose(rx_fd); + } + + if (dev_fd){ + close (dev_fd); + } + + exit(1); +} + + + diff --git a/api/tdmapi/aft_tdm_voice_api_rxhook b/api/tdmapi/aft_tdm_voice_api_rxhook new file mode 100755 index 0000000..817dddc Binary files /dev/null and b/api/tdmapi/aft_tdm_voice_api_rxhook differ diff --git a/api/tdmapi/aft_tdm_voice_api_rxhook.c b/api/tdmapi/aft_tdm_voice_api_rxhook.c new file mode 100644 index 0000000..949ee42 --- /dev/null +++ b/api/tdmapi/aft_tdm_voice_api_rxhook.c @@ -0,0 +1,448 @@ +/***************************************************************************** +* aft_api.c AFT T1/E1: HDLC API Sample Code +* +* Author(s): Nenad Corbic +* +* Copyright: (c) 2003-2004 Sangoma Technologies 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. +* ============================================================================ +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "lib_api.h" + +#define MAX_TX_DATA 5000 /* Size of tx data */ +#define MAX_FRAMES 5000 /* Number of frames to transmit */ + +#define MAX_RX_DATA 5000 + +unsigned short Rx_lgth; + +unsigned char Rx_data[MAX_RX_DATA]; +unsigned char Tx_data[MAX_TX_DATA + sizeof(wp_tdm_api_rx_hdr_t)]; + +/* Prototypes */ +int MakeConnection(void); +void handle_span_chan( void); +void sig_end(int sigid); + +int dev_fd; +FILE *tx_fd=NULL,*rx_fd=NULL; +wanpipe_tdm_api_t tdm_api; + + +/*************************************************** +* HANDLE SOCKET +* +* o Read a socket +* o Cast data received to api_rx_element_t data type +* o The received packet contains 16 bytes header +* +* ------------------------------------------ +* | 16 bytes | X bytes ... +* ------------------------------------------ +* Header Data +* +* o Data structures: +* ------------------ +* typedef struct { +* union { +* struct { +* unsigned char _event_type; +* unsigned char _rbs_rx_bits; +* unsigned int _time_stamp; +* }wp_event; +* struct { +* unsigned char _rbs_rx_bits; +* unsigned int _time_stamp; +* }wp_rx; +* unsigned char reserved[16]; +* }wp_rx_hdr_u; +* #define wp_api_event_type wp_rx_hdr_u.wp_event._event_type +* #define wp_api_event_rbs_rx_bits wp_rx_hdr_u.wp_event._rbs_rx_bits +* #define wp_api_event_time_stamp wp_rx_hdr_u.wp_event._time_stamp +* } wp_tdm_api_rx_hdr_t; +* +* typedef struct { +* wp_tdm_api_rx_hdr_t hdr; +* unsigned char data[1]; +* } wp_tdm_api_rx_element_t; +* +* typedef struct { +* union { +* struct { +* unsigned char _rbs_rx_bits; +* unsigned int _time_stamp; +* }wp_tx; +* unsigned char reserved[16]; +* }wp_tx_hdr_u; +* #define wp_api_time_stamp wp_tx_hdr_u.wp_tx._time_stamp +* } wp_tdm_api_tx_hdr_t; +* +* typedef struct { +* wp_tdm_api_tx_hdr_t hdr; +* unsigned char data[1]; +* } wp_tdm_api_tx_element_t; +* +* #define WPTDM_A_BIT 0x08 +* #define WPTDM_B_BIT 0x04 +* #define WPTDM_C_BIT 0x02 +* #define WPTDM_D_BIT 0x01 +* +*/ + +void handle_span_chan(void) +{ + unsigned int Rx_count,Tx_count,Tx_length; + wp_tdm_api_rx_element_t* api_rx_el; + wp_tdm_api_tx_element_t * api_tx_el; + fd_set ready,write,oob; + int err,i; + +#if 0 + int rlen; + int stream_sync=0; +#endif + + Rx_count = 0; + Tx_count = 0; + + if (tdm_api.wp_tdm_cmd.hdlc) { + Tx_length = tx_size; + } else { + Tx_length = tdm_api.wp_tdm_cmd.usr_mtu_mru; + } + + printf("\n\nSocket Handler: Rx=%d Tx=%i TxCnt=%i TxLen=%i TxDelay=%i\n", + read_enable,write_enable,tx_cnt,tx_size,tx_delay); + + /* Initialize the Tx Data buffer */ + memset(&Tx_data[0],0,MAX_TX_DATA + sizeof(wp_tdm_api_rx_hdr_t)); + + /* Cast the Tx data packet with the tx element + * structure. We must insert a 16 byte + * driver header, which driver will remove + * before passing packet out the physical port */ + api_tx_el = (wp_tdm_api_tx_element_t*)&Tx_data[0]; + + + /* Create a Tx packet based on user info, or + * by deafult incrementing number starting from 0 */ + for (i=0;idata[i] = (unsigned char)i; + }else{ +#if 0 + api_tx_el->data[i] = (unsigned char)tx_data+(i%4); +#else + api_tx_el->data[i] = (unsigned char)tx_data; +#endif + } + } + + sangoma_tdm_enable_rxhook_events(dev_fd, &tdm_api); + + /* Main Rx Tx OOB routine */ + for(;;) { + + /* Initialize all select() descriptors */ + FD_ZERO(&ready); + FD_ZERO(&write); + FD_ZERO(&oob); + FD_SET(dev_fd,&oob); + FD_SET(dev_fd,&ready); + + if (write_enable){ + FD_SET(dev_fd,&write); + } + + /* Select will block, until: + * 1: OOB event, link level change + * 2: Rx data available + * 3: Interface able to Tx */ + + if(select(dev_fd + 1,&ready, &write, &oob, NULL)){ + + fflush(stdout); + if (FD_ISSET(dev_fd,&oob)){ + + /* An OOB event is pending, usually indicating + * a link level change */ + + err=sangoma_tdm_read_event(dev_fd,&tdm_api); + + if(err < 0 ) { + printf("Failed to receive OOB %i , %i\n", Rx_count, err); + err = ioctl(dev_fd,SIOC_WANPIPE_SOCK_STATE,0); + printf("Sock state is %s\n", + (err == 0) ? "CONNECTED" : + (err == 1) ? "DISCONNECTED" : + "CONNECTING"); + break; + } + + printf("GOT OOB EXCEPTION CMD Exiting\n"); + } + + + if (FD_ISSET(dev_fd,&ready)){ + + /* An Rx packet is pending + * 1: Read the rx packet into the Rx_data + * buffer. Confirm len > 0 + * + * 2: Cast Rx_data to the api_rx_element. + * Thus, removing a 16 byte header + * attached by the driver. + * + * 3. Check error_flag: + * CRC,Abort..etc + */ + + memset(Rx_data, 0, sizeof(Rx_data)); + + err = sangoma_readmsg_tdm(dev_fd, + Rx_data, + sizeof(wp_tdm_api_rx_hdr_t), + &Rx_data[sizeof(wp_tdm_api_rx_hdr_t)], + MAX_RX_DATA, 0); + + + if (!read_enable){ + goto bitstrm_skip_read; + } + + /* err indicates bytes received */ + if(err <= 0) { + printf("\nError receiving data\n"); + break; + } + + api_rx_el = (wp_tdm_api_rx_element_t*)&Rx_data[0]; + + /* Check the packet length */ + Rx_lgth = err; + if(Rx_lgth<=0) { + printf("\nShort frame received (%d)\n", + Rx_lgth); + return; + } + +#if 0 + if (api_rx_el->data[0] == tx_data && api_rx_el->data[1] == (tx_data+1)){ + if (!stream_sync){ + printf("GOT SYNC %x\n",api_rx_el->data[0]); + } + stream_sync=1; + }else{ + if (stream_sync){ + printf("OUT OF SYNC: %x\n",api_rx_el->data[0]); + } + } +#endif + + ++Rx_count; + + if (verbose){ +#if 0 + printf("Received %i Length = %i\n", + Rx_count,Rx_lgth); + + printf("Data: "); + for(i=0;idata[i]); + } + printf("\n"); +#endif + }else{ + //putchar('R'); + } + + +#if 0 + switch(api_rx_el->hdr.wp_api_event_type){ + case WP_TDM_EVENT_DTMF: + printf("DTMV Event: %c (%s:%s)!\n", + api_rx_el->hdr.wp_api_event_dtmf_digit, + (api_rx_el->hdr.wp_api_event_dtmf_type&WP_TDM_EVENT_DTMF_ROUT)?"ROUT":"SOUT", + (api_rx_el->hdr.wp_api_event_dtmf_type&WP_TDM_EVENT_DTMF_PRESET)?"PRESET":"STOP"); + break; + case WP_TDM_EVENT_RXHOOK: + printf("RXHOOK Event: %s!\n", + (api_rx_el->hdr.wp_api_event_rxhook_state&WP_TDM_EVENT_RXHOOK_OFF)?"OFF-HOOK":"ON-HOOK"); + break; + case WP_TDM_EVENT_RING: + printf("RING Event: %s!\n", + (api_rx_el->hdr.wp_api_event_ring_state&WP_TDM_EVENT_RING_PRESENT)?"PRESENT":"STOP"); + break; + } +#endif + + if (rx_cnt > 0 && Rx_count >= rx_cnt){ + break; + } +bitstrm_skip_read: +; + } + + if (FD_ISSET(dev_fd,&write)){ + + + err = sangoma_writemsg_tdm(dev_fd, + Tx_data,16, + &Tx_data[16], Tx_length, + 0); + if (err <= 0){ + if (errno == EBUSY){ + if (verbose){ + printf("Sock busy try again!\n"); + } + /* Socket busy try sending again !*/ + }else{ + printf("Faild to send %i \n",errno); + perror("Send: "); + break; + } + }else{ + + ++Tx_count; + + if (verbose){ + //printf("Packet sent: Sent %i : %i\n", + // err,Tx_count); + }else{ + //putchar('T'); + } + } + } + + if (tx_delay){ + usleep(tx_delay); + } + + if (tx_cnt && tx_size && Tx_count >= tx_cnt && !(files_used & TX_FILE_USED)){ + + write_enable=0; + if (rx_cnt > 0){ + /* Dont break let rx finish */ + }else{ + break; + } + } + } + } + + sangoma_tdm_disable_rxhook_events(dev_fd, &tdm_api); + if (tx_fd){ + fclose(tx_fd); + } + if (rx_fd){ + fclose(rx_fd); + } + close (dev_fd); + return; + +} + +int rxhook_event (int fd, unsigned char state) +{ + printf("%d: RXHOOK Event: %s!\n", + fd, (state & WAN_EVENT_RXHOOK_OFF)?"OFF-HOOK":"ON-HOOK"); + return 0; +} + +/*************************************************************** + * Main: + * + * o Make a socket connection to the driver. + * o Call handle_span_chan() to read the socket + * + **************************************************************/ + + +int main(int argc, char* argv[]) +{ + int proceed; + + proceed=init_args(argc,argv); + if (proceed != WAN_TRUE){ + usage(argv[0]); + return -1; + } + + signal(SIGINT,&sig_end); + memset(&tdm_api,0,sizeof(tdm_api)); + tdm_api.wp_tdm_event.wp_rxhook_event = &rxhook_event; + + printf("TDM RXHOOK PTR = %p\n",tdm_api.wp_tdm_event.wp_rxhook_event); + + dev_fd =-1; + + dev_fd = sangoma_open_tdmapi_span_chan(atoi(card_name),atoi(if_name)); + if( dev_fd < 0){ + printf("Failed to open span chan (%s:%s:%d:%d)\n", + card_name, if_name, + atoi(card_name),atoi(if_name)); + exit (1); + } + printf("HANDLING SPAN %i CHAN %i FD=%i\n", + atoi(card_name),atoi(if_name),dev_fd); + + sangoma_tdm_set_codec(dev_fd,&tdm_api,WP_NONE); + sangoma_get_full_cfg(dev_fd, &tdm_api); + + handle_span_chan(); + close(dev_fd); + return 0; + + return 0; +}; + + +void sig_end(int sigid) +{ + + printf("Got Signal %i\n",sigid); + + sangoma_tdm_disable_rxhook_events(dev_fd, &tdm_api); + + if (tx_fd){ + fclose(tx_fd); + } + if (rx_fd){ + fclose(rx_fd); + } + + if (dev_fd){ + close (dev_fd); + } + + + exit(1); +} + + + diff --git a/api/tdmapi/aft_tdm_voice_api_switch.c b/api/tdmapi/aft_tdm_voice_api_switch.c deleted file mode 100644 index 64d11c3..0000000 --- a/api/tdmapi/aft_tdm_voice_api_switch.c +++ /dev/null @@ -1,368 +0,0 @@ -/***************************************************************************** -* bstrm_hdlc_test_multi.c: Multiple Bstrm Test Receive Module -* -* Author(s): Nenad Corbic -* -* Copyright: (c) 1995-2006 Sangoma Technologies 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. -* ============================================================================ -* Description: -* -* The chdlc_api.c utility will bind to a socket to a chdlc network -* interface, and continously tx and rx packets to an from the sockets. -* -* This example has been written for a single interface in mind, -* where the same process handles tx and rx data. -* -* A real world example, should use different processes to handle -* tx and rx spearately. -*/ - - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define FALSE 0 -#define TRUE 1 - -/* Enable/Disable tx of random frames */ -#define RAND_FRAME 1 - -#define MAX_NUM_OF_TIMESLOTS 31*16 - -#define LGTH_CRC_BYTES 2 -#define MAX_TX_DATA 1000 //MAX_NUM_OF_TIMESLOTS*10 /* Size of tx data */ -#define MAX_TX_FRAMES 1000000 /* Number of frames to transmit */ - -#define WRITE 1 -#define MAX_IF_NAME 20 -typedef struct { - - int sock; - int rx_cnt; - int tx_cnt; - int data; - int last_error; - int frames; - char if_name[MAX_IF_NAME+1]; - -} timeslot_t; - - -timeslot_t tslot_array[MAX_NUM_OF_TIMESLOTS]; - -int tx_change_data=0, tx_change_data_cnt=0; -int end=0; - - -void print_packet(unsigned char *buf, int len) -{ - int x; - printf("{ | "); - for (x=0;xif_name,&span,&chan); - - if (span > 0 && chan > 0) { - wanpipe_tdm_api_t tdm_api; - slot->sock = sangoma_open_tdmapi_span_chan(span,chan); - if( slot->sock < 0 ) { - perror("Open Span Chan: "); - return( FALSE ); - } - - sangoma_tdm_set_codec(slot->sock,&tdm_api,WP_NONE); - - - printf("Socket bound to Span=%i Chan=%i\n\n",span,chan); - return (TRUE); - } - - return(FALSE); -} - -int api_tdm_fe_alarms_callback(int fd, unsigned char alarm) -{ - int fd_found=0; - int i; - for (i=0;i max_fd){ - max_fd=tslot_array[i].sock; - } - } - i=0; - - - tv.tv_usec = 0; - tv.tv_sec = 10; - - Rx_count = 0; - - for(;;) { - - FD_ZERO(&ready); - FD_ZERO(&oob); - max_fd=0; - for (i=0;i max_fd){ - max_fd=tslot_array[i].sock; - } - } - - tv.tv_usec = 0; - tv.tv_sec = 10; - - if (end){ - break; - } - - /* The select function must be used to implement flow control. - * WANPIPE socket will block the user if the socket cannot send - * or there is nothing to receive. - * - * By using the last socket file descriptor +1 select will wait - * for all active sockets. - */ - slots=0; - if((serr=select(max_fd + 1, &ready, NULL, &oob, &tv))){ - - for (i=0;isock,&oob)){ - sangoma_tdm_read_event(slot->sock,&tdm_api); - } - - - /* Check for rx packets */ - if (FD_ISSET(slot->sock,&ready)){ - - err = sangoma_readmsg_tdm(slot->sock, - Rx_data,sizeof(wp_tdm_api_rx_hdr_t), - &Rx_data[sizeof(wp_tdm_api_rx_hdr_t)], - sizeof(Rx_data), 0); - - /* err indicates bytes received */ - if(err > 0) { - sangoma_writemsg_tdm(tslot_array[i==1?2:1].sock, - Rx_data,sizeof(wp_tdm_api_rx_hdr_t), - &Rx_data[sizeof(wp_tdm_api_rx_hdr_t)], - err, 0); - - } else { - printf("\n%s: Error receiving data\n",slot->if_name); - } - - } /* If rx */ - - } /* for all slots */ - - - } else { - printf("\n: Error selecting rx socket rc=0x%x errno=0x%x\n", - serr,errno); - perror("Select: "); - //break; - } - } - - - printf("\nRx Unloading HDLC\n"); - -} - - - - -/*************************************************************** - * Main: - * - * o Make a socket connection to the driver. - * o Call process_con() to read/write the socket - * - **************************************************************/ - -int main(int argc, char* argv[]) -{ - int proceed; - char router_name[20]; - int x,i; - - if (argc < 3){ - printf("Usage: rec_wan_sock ...\n"); - exit(0); - } - - nice(-11); - - signal(SIGINT,&sig_end); - signal(SIGTERM,&sig_end); - - memset(&tslot_array,0,sizeof(tslot_array)); - for (i=0;i ++# Makefile for the Linux network (wan) device drivers. + # +-# Licensed under the GNU General Public License, v2.0 or later, +-# at your option. See the file COPYING for details, or the web +-# page http://www.gnu.org/copyleft/gpl.html ++# 3 Aug 2000, Christoph Hellwig ++# Rewritten to use lists instead of if-statements. + # + +-OBJS = +-MODULE_NAME = +-EXTRA_CFLAGS = +-KDIR = +-$(MODULE_NAME)-objs = $(OBJS) +- +-RM = @rm -rf +-JUNK = *~ *.bak DEADJOE +- +-PWD := $(shell pwd) +-SUBDIRS=$(PWD) +- +-# First pass, kernel Makefile reads module objects +-ifneq ($(KERNELRELEASE),) +-obj-m := $(MODULE_NAME).o +- +- +-# Second pass, the actual build. +-else +-KVER ?= $(shell uname -r) +-PWD := $(shell pwd) +-KBUILD_VERBOSE= ++EXTRA_CFLAGS=-Werror $(EXTRA_FLAGS) ++EXTRA_CFLAGS+=-DENABLE_TONE_PLAY -DCONFIG_WANPIPE_HWEC -I/usr/include/wanpipe ++HOME=/common/wanec + +-all: +- $(MAKE) -C $(KDIR) SUBDIRS=$(SUBDIRS) CC=$(CC) KBUILD_VERBOSE=$(KBUILD_VERBOSE) modules +- +-clean: +- $(shell find $(SUBDIRS) -name '*.*o' | xargs rm) +- $(shell find $(SUBDIRS) -name '.*.o.cmd' | xargs rm) +- $(shell rm -f build.sh) +- $(MAKE) -C $(KDIR) SUBDIRS=$(SUBDIRS) clean +- +-distclean: clean +- $(RM) $(JUNK) $(OBJS) ++BTDIR=oct6100_api/apilib/bt ++LARGMATHDIR=oct6100_api/apilib/largmath ++LLMANDIR=oct6100_api/apilib/llman ++OCTAPIDIR=oct6100_api/octdeviceapi/oct6100api/oct6100_api ++OCTAPIMIDIR=oct6100_api/octdeviceapi/oct6100api/oct6100_apimi + +-help: +- $(MAKE) -C $(KDIR) SUBDIRS=$(SUBDIRS) help ++EXTRA_CFLAGS += -I. -I$(HOME)/oct6100_api -I$(HOME)/oct6100_api/include -I$(HOME)/oct6100_api/include/oct6100api -I$(HOME)/oct6100_api/include -I$(HOME)/oct6100_api/include/apilib -I$(HOME)/oct6100_api/include/apilib -I$(HOME)/oct6100_api/include/octrpc -I$(HOME)/oct6100_api/include/oct6100api -I$(HOME)/oct6100_api/octdeviceapi/oct6100api -DENABLE_TONE_PLAY + ++wanec-y := wanec_iface.o wanec_cmd.o wanec_utils.o wanec_dev.o ++wanec-y += $(BTDIR)/octapi_bt0.o $(LARGMATHDIR)/octapi_largmath.o ++wanec-y += $(LLMANDIR)/octapi_llman.o $(OCTAPIMIDIR)/oct6100_mask_interrupts.o ++wanec-y += $(OCTAPIDIR)/oct6100_adpcm_chan.o $(OCTAPIDIR)/oct6100_channel.o ++wanec-y += $(OCTAPIDIR)/oct6100_chip_open.o $(OCTAPIDIR)/oct6100_chip_stats.o ++wanec-y += $(OCTAPIDIR)/oct6100_conf_bridge.o $(OCTAPIDIR)/oct6100_debug.o ++wanec-y += $(OCTAPIDIR)/oct6100_events.o $(OCTAPIDIR)/oct6100_interrupts.o ++wanec-y += $(OCTAPIDIR)/oct6100_memory.o $(OCTAPIDIR)/oct6100_miscellaneous.o ++wanec-y += $(OCTAPIDIR)/oct6100_mixer.o $(OCTAPIDIR)/oct6100_phasing_tsst.o ++wanec-y += $(OCTAPIDIR)/oct6100_playout_buf.o $(OCTAPIDIR)/oct6100_remote_debug.o ++wanec-y += $(OCTAPIDIR)/oct6100_tlv.o $(OCTAPIDIR)/oct6100_tone_detection.o ++wanec-y += $(OCTAPIDIR)/oct6100_tsi_cnct.o $(OCTAPIDIR)/oct6100_tsst.o ++wanec-y += $(OCTAPIDIR)/oct6100_user.o + +-# Indents the kernel source the way linux/Documentation/CodingStyle.txt +-# wants it to be. +-indent: +- indent -kr -i8 $($(MODULE_NAME)-objs:.o=.c) ++wanec-objs := $(OBJS) + +-install: +- $(MAKE) -C $(KDIR) M=$(SUBDIRS) modules_install ++obj-m += wanec.o + +-endif +diff -dur --exclude='*.svn' --exclude='libsangoma*' --exclude='sangoma_mgd*' wanec/Makefile.Kbuild.Linux /common/wanec/Makefile.Kbuild.Linux +--- wanec/Makefile.Kbuild.Linux 2008-03-03 16:12:40.000000000 -0500 ++++ /common/wanec/Makefile.Kbuild.Linux 2007-12-04 15:44:37.000000000 -0500 +@@ -1,57 +1,37 @@ +-# Makefile for hello world kernel 2.6 module. -*-makefile-*- + # +-# Copyright (C) 2004 Joachim Nilsson ++# Makefile for the Linux network (wan) device drivers. + # +-# Licensed under the GNU General Public License, v2.0 or later, +-# at your option. See the file COPYING for details, or the web +-# page http://www.gnu.org/copyleft/gpl.html ++# 3 Aug 2000, Christoph Hellwig ++# Rewritten to use lists instead of if-statements. + # + +-OBJS = +-MODULE_NAME = +-EXTRA_CFLAGS = +-KDIR = +-$(MODULE_NAME)-objs = $(OBJS) +- +-RM = @rm -rf +-JUNK = *~ *.bak DEADJOE +- +-PWD := $(shell pwd) +-SUBDIRS=$(PWD) +- +-# First pass, kernel Makefile reads module objects +-ifneq ($(KERNELRELEASE),) +-obj-m := $(MODULE_NAME).o +- +- +-# Second pass, the actual build. +-else +-KVER ?= $(shell uname -r) +-PWD := $(shell pwd) +-KBUILD_VERBOSE= ++EXTRA_CFLAGS=-Werror $(EXTRA_FLAGS) ++EXTRA_CFLAGS+=-DENABLE_TONE_PLAY -DCONFIG_WANPIPE_HWEC -I/usr/include/wanpipe ++HOME=/common/wanec + +-all: +- $(MAKE) -C $(KDIR) SUBDIRS=$(SUBDIRS) CC=$(CC) KBUILD_VERBOSE=$(KBUILD_VERBOSE) modules +- +-clean: +- $(shell find $(SUBDIRS) -name '*.*o' | xargs rm) +- $(shell find $(SUBDIRS) -name '.*.o.cmd' | xargs rm) +- $(shell rm -f build.sh) +- $(MAKE) -C $(KDIR) SUBDIRS=$(SUBDIRS) clean +- +-distclean: clean +- $(RM) $(JUNK) $(OBJS) ++BTDIR=oct6100_api/apilib/bt ++LARGMATHDIR=oct6100_api/apilib/largmath ++LLMANDIR=oct6100_api/apilib/llman ++OCTAPIDIR=oct6100_api/octdeviceapi/oct6100api/oct6100_api ++OCTAPIMIDIR=oct6100_api/octdeviceapi/oct6100api/oct6100_apimi + +-help: +- $(MAKE) -C $(KDIR) SUBDIRS=$(SUBDIRS) help ++EXTRA_CFLAGS += -I. -I$(HOME)/oct6100_api -I$(HOME)/oct6100_api/include -I$(HOME)/oct6100_api/include/oct6100api -I$(HOME)/oct6100_api/include -I$(HOME)/oct6100_api/include/apilib -I$(HOME)/oct6100_api/include/apilib -I$(HOME)/oct6100_api/include/octrpc -I$(HOME)/oct6100_api/include/oct6100api -I$(HOME)/oct6100_api/octdeviceapi/oct6100api -DENABLE_TONE_PLAY + ++wanec-y := wanec_iface.o wanec_cmd.o wanec_utils.o wanec_dev.o ++wanec-y += $(BTDIR)/octapi_bt0.o $(LARGMATHDIR)/octapi_largmath.o ++wanec-y += $(LLMANDIR)/octapi_llman.o $(OCTAPIMIDIR)/oct6100_mask_interrupts.o ++wanec-y += $(OCTAPIDIR)/oct6100_adpcm_chan.o $(OCTAPIDIR)/oct6100_channel.o ++wanec-y += $(OCTAPIDIR)/oct6100_chip_open.o $(OCTAPIDIR)/oct6100_chip_stats.o ++wanec-y += $(OCTAPIDIR)/oct6100_conf_bridge.o $(OCTAPIDIR)/oct6100_debug.o ++wanec-y += $(OCTAPIDIR)/oct6100_events.o $(OCTAPIDIR)/oct6100_interrupts.o ++wanec-y += $(OCTAPIDIR)/oct6100_memory.o $(OCTAPIDIR)/oct6100_miscellaneous.o ++wanec-y += $(OCTAPIDIR)/oct6100_mixer.o $(OCTAPIDIR)/oct6100_phasing_tsst.o ++wanec-y += $(OCTAPIDIR)/oct6100_playout_buf.o $(OCTAPIDIR)/oct6100_remote_debug.o ++wanec-y += $(OCTAPIDIR)/oct6100_tlv.o $(OCTAPIDIR)/oct6100_tone_detection.o ++wanec-y += $(OCTAPIDIR)/oct6100_tsi_cnct.o $(OCTAPIDIR)/oct6100_tsst.o ++wanec-y += $(OCTAPIDIR)/oct6100_user.o + +-# Indents the kernel source the way linux/Documentation/CodingStyle.txt +-# wants it to be. +-indent: +- indent -kr -i8 $($(MODULE_NAME)-objs:.o=.c) ++wanec-objs := $(OBJS) + +-install: +- $(MAKE) -C $(KDIR) M=$(SUBDIRS) modules_install ++obj-m += wanec.o + +-endif +Only in /common/wanec/mod: CVS +Only in /common/wanec/modinfo: CVS +Only in /common/wanec/oct6100_api/apilib/bt: CVS +Only in /common/wanec/oct6100_api/apilib/bt: octapi_bt0.o +Only in /common/wanec/oct6100_api/apilib/bt: .octapi_bt0.o.cmd +Only in /common/wanec/oct6100_api/apilib: CVS +Only in /common/wanec/oct6100_api/apilib/largmath: CVS +Only in /common/wanec/oct6100_api/apilib/largmath: octapi_largmath.o +Only in /common/wanec/oct6100_api/apilib/largmath: .octapi_largmath.o.cmd +Only in /common/wanec/oct6100_api/apilib/llman: CVS +Only in /common/wanec/oct6100_api/apilib/llman: octapi_llman.o +Only in /common/wanec/oct6100_api/apilib/llman: .octapi_llman.o.cmd +Only in /common/wanec/oct6100_api: CVS +Only in /common/wanec/oct6100_api/include/apilib: CVS +Only in /common/wanec/oct6100_api/include: CVS +Only in /common/wanec/oct6100_api/include/oct6100api: CVS +Only in /common/wanec/oct6100_api/include/octrpc: CVS +Only in /common/wanec/oct6100_api/octdeviceapi: CVS +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api: CVS +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: CVS +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_adpcm_chan.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_adpcm_chan.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_channel.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_channel.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_chip_open.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_chip_open.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_chip_stats.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_chip_stats.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_conf_bridge.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_conf_bridge.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_debug.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_debug.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_events.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_events.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_interrupts.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_interrupts.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_memory.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_memory.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_miscellaneous.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_miscellaneous.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_mixer.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_mixer.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_phasing_tsst.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_phasing_tsst.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_playout_buf.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_playout_buf.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_remote_debug.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_remote_debug.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_tlv.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_tlv.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_tone_detection.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_tone_detection.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_tsi_cnct.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_tsi_cnct.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_tsst.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_tsst.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: oct6100_user.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api: .oct6100_user.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_apimi: CVS +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_apimi: oct6100_mask_interrupts.o +Only in /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_apimi: .oct6100_mask_interrupts.o.cmd +Only in /common/wanec/oct6100_api/octdeviceapiw: CVS +Only in /common/wanec/oct6100_api/octdeviceapiw/oct6100_apiw_freebsd: CVS +Only in /common/wanec/oct6100_api/octdeviceapiw/oct6100_apiw_linux: CVS +Only in /common/wanec: oct6100_api.PR39 +Only in /common/wanec: oct6100_api.PR41 +Only in /common/wanec: oct6100_api.PR43 +Only in /common/wanec: oct6100_api.PR47 +Only in /common/wanec/oct6100_api.PR48/apilib/bt: CVS +Only in /common/wanec/oct6100_api.PR48/apilib/bt: octapi_bt0.o +Only in /common/wanec/oct6100_api.PR48/apilib/bt: .octapi_bt0.o.cmd +Only in /common/wanec/oct6100_api.PR48/apilib: CVS +Only in /common/wanec/oct6100_api.PR48/apilib/largmath: CVS +Only in /common/wanec/oct6100_api.PR48/apilib/largmath: octapi_largmath.o +Only in /common/wanec/oct6100_api.PR48/apilib/largmath: .octapi_largmath.o.cmd +Only in /common/wanec/oct6100_api.PR48/apilib/llman: CVS +Only in /common/wanec/oct6100_api.PR48/apilib/llman: octapi_llman.o +Only in /common/wanec/oct6100_api.PR48/apilib/llman: .octapi_llman.o.cmd +Only in /common/wanec/oct6100_api.PR48: CVS +Only in /common/wanec/oct6100_api.PR48/include/apilib: CVS +Only in /common/wanec/oct6100_api.PR48/include: CVS +Only in /common/wanec/oct6100_api.PR48/include/oct6100api: CVS +Only in /common/wanec/oct6100_api.PR48/include/octrpc: CVS +Only in /common/wanec/oct6100_api.PR48/octdeviceapi: CVS +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api: CVS +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: CVS +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_adpcm_chan.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_adpcm_chan.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_channel.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_channel.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_chip_open.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_chip_open.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_chip_stats.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_chip_stats.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_conf_bridge.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_conf_bridge.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_debug.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_debug.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_events.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_events.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_interrupts.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_interrupts.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_memory.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_memory.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_miscellaneous.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_miscellaneous.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_mixer.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_mixer.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_phasing_tsst.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_phasing_tsst.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_playout_buf.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_playout_buf.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_remote_debug.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_remote_debug.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_tlv.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_tlv.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_tone_detection.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_tone_detection.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_tsi_cnct.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_tsi_cnct.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_tsst.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_tsst.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: oct6100_user.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api: .oct6100_user.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_apimi: CVS +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_apimi: oct6100_mask_interrupts.o +Only in /common/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_apimi: .oct6100_mask_interrupts.o.cmd +Only in /common/wanec/oct6100_api.PR48/octdeviceapiw: CVS +Only in /common/wanec/oct6100_api.PR48/octdeviceapiw/oct6100_apiw_freebsd: CVS +Only in /common/wanec/oct6100_api.PR48/octdeviceapiw/oct6100_apiw_linux: CVS +Only in /common/wanec/tmp: CVS +diff -dur --exclude='*.svn' --exclude='libsangoma*' --exclude='sangoma_mgd*' wanec/.tmp_versions/wanec.mod /common/wanec/.tmp_versions/wanec.mod +--- wanec/.tmp_versions/wanec.mod 2008-03-03 16:12:55.000000000 -0500 ++++ /common/wanec/.tmp_versions/wanec.mod 2008-03-05 18:40:45.000000000 -0500 +@@ -1,2 +1,2 @@ +-/root/3.3/wanpipe/patches/kdrivers/wanec/wanec.ko +-/root/3.3/wanpipe/patches/kdrivers/wanec/wanec_iface.o /root/3.3/wanpipe/patches/kdrivers/wanec/wanec_cmd.o /root/3.3/wanpipe/patches/kdrivers/wanec/wanec_utils.o /root/3.3/wanpipe/patches/kdrivers/wanec/wanec_dev.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/apilib/bt/octapi_bt0.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/apilib/largmath/octapi_largmath.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/apilib/llman/octapi_llman.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_apimi/oct6100_mask_interrupts.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_events.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.o /root/3.3/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_user.o ++/common/wanec/wanec.ko ++/common/wanec/wanec_iface.o /common/wanec/wanec_cmd.o /common/wanec/wanec_utils.o /common/wanec/wanec_dev.o /common/wanec/oct6100_api/apilib/bt/octapi_bt0.o /common/wanec/oct6100_api/apilib/largmath/octapi_largmath.o /common/wanec/oct6100_api/apilib/llman/octapi_llman.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_apimi/oct6100_mask_interrupts.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_events.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.o /common/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_user.o +diff -dur --exclude='*.svn' --exclude='libsangoma*' --exclude='sangoma_mgd*' wanec/wanec_cmd.c /common/wanec/wanec_cmd.c +--- wanec/wanec_cmd.c 2008-02-04 16:39:27.000000000 -0500 ++++ /common/wanec/wanec_cmd.c 2008-03-05 18:11:47.000000000 -0500 +@@ -1408,7 +1408,7 @@ + "%s: Error Pll Jitter\n", + ec->name); + } +- if (ec->f_InterruptFlag.fErrorH100OutOfSync == TRUE){ ++ if (ec->f_InterruptFlag.fErrorH100OutOfSync == TRUE && !ec->ignore_H100){ + DEBUG_EVENT( + "%s: The H100 slave has lost its framing on the bus!\n", + ec->name); +Only in /common/wanec: wanec_cmd.o +Only in /common/wanec: .wanec_cmd.o.cmd +Only in /common/wanec: wanec_dev.o +Only in /common/wanec: .wanec_dev.o.cmd +diff -dur --exclude='*.svn' --exclude='libsangoma*' --exclude='sangoma_mgd*' wanec/wanec_iface.c /common/wanec/wanec_iface.c +--- wanec/wanec_iface.c 2008-02-22 11:21:05.000000000 -0500 ++++ /common/wanec/wanec_iface.c 2008-03-05 18:11:47.000000000 -0500 +@@ -1674,16 +1674,18 @@ + ec_dev_new->fe_start_chan = WAN_FE_START_CHANNEL(&card->fe); + ec_dev_new->fe_max_chans = WAN_FE_MAX_CHANNELS(&card->fe); //max_line_no; // + ec_dev_new->fe_stop_chan = ec_dev_new->fe_start_chan + ec_dev_new->fe_max_chans - 1; +- ++ /* Feb 14, 2008 ++ ** Ignore fe_port_mask for BRI cards. fe_port_mask is for full card, ++ ** but ec_dev created per module. In this case, we have always ++ ** 2 channels (1 and 2). Create fe_channel_map manually */ + if (fe_port_mask && ec_dev_new->fe_media != WAN_MEDIA_BRI){ +- ec_dev_new->fe_channel_map = fe_port_mask; +- }else{ +- int fe_chan = 0; +- for(fe_chan = ec_dev_new->fe_start_chan; fe_chan <= ec_dev_new->fe_stop_chan; fe_chan++){ +- ec_dev_new->fe_channel_map |= (1 << fe_chan); +- } +- } +- ++ ec_dev_new->fe_channel_map = fe_port_mask; ++ }else{ ++ int fe_chan = 0; ++ for(fe_chan = ec_dev_new->fe_start_chan; fe_chan <= ec_dev_new->fe_stop_chan; fe_chan++){ ++ ec_dev_new->fe_channel_map |= (1 << fe_chan); ++ } ++ } + if (!WAN_FE_TDMV_LAW(&card->fe)){ + if (WAN_FE_MEDIA(&card->fe) == WAN_MEDIA_T1){ + WAN_FE_TDMV_LAW(&card->fe) = WAN_TDMV_MULAW; +@@ -1948,6 +1950,13 @@ + wanec_channel_dtmf(ec_dev, event_ctrl->channel, WAN_FALSE, NULL, wanec_verbose); + } + break; ++ case WAN_EVENT_EC_H100_REPORT: ++ if (event_ctrl->mode == WAN_EVENT_DISABLE){ ++ ec->ignore_H100 = 1; ++ }else{ ++ ec->ignore_H100 = 0; ++ } ++ break; + default: + err = -EINVAL; + break; +diff -dur --exclude='*.svn' --exclude='libsangoma*' --exclude='sangoma_mgd*' wanec/wanec_iface.h /common/wanec/wanec_iface.h +--- wanec/wanec_iface.h 2008-02-04 16:37:59.000000000 -0500 ++++ /common/wanec/wanec_iface.h 2008-03-05 18:11:47.000000000 -0500 +@@ -293,6 +293,8 @@ + u_int32_t intcount; + u_int32_t critical; + ++ int ignore_H100; /* Temporary for BRI card */ ++ + wan_spinlock_t lock; + u_int32_t events; /* enable events map */ + int tone_verbose; /* verbose mode for tone events */ +Only in /common/wanec: wanec_iface.o +Only in /common/wanec: .wanec_iface.o.cmd +Only in /common/wanec: wanec.ko +Only in /common/wanec: .wanec.ko.cmd +diff -dur --exclude='*.svn' --exclude='libsangoma*' --exclude='sangoma_mgd*' wanec/wanec.mod.c /common/wanec/wanec.mod.c +--- wanec/wanec.mod.c 2008-02-22 15:56:59.000000000 -0500 ++++ /common/wanec/wanec.mod.c 2008-03-05 18:24:45.000000000 -0500 +@@ -55,4 +55,4 @@ + "depends="; + + +-MODULE_INFO(srcversion, "7BF6911A99A9CA69B41E9F4"); ++MODULE_INFO(srcversion, "A6BF1CF61774AE275ECC9A5"); +Only in /common/wanec: wanec.mod.o +Only in /common/wanec: .wanec.mod.o.cmd +Only in /common/wanec: wanec.o +Only in /common/wanec: .wanec.o.cmd +Only in /common/wanec: wanec_utils.o +Only in /common/wanec: .wanec_utils.o.cmd diff --git a/patches/kdrivers/diff.sh b/patches/kdrivers/diff.sh new file mode 100755 index 0000000..2bebf1f --- /dev/null +++ b/patches/kdrivers/diff.sh @@ -0,0 +1,4 @@ +#!/bin/sh + + +diff -dur "$1" "$2" --exclude=*.svn --exclude=libsangoma* --exclude=sangoma_mgd* > diff diff --git a/patches/kdrivers/include/.sdla_aft_te1.h.swp b/patches/kdrivers/include/.sdla_aft_te1.h.swp new file mode 100644 index 0000000..675e2a5 Binary files /dev/null and b/patches/kdrivers/include/.sdla_aft_te1.h.swp differ diff --git a/patches/kdrivers/include/.wanpipe.h.swp b/patches/kdrivers/include/.wanpipe.h.swp deleted file mode 100644 index 3360be1..0000000 Binary files a/patches/kdrivers/include/.wanpipe.h.swp and /dev/null differ diff --git a/patches/kdrivers/include/aft_a104.h b/patches/kdrivers/include/aft_a104.h index 3b0ed31..be0dcb1 100644 --- a/patches/kdrivers/include/aft_a104.h +++ b/patches/kdrivers/include/aft_a104.h @@ -39,7 +39,7 @@ int a104_global_chip_config(sdla_t *card); int a104_global_chip_unconfig(sdla_t *card); -int a104_chip_config(sdla_t *card); +int a104_chip_config(sdla_t *card, wandev_conf_t*); int a104_chip_unconfig(sdla_t *card); int a104_chan_dev_config(sdla_t *card, void *chan); int a104_chan_dev_unconfig(sdla_t *card, void *chan); diff --git a/patches/kdrivers/include/aft_analog.h b/patches/kdrivers/include/aft_analog.h index 1cadc6d..14fb6b1 100644 --- a/patches/kdrivers/include/aft_analog.h +++ b/patches/kdrivers/include/aft_analog.h @@ -21,7 +21,7 @@ int aft_analog_global_chip_config(sdla_t *card); int aft_analog_global_chip_unconfig(sdla_t *card); -int aft_analog_chip_config(sdla_t *card); +int aft_analog_chip_config(sdla_t *card, wandev_conf_t *); int aft_analog_chip_unconfig(sdla_t *card); int aft_analog_chan_dev_config(sdla_t *card, void *chan); int aft_analog_chan_dev_unconfig(sdla_t *card, void *chan); diff --git a/patches/kdrivers/include/aft_bri.h b/patches/kdrivers/include/aft_bri.h new file mode 100755 index 0000000..49a988d --- /dev/null +++ b/patches/kdrivers/include/aft_bri.h @@ -0,0 +1,55 @@ +/***************************************************************************** +* aft_bri.h WANPIPE(tm) BRI Hardware Support +* +* Authors: David Rokhvarg +* +* Copyright: (c) 1984-2007 Sangoma Technologies 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. +* ============================================================================ +* March 15, 2007 David Rokhvarg Initial version. +*****************************************************************************/ + +#ifndef _AFT_BRI_H +#define _AFT_BRI_H + +#ifdef WAN_KERNEL + +#if 0 +#define A200_SECURITY_16_ECCHAN 0x00 +#define A200_SECURITY_32_ECCHAN 0x01 +#define A200_SECURITY_0_ECCHAN 0x05 +#define A200_ECCHAN(val) \ + ((val) == A200_SECURITY_16_ECCHAN) ? 16 : \ + ((val) == A200_SECURITY_32_ECCHAN) ? 32 : 0 +#endif + +int aft_bri_global_chip_config(sdla_t *card); +int aft_bri_global_chip_unconfig(sdla_t *card); +int aft_bri_chip_config(sdla_t *card, wandev_conf_t*); +int aft_bri_chip_unconfig(sdla_t *card); +int aft_bri_chan_dev_config(sdla_t *card, void *chan); +int aft_bri_chan_dev_unconfig(sdla_t *card, void *chan); +int aft_bri_led_ctrl(sdla_t *card, int color, int led_pos, int on); +int aft_bri_test_sync(sdla_t *card, int tx_only); +int bri_check_ec_security(sdla_t *card); + +int __aft_bri_write_fe (void* card, ...); +int aft_bri_write_fe (void* card, ...); +unsigned char __aft_bri_read_fe (void* card, ...); +unsigned char aft_bri_read_fe (void* card, ...); + +int aft_bri_write_cpld(sdla_t *card, unsigned short off,unsigned short data); +unsigned char aft_bri_read_cpld(sdla_t *card, unsigned short cpld_off); + +void aft_bri_fifo_adjust(sdla_t *card,u32 level); + +int aft_bri_dchan_transmit(sdla_t *card, void *chan_ptr, void *src_data_buffer, unsigned int buffer_len); +int aft_bri_dchan_receive( sdla_t *card, void *chan_ptr, void *dst_data_buffer, unsigned int buffer_len); + +#endif/* WAN_KERNEL */ + +#endif/* _AFT_BRI_H */ diff --git a/patches/kdrivers/include/if_wanpipe.h b/patches/kdrivers/include/if_wanpipe.h index c2f3c1a..b9ac671 100644 --- a/patches/kdrivers/include/if_wanpipe.h +++ b/patches/kdrivers/include/if_wanpipe.h @@ -219,7 +219,7 @@ enum { #define WAN_PACKET_FASTROUTE 6 /* Fastrouted frame */ -/* X25 specific */ +/* AF Socket specific */ #define WAN_PACKET_DATA 0 #define WAN_PACKET_CMD 1 #define WAN_PACKET_ERR 2 diff --git a/patches/kdrivers/include/if_wanpipe_common.h b/patches/kdrivers/include/if_wanpipe_common.h index 62ba967..9c3c1a3 100644 --- a/patches/kdrivers/include/if_wanpipe_common.h +++ b/patches/kdrivers/include/if_wanpipe_common.h @@ -1,5 +1,5 @@ /***************************************************************************** -* if_wanipe_common.h Sangoma Driver/Socket common area definitions. +* if_wanpipe_common.h Sangoma Driver/Socket common area definitions. * * Author: Nenad Corbic * @@ -29,6 +29,10 @@ # include # include # include +#elif defined(__WINDOWS__) +# include +# include +# include #endif @@ -42,13 +46,10 @@ typedef struct { int (*output) (netdevice_t*,netskb_t*,struct sockaddr*, struct rtentry*); #else int (*send) (netskb_t* skb, netdevice_t*); -#endif struct net_device_stats* (*get_stats) (netdevice_t*); - int (*ioctl) (netdevice_t*, struct ifreq*, int); - void (*tx_timeout) (netdevice_t*); -#if defined (__LINUX__) - int (*change_mtu)(netdevice_t *dev, int new_mtu); #endif + int (*ioctl) (netdevice_t*, struct ifreq*, wan_ioctl_cmd_t); + void (*tx_timeout) (netdevice_t*); } wanpipe_common_iface_t; typedef struct { @@ -58,20 +59,41 @@ typedef struct { /* netdevice_t *next; */ /* netdevice_t *slave; */ void *card; netdevice_t *dev; + struct mtx ifmtx; unsigned char state; unsigned char usedby; wan_tasklet_t bh_task; wan_timer_t dev_timer; struct socket *sk; /* Wanpipe Sock bind's here (Not used)*/ unsigned int protocol; - unsigned short lcn; + unsigned short lcn; void *lip; unsigned int lip_prot; + int is_spppdev; /* special mode for ADSL PPP_VC/PPP_LLC */ +# if defined(NETGRAPH) + char ng_nodename [NG_NODELEN+1]; + int ng_running; + node_p ng_node; + hook_p ng_upper_hook; + hook_p ng_lower_hook; + hook_p ng_debug_hook; + int ng_lowerhooks; + int ng_upperhooks; + int ng_datahooks; + struct ifqueue lo_queue; + struct ifqueue hi_queue; + short ng_timeout; + struct callout ng_timeout_handle; + u_long ng_out_deficit; /* output since last input */ + u_char ng_promisc; /* promiscuous mode enabled */ + u_char ng_autoSrcAddr; /* always overwrite source address */ +# endif #elif defined(__LINUX__) /* !!! IMPORTANT !!! <- Do not move this parameter (GENERIC-PPP) */ void* *prot_ptr; netdevice_t *next; /*slave;*/ void *card; + struct net_device_stats if_stats; atomic_t receive_block; atomic_t command; @@ -99,6 +121,26 @@ typedef struct { void *lip; unsigned int lip_prot; +#elif defined(__WINDOWS__) + + void *prot_ptr; + netdevice_t* dev; + unsigned char state; + unsigned char usedby; + + void *card; + + void* sk; + + void *lip; + + //A104 additions + unsigned int protocol; + wan_tasklet_t bh_task; + + //ADSL additions + wan_tasklet_t wanpipe_task; /* Immediate BH handler task */ + unsigned int lip_prot; #endif int is_netdev; wanpipe_common_iface_t iface; diff --git a/patches/kdrivers/include/sdla_56k.h b/patches/kdrivers/include/sdla_56k.h index b4522d1..00da98a 100644 --- a/patches/kdrivers/include/sdla_56k.h +++ b/patches/kdrivers/include/sdla_56k.h @@ -103,7 +103,7 @@ typedef struct { } sdla_56k_param_t; extern int sdla_56k_default_cfg(void* arg1, void* p56k_cfg); -extern int sdla_56k_iface_init(void* pfe); +extern int sdla_56k_iface_init(void* pfe, void *p_fe_iface); #endif /* WAN_KERNEL */ diff --git a/patches/kdrivers/include/sdla_adccp.h b/patches/kdrivers/include/sdla_adccp.h index cfd63f2..522961d 100644 --- a/patches/kdrivers/include/sdla_adccp.h +++ b/patches/kdrivers/include/sdla_adccp.h @@ -27,6 +27,7 @@ */ #pragma pack(1) + /****** CONSTANTS DEFINITIONS ***********************************************/ #define X25_MAX_CHAN 255 /* max number of open X.25 circuits */ @@ -54,16 +55,16 @@ */ typedef struct X25Cmd { - unsigned char command ; /* command code */ - unsigned short length ; /* transfer data length */ - unsigned char result ; /* return code */ - unsigned char pf ; /* P/F bit */ - unsigned short lcn ; /* logical channel */ - unsigned char qdm ; /* Q/D/M bits */ - unsigned char cause ; /* cause field */ - unsigned char diagn ; /* diagnostics */ - unsigned char pktType ; /* packet type */ - unsigned char resrv[4] ; /* reserved */ + unsigned char command ; /* command code */ + unsigned short length ; /* transfer data length */ + unsigned char result ; /* return code */ + unsigned char pf ; /* P/F bit */ + unsigned short lcn ; /* logical channel */ + unsigned char qdm ; /* Q/D/M bits */ + unsigned char cause ; /* cause field */ + unsigned char diagn ; /* diagnostics */ + unsigned char pktType ; /* packet type */ + unsigned char resrv[4] ; /* reserved */ } TX25Cmd; /* @@ -226,9 +227,9 @@ typedef struct X25Cmd */ typedef struct X25Mbox { - unsigned char opflag ; /* 00h: execution flag */ - TX25Cmd cmd ; /* 01h: command block */ - unsigned char data[1] ; /* 10h: data buffer */ + unsigned char opflag ; /* 00h: execution flag */ + TX25Cmd cmd ; /* 01h: command block */ + unsigned char data[1] ; /* 10h: data buffer */ } TX25Mbox; /*---------------------------------------------------------------------------- @@ -236,11 +237,11 @@ typedef struct X25Mbox */ typedef struct X25TimeStamp { - unsigned char month ; - unsigned char date ; - unsigned char sec ; - unsigned char min ; - unsigned char hour ; + unsigned char month ; + unsigned char date ; + unsigned char sec ; + unsigned char min ; + unsigned char hour ; } TX25TimeStamp; /*---------------------------------------------------------------------------- @@ -250,11 +251,11 @@ typedef struct X25TimeStamp */ typedef struct X25Status { - TX25TimeStamp tstamp ; /* 08h: timestamp (BCD) */ - unsigned char iflags ; /* 0Dh: interrupt flags */ - unsigned char imask ; /* 0Eh: interrupt mask */ - unsigned char hdlc_status ; /* 10h: misc. HDLC/X25 flags */ - unsigned char ghdlc_status ; /* channel status bytes */ + TX25TimeStamp tstamp ; /* 08h: timestamp (BCD) */ + unsigned char iflags ; /* 0Dh: interrupt flags */ + unsigned char imask ; /* 0Eh: interrupt mask */ + unsigned char hdlc_status ; /* 10h: misc. HDLC/X25 flags */ + unsigned char ghdlc_status ; /* channel status bytes */ } TX25Status; /* @@ -292,9 +293,9 @@ typedef struct X25Status */ typedef struct X25GlobalVars { - unsigned char resrv ; /* 00h: reserved */ - unsigned char dtrCtl ; /* 01h: DTR control code */ - unsigned char resErr ; /* 01h: '1' - reset modem error */ + unsigned char resrv ; /* 00h: reserved */ + unsigned char dtrCtl ; /* 01h: DTR control code */ + unsigned char resErr ; /* 01h: '1' - reset modem error */ } TX25GlobalVars; /* @@ -308,7 +309,7 @@ typedef struct X25GlobalVars */ typedef struct X25ModemStatus { - unsigned char status ; /* 00h: modem status */ + unsigned char status ; /* 00h: modem status */ } TX25ModemStatus; /* @@ -322,11 +323,11 @@ typedef struct X25ModemStatus */ typedef struct X25LinkStatus { - unsigned char txQueued ; /* 00h: queued Tx I-frames*/ - unsigned char rxQueued ; /* 01h: queued Rx I-frames*/ - unsigned char station ; /* 02h: DTE/DCE config. */ - unsigned char reserved ; /* 03h: reserved */ - unsigned char sfTally ; /* 04h: supervisory frame tally */ + unsigned char txQueued ; /* 00h: queued Tx I-frames*/ + unsigned char rxQueued ; /* 01h: queued Rx I-frames*/ + unsigned char station ; /* 02h: DTE/DCE config. */ + unsigned char reserved ; /* 03h: reserved */ + unsigned char sfTally ; /* 04h: supervisory frame tally */ } TX25LinkStatus; /* @@ -340,23 +341,23 @@ typedef struct X25LinkStatus */ typedef struct HdlcStats { /* a number of ... */ - unsigned short rxIFrames ; /* 00h: ready Rx I-frames */ - unsigned short rxNoseq ; /* 02h: frms out-of-sequence */ - unsigned short rxNodata ; /* 04h: I-frms without data */ - unsigned short rxDiscarded ; /* 06h: discarded frames */ - unsigned short rxTooLong ; /* 08h: frames too long */ - unsigned short rxBadAddr ; /* 0Ah: frms with inval.addr*/ - unsigned short txAcked ; /* 0Ch: acknowledged I-frms */ - unsigned short txRetransm ; /* 0Eh: re-transmit. I-frms */ - unsigned short t1Timeout ; /* 10h: T1 timeouts */ - unsigned short rxSABM ; /* 12h: received SABM frames */ - unsigned short rxDISC ; /* 14h: received DISC frames */ - unsigned short rxDM ; /* 16h: received DM frames */ - unsigned short rxFRMR ; /* 18h: FRMR frames received */ - unsigned short txSABM ; /* 1Ah: transm. SABM frames*/ - unsigned short txDISC ; /* 1Ch: transm. DISC frames*/ - unsigned short txDM ; /* 1Eh: transm. DM frames */ - unsigned short txFRMR ; /* 20h: transm. FRMR frames*/ + unsigned short rxIFrames ; /* 00h: ready Rx I-frames */ + unsigned short rxNoseq ; /* 02h: frms out-of-sequence */ + unsigned short rxNodata ; /* 04h: I-frms without data */ + unsigned short rxDiscarded ; /* 06h: discarded frames */ + unsigned short rxTooLong ; /* 08h: frames too long */ + unsigned short rxBadAddr ; /* 0Ah: frms with inval.addr*/ + unsigned short txAcked ; /* 0Ch: acknowledged I-frms */ + unsigned short txRetransm ; /* 0Eh: re-transmit. I-frms */ + unsigned short t1Timeout ; /* 10h: T1 timeouts */ + unsigned short rxSABM ; /* 12h: received SABM frames */ + unsigned short rxDISC ; /* 14h: received DISC frames */ + unsigned short rxDM ; /* 16h: received DM frames */ + unsigned short rxFRMR ; /* 18h: FRMR frames received */ + unsigned short txSABM ; /* 1Ah: transm. SABM frames*/ + unsigned short txDISC ; /* 1Ch: transm. DISC frames*/ + unsigned short txDM ; /* 1Eh: transm. DM frames */ + unsigned short txFRMR ; /* 20h: transm. FRMR frames*/ } THdlcStats; /* --------------------------------------------------------------------------- @@ -364,16 +365,16 @@ typedef struct HdlcStats */ typedef struct HdlcCommErr { /* a number of ... */ - unsigned char rxOverrun ; /* 00h: Rx overrun errors */ - unsigned char rxBadCrc ; /* 01h: Rx CRC errors */ - unsigned char rxAborted ; /* 02h: Rx aborted frames */ - unsigned char rxDropped ; /* 03h: frames lost */ - unsigned char txAborted ; /* 04h: Tx aborted frames */ - unsigned char txUnderrun ; /* 05h: Tx underrun errors */ - unsigned char txMissIntr ; /* 06h: missed underrun ints */ - unsigned char reserved ; /* 07h: reserved */ - unsigned char droppedDCD ; /* 08h: times DCD dropped */ - unsigned char droppedCTS ; /* 09h: times CTS dropped */ + unsigned char rxOverrun ; /* 00h: Rx overrun errors */ + unsigned char rxBadCrc ; /* 01h: Rx CRC errors */ + unsigned char rxAborted ; /* 02h: Rx aborted frames */ + unsigned char rxDropped ; /* 03h: frames lost */ + unsigned char txAborted ; /* 04h: Tx aborted frames */ + unsigned char txUnderrun ; /* 05h: Tx underrun errors */ + unsigned char txMissIntr ; /* 06h: missed underrun ints */ + unsigned char reserved ; /* 07h: reserved */ + unsigned char droppedDCD ; /* 08h: times DCD dropped */ + unsigned char droppedCTS ; /* 09h: times CTS dropped */ } THdlcCommErr; /* --------------------------------------------------------------------------- @@ -381,47 +382,47 @@ typedef struct HdlcCommErr */ typedef struct X25Config { - unsigned char baudRate ; /* 00h: */ - unsigned char t1 ; /* 01h: */ - unsigned char t2 ; /* 02h: */ - unsigned char n2 ; /* 03h: */ - unsigned short hdlcMTU ; /* 04h: */ - unsigned char hdlcWindow ; /* 06h: */ - unsigned char t4 ; /* 07h: */ - unsigned char autoModem ; /* 08h: */ - unsigned char autoHdlc ; /* 09h: */ - unsigned char hdlcOptions ; /* 0Ah: */ - unsigned char station ; /* 0Bh: */ - unsigned char local_station_address ; + unsigned char baudRate ; /* 00h: */ + unsigned char t1 ; /* 01h: */ + unsigned char t2 ; /* 02h: */ + unsigned char n2 ; /* 03h: */ + unsigned short hdlcMTU ; /* 04h: */ + unsigned char hdlcWindow ; /* 06h: */ + unsigned char t4 ; /* 07h: */ + unsigned char autoModem ; /* 08h: */ + unsigned char autoHdlc ; /* 09h: */ + unsigned char hdlcOptions ; /* 0Ah: */ + unsigned char station ; /* 0Bh: */ + unsigned char local_station_address ; #if 0 - unsigned char pktWindow ; /* 0Ch: */ - unsigned short defPktSize ; /* 0Dh: */ - unsigned short pktMTU ; /* 0Fh: */ - unsigned short loPVC ; /* 11h: */ - unsigned short hiPVC ; /* 13h: */ - unsigned short loIncommingSVC ; /* 15h: */ - unsigned short hiIncommingSVC ; /* 17h: */ - unsigned short loTwoWaySVC ; /* 19h: */ - unsigned short hiTwoWaySVC ; /* 1Bh: */ - unsigned short loOutgoingSVC ; /* 1Dh: */ - unsigned short hiOutgoingSVC ; /* 1Fh: */ - unsigned short options ; /* 21h: */ - unsigned char responseOpt ; /* 23h: */ - unsigned short facil1 ; /* 24h: */ - unsigned short facil2 ; /* 26h: */ - unsigned short ccittFacil ; /* 28h: */ - unsigned short otherFacil ; /* 2Ah: */ - unsigned short ccittCompat ; /* 2Ch: */ - unsigned char t10t20 ; /* 2Eh: */ - unsigned char t11t21 ; /* 2Fh: */ - unsigned char t12t22 ; /* 30h: */ - unsigned char t13t23 ; /* 31h: */ - unsigned char t16t26 ; /* 32H: */ - unsigned char t28 ; /* 33h: */ - unsigned char r10r20 ; /* 34h: */ - unsigned char r12r22 ; /* 35h: */ - unsigned char r13r23 ; /* 36h: */ + unsigned char pktWindow ; /* 0Ch: */ + unsigned short defPktSize ; /* 0Dh: */ + unsigned short pktMTU ; /* 0Fh: */ + unsigned short loPVC ; /* 11h: */ + unsigned short hiPVC ; /* 13h: */ + unsigned short loIncommingSVC ; /* 15h: */ + unsigned short hiIncommingSVC ; /* 17h: */ + unsigned short loTwoWaySVC ; /* 19h: */ + unsigned short hiTwoWaySVC ; /* 1Bh: */ + unsigned short loOutgoingSVC ; /* 1Dh: */ + unsigned short hiOutgoingSVC ; /* 1Fh: */ + unsigned short options ; /* 21h: */ + unsigned char responseOpt ; /* 23h: */ + unsigned short facil1 ; /* 24h: */ + unsigned short facil2 ; /* 26h: */ + unsigned short ccittFacil ; /* 28h: */ + unsigned short otherFacil ; /* 2Ah: */ + unsigned short ccittCompat ; /* 2Ch: */ + unsigned char t10t20 ; /* 2Eh: */ + unsigned char t11t21 ; /* 2Fh: */ + unsigned char t12t22 ; /* 30h: */ + unsigned char t13t23 ; /* 31h: */ + unsigned char t16t26 ; /* 32H: */ + unsigned char t28 ; /* 33h: */ + unsigned char r10r20 ; /* 34h: */ + unsigned char r12r22 ; /* 35h: */ + unsigned char r13r23 ; /* 36h: */ #endif } TX25Config; @@ -431,21 +432,21 @@ typedef struct X25Config */ typedef struct X25ChanAlloc /*----- Channel allocation -*/ { - unsigned short loPVC ; /* 00h: lowest PVC number */ - unsigned short hiPVC ; /* 02h: highest PVC number */ - unsigned short loIncommingSVC ; /* 04h: lowest incoming SVC */ - unsigned short hiIncommingSVC ; /* 06h: highest incoming SVC */ - unsigned short loTwoWaySVC ; /* 08h: lowest two-way SVC */ - unsigned short hiTwoWaySVC ; /* 0Ah: highest two-way SVC */ - unsigned short loOutgoingSVC ; /* 0Ch: lowest outgoing SVC */ - unsigned short hiOutgoingSVC ; /* 0Eh: highest outgoing SVC */ + unsigned short loPVC ; /* 00h: lowest PVC number */ + unsigned short hiPVC ; /* 02h: highest PVC number */ + unsigned short loIncommingSVC ; /* 04h: lowest incoming SVC */ + unsigned short hiIncommingSVC ; /* 06h: highest incoming SVC */ + unsigned short loTwoWaySVC ; /* 08h: lowest two-way SVC */ + unsigned short hiTwoWaySVC ; /* 0Ah: highest two-way SVC */ + unsigned short loOutgoingSVC ; /* 0Ch: lowest outgoing SVC */ + unsigned short hiOutgoingSVC ; /* 0Eh: highest outgoing SVC */ } TX25ChanAlloc; typedef struct X25ChanCfg /*------ Channel configuration -----*/ { - unsigned char type ; /* 00h: channel type */ - unsigned char txConf ; /* 01h: Tx packet and window sizes */ - unsigned char rxConf ; /* 01h: Rx packet and window sizes */ + unsigned char type ; /* 00h: channel type */ + unsigned char txConf ; /* 01h: Tx packet and window sizes */ + unsigned char rxConf ; /* 01h: Rx packet and window sizes */ } TX25ChanCfg; /* @@ -461,38 +462,38 @@ typedef struct X25ChanCfg /*------ Channel configuration -----*/ */ typedef struct X25Stats { /* number of packets Tx/Rx'ed */ - unsigned short txRestartRqst ; /* 00h: Restart Request */ - unsigned short rxRestartRqst ; /* 02h: Restart Request */ - unsigned short txRestartConf ; /* 04h: Restart Confirmation */ - unsigned short rxRestartConf ; /* 06h: Restart Confirmation */ - unsigned short txResetRqst ; /* 08h: Reset Request */ - unsigned short rxResetRqst ; /* 0Ah: Reset Request */ - unsigned short txResetConf ; /* 0Ch: Reset Confirmation */ - unsigned short rxResetConf ; /* 0Eh: Reset Confirmation */ - unsigned short txCallRequest ; /* 10h: Call Request */ - unsigned short rxCallRequest ; /* 12h: Call Request */ - unsigned short txCallAccept ; /* 14h: Call Accept */ - unsigned short rxCallAccept ; /* 16h: Call Accept */ - unsigned short txClearRqst ; /* 18h: Clear Request */ - unsigned short rxClearRqst ; /* 1Ah: Clear Request */ - unsigned short txClearConf ; /* 1Ch: Clear Confirmation */ - unsigned short rxClearConf ; /* 1Eh: Clear Confirmation */ - unsigned short txDiagnostic ; /* 20h: Diagnostic */ - unsigned short rxDiagnostic ; /* 22h: Diagnostic */ - unsigned short txRegRqst ; /* 24h: Registration Request */ - unsigned short rxRegRqst ; /* 26h: Registration Request */ - unsigned short txRegConf ; /* 28h: Registration Confirm.*/ - unsigned short rxRegConf ; /* 2Ah: Registration Confirm.*/ - unsigned short txInterrupt ; /* 2Ch: Interrupt */ - unsigned short rxInterrupt ; /* 2Eh: Interrupt */ - unsigned short txIntrConf ; /* 30h: Interrupt Confirm. */ - unsigned short rxIntrConf ; /* 32h: Interrupt Confirm. */ - unsigned short txData ; /* 34h: Data */ - unsigned short rxData ; /* 36h: Data */ - unsigned short txRR ; /* 38h: RR */ - unsigned short rxRR ; /* 3Ah: RR */ - unsigned short txRNR ; /* 3Ch: RNR */ - unsigned short rxRNR ; /* 3Eh: RNR */ + unsigned short txRestartRqst ; /* 00h: Restart Request */ + unsigned short rxRestartRqst ; /* 02h: Restart Request */ + unsigned short txRestartConf ; /* 04h: Restart Confirmation */ + unsigned short rxRestartConf ; /* 06h: Restart Confirmation */ + unsigned short txResetRqst ; /* 08h: Reset Request */ + unsigned short rxResetRqst ; /* 0Ah: Reset Request */ + unsigned short txResetConf ; /* 0Ch: Reset Confirmation */ + unsigned short rxResetConf ; /* 0Eh: Reset Confirmation */ + unsigned short txCallRequest ; /* 10h: Call Request */ + unsigned short rxCallRequest ; /* 12h: Call Request */ + unsigned short txCallAccept ; /* 14h: Call Accept */ + unsigned short rxCallAccept ; /* 16h: Call Accept */ + unsigned short txClearRqst ; /* 18h: Clear Request */ + unsigned short rxClearRqst ; /* 1Ah: Clear Request */ + unsigned short txClearConf ; /* 1Ch: Clear Confirmation */ + unsigned short rxClearConf ; /* 1Eh: Clear Confirmation */ + unsigned short txDiagnostic ; /* 20h: Diagnostic */ + unsigned short rxDiagnostic ; /* 22h: Diagnostic */ + unsigned short txRegRqst ; /* 24h: Registration Request */ + unsigned short rxRegRqst ; /* 26h: Registration Request */ + unsigned short txRegConf ; /* 28h: Registration Confirm.*/ + unsigned short rxRegConf ; /* 2Ah: Registration Confirm.*/ + unsigned short txInterrupt ; /* 2Ch: Interrupt */ + unsigned short rxInterrupt ; /* 2Eh: Interrupt */ + unsigned short txIntrConf ; /* 30h: Interrupt Confirm. */ + unsigned short rxIntrConf ; /* 32h: Interrupt Confirm. */ + unsigned short txData ; /* 34h: Data */ + unsigned short rxData ; /* 36h: Data */ + unsigned short txRR ; /* 38h: RR */ + unsigned short rxRR ; /* 3Ah: RR */ + unsigned short txRNR ; /* 3Ch: RNR */ + unsigned short rxRNR ; /* 3Eh: RNR */ } TX25Stats; /*---------------------------------------------------------------------------- @@ -500,12 +501,12 @@ typedef struct X25Stats */ typedef struct X25EventLog { - unsigned char type ; /* 00h: transaction type */ - unsigned short lcn ; /* 01h: logical channel num */ - unsigned char packet ; /* 03h: async packet type */ - unsigned char cause ; /* 04h: X.25 cause field */ - unsigned char diag ; /* 05h: X.25 diag field */ - TX25TimeStamp ts ; /* 06h: time stamp */ + unsigned char type ; /* 00h: transaction type */ + unsigned short lcn ; /* 01h: logical channel num */ + unsigned char packet ; /* 03h: async packet type */ + unsigned char cause ; /* 04h: X.25 cause field */ + unsigned char diag ; /* 05h: X.25 diag field */ + TX25TimeStamp ts ; /* 06h: time stamp */ } TX25EventLog; /* @@ -538,8 +539,8 @@ typedef struct X25EventLog */ typedef struct X25TraceCfg { - unsigned char flags ; /* 00h: trace configuration flags */ - unsigned char timeout ; /* 01h: timeout for trace delay mode*/ + unsigned char flags ; /* 00h: trace configuration flags */ + unsigned char timeout ; /* 01h: timeout for trace delay mode*/ } TX25TraceCfg; /* @@ -559,12 +560,12 @@ typedef struct X25TraceCfg */ typedef struct X25Trace /*----- Trace data structure -------*/ { - unsigned short length ; /* 00h: trace data length */ - unsigned char type ; /* 02h: trace type */ - unsigned char lost_cnt ; /* 03h: N of traces lost */ - TX25TimeStamp tstamp ; /* 04h: mon/date/sec/min/hour */ - unsigned short millisec ; /* 09h: ms time stamp */ - unsigned char data[0] ; /* 0Bh: traced frame */ + unsigned short length ; /* 00h: trace data length */ + unsigned char type ; /* 02h: trace type */ + unsigned char lost_cnt ; /* 03h: N of traces lost */ + TX25TimeStamp tstamp ; /* 04h: mon/date/sec/min/hour */ + unsigned short millisec ; /* 09h: ms time stamp */ + unsigned char data[0] ; /* 0Bh: traced frame */ } TX25Trace; /* @@ -589,17 +590,17 @@ typedef struct X25Trace /*----- Trace data structure -------*/ typedef struct HDLCFrame /*----- DHLC Frame Format ----------*/ { - unsigned char addr ; /* address field */ - unsigned char cntl ; /* control field */ - unsigned char data[0] ; + unsigned char addr ; /* address field */ + unsigned char cntl ; /* control field */ + unsigned char data[0] ; } THDLCFrame; typedef struct X25Pkt /*----- X.25 Paket Format ----------*/ { - unsigned char lcn_hi ; /* 4 MSB of Logical Channel Number */ - unsigned char lcn_lo ; /* 8 LSB of Logical Channel Number */ - unsigned char type ; - unsigned char data[0] ; + unsigned char lcn_hi ; /* 4 MSB of Logical Channel Number */ + unsigned char lcn_lo ; /* 8 LSB of Logical Channel Number */ + unsigned char type ; + unsigned char data[0] ; } TX25Pkt; /* @@ -633,27 +634,27 @@ typedef struct X25Pkt /*----- X.25 Paket Format ----------*/ typedef struct { - TX25Cmd cmd ; - char data[X25_MAX_DATA] ; + TX25Cmd cmd ; + char data[X25_MAX_DATA] ; } mbox_cmd_t; #if 0 typedef struct { - unsigned char qdm ; /* Q/D/M bits */ - unsigned char cause ; /* cause field */ - unsigned char diagn ; /* diagnostics */ - unsigned char pktType ; - unsigned short length ; - unsigned char result ; - unsigned short lcn ; - char reserved[7] ; + unsigned char qdm ; /* Q/D/M bits */ + unsigned char cause ; /* cause field */ + unsigned char diagn ; /* diagnostics */ + unsigned char pktType ; + unsigned short length ; + unsigned char result ; + unsigned short lcn ; + char reserved[7] ; }x25api_hdr_t; typedef struct { - x25api_hdr_t hdr ; - char data[X25_MAX_DATA] ; + x25api_hdr_t hdr ; + char data[X25_MAX_DATA] ; }x25api_t; #endif @@ -673,75 +674,72 @@ typedef struct { #if 0 typedef struct { - unsigned char opp_flag ; /* the opp flag */ - unsigned char command ; /* command code */ - unsigned short length ; /* transfer data length */ - unsigned char result ; /* return code */ - unsigned char pf ; /* P/F bit */ - unsigned short lcn ; /* logical channel */ - unsigned char qdm ; /* Q/D/M bits */ - unsigned char cause ; /* cause field */ - unsigned char diagn ; /* diagnostics */ - unsigned char pktType ; /* packet type */ - unsigned char resrv[4] ; /* reserved */ + unsigned char opp_flag ; /* the opp flag */ + unsigned char command ; /* command code */ + unsigned short length ; /* transfer data length */ + unsigned char result ; /* return code */ + unsigned char pf ; /* P/F bit */ + unsigned short lcn ; /* logical channel */ + unsigned char qdm ; /* Q/D/M bits */ + unsigned char cause ; /* cause field */ + unsigned char diagn ; /* diagnostics */ + unsigned char pktType ; /* packet type */ + unsigned char resrv[4] ; /* reserved */ } cblock_t; typedef struct { - ip_pkt_t ip_pkt ; - udp_pkt_t udp_pkt ; - wp_mgmt_t wp_mgmt ; - cblock_t cblock ; - unsigned char data[4080] ; + ip_pkt_t ip_pkt ; + udp_pkt_t udp_pkt ; + wp_mgmt_t wp_mgmt ; + cblock_t cblock ; + unsigned char data[4080] ; } x25_udp_pkt_t; #endif typedef struct read_hdlc_stat { - unsigned short inf_frames_rx_ok ; - unsigned short inf_frames_rx_out_of_seq ; - unsigned short inf_frames_rx_no_data ; - unsigned short inf_frames_rx_dropped ; - unsigned short inf_frames_rx_data_too_long ; - unsigned short inf_frames_rx_invalid_addr ; - unsigned short inf_frames_tx_ok ; - unsigned short inf_frames_tx_retransmit ; - unsigned short T1_timeouts ; - unsigned short SABM_frames_rx ; - unsigned short DISC_frames_rx ; - unsigned short DM_frames_rx ; - unsigned short FRMR_frames_rx ; - unsigned short SABM_frames_tx ; - unsigned short DISC_frames_tx ; - unsigned short DM_frames_tx ; - unsigned short FRMR_frames_tx ; + unsigned short inf_frames_rx_ok ; + unsigned short inf_frames_rx_out_of_seq ; + unsigned short inf_frames_rx_no_data ; + unsigned short inf_frames_rx_dropped ; + unsigned short inf_frames_rx_data_too_long ; + unsigned short inf_frames_rx_invalid_addr ; + unsigned short inf_frames_tx_ok ; + unsigned short inf_frames_tx_retransmit ; + unsigned short T1_timeouts ; + unsigned short SABM_frames_rx ; + unsigned short DISC_frames_rx ; + unsigned short DM_frames_rx ; + unsigned short FRMR_frames_rx ; + unsigned short SABM_frames_tx ; + unsigned short DISC_frames_tx ; + unsigned short DM_frames_tx ; + unsigned short FRMR_frames_tx ; } read_hdlc_stat_t; typedef struct read_comms_err_stats{ - unsigned char overrun_err_rx ; - unsigned char CRC_err ; - unsigned char abort_frames_rx ; - unsigned char frames_dropped_buf_full ; - unsigned char abort_frames_tx ; - unsigned char transmit_underruns ; - unsigned char missed_tx_underruns_intr ; - unsigned char reserved ; - unsigned char DCD_drop ; - unsigned char CTS_drop ; + unsigned char overrun_err_rx ; + unsigned char CRC_err ; + unsigned char abort_frames_rx ; + unsigned char frames_dropped_buf_full ; + unsigned char abort_frames_tx ; + unsigned char transmit_underruns ; + unsigned char missed_tx_underruns_intr ; + unsigned char reserved ; + unsigned char DCD_drop ; + unsigned char CTS_drop ; } read_comms_err_stats_t; typedef struct trace_data { - unsigned short length ; - unsigned char type ; - unsigned char trace_dropped ; - unsigned char reserved[5] ; - unsigned short timestamp ; - unsigned char data ; + unsigned short length ; + unsigned char type ; + unsigned char trace_dropped ; + unsigned char reserved[5] ; + unsigned short timestamp ; + unsigned char data ; } trace_data_t; enum {UDP_XPIPE_TYPE}; - -#pragma pack() - #define XPIPE_ENABLE_TRACING 0x14 #define XPIPE_DISABLE_TRACING 0x14 #define XPIPE_GET_TRACE_INFO 0x16 @@ -770,5 +768,6 @@ enum {UDP_XPIPE_TYPE}; #define TRACE_ALL_HDLC_FRMS 0x40 #define TRACE_DATA_FRMS 0x08 +#pragma pack() #endif /* _SDLA_X25_H */ diff --git a/patches/kdrivers/include/sdla_adsl.h b/patches/kdrivers/include/sdla_adsl.h index 0febfc3..83482dd 100644 --- a/patches/kdrivers/include/sdla_adsl.h +++ b/patches/kdrivers/include/sdla_adsl.h @@ -2,7 +2,7 @@ * Copyright (c) 2002 * Alex Feldman . All rights reserved. * - * $Id: sdla_adsl.h,v 1.8 2006/07/25 19:44:50 sangoma Exp $ + * $Id: sdla_adsl.h,v 1.9 2008/01/09 17:45:29 sangoma Exp $ */ /************************************************************************* @@ -24,6 +24,8 @@ #if defined(__FreeBSD__) || defined(__OpenBSD__) # include +#elif defined(__WINDOWS__) +# include #elif defined(__LINUX__) || defined(__KERNEL__) # include #elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) @@ -65,10 +67,12 @@ typedef struct adsl_cfg { unsigned char adsl_selected_standard; } adsl_cfg_t; +#if !defined(__WINDOWS__) #undef wan_udphdr_data #define wan_udphdr_data wan_udphdr_adsl_data #undef wan_udp_data #define wan_udp_data wan_udp_hdr.wan_udphdr_adsl_data +#endif #ifdef WAN_KERNEL @@ -88,6 +92,13 @@ typedef struct adsl_private_area #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) struct ifmedia media; /* media information */ #endif +#if defined(__WINDOWS__) + void *sdla_net_dev; + void *card; + struct net_device_stats if_stats; + wan_tasklet_t adsl_if_send_task; /* Immediate BH handler task */ + wan_trace_t trace_info; +#endif } adsl_private_area_t; diff --git a/patches/kdrivers/include/sdla_adsl_iface.h b/patches/kdrivers/include/sdla_adsl_iface.h index 3ffaccf..1ac3254 100644 --- a/patches/kdrivers/include/sdla_adsl_iface.h +++ b/patches/kdrivers/include/sdla_adsl_iface.h @@ -32,6 +32,8 @@ #define ADSL_ACTUAL_CONFIGURATION 0x15 #define ADSL_ACTUAL_INTERLEAVE_STATUS 0x16 #define ADSL_ATM_CELL_COUNTER 0x17 +#define ADSL_EEPROM_WRITE 0x18 +#define ADSL_EEPROM_READ 0x19 typedef struct adsl_failures diff --git a/patches/kdrivers/include/sdla_aft_te1.h b/patches/kdrivers/include/sdla_aft_te1.h index 79118ab..fed0099 100644 --- a/patches/kdrivers/include/sdla_aft_te1.h +++ b/patches/kdrivers/include/sdla_aft_te1.h @@ -25,10 +25,19 @@ #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) # include # include +#elif defined(__WINDOWS__) +# include +# include +# include +# include +# define COMPILE_COMMON_PRIVATE_AREA +# include +# define AFT_MAX_CHIP_SECURITY_CNT 100 #else # include # include # include +# include #endif #define AFT_PORT0_OFFSET 0x00000 @@ -79,6 +88,7 @@ # define AFT_CHIPCFG_TE1_CFG_BIT 0 # define AFT_CHIPCFG_56K_CFG_BIT 0 # define AFT_CHIPCFG_ANALOG_CLOCK_SELECT_BIT 0 +# define AFT_CHIPCFG_A500_NET_SYNC_CLOCK_SELECT_BIT 0 # define AFT_CHIPCFG_SFR_EX_BIT 1 # define AFT_CHIPCFG_SFR_IN_BIT 2 # define AFT_CHIPCFG_FE_INTR_CFG_BIT 3 @@ -101,12 +111,26 @@ # define AFT_CHIPCFG_ANALOG_INTR_MASK 0x0F /* Analog */ # define AFT_CHIPCFG_ANALOG_INTR_SHIFT 9 +# define AFT_CHIPCFG_A500_INTR_MASK 0x0F /* A500 BRI - interrupt pending from upto 4 remoras. + bit 9 - remora 1 + bit 10- remora 2 + bit 11- remora 3 + bit 12- remora 4 + */ +# define AFT_CHIPCFG_A500_INTR_SHIFT 9 +# define A500_LINE_SYNC_MASTER_BIT 31 + + # define AFT_CHIPCFG_A108_EC_CLOCK_SRC_MASK 0x07 /* A108 */ # define AFT_CHIPCFG_A108_EC_CLOCK_SRC_SHIFT 9 # define AFT_CHIPCFG_A104D_EC_SECURITY_BIT 12 # define AFT_CHIPCFG_A108_EC_INTR_ENABLE_BIT 12 /* A108 */ + +# define AFT_CHIPCFG_A500_EC_INTR_ENABLE_BIT 14 /* A500 - BRI not used for now */ + + # define AFT_CHIPCFG_EC_INTR_STAT_BIT 13 @@ -122,6 +146,7 @@ # define AFT_CHIPCFG_A200_EC_SECURITY_BIT 15 /* Analog */ # define AFT_CHIPCFG_A108_EC_SECURITY_BIT 15 /* A108 */ +# define AFT_CHIPCFG_A500_EC_SECURITY_BIT 15 /* A500/BRI */ # define AFT_CHIPCFG_P3_TDMV_INTR_BIT 16 # define AFT_CHIPCFG_A108_A104_TDM_FIFO_SYNC_BIT 16 /* A108 Global Fifo Sync Bit */ @@ -225,12 +250,16 @@ aft_chipcfg_get_tdmv_intr_stats(u32 reg) # define AFT_CHIPCFG_A108_TDMV_INTR_MASK 0xFF # define AFT_CHIPCFG_A108_TDMV_INTR_SHIFT 8 + # define AFT_CHIPCFG_A108_FIFO_INTR_MASK 0xFF # define AFT_CHIPCFG_A108_FIFO_INTR_SHIFT 16 # define AFT_CHIPCFG_A108_DMA_INTR_MASK 0xFF # define AFT_CHIPCFG_A108_DMA_INTR_SHIFT 24 + + + /* A108 Interrupt Status Functions */ static __inline u32 @@ -265,6 +294,46 @@ aft_chipcfg_a108_get_tdmv_intr_stats(u32 reg) return reg; } + +/* AFT Serial specific bits */ + +# define AFT_CHIPCFG_SERIAL_WDT_INTR_MASK 0xF +# define AFT_CHIPCFG_SERIAL_WDT_INTR_SHIFT 0 + +# define AFT_CHIPCFG_SERIAL_STATUS_INTR_MASK 0xFFF +# define AFT_CHIPCFG_SERIAL_STATUS_INTR_SHIFT 4 + +# define AFT_CHIPCFG_SERIAL_CTS_STATUS_INTR_BIT 0 +# define AFT_CHIPCFG_SERIAL_DCD_STATUS_INTR_BIT 1 +# define AFT_CHIPCFG_SERIAL_RTS_STATUS_INTR_BIT 2 + +/* Serial specific functions */ + +static __inline u32 +aft_chipcfg_serial_get_status_intr_stats(u32 reg, int port) +{ + reg=reg>>AFT_CHIPCFG_SERIAL_STATUS_INTR_SHIFT; + reg&=AFT_CHIPCFG_SERIAL_STATUS_INTR_MASK; + + if (port) { + port--; + } + reg=(reg>>(3*port))&0x07; + + return reg; +} + + +static __inline u32 +aft_chipcfg_serial_get_wdt_intr_stats(u32 reg) +{ + reg=reg>>AFT_CHIPCFG_SERIAL_WDT_INTR_SHIFT; + reg&=AFT_CHIPCFG_SERIAL_WDT_INTR_MASK; + return reg; +} + + + /* 56k IRQ status bits */ # define AFT_CHIPCFG_A56K_WDT_INTR_BIT 0 # define AFT_CHIPCFG_A56K_DMA_INTR_BIT 24 @@ -382,10 +451,20 @@ aft_fifo_mark_gset(u32 *reg, u8 mark) } + /*====================================================== - * PER PORT * - * AFT INTERRUPT Configuration Registers + * AFT AFT_CHIP_STAT_REG + * + *=====================================================*/ + + + + + +/*====================================================== + * + * AFT_LINE_CFG_REG * *=====================================================*/ @@ -403,6 +482,7 @@ aft_fifo_mark_gset(u32 *reg, u8 mark) #define AFT_RX_FIFO_INTR_PENDING_REG 0x118 +#define AFT_SERIAL_LINE_CFG_REG 0x210 # define AFT_LCFG_FE_IFACE_RESET_BIT 0 # define AFT_LCFG_TX_FE_SYNC_STAT_BIT 1 @@ -438,8 +518,6 @@ aft_fifo_mark_gset(u32 *reg, u8 mark) # define AFT_LCFG_A108_FE_TE1_MODE_BIT 30 /* A108 */ - - static __inline void aft_lcfg_fe_clk_source(u32 *reg, u32 src) { @@ -541,6 +619,16 @@ aft_dmactrl_set_max_logic_ch(u32 *reg, int max_logic_ch) *reg|=(max_logic_ch<> AFT_DMACTRL_MAX_LOGIC_CH_SHIFT; + return max_logic_ch; +} + + /*====================================================== * PER PORT * @@ -717,6 +805,53 @@ aft_dmachain_enable_tdmv_and_mtu_size(u32 *reg, int size) } + +/*====================================================== + * PER PORT + * + * AFT DMA Descr RAM Registers + * AFT_SERIAL_LINE_CFG_REG + *=====================================================*/ + +#define AFT_SERIAL_LCFG_RTS_BIT 0 +#define AFT_SERIAL_LCFG_DTR_BIT 1 +#define AFT_SERIAL_LCFG_CTS_BIT 2 +#define AFT_SERIAL_LCFG_DCD_BIT 3 +#define AFT_SERIAL_LCFG_POLARITY_BIT 4 +#define AFT_SERIAL_LCFG_SWMODE_BIT 5 + +#define AFT_SERIAL_LCFG_BAUD_SHIFT 8 +#define AFT_SERIAL_LCFG_BAUD_MASK 0xFFFF + +#define AFT_SERIAL_LCFG_CLK_SRC_BIT 24 +#define AFT_SERIAL_LCFG_CTS_INTR_EN_BIT 25 +#define AFT_SERIAL_LCFG_DCD_INTR_EN_BIT 26 +#define AFT_SERIAL_LCFG_IDLE_DET_BIT 27 + +#define AFT_SERIAL_LCFG_LCODING_MASK 0x07 +#define AFT_SERIAL_LCFG_LCODING_SHIFT 28 + +#define AFT_SERIAL_LCFG_IFACE_TYPE_BIT 31 + +static __inline void +aft_serial_set_baud_rate(u32 *reg, u32 rate) +{ + u32 div= (14745600/(2*rate)); + u32 remain= (14745600%(2*rate)); + if (!remain || (remain/2 > rate)) { + div=div-1; + } + *reg&=~(AFT_SERIAL_LCFG_BAUD_MASK< MCLBYTES - 16){ + new_mtu = MCLBYTES-16; + } +#endif + return new_mtu; } static __inline unsigned short aft_dma_buf_bits(unsigned short dma_bufs) @@ -1020,7 +1173,7 @@ static __inline int aft_get_num_of_slots(u32 total_slots, u32 chan_slots) { int num_of_slots=0; - int i; + u32 i; for (i=0;idevname,chan->if_name,reg); - } - } - if (wan_test_bit(AFT_RXDMA_HIDMASTATUS_PCI_T_ABRT,&dma_status)){ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s:%s: Rx Error: Abort from Target: pci fatal error 0x%X!\n", - card->devname,chan->if_name,reg); - } - } - if (wan_test_bit(AFT_RXDMA_HIDMASTATUS_PCI_DS_TOUT,&dma_status)){ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s:%s: Rx Error: No 'DeviceSelect' from target: pci fatal error 0x%X!\n", - card->devname,chan->if_name,reg); - } - } - if (wan_test_bit(AFT_RXDMA_HIDMASTATUS_PCI_RETRY,&dma_status)){ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s:%s: Rx Error: 'Retry' exceeds maximum (64k): pci fatal error 0x%X!\n", - card->devname,chan->if_name,reg); - } - } - - chan->errstats.Rx_pci_errors++; - chan->if_stats.rx_errors++; - card->wandev.stats.rx_errors++; - return 1; - } - - if (chan->hdlc_eng){ - - /* Checking Rx DMA Frame start bit. (information for api) */ - if (!wan_test_bit(AFT_RXDMA_HI_START_BIT,®)){ - DEBUG_TEST("%s:%s RxDMA Intr: Start flag missing: MTU Mismatch! Reg=0x%X\n", - card->devname,chan->if_name,reg); - chan->if_stats.rx_frame_errors++; - chan->opstats.Rx_Data_discard_long_count++; - chan->errstats.Rx_hdlc_corrupiton++; - card->wandev.stats.rx_errors++; - return 1; - } - - /* Checking Rx DMA Frame end bit. (information for api) */ - if (!wan_test_bit(AFT_RXDMA_HI_EOF_BIT,®)){ - DEBUG_TEST("%s:%s: RxDMA Intr: End flag missing: MTU Mismatch! Reg=0x%X\n", - card->devname,chan->if_name,reg); - chan->if_stats.rx_frame_errors++; - chan->opstats.Rx_Data_discard_long_count++; - chan->errstats.Rx_hdlc_corrupiton++; - card->wandev.stats.rx_errors++; - return 1; - - } else { /* Check CRC error flag only if this is the end of Frame */ - - if (wan_test_bit(AFT_RXDMA_HI_FCS_ERR_BIT,®)){ - DEBUG_TEST("%s:%s: RxDMA Intr: CRC Error! Reg=0x%X Len=%d\n", - card->devname,chan->if_name,reg, - (reg&AFT_RXDMA_HI_DMA_LENGTH_MASK)>>2); - chan->if_stats.rx_frame_errors++; - chan->errstats.Rx_crc_err_count++; - card->wandev.stats.rx_crc_errors++; - data_error = 1; - } - - /* Check if this frame is an abort, if it is - * drop it and continue receiving */ - if (wan_test_bit(AFT_RXDMA_HI_FRM_ABORT_BIT,®)){ - DEBUG_TEST("%s:%s: RxDMA Intr: Abort! Reg=0x%X\n", - card->devname,chan->if_name,reg); - chan->if_stats.rx_frame_errors++; - chan->errstats.Rx_hdlc_corrupiton++; - card->wandev.stats.rx_frame_errors++; - data_error = 1; - } - -#if 0 - if (chan->common.usedby != API && data_error){ - return 1; - } -#else - if (data_error) { - return 1; - } -#endif - - } - } - - return 0; -} - - - void aft_free_logical_channel_num (sdla_t *card, int logic_ch); void aft_dma_max_logic_ch(sdla_t *card); void aft_fe_intr_ctrl(sdla_t *card, int status); void __aft_fe_intr_ctrl(sdla_t *card, int status); void aft_wdt_set(sdla_t *card, unsigned char val); void aft_wdt_reset(sdla_t *card); - +void wanpipe_wake_stack(private_area_t* chan); #endif diff --git a/patches/kdrivers/include/sdla_aft_te1.h~ b/patches/kdrivers/include/sdla_aft_te1.h~ deleted file mode 100644 index 9833cb2..0000000 --- a/patches/kdrivers/include/sdla_aft_te1.h~ +++ /dev/null @@ -1,1585 +0,0 @@ -/***************************************************************************** -* sdla_aft_te1.h -* -* WANPIPE(tm) AFT Hardware Support -* -* Authors: Nenad Corbic -* -* Copyright: (c) 2003-2005 Sangoma Technologies 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. -* ============================================================================ -* Jan 07, 2003 Nenad Corbic Initial version. -*****************************************************************************/ - - -#ifndef _SDLA_AFT_TE1_H -#define _SDLA_AFT_TE1_H - - -#ifdef WAN_KERNEL - -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -# include -# include -#else -# include -# include -# include -#endif - -#define AFT_PORT0_OFFSET 0x00000 -#define AFT_PORT1_OFFSET 0x04000 -#define AFT_PORT2_OFFSET 0x08000 -#define AFT_PORT3_OFFSET 0x0C000 - -#define AFT_PORT4_OFFSET 0x10000 -#define AFT_PORT5_OFFSET 0x14000 -#define AFT_PORT6_OFFSET 0x18000 -#define AFT_PORT7_OFFSET 0x1C000 - -#define AFT_PORT_REG(card,reg) (reg+(0x4000*card->wandev.comm_port)) - -/*====================================================== - * GLOBAL (All Ports) - * - * AFT Chip PCI Registers - * - * Global Configuration Area for All Ports - * - *=====================================================*/ - -#define AFT_CHIP_CFG_REG 0x40 - -#define AFT_ANALOG_MCPU_IFACE_RW 0x44 - -#define AFT_WDT_CTRL_REG 0x48 -#define AFT_WDT_1TO4_CTRL_REG AFT_WDT_CTRL_REG - -#define AFT_DATA_MUX_REG 0x4C - -#define AFT_FIFO_MARK_REG 0x50 - -#define AFT_MCPU_INTERFACE_RW 0x54 - -#define AFT_ANALOG_SPI_IFACE_RW 0x54 - -#define AFT_CHIP_STAT_REG 0x58 - -#define AFT_WDT_4TO8_CTRL_REG 0x5C - - -/*================================================= - A104 CHIP CFG REGISTERS -*/ - -# define AFT_CHIPCFG_TE1_CFG_BIT 0 -# define AFT_CHIPCFG_56K_CFG_BIT 0 -# define AFT_CHIPCFG_ANALOG_CLOCK_SELECT_BIT 0 -# define AFT_CHIPCFG_SFR_EX_BIT 1 -# define AFT_CHIPCFG_SFR_IN_BIT 2 -# define AFT_CHIPCFG_FE_INTR_CFG_BIT 3 - -# define AFT_CHIPCFG_A104D_EC_SEC_KEY_MASK 0x7 -# define AFT_CHIPCFG_A104D_EC_SEC_KEY_SHIFT 4 - -# define AFT_CHIPCFG_A200_EC_SEC_KEY_MASK 0x3 -# define AFT_CHIPCFG_A200_EC_SEC_KEY_SHIFT 16 - -# define AFT_CHIPCFG_SPI_SLOW_BIT 5 /* Slow down SPI */ -#if 0 -# define AFT_CHIPCFG_EC_INTR_CFG_BIT 4 /* Shark or Analog */ -# define AFT_CHIPCFG_SECURITY_CFG_BIT 6 -#endif - -# define AFT_CHIPCFG_RAM_READY_BIT 7 -# define AFT_CHIPCFG_HDLC_CTRL_RDY_BIT 8 - -# define AFT_CHIPCFG_ANALOG_INTR_MASK 0x0F /* Analog */ -# define AFT_CHIPCFG_ANALOG_INTR_SHIFT 9 - -# define AFT_CHIPCFG_A108_EC_CLOCK_SRC_MASK 0x07 /* A108 */ -# define AFT_CHIPCFG_A108_EC_CLOCK_SRC_SHIFT 9 - -# define AFT_CHIPCFG_A104D_EC_SECURITY_BIT 12 -# define AFT_CHIPCFG_A108_EC_INTR_ENABLE_BIT 12 /* A108 */ - -# define AFT_CHIPCFG_EC_INTR_STAT_BIT 13 - - -/* A104 A200 A108 Differ Here - * By default any register without device name is - * common to all all. - */ - -# define AFT_CHIPCFG_P1_TDMV_INTR_BIT 14 - -# define AFT_CHIPCFG_P2_TDMV_INTR_BIT 15 -# define AFT_CHIPCFG_A104_TDM_ACK_BIT 15 - -# define AFT_CHIPCFG_A200_EC_SECURITY_BIT 15 /* Analog */ -# define AFT_CHIPCFG_A108_EC_SECURITY_BIT 15 /* A108 */ - -# define AFT_CHIPCFG_P3_TDMV_INTR_BIT 16 -# define AFT_CHIPCFG_A108_A104_TDM_FIFO_SYNC_BIT 16 /* A108 Global Fifo Sync Bit */ - -# define AFT_CHIPCFG_P4_TDMV_INTR_BIT 17 -# define AFT_CHIPCFG_A108_A104_TDM_DMA_RINGBUF_BIT 17 /* A108 Quad DMA Ring buf enable */ - -# define AFT_CHIPCFG_P1_WDT_INTR_BIT 18 -# define AFT_CHIPCFG_P2_WDT_INTR_BIT 19 -# define AFT_CHIPCFG_P3_WDT_INTR_BIT 20 -# define AFT_CHIPCFG_P4_WDT_INTR_BIT 21 - -# define AFT_CHIPCFG_A108_EC_INTER_STAT_BIT 21 /* A108 */ - -# define AFT_CHIPCFG_FE_INTR_STAT_BIT 22 -# define AFT_CHIPCFG_SECURITY_STAT_BIT 23 - - -/* A104 & A104D IRQ Status Bits */ - -# define AFT_CHIPCFG_HDLC_INTR_MASK 0x0F -# define AFT_CHIPCFG_HDLC_INTR_SHIFT 24 - -# define AFT_CHIPCFG_DMA_INTR_MASK 0x0F -# define AFT_CHIPCFG_DMA_INTR_SHIFT 28 - -# define AFT_CHIPCFG_A108_TDM_GLOBAL_RX_INTR_ACK 30 -# define AFT_CHIPCFG_A108_TDM_GLOBAL_TX_INTR_ACK 31 - -# define AFT_CHIPCFG_WDT_INTR_MASK 0x0F -# define AFT_CHIPCFG_WDT_INTR_SHIFT 18 - -# define AFT_CHIPCFG_TDMV_INTR_MASK 0x0F -# define AFT_CHIPCFG_TDMV_INTR_SHIFT 14 - -# define AFT_CHIPCFG_WDT_FE_INTR_STAT 0 -# define AFT_CHIPCFG_WDT_TX_INTR_STAT 1 -# define AFT_CHIPCFG_WDT_RX_INTR_STAT 2 - - - -/* A104 & A104D Interrupt Status Funcitons */ - -static __inline u32 -aft_chipcfg_get_hdlc_intr_stats(u32 reg) -{ - reg=reg>>AFT_CHIPCFG_HDLC_INTR_SHIFT; - reg&=AFT_CHIPCFG_HDLC_INTR_MASK; - return reg; -} - -static __inline u32 -aft_chipcfg_get_analog_intr_stats(u32 reg) -{ - reg=reg>>AFT_CHIPCFG_ANALOG_INTR_SHIFT; - reg&=AFT_CHIPCFG_ANALOG_INTR_MASK; - return reg; -} - -static __inline void -aft_chipcfg_set_oct_clk_src(u32 *reg, u32 src) -{ - *reg&=~(AFT_CHIPCFG_A108_EC_CLOCK_SRC_MASK<>AFT_CHIPCFG_DMA_INTR_SHIFT; - reg&=AFT_CHIPCFG_DMA_INTR_MASK; - return reg; -} - -static __inline u32 -aft_chipcfg_get_wdt_intr_stats(u32 reg) -{ - reg=reg>>AFT_CHIPCFG_WDT_INTR_SHIFT; - reg&=AFT_CHIPCFG_WDT_INTR_MASK; - return reg; -} - -static __inline u32 -aft_chipcfg_get_tdmv_intr_stats(u32 reg) -{ - reg=reg>>AFT_CHIPCFG_TDMV_INTR_SHIFT; - reg&=AFT_CHIPCFG_TDMV_INTR_MASK; - return reg; -} - - - - -/* A108 IRQ Status Bits on CHIP_STAT_REG */ - -# define AFT_CHIPCFG_A108_WDT_INTR_MASK 0xFF -# define AFT_CHIPCFG_A108_WDT_INTR_SHIFT 0 - -# define AFT_CHIPCFG_A108_TDMV_INTR_MASK 0xFF -# define AFT_CHIPCFG_A108_TDMV_INTR_SHIFT 8 - -# define AFT_CHIPCFG_A108_FIFO_INTR_MASK 0xFF -# define AFT_CHIPCFG_A108_FIFO_INTR_SHIFT 16 - -# define AFT_CHIPCFG_A108_DMA_INTR_MASK 0xFF -# define AFT_CHIPCFG_A108_DMA_INTR_SHIFT 24 - -/* A108 Interrupt Status Functions */ - -static __inline u32 -aft_chipcfg_a108_get_fifo_intr_stats(u32 reg) -{ - reg=reg>>AFT_CHIPCFG_A108_FIFO_INTR_SHIFT; - reg&=AFT_CHIPCFG_A108_FIFO_INTR_MASK; - return reg; -} - -static __inline u32 -aft_chipcfg_a108_get_dma_intr_stats(u32 reg) -{ - reg=reg>>AFT_CHIPCFG_A108_DMA_INTR_SHIFT; - reg&=AFT_CHIPCFG_A108_DMA_INTR_MASK; - return reg; -} - -static __inline u32 -aft_chipcfg_a108_get_wdt_intr_stats(u32 reg) -{ - reg=reg>>AFT_CHIPCFG_A108_WDT_INTR_SHIFT; - reg&=AFT_CHIPCFG_A108_WDT_INTR_MASK; - return reg; -} - -static __inline u32 -aft_chipcfg_a108_get_tdmv_intr_stats(u32 reg) -{ - reg=reg>>AFT_CHIPCFG_A108_TDMV_INTR_SHIFT; - reg&=AFT_CHIPCFG_A108_TDMV_INTR_MASK; - return reg; -} - -/* 56k IRQ status bits */ -# define AFT_CHIPCFG_A56K_WDT_INTR_BIT 0 -# define AFT_CHIPCFG_A56K_DMA_INTR_BIT 24 -# define AFT_CHIPCFG_A56K_FIFO_INTR_BIT 16 - -# define AFT_CHIPCFG_A56K_FE_MASK 0x7F -# define AFT_CHIPCFG_A56K_FE_SHIFT 9 - -static __inline u32 -aft_chipcfg_a56k_read_fe(u32 reg) -{ - reg=reg>>AFT_CHIPCFG_A56K_FE_SHIFT; - reg&=AFT_CHIPCFG_A56K_FE_MASK; - return reg; -} - -static __inline u32 -aft_chipcfg_a56k_write_fe(u32 reg, u32 val) -{ - val&=AFT_CHIPCFG_A56K_FE_MASK; - - reg &= ~(AFT_CHIPCFG_A56K_FE_MASK<>AFT_CHIPCFG_A104D_EC_SEC_KEY_SHIFT)&AFT_CHIPCFG_A104D_EC_SEC_KEY_MASK){ - - case 0x00: - return 0; - case 0x01: - return 32; - case 0x02: - return 64; - case 0x03: - return 96; - case 0x04: - return 128; - case 0x05: - return 256; - default: - return 0; - } - - return 0; -} - - -static __inline u32 -aft_chipcfg_get_a200_ec_channels(u32 reg) -{ - switch ((reg>>AFT_CHIPCFG_A200_EC_SEC_KEY_SHIFT)&AFT_CHIPCFG_A200_EC_SEC_KEY_MASK){ - - case 0x00: - return 0; - case 0x01: - return 16; - case 0x02: - return 32; - default: - return 0; - } - - return 0; -} - -# define AFT_WDTCTRL_MASK 0xFF -# define AFT_WDTCTRL_TIMEOUT 75 /* ms */ - -static __inline void -aft_wdt_ctrl_reset(u8 *reg) -{ - *reg=0xFF; -} -static __inline void -aft_wdt_ctrl_set(u8 *reg, u8 timeout) -{ - timeout&=AFT_WDTCTRL_MASK; - *reg=timeout; -} - - -#define AFT_FIFO_MARK_32_MASK 0x3F -#define AFT_FIFO_MARK_32_SHIFT 0 - -#define AFT_FIFO_MARK_64_MASK 0x3F -#define AFT_FIFO_MARK_64_SHIFT 6 - -#define AFT_FIFO_MARK_128_MASK 0x3F -#define AFT_FIFO_MARK_128_SHIFT 12 - -#define AFT_FIFO_MARK_256_MASK 0x3F -#define AFT_FIFO_MARK_256_SHIFT 18 - -#define AFT_FIFO_MARK_512_MASK 0x3F -#define AFT_FIFO_MARK_512_SHIFT 24 - -static __inline void -aft_fifo_mark_gset(u32 *reg, u8 mark) -{ - mark&=AFT_FIFO_MARK_32_MASK; - - *reg=0; - *reg=(mark<>AFT_LCFG_TDMV_CH_NUM_SHIFT)&AFT_LCFG_TDMV_CH_NUM_MASK; - if (cnt < 32){ - cnt++; - } - *reg&=~(AFT_LCFG_TDMV_CH_NUM_MASK<>AFT_LCFG_TDMV_CH_NUM_SHIFT)&AFT_LCFG_TDMV_CH_NUM_MASK; - if (cnt > 0){ - cnt--; - } - *reg&=~(AFT_LCFG_TDMV_CH_NUM_MASK<>AFT_DMACHAIN_TX_ADDR_CNT_SHIFT; - reg&=AFT_DMACHAIN_TX_ADDR_CNT_MASK; - return reg; -} -static __inline void -aft_dmachain_set_tx_dma_addr(u32 *reg, int addr) -{ - *reg&=~(AFT_DMACHAIN_TX_ADDR_CNT_MASK<>AFT_DMACHAIN_RX_ADDR_CNT_SHIFT; - reg&=AFT_DMACHAIN_RX_ADDR_CNT_MASK; - return reg; -} - - -static __inline void -aft_dmachain_set_rx_dma_addr(u32 *reg, int addr) -{ - *reg&=~(AFT_DMACHAIN_RX_ADDR_CNT_MASK<>AFT_TXDMA_LO_ALIGN_SHIFT; - reg&=AFT_TXDMA_LO_ALIGN_MASK; - return reg; -} - -static __inline void -aft_txdma_hi_set_dma_length(u32 *reg, int len, int align) -{ - *reg&=~(AFT_TXDMA_HI_DMA_LENGTH_MASK<>2)+align; - len&=AFT_TXDMA_HI_DMA_LENGTH_MASK; - *reg|=(len<>AFT_TXDMA_HI_DMA_LENGTH_SHIFT; - reg&=AFT_TXDMA_HI_DMA_LENGTH_MASK; - reg=reg<<2; - return reg; -} - -static __inline u32 -aft_txdma_hi_get_dma_status(u32 reg) -{ - reg=reg>>AFT_TXDMA_HI_DMA_STATUS_SHIFT; - reg&=AFT_TXDMA_HI_DMA_STATUS_MASK; - return reg; -} - -static __inline void -aft_rxdma_lo_set_alignment(u32 *reg, int align) -{ - *reg&=~(AFT_RXDMA_LO_ALIGN_MASK<>AFT_RXDMA_LO_ALIGN_SHIFT; - reg&=AFT_RXDMA_LO_ALIGN_MASK; - return reg; -} - -static __inline void -aft_rxdma_hi_set_dma_length(u32 *reg, int len, int align) -{ - *reg&=~(AFT_RXDMA_HI_DMA_LENGTH_MASK<>2)-align; - len&=AFT_RXDMA_HI_DMA_LENGTH_MASK; - *reg|=(len<>AFT_RXDMA_HI_DMA_LENGTH_SHIFT; - reg&=AFT_RXDMA_HI_DMA_LENGTH_MASK; - reg=reg<<2; - return reg; -} - -static __inline u32 -aft_rxdma_hi_get_dma_status(u32 reg) -{ - reg=reg>>AFT_RXDMA_HI_DMA_STATUS_SHIFT; - reg&=AFT_RXDMA_HI_DMA_STATUS_MASK; - return reg; -} - - -#define FIFO_32B 0x00 -#define FIFO_64B 0x01 -#define FIFO_128B 0x03 -#define FIFO_256B 0x07 -#define FIFO_512B 0x0F -#define FIFO_1024B 0x1F - - - -/*=============================================== - -*/ - -/* Default Active DMA channel used by the - * DMA Engine */ -#define AFT_DEFLT_ACTIVE_CH 0 - -#define MAX_AFT_TX_DMA_SIZE 0xFFFF - -#define MIN_WP_PRI_MTU 8 -#define DEFAULT_WP_PRI_MTU 1500 - -/* Maximum MTU for AFT card - * 8192-4=8188. This is a hardware - * limitation. - */ -#define MAX_WP_PRI_MTU 8188 - -#define MAX_DMA_PER_CH 20 -#define MIN_DMA_PER_CH 2 - -#define WP_MAX_FIFO_FRAMES 7 - -#define AFT_DEFAULT_DATA_MUX_MAP 0x01234567 -enum { - WAN_AFT_RED, - WAN_AFT_GREEN -}; - -enum { - WAN_AFT_OFF, - WAN_AFT_ON -}; - - -/*========================================== - * Board CPLD Interface Section - * - *=========================================*/ - - -#define PMC_CONTROL_REG 0x00 - -/* Used to reset the pcm - * front end - * 0: Reset Enable - * 1: Normal Operation - */ -#define PMC_RESET_BIT 0 - -/* Used to set the pmc clock - * source: - * 0 = E1 - * 1 = T1 - */ -#define PMC_CLOCK_SELECT 1 - -#define LED_CONTROL_REG 0x01 - -#define JP8_VALUE 0x02 -#define JP7_VALUE 0x01 -#define SW0_VALUE 0x04 -#define SW1_VALUE 0x08 - -#define CUSTOMER_CPLD_ID_REG 0x0A - -/* -------------------------------------- */ - -#define WRITE_DEF_SECTOR_DSBL 0x01 -#define FRONT_END_TYPE_MASK 0x38 - - -#define MEMORY_TYPE_SRAM 0x00 -#define MEMORY_TYPE_FLASH 0x01 -#define MASK_MEMORY_TYPE_SRAM 0x10 -#define MASK_MEMORY_TYPE_FLASH 0x20 - -#define BIT_A18_SECTOR_SA4_SA7 0x20 -#define USER_SECTOR_START_ADDR 0x40000 - -#define MAX_TRACE_QUEUE 100 - -#define HDLC_FREE_LOGIC_CH 0x1F -#define AFT_DEFLT_ACTIVE_CH 0 - -static __inline unsigned short aft_valid_mtu(unsigned short mtu) -{ - if (mtu <= 128){ - return 256; - }else if (mtu <= 256){ - return 512; - }else if (mtu <= 512){ - return 1024; - }else if (mtu <= 1024){ - return 2048; - }else if (mtu <= 2048){ - return 4096; - }else if (mtu <= 4096){ - return 8188; - }else if (mtu <= 8188){ - return 8188; - }else{ - return 0; - } -} - -static __inline unsigned short aft_dma_buf_bits(unsigned short dma_bufs) -{ - if (dma_bufs < 2){ - return 0; - }else if (dma_bufs < 3){ - return 1; - }else if (dma_bufs < 5){ - return 2; - }else if (dma_bufs < 9){ - return 3; - }else if (dma_bufs < 17){ - return 4; - }else{ - return 0; - } -} - - -static __inline void -aft_set_led(unsigned int color, int led_pos, int on, u32 *reg) -{ - if (color == WAN_AFT_RED){ - if (on == WAN_AFT_OFF){ - wan_clear_bit(AFT_LCFG_RED_LED_BIT,reg); - }else{ - wan_set_bit(AFT_LCFG_RED_LED_BIT,reg); - } - }else{ - if (on == WAN_AFT_OFF){ - wan_clear_bit(AFT_LCFG_GREEN_LED_BIT,reg); - }else{ - wan_set_bit(AFT_LCFG_GREEN_LED_BIT,reg); - } - } -} - -static __inline int -aft_get_num_of_slots(u32 total_slots, u32 chan_slots) -{ - int num_of_slots=0; - int i; - for (i=0;i= MAX_AFT_HW_DEV){ \ - DEBUG_EVENT("%s:%d: Critical Invalid AFT HW DEV Type %d\n", \ - __FUNCTION__,__LINE__,type); \ - return -EINVAL; \ - }\ - if (!wan_test_bit(0,&aft_hwdev[type].init)) { \ - DEBUG_EVENT("%s:%d: Critical AFT HW DEV Type %d not initialized\n", \ - __FUNCTION__,__LINE__,type); \ - return -EINVAL; \ - } - -#define ASSERT_AFT_HWDEV_VOID(type) \ - if (type >= MAX_AFT_HW_DEV){ \ - DEBUG_EVENT("%s:%d: Critical Invalid AFT HW DEV Type %d\n", \ - __FUNCTION__,__LINE__,type); \ - return; \ - }\ - if (!aft_hwdev[type] || !wan_test_bit(0,&aft_hwdev[type].init)) { \ - DEBUG_EVENT("%s:%d: Critical AFT HW DEV Type %d not initialized\n", \ - __FUNCTION__,__LINE__,type); \ - return; \ - } - - -#endif /* WAN_KERNEL */ - -/*================================================================ - * DRIVER SPECIFIC DEFINES - * - *================================================================*/ - - -#undef wan_udphdr_data -#define wan_udphdr_data wan_udphdr_u.aft.data - - -#define MAX_TRACE_BUFFER (MAX_LGTH_UDP_MGNT_PKT - \ - sizeof(iphdr_t) - \ - sizeof(udphdr_t) - \ - sizeof(wan_mgmt_t) - \ - sizeof(wan_trace_info_t) - \ - sizeof(wan_cmd_t)) - -enum { - TX_DMA_BUF_INIT =0, - TX_DMA_BUF_USED -}; - -enum { - ROUTER_UP_TIME = 0x50, - ENABLE_TRACING, - DISABLE_TRACING, - GET_TRACE_INFO, - READ_CODE_VERSION, - FLUSH_OPERATIONAL_STATS, - OPERATIONAL_STATS, - READ_OPERATIONAL_STATS, - READ_CONFIGURATION, - READ_COMMS_ERROR_STATS, - FLUSH_COMMS_ERROR_STATS, - AFT_LINK_STATUS, - AFT_MODEM_STATUS, - AFT_HWEC_STATUS, - DIGITAL_LOOPTEST -}; - -#define UDPMGMT_SIGNATURE "AFTPIPEA" - - -/* the line trace status element presented by the frame relay code */ -typedef struct { - unsigned char flag ; /* ready flag */ - unsigned short length ; /* trace length */ - unsigned char rsrv0[2] ; /* reserved */ - unsigned char attr ; /* trace attributes */ - unsigned short tmstamp ; /* time stamp */ - unsigned char rsrv1[4] ; /* reserved */ - unsigned int offset ; /* buffer absolute address */ -}aft_trc_el_t; - -typedef struct wp_rx_element -{ - unsigned int dma_addr; - unsigned int reg; - unsigned int align; - unsigned char pkt_error; -}wp_rx_element_t; - - -typedef struct aft_config -{ - unsigned int aft_chip_cfg_reg; - unsigned int aft_dma_control_reg; -}aft_config_t; - - - -#if defined(__LINUX__) -enum { - SIOC_AFT_CUSTOMER_ID = SIOC_WANPIPE_DEVPRIVATE, - SIOC_AFT_SS7_FORCE_RX, - SIOC_WANPIPE_API -}; -#endif - -#pragma pack(1) - -/* the operational statistics structure */ -typedef struct { - - /* Data frame transmission statistics */ - unsigned long Data_frames_Tx_count ; - /* # of frames transmitted */ - unsigned long Data_bytes_Tx_count ; - /* # of bytes transmitted */ - unsigned long Data_Tx_throughput ; - /* transmit throughput */ - unsigned long no_ms_for_Data_Tx_thruput_comp ; - /* millisecond time used for the Tx throughput computation */ - unsigned long Tx_Data_discard_lgth_err_count ; - - /* Data frame reception statistics */ - unsigned long Data_frames_Rx_count ; - /* number of frames received */ - unsigned long Data_bytes_Rx_count ; - /* number of bytes received */ - unsigned long Data_Rx_throughput ; - /* receive throughput */ - unsigned long no_ms_for_Data_Rx_thruput_comp ; - /* millisecond time used for the Rx throughput computation */ - unsigned long Rx_Data_discard_short_count ; - /* received Data frames discarded (too short) */ - unsigned long Rx_Data_discard_long_count ; - /* received Data frames discarded (too long) */ - unsigned long Rx_Data_discard_inactive_count ; - /* received Data frames discarded (link inactive) */ - - /* Incomming frames with a format error statistics */ - unsigned short Rx_frm_incomp_CHDLC_hdr_count ; - /* frames received of with incomplete Cisco HDLC header */ - unsigned short Rx_frms_too_long_count ; - /* frames received of excessive length count */ - - /* CHDLC link active/inactive and loopback statistics */ - unsigned short link_active_count ; - /* number of times that the link went active */ - unsigned short link_inactive_modem_count ; - /* number of times that the link went inactive (modem failure) */ - unsigned short link_inactive_keepalive_count ; - /* number of times that the link went inactive (keepalive failure) */ - unsigned short link_looped_count ; - /* link looped count */ - - unsigned long Data_frames_Tx_realign_count; - -} aft_op_stats_t; - -typedef struct { - unsigned short Rx_overrun_err_count; - unsigned short Rx_crc_err_count ; /* receiver CRC error count */ - unsigned short Rx_abort_count ; /* abort frames recvd count */ - unsigned short Rx_hdlc_corrupiton; /* receiver disabled */ - unsigned short Rx_pci_errors; /* missed tx underrun interrupt count */ - unsigned short Rx_dma_descr_err; /*secondary-abort frames tx count */ - unsigned short DCD_state_change_count ; /* DCD state change */ - unsigned short CTS_state_change_count ; /* CTS state change */ - - unsigned short Tx_pci_errors; /* missed tx underrun interrupt count */ - unsigned short Tx_dma_errors; /* missed tx underrun interrupt count */ - - unsigned int Tx_pci_latency; /* missed tx underrun interrupt count */ - unsigned int Tx_dma_len_nonzero; /* Tx dma descriptor len not zero */ - -} aft_comm_err_stats_t; - -enum wanpipe_aft_api_events { - WP_API_EVENT_NONE, - WP_API_EVENT_DTMF, - WP_API_EVENT_RM_DTMF, - WP_API_EVENT_RXHOOK, - WP_API_EVENT_RING, - WP_API_EVENT_TONE, - WP_API_EVENT_RING_DETECT, - WP_API_EVENT_TXSIG_KEWL, - WP_API_EVENT_TXSIG_START, - WP_API_EVENT_TXSIG_OFFHOOK, - WP_API_EVENT_TXSIG_ONHOOK, - WP_API_EVENT_ONHOOKTRANSFER, - WP_API_EVENT_SETPOLARITY - -}; - -#define WP_API_EVENT_ENABLE 0x01 -#define WP_API_EVENT_DISABLE 0x02 -#define WP_API_EVENT_MODE_DECODE(mode) \ - ((mode) == WP_API_EVENT_ENABLE) ? "Enable" : \ - ((mode) == WP_API_EVENT_DISABLE) ? "Disable" : \ - "(Unknown mode)" - -#define WP_API_EVENT_RXHOOK_OFF 0x01 -#define WP_API_EVENT_RXHOOK_ON 0x02 - -#define WP_API_EVENT_RING_PRESENT 0x01 -#define WP_API_EVENT_RING_STOP 0x02 - -/* tone type */ -#define WP_API_EVENT_TONE_DIAL 0x01 -#define WP_API_EVENT_TONE_BUSY 0x02 -#define WP_API_EVENT_TONE_RING 0x03 -#define WP_API_EVENT_TONE_CONGESTION 0x04 - -typedef struct { - unsigned char error_flag; - unsigned short time_stamp; - unsigned char event_type; - union { - struct { - u_int16_t channel; - union { - struct { - unsigned char rbs_bits; - } rbs; - struct { - unsigned char state; - } rxhook; - struct { - unsigned char state; - } ring; - struct { - unsigned char digit; /* DTMF: digit */ - unsigned char port; /* DTMF: SOUT/ROUT */ - unsigned char type; /* DTMF: PRESET/STOP */ - } dtmf; - } u_event; - } wp_api_event; - unsigned char reserved[12]; - }hdr_u; -#define wp_api_rx_hdr_event_channel hdr_u.wp_api_event.channel -#define wp_api_rx_hdr_event_rxhook_state hdr_u.wp_api_event.u_event.rxhook.state -#define wp_api_rx_hdr_event_ring_state hdr_u.wp_api_event.u_event.ring.state -#define wp_api_rx_hdr_event_dtmf_digit hdr_u.wp_api_event.u_event.dtmf.digit -#define wp_api_rx_hdr_event_dtmf_type hdr_u.wp_api_event.u_event.dtmf.type -#define wp_api_rx_hdr_event_dtmf_port hdr_u.wp_api_event.u_event.dtmf.port -#define wp_api_rx_hdr_event_ringdetect_state hdr_u.wp_api_event.u_event.ring.state -} api_rx_hdr_t; - -typedef struct { - api_rx_hdr_t api_rx_hdr; - unsigned char data[1]; -} api_rx_element_t; - -typedef struct { - unsigned char type; - unsigned char force_tx; - unsigned char data[8]; -} api_tx_ss7_hdr_t; - -typedef struct { - u_int8_t type; - u_int8_t mode; - u_int8_t tone; - u_int16_t channel; - u_int16_t polarity; - u_int16_t ohttimer; - -} api_tdm_event_hdr_t; - -typedef struct { - union { - api_tx_ss7_hdr_t ss7; - api_tdm_event_hdr_t event; - unsigned char reserved[16]; - }u; -#define wp_api_tx_hdr_event_type u.event.type -#define wp_api_tx_hdr_event_mode u.event.mode -#define wp_api_tx_hdr_event_tone u.event.tone -#define wp_api_tx_hdr_event_channel u.event.channel -#define wp_api_tx_hdr_event_ohttimer u.event.ohttimer -#define wp_api_tx_hdr_event_polarity u.event.polarity -} api_tx_hdr_t; - -typedef struct { - api_tx_hdr_t api_tx_hdr; - unsigned char data[1]; -} api_tx_element_t; - - - - -#pragma pack() - -/* Possible RX packet errors */ -enum { - WP_FIFO_ERROR_BIT, - WP_CRC_ERROR_BIT, - WP_ABORT_ERROR_BIT, -}; - - -#ifdef WAN_KERNEL - -#define AFT_MIN_FRMW_VER 0x11 -#define AFT_TDMV_FRM_VER 0x11 -#define AFT_TDMV_FRM_CLK_SYNC_VER 0x14 -#define AFT_TDMV_SHARK_FRM_CLK_SYNC_VER 0x17 -#define AFT_TDMV_SHARK_A108_FRM_CLK_SYNC_VER 0x25 -#define AFT_56K_MIN_FRMW_VER 0x00 - -#define AFT_MIN_ANALOG_FRMW_VER 0x05 - -typedef struct aft_dma_chain -{ - unsigned long init; - sdla_dma_addr_t dma_addr; - u32 dma_len; - u32 dma_map_len; - netskb_t *skb; - u32 index; - - u32 dma_descr; - u32 len_align; - u32 reg; - - u8 pkt_error; - void* dma_virt; - u32 dma_offset; - u32 dma_toggle; -}aft_dma_chain_t; - -typedef struct dma_history{ - u8 end; - u8 cur; - u8 begin; - u8 status; - u8 loc; -}dma_history_t; - -#define MAX_DMA_HIST_SIZE 10 -#define MAX_AFT_DMA_CHAINS 16 -#define MAX_TX_BUF MAX_AFT_DMA_CHAINS*2+1 -#define MAX_RX_BUF MAX_AFT_DMA_CHAINS*4+1 -#define AFT_DMA_INDEX_OFFSET 0x200 - - -typedef struct aft_dma_ring -{ - unsigned char rxdata[128]; - unsigned char txdata[128]; -}aft_dma_ring_t; - -#define AFT_DMA_RING_MAX 4 - -typedef struct aft_dma_swring { - int tx_toggle; - int rx_toggle; - aft_dma_ring_t rbuf[AFT_DMA_RING_MAX]; -}aft_dma_swring_t; - - -typedef struct private_area -{ - wanpipe_common_t common; - sdla_t *card; - - wan_xilinx_conf_if_t cfg; - - wan_skb_queue_t wp_tx_pending_list; - wan_skb_queue_t wp_tx_complete_list; - netskb_t *tx_dma_skb; - u8 tx_dma_cnt; - - wan_skb_queue_t wp_rx_free_list; - wan_skb_queue_t wp_rx_complete_list; - - wan_skb_queue_t wp_rx_stack_complete_list; - wan_skb_queue_t wp_rx_zap_complete_list; - - unsigned long time_slot_map; - unsigned char num_of_time_slots; - long logic_ch_num; - - unsigned char hdlc_eng; - unsigned long dma_status; - unsigned char protocol; - - struct net_device_stats if_stats; - - int tracing_enabled; /* For enabling Tracing */ - unsigned long router_start_time; - unsigned long trace_timeout; - - unsigned long tick_counter; /* For 5s timeout counter */ - unsigned long router_up_time; - - unsigned char mc; /* Mulitcast support on/off */ - - unsigned char interface_down; - - /* Polling task queue. Each interface - * has its own task queue, which is used - * to defer events from the interrupt */ - wan_taskq_t poll_task; - wan_timer_info_t poll_delay_timer; - - u8 gateway; - u8 true_if_encoding; - -#if defined(__LINUX__) - /* Entry in proc fs per each interface */ - struct proc_dir_entry *dent; -#endif - unsigned char udp_pkt_data[sizeof(wan_udp_pkt_t)+10]; - atomic_t udp_pkt_len; - - char if_name[WAN_IFNAME_SZ+1]; - - u8 idle_flag; - u16 max_idle_size; - u8 idle_start; - - u8 pkt_error; - u8 rx_fifo_err_cnt; - - int first_time_slot; - int last_time_slot; - - netskb_t *tx_idle_skb; - unsigned char rx_dma; - unsigned char pci_retry; - - unsigned char fifo_size_code; - unsigned char fifo_base_addr; - unsigned char fifo_size; - - int dma_mru; - int mru,mtu; - - void * prot_ch; - int prot_state; - - wan_trace_t trace_info; - - /* TE1 Specific Dma Chains */ - unsigned char tx_chain_indx,tx_pending_chain_indx; - aft_dma_chain_t tx_dma_chain_table[MAX_AFT_DMA_CHAINS]; - - unsigned char rx_chain_indx,rx_pending_chain_indx; - aft_dma_chain_t rx_dma_chain_table[MAX_AFT_DMA_CHAINS]; - int rx_no_data_cnt; - - unsigned long dma_chain_status; - unsigned long up; - int tx_attempts; - - aft_op_stats_t opstats; - aft_comm_err_stats_t errstats; - - unsigned char *tx_realign_buf; - unsigned char single_dma_chain; - unsigned char tslot_sync; - - dma_history_t dma_history[MAX_DMA_HIST_SIZE]; - unsigned int dma_index; - - /* Used by ss7 mangle code */ - api_tx_hdr_t tx_api_hdr; - unsigned char *tx_ss7_realign_buf; - - int tdmv_chan; - unsigned int tdmv_irq_cfg; - - unsigned char channelized_cfg; - unsigned char tdmv_zaptel_cfg; - - unsigned int tdmv_rx_delay; - unsigned char tdmv_rx_delay_cfg; - unsigned short max_tx_bufs; - unsigned short max_tx_bufs_orig; - - unsigned int ss7_force_rx; - - unsigned char lip_atm; - -#if defined(__LINUX__) - wanpipe_tdm_api_dev_t wp_tdm_api_dev; -#endif - int rx_api_crc_bytes; - - netskb_t *rx_rtp_skb; - netskb_t *tx_rtp_skb; - u32 tdm_call_status; - struct private_area *next; - - aft_dma_swring_t swring; - -}private_area_t; - - -enum { - AFT_CHIP_CONFIGURED, - AFT_FRONT_END_UP, - AFT_TDM_GLOBAL_ISR, - AFT_TDM_RING_BUF, - AFT_TDM_FAST_ISR, - AFT_TDM_SW_RING_BUF -}; - -void aft_free_logical_channel_num (sdla_t *card, int logic_ch); -void aft_dma_max_logic_ch(sdla_t *card); -void aft_fe_intr_ctrl(sdla_t *card, int status); -void __aft_fe_intr_ctrl(sdla_t *card, int status); -void aft_wdt_set(sdla_t *card, unsigned char val); -void aft_wdt_reset(sdla_t *card); - - -#endif - - -#endif diff --git a/patches/kdrivers/include/sdla_aft_te3.h b/patches/kdrivers/include/sdla_aft_te3.h index f1b28ce..fe418d0 100644 --- a/patches/kdrivers/include/sdla_aft_te3.h +++ b/patches/kdrivers/include/sdla_aft_te3.h @@ -864,8 +864,6 @@ set_te3_tx_fract_baud_rate(unsigned int *reg, *reg&=TE3_TX_FRACT_BAUD_RATE_MASK; *reg|=(counter<hw.type != SDLA_S514){ + card->mbox = (void *) card->hw.dpmbase; + }else{ + /* for a S514 adapter, set a pointer to the actual mailbox in the */ + /* allocated virtual memory area */ + card->mbox = (void *) card->hw.dpmbase + PRI_BASE_ADDR_MB_STRUCT; + } +} + +static __inline wan_mbox_t *get_card_mailbox(sdla_t *card) +{ + return (wan_mbox_t*)card->mbox; +} + +static __inline void *get_card_flags(sdla_t *card) +{ + return card->flags; +} + +static __inline void set_card_flags(sdla_t *card, void *ptr) +{ + card->flags = ptr; +} +static __inline void *get_card_rxmb(sdla_t *card) +{ + return card->u.atm.rxmb; +} + +static __inline void set_card_rxmb(sdla_t *card, void *ptr) +{ + card->u.atm.rxmb = ptr; + if((void*)ptr > card->u.atm.rxbuf_last){ + card->u.atm.rxmb = card->u.atm.rxbuf_base; + } +} + +static __inline void *get_card_txbuf(sdla_t *card) +{ + return card->u.atm.txbuf; +} + +static __inline void set_card_txbuf(sdla_t *card, void *ptr) +{ + card->u.atm.txbuf = ptr; + if ((void*)ptr > card->u.atm.txbuf_last){ + card->u.atm.txbuf = card->u.atm.txbuf_base; + } +} + +#endif +#endif diff --git a/patches/kdrivers/include/sdla_bri.h b/patches/kdrivers/include/sdla_bri.h new file mode 100755 index 0000000..1487fd5 --- /dev/null +++ b/patches/kdrivers/include/sdla_bri.h @@ -0,0 +1,366 @@ +/*************************************************************************** + * sdla_bri.h Sangoma ISDN-BRI definitions (for Cologne XHFC-2SU chip). + * + * Author(s): David Rokhvarg + * + * Copyright: (c) 1984 - 2007 Sangoma Technologies 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. + * + * ============================================================================ + * February 14, 2007 David Rokhvarg + * v1.0 Initial version. + * + * February 26, 2008 David Rokhvarg + * v1.1 Imrovements in SU State transition code. + * Implemented T3 and T4 timers. + * + ****************************************************************************** + */ + +#ifndef __SDLA_BRI_H +# define __SDLA_BRI_H + +#if defined(__LINUX__) +# include +#else +# include +#endif + +/******************************************************************************* +** DEFINES and MACROS +*******************************************************************************/ + +#define IS_BRI_CARD(card) IS_BRI_FEMEDIA(&(card)->fe) + +#define WAN_BRI_START_CHANNEL 1 + +#define MAX_BRI_REMORAS 4 +#define MAX_BRI_MODULES_PER_REMORA 3 + +/* + Maximum of 4 remoras, 3 modules on each - maximum 12 modules. + On each module there is 1 dual-port ISDN BRI chip. + On each line there are 2 B-channels and 1 D-channel. +*/ +#define MAX_BRI_MODULES 12 +#define MAX_BRI_CHANNELS 2 /* Number of channels per device */ +#define MAX_BRI_LINES (MAX_BRI_MODULES*MAX_BRI_CHANNELS) + +/* + The maximum number of BRI timeslots is 32. + This is needed for the d-chan, which is always at the otherwise unused timeslot 31. + But AFT hardware is actually using only 24 timeslots - only for the b-chans. +*/ +#define MAX_TIMESLOTS 32 +#define BRI_DCHAN_LOGIC_CHAN 31 + +#define BRI_DCHAN_ACTIVE_CFG_CHAN 2 + +#define MAX_BRI_TIMESLOTS 3 /* this is the number of b-chans (2) and the d-chan on one BRI line */ + +#define MAX_TENT_CHANNELS MAX_BRI_MODULES + +#define MOD_TYPE_NONE 0 /* corresponds to module which is not installed */ +#define MOD_TYPE_NT 1 +#define MOD_TYPE_TE 2 +#define MOD_TYPE_TEST 3 + +#define WP_BRI_DECODE_MOD_TYPE(type) \ + (type == MOD_TYPE_NT) ? "NT" : \ + (type == MOD_TYPE_TE) ? "TE" : "Unknown" + +/* SPI interface */ +#define MOD_CHAIN_DISABLED 0 +#define MOD_CHAIN_ENABLED 1 + +#define SPI_INTERFACE_REG 0x54 +#define SPI_MAX_RETRY_COUNT 10 + +#define MOD_SPI_RESET 0x40000000 +#define MOD_SPI_BUSY 0x80000000 +#define MOD_SPI_V3_STAT 0x08000000 /* bit 27 used as START in version 1-2-3 */ +#define MOD_SPI_START 0x08000000 + +#define BRI_FE_MAGIC 0x150D + +#define WAN_BRI_OPERMODE_LEN 20 + +#if !defined(__WINDOWS__) +/* Front-End UDP command */ +#define WAN_FE_TONES (WAN_FE_UDP_CMD_START + 0) +#define WAN_FE_RING (WAN_FE_UDP_CMD_START + 1) +#define WAN_FE_REGDUMP (WAN_FE_UDP_CMD_START + 2) +#define WAN_FE_STATS (WAN_FE_UDP_CMD_START + 3) + +#define WAN_BRI_SET_ECHOTUNE _IOW (ZT_CODE, 63, struct wan_bri_echo_coefs) +#endif + +/****************************************************************************** +** XHFC definitions +*******************************************************************************/ + +/* max. number of S/U ports per XHFC-2SU controller */ +#define BRI_MAX_PORTS_PER_CHIP 2 +#define PORT_0 0 +#define PORT_1 1 + +/* flags in _u16 port mode */ +#define PORT_UNUSED 0x0000 +#define PORT_MODE_NT 0x0001 +#define PORT_MODE_TE 0x0002 +#define PORT_MODE_S0 0x0004 +#define PORT_MODE_UP 0x0008 +#define PORT_MODE_EXCH_POL 0x0010 +#define PORT_MODE_LOOP 0x0020 +#define NT_TIMER 0x8000 + +/* NT / TE defines */ +#define NT_T1_COUNT 25 /* number of 4ms interrupts for G2 timeout */ +#define CLK_DLY_TE 0x0e /* CLKDEL in TE mode */ +#define CLK_DLY_NT 0x6c /* CLKDEL in NT mode */ +#define STA_ACTIVATE 0x60 /* start activation in A_SU_WR_STA */ +#define STA_DEACTIVATE 0x40 /* start deactivation in A_SU_WR_STA */ +#define LIF_MODE_NT 0x04 /* Line Interface NT mode */ + +#define XHFC_TIMER_T3 8000 /* 8s activation timer T3 */ +#define XHFC_TIMER_T4 500 /* 500ms deactivation timer T4 */ + +/* xhfc Layer1 physical commands */ +#define HFC_L1_ACTIVATE_TE 0x01 +#define HFC_L1_FORCE_DEACTIVATE_TE 0x02 +#define HFC_L1_ACTIVATE_NT 0x03 +#define HFC_L1_DEACTIVATE_NT 0x04 +#define HFC_L1_TESTLOOP_B1 0x05 +#define HFC_L1_TESTLOOP_B2 0x06 + +/* xhfc Layer1 Flags (stored in bri_xhfc_port_t->l1_flags) */ +#define HFC_L1_ACTIVATING 1 +#define HFC_L1_ACTIVATED 2 +#define HFC_L1_DEACTTIMER 4 +#define HFC_L1_ACTTIMER 8 + +/* Layer1 timer Flags (stored in bri_xhfc_port_t->timer_flags) */ +#define T3_TIMER_ACTIVE 1 +#define T4_TIMER_ACTIVE 2 + +#define FIFO_MASK_TX 0x55555555 +#define FIFO_MASK_RX 0xAAAAAAAA + + +#ifndef MAX_DFRAME_LEN_L1 +#define MAX_DFRAME_LEN_L1 300 +#endif + +#define USE_F0_COUNTER 1 /* akkumulate F0 counter diff every irq */ +#define TRANSP_PACKET_SIZE 0 /* minium tranparent packet size for transmittion to upper layer */ + +typedef struct sdla_bri_cfg_ { + int not_used; + int opermode; + char opermode_name[WAN_BRI_OPERMODE_LEN]; +/* int tdmv_law;*/ /* WAN_TDMV_ALAW or WAN_TDMV_MULAW */ + char clock_mode; +} sdla_bri_cfg_t; + +#if defined(WAN_KERNEL) + +#if !defined(WAN_DEBUG_FE) + +/* no debugging info compiled */ +/* NT/TE */ +# define WRITE_BRI_REG(mod_no,reg,val) \ + fe->write_fe_reg( fe->card, \ + (int)mod_no, \ + fe->bri_param.mod[mod_no].type, \ + fe->bri_param.mod[mod_no].chain, \ + (int)reg, (int)val) + +# define READ_BRI_REG(mod_no,reg) \ + fe->read_fe_reg( fe->card, \ + (int)mod_no, \ + fe->bri_param.mod[mod_no].type, \ + fe->bri_param.mod[mod_no].chain, \ + (int)reg) + +#else + +#warning "WAN_DEBUG_FE - Debugging Defined" +/* NT/TE */ +# define WRITE_BRI_REG(mod_no,reg,val) \ + fe->write_fe_reg( fe->card, \ + (int)mod_no, \ + fe->bri_param.mod[mod_no].type, \ + fe->bri_param.mod[mod_no].chain, \ + (int)reg, (int)val,__FILE__,(int)__LINE__) + +# define READ_BRI_REG(mod_no,reg) \ + fe->read_fe_reg( fe->card, \ + (int)mod_no, \ + fe->bri_param.mod[mod_no].type, \ + fe->bri_param.mod[mod_no].chain, \ + (int)reg,__FILE__,(int)__LINE__) + +#endif/* #if !defined(WAN_DEBUG_FE) */ + +#define __READ_BRI_REG(mod_no,reg) \ + fe->__read_fe_reg( fe->card, \ + (int)mod_no, \ + fe->bri_param.mod[mod_no].type, \ + fe->bri_param.mod[mod_no].chain, \ + (int)reg) + + +/***************************************************************/ +/* port struct for each S/U port */ +typedef struct { + u_int8_t idx; /* port idx in hw->port[idx] */ + void *hw; /* back pointer to 'wp_bri_module_t' */ + u_int16_t mode; /* NT/TE / ST/U */ + u_int32_t l1_flags; + u_int32_t timer_flags; + + int drx_indx; + int dtx_indx, bytes2transmit; + u_int8_t drxbuf[MAX_DFRAME_LEN_L1]; + u_int8_t dtxbuf[MAX_DFRAME_LEN_L1]; + + /* layer1 ISDN timer */ + wan_timer_t t3_timer; + wan_timer_t t4_timer; + + /* chip registers */ + reg_a_su_rd_sta su_state; + reg_a_su_ctrl0 su_ctrl0; + reg_a_su_ctrl1 su_ctrl1; + reg_a_su_ctrl2 su_ctrl2; + reg_a_st_ctrl3 st_ctrl3; + + /* DavidR */ + reg_a_sl_cfg sl_cfg;/* for data direction programming on pins STIO1 and STIO2 */ + + u_int32_t clock_routing_state, clock_routing_counter; + + u_int32_t l1_state;/* BRI L1 current state of the line */ + int nt_timer; +} bri_xhfc_port_t; + + +/******************************************************************************* +** TYPEDEF STRUCTURE +*******************************************************************************/ +typedef struct { + unsigned int mod_no; + /* Both ports of a module will always be in the + SAME mode - TE or NT. */ + int type; + int chain; + unsigned long events; + +#if 0 +#if defined(__WINDOWS__) + wan_event_ctrl_t current_control_event; + wan_event_ctrl_t *current_control_event_ptr; +#else + WAN_LIST_HEAD(, wan_event_ctrl_) event_head; +#endif +#endif + /* TDM Voice applications */ + int sig; + + /**********************************/ + int num_ports; /* number of S and U interfaces */ + int max_fifo; /* always 4 fifos per port */ + u_int8_t max_z; /* fifo depth -1 */ + + bri_xhfc_port_t port[BRI_MAX_PORTS_PER_CHIP]; /* 2 ports - one for each Line intercace */ + + u_int32_t irq_cnt; /* count irqs */ + u_int32_t f0_cnt; /* last F0 counter value */ + u_int32_t f0_akku; /* akkumulated f0 counter deltas */ + + /* chip registers */ + reg_r_pcm_md0 pcm_md0; + reg_r_pcm_md1 pcm_md1; + /**********************************/ + + void *fe; /* pointer back to 'sdla_fe_t' */ + +} wp_bri_module_t; + +typedef struct { +/* u_int16_t type; */ + unsigned int mod_no; /* A500 - ISDN BRI Remora */ + unsigned char ec_dtmf_port; /* EC DTMF: SOUT or ROUT */ + unsigned long ts_map; + u_int8_t tone; +} sdla_bri_event_t; + +typedef struct sdla_bri_param { + int not_used; + + /* each module has 2 lines, */ + wp_bri_module_t mod[MAX_BRI_LINES]; + /* + Maximum of 4 remoras, 3 modules on each - maximum 12 modules. + On each module there is 1 dual-port ISDN BRI chip. + On each line there are 2 B-channels and 1 D-channel. + + It means we have 48 timeslots (B-channels only!), and 32 bits are not enough. + First 0-23 timeslots will be mapped on 'module_map[0]' and 24-47 will be mapped + on 'module_map[1]'. + */ + u_int32_t module_map[2]; /* Map of available module */ + u_int16_t max_fe_channels; /* Number of available modules */ + + u_int8_t critical; + + /* + Flag indicating if this logical 'card' (sdla_t) which represents a BRI line, + is the 'clock reference port' for the physical A500 card. + Only ONE 'card' may have this flag set to WANOPT_YES, all others must be + WANOPT_NO. + TE mode: if 'is_clock_master' is set to WANOPT_YES, clock recovered from + the line will be routed to ALL other BRI modules on the card. + */ + u_int8_t is_clock_master; + +} sdla_bri_param_t; + + +/******************************************************************************* + DEFINES AND MACROS + *******************************************************************************/ + +/* AFT register - Intel x86 definition. */ +typedef struct bri_reg{ + u_int32_t data:8; /* lsb */ + u_int32_t contrl:8; + + u_int32_t reserv1:8; + u_int32_t mod_addr:2; /* 00, 01, 10 - adresses modules, + code 11 - address of status register per-remora. + */ + + u_int32_t remora_addr:4; /* Select Remora. Maximum is 4 (from 0 to 3) for BRI */ + + u_int32_t reset:1; + u_int32_t start:1;/* msb */ +}bri_reg_t; + +#define READ_BIT (1 << 7) +#define ADDR_BIT (1 << 6) + +/******************************************************************************* +** FUNCTION PROTOTYPES +*******************************************************************************/ +extern int wp_bri_iface_init(void*); + +#endif/* WAN_KERNEL */ + +/***************************************************************/ + +#endif /* __SDLA_BRI_H */ diff --git a/patches/kdrivers/include/sdla_bscmp.h b/patches/kdrivers/include/sdla_bscmp.h index 45d81d1..c87a5ec 100644 --- a/patches/kdrivers/include/sdla_bscmp.h +++ b/patches/kdrivers/include/sdla_bscmp.h @@ -2,9 +2,9 @@ #ifndef _BSC_HEADER_ #define _BSC_HEADER_ - #pragma pack(1) + /*========== MAILBOX COMMANDS AND RETURN CODES ==========*/ #define BSC_READ 0x00 #define BSC_WRITE 0x01 @@ -52,91 +52,91 @@ */ /* control block */ typedef struct { - unsigned char opp_flag ; - unsigned char command ; - unsigned short buffer_length ; - unsigned char return_code ; - unsigned char misc_tx_rx_bits ; - unsigned short heading_length ; - unsigned short notify ; - unsigned char station ; - unsigned char poll_address ; - unsigned char select_address ; - unsigned char device_address ; - unsigned char notify_extended ; - unsigned char reserved ; - unsigned char data[MDATALEN] ; + unsigned char opp_flag ; + unsigned char command ; + unsigned short buffer_length ; + unsigned char return_code ; + unsigned char misc_tx_rx_bits ; + unsigned short heading_length ; + unsigned short notify ; + unsigned char station ; + unsigned char poll_address ; + unsigned char select_address ; + unsigned char device_address ; + unsigned char notify_extended ; + unsigned char reserved ; + unsigned char data[MDATALEN] ; } BSC_MAILBOX_STRUCT; typedef struct { - unsigned char line_speed_number ; - unsigned short max_data_frame_size ; - unsigned char secondary_station ; - unsigned char num_consec_PAD_eof ; - unsigned char num_add_lead_SYN ; - unsigned char conversational_mode ; - unsigned char pp_dial_up_operation ; - unsigned char switched_CTS_RTS ; - unsigned char EBCDIC_encoding ; - unsigned char auto_open ; - unsigned char misc_bits ; - unsigned char protocol_options1 ; - unsigned char protocol_options2 ; - unsigned short reserved_pp ; - unsigned char max_retransmissions ; - unsigned short fast_poll_retries ; - unsigned short TTD_retries ; - unsigned short restart_timer ; - unsigned short pp_slow_restart_timer ; - unsigned short TTD_timer ; - unsigned short pp_delay_between_EOT_ENQ ; - unsigned short response_timer ; - unsigned short rx_data_timer ; - unsigned short NAK_retrans_delay_timer ; - unsigned short wait_CTS_timer ; - unsigned char mp_max_consec_ETX ; - unsigned char mp_general_poll_address ; - unsigned short sec_poll_timeout ; - unsigned char pri_poll_skips_inactive ; - unsigned char sec_additional_stn_send_gpoll ; - unsigned char pri_select_retries ; - unsigned char mp_multipoint_options ; - unsigned short reserved ; + unsigned char line_speed_number ; + unsigned short max_data_frame_size ; + unsigned char secondary_station ; + unsigned char num_consec_PAD_eof ; + unsigned char num_add_lead_SYN ; + unsigned char conversational_mode ; + unsigned char pp_dial_up_operation ; + unsigned char switched_CTS_RTS ; + unsigned char EBCDIC_encoding ; + unsigned char auto_open ; + unsigned char misc_bits ; + unsigned char protocol_options1 ; + unsigned char protocol_options2 ; + unsigned short reserved_pp ; + unsigned char max_retransmissions ; + unsigned short fast_poll_retries ; + unsigned short TTD_retries ; + unsigned short restart_timer ; + unsigned short pp_slow_restart_timer ; + unsigned short TTD_timer ; + unsigned short pp_delay_between_EOT_ENQ ; + unsigned short response_timer ; + unsigned short rx_data_timer ; + unsigned short NAK_retrans_delay_timer ; + unsigned short wait_CTS_timer ; + unsigned char mp_max_consec_ETX ; + unsigned char mp_general_poll_address ; + unsigned short sec_poll_timeout ; + unsigned char pri_poll_skips_inactive ; + unsigned char sec_additional_stn_send_gpoll ; + unsigned char pri_select_retries ; + unsigned char mp_multipoint_options ; + unsigned short reserved ; } BSC_CONFIG_STRUCT; typedef struct { - unsigned char max_tx_queue ; - unsigned char max_rx_queue ; - unsigned char station_flags ; + unsigned char max_tx_queue ; + unsigned char max_rx_queue ; + unsigned char station_flags ; }ADD_STATION_STRUCT; typedef struct { - unsigned char station ; - unsigned short time_stamp ; - unsigned char reserved[13] ; + unsigned char station ; + unsigned short time_stamp ; + unsigned char reserved[13] ; } api_rx_hdr_t; typedef struct { - api_rx_hdr_t api_rx_hdr ; - void * data ; + api_rx_hdr_t api_rx_hdr ; + void * data ; } api_rx_element_t; typedef struct { - unsigned char station ; - unsigned char misc_tx_rx_bits ; - unsigned char reserved[14] ; + unsigned char station ; + unsigned char misc_tx_rx_bits ; + unsigned char reserved[14] ; } api_tx_hdr_t; typedef struct { - api_tx_hdr_t api_tx_hdr ; - void * data ; + api_tx_hdr_t api_tx_hdr ; + void * data ; } api_tx_element_t; -#pragma pack() - #define SIOC_WANPIPE_EXEC_CMD SIOC_WANPIPE_DEVPRIVATE +#pragma pack() + #endif diff --git a/patches/kdrivers/include/sdla_bscstrm.h b/patches/kdrivers/include/sdla_bscstrm.h index d45dfe7..8d97474 100644 --- a/patches/kdrivers/include/sdla_bscstrm.h +++ b/patches/kdrivers/include/sdla_bscstrm.h @@ -1,4 +1,4 @@ -/* $Header: /usr/local/cvsroot/wanpipe_linux/code/include/sdla_bscstrm.h,v 1.3 2004/09/28 21:47:30 sangoma Exp $ */ +/* $Header: /usr/local/cvsroot/wanpipe_linux/code/include/sdla_bscstrm.h,v 1.4 2007/05/24 17:45:25 sangoma Exp $ */ /* @@ -12,6 +12,9 @@ /* * $Log: sdla_bscstrm.h,v $ + * Revision 1.4 2007/05/24 17:45:25 sangoma + * Removed PACKED from include files + * * Revision 1.3 2004/09/28 21:47:30 sangoma * *** empty log message *** * @@ -234,25 +237,25 @@ typedef struct { #define RX_EXCESSIVE_LGTH_ERR_APP_LVL 0x20 /* the received block was too long (application level) */ typedef struct { - unsigned char station ; - unsigned short time_stamp ; - unsigned char reserved[13] ; + unsigned char station ; + unsigned short time_stamp ; + unsigned char reserved[13] ; } api_rx_hdr_t; typedef struct { - api_rx_hdr_t api_rx_hdr ; - unsigned char data[1] ; + api_rx_hdr_t api_rx_hdr ; + unsigned char data[1] ; } api_rx_element_t; typedef struct { - unsigned char station ; - unsigned char misc_tx_rx_bits ; - unsigned char reserved[14] ; + unsigned char station ; + unsigned char misc_tx_rx_bits ; + unsigned char reserved[14] ; } api_tx_hdr_t; typedef struct { - api_tx_hdr_t api_tx_hdr ; - unsigned char data[1] ; + api_tx_hdr_t api_tx_hdr ; + unsigned char data[1] ; } api_tx_element_t; #pragma pack() diff --git a/patches/kdrivers/include/sdla_bstrm.h b/patches/kdrivers/include/sdla_bstrm.h index a793ea2..af936f2 100644 --- a/patches/kdrivers/include/sdla_bstrm.h +++ b/patches/kdrivers/include/sdla_bstrm.h @@ -13,13 +13,11 @@ * Sep 24, 1998 Jaspreet Singh o Initial Version. *****************************************************************************/ - -#ifndef __SDLA_BSTRM__ -#define __SDLA_BSTRM__ +#ifndef __SDLA_BSTRM_H__ +#define __SDLA_BSTRM_H__ #pragma pack(1) - /* Status flag for determining whether to perform a check on socket receive * queue. */ @@ -84,20 +82,20 @@ for the mailbox header area, we are left with a mailbox data size of 4064 bytes. /* the mailbox structure */ typedef struct { - unsigned char opp_flag ; /* the opp flag */ - unsigned char command ; /* the user command */ - unsigned short buffer_length ; /* the data length */ - unsigned char return_code ; /* the return code */ - unsigned char misc_Tx_Rx_bits ; /* miscellaneous transmit and receive bits */ - unsigned char Rx_error_bits ; /* an indication of a block received with an error */ - unsigned short Rx_time_stamp ; /* a millisecond receive time stamp */ - unsigned char reserved[7] ; /* reserved for later use */ - char data[SIZEOF_MB_DATA_BFR] ; /* the data area */ + unsigned char opp_flag ; /* the opp flag */ + unsigned char command ; /* the user command */ + unsigned short buffer_length ; /* the data length */ + unsigned char return_code ; /* the return code */ + unsigned char misc_Tx_Rx_bits ; /* miscellaneous transmit and receive bits */ + unsigned char Rx_error_bits ; /* an indication of a block received with an error */ + unsigned short Rx_time_stamp ; /* a millisecond receive time stamp */ + unsigned char reserved[7] ; /* reserved for later use */ + char data[SIZEOF_MB_DATA_BFR] ; /* the data area */ } MAILBOX_STRUCT; typedef struct { - pid_t pid_num ; - MAILBOX_STRUCT cmdarea ; + pid_t pid_num ; + MAILBOX_STRUCT cmdarea ; } CMDBLOCK_STRUCT; /* definitions for setting the configuration */ @@ -134,18 +132,18 @@ typedef struct { /* the configuration structure */ typedef struct { - unsigned long baud_rate ; /* the baud rate */ - unsigned long adapter_frequency ; /* the adapter frequecy */ - unsigned short max_data_length ; /* the maximum length of a BSC data block */ - unsigned short EBCDIC_encoding ; /* EBCDIC/ASCII encoding */ - unsigned short Rx_block_type ; /* the type of BSC block to be received */ - unsigned short no_consec_PADs_EOB ; /* the number of consecutive PADs indicating the end of the block */ - unsigned short no_add_lead_Tx_SYN_chars ; /* the number of additional leading transmit SYN characters */ - unsigned short no_bits_per_char ; /* the number of bits per character */ - unsigned short parity ; /* parity */ - unsigned short misc_config_options ; /* miscellaneous configuration options */ - unsigned short statistics_options ; /* statistic options */ - unsigned short modem_config_options ; /* modem configuration options */ + unsigned long baud_rate ; /* the baud rate */ + unsigned long adapter_frequency ; /* the adapter frequecy */ + unsigned short max_data_length ; /* the maximum length of a BSC data block */ + unsigned short EBCDIC_encoding ; /* EBCDIC/ASCII encoding */ + unsigned short Rx_block_type ; /* the type of BSC block to be received */ + unsigned short no_consec_PADs_EOB ; /* the number of consecutive PADs indicating the end of the block */ + unsigned short no_add_lead_Tx_SYN_chars ; /* the number of additional leading transmit SYN characters */ + unsigned short no_bits_per_char ; /* the number of bits per character */ + unsigned short parity ; /* parity */ + unsigned short misc_config_options ; /* miscellaneous configuration options */ + unsigned short statistics_options ; /* statistic options */ + unsigned short modem_config_options ; /* modem configuration options */ } CONFIGURATION_STRUCT; @@ -173,13 +171,13 @@ typedef struct { /* definitions for reading the operational statistics */ /* the operational statistics structure */ typedef struct { - unsigned long no_blocks_Rx ; /* the number of data blocks received and made available for the application */ - unsigned long no_bytes_Rx ; /* the number of bytes received and made available for the application */ - unsigned long no_blocks_Tx ; /* the number of data blocks transmitted */ - unsigned long no_bytes_Tx ; /* the number of bytes transmitted */ + unsigned long no_blocks_Rx ; /* the number of data blocks received and made available for the application */ + unsigned long no_bytes_Rx ; /* the number of bytes received and made available for the application */ + unsigned long no_blocks_Tx ; /* the number of data blocks transmitted */ + unsigned long no_bytes_Tx ; /* the number of bytes transmitted */ } OPERATIONAL_STATS_STRUCT; -#pragma pack() + /* definitions for interrupt usage */ /* 'interrupt_triggers' bit mapping set by a SET_INTERRUPT_TRIGGERS command */ @@ -211,3 +209,7 @@ typedef struct { #define RX_OVERRUN_ERROR 0x02 /* a receive overrun error occurred */ #define RX_EXCESSIVE_LGTH_ERR_INT_LVL 0x10 /* the received block was too long (interrupt level) */ #define RX_EXCESSIVE_LGTH_ERR_APP_LVL 0x20 /* the received block was too long (application level) */ + +#pragma pack() + +#endif diff --git a/patches/kdrivers/include/sdla_chdlc.h b/patches/kdrivers/include/sdla_chdlc.h index 062e6b4..1ac5783 100644 --- a/patches/kdrivers/include/sdla_chdlc.h +++ b/patches/kdrivers/include/sdla_chdlc.h @@ -32,6 +32,7 @@ #define _SDLA_CHDLC_H #if defined(__LINUX__) +# include # include #else # include @@ -65,12 +66,12 @@ #if 0 typedef struct { - unsigned char opp_flag ; /* the opp flag */ - unsigned char command ; /* the user command */ - unsigned short buffer_length ; /* the data length */ - unsigned char return_code ; /* the return code */ - unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] ; /* reserved for later */ - unsigned char data[SIZEOF_MB_DATA_BFR] ; /* the data area */ + unsigned char opp_flag ; /* the opp flag */ + unsigned char command ; /* the user command */ + unsigned short buffer_length ; /* the data length */ + unsigned char return_code ; /* the return code */ + unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] ; /* reserved for later */ + unsigned char data[SIZEOF_MB_DATA_BFR] ; /* the data area */ } CHDLC_MAILBOX_STRUCT; #endif @@ -219,6 +220,15 @@ typedef struct { #define LINK_DISCONNECTED 0x21 #define NO_TX_BFRS_AVAIL 0x24 +typedef struct { + unsigned char modem_status; +} MODEM_STATUS_STRUCT; + +#define SET_MODEM_DTR_HIGH 0x01 +#define SET_MODEM_RTS_HIGH 0x02 + +#define MODEM_CTS_MASK 0x20 +#define MODEM_DCD_MASK 0x08 /* ---------------------------------------------------------------------------- * Constants for the SET_GLOBAL_CONFIGURATION/READ_GLOBAL_CONFIGURATION commands @@ -226,10 +236,10 @@ typedef struct { /* the global configuration structure */ typedef struct { - unsigned short adapter_config_options ; /* adapter config options */ - unsigned short app_IRQ_timeout ; /* application IRQ timeout */ - unsigned int adapter_operating_frequency ; /* adapter operating frequency */ - unsigned short frame_transmit_timeout ; + unsigned short adapter_config_options ; /* adapter config options */ + unsigned short app_IRQ_timeout ; /* application IRQ timeout */ + unsigned int adapter_operating_frequency ; /* adapter operating frequency */ + unsigned short frame_transmit_timeout ; } GLOBAL_CONFIGURATION_STRUCT; /* settings for the 'app_IRQ_timeout' */ @@ -243,7 +253,7 @@ typedef struct { /* the global statistics structure */ typedef struct { - unsigned short app_IRQ_timeout_count ; + unsigned short app_IRQ_timeout_count ; } GLOBAL_STATS_STRUCT; @@ -254,16 +264,16 @@ typedef struct { /* the communications error statistics structure */ typedef struct { - unsigned short Rx_overrun_err_count ; - unsigned short CRC_err_count ; /* receiver CRC error count */ - unsigned short Rx_abort_count ; /* abort frames recvd count */ - unsigned short Rx_dis_pri_bfrs_full_count ;/* receiver disabled */ - unsigned short comms_err_stat_reserved_1 ;/* reserved for later */ - unsigned short sec_Tx_abort_msd_Tx_int_count ; /* secondary - abort frames transmitted count (missed Tx interrupt) */ - unsigned short missed_Tx_und_int_count ; /* missed tx underrun interrupt count */ - unsigned short sec_Tx_abort_count ; /*secondary-abort frames tx count */ - unsigned short DCD_state_change_count ; /* DCD state change */ - unsigned short CTS_state_change_count ; /* CTS state change */ + unsigned short Rx_overrun_err_count ; + unsigned short CRC_err_count ; /* receiver CRC error count */ + unsigned short Rx_abort_count ; /* abort frames recvd count */ + unsigned short Rx_dis_pri_bfrs_full_count ;/* receiver disabled */ + unsigned short comms_err_stat_reserved_1 ;/* reserved for later */ + unsigned short sec_Tx_abort_msd_Tx_int_count ; /* secondary - abort frames transmitted count (missed Tx interrupt) */ + unsigned short missed_Tx_und_int_count ; /* missed tx underrun interrupt count */ + unsigned short sec_Tx_abort_count ; /*secondary-abort frames tx count */ + unsigned short DCD_state_change_count ; /* DCD state change */ + unsigned short CTS_state_change_count ; /* CTS state change */ } COMMS_ERROR_STATS_STRUCT; @@ -274,9 +284,9 @@ typedef struct { /* the trace configuration structure (SET_TRACE_CONFIGURATION/READ_TRACE_CONFIGURATION commands) */ typedef struct { - unsigned char trace_config ; /* trace configuration */ - unsigned short trace_deactivation_timer ; /* trace deactivation timer */ - unsigned int ptr_trace_stat_el_cfg_struct ; /* a pointer to the line trace element configuration structure */ + unsigned char trace_config ; /* trace configuration */ + unsigned short trace_deactivation_timer ; /* trace deactivation timer */ + unsigned int ptr_trace_stat_el_cfg_struct ; /* a pointer to the line trace element configuration structure */ } LINE_TRACE_CONFIG_STRUCT; /* 'trace_config' bit settings */ @@ -289,22 +299,22 @@ typedef struct { /* the line trace status element configuration structure */ typedef struct { - unsigned short number_trace_status_elements ; /* number of line trace elements */ - unsigned int base_addr_trace_status_elements ; /* base address of the trace element list */ - unsigned int next_trace_element_to_use ; /* pointer to the next trace element to be used */ - unsigned int base_addr_trace_buffer ; /* base address of the trace data buffer */ - unsigned int end_addr_trace_buffer ; /* end address of the trace data buffer */ + unsigned short number_trace_status_elements ; /* number of line trace elements */ + unsigned int base_addr_trace_status_elements ; /* base address of the trace element list */ + unsigned int next_trace_element_to_use ; /* pointer to the next trace element to be used */ + unsigned int base_addr_trace_buffer ; /* base address of the trace data buffer */ + unsigned int end_addr_trace_buffer ; /* end address of the trace data buffer */ } TRACE_STATUS_EL_CFG_STRUCT; /* the line trace status element structure */ typedef struct { - unsigned char opp_flag ; /* opp flag */ - unsigned short trace_length ; /* trace length */ - unsigned char trace_type ; /* trace type */ - unsigned short trace_time_stamp ; /* time stamp */ - unsigned short trace_reserved_1 ; /* reserved for later use */ - unsigned int trace_reserved_2 ; /* reserved for later use */ - unsigned int ptr_data_bfr ; /* ptr to the trace data buffer */ + unsigned char opp_flag ; /* opp flag */ + unsigned short trace_length ; /* trace length */ + unsigned char trace_type ; /* trace type */ + unsigned short trace_time_stamp ; /* time stamp */ + unsigned short trace_reserved_1 ; /* reserved for later use */ + unsigned int trace_reserved_2 ; /* reserved for later use */ + unsigned int ptr_data_bfr ; /* ptr to the trace data buffer */ } TRACE_STATUS_ELEMENT_STRUCT; /* "trace_type" bit settings */ @@ -318,8 +328,8 @@ typedef struct { /* the line trace statistics structure */ typedef struct { - unsigned int frames_traced_count ; /* number of frames traced */ - unsigned int trc_frms_not_recorded_count ; /* number of trace frames discarded */ + unsigned int frames_traced_count ; /* number of frames traced */ + unsigned int trc_frms_not_recorded_count ; /* number of trace frames discarded */ } LINE_TRACE_STATS_STRUCT; @@ -341,24 +351,24 @@ typedef struct { /* the CHDLC configuration structure */ typedef struct { - unsigned int baud_rate ; /* the baud rate */ - unsigned short line_config_options ; /* line configuration options */ - unsigned short modem_config_options ; /* modem configration options */ - unsigned short modem_status_timer ; /* timer for monitoring modem status changes */ - unsigned short CHDLC_API_options ; /* CHDLC API options */ - unsigned short CHDLC_protocol_options ; /* CHDLC protocol options */ - unsigned short percent_data_buffer_for_Tx ; /* percentage data buffering used for Tx */ - unsigned short CHDLC_statistics_options ; /* CHDLC operational statistics options */ - unsigned short max_CHDLC_data_field_length ; /* the maximum length of the CHDLC Data field */ - unsigned short transmit_keepalive_timer ; /* the transmit keepalive timer */ - unsigned short receive_keepalive_timer ; /* the receive keepalive timer */ - unsigned short keepalive_error_tolerance ; /* the receive keepalive error tolerance */ - unsigned short SLARP_request_timer ; /* the SLARP request timer */ - unsigned int IP_address ; /* the IP address */ - unsigned int IP_netmask ; /* the IP netmask */ - unsigned int ptr_shared_mem_info_struct ; /* a pointer to the shared memory area information structure */ - unsigned int ptr_CHDLC_Tx_stat_el_cfg_struct ; /* a pointer to the transmit status element configuration structure */ - unsigned int ptr_CHDLC_Rx_stat_el_cfg_struct ; /* a pointer to the receive status element configuration structure */ + unsigned int baud_rate ; /* the baud rate */ + unsigned short line_config_options ; /* line configuration options */ + unsigned short modem_config_options ; /* modem configration options */ + unsigned short modem_status_timer ; /* timer for monitoring modem status changes */ + unsigned short CHDLC_API_options ; /* CHDLC API options */ + unsigned short CHDLC_protocol_options ; /* CHDLC protocol options */ + unsigned short percent_data_buffer_for_Tx ; /* percentage data buffering used for Tx */ + unsigned short CHDLC_statistics_options ; /* CHDLC operational statistics options */ + unsigned short max_CHDLC_data_field_length ; /* the maximum length of the CHDLC Data field */ + unsigned short transmit_keepalive_timer ; /* the transmit keepalive timer */ + unsigned short receive_keepalive_timer ; /* the receive keepalive timer */ + unsigned short keepalive_error_tolerance ; /* the receive keepalive error tolerance */ + unsigned short SLARP_request_timer ; /* the SLARP request timer */ + unsigned int IP_address ; /* the IP address */ + unsigned int IP_netmask ; /* the IP netmask */ + unsigned int ptr_shared_mem_info_struct ; /* a pointer to the shared memory area information structure */ + unsigned int ptr_CHDLC_Tx_stat_el_cfg_struct ; /* a pointer to the transmit status element configuration structure */ + unsigned int ptr_CHDLC_Rx_stat_el_cfg_struct ; /* a pointer to the receive status element configuration structure */ } CHDLC_CONFIGURATION_STRUCT; /* settings for the 'line_config_options' */ @@ -460,10 +470,10 @@ typedef struct { /* the CHDLC status structure */ typedef struct { - unsigned char CHDLC_link_status ; /* CHDLC link status */ - unsigned char no_Data_frms_for_app ; /* number of Data frames available for the application */ - unsigned char receiver_status ; /* enabled/disabled */ - unsigned char SLARP_state ; /* internal SLARP state */ + unsigned char CHDLC_link_status ; /* CHDLC link status */ + unsigned char no_Data_frms_for_app ; /* number of Data frames available for the application */ + unsigned char receiver_status ; /* enabled/disabled */ + unsigned char SLARP_state ; /* internal SLARP state */ } CHDLC_LINK_STATUS_STRUCT; /* settings for the 'CHDLC_link_status' variable */ @@ -478,10 +488,10 @@ typedef struct { /* the structure used for the SET_CHDLC_INTERRUPT_TRIGGERS/READ_CHDLC_INTERRUPT_TRIGGERS command */ typedef struct { - unsigned char CHDLC_interrupt_triggers ; /* CHDLC interrupt trigger configuration */ - unsigned char IRQ ; /* IRQ to be used */ - unsigned short interrupt_timer ; /* interrupt timer */ - unsigned short misc_interrupt_bits ; /* miscellaneous bits */ + unsigned char CHDLC_interrupt_triggers ; /* CHDLC interrupt trigger configuration */ + unsigned char IRQ ; /* IRQ to be used */ + unsigned short interrupt_timer ; /* interrupt timer */ + unsigned short misc_interrupt_bits ; /* miscellaneous bits */ } CHDLC_INT_TRIGGERS_STRUCT; /* 'CHDLC_interrupt_triggers' bit settings */ @@ -515,19 +525,19 @@ typedef struct { /* the Data frame transmit status element configuration structure */ typedef struct { - unsigned short number_Tx_status_elements ; /* number of transmit status elements */ - unsigned int base_addr_Tx_status_elements ; /* base address of the transmit element list */ - unsigned int next_Tx_status_element_to_use ; /* pointer to the next transmit element to be used */ + unsigned short number_Tx_status_elements ; /* number of transmit status elements */ + unsigned int base_addr_Tx_status_elements ; /* base address of the transmit element list */ + unsigned int next_Tx_status_element_to_use ; /* pointer to the next transmit element to be used */ } CHDLC_TX_STATUS_EL_CFG_STRUCT; /* the Data frame transmit status element structure */ typedef struct { - unsigned char opp_flag ; /* opp flag */ - unsigned short frame_length ; /* length of the frame to be transmitted */ - unsigned char misc_Tx_bits ; /* miscellaneous transmit bits */ - unsigned int reserved_2 ; /* reserved for internal use */ - unsigned int reserved_3 ; /* reserved for internal use */ - unsigned int ptr_data_bfr ; /* pointer to the data area */ + unsigned char opp_flag ; /* opp flag */ + unsigned short frame_length ; /* length of the frame to be transmitted */ + unsigned char misc_Tx_bits ; /* miscellaneous transmit bits */ + unsigned int reserved_2 ; /* reserved for internal use */ + unsigned int reserved_3 ; /* reserved for internal use */ + unsigned int ptr_data_bfr ; /* pointer to the data area */ } CHDLC_DATA_TX_STATUS_EL_STRUCT; @@ -556,22 +566,22 @@ typedef struct { /* the Data frame receive status element configuration structure */ typedef struct { - unsigned short number_Rx_status_elements ; /* number of receive status elements */ - unsigned int base_addr_Rx_status_elements ; /* base address of the receive element list */ - unsigned int next_Rx_status_element_to_use ; /* pointer to the next receive element to be used */ - unsigned int base_addr_Rx_buffer ; /* base address of the receive data buffer */ - unsigned int end_addr_Rx_buffer ; /* end address of the receive data buffer */ + unsigned short number_Rx_status_elements ; /* number of receive status elements */ + unsigned int base_addr_Rx_status_elements ; /* base address of the receive element list */ + unsigned int next_Rx_status_element_to_use ; /* pointer to the next receive element to be used */ + unsigned int base_addr_Rx_buffer ; /* base address of the receive data buffer */ + unsigned int end_addr_Rx_buffer ; /* end address of the receive data buffer */ } CHDLC_RX_STATUS_EL_CFG_STRUCT; /* the Data frame receive status element structure */ typedef struct { - unsigned char opp_flag ; /* opp flag */ - unsigned short frame_length ; /* length of the received frame */ - unsigned char error_flag ; /* frame errors (HDLC_STREAMING_MODE)*/ - unsigned short time_stamp ; /* receive time stamp (HDLC_STREAMING_MODE) */ - unsigned int reserved_1 ; /* reserved for internal use */ - unsigned short reserved_2 ; /* reserved for internal use */ - unsigned int ptr_data_bfr ; /* pointer to the data area */ + unsigned char opp_flag ; /* opp flag */ + unsigned short frame_length ; /* length of the received frame */ + unsigned char error_flag ; /* frame errors (HDLC_STREAMING_MODE)*/ + unsigned short time_stamp ; /* receive time stamp (HDLC_STREAMING_MODE) */ + unsigned int reserved_1 ; /* reserved for internal use */ + unsigned short reserved_2 ; /* reserved for internal use */ + unsigned int ptr_data_bfr ; /* pointer to the data area */ } CHDLC_DATA_RX_STATUS_EL_STRUCT; @@ -593,41 +603,41 @@ typedef struct { /* the global information structure */ typedef struct { - unsigned char global_status ; /* global status */ - unsigned char modem_status ; /* current modem status */ - unsigned char global_excep_conditions ; /* global exception conditions */ - unsigned char glob_info_reserved[5] ; /* reserved */ - unsigned char codename[4] ; /* Firmware name */ - unsigned char codeversion[4] ; /* Firmware version */ + unsigned char global_status ; /* global status */ + unsigned char modem_status ; /* current modem status */ + unsigned char global_excep_conditions ; /* global exception conditions */ + unsigned char glob_info_reserved[5] ; /* reserved */ + unsigned char codename[4] ; /* Firmware name */ + unsigned char codeversion[4] ; /* Firmware version */ } GLOBAL_INFORMATION_STRUCT; /* the CHDLC information structure */ typedef struct { - unsigned char CHDLC_status ; /* CHDLC status */ - unsigned char CHDLC_excep_conditions ; /* CHDLC exception conditions */ - unsigned char CHDLC_info_reserved[14] ; /* reserved */ + unsigned char CHDLC_status ; /* CHDLC status */ + unsigned char CHDLC_excep_conditions ; /* CHDLC exception conditions */ + unsigned char CHDLC_info_reserved[14] ; /* reserved */ } CHDLC_INFORMATION_STRUCT; /* the interrupt information structure */ typedef struct { - unsigned char interrupt_type ; /* type of interrupt triggered */ - unsigned char interrupt_permission ; /* interrupt permission mask */ - unsigned char int_info_reserved[14] ; /* reserved */ + unsigned char interrupt_type ; /* type of interrupt triggered */ + unsigned char interrupt_permission ; /* interrupt permission mask */ + unsigned char int_info_reserved[14] ; /* reserved */ } INTERRUPT_INFORMATION_STRUCT; /* the S508/FT1 information structure */ typedef struct { - unsigned char parallel_port_A_input ; /* input - parallel port A */ - unsigned char parallel_port_B_input ; /* input - parallel port B */ - unsigned char FT1_info_reserved[14] ; /* reserved */ + unsigned char parallel_port_A_input ; /* input - parallel port A */ + unsigned char parallel_port_B_input ; /* input - parallel port B */ + unsigned char FT1_info_reserved[14] ; /* reserved */ } FT1_INFORMATION_STRUCT; /* the shared memory area information structure */ typedef struct { - GLOBAL_INFORMATION_STRUCT global_info_struct ; /* the global information structure */ - CHDLC_INFORMATION_STRUCT CHDLC_info_struct ; /* the CHDLC information structure */ - INTERRUPT_INFORMATION_STRUCT interrupt_info_struct ; /* the interrupt information structure */ - FT1_INFORMATION_STRUCT FT1_info_struct ; /* the S508/FT1 information structure */ + GLOBAL_INFORMATION_STRUCT global_info_struct ; /* the global information structure */ + CHDLC_INFORMATION_STRUCT CHDLC_info_struct ; /* the CHDLC information structure */ + INTERRUPT_INFORMATION_STRUCT interrupt_info_struct ; /* the interrupt information structure */ + FT1_INFORMATION_STRUCT FT1_info_struct ; /* the S508/FT1 information structure */ } SHARED_MEMORY_INFO_STRUCT; /* ---------------------------------------------------------------------------- @@ -640,55 +650,55 @@ typedef struct { #ifndef HDLC_PROT_ONLY typedef struct { - unsigned char opp_flag ; /* the opp flag */ - unsigned char command ; /* the user command */ - unsigned short buffer_length ; /* the data length */ - unsigned char return_code ; /* the return code */ - unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] ; /* reserved for later */ + unsigned char opp_flag ; /* the opp flag */ + unsigned char command ; /* the user command */ + unsigned short buffer_length ; /* the data length */ + unsigned char return_code ; /* the return code */ + unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] ; /* reserved for later */ } cblock_t; /* UDP management packet layout (data area of ip packet) */ /* typedef struct { - unsigned char signature[8] ; - unsigned char request_reply ; - unsigned char id ; - unsigned char reserved[6] ; - cblock_t cblock ; - unsigned char num_frames ; - unsigned char ismoredata ; - unsigned char data[SIZEOF_MB_DATA_BFR] ; + unsigned char signature[8] ; + unsigned char request_reply ; + unsigned char id ; + unsigned char reserved[6] ; + cblock_t cblock ; + unsigned char num_frames ; + unsigned char ismoredata ; + unsigned char data[SIZEOF_MB_DATA_BFR] ; } udp_management_packet_t; */ typedef struct { - unsigned char num_frames ; - unsigned char ismoredata ; + unsigned char num_frames ; + unsigned char ismoredata ; } trace_info_t; #if 0 typedef struct { - ip_pkt_t ip_pkt ; - udp_pkt_t udp_pkt ; - wp_mgmt_t wp_mgmt ; - cblock_t cblock ; - trace_info_t trace_info ; - unsigned char data[SIZEOF_MB_DATA_BFR] ; + ip_pkt_t ip_pkt ; + udp_pkt_t udp_pkt ; + wp_mgmt_t wp_mgmt ; + cblock_t cblock ; + trace_info_t trace_info ; + unsigned char data[SIZEOF_MB_DATA_BFR] ; } chdlc_udp_pkt_t; #endif typedef struct ft1_exec_cmd{ - unsigned char command ; /* the user command */ - unsigned short buffer_length ; /* the data length */ - unsigned char return_code ; /* the return code */ - unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] ; + unsigned char command ; /* the user command */ + unsigned short buffer_length ; /* the data length */ + unsigned char return_code ; /* the return code */ + unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] ; } ft1_exec_cmd_t; typedef struct { - unsigned char opp_flag ; - ft1_exec_cmd_t cmd ; - unsigned char data[SIZEOF_MB_DATA_BFR] ; + unsigned char opp_flag ; + ft1_exec_cmd_t cmd ; + unsigned char data[SIZEOF_MB_DATA_BFR] ; } ft1_exec_t; @@ -699,19 +709,19 @@ typedef struct { /* UDP/IP packet (for UDP management) layout */ /* typedef struct { - unsigned char reserved[2] ; - unsigned short ip_length ; - unsigned char reserved2[4] ; - unsigned char ip_ttl ; - unsigned char ip_protocol ; - unsigned short ip_checksum ; - unsigned int ip_src_address ; - unsigned int ip_dst_address ; - unsigned short udp_src_port ; - unsigned short udp_dst_port ; - unsigned short udp_length ; - unsigned short udp_checksum ; - udp_management_packet_t um_packet ; + unsigned char reserved[2] ; + unsigned short ip_length ; + unsigned char reserved2[4] ; + unsigned char ip_ttl ; + unsigned char ip_protocol ; + unsigned short ip_checksum ; + unsigned int ip_src_address ; + unsigned int ip_dst_address ; + unsigned short udp_src_port ; + unsigned short udp_dst_port ; + unsigned short udp_length ; + unsigned short udp_checksum ; + udp_management_packet_t um_packet ; } ip_packet_t; */ @@ -720,36 +730,36 @@ typedef struct { #if 0 typedef struct { - unsigned char status ; - unsigned char data_avail ; - unsigned short real_length ; - unsigned short time_stamp ; - unsigned char data[1] ; + unsigned char status ; + unsigned char data_avail ; + unsigned short real_length ; + unsigned short time_stamp ; + unsigned char data[1] ; } trace_pkt_t; #endif typedef struct { - unsigned char error_flag ; - unsigned short time_stamp ; - unsigned int sec ; - unsigned int usec ; - unsigned char reserved[5] ; + unsigned char error_flag ; + unsigned short time_stamp ; + unsigned int sec ; + unsigned int usec ; + unsigned char reserved[5] ; } api_rx_hdr_t; typedef struct { - api_rx_hdr_t api_rx_hdr ; - unsigned char data[1] ; + api_rx_hdr_t api_rx_hdr ; + unsigned char data[1] ; } api_rx_element_t; typedef struct { - unsigned char attr ; - unsigned char misc_Tx_bits ; - unsigned char reserved[14] ; + unsigned char attr ; + unsigned char misc_Tx_bits ; + unsigned char reserved[14] ; } api_tx_hdr_t; typedef struct { - api_tx_hdr_t api_tx_hdr ; - unsigned char data[1] ; + api_tx_hdr_t api_tx_hdr ; + unsigned char data[1] ; } api_tx_element_t; #endif //HDLC_PROT_ONLY @@ -768,7 +778,6 @@ typedef struct { } ft1_config_t; -#pragma pack() /* settings for the 'framing_mode' */ #define ESF_FRAMING 0x00 /* ESF framing */ @@ -807,13 +816,23 @@ typedef struct { #define AUTO_FT1_CFG_FAIL_OP_MODE 0x0C #define AUTO_FT1_CFG_FAIL_INVALID_LINE 0x0D +#if !defined(__WINDOWS__) #undef wan_udphdr_data #define wan_udphdr_data wan_udphdr_u.chdlc.data +#endif #ifdef __KERNEL__ #undef wan_udp_data #define wan_udp_data wan_udp_hdr.wan_udphdr_u.chdlc.data #endif +#pragma pack() + + +#if defined(__LINUX__) +enum { + SIOC_MBOX_CMD = SIOC_WANPIPE_DEVPRIVATE +}; +#endif #endif /* _SDLA_CHDLC_H */ diff --git a/patches/kdrivers/include/sdla_fr.h b/patches/kdrivers/include/sdla_fr.h index 53023c9..e07e1a6 100644 --- a/patches/kdrivers/include/sdla_fr.h +++ b/patches/kdrivers/include/sdla_fr.h @@ -34,8 +34,10 @@ * -------- -------- * GNU C Linux */ + #pragma pack(1) + /* Adapter memory layout */ #define FR_MB_VECTOR 0xE000 /* mailbox window vector */ #define FR502_RX_VECTOR 0xA000 /* S502 direct receive window vector */ @@ -63,14 +65,14 @@ */ typedef struct fr_cmd { - unsigned char command ; /* command code */ - unsigned short length ; /* length of data buffer */ - unsigned char result ; /* return code */ - unsigned short dlci ; /* DLCI number */ - unsigned char attr ; /* FECN, BECN, DE and C/R bits */ - unsigned short rxlost1 ; /* frames discarded at int. level */ - unsigned int rxlost2 ; /* frames discarded at app. level */ - unsigned char rsrv[2] ; /* reserved for future use */ + unsigned char command ; /* command code */ + unsigned short length ; /* length of data buffer */ + unsigned char result ; /* return code */ + unsigned short dlci ; /* DLCI number */ + unsigned char attr ; /* FECN, BECN, DE and C/R bits */ + unsigned short rxlost1 ; /* frames discarded at int. level */ + unsigned int rxlost2 ; /* frames discarded at app. level */ + unsigned char rsrv[2] ; /* reserved for future use */ } fr_cmd_t; @@ -116,14 +118,14 @@ typedef struct fr_cmd */ typedef struct fr502_flags { - unsigned char rsrv1[1] ; /* 00h: */ - unsigned char tx_ready ; /* 01h: Tx buffer available */ - unsigned char rx_ready ; /* 02h: Rx frame available */ - unsigned char event ; /* 03h: asynchronous event */ - unsigned char mstatus ; /* 04h: modem status */ - unsigned char rsrv2[8] ; /* 05h: */ - unsigned char iflag ; /* 0Dh: interrupt flag */ - unsigned char imask ; /* 0Eh: interrupt mask */ + unsigned char rsrv1[1] ; /* 00h: */ + unsigned char tx_ready ; /* 01h: Tx buffer available */ + unsigned char rx_ready ; /* 02h: Rx frame available */ + unsigned char event ; /* 03h: asynchronous event */ + unsigned char mstatus ; /* 04h: modem status */ + unsigned char rsrv2[8] ; /* 05h: */ + unsigned char iflag ; /* 0Dh: interrupt flag */ + unsigned char imask ; /* 0Eh: interrupt mask */ } fr502_flags_t; /*---------------------------------------------------------------------------- @@ -132,14 +134,14 @@ typedef struct fr502_flags */ typedef struct fr508_flags { - unsigned char rsrv1[3] ; /* 00h: reserved */ - unsigned char event ; /* 03h: asynchronous event */ - unsigned char mstatus ; /* 04h: modem status */ - unsigned char rsrv2[11] ; /* 05h: reserved */ - unsigned char iflag ; /* 10h: interrupt flag */ - unsigned char imask ; /* 11h: interrupt mask */ - unsigned int tse_offs ; /* 12h: Tx status element */ - unsigned short dlci ; /* 16h: DLCI NUMBER */ + unsigned char rsrv1[3] ; /* 00h: reserved */ + unsigned char event ; /* 03h: asynchronous event */ + unsigned char mstatus ; /* 04h: modem status */ + unsigned char rsrv2[11] ; /* 05h: reserved */ + unsigned char iflag ; /* 10h: interrupt flag */ + unsigned char imask ; /* 11h: interrupt mask */ + unsigned int tse_offs ; /* 12h: Tx status element */ + unsigned short dlci ; /* 16h: DLCI NUMBER */ } fr508_flags_t; /* 'event' field defines */ @@ -168,12 +170,12 @@ typedef struct fr508_flags */ typedef struct fr_buf_info { - unsigned short rse_num ; /* 00h: number of status elements */ - unsigned int rse_base ; /* 02h: receive status array base */ - unsigned int rse_next ; /* 06h: next status element */ - unsigned int buf_base ; /* 0Ah: rotational buffer base */ - unsigned short reserved ; /* 0Eh: */ - unsigned int buf_top ; /* 10h: rotational buffer top */ + unsigned short rse_num ; /* 00h: number of status elements */ + unsigned int rse_base ; /* 02h: receive status array base */ + unsigned int rse_next ; /* 06h: next status element */ + unsigned int buf_base ; /* 0Ah: rotational buffer base */ + unsigned short reserved ; /* 0Eh: */ + unsigned int buf_top ; /* 10h: rotational buffer top */ } fr_buf_info_t; /*---------------------------------------------------------------------------- @@ -184,24 +186,24 @@ typedef struct fr_buf_info */ typedef struct fr_rx_buf_ctl { - unsigned char flag ; /* 00h: ready flag */ - unsigned short length ; /* 01h: frame length */ - unsigned short dlci ; /* 03h: DLCI */ - unsigned char attr ; /* 05h: FECN/BECN/DE/CR */ - unsigned short tmstamp ; /* 06h: time stamp */ - unsigned short rsrv[2] ; /* 08h: */ - unsigned int offset ; /* 0Ch: buffer absolute address */ + unsigned char flag ; /* 00h: ready flag */ + unsigned short length ; /* 01h: frame length */ + unsigned short dlci ; /* 03h: DLCI */ + unsigned char attr ; /* 05h: FECN/BECN/DE/CR */ + unsigned short tmstamp ; /* 06h: time stamp */ + unsigned short rsrv[2] ; /* 08h: */ + unsigned int offset ; /* 0Ch: buffer absolute address */ } fr_rx_buf_ctl_t; typedef struct fr_tx_buf_ctl { - unsigned char flag ; /* 00h: ready flag */ - unsigned short rsrv0[2] ; /* 01h: */ - unsigned short length ; /* 05h: frame length */ - unsigned short dlci ; /* 07h: DLCI */ - unsigned char attr ; /* 09h: FECN/BECN/DE/CR */ - unsigned short rsrv1 ; /* 0Ah: */ - unsigned int offset ; /* 0Ch: buffer absolute address */ + unsigned char flag ; /* 00h: ready flag */ + unsigned short rsrv0[2] ; /* 01h: */ + unsigned short length ; /* 05h: frame length */ + unsigned short dlci ; /* 07h: DLCI */ + unsigned char attr ; /* 09h: FECN/BECN/DE/CR */ + unsigned short rsrv1 ; /* 0Ah: */ + unsigned int offset ; /* 0Ch: buffer absolute address */ } fr_tx_buf_ctl_t; /*---------------------------------------------------------------------------- @@ -209,23 +211,23 @@ typedef struct fr_tx_buf_ctl */ typedef struct fr_conf { - unsigned short station ; /* 00h: CPE/Node */ - unsigned short options ; /* 02h: configuration options */ - unsigned short kbps ; /* 04h: baud rate in kbps */ - unsigned short port ; /* 06h: RS-232/V.35 */ - unsigned short mtu ; /* 08h: max. transmit length */ - unsigned short t391 ; /* 0Ah: */ - unsigned short t392 ; /* 0Ch: */ - unsigned short n391 ; /* 0Eh: */ - unsigned short n392 ; /* 10h: */ - unsigned short n393 ; /* 12h: */ - unsigned short cir_fwd ; /* 14h: */ - unsigned short bc_fwd ; /* 16h: */ - unsigned short be_fwd ; /* 18h: */ - unsigned short cir_bwd ; /* 1Ah: */ - unsigned short bc_bwd ; /* 1Ch: */ - unsigned short be_bwd ; /* 1Eh: */ - unsigned short dlci[0] ; /* 20h: */ + unsigned short station ; /* 00h: CPE/Node */ + unsigned short options ; /* 02h: configuration options */ + unsigned short kbps ; /* 04h: baud rate in kbps */ + unsigned short port ; /* 06h: RS-232/V.35 */ + unsigned short mtu ; /* 08h: max. transmit length */ + unsigned short t391 ; /* 0Ah: */ + unsigned short t392 ; /* 0Ch: */ + unsigned short n391 ; /* 0Eh: */ + unsigned short n392 ; /* 10h: */ + unsigned short n393 ; /* 12h: */ + unsigned short cir_fwd ; /* 14h: */ + unsigned short bc_fwd ; /* 16h: */ + unsigned short be_fwd ; /* 18h: */ + unsigned short cir_bwd ; /* 1Ah: */ + unsigned short bc_bwd ; /* 1Ch: */ + unsigned short be_bwd ; /* 1Eh: */ + unsigned short dlci[0] ; /* 20h: */ } fr_conf_t; /* 'station_type' defines */ @@ -262,26 +264,26 @@ typedef struct fr_conf /* the line trace status element presented by the frame relay code */ typedef struct { - unsigned char flag ; /* ready flag */ - unsigned short length ; /* trace length */ - unsigned char rsrv0[2] ; /* reserved */ - unsigned char attr ; /* trace attributes */ - unsigned short tmstamp ; /* time stamp */ - unsigned char rsrv1[4] ; /* reserved */ - unsigned int offset ; /* buffer absolute address */ + unsigned char flag ; /* ready flag */ + unsigned short length ; /* trace length */ + unsigned char rsrv0[2] ; /* reserved */ + unsigned char attr ; /* trace attributes */ + unsigned short tmstamp ; /* time stamp */ + unsigned char rsrv1[4] ; /* reserved */ + unsigned int offset ; /* buffer absolute address */ } fr_trc_el_t; typedef struct { - unsigned char status ; /* status flag */ - unsigned char data_passed ; /* 0 if no data passed, 1 if */ + unsigned char status ; /* status flag */ + unsigned char data_passed ; /* 0 if no data passed, 1 if */ /* data passed */ - unsigned short length ; /* frame length */ - unsigned short tmstamp ; /* time stamp */ + unsigned short length ; /* frame length */ + unsigned short tmstamp ; /* time stamp */ } fpipemon_trc_hdr_t; typedef struct { - fpipemon_trc_hdr_t fpipemon_trc_hdr ; - unsigned char data[FR_MAX_NO_DATA_BYTES_IN_FRAME] ; + fpipemon_trc_hdr_t fpipemon_trc_hdr ; + unsigned char data[FR_MAX_NO_DATA_BYTES_IN_FRAME] ; } fpipemon_trc_t; /* bit settings for the 'status' byte - note that bits 1, 2 and 3 are used */ @@ -311,13 +313,13 @@ typedef struct { */ typedef struct fr_dlc_conf { - unsigned short conf_flags ; /* 00h: configuration bits */ - unsigned short cir_fwd ; /* 02h: */ - unsigned short bc_fwd ; /* 04h: */ - unsigned short be_fwd ; /* 06h: */ - unsigned short cir_bwd ; /* 08h: */ - unsigned short bc_bwd ; /* 0Ah: */ - unsigned short be_bwd ; /* 0Ch: */ + unsigned short conf_flags ; /* 00h: configuration bits */ + unsigned short cir_fwd ; /* 02h: */ + unsigned short bc_fwd ; /* 04h: */ + unsigned short be_fwd ; /* 06h: */ + unsigned short cir_bwd ; /* 08h: */ + unsigned short bc_bwd ; /* 0Ah: */ + unsigned short be_bwd ; /* 0Ch: */ } fr_dlc_conf_t; /*---------------------------------------------------------------------------- @@ -327,8 +329,8 @@ typedef struct fr_dlc_conf */ typedef struct fr502_intr_ctl { - unsigned char mode ; /* 00h: interrupt enable flags */ - unsigned short tx_len ; /* 01h: required Tx buffer size */ + unsigned char mode ; /* 00h: interrupt enable flags */ + unsigned short tx_len ; /* 01h: required Tx buffer size */ } fr502_intr_ctl_t; /*---------------------------------------------------------------------------- @@ -338,11 +340,11 @@ typedef struct fr502_intr_ctl */ typedef struct fr508_intr_ctl { - unsigned char mode ; /* 00h: interrupt enable flags */ - unsigned short tx_len ; /* 01h: required Tx buffer size */ - unsigned char irq ; /* 03h: IRQ level to activate */ - unsigned char flags ; /* 04h: ?? */ - unsigned short timeout ; /* 05h: ms, for timer interrupt */ + unsigned char mode ; /* 00h: interrupt enable flags */ + unsigned short tx_len ; /* 01h: required Tx buffer size */ + unsigned char irq ; /* 03h: IRQ level to activate */ + unsigned char flags ; /* 04h: ?? */ + unsigned short timeout ; /* 05h: ms, for timer interrupt */ } fr508_intr_ctl_t; /*---------------------------------------------------------------------------- @@ -351,12 +353,12 @@ typedef struct fr508_intr_ctl */ typedef struct fr_dlc_Status { - unsigned char status ; /* 00h: link/DLCI status */ + unsigned char status ; /* 00h: link/DLCI status */ struct { - unsigned short dlci ; /* 01h: DLCI number */ - unsigned char status ; /* 03h: DLCI status */ - } circuit[1] ; + unsigned short dlci ; /* 01h: DLCI number */ + unsigned char status ; /* 03h: DLCI status */ + } circuit[1] ; } fr_dlc_status_t; /* 'status' defines */ @@ -378,34 +380,34 @@ typedef struct fr_dlc_Status */ typedef struct fr_link_stat { - unsigned short rx_too_long ; /* 00h: */ - unsigned short rx_dropped ; /* 02h: */ - unsigned short rx_dropped2 ; /* 04h: */ - unsigned short rx_bad_dlci ; /* 06h: */ - unsigned short rx_bad_format ; /* 08h: */ - unsigned short retransmitted ; /* 0Ah: */ - unsigned short cpe_tx_FSE ; /* 0Ch: */ - unsigned short cpe_tx_LIV ; /* 0Eh: */ - unsigned short cpe_rx_FSR ; /* 10h: */ - unsigned short cpe_rx_LIV ; /* 12h: */ - unsigned short node_rx_FSE ; /* 14h: */ - unsigned short node_rx_LIV ; /* 16h: */ - unsigned short node_tx_FSR ; /* 18h: */ - unsigned short node_tx_LIV ; /* 1Ah: */ - unsigned short rx_ISF_err ; /* 1Ch: */ - unsigned short rx_unsolicited ; /* 1Eh: */ - unsigned short rx_SSN_err ; /* 20h: */ - unsigned short rx_RSN_err ; /* 22h: */ - unsigned short T391_timeouts ; /* 24h: */ - unsigned short T392_timeouts ; /* 26h: */ - unsigned short N392_reached ; /* 28h: */ - unsigned short cpe_SSN_RSN ; /* 2Ah: */ - unsigned short current_SSN ; /* 2Ch: */ - unsigned short current_RSN ; /* 2Eh: */ - unsigned short curreny_T391 ; /* 30h: */ - unsigned short current_T392 ; /* 32h: */ - unsigned short current_N392 ; /* 34h: */ - unsigned short current_N393 ; /* 36h: */ + unsigned short rx_too_long ; /* 00h: */ + unsigned short rx_dropped ; /* 02h: */ + unsigned short rx_dropped2 ; /* 04h: */ + unsigned short rx_bad_dlci ; /* 06h: */ + unsigned short rx_bad_format ; /* 08h: */ + unsigned short retransmitted ; /* 0Ah: */ + unsigned short cpe_tx_FSE ; /* 0Ch: */ + unsigned short cpe_tx_LIV ; /* 0Eh: */ + unsigned short cpe_rx_FSR ; /* 10h: */ + unsigned short cpe_rx_LIV ; /* 12h: */ + unsigned short node_rx_FSE ; /* 14h: */ + unsigned short node_rx_LIV ; /* 16h: */ + unsigned short node_tx_FSR ; /* 18h: */ + unsigned short node_tx_LIV ; /* 1Ah: */ + unsigned short rx_ISF_err ; /* 1Ch: */ + unsigned short rx_unsolicited ; /* 1Eh: */ + unsigned short rx_SSN_err ; /* 20h: */ + unsigned short rx_RSN_err ; /* 22h: */ + unsigned short T391_timeouts ; /* 24h: */ + unsigned short T392_timeouts ; /* 26h: */ + unsigned short N392_reached ; /* 28h: */ + unsigned short cpe_SSN_RSN ; /* 2Ah: */ + unsigned short current_SSN ; /* 2Ch: */ + unsigned short current_RSN ; /* 2Eh: */ + unsigned short curreny_T391 ; /* 30h: */ + unsigned short current_T392 ; /* 32h: */ + unsigned short current_N392 ; /* 34h: */ + unsigned short current_N393 ; /* 36h: */ } fr_link_stat_t; /*---------------------------------------------------------------------------- @@ -415,18 +417,18 @@ typedef struct fr_link_stat */ typedef struct fr_dlci_stat { - unsigned int tx_frames ; /* 00h: */ - unsigned int tx_bytes ; /* 04h: */ - unsigned int rx_frames ; /* 08h: */ - unsigned int rx_bytes ; /* 0Ch: */ - unsigned int rx_dropped ; /* 10h: */ - unsigned int rx_inactive ; /* 14h: */ - unsigned int rx_exceed_CIR ; /* 18h: */ - unsigned int rx_DE_set ; /* 1Ch: */ - unsigned int tx_throughput ; /* 20h: */ - unsigned int tx_calc_timer ; /* 24h: */ - unsigned int rx_throughput ; /* 28h: */ - unsigned int rx_calc_timer ; /* 2Ch: */ + unsigned int tx_frames ; /* 00h: */ + unsigned int tx_bytes ; /* 04h: */ + unsigned int rx_frames ; /* 08h: */ + unsigned int rx_bytes ; /* 0Ch: */ + unsigned int rx_dropped ; /* 10h: */ + unsigned int rx_inactive ; /* 14h: */ + unsigned int rx_exceed_CIR ; /* 18h: */ + unsigned int rx_DE_set ; /* 1Ch: */ + unsigned int tx_throughput ; /* 20h: */ + unsigned int tx_calc_timer ; /* 24h: */ + unsigned int rx_throughput ; /* 28h: */ + unsigned int rx_calc_timer ; /* 2Ch: */ } fr_dlci_stat_t; #endif @@ -436,15 +438,15 @@ typedef struct fr_dlci_stat */ typedef struct fr_comm_stat { - unsigned char rx_overruns ; /* 00h: */ - unsigned char rx_bad_crc ; /* 01h: */ - unsigned char rx_aborts ; /* 02h: */ - unsigned char rx_too_long ; /* 03h: */ - unsigned char tx_aborts ; /* 04h: */ - unsigned char tx_underruns ; /* 05h: */ - unsigned char tx_missed_undr ; /* 06h: */ - unsigned char dcd_dropped ; /* 07h: */ - unsigned char cts_dropped ; /* 08h: */ + unsigned char rx_overruns ; /* 00h: */ + unsigned char rx_bad_crc ; /* 01h: */ + unsigned char rx_aborts ; /* 02h: */ + unsigned char rx_too_long ; /* 03h: */ + unsigned char tx_aborts ; /* 04h: */ + unsigned char tx_underruns ; /* 05h: */ + unsigned char tx_missed_undr ; /* 06h: */ + unsigned char dcd_dropped ; /* 07h: */ + unsigned char cts_dropped ; /* 08h: */ } fr_comm_stat_t; /*---------------------------------------------------------------------------- @@ -459,15 +461,15 @@ typedef struct fr_comm_stat typedef struct arphdr_fr { - unsigned short ar_hrd ; /* format of hardware addr */ - unsigned short ar_pro ; /* format of protocol addr */ - unsigned char ar_hln ; /* length of hardware addr */ - unsigned char ar_pln ; /* length of protocol addr */ - unsigned short ar_op ; /* ARP opcode */ - unsigned short ar_sha ; /* Sender DLCI addr 2 bytes */ - unsigned int ar_sip ; /* Sender IP addr 4 bytes */ - unsigned short ar_tha ; /* Target DLCI addr 2 bytes */ - unsigned int ar_tip ; /* Target IP addr 4 bytes */ + unsigned short ar_hrd ; /* format of hardware addr */ + unsigned short ar_pro ; /* format of protocol addr */ + unsigned char ar_hln ; /* length of hardware addr */ + unsigned char ar_pln ; /* length of protocol addr */ + unsigned short ar_op ; /* ARP opcode */ + unsigned short ar_sha ; /* Sender DLCI addr 2 bytes */ + unsigned int ar_sip ; /* Sender IP addr 4 bytes */ + unsigned short ar_tha ; /* Target DLCI addr 2 bytes */ + unsigned int ar_tip ; /* Target IP addr 4 bytes */ } arphdr_fr_t; /*---------------------------------------------------------------------------- @@ -475,11 +477,11 @@ typedef struct arphdr_fr */ typedef struct arphdr_1490 { - unsigned char control ; /* UI, etc... */ - unsigned char pad ; /* Pad */ - unsigned char NLPID ; /* SNAP */ - unsigned char OUI[3] ; /* Ethertype, etc... */ - unsigned short PID ; /* ARP, IP, etc... */ + unsigned char control ; /* UI, etc... */ + unsigned char pad ; /* Pad */ + unsigned char NLPID ; /* SNAP */ + unsigned char OUI[3] ; /* Ethertype, etc... */ + unsigned short PID ; /* ARP, IP, etc... */ } arphdr_1490_t; /* valid ip_protocol for UDP management */ @@ -543,28 +545,28 @@ typedef struct { } drvstats_gen_t; typedef struct { - unsigned char attr ; - unsigned short time_stamp ; - unsigned char reserved[13] ; + unsigned char attr ; + unsigned short time_stamp ; + unsigned char reserved[13] ; } api_rx_hdr_t; typedef struct { - api_rx_hdr_t api_rx_hdr ; - void * data ; + api_rx_hdr_t api_rx_hdr ; + void * data ; } api_rx_element_t; typedef struct { - unsigned char attr ; - unsigned char reserved[15] ; + unsigned char attr ; + unsigned char reserved[15] ; } api_tx_hdr_t; typedef struct { - api_tx_hdr_t api_tx_hdr ; - void * data ; + api_tx_hdr_t api_tx_hdr ; + void * data ; } api_tx_element_t; -#pragma pack() +#pragma pack() #endif /* _SDLA_FR_H */ diff --git a/patches/kdrivers/include/sdla_front_end.h b/patches/kdrivers/include/sdla_front_end.h index 0b2944f..820a336 100644 --- a/patches/kdrivers/include/sdla_front_end.h +++ b/patches/kdrivers/include/sdla_front_end.h @@ -1,13 +1,14 @@ /* ************************************************************************************* * * - * FRNT_END.H - the 'C' header file for the Sangoma S508/S514 adapter front-end API. * + * sdla_front_end.h - the 'C' header file for the Sangoma S508/S514 adapter front-end API. * * * ************************************************************************************* */ #ifndef _SDLA_FRONT_END_H_ #define _SDLA_FRONT_END_H_ + /* ************************************************************************* * DEFINES AND MACROS * @@ -23,6 +24,8 @@ #define WAN_MEDIA_STS1 0x06 #define WAN_MEDIA_J1 0x07 #define WAN_MEDIA_FXOFXS 0x08 +#define WAN_MEDIA_BRI 0x09 +#define WAN_MEDIA_SERIAL 0x0A /*The line code */ #define WAN_LCODE_NONE 0x00 @@ -42,19 +45,26 @@ #define WAN_FR_E3_G751 0x07 #define WAN_FR_E3_G832 0x08 #define WAN_FR_DS3_Cbit 0x09 -#define WAN_FR_DS3_M13 0x10 +#define WAN_FR_DS3_M13 0x0A +#define WAN_FR_SLC96 0x0B /* Clocking Master/Normal */ #define WAN_NORMAL_CLK 0x01 #define WAN_MASTER_CLK 0x02 +/* Serial Card FE options */ +#define WAN_FE_V35 0x01 +#define WAN_FE_RS232 0x02 + /* Front-End DEBUG flags */ -#define WAN_FE_DEBUG_NONE 0x00 -#define WAN_FE_DEBUG_RBS 0x01 -#define WAN_FE_DEBUG_ALARM 0x02 -#define WAN_FE_DEBUG_VOLTAGE 0x03 -#define WAN_FE_DEBUG_RECONFIG 0x04 -#define WAN_FE_DEBUG_REG 0x05 +#define WAN_FE_DEBUG_NONE 0x00 +#define WAN_FE_DEBUG_RBS 0x01 +#define WAN_FE_DEBUG_ALARM 0x02 +#define WAN_FE_DEBUG_VOLTAGE 0x03 +#define WAN_FE_DEBUG_RECONFIG 0x04 +#define WAN_FE_DEBUG_REG 0x05 +#define WAN_FE_DEBUG_CONFIG_VERIFY 0x06 +#define WAN_FE_DEBUG_HOOK 0x07 /* Front-End DEBUG sub-flags */ /* Sub-flags for RBS debugging */ @@ -134,8 +144,10 @@ #define IS_TE1_56K_MEDIA(fe_cfg)(IS_TE1_MEDIA(fe_cfg) || \ IS_56K_MEDIA(fe_cfg) #define IS_DS3_MEDIA(fe_cfg) (FE_MEDIA(fe_cfg) == WAN_MEDIA_DS3) -#define IS_E3_MEDIA(fe_cfg) (FE_MEDIA(fe_cfg) == WAN_MEDIA_E3) +#define IS_E3_MEDIA(fe_cfg) (FE_MEDIA(fe_cfg) == WAN_MEDIA_E3) #define IS_FXOFXS_MEDIA(fe_cfg) (FE_MEDIA(fe_cfg) == WAN_MEDIA_FXOFXS) +#define IS_BRI_MEDIA(fe_cfg) (FE_MEDIA(fe_cfg) == WAN_MEDIA_BRI) +#define IS_SERIAL_MEDIA(fe_cfg) (FE_MEDIA(fe_cfg) == WAN_MEDIA_SERIAL) #define IS_TXTRISTATE(fe_cfg) (FE_TXTRISTATE(fe_cfg) == WANOPT_YES) @@ -151,6 +163,8 @@ (FE_MEDIA(fe_cfg) == WAN_MEDIA_DS3) ? "DS3" : \ (FE_MEDIA(fe_cfg) == WAN_MEDIA_E3) ? "E3" : \ (FE_MEDIA(fe_cfg) == WAN_MEDIA_FXOFXS) ? "FXO/FXS" : \ + (FE_MEDIA(fe_cfg) == WAN_MEDIA_BRI) ? "BRI" : \ + (FE_MEDIA(fe_cfg) == WAN_MEDIA_SERIAL) ? "V35/RS232" : \ "Unknown" #define LCODE_DECODE(fe_cfg) \ @@ -168,7 +182,8 @@ (FE_FRAME(fe_cfg) == WAN_FR_E3_G751) ? "G.751" : \ (FE_FRAME(fe_cfg) == WAN_FR_E3_G832) ? "G.832" : \ (FE_FRAME(fe_cfg) == WAN_FR_DS3_Cbit) ? "C-bit" : \ - (FE_FRAME(fe_cfg) == WAN_FR_DS3_M13) ? "M13" : "Unknown" + (FE_FRAME(fe_cfg) == WAN_FR_DS3_M13) ? "M13" : \ + (FE_FRAME(fe_cfg) == WAN_FR_SLC96) ? "SLC-96" : "Unknown" @@ -187,21 +202,20 @@ typedef struct { unsigned int line_no; unsigned char tx_tristate_mode; unsigned int tdmv_law; - unsigned char poll_mode; /* enable fe poll driven arch */ + unsigned char poll_mode; union { sdla_te_cfg_t te_cfg; sdla_te3_cfg_t te3_cfg; sdla_remora_cfg_t remora; + sdla_bri_cfg_t bri; } cfg; } sdla_fe_cfg_t; typedef struct { - unsigned int alarms; - unsigned int liu_alarms; - unsigned int bert_alarms; + u_int32_t alarms; union { sdla_te_stats_t te1_stats; - //sdla_te_pmon_t te_pmon; + /*sdla_te_pmon_t te_pmon;*/ sdla_te3_pmon_t te3_pmon; } u; #define te_pmon u.te1_stats.pmon @@ -210,6 +224,7 @@ typedef struct { typedef struct { unsigned char type; unsigned char mode; + int mod_no; /* A200/A400 */ union{ struct { int channel; @@ -220,12 +235,24 @@ typedef struct { int reg; unsigned char value; } reg; + struct { + int offhook; + }hook; } fe_debug_un; #define fe_debug_rbs fe_debug_un.rbs #define fe_debug_reg fe_debug_un.reg +#define fe_debug_hook fe_debug_un.hook } sdla_fe_debug_t; +/* Front-End status */ +#define FE_STATUS_DECODE(fe_status) \ + (fe_status == FE_DISCONNECTED) ? "disconnected" :\ + (fe_status == FE_CONNECTED) ? "connected" : \ + "unknown" + +#define WAN_FE_STATUS_DECODE(fe) FE_STATUS_DECODE((fe)->fe_status) + #ifdef WAN_KERNEL #define FE_ASSERT(val) if (val) return; @@ -242,6 +269,8 @@ typedef struct { #define IS_FXOFXS_FEMEDIA(fe) IS_FXOFXS_MEDIA(&((fe)->fe_cfg)) #define IS_FE_TXTRISTATE(fe) IS_TXTRISTATE(&((fe)->fe_cfg)) #define IS_FR_FEUNFRAMED(fe) IS_FR_UNFRAMED(&((fe)->fe_cfg)) +#define IS_BRI_FEMEDIA(fe) IS_BRI_MEDIA(&((fe)->fe_cfg)) +#define IS_SERIAL_FEMEDIA(fe) IS_SERIAL_MEDIA(&((fe)->fe_cfg)) #define WAN_FE_MEDIA(fe) FE_MEDIA(&((fe)->fe_cfg)) #define WAN_FE_LCODE(fe) FE_LCODE(&((fe)->fe_cfg)) @@ -254,15 +283,16 @@ typedef struct { #define FE_LCODE_DECODE(fe) LCODE_DECODE(&((fe)->fe_cfg)) #define FE_FRAME_DECODE(fe) FRAME_DECODE(&((fe)->fe_cfg)) +#define WAN_FE_START_CHANNEL(fe) \ + (IS_TE1_FEMEDIA(fe)) ? GET_TE_START_CHANNEL(fe) : \ + (IS_FXOFXS_FEMEDIA(fe)) ? WAN_RM_START_CHANNEL: \ + (IS_BRI_FEMEDIA(fe)) ? WAN_BRI_START_CHANNEL: 0 + #define WAN_FE_MAX_CHANNELS(fe) \ (IS_TE1_FEMEDIA(fe)) ? GET_TE_CHANNEL_RANGE(fe) : \ - (IS_FXOFXS_FEMEDIA(fe)) ? MAX_FXOFXS_CHANNELS : 0 + (IS_FXOFXS_FEMEDIA(fe)) ? MAX_FXOFXS_CHANNELS : \ + (IS_BRI_FEMEDIA(fe)) ? MAX_BRI_CHANNELS : 0 -/* Front-End status */ -#define WAN_FE_STATUS_DECODE(fe) \ - ((fe)->fe_status == FE_DISCONNECTED) ? "disconnected" :\ - ((fe)->fe_status == FE_CONNECTED) ? "connected" : \ - "unknown" #if 0 enum fe_status { FE_UNITIALIZED = 0x00, @@ -390,7 +420,7 @@ typedef struct sdla_fe_timer_event_ { WAN_LIST_ENTRY(sdla_fe_timer_event_) next; } sdla_fe_timer_event_t; -#define WAN_FE_MAX_QEVENT_LEN 20 +#define WAN_FE_MAX_QEVENT_LEN 20 typedef struct { char *name; void *card; @@ -406,21 +436,25 @@ typedef struct { #define te_param fe_param.te #define te3_param fe_param.te3 #define rm_param fe_param.remora +#define bri_param fe_param.bri sdla_te_param_t te; sdla_56k_param_t k56_param; sdla_te3_param_t te3; sdla_remora_param_t remora; + sdla_bri_param_t bri; } fe_param; -#define fe_alarm fe_stats.alarms -#define liu_alarm fe_stats.liu_alarms -#define bert_alarm fe_stats.bert_alarms - sdla_fe_stats_t fe_stats; +#define fe_alarm fe_stats.alarms + sdla_fe_stats_t fe_stats; - wan_spinlock_t lock; + wan_spinlock_t lockirq; wan_timer_t timer; +#if defined(__WINDOWS__) + WAN_LIST_HEAD(fe_timer_event_list_head, sdla_fe_timer_event_) event; +#else WAN_LIST_HEAD(, sdla_fe_timer_event_) event; - unsigned int event_map; - +#endif + unsigned int event_map; + int (*write_cpld)(void*, unsigned short, unsigned char); int (*read_cpld)(void*, unsigned short, unsigned char); int (*write_fe_cpld)(void*, unsigned short, unsigned char); @@ -477,9 +511,10 @@ typedef struct { int (*if_unconfig)(void *fe, u32, u8); int (*disable_irq)(void *fe); int (*polling)(sdla_fe_t *fe); + int (*add_timer)(sdla_fe_t *fe, unsigned long); int (*isr)(sdla_fe_t *fe); int (*process_udp)(sdla_fe_t *fe, void*, unsigned char*); - unsigned int (*read_alarm)(sdla_fe_t *fe, int); + u_int32_t (*read_alarm)(sdla_fe_t *fe, int); int (*read_pmon)(sdla_fe_t *fe, int); int (*flush_pmon)(sdla_fe_t *fe); /* Set Front-End alarm (T1/E1) */ @@ -490,8 +525,10 @@ typedef struct { char* (*print_fe_act_channels)(sdla_fe_t*); /* Print Front-End alarm (T1/E1/56K) */ int (*print_fe_alarm)(sdla_fe_t*,unsigned int); - /* Get front end status */ + /* Get front end status: Connected/Disconnected */ int (*get_fe_status)(sdla_fe_t *fe, unsigned char*); + /* Set front end status: Connected/Disconnected only ISDN BRI */ + int (*set_fe_status)(sdla_fe_t *fe, unsigned char); /* Get front end media type */ unsigned char (*get_fe_media)(sdla_fe_t *fe); /* Get front end media type string */ @@ -499,9 +536,9 @@ typedef struct { /* Set Line-loopback modes */ int (*set_fe_lbmode)(sdla_fe_t*, unsigned char, unsigned char); /* Update Alarm Status for proc file system */ - int (*update_alarm_info)(sdla_fe_t*, struct seq_file* m, int* stop_cnt); + int (*update_alarm_info)(sdla_fe_t*, struct seq_file*, int*); /* Update PMON Status for proc file system */ - int (*update_pmon_info)(sdla_fe_t*, struct seq_file* m, int* stop_cnt); + int (*update_pmon_info)(sdla_fe_t*, struct seq_file*, int*); /* AFT T1/E1 cards only */ int (*led_ctrl)(sdla_fe_t*, int mode); /* Check RBS bits (T1/E1 cards) */ @@ -521,7 +558,10 @@ typedef struct { void (*enable_timer)(sdla_fe_t* fe, unsigned char cmd, unsigned int delay); #endif /* Available front-end map */ - unsigned int (*active_map)(sdla_fe_t *fe); + /* BRI addition - one Wanpipe may have two lines, provide the 'line_no' when + getting the active channels map. + */ + unsigned int (*active_map)(sdla_fe_t *fe, unsigned char line_no); /* Transmit DTMF number */ int (*set_dtmf)(sdla_fe_t*, int, unsigned char); /* Enable/Disable FE interrupt */ @@ -530,6 +570,11 @@ typedef struct { int (*event_ctrl)(sdla_fe_t*, wan_event_ctrl_t*); /* Front-End watchdog */ int (*watchdog)(sdla_fe_t*); + /* Transmit ISDN BRI D-chan data */ + int (*isdn_bri_dchan_tx)(sdla_fe_t*, void*, unsigned int); + /* Receive ISDN BRI D-chan data */ + int (*isdn_bri_dchan_rx)(sdla_fe_t*, void*, unsigned int); + } sdla_fe_iface_t; /* diff --git a/patches/kdrivers/include/sdla_front_end.h~ b/patches/kdrivers/include/sdla_front_end.h~ deleted file mode 100644 index 8dba5c0..0000000 --- a/patches/kdrivers/include/sdla_front_end.h~ +++ /dev/null @@ -1,547 +0,0 @@ -/* - ************************************************************************************* - * * - * FRNT_END.H - the 'C' header file for the Sangoma S508/S514 adapter front-end API. * - * * - ************************************************************************************* -*/ -#ifndef _SDLA_FRONT_END_H_ -#define _SDLA_FRONT_END_H_ - -/* -************************************************************************* -* DEFINES AND MACROS * -************************************************************************* -*/ -/* Front-End media type */ -#define WAN_MEDIA_NONE 0x00 -#define WAN_MEDIA_T1 0x01 -#define WAN_MEDIA_E1 0x02 -#define WAN_MEDIA_56K 0x03 -#define WAN_MEDIA_DS3 0x04 -#define WAN_MEDIA_E3 0x05 -#define WAN_MEDIA_STS1 0x06 -#define WAN_MEDIA_J1 0x07 -#define WAN_MEDIA_FXOFXS 0x08 - -/*The line code */ -#define WAN_LCODE_NONE 0x00 -#define WAN_LCODE_AMI 0x01 /* T1/E1/DS3/E3 */ -#define WAN_LCODE_B8ZS 0x02 /* T1 */ -#define WAN_LCODE_HDB3 0x03 /* E1/E3 */ -#define WAN_LCODE_B3ZS 0x04 /* DS3 */ - -/* Framing modes */ -#define WAN_FR_NONE 0x00 -#define WAN_FR_ESF 0x01 -#define WAN_FR_D4 0x02 -#define WAN_FR_ESF_JAPAN 0x03 -#define WAN_FR_CRC4 0x04 -#define WAN_FR_NCRC4 0x05 -#define WAN_FR_UNFRAMED 0x06 -#define WAN_FR_E3_G751 0x07 -#define WAN_FR_E3_G832 0x08 -#define WAN_FR_DS3_Cbit 0x09 -#define WAN_FR_DS3_M13 0x10 - -/* Clocking Master/Normal */ -#define WAN_NORMAL_CLK 0x01 -#define WAN_MASTER_CLK 0x02 - -/* Front-End DEBUG flags */ -#define WAN_FE_DEBUG_NONE 0x00 -#define WAN_FE_DEBUG_RBS 0x01 -#define WAN_FE_DEBUG_ALARM 0x02 -#define WAN_FE_DEBUG_VOLTAGE 0x03 -#define WAN_FE_DEBUG_RECONFIG 0x04 -#define WAN_FE_DEBUG_REG 0x05 - -/* Front-End DEBUG sub-flags */ -/* Sub-flags for RBS debugging */ -#define WAN_FE_DEBUG_RBS_RX_ENABLE 0x01 -#define WAN_FE_DEBUG_RBS_TX_ENABLE 0x02 -#define WAN_FE_DEBUG_RBS_RX_DISABLE 0x03 -#define WAN_FE_DEBUG_RBS_TX_DISABLE 0x04 -#define WAN_FE_DEBUG_RBS_READ 0x05 -#define WAN_FE_DEBUG_RBS_SET 0x06 -#define WAN_FE_DEBUG_RBS_PRINT 0x07 -#define WAN_FE_DEBUG_RBS_DECODE(mode) \ - ((mode) == WAN_FE_DEBUG_RBS_RX_ENABLE) ? "Enable RBS RX" : \ - ((mode) == WAN_FE_DEBUG_RBS_TX_ENABLE) ? "Enable RBS TX" : \ - ((mode) == WAN_FE_DEBUG_RBS_RX_DISABLE) ? "Disable RBS RX" : \ - ((mode) == WAN_FE_DEBUG_RBS_TX_DISABLE) ? "Disable RBS TX" : \ - ((mode) == WAN_FE_DEBUG_RBS_READ) ? "Read RBS" : \ - ((mode) == WAN_FE_DEBUG_RBS_SET) ? "Set RBS" : \ - ((mode) == WAN_FE_DEBUG_RBS_PRINT) ? "Print RBS" : "Unknown" - -/* Sub-flags for ALARM debugging */ -#define WAN_FE_DEBUG_ALARM_AIS_ENABLE 0x01 -#define WAN_FE_DEBUG_ALARM_AIS_DISABLE 0x02 -#define WAN_FE_DEBUG_ALARM_DECODE(mode) \ - ((mode) == WAN_FE_DEBUG_ALARM_AIS_ENABLE) ? "Enable TX AIS" : \ - ((mode) == WAN_FE_DEBUG_ALARM_AIS_DISABLE) ? "Disable TX AIS" : \ - "Unknown" - -/* Front-End TX tri-state mode flags */ -#define WAN_FE_TXMODE_ENABLE 0x01 -#define WAN_FE_TXMODE_DISABLE 0x02 - -/* Read alarm flag */ -#define WAN_FE_ALARM_NONE 0x00 -#define WAN_FE_ALARM_READ 0x01 -#define WAN_FE_ALARM_PRINT 0x02 -#define WAN_FE_ALARM_UPDATE 0x04 -#define IS_FE_ALARM_READ(action) ((action) & WAN_FE_ALARM_READ) -#define IS_FE_ALARM_PRINT(action) ((action) & WAN_FE_ALARM_PRINT) -#define IS_FE_ALARM_UPDATE(action) ((action) & WAN_FE_ALARM_UPDATE) - -/* Read pmon flag */ -#define WAN_FE_PMON_UPDATE 0x01 -#define WAN_FE_PMON_PRINT 0x02 -#define WAN_FE_PMON_READ 0x04 -#define IS_FE_PMON_UPDATE(action) ((action) & WAN_FE_PMON_UPDATE) -#define IS_FE_PMON_PRINT(action) ((action) & WAN_FE_PMON_PRINT) -#define IS_FE_PMON_READ(action) ((action) & WAN_FE_PMON_READ) - -/* FE interrupt action command */ -#define WAN_FE_INTR_ENABLE 0x01 -#define WAN_FE_INTR_MASK 0x02 - -/* FE event action command */ -#define WAN_FE_EVENT_ENABLE 0x01 -#define WAN_FE_EVENT_MASK 0x02 - -/* Alaw/Mulaw */ -#define WAN_TDMV_ALAW 0x01 -#define WAN_TDMV_MULAW 0x02 - -#define FE_MEDIA(fe_cfg) ((fe_cfg)->media) -#define FE_SUBMEDIA(fe_cfg) ((fe_cfg)->sub_media) -#define FE_LCODE(fe_cfg) ((fe_cfg)->lcode) -#define FE_FRAME(fe_cfg) ((fe_cfg)->frame) -#define FE_LINENO(fe_cfg) ((fe_cfg)->line_no) -#define FE_TXTRISTATE(fe_cfg) ((fe_cfg)->tx_tristate_mode) -#define FE_TDMV_LAW(fe_cfg) ((fe_cfg)->tdmv_law) - -#define IS_T1_MEDIA(fe_cfg) (FE_MEDIA(fe_cfg) == WAN_MEDIA_T1) -#define IS_E1_MEDIA(fe_cfg) (FE_MEDIA(fe_cfg) == WAN_MEDIA_E1) -#define IS_J1_MEDIA(fe_cfg) (FE_MEDIA(fe_cfg) == WAN_MEDIA_T1 && \ - FE_SUBMEDIA(fe_cfg) == WAN_MEDIA_J1) -#define IS_TE1_MEDIA(fe_cfg) (IS_T1_MEDIA(fe_cfg) || \ - IS_E1_MEDIA(fe_cfg) || \ - IS_J1_MEDIA(fe_cfg)) -#define IS_56K_MEDIA(fe_cfg) (FE_MEDIA(fe_cfg) == WAN_MEDIA_56K) -#define IS_TE1_56K_MEDIA(fe_cfg)(IS_TE1_MEDIA(fe_cfg) || \ - IS_56K_MEDIA(fe_cfg) -#define IS_DS3_MEDIA(fe_cfg) (FE_MEDIA(fe_cfg) == WAN_MEDIA_DS3) -#define IS_E3_MEDIA(fe_cfg) (FE_MEDIA(fe_cfg) == WAN_MEDIA_E3) -#define IS_FXOFXS_MEDIA(fe_cfg) (FE_MEDIA(fe_cfg) == WAN_MEDIA_FXOFXS) - -#define IS_TXTRISTATE(fe_cfg) (FE_TXTRISTATE(fe_cfg) == WANOPT_YES) - -#define IS_FR_UNFRAMED(fe_cfg) (FE_FRAME(fe_cfg) == WAN_FR_UNFRAMED) - -#define MEDIA_DECODE(fe_cfg) \ - (FE_MEDIA(fe_cfg) == WAN_MEDIA_T1 && \ - FE_SUBMEDIA(fe_cfg)==WAN_MEDIA_J1)?"J1" : \ - (FE_MEDIA(fe_cfg) == WAN_MEDIA_T1) ? "T1" : \ - (FE_MEDIA(fe_cfg) == WAN_MEDIA_E1) ? "E1" : \ - (FE_MEDIA(fe_cfg) == WAN_MEDIA_J1) ? "J1" : \ - (FE_MEDIA(fe_cfg) == WAN_MEDIA_56K) ? "56K" : \ - (FE_MEDIA(fe_cfg) == WAN_MEDIA_DS3) ? "DS3" : \ - (FE_MEDIA(fe_cfg) == WAN_MEDIA_E3) ? "E3" : \ - (FE_MEDIA(fe_cfg) == WAN_MEDIA_FXOFXS) ? "FXO/FXS" : \ - "Unknown" - -#define LCODE_DECODE(fe_cfg) \ - (FE_LCODE(fe_cfg) == WAN_LCODE_AMI) ? "AMI" : \ - (FE_LCODE(fe_cfg) == WAN_LCODE_B8ZS) ? "B8ZS" : \ - (FE_LCODE(fe_cfg) == WAN_LCODE_HDB3) ? "HDB3" : \ - (FE_LCODE(fe_cfg) == WAN_LCODE_B3ZS) ? "B3ZS" : "Unknown" - -#define FRAME_DECODE(fe_cfg) \ - (FE_FRAME(fe_cfg) == WAN_FR_ESF) ? "ESF" : \ - (FE_FRAME(fe_cfg) == WAN_FR_D4) ? "D4" : \ - (FE_FRAME(fe_cfg) == WAN_FR_CRC4) ? "CRC4" : \ - (FE_FRAME(fe_cfg) == WAN_FR_NCRC4) ? "non-CRC4" : \ - (FE_FRAME(fe_cfg) == WAN_FR_UNFRAMED) ? "Unframed" : \ - (FE_FRAME(fe_cfg) == WAN_FR_E3_G751) ? "G.751" : \ - (FE_FRAME(fe_cfg) == WAN_FR_E3_G832) ? "G.832" : \ - (FE_FRAME(fe_cfg) == WAN_FR_DS3_Cbit) ? "C-bit" : \ - (FE_FRAME(fe_cfg) == WAN_FR_DS3_M13) ? "M13" : "Unknown" - - - -/* front-end configuration and access interface commands */ -#define READ_FRONT_END_REGISTER (WAN_FE_CMD_START+0) /* 0x90 read from front-end register */ -#define WRITE_FRONT_END_REGISTER (WAN_FE_CMD_START+1) /* 0x91 write to front-end register */ -#define READ_FRONT_END_STATISTICS (WAN_FE_CMD_START+2) /* 0x92 read the front-end statistics */ -#define FLUSH_FRONT_END_STATISTICS (WAN_FE_CMD_START+3) /* 0x93 flush the front-end statistics */ - - -typedef struct { - unsigned char media; - unsigned char sub_media; - unsigned char lcode; - unsigned char frame; - unsigned int line_no; - unsigned char tx_tristate_mode; - unsigned int tdmv_law; - unsigned char poll_mode; /* enable fe poll driven arch */ - union { - sdla_te_cfg_t te_cfg; - sdla_te3_cfg_t te3_cfg; - sdla_remora_cfg_t remora; - } cfg; -} sdla_fe_cfg_t; - -typedef struct { - unsigned int alarms; - unsigned int liu_alarms; - unsigned int bert_alarms; - union { - sdla_te_stats_t te1_stats; - //sdla_te_pmon_t te_pmon; - sdla_te3_pmon_t te3_pmon; - } u; -#define te_pmon u.te1_stats.pmon -} sdla_fe_stats_t; - -typedef struct { - unsigned char type; - unsigned char mode; - union{ - struct { - int channel; - unsigned char abcd; - } rbs; - struct { - int read; - int reg; - unsigned char value; - } reg; - } fe_debug_un; -#define fe_debug_rbs fe_debug_un.rbs -#define fe_debug_reg fe_debug_un.reg -} sdla_fe_debug_t; - - -#ifdef WAN_KERNEL - -#define FE_ASSERT(val) if (val) return; -#define FE_ASSERT1(val) if (val) return 1; - -#define WAN_FECALL(dev, func, x) \ - ((dev)->fe_iface.func) ? (dev)->fe_iface.func x : -EINVAL - -#define IS_T1_FEMEDIA(fe) IS_T1_MEDIA(&((fe)->fe_cfg)) -#define IS_E1_FEMEDIA(fe) IS_E1_MEDIA(&((fe)->fe_cfg)) -#define IS_TE1_FEMEDIA(fe) IS_TE1_MEDIA(&((fe)->fe_cfg)) -#define IS_56K_FEMEDIA(fe) IS_56K_MEDIA(&((fe)->fe_cfg)) -#define IS_J1_FEMEDIA(fe) IS_J1_MEDIA(&((fe)->fe_cfg)) -#define IS_FXOFXS_FEMEDIA(fe) IS_FXOFXS_MEDIA(&((fe)->fe_cfg)) -#define IS_FE_TXTRISTATE(fe) IS_TXTRISTATE(&((fe)->fe_cfg)) -#define IS_FR_FEUNFRAMED(fe) IS_FR_UNFRAMED(&((fe)->fe_cfg)) - -#define WAN_FE_MEDIA(fe) FE_MEDIA(&((fe)->fe_cfg)) -#define WAN_FE_LCODE(fe) FE_LCODE(&((fe)->fe_cfg)) -#define WAN_FE_FRAME(fe) FE_FRAME(&((fe)->fe_cfg)) -#define WAN_FE_LINENO(fe) FE_LINENO(&((fe)->fe_cfg)) -#define WAN_FE_TXTRISTATE(fe) FE_TXTRISTATE(&((fe)->fe_cfg)) -#define WAN_FE_TDMV_LAW(fe) FE_TDMV_LAW(&((fe)->fe_cfg)) - -#define FE_MEDIA_DECODE(fe) MEDIA_DECODE(&((fe)->fe_cfg)) -#define FE_LCODE_DECODE(fe) LCODE_DECODE(&((fe)->fe_cfg)) -#define FE_FRAME_DECODE(fe) FRAME_DECODE(&((fe)->fe_cfg)) - -#define WAN_FE_MAX_CHANNELS(fe) \ - (IS_TE1_FEMEDIA(fe)) ? GET_TE_CHANNEL_RANGE(fe) : \ - (IS_FXOFXS_FEMEDIA(fe)) ? MAX_FXOFXS_CHANNELS : 0 - -/* Front-End status */ -#define WAN_FE_STATUS_DECODE(fe) \ - ((fe)->fe_status == FE_DISCONNECTED) ? "disconnected" :\ - ((fe)->fe_status == FE_CONNECTED) ? "connected" : \ - "unknown" -#if 0 -enum fe_status { - FE_UNITIALIZED = 0x00, - FE_DISCONNECTED, - FE_CONNECTED -}; -#endif - -/* adapter configuration interface commands */ -#define SET_ADAPTER_CONFIGURATION (WAN_INTERFACE_CMD_START+0) /* 0xA0 set adapter configuration */ -#define READ_ADAPTER_CONFIGURATION (WAN_INTERFACE_CMD_START+1) /* 0xA1 read adapter configuration */ - -/* return codes from interface commands */ -#define LGTH_FE_CFG_DATA_INVALID 0x91 /* the length of the FE_RX_DISC_TX_IDLE_STRUCT is invalid */ -#define LGTH_ADAPTER_CFG_DATA_INVALID 0x91 /* the length of the passed configuration data is invalid */ -#define INVALID_FE_CFG_DATA 0x92 /* the passed SET_FE_RX_DISC_TX_IDLE_CFG data is invalid */ -#define ADPTR_OPERATING_FREQ_INVALID 0x92 /* an invalid adapter operating frequency was selected */ -#define PROT_CFG_BEFORE_FE_CFG 0x93 /* set the protocol-level configuration before setting the FE configuration */ - -#define SET_FE_RX_DISC_TX_IDLE_CFG 0x98 /* set the front-end Rx discard/Tx idle configuration */ -#define READ_FE_RX_DISC_TX_IDLE_CFG 0x99 /* read the front-end Rx discard/Tx idle configuration */ -#define SET_TE1_SIGNALING_CFG 0x9A /* set the T1/E1 signaling configuration */ -#define READ_TE1_SIGNALING_CFG 0x9B /* read the T1/E1 signaling configuration */ - - -#define COMMAND_INVALID_FOR_ADAPTER 0x9F /* the command is invalid for the adapter type */ - - -/* --------------------------------------------------------------------------------- - * Constants for the SET_FE_RX_DISC_TX_IDLE_CFG/READ_FE_RX_DISC_TX_IDLE_CFG commands - * --------------------------------------------------------------------------------*/ - -#define NO_ACTIVE_RX_TIME_SLOTS_T1 24 /* T1 - no active time slots used for reception */ -#define NO_ACTIVE_TX_TIME_SLOTS_T1 24 /* T1 - no active time slots used for transmission */ -#define NO_ACTIVE_RX_TIME_SLOTS_E1 32 /* E1 - no active time slots used for reception */ -#define NO_ACTIVE_TX_TIME_SLOTS_E1 31 /* E1 - no active time slots used for transmission (channel 0 reserved for framing) */ - -/* the structure used for the SET_FE_RX_DISC_TX_IDLE_CFG/READ_FE_RX_DISC_TX_IDLE_CFG command */ -#pragma pack(1) -typedef struct { - unsigned short lgth_Rx_disc_bfr; /* the length of the Rx discard buffer */ - unsigned short lgth_Tx_idle_bfr; /* the length of the Tx idle buffer */ - /* the transmit idle data buffer */ - unsigned char Tx_idle_data_bfr[NO_ACTIVE_TX_TIME_SLOTS_E1]; -} FE_RX_DISC_TX_IDLE_STRUCT; -#pragma pack() - - -/* ---------------------------------------------------------------------------- - * Constants for front-end access - * --------------------------------------------------------------------------*/ - -/* the structure used for the READ_FRONT_END_REGISTER/WRITE_FRONT_END_REGISTER command */ -#pragma pack(1) -typedef struct { - unsigned short register_number; /* the register number to be read from or written to */ - unsigned char register_value; /* the register value read/written */ -} FRONT_END_REG_STRUCT; -#pragma pack() - -#pragma pack(1) -typedef struct { - unsigned char opp_flag; /* opp flag */ - - union { - struct { - unsigned char RR8_56k; /* register #8 value - 56K CSU/DSU */ - unsigned char RR9_56k; /* register #9 value - 56K CSU/DSU */ - unsigned char RRA_56k; /* register #A value - 56K CSU/DSU */ - unsigned char RRB_56k; /* register #B value - 56K CSU/DSU */ - unsigned char RRC_56k; /* register #C value - 56K CSU/DSU */ - } stat_56k; - } FE_U; - -} FRONT_END_STATUS_STRUCT; -#pragma pack() - - -/* ----------------------------------------------------------------------------- - * Constants for the READ_FRONT_END_STATISTICS command - * ---------------------------------------------------------------------------*/ - -/* the front-end statistics structure */ -#pragma pack(1) -typedef struct { - unsigned int FE_interrupt_count; /* the number of front-end interrupts generated */ - unsigned int FE_app_timeout_count; /* the number of front-end interrupt application timeouts */ -} FE_STATISTICS_STRUCT; -#pragma pack() - - - -/* -------------------------------------------------------------------------------- - * Constants for the SET_ADAPTER_CONFIGURATION/READ_ADAPTER_CONFIGURATION commands - * -------------------------------------------------------------------------------*/ - -/* the adapter configuration structure */ -#pragma pack(1) -typedef struct { - unsigned short adapter_type; /* type of adapter */ - unsigned short adapter_config; /* miscellaneous adapter configuration options */ - unsigned int operating_frequency; /* adapter operating frequency */ -} ADAPTER_CONFIGURATION_STRUCT; -#pragma pack() - -typedef int (WRITE_FRONT_END_REG_T)(void*, ...); -typedef unsigned char (READ_FRONT_END_REG_T)(void*, ...); - -enum { - AFT_LED_ON, - AFT_LED_OFF, - AFT_LED_TOGGLE -}; - -typedef struct sdla_fe_timer_event_ { - unsigned char type; - u_int8_t mode; - int delay; - union{ -#define te_event u_fe.te -#define rm_event u_fe.rm - sdla_te_event_t te; - sdla_rm_event_t rm; - } u_fe; - WAN_LIST_ENTRY(sdla_fe_timer_event_) next; -} sdla_fe_timer_event_t; - -#define WAN_FE_MAX_QEVENT_LEN 20 -typedef struct { - char *name; - void *card; - sdla_fe_cfg_t fe_cfg; - /* FIXME: Remove the following parameters from wandev_t */ - unsigned char fe_status; -/* unsigned int fe_alarm; */ - unsigned char fe_chip_id; - unsigned char fe_max_ports; - unsigned char fe_debug; - /* ^^^ */ - union { -#define te_param fe_param.te -#define te3_param fe_param.te3 -#define rm_param fe_param.remora - sdla_te_param_t te; - sdla_56k_param_t k56_param; - sdla_te3_param_t te3_param; - sdla_remora_param_t remora; - } fe_param; -#define fe_alarm fe_stats.alarms -#define liu_alarm fe_stats.liu_alarms -#define bert_alarm fe_stats.bert_alarms - sdla_fe_stats_t fe_stats; - - wan_spinlock_t lock; - wan_timer_t timer; - WAN_LIST_HEAD(, sdla_fe_timer_event_) event; - unsigned int event_map; - - int (*write_cpld)(void*, unsigned short, unsigned char); - int (*read_cpld)(void*, unsigned short, unsigned char); - int (*write_fe_cpld)(void*, unsigned short, unsigned char); - int (*read_fe_cpld)(void*, unsigned short, unsigned char); - int (*write_framer)(void*,unsigned short,unsigned short); - unsigned int (*read_framer)(void*,unsigned short); - WRITE_FRONT_END_REG_T *write_fe_reg; - READ_FRONT_END_REG_T *read_fe_reg; - READ_FRONT_END_REG_T *__read_fe_reg; -#if defined(__WINDOWS__) - int remora_modules_counter;/* set in wp_remora_config() */ -#endif -} sdla_fe_t; - -/* -** Sangoma Front-End interface structure -*/ -#if 0 -typedef struct { - /* In-Service or Not (T1/E1/56K) */ - unsigned int (*get_fe_service_status)(void*); - /* Print Front-End alarm (T1/E1/56K) */ - void (*print_fe_alarm)(void*,unsigned int); - /* Print Front-End alarm (T1/E1/56K) */ - char* (*print_fe_act_channels)(void*); - /* Set Front-End alarm (T1/E1) */ - void (*set_fe_alarm)(void*,unsigned int); - /* Set extra interrupt type (after link get connected)) */ - int (*set_fe_sigcfg)(void*, unsigned int); -} sdla_fe_iface_t; -#endif - -#if defined(__LINUX__) -# include -#elif defined(__WINDOWS__) -# include /* for wan_event_ctrl_t */ -#endif - -/* -** Sangoma Front-End interface structure (new version) -** FIXME: replace sdla_fe_iface_t with the new version! */ -typedef struct { - int (*reset)(void *fe, int, int); - int (*global_config)(void *fe); - int (*global_unconfig)(void *fe); - int (*chip_config)(void *fe); - int (*config)(void *fe); - int (*post_init)(void*); - /* Set extra T1/E1 configuration */ - int (*reconfig)(sdla_fe_t*); - int (*unconfig)(void *fe); - int (*pre_release)(void*); - int (*if_config)(void *fe, u32, u8); - int (*if_unconfig)(void *fe, u32, u8); - int (*disable_irq)(void *fe); - int (*polling)(sdla_fe_t *fe); - int (*isr)(sdla_fe_t *fe); - int (*process_udp)(sdla_fe_t *fe, void*, unsigned char*); - unsigned int (*read_alarm)(sdla_fe_t *fe, int); - int (*read_pmon)(sdla_fe_t *fe, int); - int (*flush_pmon)(sdla_fe_t *fe); - /* Set Front-End alarm (T1/E1) */ - int (*set_fe_alarm)(sdla_fe_t *fe, unsigned int); - /* Set extra interrupt type (after link get connected)) */ - int (*set_fe_sigctrl)(sdla_fe_t*, int, unsigned long, int); - /* Print Front-End alarm (T1/E1/56K) */ - char* (*print_fe_act_channels)(sdla_fe_t*); - /* Print Front-End alarm (T1/E1/56K) */ - int (*print_fe_alarm)(sdla_fe_t*,unsigned int); - /* Get front end status */ - int (*get_fe_status)(sdla_fe_t *fe, unsigned char*); - /* Get front end media type */ - unsigned char (*get_fe_media)(sdla_fe_t *fe); - /* Get front end media type string */ - char* (*get_fe_media_string)(void); - /* Set Line-loopback modes */ - int (*set_fe_lbmode)(sdla_fe_t*, unsigned char, unsigned char); - /* Update Alarm Status for proc file system */ - int (*update_alarm_info)(sdla_fe_t*, struct seq_file* m, int* stop_cnt); - /* Update PMON Status for proc file system */ - int (*update_pmon_info)(sdla_fe_t*, struct seq_file* m, int* stop_cnt); - /* AFT T1/E1 cards only */ - int (*led_ctrl)(sdla_fe_t*, int mode); - /* Check RBS bits (T1/E1 cards) */ - int (*check_rbsbits)(sdla_fe_t*, int, unsigned int, int); - /* Read RBS bits (T1/E1 cards) */ - unsigned char (*read_rbsbits)(sdla_fe_t*, int, int); - /* Set RBS bits (T1/E1 cards, voice) */ - int (*set_rbsbits)(sdla_fe_t*, int, unsigned char); - /* Report RBS bits (T1/E1 cards) */ - int (*report_rbsbits)(sdla_fe_t*); - /* Get Front-End SNMP data */ - int (*get_snmp_data)(sdla_fe_t*, void*, void*); - /* Check if the interrupt is for this port */ - int (*check_isr)(sdla_fe_t *fe); -#if defined(__WINDOWS__) - /* Enable TE1 poll timer (WINDOWS ONLY) */ - void (*enable_timer)(sdla_fe_t* fe, unsigned char cmd, unsigned int delay); -#endif - /* Available front-end map */ - unsigned int (*active_map)(sdla_fe_t *fe); - /* Transmit DTMF number */ - int (*set_dtmf)(sdla_fe_t*, int, unsigned char); - /* Enable/Disable FE interrupt */ - int (*intr_ctrl)(sdla_fe_t*, int, u_int8_t, u_int8_t, unsigned int); - /* Event Control */ - int (*event_ctrl)(sdla_fe_t*, wan_event_ctrl_t*); - /* Front-End watchdog */ - int (*watchdog)(sdla_fe_t*); -} sdla_fe_iface_t; - -/* -** Sangoma Front-End interface structure (new version) -** FIXME: replace sdla_fe_iface_t with the new version! */ -typedef struct { - - int (*check_hook_state)(sdla_fe_t *, int); - int (*hook_state)(sdla_fe_t *, int, int); - -} sdla_fe_notify_iface_t; - -#endif /* WAN_KERNEL */ - -#endif diff --git a/patches/kdrivers/include/sdla_hdlc.h b/patches/kdrivers/include/sdla_hdlc.h index 2bcb1b4..ee73c18 100644 --- a/patches/kdrivers/include/sdla_hdlc.h +++ b/patches/kdrivers/include/sdla_hdlc.h @@ -13,8 +13,8 @@ * Oct 14, 1998 Jaspreet Singh o Initial Version. *****************************************************************************/ -#ifndef _SDLA_HDLC___ -#define _SDLA_HDLC___ +#ifndef __SDLA_HDLC_H__ +#define __SDLA_HDLC_H__ #pragma pack(1) @@ -52,13 +52,13 @@ */ typedef struct { - unsigned char opp_flag ; /* the opp flag */ - unsigned char command ; /* the command code */ - unsigned short buffer_length ; /* the data length */ - unsigned char return_code ; /* the return code */ - unsigned char PF_bit ; /* the HDLC P/F bit */ - char MB_reserved[NUMBER_HDLC_MB_RES_BYTES] ; /* for later use */ - char data[MAX_NO_DATA_BYTES_IN_I_FRAME] ; /* the data area */ + unsigned char opp_flag ; /* the opp flag */ + unsigned char command ; /* the command code */ + unsigned short buffer_length ; /* the data length */ + unsigned char return_code ; /* the return code */ + unsigned char PF_bit ; /* the HDLC P/F bit */ + char MB_reserved[NUMBER_HDLC_MB_RES_BYTES] ; /* for later use */ + char data[MAX_NO_DATA_BYTES_IN_I_FRAME] ; /* the data area */ } HDLC_MAILBOX_STRUCT; @@ -67,20 +67,20 @@ typedef struct { typedef struct { - unsigned char opp_flag ; /* the opp flag */ - unsigned char command ; /* the command code */ - unsigned short buffer_length ; /* the data length */ - unsigned char return_code ; /* the return code */ - unsigned char PF_bit ; /* the HDLC P/F bit */ - char MB_reserved[NUMBER_HDLC_MB_RES_BYTES] ; /* for later use */ - char data[SIZEOF_HDLC_MB_DATA_BFR] ; /* the data area */ + unsigned char opp_flag ; /* the opp flag */ + unsigned char command ; /* the command code */ + unsigned short buffer_length ; /* the data length */ + unsigned char return_code ; /* the return code */ + unsigned char PF_bit ; /* the HDLC P/F bit */ + char MB_reserved[NUMBER_HDLC_MB_RES_BYTES] ; /* for later use */ + char data[SIZEOF_HDLC_MB_DATA_BFR] ; /* the data area */ } TRUE_HDLC_MAILBOX_STRUCT; typedef struct { - pid_t pid_num ; - HDLC_MAILBOX_STRUCT cmdarea ; + pid_t pid_num ; + HDLC_MAILBOX_STRUCT cmdarea ; } CMDBLOCK_STRUCT; @@ -288,9 +288,9 @@ typedef struct { typedef struct { - unsigned char trace_config ; /* trace configuration */ - unsigned short trace_deactivation_timer ; /* trace deactivation timer */ - unsigned long ptr_trace_stat_el_cfg_struct ; /* a pointer to the line trace element configuration structure */ + unsigned char trace_config ; /* trace configuration */ + unsigned short trace_deactivation_timer ; /* trace deactivation timer */ + unsigned long ptr_trace_stat_el_cfg_struct ; /* a pointer to the line trace element configuration structure */ } LINE_TRACE_CONFIG_STRUCT; @@ -309,11 +309,11 @@ typedef struct { typedef struct { - unsigned short number_trace_status_elements ; /* number of line trace elements */ - unsigned long base_addr_trace_status_elements ;/* base address of the trace element list */ - unsigned long next_trace_element_to_use ; /* pointer to the next trace element to be used */ - unsigned long base_addr_trace_buffer ; /* base address of the trace data buffer */ - unsigned long end_addr_trace_buffer ; /* end address of the trace data buffer */ + unsigned short number_trace_status_elements ; /* number of line trace elements */ + unsigned long base_addr_trace_status_elements ;/* base address of the trace element list */ + unsigned long next_trace_element_to_use ; /* pointer to the next trace element to be used */ + unsigned long base_addr_trace_buffer ; /* base address of the trace data buffer */ + unsigned long end_addr_trace_buffer ; /* end address of the trace data buffer */ } TRACE_STATUS_EL_CFG_STRUCT; @@ -323,13 +323,13 @@ typedef struct { typedef struct { - unsigned char opp_flag ; /* opp flag */ - unsigned short trace_length ; /* trace length */ - unsigned char trace_type ; /* trace type */ - unsigned short trace_time_stamp ;/* time stamp */ - unsigned short trace_reserved_1 ;/* reserved for later use */ - unsigned long trace_reserved_2 ; /* reserved for later use */ - unsigned long ptr_data_bfr ; /* pointer to the trace data buffer */ + unsigned char opp_flag ; /* opp flag */ + unsigned short trace_length ; /* trace length */ + unsigned char trace_type ; /* trace type */ + unsigned short trace_time_stamp ;/* time stamp */ + unsigned short trace_reserved_1 ;/* reserved for later use */ + unsigned long trace_reserved_2 ; /* reserved for later use */ + unsigned long ptr_data_bfr ; /* pointer to the trace data buffer */ } TRACE_STATUS_ELEMENT_STRUCT; @@ -360,24 +360,24 @@ typedef struct { typedef struct { - unsigned long baud_rate ; /* the baud rate */ - unsigned short line_config_options ; /* line configuration options */ - unsigned short modem_config_options ; /* modem configuration options */ - unsigned short HDLC_API_options ; /* HDLC API options */ - unsigned short HDLC_protocol_options ; /* HDLC protocol options */ - unsigned short HDLC_buffer_config_options ; /* HDLC buffer configuration options */ - unsigned short HDLC_statistics_options ; /* HDLC operational statistics options */ - unsigned short configured_as_DTE ; /* DTE or DCE configuration */ - unsigned short max_HDLC_I_field_length ; /* the maximum length of the HDLC I-field */ - unsigned short HDLC_I_frame_window ; /* k - the I-frame window (maximum number of outstanding I-frames) */ - unsigned short HDLC_T1_timer ; /* the HDLC T1 timer */ - unsigned short HDLC_T2_timer ; /* the HDLC T2 timer */ - unsigned short HDLC_T3_timer ; /* the HDLC T3 timer */ - unsigned short HDLC_T4_timer ; /* the HDLC T4 timer */ - unsigned short HDLC_N2_counter ; /* the HDLC N2 counter */ - unsigned long ptr_shared_mem_info_struct ;/* a pointer to the shared memory area information structure */ - unsigned long ptr_HDLC_Tx_stat_el_cfg_struct ;/* a pointer to the transmit status element configuration structure */ - unsigned long ptr_HDLC_Rx_stat_el_cfg_struct ;/* a pointer to the receive status element configuration structure */ + unsigned long baud_rate ; /* the baud rate */ + unsigned short line_config_options ; /* line configuration options */ + unsigned short modem_config_options ; /* modem configuration options */ + unsigned short HDLC_API_options ; /* HDLC API options */ + unsigned short HDLC_protocol_options ; /* HDLC protocol options */ + unsigned short HDLC_buffer_config_options ; /* HDLC buffer configuration options */ + unsigned short HDLC_statistics_options ; /* HDLC operational statistics options */ + unsigned short configured_as_DTE ; /* DTE or DCE configuration */ + unsigned short max_HDLC_I_field_length ; /* the maximum length of the HDLC I-field */ + unsigned short HDLC_I_frame_window ; /* k - the I-frame window (maximum number of outstanding I-frames) */ + unsigned short HDLC_T1_timer ; /* the HDLC T1 timer */ + unsigned short HDLC_T2_timer ; /* the HDLC T2 timer */ + unsigned short HDLC_T3_timer ; /* the HDLC T3 timer */ + unsigned short HDLC_T4_timer ; /* the HDLC T4 timer */ + unsigned short HDLC_N2_counter ; /* the HDLC N2 counter */ + unsigned long ptr_shared_mem_info_struct ;/* a pointer to the shared memory area information structure */ + unsigned long ptr_HDLC_Tx_stat_el_cfg_struct ;/* a pointer to the transmit status element configuration structure */ + unsigned long ptr_HDLC_Rx_stat_el_cfg_struct ;/* a pointer to the receive status element configuration structure */ } HDLC_CONFIGURATION_STRUCT; @@ -604,9 +604,9 @@ typedef struct { */ typedef struct { - unsigned char interrupt_type ; /* type of interrupt triggered */ - unsigned char interrupt_permission ; /* interrupt permission mask */ - unsigned char int_info_reserved[14] ; /* reserved */ + unsigned char interrupt_type ; /* type of interrupt triggered */ + unsigned char interrupt_permission ; /* interrupt permission mask */ + unsigned char int_info_reserved[14] ; /* reserved */ } HDLC_INTERRUPT_INFO_STRUCT; @@ -633,9 +633,9 @@ typedef struct { typedef struct { - unsigned short number_Tx_status_elements ; /* number of transmit status elements */ - unsigned long base_addr_Tx_status_elements ; /* base address of the transmit element list */ - unsigned long next_Tx_status_element_to_use ; /* pointer to the next transmit element to be used */ + unsigned short number_Tx_status_elements ; /* number of transmit status elements */ + unsigned long base_addr_Tx_status_elements ; /* base address of the transmit element list */ + unsigned long next_Tx_status_element_to_use ; /* pointer to the next transmit element to be used */ } HDLC_TX_STATUS_EL_CFG_STRUCT; @@ -644,12 +644,12 @@ typedef struct { */ typedef struct { - unsigned char opp_flag ; /* opp flag */ - unsigned short I_frame_length ; /* length of the frame*/ - unsigned char P_bit ; /* P-bit setting in the frame */ - unsigned long reserved_1 ; /* reserved for internal use */ - unsigned long reserved_2 ; /* reserved for internal use */ - unsigned long ptr_data_bfr ; /* pointer to the data area */ + unsigned char opp_flag ; /* opp flag */ + unsigned short I_frame_length ; /* length of the frame*/ + unsigned char P_bit ; /* P-bit setting in the frame */ + unsigned long reserved_1 ; /* reserved for internal use */ + unsigned long reserved_2 ; /* reserved for internal use */ + unsigned long ptr_data_bfr ; /* pointer to the data area */ } HDLC_I_FRM_TX_STATUS_EL_STRUCT; @@ -665,11 +665,11 @@ typedef struct { typedef struct { - unsigned short number_Rx_status_elements ; /* number of receive status elements */ - unsigned long base_addr_Rx_status_elements ; /* base address of the receive element list */ - unsigned long next_Rx_status_element_to_use ; /* pointer to the next receive element to be used */ - unsigned long base_addr_Rx_buffer ; /* base address of the receive data buffer */ - unsigned long end_addr_Rx_buffer ; /* end address of the receive data buffer */ + unsigned short number_Rx_status_elements ; /* number of receive status elements */ + unsigned long base_addr_Rx_status_elements ; /* base address of the receive element list */ + unsigned long next_Rx_status_element_to_use ; /* pointer to the next receive element to be used */ + unsigned long base_addr_Rx_buffer ; /* base address of the receive data buffer */ + unsigned long end_addr_Rx_buffer ; /* end address of the receive data buffer */ } HDLC_RX_STATUS_EL_CFG_STRUCT; /* @@ -677,12 +677,12 @@ typedef struct { */ typedef struct { - unsigned char opp_flag ; /* opp flag */ - unsigned short I_frame_length ; /*length of the recvd frame */ - unsigned char P_bit ; /* P-bit setting in the frame */ - unsigned long reserved_1 ; /* reserved for internal use */ - unsigned long reserved_2 ; /* reserved for internal use */ - unsigned long ptr_data_bfr ; /* pointer to the data area */ + unsigned char opp_flag ; /* opp flag */ + unsigned short I_frame_length ; /*length of the recvd frame */ + unsigned char P_bit ; /* P-bit setting in the frame */ + unsigned long reserved_1 ; /* reserved for internal use */ + unsigned long reserved_2 ; /* reserved for internal use */ + unsigned long ptr_data_bfr ; /* pointer to the data area */ } HDLC_I_FRM_RX_STATUS_EL_STRUCT; @@ -700,12 +700,12 @@ typedef struct { typedef struct { - unsigned char global_status ; /* global status */ - unsigned char modem_status ;/* current modem status*/ - unsigned char global_excep_conditions ; /* global exception conditions */ - unsigned char glob_info_reserved[5] ; /* reserved */ - unsigned char code_name[4] ; /* code name */ - unsigned char code_version[4] ; /* code version */ + unsigned char global_status ; /* global status */ + unsigned char modem_status ;/* current modem status*/ + unsigned char global_excep_conditions ; /* global exception conditions */ + unsigned char glob_info_reserved[5] ; /* reserved */ + unsigned char code_name[4] ; /* code name */ + unsigned char code_version[4] ; /* code version */ } GLOBAL_INFORMATION_STRUCT; @@ -716,9 +716,9 @@ typedef struct { typedef struct { - unsigned char parallel_port_A_input ; /* input - parallel port A */ - unsigned char parallel_port_B_input ; /* input - parallel port B */ - unsigned char FT1_info_reserved[14] ; /* reserved */ + unsigned char parallel_port_A_input ; /* input - parallel port A */ + unsigned char parallel_port_B_input ; /* input - parallel port B */ + unsigned char FT1_info_reserved[14] ; /* reserved */ } FT1_INFORMATION_STRUCT; @@ -728,14 +728,14 @@ typedef struct { typedef struct { - unsigned char HDLC_status ; /* HDLC status */ - unsigned char HDLC_excep_frms_Rx ; /* HDLC exception conditions - received frames */ - unsigned char HDLC_excep_frms_Tx ; /* HDLC exception conditions - transmitted frames */ - unsigned char HDLC_excep_miscellaneous ; /* HDLC exception conditions - miscellaneous */ - unsigned char rotating_SUP_frm_count ; /* rotating Supervisory frame count */ - unsigned char LAPB_status ; /* internal LAPB status */ - unsigned char internal_HDLC_status ; /* internal HDLC status */ - unsigned char HDLC_info_reserved[9] ; /* reserved */ + unsigned char HDLC_status ; /* HDLC status */ + unsigned char HDLC_excep_frms_Rx ; /* HDLC exception conditions - received frames */ + unsigned char HDLC_excep_frms_Tx ; /* HDLC exception conditions - transmitted frames */ + unsigned char HDLC_excep_miscellaneous ; /* HDLC exception conditions - miscellaneous */ + unsigned char rotating_SUP_frm_count ; /* rotating Supervisory frame count */ + unsigned char LAPB_status ; /* internal LAPB status */ + unsigned char internal_HDLC_status ; /* internal HDLC status */ + unsigned char HDLC_info_reserved[9] ; /* reserved */ } HDLC_INFORMATION_STRUCT; @@ -748,14 +748,12 @@ typedef struct { typedef struct { - GLOBAL_INFORMATION_STRUCT global_info ; /* the global information structure */ - FT1_INFORMATION_STRUCT FT1_info ; /* the S508/FT1 information structure */ - HDLC_INFORMATION_STRUCT HDLC_info ; /* the HDLC information structure */ - HDLC_INTERRUPT_INFO_STRUCT HDLC_interrupt_info ; /* the HDLC interrupt information structure */ + GLOBAL_INFORMATION_STRUCT global_info ; /* the global information structure */ + FT1_INFORMATION_STRUCT FT1_info ; /* the S508/FT1 information structure */ + HDLC_INFORMATION_STRUCT HDLC_info ; /* the HDLC information structure */ + HDLC_INTERRUPT_INFO_STRUCT HDLC_interrupt_info ; /* the HDLC interrupt information structure */ } HDLC_SHARED_MEMORY_INFO_STRUCT; - -#pragma pack() - +#pragma pack() #endif diff --git a/patches/kdrivers/include/sdla_mp_fr.h b/patches/kdrivers/include/sdla_mp_fr.h index c2e1ba9..55f6822 100644 --- a/patches/kdrivers/include/sdla_mp_fr.h +++ b/patches/kdrivers/include/sdla_mp_fr.h @@ -18,8 +18,6 @@ #define MAX_FR_CHANNELS 1023 #define HIGHEST_VALID_DLCI MAX_FR_CHANNELS-1 -#pragma pack(1) - typedef struct { unsigned ea1 : 1; unsigned cr : 1; @@ -30,9 +28,7 @@ typedef struct { unsigned becn : 1; unsigned fecn : 1; unsigned dlcil: 4; -}fr_hdr; - -#pragma pack() +}__attribute__ ((packed)) fr_hdr; #define FR_HEADER_LEN 8 @@ -57,6 +53,14 @@ typedef struct { #define FR_LINK_INOPER 0x00 /* for global status (DLCI == 0) */ #define FR_LINK_OPER 0x01 +#if 0 +#define FR_DLCI_INOPER 0x00 +#define FR_DLCI_DELETED 0x01 /* for circuit status (DLCI != 0) */ +#define FR_DLCI_ACTIVE 0x02 +#define FR_DLCI_WAITING 0x04 +#define FR_DLCI_NEW 0x08 +#define FR_DLCI_REPORT 0x40 +#endif #define PVC_STATE_NEW 0x01 #define PVC_STATE_ACTIVE 0x02 diff --git a/patches/kdrivers/include/sdla_ppp.h b/patches/kdrivers/include/sdla_ppp.h index 1a7cf57..42d42ab 100644 --- a/patches/kdrivers/include/sdla_ppp.h +++ b/patches/kdrivers/include/sdla_ppp.h @@ -26,10 +26,11 @@ * -------- -------- * GNU C Linux */ -#pragma pack(1) #include +#pragma pack(1) + /* Adapter memory layout and important constants */ #define PPP508_MB_VECT 0xE000 /* mailbox window vector */ #define PPP508_MB_OFFS 0 /* mailbox offset */ @@ -46,27 +47,27 @@ * PPP Command Block. */ typedef struct ppp_cmd{ - unsigned char command ; /* command code */ - unsigned short length ; /* length of data buffer */ - unsigned char result ; /* return code */ - unsigned char rsrv[11] ; /* reserved for future use */ + unsigned char command ; /* command code */ + unsigned short length ; /* length of data buffer */ + unsigned char result ; /* return code */ + unsigned char rsrv[11] ; /* reserved for future use */ } ppp_cmd_t; typedef struct { - unsigned char status ; - unsigned char data_avail ; - unsigned short real_length ; - unsigned short time_stamp ; - unsigned char data[1] ; + unsigned char status ; + unsigned char data_avail ; + unsigned short real_length ; + unsigned short time_stamp ; + unsigned char data[1] ; } trace_pkt_t; typedef struct { - unsigned char opp_flag ; - unsigned char trace_type ; - unsigned short trace_length ; - unsigned short trace_data_ptr ; - unsigned short trace_time_stamp ; + unsigned char opp_flag ; + unsigned char trace_type ; + unsigned short trace_length ; + unsigned short trace_data_ptr ; + unsigned short trace_time_stamp ; } trace_element_t; @@ -82,9 +83,9 @@ typedef struct { */ typedef struct ppp_mbox { - unsigned char flag ; /* 00h: command execution flag */ - ppp_cmd_t cmd ; /* 01h: command block */ - unsigned char data[1] ; /* 10h: variable length data buffer */ + unsigned char flag ; /* 00h: command execution flag */ + ppp_cmd_t cmd ; /* 01h: command block */ + unsigned char data[1] ; /* 10h: variable length data buffer */ } ppp_mbox_t; #endif /*---------------------------------------------------------------------------- @@ -94,17 +95,17 @@ typedef struct ppp_mbox */ typedef struct ppp_flags { - unsigned char iflag ; /* 00: interrupt flag */ - unsigned char imask ; /* 01: interrupt mask */ - unsigned char resrv ; - unsigned char mstatus ; /* 03: modem status */ - unsigned char lcp_state ; /* 04: LCP state */ - unsigned char ppp_phase ; /* 05: PPP phase */ - unsigned char ip_state ; /* 06: IPCP state */ - unsigned char ipx_state ; /* 07: IPXCP state */ - unsigned char pap_state ; /* 08: PAP state */ - unsigned char chap_state ; /* 09: CHAP state */ - unsigned short disc_cause ; /* 0A: disconnection cause */ + unsigned char iflag ; /* 00: interrupt flag */ + unsigned char imask ; /* 01: interrupt mask */ + unsigned char resrv ; + unsigned char mstatus ; /* 03: modem status */ + unsigned char lcp_state ; /* 04: LCP state */ + unsigned char ppp_phase ; /* 05: PPP phase */ + unsigned char ip_state ; /* 06: IPCP state */ + unsigned char ipx_state ; /* 07: IPXCP state */ + unsigned char pap_state ; /* 08: PAP state */ + unsigned char chap_state ; /* 09: CHAP state */ + unsigned short disc_cause ; /* 0A: disconnection cause */ } ppp_flags_t; /* 'iflag' defines */ @@ -163,16 +164,16 @@ typedef struct ppp_flags */ typedef struct ppp508_buf_info { - unsigned short txb_num ; /* 00: number of transmit buffers */ - unsigned int txb_ptr ; /* 02: pointer to the buffer ctl. */ - unsigned int txb_nxt ; - unsigned char rsrv1[22] ; - unsigned short rxb_num ; /* 20: number of receive buffers */ - unsigned int rxb_ptr ; /* 22: pointer to the buffer ctl. */ - unsigned int rxb1_ptr ; /* 26: pointer to the first buf.ctl. */ - unsigned int rxb_base ; /* 2A: pointer to the buffer base */ - unsigned char rsrv2[2] ; - unsigned int rxb_end ; /* 30: pointer to the buffer end */ + unsigned short txb_num ; /* 00: number of transmit buffers */ + unsigned int txb_ptr ; /* 02: pointer to the buffer ctl. */ + unsigned int txb_nxt ; + unsigned char rsrv1[22] ; + unsigned short rxb_num ; /* 20: number of receive buffers */ + unsigned int rxb_ptr ; /* 22: pointer to the buffer ctl. */ + unsigned int rxb1_ptr ; /* 26: pointer to the first buf.ctl. */ + unsigned int rxb_base ; /* 2A: pointer to the buffer base */ + unsigned char rsrv2[2] ; + unsigned int rxb_end ; /* 30: pointer to the buffer end */ } ppp508_buf_info_t; /*---------------------------------------------------------------------------- @@ -180,17 +181,17 @@ typedef struct ppp508_buf_info */ typedef struct ppp_buf_ctl { - unsigned char flag ; /* 00: 'buffer ready' flag */ - unsigned short length ; /* 01: length of data */ - unsigned char reserved1[1] ; /* 03: */ - unsigned char proto ; /* 04: protocol */ - unsigned short timestamp ; /* 05: time stamp (Rx only) */ - unsigned char reserved2[5] ; /* 07: */ + unsigned char flag ; /* 00: 'buffer ready' flag */ + unsigned short length ; /* 01: length of data */ + unsigned char reserved1[1] ; /* 03: */ + unsigned char proto ; /* 04: protocol */ + unsigned short timestamp ; /* 05: time stamp (Rx only) */ + unsigned char reserved2[5] ; /* 07: */ union { unsigned short o_p[2]; /* 1C: buffer offset & page (S502) */ unsigned int ptr; /* 1C: buffer pointer (S508) */ - } buf ; + } buf ; } ppp_buf_ctl_t; /*---------------------------------------------------------------------------- @@ -198,31 +199,31 @@ typedef struct ppp_buf_ctl */ typedef struct ppp508_conf { - unsigned int line_speed ; /* 00: baud rate, bps */ - unsigned short txbuf_percent ; /* 04: % of Tx buffer */ - unsigned short conf_flags ; /* 06: configuration bits */ - unsigned short mtu_local ; /* 08: local MTU */ - unsigned short mtu_remote ; /* 0A: remote MTU */ - unsigned short restart_tmr ; /* 0C: restart timer */ - unsigned short auth_rsrt_tmr ; /* 0E: authentication timer */ - unsigned short auth_wait_tmr ; /* 10: authentication timer */ - unsigned short mdm_fail_tmr ; /* 12: modem failure timer */ - unsigned short dtr_drop_tmr ; /* 14: DTR drop timer */ - unsigned short connect_tmout ; /* 16: connection timeout */ - unsigned short conf_retry ; /* 18: max. retry */ - unsigned short term_retry ; /* 1A: max. retry */ - unsigned short fail_retry ; /* 1C: max. retry */ - unsigned short auth_retry ; /* 1E: max. retry */ - unsigned char auth_options ; /* 20: authentication opt. */ - unsigned char ip_options ; /* 21: IP options */ - unsigned int ip_local ; /* 22: local IP address */ - unsigned int ip_remote ; /* 26: remote IP address */ - unsigned char ipx_options ; /* 2A: IPX options */ - unsigned char ipx_netno[4] ; /* 2B: IPX net number */ - unsigned char ipx_local[6] ; /* 2F: local IPX node number*/ - unsigned char ipx_remote[6] ; /* 35: remote IPX node num.*/ - unsigned char ipx_router[48] ; /* 3B: IPX router name*/ - unsigned int alt_cpu_clock ; /* 6B: */ + unsigned int line_speed ; /* 00: baud rate, bps */ + unsigned short txbuf_percent ; /* 04: % of Tx buffer */ + unsigned short conf_flags ; /* 06: configuration bits */ + unsigned short mtu_local ; /* 08: local MTU */ + unsigned short mtu_remote ; /* 0A: remote MTU */ + unsigned short restart_tmr ; /* 0C: restart timer */ + unsigned short auth_rsrt_tmr ; /* 0E: authentication timer */ + unsigned short auth_wait_tmr ; /* 10: authentication timer */ + unsigned short mdm_fail_tmr ; /* 12: modem failure timer */ + unsigned short dtr_drop_tmr ; /* 14: DTR drop timer */ + unsigned short connect_tmout ; /* 16: connection timeout */ + unsigned short conf_retry ; /* 18: max. retry */ + unsigned short term_retry ; /* 1A: max. retry */ + unsigned short fail_retry ; /* 1C: max. retry */ + unsigned short auth_retry ; /* 1E: max. retry */ + unsigned char auth_options ; /* 20: authentication opt. */ + unsigned char ip_options ; /* 21: IP options */ + unsigned int ip_local ; /* 22: local IP address */ + unsigned int ip_remote ; /* 26: remote IP address */ + unsigned char ipx_options ; /* 2A: IPX options */ + unsigned char ipx_netno[4] ; /* 2B: IPX net number */ + unsigned char ipx_local[6] ; /* 2F: local IPX node number*/ + unsigned char ipx_remote[6] ; /* 35: remote IPX node num.*/ + unsigned char ipx_router[48] ; /* 3B: IPX router name*/ + unsigned int alt_cpu_clock ; /* 6B: */ } ppp508_conf_t; /*---------------------------------------------------------------------------- @@ -231,17 +232,17 @@ typedef struct ppp508_conf */ typedef struct ppp508_connect_info { - unsigned short mru ; /* 00-01 Remote Max Rec' Unit */ - unsigned char ip_options ; /* 02: Negotiated ip options */ - unsigned int ip_local ; /* 03-06: local IP address */ - unsigned int ip_remote ; /* 07-0A: remote IP address */ - unsigned char ipx_options ; /* 0B: Negotiated ipx options */ - unsigned char ipx_netno[4] ; /* 0C-0F: IPX net number */ - unsigned char ipx_local[6] ; /* 10-1F: local IPX node # */ - unsigned char ipx_remote[6] ; /* 16-1B: remote IPX node # */ - unsigned char ipx_router[48] ; /* 1C-4B: IPX router name */ - unsigned char auth_status ; /* 4C: Authentication Status */ - unsigned char inbd_auth_peerID[1] ; /* 4D: variable length inbound authenticated peer ID */ + unsigned short mru ; /* 00-01 Remote Max Rec' Unit */ + unsigned char ip_options ; /* 02: Negotiated ip options */ + unsigned int ip_local ; /* 03-06: local IP address */ + unsigned int ip_remote ; /* 07-0A: remote IP address */ + unsigned char ipx_options ; /* 0B: Negotiated ipx options */ + unsigned char ipx_netno[4] ; /* 0C-0F: IPX net number */ + unsigned char ipx_local[6] ; /* 10-1F: local IPX node # */ + unsigned char ipx_remote[6] ; /* 16-1B: remote IPX node # */ + unsigned char ipx_router[48] ; /* 1C-4B: IPX router name */ + unsigned char auth_status ; /* 4C: Authentication Status */ + unsigned char inbd_auth_peerID[1] ; /* 4D: variable length inbound authenticated peer ID */ } ppp508_connect_info_t; /* 'line_speed' field */ @@ -286,10 +287,10 @@ typedef struct ppp508_connect_info */ typedef struct ppp508_get_conf { - unsigned int bps ; /* 00: baud rate, bps */ - ppp508_conf_t conf ; /* 04: requested config. */ - unsigned short txb_num ; /* 6F: number of Tx buffers */ - unsigned short rxb_num ; /* 71: number of Rx buffers */ + unsigned int bps ; /* 00: baud rate, bps */ + ppp508_conf_t conf ; /* 04: requested config. */ + unsigned short txb_num ; /* 6F: number of Tx buffers */ + unsigned short rxb_num ; /* 71: number of Rx buffers */ } ppp508_get_conf_t; /*---------------------------------------------------------------------------- @@ -297,13 +298,13 @@ typedef struct ppp508_get_conf */ typedef struct ppp508_stats { - unsigned short reserved1 ; /* 00: */ - unsigned short rx_bad_len ; /* 02: */ - unsigned short reserved2 ; /* 04: */ - unsigned int tx_frames ; /* 06: */ - unsigned int tx_bytes ; /* 0A: */ - unsigned int rx_frames ; /* 0E: */ - unsigned int rx_bytes ; /* 12: */ + unsigned short reserved1 ; /* 00: */ + unsigned short rx_bad_len ; /* 02: */ + unsigned short reserved2 ; /* 04: */ + unsigned int tx_frames ; /* 06: */ + unsigned int tx_bytes ; /* 0A: */ + unsigned int rx_frames ; /* 0E: */ + unsigned int rx_bytes ; /* 12: */ } ppp508_stats_t; /*---------------------------------------------------------------------------- @@ -311,25 +312,25 @@ typedef struct ppp508_stats */ typedef struct ppp_err_stats { - unsigned char rx_overrun ; /* 00: Rx overrun errors */ - unsigned char rx_bad_crc ; /* 01: Rx CRC errors */ - unsigned char rx_abort ; /* 02: Rx aborted frames */ - unsigned char rx_lost ; /* 03: Rx frames lost */ - unsigned char tx_abort ; /* 04: Tx aborted frames */ - unsigned char tx_underrun ; /* 05: Tx underrun errors */ - unsigned char tx_missed_intr ; /* 06: Tx underruns missed */ - unsigned char reserved ; /* 07: Tx underruns missed */ - unsigned char dcd_trans ; /* 08: DCD transitions */ - unsigned char cts_trans ; /* 09: CTS transitions */ + unsigned char rx_overrun ; /* 00: Rx overrun errors */ + unsigned char rx_bad_crc ; /* 01: Rx CRC errors */ + unsigned char rx_abort ; /* 02: Rx aborted frames */ + unsigned char rx_lost ; /* 03: Rx frames lost */ + unsigned char tx_abort ; /* 04: Tx aborted frames */ + unsigned char tx_underrun ; /* 05: Tx underrun errors */ + unsigned char tx_missed_intr ; /* 06: Tx underruns missed */ + unsigned char reserved ; /* 07: Tx underruns missed */ + unsigned char dcd_trans ; /* 08: DCD transitions */ + unsigned char cts_trans ; /* 09: CTS transitions */ } ppp_err_stats_t; /* Data structure for SET_TRIGGER_INTR command */ typedef struct ppp_intr_info{ - unsigned char i_enable ; /* 0 Interrupt enable bits */ - unsigned char irq ; /* 1 Irq number */ - unsigned short timer_len ; /* 2 Timer delay */ + unsigned char i_enable ; /* 0 Interrupt enable bits */ + unsigned char irq ; /* 1 Irq number */ + unsigned short timer_len ; /* 2 Timer delay */ } ppp_intr_info_t; @@ -364,7 +365,6 @@ typedef struct ppp_intr_info{ #define UDPDRV_SIGNATURE "DRVSTATS" #define UDPMGMT_UDP_PROTOCOL 0x11 - -#pragma pack() +#pragma pack() #endif /* _SDLA_PPP_H */ diff --git a/patches/kdrivers/include/sdla_remora.h b/patches/kdrivers/include/sdla_remora.h index a3daeb1..cf58d5b 100644 --- a/patches/kdrivers/include/sdla_remora.h +++ b/patches/kdrivers/include/sdla_remora.h @@ -37,6 +37,8 @@ #define IS_FXOFXS_CARD(card) IS_FXOFXS_FEMEDIA(&(card)->fe) +#define WAN_RM_START_CHANNEL 1 + #define MAX_REMORA_MODULES 24 #define MAX_FXOFXS_CHANNELS MAX_REMORA_MODULES @@ -88,14 +90,21 @@ #define WAN_RM_OPERMODE_LEN 20 /* Front-End UDP command */ +#if defined(__WINDOWS__) +#define WAN_FE_TONES 13 +#define WAN_FE_RING (WAN_FE_TONES + 1) +#define WAN_FE_REGDUMP (WAN_FE_TONES + 2) +#define WAN_FE_STATS (WAN_FE_TONES + 3) +#else #define WAN_FE_TONES (WAN_FE_UDP_CMD_START + 0) #define WAN_FE_RING (WAN_FE_UDP_CMD_START + 1) #define WAN_FE_REGDUMP (WAN_FE_UDP_CMD_START + 2) #define WAN_FE_STATS (WAN_FE_UDP_CMD_START + 3) +#endif #define WAN_RM_SET_ECHOTUNE _IOW (ZT_CODE, 63, struct wan_rm_echo_coefs) -/* FE interrupt types */ +/* RM interrupt types */ #define WAN_RM_INTR_NONE 0x00 #define WAN_RM_INTR_GLOBAL 0x01 @@ -119,22 +128,28 @@ ** TYPEDEF STRUCTURE *******************************************************************************/ typedef struct sdla_remora_cfg_ { - int not_used; - int opermode; - char opermode_name[WAN_RM_OPERMODE_LEN]; + + int opermode; + char opermode_name[WAN_RM_OPERMODE_LEN]; /* int tdmv_law;*/ /* WAN_TDMV_ALAW or WAN_TDMV_MULAW */ - int reversepolarity; - int battthresh; - int battdebounce; - int network_sync; + int reversepolarity; + int battthresh; + int battdebounce; + int network_sync; + + u_int8_t relaxcfg; /* do not failed during config if one of + ** the modules failed to configure */ int fxs_rxgain; int fxs_txgain; u_int8_t fxs_fastringer; u_int8_t fxs_lowpower; + u_int8_t fxs_pulsedialing; int fxo_rxgain; int fxo_txgain; + + int fxs_ringampl; } sdla_remora_cfg_t; typedef struct { @@ -151,7 +166,7 @@ typedef struct { int ring_volt; /* RING voltage (mV) (FXS) */ int bat_volt; /* VBAT voltage (mV) (FXS) */ int volt; /* Line voltage status (FXO) */ - //u_int8_t hook; /* On/Off hook state */ + /*u_int8_t hook; */ /* On/Off hook state */ } wan_remora_stats_t; typedef struct { @@ -185,70 +200,90 @@ struct wan_rm_echo_coefs { #if !defined(WAN_DEBUG_FE) # define WRITE_RM_FXS_REG(mod_no,chain,reg,val) \ - fe->write_fe_reg( fe->card, \ + fe->write_fe_reg( ((sdla_t*)fe->card)->hw, \ (int)mod_no, \ (int)MOD_TYPE_FXS, \ (int)chain, \ (int)reg, \ (int)val) # define READ_RM_FXS_REG(mod_no,chain,reg) \ - fe->read_fe_reg( fe->card, \ + fe->read_fe_reg( ((sdla_t*)fe->card)->hw, \ (int)mod_no, \ (int)MOD_TYPE_FXS, \ (int)chain, \ (int)reg) # define WRITE_RM_FXO_REG(mod_no,chain,reg,val) \ - fe->write_fe_reg( fe->card, \ + fe->write_fe_reg( ((sdla_t*)fe->card)->hw, \ (int)mod_no, \ (int)MOD_TYPE_FXO, \ (int)chain, \ (int)reg, \ (int)val) # define READ_RM_FXO_REG(mod_no,chain,reg) \ - fe->read_fe_reg( fe->card, \ + fe->read_fe_reg( ((sdla_t*)fe->card)->hw, \ (int)mod_no, \ (int)MOD_TYPE_FXO, \ (int)chain, \ (int)reg) # define WRITE_RM_REG(mod_no,reg,val) \ - fe->write_fe_reg( fe->card, \ + fe->write_fe_reg( ((sdla_t*)fe->card)->hw, \ (int)mod_no, \ - fe->rm_param.mod[mod_no].type, \ - fe->rm_param.mod[mod_no].chain, \ + (int)fe->rm_param.mod[mod_no].type, \ + (int)fe->rm_param.mod[mod_no].chain, \ (int)reg, (int)val) # define READ_RM_REG(mod_no,reg) \ - fe->read_fe_reg( fe->card, \ + fe->read_fe_reg( ((sdla_t*)fe->card)->hw, \ (int)mod_no, \ - fe->rm_param.mod[mod_no].type, \ - fe->rm_param.mod[mod_no].chain, \ + (int)fe->rm_param.mod[mod_no].type, \ + (int)fe->rm_param.mod[mod_no].chain, \ (int)reg) #else -# define WRITE_RM_FXS_REG(mod_no,chain,reg,val) \ - fe->write_fe_reg(fe->card,(int)mod_no,(int)MOD_TYPE_FXS,(int)chain,(int)reg,(int)val,__FILE__,(int)__LINE__) +# define WRITE_RM_FXS_REG(mod_no,chain,reg,val) \ + fe->write_fe_reg( ((sdla_t*)fe->card)->hw, \ + (int)mod_no, \ + (int)MOD_TYPE_FXS, \ + (int)chain, \ + (int)reg, (int)val, \ + __FILE__,(int)__LINE__) # define READ_RM_FXS_REG(mod_no,chain,reg) \ - fe->read_fe_reg(fe->card, (int)mod_no,(int)MOD_TYPE_FXS,(int)chain,(int)reg,__FILE__,__LINE__) + fe->read_fe_reg( ((sdla_t*)fe->card)->hw, \ + (int)mod_no, \ + (int)MOD_TYPE_FXS, \ + (int)chain, \ + (int)reg, \ + __FILE__,__LINE__) # define WRITE_RM_FXO_REG(mod_no,chain,reg,val) \ - fe->write_fe_reg(fe->card,(int)mod_no,(int)MOD_TYPE_FXO,(int)chain,(int)reg,(int)val,__FILE__,(int)__LINE__) + fe->write_fe_reg( ((sdla_t*)fe->card)->hw, \ + (int)mod_no, \ + (int)MOD_TYPE_FXO, \ + (int)chain, \ + (int)reg,(int)val, \ + __FILE__,(int)__LINE__) # define READ_RM_FXO_REG(mod_no,chain,reg) \ - fe->read_fe_reg(fe->card, (int)mod_no,(int)MOD_TYPE_FXO,(int)chain,(int)reg,__FILE__,(int)__LINE__) + fe->read_fe_reg( ((sdla_t*)fe->card)->hw, \ + (int)mod_no, \ + (int)MOD_TYPE_FXO, \ + (int)chain, \ + (int)reg, \ + __FILE__,(int)__LINE__) # define WRITE_RM_REG(mod_no,reg,val) \ - fe->write_fe_reg( fe->card, \ + fe->write_fe_reg( ((sdla_t*)fe->card)->hw, \ (int)mod_no, \ - fe->rm_param.mod[mod_no].type, \ - fe->rm_param.mod[mod_no].chain, \ + (int)fe->rm_param.mod[mod_no].type, \ + (int)fe->rm_param.mod[mod_no].chain, \ (int)reg, (int)val,__FILE__,(int)__LINE__) # define READ_RM_REG(mod_no,reg) \ - fe->read_fe_reg( fe->card, \ + fe->read_fe_reg( ((sdla_t*)fe->card)->hw, \ (int)mod_no, \ - fe->rm_param.mod[mod_no].type, \ - fe->rm_param.mod[mod_no].chain, \ + (int)fe->rm_param.mod[mod_no].type, \ + (int)fe->rm_param.mod[mod_no].chain, \ (int)reg,__FILE__,(int)__LINE__) #endif #define __READ_RM_REG(mod_no,reg) \ - fe->__read_fe_reg( fe->card, \ + fe->__read_fe_reg( ((sdla_t*)fe->card)->hw, \ (int)mod_no, \ - fe->rm_param.mod[mod_no].type, \ - fe->rm_param.mod[mod_no].chain, \ + (int)fe->rm_param.mod[mod_no].type, \ + (int)fe->rm_param.mod[mod_no].chain, \ (int)reg) @@ -332,12 +367,14 @@ typedef struct { typedef struct { // u_int16_t type; - int mod_no; /* A200-Remora */ + unsigned int mod_no; /* A200-Remora */ unsigned char ec_dtmf_port; /* EC DTMF: SOUT or ROUT */ unsigned long ts_map; u_int8_t tone; int ohttimer; /* On-hook transfer */ int polarity; /* SETPOLARITY */ + unsigned short reg; /* fe register */ + unsigned char value; /* fe register value */ } sdla_rm_event_t; typedef struct sdla_remora_param { @@ -355,7 +392,12 @@ typedef struct sdla_remora_param { // u16 timer_delay; u32 intcount; - unsigned long last_watchdog; + wan_ticks_t last_watchdog; + + int reg_dbg_busy; + int reg_dbg_ready; + unsigned char reg_dbg_value; + } sdla_remora_param_t; @@ -364,7 +406,7 @@ typedef struct sdla_remora_param { /******************************************************************************* ** FUNCTION PROTOTYPES *******************************************************************************/ -extern int wp_remora_iface_init(void*); +extern int wp_remora_iface_init(void*, void*); #undef EXTERN #endif /* __SDLA_REMORA_H */ diff --git a/patches/kdrivers/include/sdla_serial.h b/patches/kdrivers/include/sdla_serial.h new file mode 100644 index 0000000..8e47a5c --- /dev/null +++ b/patches/kdrivers/include/sdla_serial.h @@ -0,0 +1,62 @@ +/***************************************************************************** + * sdla_serial.h Sangoma AFT Base Serial configuration definitions. + * + * Author: Alex Feldman + * + * Copyright: (c) 1995-2001 Sangoma Technologies 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. + + * ============================================================================ + * Oct 10, 2007 Alex Feldman Initial version. + **************************************************************************** +*/ + +#ifndef _SDLA_SERIAL_H_ +#define _SDLA_SERIAL_H_ + +/******************************************************************************* + DEFINES AND MACROS + ******************************************************************************/ + +#define AFT_SERIAL_OSC 14745600 + +#define REG_FLOWCNTRL 0x00 + +#define BIT_FLOWCNTRL_RTS 0x00000001 +#define BIT_FLOWCNTRL_DTR 0x00000002 +#define BIT_FLOWCNTRL_CTS 0x00000004 +#define BIT_FLOWCNTRL_DCD 0x00000008 + +#define BITS_BAUDRATE(baud,asyn_if) ((( AFT_SERIAL_OSC / (2 * ((async_if) ? 16 :1) * (baud))) - 1 ) << 8) + +#define BIT_INTCTRL_CLK_MASTER 0x01000000 /* Internal clock (from oscillator) */ +#define BIT_INTCTRL_NRZI 0x10000000 /* NRZI */ +#define BIT_INTCTRL_FM1 0x20000000 /* FM1 */ +#define BIT_INTCTRL_FM0 0x30000000 /* FM0 */ +#define BIT_INTCTRL_MANCHESTER 0x40000000 /* MANCHESTER */ +#define BIT_INTCTRL_ASYNCH 0x80000000 /* Asynchronous */ + +#define MAX_SERIAL_LINES 4 +/******************************************************************************* + FUNCTION PROTOTYPES + ******************************************************************************/ + + +#ifdef WAN_KERNEL + +#define IS_SERIAL_CARD(card) IS_SERIAL_FEMEDIA(&(card)->fe) + +int aft_serial_write_fe(void* phw, ...); +#define __aft_serial_write_fe aft_serial_write_fe +u32 aft_serial_read_fe(void* phw, ...); +#define __aft_serial_read_fe aft_serial_read_fe + +int32_t wp_serial_iface_init(void *pfe_iface); + +#endif /* WAN_KERNEL */ + +#endif /* _SDLA_SERIAL_H_ */ diff --git a/patches/kdrivers/include/sdla_tdmv.h b/patches/kdrivers/include/sdla_tdmv.h index f69221c..0e3de6c 100644 --- a/patches/kdrivers/include/sdla_tdmv.h +++ b/patches/kdrivers/include/sdla_tdmv.h @@ -104,6 +104,7 @@ typedef struct wan_tdmv_iface_ ******************************************************************************/ EXTERN int wp_tdmv_te1_init(wan_tdmv_iface_t *iface); EXTERN int wp_tdmv_remora_init(wan_tdmv_iface_t *iface); +EXTERN int wp_tdmv_bri_init(wan_tdmv_iface_t *iface); #ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE_ECHOMASTER EXTERN int wp_tdmv_echo_check(wan_tdmv_t *wan_tdmv, void *current_ztchan, int channo); diff --git a/patches/kdrivers/include/sdla_tdmv.mar8.h b/patches/kdrivers/include/sdla_tdmv.mar8.h deleted file mode 100644 index 8a200d7..0000000 --- a/patches/kdrivers/include/sdla_tdmv.mar8.h +++ /dev/null @@ -1,70 +0,0 @@ -/****************************************************************************** - * sdla_tdmv.h - * - * Author: Alex Feldman - * - * Copyright: (c) 1995-2001 Sangoma Technologies 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. - * ============================================================================ - ****************************************************************************** - */ - -#ifndef __SDLA_TDMV_H -# define __SDLA_TDMV_H - -#ifdef __SDLA_TDMV_SRC -# define EXTERN -#else -# define EXTERN extern -#endif - - -/* -******************************************************************************* -** DEFINES and MACROS -******************************************************************************* -*/ -#define WAN_TDMV_IDLE_FLAG 0x7F - -/* -******************************************************************************* -** TYPEDEF STRUCTURE -******************************************************************************* -*/ -typedef struct wan_tdmv_ { - void *sc; - int max_tx_len; - int max_timeslots; - int brt_enable; - int spanno; - WAN_LIST_ENTRY(wan_tdmv_) next; -} wan_tdmv_t; - -/* -******************************************************************************* -** FUNCTION PROTOTYPES -******************************************************************************* -*/ -EXTERN int wp_tdmv_check_mtu(void*, unsigned long); -EXTERN int wp_tdmv_init(void*, wanif_conf_t*); -EXTERN void wp_tdmv_free(wan_tdmv_t*); -EXTERN void wp_tdmv_state(void*, int); -EXTERN int wp_tdmv_rx_tx(void*, netskb_t*); -EXTERN void wp_tdmv_report_rbsbits(void*, int, unsigned char); -EXTERN void wp_tdmv_report_alarms(void*, unsigned long); - -EXTERN int wp_tdmv_create(void* pcard, wandev_conf_t *conf); -EXTERN int wp_tdmv_reg(void*, wanif_conf_t*, int); -EXTERN int wp_tdmv_unreg(void* pcard, unsigned long ts_map); -EXTERN int wp_tdmv_remove(void* pcard); -EXTERN int wp_tdmv_rx_chan(wan_tdmv_t *wan_tdmv, int channo, - unsigned char *rxbuf, - unsigned char *txbuf); -EXTERN int wp_tdmv_rx_tx_span(void *pcard); - -#undef EXTERN -#endif /* __SDLA_VOIP_H */ diff --git a/patches/kdrivers/include/sdla_te1.h b/patches/kdrivers/include/sdla_te1.h index e62b28e..712c66c 100644 --- a/patches/kdrivers/include/sdla_te1.h +++ b/patches/kdrivers/include/sdla_te1.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: sdla_te1.h,v 1.57 2007/04/04 16:25:49 sangoma Exp $ + * $Id: sdla_te1.h,v 1.71 2008/03/03 19:21:02 sangoma Exp $ */ /***************************************************************************** @@ -81,19 +81,26 @@ #define WAN_TE_SIG_INTR 0x02 /* Framer Alarm bit mask */ -#define WAN_TE_BIT_ALOS_ALARM 0x0001 -#define WAN_TE_BIT_LOS_ALARM 0x0002 -#define WAN_TE_BIT_ALTLOS_ALARM 0x0004 -#define WAN_TE_BIT_OOF_ALARM 0x0008 -#define WAN_TE_BIT_RED_ALARM 0x0010 -#define WAN_TE_BIT_AIS_ALARM 0x0020 -#define WAN_TE_BIT_OOSMF_ALARM 0x0040 -#define WAN_TE_BIT_OOCMF_ALARM 0x0080 -#define WAN_TE_BIT_OOOF_ALARM 0x0100 -#define WAN_TE_BIT_RAI_ALARM 0x0200 -#define WAN_TE_BIT_YEL_ALARM 0x0400 -#define WAN_TE_BIT_LOOPUP_CODE 0x2000 -#define WAN_TE_BIT_LOOPDOWN_CODE 0x4000 +#define WAN_TE_BIT_FRAMER_ALARM_MASK 0x0000FFFF +#define WAN_TE_BIT_LIU_ALARM_MASK 0x00F00000 +#define WAN_TE_BIT_ALOS_ALARM 0x00000001 +#define WAN_TE_BIT_LOS_ALARM 0x00000002 +#define WAN_TE_BIT_ALTLOS_ALARM 0x00000004 +#define WAN_TE_BIT_OOF_ALARM 0x00000008 +#define WAN_TE_BIT_RED_ALARM 0x00000010 +#define WAN_TE_BIT_AIS_ALARM 0x00000020 +#define WAN_TE_BIT_OOSMF_ALARM 0x00000040 +#define WAN_TE_BIT_OOCMF_ALARM 0x00000080 +#define WAN_TE_BIT_OOOF_ALARM 0x00000100 +#define WAN_TE_BIT_RAI_ALARM 0x00000200 +#define WAN_TE_BIT_YEL_ALARM 0x00000400 +#define WAN_TE_BIT_LOOPUP_CODE 0x00002000 +#define WAN_TE_BIT_LOOPDOWN_CODE 0x00004000 +#define WAN_TE_BIT_LIU_ALARM 0x00100000 +#define WAN_TE_BIT_LIU_ALARM_SC 0x00200000 +#define WAN_TE_BIT_LIU_ALARM_OC 0x00400000 +#define WAN_TE_BIT_LIU_ALARM_LOS 0x00800000 + #define WAN_TE_BIT_TE1_ALARM 0x8000 /* for Windows only */ #define IS_TE_ALARM(alarm, mask) (alarm & mask) #define IS_TE_ALOS_ALARM(alarm) IS_TE_ALARM(alarm, WAN_TE_BIT_ALOS_ALARM) @@ -116,12 +123,6 @@ #define WAN_TE_BIT_PMON_FER 0x20 /* framing bit error (T1-pmc) */ #define WAN_TE_BIT_PMON_FAS 0x40 /* Frame Alginment signal (E1) */ -/* LIU Alarm bit mask */ -#define WAN_TE_BIT_LIU_ALARM 0x8000 /* print liu status */ -#define WAN_TE_BIT_LIU_ALARM_SC 0x0001 -#define WAN_TE_BIT_LIU_ALARM_OC 0x0002 -#define WAN_TE_BIT_LIU_ALARM_LOS 0x0004 - /* T1/E1 statistics bit mask */ #define WAN_TE_STATS_BIT_ALARM 0x0001 #define WAN_TE_STATS_BIT_RXLEVEL 0x0002 @@ -149,7 +150,7 @@ #define WAN_T1_533_655 0x11 /* T1/E1: Recever */ -#define WAN_TE1_RX_SLEVEL_NONE 0 +#define WAN_TE1_RX_SLEVEL_NONE 0 #define WAN_TE1_RX_SLEVEL_43_DB 430 /* 43 dB E1, RMONEN=0 */ #define WAN_TE1_RX_SLEVEL_36_DB 360 /* 36 dB T1, RMONEN=0 */ #define WAN_TE1_RX_SLEVEL_30_DB 300 /* 30 dB RMONEN=0 | 1 */ @@ -182,44 +183,27 @@ #define WAN_TE1_FR_FLB_MODE 0x09 #define WAN_TE1_FR_PLB_MODE 0x0A #define WAN_TE1_FR_RLB_MODE 0x0B -#define WAN_TE1_LB_TYPE_DECODE(type) \ - (type == WAN_TE1_LINELB_MODE) ? "Line Loopback" : \ - (type == WAN_TE1_PAYLB_MODE) ? "Payload Loopback" : \ - (type == WAN_TE1_DDLB_MODE) ? "Diagnostic Digital Loopback" : \ - (type == WAN_TE1_TX_LB_MODE) ? "TX Loopback" : \ - (type == WAN_TE1_LIU_ALB_MODE) ? "Analog LIU Loopback" : \ - (type == WAN_TE1_LIU_LLB_MODE) ? "Local LIU Loopback" : \ - (type == WAN_TE1_LIU_RLB_MODE) ? "Remote LIU Loopback" : \ - (type == WAN_TE1_LIU_DLB_MODE) ? "Dual LIU Loopback" : \ - (type == WAN_TE1_FR_FLB_MODE) ? "Framer Loopback" : \ - (type == WAN_TE1_FR_RLB_MODE) ? "Remote Framer Loopback" : \ - (type == WAN_TE1_FR_PLB_MODE) ? "Payload Framer Loopback" : \ +#define WAN_TE1_LB_MODE_DECODE(mode) \ + ((mode) == WAN_TE1_LINELB_MODE) ? "Line Loopback" : \ + ((mode) == WAN_TE1_PAYLB_MODE) ? "Payload Loopback" : \ + ((mode) == WAN_TE1_DDLB_MODE) ? "Diagnostic Digital Loopback" : \ + ((mode) == WAN_TE1_TX_LB_MODE) ? "TX Loopback" : \ + ((mode) == WAN_TE1_LIU_ALB_MODE) ? "Analog LIU Loopback" : \ + ((mode) == WAN_TE1_LIU_LLB_MODE) ? "Local LIU Loopback" : \ + ((mode) == WAN_TE1_LIU_RLB_MODE) ? "Remote LIU Loopback" : \ + ((mode) == WAN_TE1_LIU_DLB_MODE) ? "Dual LIU Loopback" : \ + ((mode) == WAN_TE1_FR_FLB_MODE) ? "Framer Loopback" : \ + ((mode) == WAN_TE1_FR_RLB_MODE) ? "Remote Framer Loopback" : \ + ((mode) == WAN_TE1_FR_PLB_MODE) ? "Payload Framer Loopback" : \ "Unknown Loopback" /* Line loopback activate/deactive modes */ #define WAN_TE1_ACTIVATE_LB 0x01 #define WAN_TE1_DEACTIVATE_LB 0x02 - -#if 1 -#define WAN_TE1_LB_MODE_DECODE(mode) \ - ((mode) == WAN_TE1_LINELB_MODE) ? "Line Loopback" : \ - ((mode) == WAN_TE1_PAYLB_MODE) ? "Payload Loopback" : \ - ((mode) == WAN_TE1_DDLB_MODE) ? "Diagnostic Digital Loopback" : \ - ((mode) == WAN_TE1_TX_LB_MODE) ? "TX Loopback" : \ - ((mode) == WAN_TE1_LIU_ALB_MODE) ? "Analog LIU Loopback" : \ - ((mode) == WAN_TE1_LIU_LLB_MODE) ? "Local LIU Loopback" : \ - ((mode) == WAN_TE1_LIU_RLB_MODE) ? "Remote LIU Loopback" : \ - ((mode) == WAN_TE1_LIU_DLB_MODE) ? "Dual LIU Loopback" : \ - ((mode) == WAN_TE1_FR_FLB_MODE) ? "Framer Loopback" : \ - ((mode) == WAN_TE1_FR_RLB_MODE) ? "Remote Framer Loopback" : \ - ((mode) == WAN_TE1_FR_PLB_MODE) ? "Payload Framer Loopback" : \ - "Unknown Loopback" -#else -#define WAN_TE1_LB_MODE_DECODE(mode) \ - (mode == WAN_TE1_ACTIVATE_LB) ? "Activate" : \ - (mode == WAN_TE1_DEACTIVATE_LB) ? "Deactivate" :\ +#define WAN_TE1_LB_ACTION_DECODE(action) \ + ((action) == WAN_TE1_ACTIVATE_LB) ? "Activate" : \ + ((action) == WAN_TE1_DEACTIVATE_LB) ? "Deactivate" :\ "Unknown" -#endif /* T1/E1 front end Master clock source */ #define WAN_TE1_REFCLK_OSC 0x00 @@ -295,6 +279,7 @@ #define TE_POLL_CONFIG 0x0B #define TE_POLL_READ 0x0C #define TE_POLL_WRITE 0x0D +#define TE_POLL_CONFIG_VERIFY 0x0E #define TE_LINKCRIT_TIMER 0x0F #define WAN_TE_POLL_LINKREADY 0x10 @@ -317,6 +302,11 @@ #define FE_HIMPEDANCE_MODE(fe_cfg) (fe_cfg)->cfg.te_cfg.high_impedance_mode #define FE_ACTIVE_CH(fe_cfg) (fe_cfg)->cfg.te_cfg.active_ch #define FE_SIG_MODE(fe_cfg) (fe_cfg)->cfg.te_cfg.sig_mode +#define FE_RX_SLEVEL(fe_cfg) (fe_cfg)->cfg.te_cfg.rx_slevel + +#define GET_TE_START_CHANNEL(fe) \ + (IS_T1_FEMEDIA(fe) ? 1 : \ + IS_E1_FEMEDIA(fe) ? 0 :0) #define GET_TE_CHANNEL_RANGE(fe) \ (IS_T1_FEMEDIA(fe) ? NUM_OF_T1_CHANNELS :\ @@ -359,7 +349,7 @@ (FE_LBO(fe_cfg) == WAN_T1_133_266) ? "133-266ft" : \ (FE_LBO(fe_cfg) == WAN_T1_266_399) ? "266-399ft" : \ (FE_LBO(fe_cfg) == WAN_T1_399_533) ? "399-533ft" : \ - (FE_LBO(fe_cfg) == WAN_T1_533_655) ? "533-599ft": \ + (FE_LBO(fe_cfg) == WAN_T1_533_655) ? "5330-599ft": \ (FE_LBO(fe_cfg) == WAN_E1_120) ? "120OH" : \ (FE_LBO(fe_cfg) == WAN_E1_75) ? "75OH" : \ "Unknown" @@ -381,7 +371,7 @@ #define WAN_FE_SET_DEBUG_MODE (WAN_FE_UDP_CMD_START + 4) #define WAN_FE_TX_MODE (WAN_FE_UDP_CMD_START + 5) -/* FE interrupt types */ +/* FE interrupt types bit-map */ #define WAN_TE_INTR_NONE 0x00 #define WAN_TE_INTR_GLOBAL 0x01 #define WAN_TE_INTR_BASIC 0x02 @@ -398,9 +388,10 @@ typedef struct sdla_te_cfg { u_int32_t active_ch; u_int32_t te_rbs_ch; u_int8_t high_impedance_mode; - int rx_slevel; + int rx_slevel; /* only for high_impedance_mode=YES */ u_int8_t te_ref_clock; u_int8_t sig_mode; + u_int8_t ignore_yel_alarm; } sdla_te_cfg_t; /* Performamce monitor counters */ @@ -582,13 +573,15 @@ typedef struct { unsigned char xlpg_scale; u_int16_t status_cnt; - + int reg_dbg_busy; int reg_dbg_ready; unsigned char reg_dbg_value; wan_ticks_t crit_alarm_start; unsigned int lb_mode; + + int tx_yel_alarm; } sdla_te_param_t; @@ -601,8 +594,8 @@ typedef struct { EXTERN int sdla_te_default_cfg(void* pfe, void* fe_cfg, int media); EXTERN int sdla_te_copycfg(void* pfe, void* fe_cfg); -EXTERN int sdla_te_iface_init(void *p_fe_iface); -EXTERN int sdla_ds_te1_iface_init(void *p_fe_iface); +EXTERN int sdla_te_iface_init(void *p_fe, void *p_fe_iface); +EXTERN int sdla_ds_te1_iface_init(void *p_fe, void *p_fe_iface); #endif /* WAN_KERNEL */ diff --git a/patches/kdrivers/include/sdla_te1_ds.h b/patches/kdrivers/include/sdla_te1_ds.h index 57bf6cb..975401f 100644 --- a/patches/kdrivers/include/sdla_te1_ds.h +++ b/patches/kdrivers/include/sdla_te1_ds.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: sdla_te1_ds.h,v 1.9 2007/01/04 20:16:01 sangoma Exp $ + * $Id: sdla_te1_ds.h,v 1.15 2008/02/06 19:32:19 sangoma Exp $ */ /***************************************************************************** @@ -68,6 +68,7 @@ #define DEVICE_ID_DS26524 0x0C #define DEVICE_ID_DS26522 0x0D #define DEVICE_ID_DS26521 0x0E +#define DEVICE_ID_BAD 0x00 #define DEVICE_ID_SHIFT 3 #define DEVICE_ID_MASK 0x1F #define DEVICE_ID_DS(dev_id) ((dev_id) >> DEVICE_ID_SHIFT) & DEVICE_ID_MASK @@ -94,6 +95,13 @@ #define REG_RSIGC 0x13 #define BIT_RSIGC_CASMS 0x10 +#define REG_T1RCR2 0x14 +#define BIT_T1RCR2_RSLC96 0x10 +#define BIT_T1RCR2_OOF2 0x08 +#define BIT_T1RCR2_OOF1 0x04 +#define BIT_T1RCR2_RAIIE 0x02 +#define BIT_T1RCR2_RD4RM 0x01 + #define REG_RS1 0x40 #define BIT_RS_A 0x08 #define BIT_RS_B 0x04 @@ -348,6 +356,8 @@ #define BIT_RIM5_RNES 0x01 #define REG_RIM7 0xA6 +#define BIT_RIM7_RSLC96 0x08 +#define BIT_RIM7_RFDLF 0x04 #define REG_RSCSE1 0xA8 #define BITS_RSCSE1_ALL 0xFF @@ -536,10 +546,10 @@ #define BIT_TCR1_E1_TCRC4 0x01 #define REG_TCR2 0x182 -#define BIT_TCR2_T1_TD4RM 0x04 -#define BIT_TCR2_T1_TSLC96 0x40 #define BIT_TCR2_T1_TFDLS 0x80 -#define BIT_TCR2_E1_AEBE 0x80 +#define BIT_TCR2_T1_TSLC96 0x40 +#define BIT_TCR2_T1_TD4RM 0x04 +#define BIT_TCR2_E1_AEBE 0x80 /* EBIT */ #define REG_TCR3 0x183 #define BIT_TCR3_ODF 0x80 diff --git a/patches/kdrivers/include/sdla_te1_pmc.h b/patches/kdrivers/include/sdla_te1_pmc.h index 4ea68ed..a15ddbc 100644 --- a/patches/kdrivers/include/sdla_te1_pmc.h +++ b/patches/kdrivers/include/sdla_te1_pmc.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: sdla_te1_pmc.h,v 1.3 2006/10/03 16:45:59 sangoma Exp $ + * $Id: sdla_te1_pmc.h,v 1.4 2007/04/25 21:23:03 sangoma Exp $ */ /***************************************************************************** @@ -225,11 +225,13 @@ #define BIT_SIGX_CHANCFG_RDEBE 0x01 #define REG_T1_XBAS_CFG 0x54 -#define BIT_T1_XBAS_ZCS0 0x01 -#define BIT_T1_XBAS_ZCS1 0x02 #define BIT_T1_XBAS_JPN 0x40 #define BIT_T1_XBAS_B8ZS 0x20 #define BIT_T1_XBAS_ESF 0x10 +#define BIT_T1_XBAS_FMS1 0x08 +#define BIT_T1_XBAS_FMS0 0x04 +#define BIT_T1_XBAS_ZCS1 0x02 +#define BIT_T1_XBAS_ZCS0 0x01 #define REG_T1_XBAS_ALARM_TX 0x55 #define BIT_T1_XBAS_ALARM_TX_XYEL 0x02 diff --git a/patches/kdrivers/include/sdla_te3.h b/patches/kdrivers/include/sdla_te3.h index 988d1a0..f8638ef 100644 --- a/patches/kdrivers/include/sdla_te3.h +++ b/patches/kdrivers/include/sdla_te3.h @@ -21,7 +21,6 @@ #ifndef __SDLA_TE3_H # define __SDLA_TE3_H - #define WAN_TE3_LIU_LB_NORMAL 0x00 #define WAN_TE3_LIU_LB_ANALOG 0x01 #define WAN_TE3_LIU_LB_REMOTE 0x02 @@ -40,7 +39,6 @@ ((mode) == WAN_TE3_DEACTIVATE_LB) ? "Deactivate" :\ "Unknown" - #define WAN_TE3_RDEVICE_NONE 0x00 #define WAN_TE3_RDEVICE_ADTRAN 0x01 #define WAN_TE3_RDEVICE_DIGITALLINK 0x02 diff --git a/patches/kdrivers/include/sdla_te3.h~ b/patches/kdrivers/include/sdla_te3.h~ deleted file mode 100644 index 3863c03..0000000 --- a/patches/kdrivers/include/sdla_te3.h~ +++ /dev/null @@ -1,116 +0,0 @@ -/****************************************************************************** - * - * sdla_te3.h Sangoma T3/E3 front end definitions. - * - * Alex Feldman - * - * Copyright Sangoma Technologies Inc. 1999, 2000, 2001, 2002, 2003, 2004 - * - * This program is provided subject to the Software License included in - * this package in the file license.txt. By using this program you agree - * to be bound bythe terms of this license. - * - * Should you not have a copy of the file license.txt, or wish to obtain - * a hard copy of the Software License, please contact Sangoma - * technologies Corporation. - * - * Contact: Sangoma Technologies Inc. 905-474-1990, info@sangoma.com - * - *****************************************************************************/ - -#ifndef __SDLA_TE3_H -# define __SDLA_TE3_H - - -#define WAN_TE3_LIU_LB_NORMAL 0x00 -#define WAN_TE3_LIU_LB_ANALOG 0x01 -#define WAN_TE3_LIU_LB_REMOTE 0x02 -#define WAN_TE3_LIU_LB_DIGITAL 0x03 -#define WAN_TE3_LB_TYPE_DECODE(type) \ - ((type) == WAN_TE3_LIU_LB_ANALOG) ? "Analog" : \ - ((type) == WAN_TE3_LIU_LB_REMOTE) ? "Remote" : \ - ((type) == WAN_TE3_LIU_LB_DIGITAL) ? "Digital Local" : \ - "Unknown" - -/* Line loopback activate/deactive modes */ -#define WAN_TE3_ACTIVATE_LB 0x01 -#define WAN_TE3_DEACTIVATE_LB 0x02 -#define WAN_TE3_LB_MODE_DECODE(mode) \ - ((mode) == WAN_TE3_ACTIVATE_LB) ? "Activate" : \ - ((mode) == WAN_TE3_DEACTIVATE_LB) ? "Deactivate" :\ - "Unknown" - - -#define WAN_TE3_RDEVICE_NONE 0x00 -#define WAN_TE3_RDEVICE_ADTRAN 0x01 -#define WAN_TE3_RDEVICE_DIGITALLINK 0x02 -#define WAN_TE3_RDEVICE_KENTROX 0x03 -#define WAN_TE3_RDEVICE_LARSCOM 0x04 -#define WAN_TE3_RDEVICE_VERILINK 0x05 - -#define WAN_TE3_BIT_LOS_ALARM 0x0001 -#define WAN_TE3_BIT_OOF_ALARM 0x0002 -#define WAN_TE3_BIT_AIS_ALARM 0x0004 -#define WAN_TE3_BIT_AIC_ALARM 0x0008 -#define WAN_TE3_BIT_YEL_ALARM 0x0010 -#define WAN_TE3_BIT_LOF_ALARM 0x0020 - -#define RDEVICE_DECODE(rdevice) \ - (rdevice == WAN_TE3_RDEVICE_NONE) ? "None" : \ - (rdevice == WAN_TE3_RDEVICE_ADTRAN) ? "ADTRAN" : \ - (rdevice == WAN_TE3_RDEVICE_DIGITALLINK) ? "DIGITALLINK" : \ - (rdevice == WAN_TE3_RDEVICE_KENTROX) ? "KENTROX" : \ - (rdevice == WAN_TE3_RDEVICE_LARSCOM) ? "LARSCOM" : \ - (rdevice == WAN_TE3_RDEVICE_VERILINK) ? "VERLINK" : \ - "Unknown" - -typedef struct { - int rx_equal; /* receive equalization enable (TRUE/FALSE) */ - int taos; /* transmit all ones select (TRUE/FALSE) */ - int lb_mode; /* loopback modes */ - int tx_lbo; /* transmit line build-out (TRUE/FALSE) */ -} sdla_te3_liu_cfg_t; - -typedef struct { - sdla_te3_liu_cfg_t liu_cfg; - int fractional; - int rdevice_type; - int fcs; - int clock; - unsigned char lcode; -} sdla_te3_cfg_t; - -typedef struct { - u_int32_t pmon_lcv; - u_int32_t pmon_framing; - u_int32_t pmon_parity; - u_int32_t pmon_febe; - u_int32_t pmon_cpbit; -} sdla_te3_pmon_t; - -#define IS_DS3(cfg) ((cfg)->media == WAN_MEDIA_DS3) -#define IS_E3(cfg) ((cfg)->media == WAN_MEDIA_E3) -#define IS_TE3(cfg) ( \ - (cfg)->media == WAN_MEDIA_DS3 || \ - (cfg)->media == WAN_MEDIA_E3) - - -#define WAN_TE3_ALARM(alarm, bit) ((alarm) & (bit)) ? "ON" : "OFF" - -#define WAN_TE3_LOS_ALARM(alarm) WAN_TE3_ALARM(alarm, WAN_TE3_BIT_LOS_ALARM) -#define WAN_TE3_OOF_ALARM(alarm) WAN_TE3_ALARM(alarm, WAN_TE3_BIT_OOF_ALARM) -#define WAN_TE3_AIS_ALARM(alarm) WAN_TE3_ALARM(alarm, WAN_TE3_BIT_AIS_ALARM) -#define WAN_TE3_AIC_ALARM(alarm) WAN_TE3_ALARM(alarm, WAN_TE3_BIT_AIC_ALARM) -#define WAN_TE3_YEL_ALARM(alarm) WAN_TE3_ALARM(alarm, WAN_TE3_BIT_YEL_ALARM) -#define WAN_TE3_LOF_ALARM(alarm) WAN_TE3_ALARM(alarm, WAN_TE3_BIT_LOF_ALARM) - -#if defined(WAN_KERNEL) - -typedef struct { - int dummy; -} sdla_te3_param_t; - -int sdla_te3_iface_init(void *p_fe_iface); -#endif /* WAN_KERNEL */ - -#endif /* __SDLA_TE3_H */ diff --git a/patches/kdrivers/include/sdla_x25.h b/patches/kdrivers/include/sdla_x25.h index b71ba8e..5a1d645 100644 --- a/patches/kdrivers/include/sdla_x25.h +++ b/patches/kdrivers/include/sdla_x25.h @@ -59,16 +59,16 @@ */ typedef struct X25Cmd { - unsigned char command ; /* command code */ - unsigned short length ; /* transfer data length */ - unsigned char result ; /* return code */ - unsigned char pf ; /* P/F bit */ - unsigned short lcn ; /* logical channel */ - unsigned char qdm ; /* Q/D/M bits */ - unsigned char cause ; /* cause field */ - unsigned char diagn ; /* diagnostics */ - unsigned char pktType ; /* packet type */ - unsigned char resrv[4] ; /* reserved */ + unsigned char command ; /* command code */ + unsigned short length ; /* transfer data length */ + unsigned char result ; /* return code */ + unsigned char pf ; /* P/F bit */ + unsigned short lcn ; /* logical channel */ + unsigned char qdm ; /* Q/D/M bits */ + unsigned char cause ; /* cause field */ + unsigned char diagn ; /* diagnostics */ + unsigned char pktType ; /* packet type */ + unsigned char resrv[4] ; /* reserved */ } TX25Cmd; /* @@ -237,9 +237,9 @@ typedef struct X25Cmd */ typedef struct X25Mbox { - unsigned char opflag ; /* 00h: execution flag */ - TX25Cmd cmd ; /* 01h: command block */ - unsigned char data[1] ; /* 10h: data buffer */ + unsigned char opflag ; /* 00h: execution flag */ + TX25Cmd cmd ; /* 01h: command block */ + unsigned char data[1] ; /* 10h: data buffer */ } TX25Mbox; /*---------------------------------------------------------------------------- @@ -247,11 +247,11 @@ typedef struct X25Mbox */ typedef struct X25TimeStamp { - unsigned char month ; - unsigned char date ; - unsigned char sec ; - unsigned char min ; - unsigned char hour ; + unsigned char month ; + unsigned char date ; + unsigned char sec ; + unsigned char min ; + unsigned char hour ; } TX25TimeStamp; /*---------------------------------------------------------------------------- @@ -261,16 +261,16 @@ typedef struct X25TimeStamp */ typedef struct X25Status { - unsigned short pvc_map ; /* 00h: PVC map */ - unsigned short icc_map ; /* 02h: Incomming Chan. map */ - unsigned short twc_map ; /* 04h: Two-way Cnan. map */ - unsigned short ogc_map ; /* 06h: Outgoing Chan. map */ - TX25TimeStamp tstamp ; /* 08h: timestamp (BCD) */ - unsigned char iflags ; /* 0Dh: interrupt flags */ - unsigned char imask ; /* 0Eh: interrupt mask */ - unsigned char resrv ; /* 0Eh: */ - unsigned char gflags ; /* 10h: misc. HDLC/X25 flags */ - unsigned char cflags[X25_MAX_CHAN] ; /* channel status bytes */ + unsigned short pvc_map ; /* 00h: PVC map */ + unsigned short icc_map ; /* 02h: Incomming Chan. map */ + unsigned short twc_map ; /* 04h: Two-way Cnan. map */ + unsigned short ogc_map ; /* 06h: Outgoing Chan. map */ + TX25TimeStamp tstamp ; /* 08h: timestamp (BCD) */ + unsigned char iflags ; /* 0Dh: interrupt flags */ + unsigned char imask ; /* 0Eh: interrupt mask */ + unsigned char resrv ; /* 0Eh: */ + unsigned char gflags ; /* 10h: misc. HDLC/X25 flags */ + unsigned char cflags[X25_MAX_CHAN] ; /* channel status bytes */ } TX25Status; /* @@ -308,9 +308,9 @@ typedef struct X25Status */ typedef struct X25GlobalVars { - unsigned char resrv ; /* 00h: reserved */ - unsigned char dtrCtl ; /* 01h: DTR control code */ - unsigned char resErr ; /* 01h: '1' - reset modem error */ + unsigned char resrv ; /* 00h: reserved */ + unsigned char dtrCtl ; /* 01h: DTR control code */ + unsigned char resErr ; /* 01h: '1' - reset modem error */ } TX25GlobalVars; /* @@ -324,7 +324,7 @@ typedef struct X25GlobalVars */ typedef struct X25ModemStatus { - unsigned char status ; /* 00h: modem status */ + unsigned char status ; /* 00h: modem status */ } TX25ModemStatus; /* @@ -338,11 +338,11 @@ typedef struct X25ModemStatus */ typedef struct X25LinkStatus { - unsigned char txQueued ; /* 00h: queued Tx I-frames*/ - unsigned char rxQueued ; /* 01h: queued Rx I-frames*/ - unsigned char station ; /* 02h: DTE/DCE config. */ - unsigned char reserved ; /* 03h: reserved */ - unsigned char sfTally ; /* 04h: supervisory frame tally */ + unsigned char txQueued ; /* 00h: queued Tx I-frames*/ + unsigned char rxQueued ; /* 01h: queued Rx I-frames*/ + unsigned char station ; /* 02h: DTE/DCE config. */ + unsigned char reserved ; /* 03h: reserved */ + unsigned char sfTally ; /* 04h: supervisory frame tally */ } TX25LinkStatus; /* @@ -356,23 +356,23 @@ typedef struct X25LinkStatus */ typedef struct HdlcStats { /* a number of ... */ - unsigned short rxIFrames ; /* 00h: ready Rx I-frames */ - unsigned short rxNoseq ; /* 02h: frms out-of-sequence */ - unsigned short rxNodata ; /* 04h: I-frms without data */ - unsigned short rxDiscarded ; /* 06h: discarded frames */ - unsigned short rxTooLong ; /* 08h: frames too long */ - unsigned short rxBadAddr ; /* 0Ah: frms with inval.addr*/ - unsigned short txAcked ; /* 0Ch: acknowledged I-frms */ - unsigned short txRetransm ; /* 0Eh: re-transmit. I-frms */ - unsigned short t1Timeout ; /* 10h: T1 timeouts */ - unsigned short rxSABM ; /* 12h: received SABM frames */ - unsigned short rxDISC ; /* 14h: received DISC frames */ - unsigned short rxDM ; /* 16h: received DM frames */ - unsigned short rxFRMR ; /* 18h: FRMR frames received */ - unsigned short txSABM ; /* 1Ah: transm. SABM frames*/ - unsigned short txDISC ; /* 1Ch: transm. DISC frames*/ - unsigned short txDM ; /* 1Eh: transm. DM frames */ - unsigned short txFRMR ; /* 20h: transm. FRMR frames*/ + unsigned short rxIFrames ; /* 00h: ready Rx I-frames */ + unsigned short rxNoseq ; /* 02h: frms out-of-sequence */ + unsigned short rxNodata ; /* 04h: I-frms without data */ + unsigned short rxDiscarded ; /* 06h: discarded frames */ + unsigned short rxTooLong ; /* 08h: frames too long */ + unsigned short rxBadAddr ; /* 0Ah: frms with inval.addr*/ + unsigned short txAcked ; /* 0Ch: acknowledged I-frms */ + unsigned short txRetransm ; /* 0Eh: re-transmit. I-frms */ + unsigned short t1Timeout ; /* 10h: T1 timeouts */ + unsigned short rxSABM ; /* 12h: received SABM frames */ + unsigned short rxDISC ; /* 14h: received DISC frames */ + unsigned short rxDM ; /* 16h: received DM frames */ + unsigned short rxFRMR ; /* 18h: FRMR frames received */ + unsigned short txSABM ; /* 1Ah: transm. SABM frames*/ + unsigned short txDISC ; /* 1Ch: transm. DISC frames*/ + unsigned short txDM ; /* 1Eh: transm. DM frames */ + unsigned short txFRMR ; /* 20h: transm. FRMR frames*/ } THdlcStats; /* --------------------------------------------------------------------------- @@ -380,16 +380,16 @@ typedef struct HdlcStats */ typedef struct HdlcCommErr { /* a number of ... */ - unsigned char rxOverrun ; /* 00h: Rx overrun errors */ - unsigned char rxBadCrc ; /* 01h: Rx CRC errors */ - unsigned char rxAborted ; /* 02h: Rx aborted frames */ - unsigned char rxDropped ; /* 03h: frames lost */ - unsigned char txAborted ; /* 04h: Tx aborted frames */ - unsigned char txUnderrun ; /* 05h: Tx underrun errors */ - unsigned char txMissIntr ; /* 06h: missed underrun ints */ - unsigned char reserved ; /* 07h: reserved */ - unsigned char droppedDCD ; /* 08h: times DCD dropped */ - unsigned char droppedCTS ; /* 09h: times CTS dropped */ + unsigned char rxOverrun ; /* 00h: Rx overrun errors */ + unsigned char rxBadCrc ; /* 01h: Rx CRC errors */ + unsigned char rxAborted ; /* 02h: Rx aborted frames */ + unsigned char rxDropped ; /* 03h: frames lost */ + unsigned char txAborted ; /* 04h: Tx aborted frames */ + unsigned char txUnderrun ; /* 05h: Tx underrun errors */ + unsigned char txMissIntr ; /* 06h: missed underrun ints */ + unsigned char reserved ; /* 07h: reserved */ + unsigned char droppedDCD ; /* 08h: times DCD dropped */ + unsigned char droppedCTS ; /* 09h: times CTS dropped */ } THdlcCommErr; /* --------------------------------------------------------------------------- @@ -397,44 +397,44 @@ typedef struct HdlcCommErr */ typedef struct X25Config { -unsigned char baudRate ; /* 00h: */ - unsigned char t1 ; /* 01h: */ - unsigned char t2 ; /* 02h: */ - unsigned char n2 ; /* 03h: */ - unsigned short hdlcMTU ; /* 04h: */ - unsigned char hdlcWindow ; /* 06h: */ - unsigned char t4 ; /* 07h: */ - unsigned char autoModem ; /* 08h: */ - unsigned char autoHdlc ; /* 09h: */ - unsigned char hdlcOptions ; /* 0Ah: */ - unsigned char station ; /* 0Bh: */ - unsigned char pktWindow ; /* 0Ch: */ - unsigned short defPktSize ; /* 0Dh: */ - unsigned short pktMTU ; /* 0Fh: */ - unsigned short loPVC ; /* 11h: */ - unsigned short hiPVC ; /* 13h: */ - unsigned short loIncommingSVC ; /* 15h: */ - unsigned short hiIncommingSVC ; /* 17h: */ - unsigned short loTwoWaySVC ; /* 19h: */ - unsigned short hiTwoWaySVC ; /* 1Bh: */ - unsigned short loOutgoingSVC ; /* 1Dh: */ - unsigned short hiOutgoingSVC ; /* 1Fh: */ - unsigned short options ; /* 21h: */ - unsigned char responseOpt ; /* 23h: */ - unsigned short facil1 ; /* 24h: */ - unsigned short facil2 ; /* 26h: */ - unsigned short ccittFacil ; /* 28h: */ - unsigned short otherFacil ; /* 2Ah: */ - unsigned short ccittCompat ; /* 2Ch: */ - unsigned char t10t20 ; /* 2Eh: */ - unsigned char t11t21 ; /* 2Fh: */ - unsigned char t12t22 ; /* 30h: */ - unsigned char t13t23 ; /* 31h: */ - unsigned char t16t26 ; /* 32H: */ - unsigned char t28 ; /* 33h: */ - unsigned char r10r20 ; /* 34h: */ - unsigned char r12r22 ; /* 35h: */ - unsigned char r13r23 ; /* 36h: */ +unsigned char baudRate ; /* 00h: */ + unsigned char t1 ; /* 01h: */ + unsigned char t2 ; /* 02h: */ + unsigned char n2 ; /* 03h: */ + unsigned short hdlcMTU ; /* 04h: */ + unsigned char hdlcWindow ; /* 06h: */ + unsigned char t4 ; /* 07h: */ + unsigned char autoModem ; /* 08h: */ + unsigned char autoHdlc ; /* 09h: */ + unsigned char hdlcOptions ; /* 0Ah: */ + unsigned char station ; /* 0Bh: */ + unsigned char pktWindow ; /* 0Ch: */ + unsigned short defPktSize ; /* 0Dh: */ + unsigned short pktMTU ; /* 0Fh: */ + unsigned short loPVC ; /* 11h: */ + unsigned short hiPVC ; /* 13h: */ + unsigned short loIncommingSVC ; /* 15h: */ + unsigned short hiIncommingSVC ; /* 17h: */ + unsigned short loTwoWaySVC ; /* 19h: */ + unsigned short hiTwoWaySVC ; /* 1Bh: */ + unsigned short loOutgoingSVC ; /* 1Dh: */ + unsigned short hiOutgoingSVC ; /* 1Fh: */ + unsigned short options ; /* 21h: */ + unsigned char responseOpt ; /* 23h: */ + unsigned short facil1 ; /* 24h: */ + unsigned short facil2 ; /* 26h: */ + unsigned short ccittFacil ; /* 28h: */ + unsigned short otherFacil ; /* 2Ah: */ + unsigned short ccittCompat ; /* 2Ch: */ + unsigned char t10t20 ; /* 2Eh: */ + unsigned char t11t21 ; /* 2Fh: */ + unsigned char t12t22 ; /* 30h: */ + unsigned char t13t23 ; /* 31h: */ + unsigned char t16t26 ; /* 32H: */ + unsigned char t28 ; /* 33h: */ + unsigned char r10r20 ; /* 34h: */ + unsigned char r12r22 ; /* 35h: */ + unsigned char r13r23 ; /* 36h: */ } TX25Config; #define X25_PACKET_WINDOW 0x02 /* Default value for Window Size */ @@ -443,21 +443,21 @@ unsigned char baudRate ; /* 00h: */ */ typedef struct X25ChanAlloc /*----- Channel allocation -*/ { - unsigned short loPVC ; /* 00h: lowest PVC number */ - unsigned short hiPVC ; /* 02h: highest PVC number */ - unsigned short loIncommingSVC ; /* 04h: lowest incoming SVC */ - unsigned short hiIncommingSVC ; /* 06h: highest incoming SVC */ - unsigned short loTwoWaySVC ; /* 08h: lowest two-way SVC */ - unsigned short hiTwoWaySVC ; /* 0Ah: highest two-way SVC */ - unsigned short loOutgoingSVC ; /* 0Ch: lowest outgoing SVC */ - unsigned short hiOutgoingSVC ; /* 0Eh: highest outgoing SVC */ + unsigned short loPVC ; /* 00h: lowest PVC number */ + unsigned short hiPVC ; /* 02h: highest PVC number */ + unsigned short loIncommingSVC ; /* 04h: lowest incoming SVC */ + unsigned short hiIncommingSVC ; /* 06h: highest incoming SVC */ + unsigned short loTwoWaySVC ; /* 08h: lowest two-way SVC */ + unsigned short hiTwoWaySVC ; /* 0Ah: highest two-way SVC */ + unsigned short loOutgoingSVC ; /* 0Ch: lowest outgoing SVC */ + unsigned short hiOutgoingSVC ; /* 0Eh: highest outgoing SVC */ } TX25ChanAlloc; typedef struct X25ChanCfg /*------ Channel configuration -----*/ { - unsigned char type ; /* 00h: channel type */ - unsigned char txConf ; /* 01h: Tx packet and window sizes */ - unsigned char rxConf ; /* 01h: Rx packet and window sizes */ + unsigned char type ; /* 00h: channel type */ + unsigned char txConf ; /* 01h: Tx packet and window sizes */ + unsigned char rxConf ; /* 01h: Rx packet and window sizes */ } TX25ChanCfg; /* @@ -473,38 +473,38 @@ typedef struct X25ChanCfg /*------ Channel configuration -----*/ */ typedef struct X25Stats { /* number of packets Tx/Rx'ed */ - unsigned short txRestartRqst ; /* 00h: Restart Request */ - unsigned short rxRestartRqst ; /* 02h: Restart Request */ - unsigned short txRestartConf ; /* 04h: Restart Confirmation */ - unsigned short rxRestartConf ; /* 06h: Restart Confirmation */ - unsigned short txResetRqst ; /* 08h: Reset Request */ - unsigned short rxResetRqst ; /* 0Ah: Reset Request */ - unsigned short txResetConf ; /* 0Ch: Reset Confirmation */ - unsigned short rxResetConf ; /* 0Eh: Reset Confirmation */ - unsigned short txCallRequest ; /* 10h: Call Request */ - unsigned short rxCallRequest ; /* 12h: Call Request */ - unsigned short txCallAccept ; /* 14h: Call Accept */ - unsigned short rxCallAccept ; /* 16h: Call Accept */ - unsigned short txClearRqst ; /* 18h: Clear Request */ - unsigned short rxClearRqst ; /* 1Ah: Clear Request */ - unsigned short txClearConf ; /* 1Ch: Clear Confirmation */ - unsigned short rxClearConf ; /* 1Eh: Clear Confirmation */ - unsigned short txDiagnostic ; /* 20h: Diagnostic */ - unsigned short rxDiagnostic ; /* 22h: Diagnostic */ - unsigned short txRegRqst ; /* 24h: Registration Request */ - unsigned short rxRegRqst ; /* 26h: Registration Request */ - unsigned short txRegConf ; /* 28h: Registration Confirm.*/ - unsigned short rxRegConf ; /* 2Ah: Registration Confirm.*/ - unsigned short txInterrupt ; /* 2Ch: Interrupt */ - unsigned short rxInterrupt ; /* 2Eh: Interrupt */ - unsigned short txIntrConf ; /* 30h: Interrupt Confirm. */ - unsigned short rxIntrConf ; /* 32h: Interrupt Confirm. */ - unsigned short txData ; /* 34h: Data */ - unsigned short rxData ; /* 36h: Data */ - unsigned short txRR ; /* 38h: RR */ - unsigned short rxRR ; /* 3Ah: RR */ - unsigned short txRNR ; /* 3Ch: RNR */ - unsigned short rxRNR ; /* 3Eh: RNR */ + unsigned short txRestartRqst ; /* 00h: Restart Request */ + unsigned short rxRestartRqst ; /* 02h: Restart Request */ + unsigned short txRestartConf ; /* 04h: Restart Confirmation */ + unsigned short rxRestartConf ; /* 06h: Restart Confirmation */ + unsigned short txResetRqst ; /* 08h: Reset Request */ + unsigned short rxResetRqst ; /* 0Ah: Reset Request */ + unsigned short txResetConf ; /* 0Ch: Reset Confirmation */ + unsigned short rxResetConf ; /* 0Eh: Reset Confirmation */ + unsigned short txCallRequest ; /* 10h: Call Request */ + unsigned short rxCallRequest ; /* 12h: Call Request */ + unsigned short txCallAccept ; /* 14h: Call Accept */ + unsigned short rxCallAccept ; /* 16h: Call Accept */ + unsigned short txClearRqst ; /* 18h: Clear Request */ + unsigned short rxClearRqst ; /* 1Ah: Clear Request */ + unsigned short txClearConf ; /* 1Ch: Clear Confirmation */ + unsigned short rxClearConf ; /* 1Eh: Clear Confirmation */ + unsigned short txDiagnostic ; /* 20h: Diagnostic */ + unsigned short rxDiagnostic ; /* 22h: Diagnostic */ + unsigned short txRegRqst ; /* 24h: Registration Request */ + unsigned short rxRegRqst ; /* 26h: Registration Request */ + unsigned short txRegConf ; /* 28h: Registration Confirm.*/ + unsigned short rxRegConf ; /* 2Ah: Registration Confirm.*/ + unsigned short txInterrupt ; /* 2Ch: Interrupt */ + unsigned short rxInterrupt ; /* 2Eh: Interrupt */ + unsigned short txIntrConf ; /* 30h: Interrupt Confirm. */ + unsigned short rxIntrConf ; /* 32h: Interrupt Confirm. */ + unsigned short txData ; /* 34h: Data */ + unsigned short rxData ; /* 36h: Data */ + unsigned short txRR ; /* 38h: RR */ + unsigned short rxRR ; /* 3Ah: RR */ + unsigned short txRNR ; /* 3Ch: RNR */ + unsigned short rxRNR ; /* 3Eh: RNR */ } TX25Stats; /*---------------------------------------------------------------------------- @@ -512,12 +512,12 @@ typedef struct X25Stats */ typedef struct X25EventLog { - unsigned char type ; /* 00h: transaction type */ - unsigned short lcn ; /* 01h: logical channel num */ - unsigned char packet ; /* 03h: async packet type */ - unsigned char cause ; /* 04h: X.25 cause field */ - unsigned char diag ; /* 05h: X.25 diag field */ - TX25TimeStamp ts ; /* 06h: time stamp */ + unsigned char type ; /* 00h: transaction type */ + unsigned short lcn ; /* 01h: logical channel num */ + unsigned char packet ; /* 03h: async packet type */ + unsigned char cause ; /* 04h: X.25 cause field */ + unsigned char diag ; /* 05h: X.25 diag field */ + TX25TimeStamp ts ; /* 06h: time stamp */ } TX25EventLog; /* @@ -551,8 +551,8 @@ typedef struct X25EventLog */ typedef struct X25TraceCfg { - unsigned char flags ; /* 00h: trace configuration flags */ - unsigned char timeout ; /* 01h: timeout for trace delay mode*/ + unsigned char flags ; /* 00h: trace configuration flags */ + unsigned char timeout ; /* 01h: timeout for trace delay mode*/ } TX25TraceCfg; /* @@ -572,12 +572,12 @@ typedef struct X25TraceCfg */ typedef struct X25Trace /*----- Trace data structure -------*/ { - unsigned short length ; /* 00h: trace data length */ - unsigned char type ; /* 02h: trace type */ - unsigned char lost_cnt ; /* 03h: N of traces lost */ - TX25TimeStamp tstamp ; /* 04h: mon/date/sec/min/hour */ - unsigned short millisec ; /* 09h: ms time stamp */ - unsigned char data[0] ; /* 0Bh: traced frame */ + unsigned short length ; /* 00h: trace data length */ + unsigned char type ; /* 02h: trace type */ + unsigned char lost_cnt ; /* 03h: N of traces lost */ + TX25TimeStamp tstamp ; /* 04h: mon/date/sec/min/hour */ + unsigned short millisec ; /* 09h: ms time stamp */ + unsigned char data[0] ; /* 0Bh: traced frame */ } TX25Trace; /* @@ -602,17 +602,17 @@ typedef struct X25Trace /*----- Trace data structure -------*/ typedef struct HDLCFrame /*----- DHLC Frame Format ----------*/ { - unsigned char addr ; /* address field */ - unsigned char cntl ; /* control field */ - unsigned char data[0] ; + unsigned char addr ; /* address field */ + unsigned char cntl ; /* control field */ + unsigned char data[0] ; } THDLCFrame; typedef struct X25Pkt /*----- X.25 Paket Format ----------*/ { - unsigned char lcn_hi ; /* 4 MSB of Logical Channel Number */ - unsigned char lcn_lo ; /* 8 LSB of Logical Channel Number */ - unsigned char type ; - unsigned char data[0] ; + unsigned char lcn_hi ; /* 4 MSB of Logical Channel Number */ + unsigned char lcn_lo ; /* 8 LSB of Logical Channel Number */ + unsigned char type ; + unsigned char data[0] ; } TX25Pkt; /* @@ -646,29 +646,29 @@ typedef struct X25Pkt /*----- X.25 Paket Format ----------*/ typedef struct { - TX25Cmd cmd ; - char data[X25_MAX_DATA] ; + TX25Cmd cmd ; + char data[X25_MAX_DATA] ; } mbox_cmd_t; #if 0 typedef struct { - unsigned char qdm ; /* Q/D/M bits */ - unsigned char cause ; /* cause field */ - unsigned char diagn ; /* diagnostics */ - unsigned char pktType ; - unsigned short length ; - unsigned char result ; - unsigned short lcn ; - unsigned short mtu ; - unsigned short mru ; - char reserved[3] ; + unsigned char qdm ; /* Q/D/M bits */ + unsigned char cause ; /* cause field */ + unsigned char diagn ; /* diagnostics */ + unsigned char pktType ; + unsigned short length ; + unsigned char result ; + unsigned short lcn ; + unsigned short mtu ; + unsigned short mru ; + char reserved[3] ; }x25api_hdr_t; typedef struct { - x25api_hdr_t hdr ; - char data[X25_MAX_DATA] ; + x25api_hdr_t hdr ; + char data[X25_MAX_DATA] ; }x25api_t; #endif @@ -688,74 +688,72 @@ typedef struct { #if 0 typedef struct { - unsigned char opp_flag ; /* the opp flag */ - unsigned char command ; /* command code */ - unsigned short length ; /* transfer data length */ - unsigned char result ; /* return code */ - unsigned char pf ; /* P/F bit */ - unsigned short lcn ; /* logical channel */ - unsigned char qdm ; /* Q/D/M bits */ - unsigned char cause ; /* cause field */ - unsigned char diagn ; /* diagnostics */ - unsigned char pktType ; /* packet type */ - unsigned char resrv[4] ; /* reserved */ + unsigned char opp_flag ; /* the opp flag */ + unsigned char command ; /* command code */ + unsigned short length ; /* transfer data length */ + unsigned char result ; /* return code */ + unsigned char pf ; /* P/F bit */ + unsigned short lcn ; /* logical channel */ + unsigned char qdm ; /* Q/D/M bits */ + unsigned char cause ; /* cause field */ + unsigned char diagn ; /* diagnostics */ + unsigned char pktType ; /* packet type */ + unsigned char resrv[4] ; /* reserved */ } cblock_t; typedef struct { - ip_pkt_t ip_pkt ; - udp_pkt_t udp_pkt ; - wp_mgmt_t wp_mgmt ; - cblock_t cblock ; - unsigned char data[4080] ; + ip_pkt_t ip_pkt ; + udp_pkt_t udp_pkt ; + wp_mgmt_t wp_mgmt ; + cblock_t cblock ; + unsigned char data[4080] ; } x25_udp_pkt_t; #endif typedef struct read_hdlc_stat { - unsigned short inf_frames_rx_ok ; - unsigned short inf_frames_rx_out_of_seq ; - unsigned short inf_frames_rx_no_data ; - unsigned short inf_frames_rx_dropped ; - unsigned short inf_frames_rx_data_too_long ; - unsigned short inf_frames_rx_invalid_addr ; - unsigned short inf_frames_tx_ok ; - unsigned short inf_frames_tx_retransmit ; - unsigned short T1_timeouts ; - unsigned short SABM_frames_rx ; - unsigned short DISC_frames_rx ; - unsigned short DM_frames_rx ; - unsigned short FRMR_frames_rx ; - unsigned short SABM_frames_tx ; - unsigned short DISC_frames_tx ; - unsigned short DM_frames_tx ; - unsigned short FRMR_frames_tx ; + unsigned short inf_frames_rx_ok ; + unsigned short inf_frames_rx_out_of_seq ; + unsigned short inf_frames_rx_no_data ; + unsigned short inf_frames_rx_dropped ; + unsigned short inf_frames_rx_data_too_long ; + unsigned short inf_frames_rx_invalid_addr ; + unsigned short inf_frames_tx_ok ; + unsigned short inf_frames_tx_retransmit ; + unsigned short T1_timeouts ; + unsigned short SABM_frames_rx ; + unsigned short DISC_frames_rx ; + unsigned short DM_frames_rx ; + unsigned short FRMR_frames_rx ; + unsigned short SABM_frames_tx ; + unsigned short DISC_frames_tx ; + unsigned short DM_frames_tx ; + unsigned short FRMR_frames_tx ; } read_hdlc_stat_t; typedef struct read_comms_err_stats{ - unsigned char overrun_err_rx ; - unsigned char CRC_err ; - unsigned char abort_frames_rx ; - unsigned char frames_dropped_buf_full ; - unsigned char abort_frames_tx ; - unsigned char transmit_underruns ; - unsigned char missed_tx_underruns_intr ; - unsigned char reserved ; - unsigned char DCD_drop ; - unsigned char CTS_drop ; + unsigned char overrun_err_rx ; + unsigned char CRC_err ; + unsigned char abort_frames_rx ; + unsigned char frames_dropped_buf_full ; + unsigned char abort_frames_tx ; + unsigned char transmit_underruns ; + unsigned char missed_tx_underruns_intr ; + unsigned char reserved ; + unsigned char DCD_drop ; + unsigned char CTS_drop ; } read_comms_err_stats_t; typedef struct trace_data { - unsigned short length ; - unsigned char type ; - unsigned char trace_dropped ; - unsigned char reserved[5] ; - unsigned short timestamp ; - unsigned int sec ; - unsigned int usec ; - unsigned char data[0] ; + unsigned short length ; + unsigned char type ; + unsigned char trace_dropped ; + unsigned char reserved[5] ; + unsigned short timestamp ; + unsigned int sec ; + unsigned int usec ; + unsigned char data[0] ; } trace_data_t; -#pragma pack() - enum {UDP_XPIPE_TYPE}; #define XPIPE_ENABLE_TRACING 0x14 @@ -786,5 +784,6 @@ enum {UDP_XPIPE_TYPE}; #define TRACE_ALL_HDLC_FRMS 0x40 #define TRACE_DATA_FRMS 0x08 +#pragma pack() #endif /* _SDLA_X25_H */ diff --git a/patches/kdrivers/include/sdla_xilinx.h b/patches/kdrivers/include/sdla_xilinx.h index ff24743..c56e9f7 100644 --- a/patches/kdrivers/include/sdla_xilinx.h +++ b/patches/kdrivers/include/sdla_xilinx.h @@ -926,8 +926,10 @@ typedef struct { } api_tx_element_t; #pragma pack() +#if !defined(__WINDOWS__)/* use 'wan_udphdr_aft_data'! */ #undef wan_udphdr_data #define wan_udphdr_data wan_udphdr_u.aft.data +#endif /*========================================== * Board CPLD Interface Section @@ -1005,7 +1007,8 @@ enum { TX_DMA_BUF_INIT =0, TX_DMA_BUF_USED }; - + +#if !defined(__WINDOWS__) enum { ROUTER_UP_TIME = 0x50, ENABLE_TRACING, @@ -1023,6 +1026,7 @@ enum { AFT_HWEC_STATUS, DIGITAL_LOOPTEST }; +#endif #define UDPMGMT_SIGNATURE "AFTPIPEA" @@ -1044,6 +1048,9 @@ typedef struct wp_rx_element unsigned int reg; unsigned int align; unsigned char pkt_error; +#if defined(__WINDOWS__) + api_header_t rx_info; +#endif }wp_rx_element_t; @@ -1102,23 +1109,30 @@ static __inline void set_channel_timeslot_sync(u32 *reg,unsigned int timeslot) static __inline unsigned short xilinx_valid_mtu(unsigned short mtu) { + unsigned short new_mtu = 0; if (mtu <= 128){ - return 128; + new_mtu = 128; }else if (mtu <= 256){ - return 256; + new_mtu = 256; }else if (mtu <= 512){ - return 512; + new_mtu = 512; }else if (mtu <= 1024){ - return 1024; + new_mtu = 1024; }else if (mtu <= 2048){ - return 2048; + new_mtu = 2048; }else if (mtu <= 4096){ - return 4096; + new_mtu = 4096; }else if (mtu <= 8188){ - return 8188; + new_mtu = 8188; }else{ return 0; } +#if defined(__FreeBSD__) + if (new_mtu > MCLBYTES - 16){ + new_mtu = MCLBYTES-16; + } +#endif + return new_mtu; } static __inline unsigned short xilinx_dma_buf_bits(unsigned short dma_bufs) diff --git a/patches/kdrivers/include/sdladrv.h b/patches/kdrivers/include/sdladrv.h index c3c593a..7657e48 100644 --- a/patches/kdrivers/include/sdladrv.h +++ b/patches/kdrivers/include/sdladrv.h @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: sdladrv.h,v 1.69 2007/03/23 15:10:01 sangoma Exp $ + * $Id: sdladrv.h,v 1.93 2008/03/06 14:02:42 sangoma Exp $ */ /***************************************************************************** @@ -38,7 +38,11 @@ * Author: Alex Feldman * * ============================================================================ + * Nov 27, 2007 David Rokhvarg Implemented functions/definitions for + * Sangoma MS Windows Driver and API. + * * Dec 06, 1999 Alex Feldman Updated to FreeBSD 3.2 + * * Dec 06, 1995 Gene Kozin Initial version. ***************************************************************************** */ @@ -51,6 +55,10 @@ # define EXTERN extern #endif +#if defined(__LINUX__) +# define WAN_ISA_SUPPORT +#endif + /* ****************************************************************** ** I N C L U D E S ** @@ -60,13 +68,19 @@ # include # include #elif defined(__FreeBSD__) -# ifdef __SDLADRV__ -# include +# if defined(__SDLADRV__) +# if defined(SDLA_AUTO_PROBE) +# include +# else +# include +# endif # endif #elif defined(__OpenBSD__) || defined(__NetBSD__) # ifdef __SDLADRV__ # include # endif +#elif defined(__WINDOWS__) +# include #endif /* @@ -74,13 +88,6 @@ ** D E F I N E S ** ****************************************************************** */ -#if defined(__LINUX__) -#ifdef CONFIG_ISA -# define WAN_ISA_SUPPORT -#else -# undef WAN_ISA_SUPPORT -#endif -#endif #define SDLADRV_MAGIC 0x414C4453L /* signature: 'SDLA' reversed */ @@ -90,33 +97,39 @@ #define SDLA_WINDOWSIZE 0x2000 /* default dual-port memory window size */ /* */ -#define SDLA_MEMBASE 0x01 -#define SDLA_MEMEND 0x02 -#define SDLA_MEMSIZE 0x03 -#define SDLA_IRQ 0x04 -#define SDLA_ADAPTERTYPE 0x05 -#define SDLA_CPU 0x06 -#define SDLA_SLOT 0x07 -#define SDLA_IOPORT 0x08 -#define SDLA_IORANGE 0x09 -#define SDLA_CARDTYPE 0x0A -#define SDLA_DMATAG 0x0B -#define SDLA_MEMORY 0x0C -#define SDLA_PCIEXTRAVER 0x0D -#define SDLA_HWTYPE 0x0E -#define SDLA_BUS 0x0F -#define SDLA_BASEADDR 0x10 -#define SDLA_COREREV 0x11 -#define SDLA_USEDCNT 0x12 -#define SDLA_ADAPTERSUBTYPE 0x13 -#define SDLA_HWEC_NO 0x14 -#define SDLA_COREID 0x15 - +#define SDLA_MEMBASE 0x01 +#define SDLA_MEMEND 0x02 +#define SDLA_MEMSIZE 0x03 +#define SDLA_IRQ 0x04 +#define SDLA_ADAPTERTYPE 0x05 +#define SDLA_CPU 0x06 +#define SDLA_SLOT 0x07 +#define SDLA_IOPORT 0x08 +#define SDLA_IORANGE 0x09 +#define SDLA_CARDTYPE 0x0A +#define SDLA_DMATAG 0x0B +#define SDLA_MEMORY 0x0C +#define SDLA_PCIEXTRAVER 0x0D +#define SDLA_HWTYPE 0x0E +#define SDLA_BUS 0x0F +#define SDLA_BASEADDR 0x10 +#define SDLA_COREREV 0x11 +#define SDLA_HWCPU_USEDCNT 0x12 +#define SDLA_ADAPTERSUBTYPE 0x13 +#define SDLA_HWEC_NO 0x14 +#define SDLA_COREID 0x15 +#define SDLA_PCIEXPRESS 0x16 +#define SDLA_PORTS_NO 0x17 +#define SDLA_HWPORTUSED 0x18 +#define SDLA_HWPORTREG 0x19 +#define SDLA_PORT_MAP 0x1A +#define SDLA_RECOVERY_CLOCK_FLAG 0x1B +#define SDLA_HWPORTREGMAP 0x1C #define SDLA_MAX_CPUS 2 - /* Serial card - 2, A104 - 4, A108 - 8, A200 - 1 */ -#define SDLA_MAX_PORTS 8 +/* Serial card - 2, A104 - 4, A108 - 8, A200/A400 - 1, A500-24 */ +#define SDLA_MAX_PORTS 24 /* Status values */ #define SDLA_MEM_RESERVED 0x0001 @@ -131,7 +144,9 @@ # define PCI_DMA_TODEVICE 2 #endif -#define SDLA_MAGIC(hw) WAN_ASSERT(hw->magic != SDLADRV_MAGIC) +#define SDLA_MAGIC(hw) WAN_ASSERT((hw)->magic != SDLADRV_MAGIC) +#define SDLA_MAGIC_RC(hw,rc) WAN_ASSERT_RC((hw)->magic != SDLADRV_MAGIC, (rc)) +#define SDLA_MAGIC_VOID(hw) WAN_ASSERT_VOID((hw)->magic != SDLADRV_MAGIC) /* ****************************************************************** @@ -145,8 +160,8 @@ typedef bus_addr_t sdla_base_addr_t; typedef bus_addr_t sdla_dma_addr_t; typedef pcici_t sdla_pci_dev_t; # else -typedef uint32_t sdla_base_addr_t; -typedef uint32_t sdla_dma_addr_t; +typedef bus_addr_t sdla_base_addr_t; +typedef bus_addr_t sdla_dma_addr_t; typedef struct device* sdla_pci_dev_t; # endif #elif defined(__OpenBSD__) @@ -168,6 +183,13 @@ typedef void * sdla_mem_handle_t; typedef unsigned long sdla_base_addr_t; typedef dma_addr_t sdla_dma_addr_t; typedef struct pci_dev* sdla_pci_dev_t; +#elif defined(__WINDOWS__) +typedef void * sdla_mem_handle_t; +typedef unsigned long sdla_base_addr_t; +/* Dma addresses are 32-bits wide!!! */ +typedef u32 dma_addr_t; +typedef dma_addr_t sdla_dma_addr_t; +typedef struct pci_dev* sdla_pci_dev_t; #else # warning "Undefined types sdla_mem_handle_t/sdla_base_addr_t!" #endif @@ -178,7 +200,11 @@ typedef struct pci_dev* sdla_pci_dev_t; ****************************************************************** */ #if defined(__FreeBSD__) -# define virt_to_phys(x) kvtop((caddr_t)x) +# if defined(__i386__) +# define virt_to_phys(x) kvtop((caddr_t)x) +# else +# define virt_to_phys(x) (sdla_dma_addr_t)(x) +# endif # define phys_to_virt(x) (sdla_mem_handle_t)x #elif defined(__OpenBSD__) # define virt_to_phys(x) kvtop((caddr_t)x) @@ -186,7 +212,9 @@ typedef struct pci_dev* sdla_pci_dev_t; #elif defined(__NetBSD__) # define virt_to_phys(x) kvtop((caddr_t)x) # define phys_to_virt(x) (bus_space_handle_t)x -#elif defined(__LINUX__) +#elif defined(__LINUX__) +#elif defined(__WINDOWS__) +# define phys_to_virt(x) NULL #else # warning "Undefined virt_to_phys/phys_to_virt macros!" #endif @@ -207,19 +235,92 @@ typedef struct pci_dev* sdla_pci_dev_t; ** S T R U C T U R E S ** ****************************************************************** */ -typedef struct sdla_hw_probe { +/* DMA structure */ +#define SDLA_DMA_FLAG_READY 0 +#define SDLA_DMA_FLAG_INIT 1 +#define SDLA_DMA_FLAG_ALLOC 2 + +#if defined(__FreeBSD__) +# define SDLA_DMA_POSTREAD BUS_DMASYNC_POSTREAD +# define SDLA_DMA_PREREAD BUS_DMASYNC_PREREAD +# define SDLA_DMA_POSTWRITE BUS_DMASYNC_POSTWRITE +# define SDLA_DMA_PREWRITE BUS_DMASYNC_PREWRITE +#elif defined(__LINUX__) +# define SDLA_DMA_POSTREAD PCI_DMA_FROMDEVICE +# define SDLA_DMA_PREREAD PCI_DMA_FROMDEVICE +# define SDLA_DMA_POSTWRITE PCI_DMA_TODEVICE +# define SDLA_DMA_PREWRITE PCI_DMA_TODEVICE +#else +# define SDLA_DMA_POSTREAD 1 +# define SDLA_DMA_PREREAD 2 +# define SDLA_DMA_POSTWRITE 3 +# define SDLA_DMA_PREWRITE 4 +#endif +typedef struct wan_dma_descr_ +{ + unsigned long init; + unsigned long flag; + u32 alignment; + u32 max_len; + + sdla_dma_addr_t dma_addr; /* physical address */ + u32 dma_len; /* total dma data len */ + u32 dma_map_len; /* actual dma mapped len (address range) */ + netskb_t *skb; + u32 index; + + u32 dma_descr; + u32 len_align; + u32 reg; + + u8 pkt_error; + void* dma_virt; + u32 dma_offset; + u32 dma_toggle; +#if defined(__FreeBSD__) + bus_dma_tag_t dmat; + bus_dmamap_t dmam; +#elif defined(__OpenBSD__) + bus_dma_tag_t dmat; + bus_dma_segment_t dmaseg; + int rsegs; +#elif defined(__NetBSD__) + bus_dma_tag_t dmat; + bus_dma_segment_t dmaseg; + int rsegs; +#elif defined(__WINDOWS__) + void* vAddr; + PHYSICAL_ADDRESS physicalAddr; +#endif +} wan_dma_descr_t; + + +typedef struct sdla_hw_probe +{ + int internal_used; int used; unsigned char hw_info[100]; unsigned char hw_info_verbose[500]; WAN_LIST_ENTRY(sdla_hw_probe) next; } sdla_hw_probe_t; +/*------------------------------------------------------------- + * + */ +#if 0 +typedef struct sdlahw_port +{ + int used; + char *devname; + sdla_hw_probe_t *hwprobe; +} sdlahw_port_t; +#endif /* * This structure keeps common parameters per physical card. */ typedef struct sdlahw_card { - int used; + int internal_used; unsigned int hw_type; /* ISA/PCI */ unsigned int type; /* S50x/S514/ADSL/SDLA_AFT */ unsigned char cfg_type; /* Config card type WANOPT_XXX */ @@ -232,6 +333,7 @@ typedef struct sdlahw_card { unsigned int slot_no; unsigned int bus_no; unsigned int ioport; + unsigned int recovery_clock_flag; /* 1 - already used, 0 - not used */ #if defined(__LINUX__) sdla_pci_dev_t pci_dev; /* PCI config header info */ #else @@ -242,35 +344,32 @@ typedef struct sdlahw_card { sdla_pci_dev_t pci_dev; /* PCI config header info */ #endif sdla_pci_dev_t pci_bridge_dev; /* PCI Bridge config header info */ + unsigned int pci_bridge_slot;/* PCI Bridge slot number */ + unsigned int pci_bridge_bus; /* PCI Bridge bus number */ wan_spinlock_t pcard_lock; /* lock per physical card for FE */ wan_spinlock_t pcard_ec_lock; /* lock per physical card for EC */ wan_smp_flag_t fe_rw_flag; unsigned char adptr_security; /* Adapter security (AFT cards) */ u16 hwec_chan_no; /* max hwec channels number */ - int rm_mod_type[MAX_REMORA_MODULES]; - void *port_ptr_isr_array[SDLA_MAX_PORTS]; + int hwec_ind; /* hwec index */ WAN_LIST_ENTRY(sdlahw_card) next; + +#if defined(__WINDOWS__) + int rm_mod_type[MAX_REMORA_MODULES]; +#endif + } sdlahw_card_t; -/*------------------------------------------------------------- - * - */ -typedef struct sdlahw_port -{ - int used; - char *devname; - sdla_hw_probe_t *hwprobe; -} sdlahw_port_t; - /*---------------------------------------------------------------------------- * Adapter hardware configuration. Pointer to this structure is passed to all * APIs. */ -typedef struct sdlahw +struct sdlahw_port; +typedef struct sdlahw_cpu { + int internal_used; int used; - char *devname; u16 status; unsigned fwid; /* firmware ID */ #if defined(__NetBSD__) || defined(__OpenBSD__) @@ -282,14 +381,13 @@ typedef struct sdlahw void* irqh[SDLA_MAX_PORTS]; #endif unsigned int cpu_no; /* PCI CPU Number */ - unsigned int line_no; /* PCI CPU Number */ char auto_pci_cfg; /* Auto PCI configuration */ sdla_mem_handle_t dpmbase; /* dual-port memory base */ sdla_base_addr_t mem_base_addr; unsigned dpmsize; /* dual-port memory size */ unsigned pclk; /* CPU clock rate, kHz */ unsigned long memory; /* memory size */ - sdla_mem_handle_t vector; /* local offset of the DPM window */ + sdla_mem_handle_t vector; /* local offset of the DPM window */ unsigned io_range; /* I/O port range */ unsigned char regs[SDLA_MAXIORANGE]; /* was written to registers */ @@ -298,12 +396,37 @@ typedef struct sdlahw /* */ unsigned magic; - void* dev; /* used only for FreeBSD/OpenBSD */ +# if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) + void *sdla_dev; /* used only for FreeBSD/OpenBSD */ +# endif u16 configured; - int max_ports; - sdlahw_port_t hwport[SDLA_MAX_PORTS]; - sdlahw_card_t* hwcard; - WAN_LIST_ENTRY(sdlahw) next; + + int max_ports; /* number of ports */ + u_int32_t port_map; /* installed modules for A200/A400/ISDN */ + int reg_port[SDLA_MAX_PORTS]; + u_int32_t reg_port_map; /* configured port */ + struct sdlahw_port *hwport[SDLA_MAX_PORTS]; + + void *port_ptr_isr_array[SDLA_MAX_PORTS]; + + sdlahw_card_t *hwcard; + WAN_LIST_ENTRY(sdlahw_cpu) next; +} sdlahw_cpu_t; + +typedef struct sdlahw_port +{ + int internal_used; + int used; + char *devname; + unsigned magic; + unsigned int port_no; /* Port number per CPU */ + sdla_hw_probe_t *hwprobe; + sdlahw_cpu_t* hwcpu; + + WAN_LIST_ENTRY(sdlahw_port) next; +#if defined(__WINDOWS__) + void *p_sdla; +#endif } sdlahw_t; typedef struct sdlahw_iface @@ -318,6 +441,7 @@ typedef struct sdlahw_iface int (*mapmem)(void*, unsigned long); int (*check_mismatch)(void*, unsigned char); int (*getcfg)(void*, int, void*); + int (*setcfg)(void*, int, void*); int (*isa_read_1)(void* hw, unsigned int offset, u8*); int (*isa_write_1)(void* hw, unsigned int offset, u8); int (*io_write_1)(void* hw, unsigned int offset, u8); @@ -335,7 +459,9 @@ typedef struct sdlahw_iface int (*pci_read_config_word)(void* hw, int reg, u16* value); int (*pci_read_config_dword)(void* hw, int reg, u32* value); int (*pci_bridge_write_config_dword)(void* hw, int reg, u32 value); + int (*pci_bridge_write_config_byte)(void* hw, int reg, u_int8_t value); int (*pci_bridge_read_config_dword)(void* hw, int reg, u32* value); + int (*pci_bridge_read_config_byte)(void* hw, int reg, u_int8_t* value); int (*cmd)(void* phw, unsigned long offset, wan_mbox_t* mbox); int (*peek)(void*,unsigned long, void*,unsigned); int (*poke)(void*,unsigned long, void*,unsigned); @@ -352,7 +478,9 @@ typedef struct sdlahw_iface int (*hw_lock)(void *phw, wan_smp_flag_t *flag); int (*hw_ec_unlock)(void *phw, wan_smp_flag_t *flag); int (*hw_ec_lock)(void *phw, wan_smp_flag_t *flag); + int (*hw_ec_trylock)(void *phw, wan_smp_flag_t *flag); int (*hw_same)(void *phw1, void *phw2); + int (*hwcpu_same)(void *phw1, void *phw2); int (*fe_test_and_set_bit)(void *phw, int value); int (*fe_test_bit)(void *phw,int value); int (*fe_set_bit)(void *phw,int value); @@ -363,6 +491,25 @@ typedef struct sdlahw_iface int (*write_cpld)(void *phw, u16, u8); int (*fe_write)(void*, ...); u_int8_t (*fe_read)(void*, ...); + u_int8_t (*__fe_read)(void*, ...); + wan_dma_descr_t* (*busdma_descr_alloc)(void *phw, int); + void (*busdma_descr_free)(void *phw, wan_dma_descr_t*); + int (*busdma_tag_create)(void *phw, wan_dma_descr_t*, u32, u32, int); + int (*busdma_tag_destroy)(void *phw, wan_dma_descr_t*, int); + int (*busdma_create)(void *phw, wan_dma_descr_t*); + int (*busdma_destroy)(void *phw, wan_dma_descr_t*); + int (*busdma_alloc)(void *phw, wan_dma_descr_t*); + void (*busdma_free)(void *phw, wan_dma_descr_t*); + int (*busdma_load)(void *phw, wan_dma_descr_t*, u32); + void (*busdma_unload)(void *phw, wan_dma_descr_t*); + void (*busdma_map)(void *phw, wan_dma_descr_t*, void *buf, int len, int map_len, int dir); + void (*busdma_unmap)(void *phw, wan_dma_descr_t*, int dir); + void (*busdma_sync)(void *phw, wan_dma_descr_t*, int ndescr, int single, int dir); + char* (*hwec_name)(void *phw); + int (*get_hwec_index)(void *phw); +#if defined(__WINDOWS__) + sdlahw_t *hw; +#endif } sdlahw_iface_t; typedef struct sdla_hw_type_cnt @@ -377,10 +524,12 @@ typedef struct sdla_hw_type_cnt unsigned char aft108_adapters; unsigned char aft_isdn_adapters; unsigned char aft_56k_adapters; + unsigned char aft_serial_adapters; unsigned char aft_x_adapters; }sdla_hw_type_cnt_t; + /****** Function Prototypes *************************************************/ EXTERN unsigned int sdla_hw_probe(void); @@ -394,21 +543,26 @@ EXTERN int sdla_unregister (void**, char*); static __inline unsigned int sdla_get_pci_bus(sdlahw_t* hw) { - sdlahw_card_t* card; + sdlahw_card_t *hwcard; + sdlahw_cpu_t *hwcpu; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + hwcard = hwcpu->hwcard; #if defined(__FreeBSD__) # if (__FreeBSD_version > 400000) - return pci_get_bus(card->pci_dev); + return pci_get_bus(hwcard->pci_dev); # else - return card->pci_dev->bus; + return hwcard->pci_dev->bus; # endif #elif defined(__NetBSD__) || defined(__OpenBSD__) - return card->pci_dev->pa_bus; + return hwcard->pci_dev->pa_bus; #elif defined(__LINUX__) - return ((struct pci_bus*)card->pci_dev->bus)->number; + return ((struct pci_bus*)hwcard->pci_dev->bus)->number; +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL #else # warning "sdla_get_pci_bus: Not supported yet!" #endif @@ -417,21 +571,26 @@ static __inline unsigned int sdla_get_pci_bus(sdlahw_t* hw) static __inline unsigned int sdla_get_pci_slot(sdlahw_t* hw) { - sdlahw_card_t* card; + sdlahw_card_t *hwcard; + sdlahw_cpu_t *hwcpu; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + hwcard = hwcpu->hwcard; #if defined(__FreeBSD__) # if (__FreeBSD_version > 400000) - return pci_get_slot(card->pci_dev); + return pci_get_slot(hwcard->pci_dev); # else - return card->pci_dev->slot; + return hwcard->pci_dev->slot; # endif #elif defined(__NetBSD__) || defined(__OpenBSD__) - return card->pci_dev->pa_device; + return hwcard->pci_dev->pa_device; #elif defined(__LINUX__) - return ((card->pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK); + return ((hwcard->pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK); +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL #else # warning "sdla_get_pci_slot: Not supported yet!" #endif @@ -441,17 +600,32 @@ static __inline unsigned int sdla_get_pci_slot(sdlahw_t* hw) static __inline int sdla_bus_space_map(sdlahw_t* hw, int reg, int size, sdla_mem_handle_t* handle) { - int err = 0; + sdlahw_cpu_t *hwcpu; + int err = 0; + + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); #if defined(__FreeBSD__) - *handle = (sdla_mem_handle_t)pmap_mapdev(hw->mem_base_addr + reg, size); + *handle = (sdla_mem_handle_t)pmap_mapdev(hwcpu->mem_base_addr + reg, size); #elif defined(__NetBSD__) || defined(__OpenBSD__) - err = bus_space_map(hw->hwcard->memt, - hw->mem_base_addr+reg, + err = bus_space_map(hwcpu->hwcard->memt, + hwcpu->mem_base_addr+reg, size, 0, handle); #elif defined(__LINUX__) - *handle = (sdla_mem_handle_t)ioremap(hw->mem_base_addr+reg, size); + *handle = (sdla_mem_handle_t)ioremap(hwcpu->mem_base_addr+reg, size); +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL + /* + *handle = (sdla_mem_handle_t)MmMapIoSpace( + ((PHYSICAL_ADDRESS)(hwcpu->mem_base_addr+reg)), (ULONG)size, MmNonCached); + if(*handle == NULL){ + err = 1; + } + */ #else # warning "sdla_bus_space_map: Not supported yet!" #endif @@ -462,6 +636,12 @@ sdla_bus_space_map(sdlahw_t* hw, int reg, int size, sdla_mem_handle_t* handle) static __inline void sdla_bus_space_unmap(sdlahw_t* hw, sdla_mem_handle_t offset, int size) { + sdlahw_cpu_t *hwcpu; + + WAN_ASSERT_VOID(hw == NULL); + WAN_ASSERT_VOID(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT_VOID(hwcpu->hwcard == NULL); #if defined(__FreeBSD__) int i = 0; for (i = 0; i < size; i += PAGE_SIZE){ @@ -469,9 +649,12 @@ sdla_bus_space_unmap(sdlahw_t* hw, sdla_mem_handle_t offset, int size) } kmem_free(kernel_map, (vm_offset_t)offset, size); #elif defined(__NetBSD__) || defined(__OpenBSD__) - bus_space_unmap(hw->hwcard->memt, offset, size); + bus_space_unmap(hwcpu->hwcard->memt, offset, size); #elif defined(__LINUX__) iounmap((void*)offset); +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL + /*MmUnmapIoSpace((void*)offset, size);*/ #else # warning "sdla_bus_space_unmap: Not supported yet!" #endif @@ -482,12 +665,20 @@ sdla_bus_space_unmap(sdlahw_t* hw, sdla_mem_handle_t offset, int size) static __inline void sdla_bus_set_region_1(sdlahw_t* hw, unsigned int offset, unsigned char val, unsigned int cnt) { + sdlahw_cpu_t *hwcpu; + + WAN_ASSERT_VOID(hw == NULL); + WAN_ASSERT_VOID(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT_VOID(hwcpu->hwcard == NULL); #if defined(__FreeBSD__) return; #elif defined(__NetBSD__) || defined(__OpenBSD__) - bus_space_set_region_1(hw->hwcard->memt, hw->dpmbase, offset, val, cnt); + bus_space_set_region_1(hwcpu->hwcard->memt, hw->dpmbase, offset, val, cnt); #elif defined(__LINUX__) - wp_memset_io(hw->dpmbase + offset, val, cnt); + wp_memset_io(hwcpu->dpmbase + offset, val, cnt); +#elif defined(__WINDOWS__) + wp_memset_io(((u8*)hwcpu->dpmbase) + offset, val, cnt); #else # warning "sdla_bus_set_region_1: Not supported yet!" #endif @@ -506,6 +697,9 @@ sdla_request_mem_region(sdlahw_t* hw, sdla_base_addr_t base_addr, unsigned int l } *pres = resource; return 0; +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL + return 0; #else # warning "sdla_request_mem_region: Not supported yet!" return 0; @@ -519,6 +713,8 @@ sdla_release_mem_region(sdlahw_t* hw, sdla_base_addr_t base_addr, unsigned int l return; #elif defined(__LINUX__) release_mem_region(base_addr, len); +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL #else # warning "sdla_release_mem_region: Not supported yet!" #endif @@ -528,14 +724,22 @@ static __inline int sdla_pci_enable_device(sdlahw_t* hw) { sdlahw_card_t* card; + sdlahw_cpu_t *hwcpu; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + card = hwcpu->hwcard; +#if defined(__FreeBSD__) + return pci_enable_io(card->pci_dev, SYS_RES_MEMORY); +#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) return 0; #elif defined(__LINUX__) return pci_enable_device(card->pci_dev); +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL + return 0; #else # warning "sdla_release_mem_region: Not supported yet!" return -EINVAL; @@ -546,15 +750,23 @@ static __inline int sdla_pci_disable_device(sdlahw_t* hw) { sdlahw_card_t* card; + sdlahw_cpu_t *hwcpu; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + card = hwcpu->hwcard; +#if defined(__FreeBSD__) + return pci_disable_io(card->pci_dev, SYS_RES_MEMORY); +#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) return 0; #elif defined(__LINUX__) pci_disable_device(card->pci_dev); return 0; +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL + return 0; #else # warning "sdla_release_mem_region: Not supported yet!" return -EINVAL; @@ -567,14 +779,21 @@ static __inline void sdla_pci_set_master(sdlahw_t* hw) { sdlahw_card_t* card; + sdlahw_cpu_t *hwcpu; WAN_ASSERT1(hw == NULL); - WAN_ASSERT1(hw->hwcard == NULL); - card = hw->hwcard; -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) + WAN_ASSERT1(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT1(hwcpu->hwcard == NULL); + card = hwcpu->hwcard; +#if defined(__FreeBSD__) + pci_enable_busmaster(card->pci_dev); +#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) return; #elif defined(__LINUX__) pci_set_master(card->pci_dev); +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL #else # warning "sdla_pci_set_master: Not supported yet!" #endif @@ -585,10 +804,13 @@ static __inline void sdla_get_pci_base_resource_addr(sdlahw_t* hw, int pci_offset, sdla_base_addr_t *base_addr) { sdlahw_card_t* card; + sdlahw_cpu_t *hwcpu; WAN_ASSERT1(hw == NULL); - WAN_ASSERT1(hw->hwcard == NULL); - card = hw->hwcard; + WAN_ASSERT1(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT1(hwcpu->hwcard == NULL); + card = hwcpu->hwcard; #if defined(__FreeBSD__) # if (__FreeBSD_version > 400000) @@ -599,12 +821,13 @@ sdla_get_pci_base_resource_addr(sdlahw_t* hw, int pci_offset, sdla_base_addr_t * #elif defined(__NetBSD__) || defined(__OpenBSD__) *base_addr = (sdla_base_addr_t)pci_conf_read(card->pci_dev->pa_pc, card->pci_dev->pa_tag, pci_offset); #elif defined(__LINUX__) - if (pci_offset == PCI_IO_BASE_DWORD){ *base_addr = (sdla_base_addr_t)pci_resource_start(card->pci_dev,0); }else{ *base_addr = (sdla_base_addr_t)pci_resource_start(card->pci_dev,1); } +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL #else # warning "sdla_get_pci_base_resource_addr: Not supported yet!" #endif @@ -616,27 +839,35 @@ sdla_get_pci_base_resource_addr(sdlahw_t* hw, int pci_offset, sdla_base_addr_t * static __inline int __sdla_bus_read_4(void* phw, unsigned int offset, u32* value) { sdlahw_t* hw = (sdlahw_t*)phw; - int retry=5; - WAN_ASSERT2(hw == NULL, 0); - WAN_ASSERT2(hw->dpmbase == 0, 0); - SDLA_MAGIC(hw); + sdlahw_cpu_t *hwcpu; + unsigned int retry=3; + WAN_ASSERT2(hw == NULL, 0); + WAN_ASSERT2(hw->hwcpu == NULL, 0); + hwcpu = hw->hwcpu; + WAN_ASSERT2(hwcpu->hwcard == NULL, 0); + WAN_ASSERT2(hwcpu->dpmbase == 0, 0); + SDLA_MAGIC(hwcpu); + + if (!(hwcpu->status & SDLA_MEM_MAPPED)) return 0; do { #if defined(__FreeBSD__) - *value = readl(((u8*)hw->dpmbase + offset)); + *value = readl(((u8*)hw->hwcpu->dpmbase + offset)); #elif defined(__NetBSD__) || defined(__OpenBSD__) - *value = bus_space_read_4(hw->hwcard->memt, hwcpu->dpmbase, offset); + *value = bus_space_read_4(hw->hwcard->memt, hwcpu->hwcpu->dpmbase, offset); #elif defined(__LINUX__) - *value = wp_readl((unsigned char*)hw->dpmbase + offset); + *value = wp_readl((unsigned char*)hw->hwcpu->dpmbase + offset); +#elif defined(__WINDOWS__) + *value = READ_REGISTER_ULONG((PULONG)((PUCHAR)hw->hwcpu->dpmbase + offset)); #else *value = 0; # warning "sdla_bus_read_4: Not supported yet!" #endif if (offset == 0x40 && *value == (u32)-1) { if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s:%d: Error: Illegal Register read: 0x%04X = 0x%08X\n", + DEBUG_EVENT("%s:%d: wanpipe PCI Error: Illegal Register read: 0x%04X = 0x%08X\n", __FUNCTION__,__LINE__,offset,*value); } } else { @@ -652,16 +883,22 @@ static __inline int __sdla_bus_read_4(void* phw, unsigned int offset, u32* value static __inline int __sdla_bus_write_4(void* phw, unsigned int offset, u32 value) { sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; - WAN_ASSERT(hw == NULL); - SDLA_MAGIC(hw); - if (!(hw->status & SDLA_MEM_MAPPED)) return 0; + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + SDLA_MAGIC(hwcpu); + if (!(hwcpu->status & SDLA_MEM_MAPPED)) return 0; #if defined(__FreeBSD__) - writel(((u8*)hw->dpmbase + offset), value); + writel(((u8*)hwcpu->dpmbase + offset), value); #elif defined(__NetBSD__) || defined(__OpenBSD__) - bus_space_write_4(hw->hwcard->memt, hw->dpmbase, offset, value); + bus_space_write_4(hwcpu->hwcard->memt, hwcpu->dpmbase, offset, value); #elif defined(__LINUX__) - wp_writel(value,(u8*)hw->dpmbase + offset); + wp_writel(value,(u8*)hwcpu->dpmbase + offset); +#elif defined(__WINDOWS__) + WRITE_REGISTER_ULONG((PULONG)((PUCHAR)hwcpu->dpmbase + offset), value); #else # warning "sdla_bus_write_4: Not supported yet!" #endif @@ -670,39 +907,61 @@ static __inline int __sdla_bus_write_4(void* phw, unsigned int offset, u32 value static __inline int __sdla_is_same_hwcard(void* phw1, void *phw2) { - if (((sdlahw_t*)phw1)->hwcard == ((sdlahw_t*)phw2)->hwcard){ + sdlahw_cpu_t *hwcpu1, *hwcpu2; + + WAN_ASSERT_RC(phw1 == NULL, 0); + WAN_ASSERT_RC(phw2 == NULL, 0); + WAN_ASSERT_RC(((sdlahw_t*)phw1)->hwcpu == NULL, 0); + WAN_ASSERT_RC(((sdlahw_t*)phw2)->hwcpu == NULL, 0); + hwcpu1 = ((sdlahw_t*)phw1)->hwcpu; + hwcpu2 = ((sdlahw_t*)phw2)->hwcpu; + if (hwcpu1->hwcard == hwcpu2->hwcard){ return 1; } return 0; } -static __inline void **__sdla_get_ptr_isr_array(void *phw1) +static __inline void **__sdla_get_ptr_isr_array(void *phw) { - return &((sdlahw_t*)phw1)->hwcard->port_ptr_isr_array[0]; + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + + WAN_ASSERT_RC(hw == NULL, 0); + WAN_ASSERT_RC(hw->hwcpu == NULL, 0); + hwcpu = hw->hwcpu; + return &hwcpu->port_ptr_isr_array[0]; } -static __inline void __sdla_push_ptr_isr_array(void *phw1, void *card, int line) +static __inline void __sdla_push_ptr_isr_array(void *phw, void *card, int line) { + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + + WAN_ASSERT_VOID(hw == NULL); + WAN_ASSERT_VOID(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; if (line >= SDLA_MAX_PORTS) { return; - } - - ((sdlahw_t*)phw1)->hwcard->port_ptr_isr_array[line]=card; + } + hwcpu->port_ptr_isr_array[line]=card; } -static __inline void __sdla_pull_ptr_isr_array(void *phw1, void *card, int line) +static __inline void __sdla_pull_ptr_isr_array(void *phw, void *card, int line) { + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + + WAN_ASSERT_VOID(hw == NULL); + WAN_ASSERT_VOID(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; if (line >= SDLA_MAX_PORTS) { return; } - ((sdlahw_t*)phw1)->hwcard->port_ptr_isr_array[line]=NULL; - + hwcpu->port_ptr_isr_array[line]=NULL; return; } - - #undef EXTERN #endif /* _SDLADRV_H */ diff --git a/patches/kdrivers/include/sdlapci.h b/patches/kdrivers/include/sdlapci.h index 41c0e7a..272b0b8 100644 --- a/patches/kdrivers/include/sdlapci.h +++ b/patches/kdrivers/include/sdlapci.h @@ -25,15 +25,25 @@ #define PCI_DEV_SLOT_MASK 0x1F /* mask for slot numbering */ #define PCI_IRQ_NOT_ALLOCATED 0xFF /* interrupt line for no IRQ */ -/* Definition for identifying and finding XILINX PCI adapters */ +/* Vendor id lisr for Sangoma cards */ #define SANGOMA_PCI_VENDOR 0x1923 /* Old value -> 0x11B0 */ #define SANGOMA_PCI_VENDOR_OLD 0x10EE /* Old value -> 0x11B0 */ + +/* Device id list for Sangoma cards */ #define SANGOMA_PCI_DEVICE 0x0300 /* Old value -> 0x0200 */ #define SANGOMA_PCI_4_DEVICE 0x0400 /* */ +#define SANGOMA_S2E_300_PCI_DEVICE 0x0030 /* Xilinx-300 SPARTAN-2e */ +#define SANGOMA_S3_400_PCI_DEVICE 0x0040 /* Xilinx-400 SPARTAN-3 */ +#define SANGOMA_S3_1000_PCI_DEVICE 0x0100 /* Xilinx-1000 SPARTAN-3 */ +#define SANGOMA_S3E_250_PCI_DEVICE 0x0025 /* Xilinx-250 SPARTAN-3e */ +#define SANGOMA_S3E_500_PCI_DEVICE 0x0050 /* Xilinx-500 SPARTAN-3e */ +#define SANGOMA_S3E_1200_PCI_DEVICE 0x0120 /* Xilinx-1200 SPARTAN-3e */ +#define SANGOMA_GP_ADSL_PCI_DEVICE 0x0001 /* Globe-Span ADSL */ #if defined(__WINDOWS__) #define SANGOMA_PCI_4_SHARK_DEVICE 0x0100 /* A104D */ #define SANGOMA_PCI_A200_SHARK_DEVICE 0x0040 /* A200 (D) */ +#define SANGOMA_PCI_A056_SHARK_DEVICE 0x0020 /* A056 */ #endif /* Definition for identifying and finding PLX PCI bridge adapters */ @@ -41,13 +51,9 @@ #define PLX_DEVICE_ID 0x8111 /* PLX device ID number */ #define PLX2_DEVICE_ID 0x8112 /* PLX device ID number rev 2 */ -#define TUNDRA_VENDOR_ID 0x10E3 /* TUNDRA vendor ID number */ -#define TUNDRA_DEVICE_ID 0x8111 /* TUNDRA device ID number */ - #define PLX_EEPROM_ENABLE 0x5A #define PLX_EEPROM_VENDOR_OFF 0xFC /* 2 bytes for Card vendor id */ - #define A101_1TE1_SUBSYS_VENDOR 0xA010 /* A101 with T1/E1 1 line */ #define A101_2TE1_SUBSYS_VENDOR 0xA011 /* A101 with T1/E1 2 lines */ #define A104_4TE1_SUBSYS_VENDOR 0xA013 /* A104 with T1/E1 4 lines */ @@ -66,6 +72,11 @@ #define AFT_ISDN_BRI_SHARK_SUBSYS_VENDOR 0xA500 /* AFT-ISDN BRI SHARK board */ #define AFT_56K_SHARK_SUBSYS_VENDOR 0xA056 /* AFT-56K SHARK board */ +#define AFT_2SERIAL_V35X21_SUBSYS_VENDOR 0xA031 /* AFT-A142 2 Port V.35/X.21 board */ +#define AFT_4SERIAL_V35X21_SUBSYS_VENDOR 0xA032 /* AFT-A144 4 Port V.35/X.21 board */ +#define AFT_2SERIAL_RS232_SUBSYS_VENDOR 0xA033 /* AFT-A142 2 Port RS232 board */ +#define AFT_4SERIAL_RS232_SUBSYS_VENDOR 0xA034 /* AFT-A144 4 Port RS232 board */ + #define AFT_CORE_ID_MASK 0x00FF #define AFT_CORE_REV_MASK 0xFF00 #define AFT_CORE_REV_SHIFT 8 @@ -160,7 +171,7 @@ #define PCI_VENDOR_ID_GSI 0x14BC #define PCI_DEVICE_ID_GSI_PULSAR 0xD002 #define PCI_DEVICE_ID_GSI_ADSL PCI_DEVICE_ID_GSI_PULSAR -#define PCI_DEVICE_ID_GSI_ADSL_OTHER 0xD001 +#define PCI_DEVICE_ID_GSI_ADSL_V2 0xD001 #endif /* _SDLAPCI_H */ diff --git a/patches/kdrivers/include/sdlasfm.h b/patches/kdrivers/include/sdlasfm.h index d31b513..bd63cf6 100644 --- a/patches/kdrivers/include/sdlasfm.h +++ b/patches/kdrivers/include/sdlasfm.h @@ -159,6 +159,11 @@ typedef struct sfm /* SDLA firmware file structire */ #define AFT_ADPTR_56K_MASK 0x2000 /* AFT 56K board mask */ #define AFT_ADPTR_56K 0x2001 /* AFT 56K board */ +#define AFT_ADPTR_SERIAL_MASK 0x4000 /* AFT Serial base board mask */ +#define AFT_ADPTR_2SERIAL_V35X21 0x4001 /* AFT-A142 2 Port V.35/X.21 board */ +#define AFT_ADPTR_4SERIAL_V35X21 0x4002 /* AFT-A144 4 Port V.35/X.21 board */ +#define AFT_ADPTR_2SERIAL_RS232 0x4003 /* AFT-A142 2 Port RS232 board */ +#define AFT_ADPTR_4SERIAL_RS232 0x4004 /* AFT-A144 4 Port RS232 board */ #define OPERATE_T1E1_AS_SERIAL 0x8000 /* For bitstreaming only * Allow the applicatoin to @@ -180,7 +185,7 @@ typedef struct sfm /* SDLA firmware file structire */ /* CPLD interface */ #define AFT_MCPU_INTERFACE_ADDR 0x46 -#define AFT_MCPU_INTERFACE 0x44 +#define AFT_MCPU_INTERFACE 0x44 #define AFT56K_MCPU_INTERFACE_ADDR 0x46 #define AFT56K_MCPU_INTERFACE 0x44 @@ -202,6 +207,11 @@ typedef struct sfm /* SDLA firmware file structire */ #define AFT8_BIT_DEV_ADDR_CPLD 0x800 #define AFT8_BIT_DEV_MAXIM_ADDR_CPLD 0x1000 +/* Aft Serial CPLD definitions */ +#define AFT_SERIAL_BIT_DEV_ADDR_CLEAR 0x1800 /* QUAD */ +#define AFT_SERIAL_BIT_DEV_ADDR_CPLD 0x800 +#define AFT_SERIAL_BIT_DEV_MAXIM_ADDR_CPLD 0x1000 + #define AFT3_BIT_DEV_ADDR_EXAR_CLEAR 0x600 #define AFT3_BIT_DEV_ADDR_EXAR_CPLD 0x400 @@ -234,6 +244,10 @@ typedef struct sfm /* SDLA firmware file structire */ #define A108_SECURITY_256_ECCHAN 0x04 #define A108_SECURITY_0_ECCHAN 0x05 +#define A500_SECURITY_32_ECCHAN 0x00 +#define A500_SECURITY_64_ECCHAN 0x01 +#define A500_SECURITY_0_ECCHAN 0x05 + #define A104_ECCHAN(val) \ ((val) == A104_SECURITY_32_ECCHAN) ? 32 : \ ((val) == A104_SECURITY_64_ECCHAN) ? 64 : \ @@ -249,6 +263,10 @@ typedef struct sfm /* SDLA firmware file structire */ ((val) == A108_SECURITY_128_ECCHAN) ? 128 : \ ((val) == A108_SECURITY_256_ECCHAN) ? 256 : 0 +#define A500_ECCHAN(val) \ + ((val) == A500_SECURITY_32_ECCHAN) ? 32 : \ + ((val) == A500_SECURITY_64_ECCHAN) ? 64 : 0 + #define AFT_RM_SECURITY_16_ECCHAN 0x00 #define AFT_RM_SECURITY_32_ECCHAN 0x01 #define AFT_RM_SECURITY_0_ECCHAN 0x05 @@ -257,7 +275,6 @@ typedef struct sfm /* SDLA firmware file structire */ ((val) == AFT_RM_SECURITY_32_ECCHAN) ? 32 : 0 - #define SDLA_ADPTR_NAME(adapter_type) \ (adapter_type == S5141_ADPTR_1_CPU_SERIAL) ? "S514-1-PCI" : \ (adapter_type == S5142_ADPTR_2_CPU_SERIAL) ? "S514-2-PCI" : \ @@ -275,24 +292,12 @@ typedef struct sfm /* SDLA firmware file structire */ (adapter_type == A400_ADPTR_ANALOG) ? "AFT-A400" : \ (adapter_type == AFT_ADPTR_ISDN) ? "AFT-A500" : \ (adapter_type == AFT_ADPTR_56K) ? "AFT-A056" : \ + (adapter_type == AFT_ADPTR_2SERIAL_V35X21) ? "AFT-A142" : \ + (adapter_type == AFT_ADPTR_4SERIAL_V35X21) ? "AFT-A144" : \ + (adapter_type == AFT_ADPTR_2SERIAL_RS232) ? "AFT-A142" : \ + (adapter_type == AFT_ADPTR_4SERIAL_RS232) ? "AFT-A144" : \ "UNKNOWN" - -#if 0 -#define SDLA_ADPTR_DECODE(adapter_type) \ - (adapter_type == S5141_ADPTR_1_CPU_SERIAL) ? "S514-1-PCI" : \ - (adapter_type == S5142_ADPTR_2_CPU_SERIAL) ? "S514-2-PCI" : \ - (adapter_type == S5143_ADPTR_1_CPU_FT1) ? "S514-3-PCI" : \ - (adapter_type == S5144_ADPTR_1_CPU_T1E1) ? "S514-4-PCI" : \ - (adapter_type == S5145_ADPTR_1_CPU_56K) ? "S514-5-PCI" : \ - (adapter_type == S5147_ADPTR_2_CPU_T1E1) ? "S514-7-PCI" : \ - (adapter_type == S518_ADPTR_1_CPU_ADSL) ? "S518-PCI " : \ - (adapter_type == A101_ADPTR_1TE1) ? "AFT-A101 " : \ - (adapter_type == A101_ADPTR_2TE1) ? "AFT-A102 " : \ - (adapter_type == A104_ADPTR_4TE1) ? "AFT-A104 " : \ - (adapter_type == A300_ADPTR_U_1TE3) ? "AFT-A301 " : \ - "UNKNOWN " -#endif - + #define AFT_GET_SECURITY(security) \ ((security >> AFT_SECURITY_CPLD_SHIFT) & AFT_SECURITY_CPLD_MASK) @@ -313,11 +318,24 @@ typedef struct sfm /* SDLA firmware file structire */ (adptr_subtype == AFT_SUBTYPE_SHARK) ? "SHARK" : "" #define AFT_PCITYPE_DECODE(hwcard) \ - ((hwcard)->pci_bridge_dev) ? "PCIe" : "PCI" - -#define AFT_PCIEXPRESS_DECODE AFT_PCITYPE_DECODE + ((hwcard)->pci_bridge_dev) ? " PCIe" : " PCI" +#if defined(__WINDOWS__) +#define DECODE_CARD_SUBTYPE(card_sub_type) \ + (card_sub_type == A101_1TE1_SUBSYS_VENDOR) ? "A101" : \ + (card_sub_type == AFT_1TE1_SHARK_SUBSYS_VENDOR) ? "A101D" : \ + (card_sub_type == A101_2TE1_SUBSYS_VENDOR) ? "A102" : \ + (card_sub_type == AFT_2TE1_SHARK_SUBSYS_VENDOR) ? "A102D" : \ + (card_sub_type == A104_4TE1_SUBSYS_VENDOR) ? "A104" : \ + (card_sub_type == AFT_4TE1_SHARK_SUBSYS_VENDOR) ? "A104D" : \ + (card_sub_type == AFT_8TE1_SHARK_SUBSYS_VENDOR) ? "A108D" : \ + (card_sub_type == A200_REMORA_SHARK_SUBSYS_VENDOR)? "A200" : "Unknown" +#define SDLA_CARD_TYPE_DECODE(cardtype) \ + ((cardtype == SDLA_S514) ? "S514" : \ + (cardtype == SDLA_ADSL) ? "S518-ADSL" : \ + (cardtype == SDLA_AFT) ? "AFT" : "Invalid card") +#endif/* __WINDOWS__ */ #endif /* _SDLASFM_H */ diff --git a/patches/kdrivers/include/ss7_linux.h b/patches/kdrivers/include/ss7_linux.h index c135b15..78f96f9 100644 --- a/patches/kdrivers/include/ss7_linux.h +++ b/patches/kdrivers/include/ss7_linux.h @@ -24,12 +24,11 @@ Descripiton: #ifndef _SS7_LINUX_H #define _SS7_LINUX_H +#pragma pack(1) #include #include -#pragma pack(1) - enum { SIOCC_PC_RESERVED = (SIOC_WANPIPE_DEVPRIVATE), SIOCS_GENERAL_CMD, @@ -45,64 +44,35 @@ enum { typedef struct { - unsigned char status ; - unsigned char data_avail ; - unsigned short real_length ; - unsigned short time_stamp ; - unsigned char data[1] ; + unsigned char status ; + unsigned char data_avail ; + unsigned short real_length ; + unsigned short time_stamp ; + unsigned char data[1] ; } trace_pkt_t; typedef struct { - unsigned char SIO ; - unsigned short time_stamp ; - unsigned char reserved[13] ; + unsigned char SIO ; + unsigned short time_stamp ; + unsigned char reserved[13] ; } api_rx_hdr_t; typedef struct { - api_rx_hdr_t api_rx_hdr ; - void * data ; + api_rx_hdr_t api_rx_hdr ; + void * data ; } api_rx_element_t; typedef struct { - unsigned char SIO ; - unsigned char reserved[15] ; + unsigned char SIO ; + unsigned char reserved[15] ; } api_tx_hdr_t; typedef struct { - api_tx_hdr_t api_tx_hdr ; - void * data ; + api_tx_hdr_t api_tx_hdr ; + void * data ; } api_tx_element_t; -/* The embedded control block for UDP mgmt - This is essentially a mailbox structure, without the large data field */ -#if 0 -typedef struct { - unsigned char opp_flag ; /* the opp flag */ - unsigned char command ; /* the user command */ - unsigned short buffer_length ; /* the data length */ - unsigned char return_code ; /* the return code */ - unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] ; /* reserved for later */ -} cblock_t; - - -typedef struct { - unsigned char num_frames ; - unsigned char ismoredata ; -} trace_info_t; - -typedef struct { - ip_pkt_t ip_pkt ; - udp_pkt_t udp_pkt ; - wp_mgmt_t wp_mgmt ; - cblock_t cblock ; - trace_info_t trace_info ; - unsigned char data[SIZEOF_MB_DATA_BFR] ; -} ss7_udp_pkt_t; -#endif - -#pragma pack() - /* modem status changes */ #define DCD_HIGH 0x08 #define CTS_HIGH 0x20 @@ -129,5 +99,7 @@ typedef struct { #define UDPMGMT_SIGNATURE "CTPIPEAB" /* "STPIPEAB" */ +#pragma pack() + #endif diff --git a/patches/kdrivers/include/wanec_iface.h b/patches/kdrivers/include/wanec_iface.h new file mode 120000 index 0000000..bcd03df --- /dev/null +++ b/patches/kdrivers/include/wanec_iface.h @@ -0,0 +1 @@ +../wanec/wanec_iface.h \ No newline at end of file diff --git a/patches/kdrivers/include/wanpipe.h b/patches/kdrivers/include/wanpipe.h index c685769..d2464cf 100644 --- a/patches/kdrivers/include/wanpipe.h +++ b/patches/kdrivers/include/wanpipe.h @@ -13,6 +13,9 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * ============================================================================ +* Nov 27, 2007 David Rokhvarg Implemented functions/definitions for +* Sangoma MS Windows Driver and API. +* * Nov 3, 2000 Nenad Corbic Added config_id to sdla_t structure. * Used to determine the protocol running. * Jul 13, 2000 Nenad Corbic Added SyncPPP Support @@ -47,6 +50,14 @@ #include #include # include +#elif defined(__WINDOWS__) +#include +#include +#include +#include +#include +#include +#include #elif defined(__LINUX__) || defined (__KERNEL__) #include #include @@ -89,6 +100,7 @@ #endif /* Defines */ + #define WANPIPE_MAGIC 0x414C4453L /* signature: 'SDLA' reversed */ /* IOCTL numbers (up to 16) */ @@ -307,10 +319,21 @@ typedef struct { # include # include # include +#elif defined(__WINDOWS__) +# include +# include +# include /* SDLA firmware module definitions */ +# include /* SDLA support module API definitions */ +# include #endif #define MAX_E1_CHANNELS 32 + +#if defined(__WINDOWS__) +#define MAX_FR_CHANNELS MAX_NUMBER_OF_PROTOCOL_INTERFACES /*1023*/ +#else #define MAX_FR_CHANNELS (1007+1) +#endif #define WAN_ENABLE 0x01 #define WAN_DISABLE 0x02 @@ -366,7 +389,7 @@ typedef struct wan_x25_conf_t x25_conf; atomic_t tx_interrupt_cmd; struct sk_buff_head trace_queue; - unsigned long trace_timeout; + wan_ticks_t trace_timeout; unsigned short trace_lost_cnt; unsigned long card_ready; @@ -694,19 +717,20 @@ typedef struct unsigned char state_change_exit_isr; unsigned long active_ch_map; unsigned long fifo_addr_map; + unsigned long fifo_addr_map_l2; wan_timer_t led_timer; unsigned char tdmv_sync; unsigned int chip_cfg_status; wan_taskq_t port_task; unsigned int port_task_cmd; unsigned long wdt_rx_cnt; - unsigned long wdt_tx_cnt; + wan_ticks_t wdt_tx_cnt; unsigned int security_id; unsigned int security_cnt; unsigned char firm_ver; unsigned char firm_id; unsigned int chip_security_cnt; - unsigned long rx_timeout,gtimeout; + wan_ticks_t rx_timeout,gtimeout; unsigned int comm_enabled; unsigned int lcfg_reg; unsigned int tdmv_master_if_up; @@ -731,14 +755,10 @@ typedef struct unsigned short tdm_tx_dma_toggle; unsigned int tdm_logic_ch_map; - unsigned long sec_chk_cnt; - + wan_ticks_t sec_chk_cnt; wan_skb_queue_t rtp_tap_list; - unsigned int rx_errors_hist; - unsigned int rx_errors_over_cnt; - unsigned long rx_errors_timeout; - unsigned long rx_errors_down_timeout; - + unsigned int serial_status; + } sdla_xilinx_t; @@ -759,20 +779,26 @@ typedef struct unsigned long status; } sdla_debug_t; + /* Adapter Data Space. * This structure is needed because we handle multiple cards, otherwise * static data would do it. */ typedef struct sdla { +#if defined(__WINDOWS__) + u8 device_type; /* must be first member of sdla_t structure! */ + struct _win_sdla_data; +#endif/* __WINDOWS__ */ + char devname[WAN_DRVNAME_SZ+1]; /* card name */ void* hw; /* hardware configuration */ wan_device_t wandev; /* WAN device data space */ - unsigned open_cnt; /* number of open interfaces */ - unsigned long state_tick; /* link state timestamp */ - unsigned intr_mode; /* Type of Interrupt Mode */ - unsigned long in_isr; /* interrupt-in-service flag */ + unsigned open_cnt; /* number of open interfaces */ + wan_ticks_t state_tick; /* link state timestamp */ + unsigned intr_mode; /* Type of Interrupt Mode */ + unsigned long in_isr; /* interrupt-in-service flag */ char buff_int_mode_unbusy; /* flag for carrying out dev_tint */ char dlci_int_mode_unbusy; /* flag for carrying out dev_tint */ unsigned long configured; /* flag for previous configurations */ @@ -821,8 +847,13 @@ typedef struct sdla struct sk_buff_head tty_rx_empty; struct sk_buff_head tty_rx_full; wan_taskq_t tty_task_queue; -#endif +#endif + +#if defined(__WINDOWS__) + struct +#else union +#endif { #if defined(__LINUX__) sdla_x25_t x; @@ -862,8 +893,8 @@ typedef struct sdla unsigned long update_comms_stats; sdla_fe_t fe; /* front end structures */ - u8 fe_no_intr; /* do not enable global fe intr */ - + u8 fe_no_intr; /* set to 0x01 if not FE interrupt should enabled */ + unsigned int rCount; /* Wanpipe Socket Interface */ @@ -899,9 +930,11 @@ typedef struct sdla # if defined(NETGRAPH) int running; /* something is attached so we are running */ /* ---netgraph bits --- */ - int datahooks; /* number of data hooks attached */ + int upperhooks; /* number of upper hooks attached */ + int lowerhooks; /* number of lower hooks attached */ node_p node; /* netgraph node */ - hook_p hook; /* data hook */ + hook_p upper; /* upper layer */ + hook_p lower; /* lower layer */ hook_p debug_hook; # if defined(ALTQ) struct ifaltq xmitq_hipri; /* hi-priority transmit queue */ @@ -921,6 +954,8 @@ typedef struct sdla u_long inrate, outrate; /* highest rate seen */ u_long inlast; /* last input N secs ago */ u_long out_deficit; /* output since last input */ + u_char promisc; /* promiscuous mode enabled */ + u_char autoSrcAddr; /* always overwrite source address */ void (*wan_down)(struct sdla*); int (*wan_up)(struct sdla*); void (*wan_start)(struct sdla*); @@ -931,9 +966,11 @@ typedef struct sdla u_long opackets, ipackets; #endif /* __FreeBSD__ */ - /* This value is used for detecting TDM Voice - * rsync timeout, it should be long */ - unsigned long rsync_timeout; + + /* This value is used for detecting TDM Voice + * rsync timeout, it should be long */ + wan_ticks_t rsync_timeout; + } sdla_t; /****** Public Functions ****************************************************/ @@ -963,6 +1000,8 @@ int wp_xilinx_init(sdla_t* card, wandev_conf_t* conf); /* Xilinx Hardware Suppor int wp_aft_te1_init(sdla_t* card, wandev_conf_t* conf); /* Xilinx Hardware Support */ int wp_aft_56k_init(sdla_t* card, wandev_conf_t* conf); /* Xilinx Hardware Support */ int wp_aft_analog_init(sdla_t* card, wandev_conf_t* conf); /* Xilinx Hardware Support */ +int wp_aft_bri_init(sdla_t* card, wandev_conf_t* conf); /* BRI Hardware Support */ +int wp_aft_serial_init(sdla_t* card, wandev_conf_t* conf); /* Serial Hardware Support */ int wp_adccp_init(sdla_t* card, wandev_conf_t* conf); int wp_xilinx_if_init(sdla_t* card, netdevice_t* dev); int wp_aft_te3_init(sdla_t* card, wandev_conf_t* conf); /* AFT TE3 Hardware Support */ @@ -1022,8 +1061,14 @@ void *atm_tx_skb_dequeue(void* wp_tx_pending_list, void *tx_idle_skb, char *if_n #if defined(__FreeBSD__) && defined(NETGRAPH) -int wan_ng_init(sdla_t*); -int wan_ng_remove(sdla_t*); +int wan_ng_init_old(sdla_t*); +int wan_ng_remove_old(sdla_t*); +#endif + +#if defined(__WINDOWS__) +extern int connect_to_interrupt_line(sdla_t *card); +extern void disconnect_from_interrupt_line(sdla_t *card); +int wp_aft_firmware_up_init(sdla_t* card, wandev_conf_t* conf); /* AFT Firmware Update support */ #endif #endif /* __KERNEL__ */ diff --git a/patches/kdrivers/include/wanpipe.h~ b/patches/kdrivers/include/wanpipe.h~ deleted file mode 100644 index 012c2f0..0000000 --- a/patches/kdrivers/include/wanpipe.h~ +++ /dev/null @@ -1,1014 +0,0 @@ -/***************************************************************************** -* wanpipe.h WANPIPE(tm) Multiprotocol WAN Link Driver. -* User-level API definitions. -* -* Author: Nenad Corbic -* Alex Feldman -* Gideon Hack -* -* Copyright: (c) 1995-2000 Sangoma Technologies 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. -* ============================================================================ -* Nov 3, 2000 Nenad Corbic Added config_id to sdla_t structure. -* Used to determine the protocol running. -* Jul 13, 2000 Nenad Corbic Added SyncPPP Support -* Feb 24, 2000 Nenad Corbic Added support for x25api driver -* Oct 04, 1999 Nenad Corbic New CHDLC and FRAME RELAY code, SMP support -* Jun 02, 1999 Gideon Hack Added 'update_call_count' for Cisco HDLC -* support -* Jun 26, 1998 David Fong Added 'ip_mode' in sdla_t.u.p for dynamic IP -* routing mode configuration -* Jun 12, 1998 David Fong Added Cisco HDLC union member in sdla_t -* Dec 08, 1997 Jaspreet Singh Added 'authenticator' in union of 'sdla_t' -* Nov 26, 1997 Jaspreet Singh Added 'load_sharing' structure. Also added -* 'devs_struct','dev_to_devtint_next' to 'sdla_t' -* Nov 24, 1997 Jaspreet Singh Added 'irq_dis_if_send_count', -* 'irq_dis_poll_count' to 'sdla_t'. -* Nov 06, 1997 Jaspreet Singh Added a define called 'INTR_TEST_MODE' -* Oct 20, 1997 Jaspreet Singh Added 'buff_intr_mode_unbusy' and -* 'dlci_intr_mode_unbusy' to 'sdla_t' -* Oct 18, 1997 Jaspreet Singh Added structure to maintain global driver -* statistics. -* Jan 15, 1997 Gene Kozin Version 3.1.0 -* o added UDP management stuff -* Jan 02, 1997 Gene Kozin Version 3.0.0 -*****************************************************************************/ -#ifndef _WANPIPE_H -#define _WANPIPE_H - -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) -#include -#include -#include -#include -#include -# include -#elif defined(__LINUX__) || defined (__KERNEL__) -#include -#include -#include -#include -#include -#include -#else -# error "No OS Specified" -#endif - -/* Due to changes between 2.4.9 and 2.4.13, - * I decided to write my own min() and max() - * functions */ - -#define wp_min(x,y) \ - ({ unsigned int __x = (x); unsigned int __y = (y); __x < __y ? __x: __y; }) -#define wp_max(x,y) \ - ({ unsigned int __x = (x); unsigned int __y = (y); __x > __y ? __x: __y; }) - - -#if defined(__LINUX__) || defined (__KERNEL__) -# if defined(LINUX_2_4)||defined(LINUX_2_6) -# ifndef AF_WANPIPE -# define AF_WANPIPE 25 -# ifndef PF_WANPIPE -# define PF_WANPIPE AF_WANPIPE -# endif -# endif -# else -# ifndef AF_WANPIPE -# define AF_WANPIPE 24 -# ifndef PF_WANPIPE -# define PF_WANPIPE AF_WANPIPE -# endif -# endif -# endif -# define AF_ANNEXG_WANPIPE AF_WANPIPE -# define PF_ANNEXG_WANPIPE AF_ANNEXG_WANPIPE -#endif - -/* Defines */ -#define WANPIPE_MAGIC 0x414C4453L /* signature: 'SDLA' reversed */ - -/* IOCTL numbers (up to 16) */ -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) -# define WANPIPE_DUMP _IOW(ROUTER_IOCTL, 16, wan_conf_t) -# define WANPIPE_EXEC _IOWR(ROUTER_IOCTL, 17, wan_conf_t) -#elif defined(__LINUX__) -# define WANPIPE_DUMP (ROUTER_USER+0) /* dump adapter's memory */ -# define WANPIPE_EXEC (ROUTER_USER+1) /* execute firmware command */ -#endif - -#if 0 -#define WAN_HWCALL(func, (x)) \ - if (card->hw_iface.##func){ \ - card->hw_iface.##func(x); \ - } -#endif - -#define TRACE_ALL 0x00 -#define TRACE_PROT 0x01 -#define TRACE_DATA 0x02 - -/* values for request/reply byte */ -#define UDPMGMT_REQUEST 0x01 -#define UDPMGMT_REPLY 0x02 -#define UDP_OFFSET 12 - -#define MAX_CMD_BUFF 10 -#define MAX_X25_LCN 255 /* Maximum number of x25 channels */ -#define MAX_LCN_NUM 4095 /* Maximum lcn number */ -#define MAX_FT1_RETRY 100 - -#define TX_TIMEOUT 5*HZ - - -/* General Critical Flags */ -enum { - SEND_CRIT, - PERI_CRIT, - RX_CRIT, - PRIV_CRIT -}; - -/* TE timer critical flags */ -/* #define LINELB_TIMER_RUNNING 0x04 - define in sdla_te1_pmc.h */ - -/* Bit maps for dynamic interface configuration - * DYN_OPT_ON : turns this option on/off - * DEV_DOWN : device was shutdown by the driver not - * by user - */ -#define DYN_OPT_ON 0x00 -#define DEV_DOWN 0x01 -#define WAN_DEV_READY 0x02 - -/* - * Data structures for IOCTL calls. - */ - -typedef struct sdla_dump /* WANPIPE_DUMP */ -{ - unsigned long magic; /* for verification */ - unsigned long offset; /* absolute adapter memory address */ - unsigned long length; /* block length */ - void* ptr; /* -> buffer */ -} sdla_dump_t; - -typedef struct sdla_exec /* WANPIPE_EXEC */ -{ - unsigned long magic; /* for verification */ - void* cmd; /* -> command structure */ - void* data; /* -> data buffer */ -} sdla_exec_t; - -typedef struct wan_procfs -{ - unsigned long magic; /* for verification */ - int cmd; - unsigned long max_len; - unsigned long offs; - int is_more; - void* data; -} wan_procfs_t; - -/* UDP management stuff */ -typedef struct wum_header -{ - unsigned char signature[8]; /* 00h: signature */ - unsigned char type; /* 08h: request/reply */ - unsigned char command; /* 09h: commnand */ - unsigned char reserved[6]; /* 0Ah: reserved */ -} wum_header_t; - -/************************************************************************* - Data Structure for global statistics -*************************************************************************/ - -typedef struct global_stats -{ - unsigned long isr_entry; - unsigned long isr_already_critical; - unsigned long isr_rx; - unsigned long isr_tx; - unsigned long isr_intr_test; - unsigned long isr_spurious; - unsigned long isr_enable_tx_int; - unsigned long rx_intr_corrupt_rx_bfr; - unsigned long rx_intr_on_orphaned_DLCI; - unsigned long rx_intr_dev_not_started; - unsigned long tx_intr_dev_not_started; - unsigned long poll_entry; - unsigned long poll_already_critical; - unsigned long poll_processed; - unsigned long poll_tbusy_bad_status; - unsigned long poll_host_disable_irq; - unsigned long poll_host_enable_irq; - -} global_stats_t; - -/************************************************************************* - Data Structure for if_send statistics -*************************************************************************/ -typedef struct if_send_stat{ - unsigned long if_send_entry; - unsigned long if_send_skb_null; - unsigned long if_send_broadcast; - unsigned long if_send_multicast; - unsigned long if_send_critical_ISR; - unsigned long if_send_critical_non_ISR; - unsigned long if_send_tbusy; - unsigned long if_send_tbusy_timeout; - unsigned long if_send_PIPE_request; - unsigned long if_send_wan_disconnected; - unsigned long if_send_dlci_disconnected; - unsigned long if_send_no_bfrs; - unsigned long if_send_adptr_bfrs_full; - unsigned long if_send_bfr_passed_to_adptr; - unsigned long if_send_protocol_error; - unsigned long if_send_bfr_not_passed_to_adptr; - unsigned long if_send_tx_int_enabled; - unsigned long if_send_consec_send_fail; -} if_send_stat_t; - -typedef struct rx_intr_stat{ - unsigned long rx_intr_no_socket; - unsigned long rx_intr_dev_not_started; - unsigned long rx_intr_PIPE_request; - unsigned long rx_intr_bfr_not_passed_to_stack; - unsigned long rx_intr_bfr_passed_to_stack; -} rx_intr_stat_t; - -typedef struct pipe_mgmt_stat{ - unsigned long UDP_PIPE_mgmt_kmalloc_err; - unsigned long UDP_PIPE_mgmt_direction_err; - unsigned long UDP_PIPE_mgmt_adptr_type_err; - unsigned long UDP_PIPE_mgmt_adptr_cmnd_OK; - unsigned long UDP_PIPE_mgmt_adptr_cmnd_timeout; - unsigned long UDP_PIPE_mgmt_adptr_send_passed; - unsigned long UDP_PIPE_mgmt_adptr_send_failed; - unsigned long UDP_PIPE_mgmt_not_passed_to_stack; - unsigned long UDP_PIPE_mgmt_passed_to_stack; - unsigned long UDP_PIPE_mgmt_no_socket; - unsigned long UDP_PIPE_mgmt_passed_to_adptr; -} pipe_mgmt_stat_t; - - -typedef struct { - struct sk_buff *skb; -} bh_data_t, cmd_data_t; - -#define MAX_LGTH_UDP_MGNT_PKT WAN_MAX_DATA_SIZE - - -/* This is used for interrupt testing */ -#define INTR_TEST_MODE 0x02 - -#define WUM_SIGNATURE_L 0x50495046 -#define WUM_SIGNATURE_H 0x444E3845 - -#define WUM_KILL 0x50 -#define WUM_EXEC 0x51 - - - -#if defined(WAN_KERNEL) -/****** Kernel Interface ****************************************************/ - -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) -# include /* WANPIPE Debugging messages */ -# include -# include -# include -# include -#elif defined(__LINUX__) -# include -# ifndef KERNEL_VERSION -# define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -# endif -# include -# include /* SDLA firmware module definitions */ -# include /* SDLA support module API definitions */ - -# if defined(LINUX_2_6) -# include -# elif defined(LINUX_2_4) -# include -# endif - -# include -# if defined(LINUX_2_4) || defined(LINUX_2_6) -# include -# include -# include -# include -# endif -# include -# include -# include -#endif - -#define MAX_E1_CHANNELS 32 -#define MAX_FR_CHANNELS (1007+1) - -#define WAN_ENABLE 0x01 -#define WAN_DISABLE 0x02 - -#ifndef min -#define min(a,b) (((a)<(b))?(a):(b)) -#endif -#ifndef max -#define max(a,b) (((a)>(b))?(a):(b)) -#endif - -#define is_digit(ch) (((ch)>=(unsigned)'0'&&(ch)<=(unsigned)'9')?1:0) -#define is_alpha(ch) ((((ch)>=(unsigned)'a'&&(ch)<=(unsigned)'z')||\ - ((ch)>=(unsigned)'A'&&(ch)<=(unsigned)'Z'))?1:0) -#define is_hex_digit(ch) ((((ch)>=(unsigned)'0'&&(ch)<=(unsigned)'9')||\ - ((ch)>=(unsigned)'a'&&(ch)<=(unsigned)'f')||\ - ((ch)>=(unsigned)'A'&&(ch)<=(unsigned)'F'))?1:0) - - -/****** Data Structures *****************************************************/ - -#if defined(__LINUX__) -typedef struct -{ /****** X.25 specific data **********/ - netdevice_t *svc_to_dev_map[MAX_X25_LCN]; - netdevice_t *pvc_to_dev_map[MAX_X25_LCN]; - netdevice_t *tx_dev; - netdevice_t *cmd_dev; - u32 no_dev; - unsigned long hdlc_buf_status_off; - atomic_t tx_interrupts_pending; - - /* FIXME: Move this out of the union */ - u16 timer_int_enabled; - netdevice_t *poll_device; - atomic_t command_busy; - - u32 udp_type; - u8 udp_pkt_src; - u32 udp_lcn; - netdevice_t * udp_dev; - wan_udp_pkt_t udp_pkt_data; - atomic_t udp_pkt_len; - - u8 LAPB_hdlc; /* Option to turn off X25 and run only LAPB */ - u8 logging; /* Option to log call messages */ - u8 oob_on_modem; /* Option to send modem status to the api */ - u16 num_of_ch; /* Number of channels configured by the user */ - wan_taskq_t x25_poll_task; - struct timer_list x25_timer; - /* Proc fs */ - wan_x25_conf_t x25_adm_conf; - wan_x25_conf_t x25_conf; - atomic_t tx_interrupt_cmd; - struct sk_buff_head trace_queue; - unsigned long trace_timeout; - unsigned short trace_lost_cnt; - - unsigned long card_ready; -} sdla_x25_t; -#endif - -typedef struct -{ /****** frame relay specific data ***/ - unsigned long rxmb_base_off; /* -> first Rx buffer */ - unsigned long rxmb_last_off; /* -> last Rx buffer */ - unsigned long rx_base_off; /* S508 receive buffer base */ - unsigned long rx_top_off; /* S508 receive buffer end */ - unsigned short node_dlci[100]; - unsigned short dlci_num; - netdevice_t* dlci_to_dev_map[MAX_FR_CHANNELS]; - atomic_t tx_interrupts_pending; - - /* FIXME: Move this out of the union */ - unsigned short timer_int_enabled; - - int udp_type; - char udp_pkt_src; - unsigned udp_dlci; - wan_udp_pkt_t udp_pkt_data; - atomic_t udp_pkt_len; - void* trc_el_base; /* first trace element */ - void* trc_el_last; /* last trace element */ - void* curr_trc_el; /* current trace element */ - unsigned short trc_bfr_space; /* trace buffer space */ - netdevice_t* arp_dev; -#if defined(__LINUX__) - spinlock_t if_send_lock; -#endif - unsigned char issue_fs_on_startup; - /* Proc fs */ - unsigned short t391; - unsigned short t392; - unsigned short n391; - unsigned short n392; - unsigned short n393; - void* update_dlci; - unsigned char auto_dlci_cfg; -} sdla_fr_t; - -typedef struct -{ /****** PPP-specific data ***********/ - char if_name[WAN_IFNAME_SZ+1]; /* interface name */ - unsigned long txbuf_off; /* -> current Tx buffer */ - unsigned long txbuf_base_off; /* -> first Tx buffer */ - unsigned long txbuf_last_off; /* -> last Tx buffer */ - unsigned long txbuf_next_off; /* Next Tx buffer to use */ - unsigned long rxbuf_base_off; /* -> first Rx buffer */ - unsigned long rxbuf_last_off; /* -> last Rx buffer */ - unsigned long rx_base_off; /* S508 receive buffer base */ - unsigned long rx_top_off; /* S508 receive buffer end */ - unsigned long rxbuf_next_off; /* Next Rx buffer to use */ - char ip_mode; /* STATIC/HOST/PEER IP Mode */ - char authenticator; /* Authenticator for PAP/CHAP */ - /* FIXME: Move this out of the union */ - unsigned char comm_enabled; /* Is comm enabled or not */ - unsigned char peer_route; /* Process Peer Route */ -} sdla_ppp_t; - -typedef struct -{ /* Cisco HDLC-specific data */ - char if_name[WAN_IFNAME_SZ+1]; /* interface name */ - int comm_port;/* Communication Port O or 1 */ - unsigned char usedby; /* Used by WANPIPE or API */ - unsigned long rxmb_off; /* Receive mail box */ - /*unsigned long flags_off;*/ /* flags */ - unsigned long txbuf_off; /* -> current Tx buffer */ - unsigned long txbuf_base_off; /* -> first Tx buffer */ - unsigned long txbuf_last_off; /* -> last Tx buffer */ - unsigned long rxbuf_base_off; /* -> first Rx buffer */ - unsigned long rxbuf_last_off; /* -> last Rx buffer */ - unsigned long rx_base_off; /* S508 receive buffer base */ - unsigned long rx_top_off; /* S508 receive buffer end */ - void* tx_status; /* Tx status element */ - void* rx_status; /* Rx status element */ - unsigned char receive_only; /* high speed receivers */ - unsigned short protocol_options; - unsigned short kpalv_tx; /* Tx kpalv timer */ - unsigned short kpalv_rx; /* Rx kpalv timer */ - unsigned short kpalv_err; /* Error tolerance */ - unsigned short slarp_timer; /* SLARP req timer */ - unsigned state; /* state of the link */ - unsigned char api_status; - unsigned char update_call_count; - unsigned short api_options; /* for async config */ - unsigned char async_mode; - unsigned short tx_bits_per_char; - unsigned short rx_bits_per_char; - unsigned short stop_bits; - unsigned short parity; - unsigned short break_timer; - unsigned short inter_char_timer; - unsigned short rx_complete_length; - unsigned short xon_char; - unsigned short xoff_char; - /* FIXME: Move this out of the union */ - unsigned char comm_enabled; /* Is comm enabled or not */ - /* FIXME: Move this out of the union */ - unsigned char backup; - int TracingEnabled; /* For enabling Tracing */ - unsigned long curr_trace_addr; /* Used for Tracing */ - unsigned long start_trace_addr; - unsigned long end_trace_addr; - unsigned long base_addr_trace_buffer; - unsigned long end_addr_trace_buffer; - unsigned short number_trace_elements; - unsigned available_buffer_space; - unsigned long router_start_time; - unsigned char route_status; - unsigned char route_removed; - unsigned long tick_counter; - /* FIXME: Move this out of the union */ - unsigned short timer_int_enabled; - unsigned long router_up_time; -#if defined(__LINUX__) - spinlock_t if_send_lock; -#endif - void * prot; -} sdla_chdlc_t; - -typedef struct -{ - void* tx_status; /* Tx status element */ - void* rx_status; /* Rx status element */ - void* trace_status; /* Trace status element */ - void* txbuf; /* -> current Tx buffer */ - void* txbuf_base; /* -> first Tx buffer */ - void* txbuf_last; /* -> last Tx buffer */ - void* rxbuf_base; /* -> first Rx buffer */ - void* rxbuf_last; /* -> last Rx buffer */ - void* tracebuf; /* -> current Trace buffer */ - void* tracebuf_base; /* -> current Trace buffer */ - void* tracebuf_last; /* -> current Trace buffer */ - unsigned rx_base; /* receive buffer base */ - unsigned rx_end; /* receive buffer end */ - unsigned trace_base; /* trace buffer base */ - unsigned trace_end; /* trace buffer end */ -} sdla_hdlc_t; - -#if defined(__LINUX__) -typedef struct -{ - char if_name[WAN_IFNAME_SZ+1]; /* interface name */ - int comm_port;/* Communication Port O or 1 */ - unsigned char usedby; /* Used by WANPIPE or API */ - unsigned long rxmb_off; /* Receive mail box */ - /* unsigned long flags_off; */ /* flags */ - unsigned long txbuf_off; /* -> current Tx buffer */ - unsigned long txbuf_base_off; /* -> first Tx buffer */ - unsigned long txbuf_last_off; /* -> last Tx buffer */ - unsigned long rxbuf_base_off; /* -> first Rx buffer */ - unsigned long rxbuf_last_off; /* -> last Rx buffer */ - unsigned long rx_base_off; /* S508 receive buffer base */ - unsigned long rx_top_off; /* S508 receive buffer end */ - void* tx_status; /* FIXME: Not used Tx status element */ - void* rx_status; /* FIXME: Not used Rx status element */ - unsigned short protocol_options; - unsigned state; /* state of the link */ - unsigned char api_status; - unsigned char update_call_count; - unsigned short api_options; /* for async config */ - unsigned short tx_bits_per_char; - unsigned short rx_bits_per_char; - unsigned short stop_bits; - unsigned short parity; - - unsigned long tq_working; - void *time_slot_map[MAX_E1_CHANNELS]; - struct tasklet_struct wanpipe_rx_task; - struct tasklet_struct wanpipe_tx_task; - unsigned char time_slots; - unsigned char tx_scratch_buf[MAX_E1_CHANNELS*50]; - unsigned short tx_scratch_buf_len; - atomic_t tx_interrupts; - unsigned short tx_chan_multiple; - unsigned int wait_for_buffers; - struct sdla *sw_card; - struct sk_buff_head rx_isr_queue; - struct sk_buff_head rx_isr_free_queue; - - /* FIXME: Move this out of the union */ - unsigned short timer_int_enabled; - unsigned long tx_idle_off; - unsigned long rx_discard_off; - - wan_bitstrm_conf_t cfg; - - unsigned char rbs_sig[32]; - unsigned char serial; - -} sdla_bitstrm_t; -#endif - -typedef struct -{ - char if_name[WAN_IFNAME_SZ+1]; /* interface name */ - int comm_port;/* Communication Port O or 1 */ - unsigned char usedby; /* Used by WANPIPE or API */ - unsigned char state; - /* unsigned long flags_off; */ /* flags */ - unsigned long rxmb_off; /* Receive mail box */ - unsigned long txbuf_off; /* -> current Tx buffer */ - unsigned long txbuf_base_off; /* -> first Tx buffer */ - unsigned long txbuf_last_off; /* -> last Tx buffer */ - unsigned long rxbuf_base_off; /* -> first Rx buffer */ - unsigned long rxbuf_last_off; /* -> last Rx buffer */ - unsigned long rx_base_off; /* S508 receive buffer base */ - unsigned long rx_top_off; /* S508 receive buffer end */ - void* tx_status; /* Tx status element */ - void* rx_status; /* Rx status element */ - - unsigned int line_cfg_opt; - unsigned int modem_cfg_opt; - unsigned int modem_status_timer; - unsigned int api_options; - unsigned int protocol_options; - unsigned int protocol_specification; - unsigned int stats_history_options; - unsigned int max_length_msu_sif; - unsigned int max_unacked_tx_msus; - unsigned int link_inactivity_timer; - unsigned int t1_timer; - unsigned int t2_timer; - unsigned int t3_timer; - unsigned int t4_timer_emergency; - unsigned int t4_timer_normal; - unsigned int t5_timer; - unsigned int t6_timer; - unsigned int t7_timer; - unsigned int t8_timer; - unsigned int n1; - unsigned int n2; - unsigned int tin; - unsigned int tie; - unsigned int suerm_error_threshold; - unsigned int suerm_number_octets; - unsigned int suerm_number_sus; - unsigned int sie_interval_timer; - unsigned int sio_interval_timer; - unsigned int sios_interval_timer; - unsigned int fisu_interval_timer; -} sdla_ss7_t; - -typedef struct -{ - char if_name[WAN_IFNAME_SZ+1]; /* interface name */ - int comm_port;/* Communication Port O or 1 */ - unsigned char usedby; /* Used by WANPIPE or API */ - unsigned char state; - /*FIXME: Move this out of the union */ - unsigned char comm_enabled; -} sdla_sdlc_t; - -typedef struct -{ - void *adapter; - unsigned char EncapMode; -} sdla_adsl_t; - -#if defined(__LINUX__) -typedef struct -{ - unsigned long rxmb_off; /* Receive mail box */ - /* unsigned long flags_off; */ /* flags */ - unsigned long txbuf_off; /* -> current Tx buffer */ - unsigned long txbuf_base_off; /* -> first Tx buffer */ - unsigned long txbuf_last_off; /* -> last Tx buffer */ - unsigned long rxbuf_base_off; /* -> first Rx buffer */ - unsigned long rxbuf_last_off; /* -> last Rx buffer */ - unsigned long rx_base_off; /* S508 receive buffer base */ - void* tx_status; /* Tx status element */ - void* rx_status; /* Rx status element */ - wan_tasklet_t wanpipe_rx_task; - struct sk_buff_head wp_rx_free_list; - struct sk_buff_head wp_rx_used_list; - struct sk_buff_head wp_rx_data_list; - struct sk_buff_head wp_tx_prot_list; - unsigned char state; - wan_timer_t atm_timer; - void *tx_dev; - void *trace_info; - void *atm_device; - wan_atm_conf_t atm_cfg; -} sdla_atm_t; -#endif - -#if defined(__LINUX__) -typedef struct -{ - void* rxmb; /* Receive mail box */ - void* flags; /* flags */ - void* tx_status; /* Tx status element */ - void* rx_status; /* Rx status element */ - void* txbuf; /* -> current Tx buffer */ - void* txbuf_base; /* -> first Tx buffer */ - void* txbuf_last; /* -> last Tx buffer */ - void* rxbuf_base; /* -> first Rx buffer */ - void* rxbuf_last; /* -> last Rx buffer */ - unsigned rx_base; /* S508 receive buffer base */ - wan_tasklet_t wanpipe_rx_task; - struct sk_buff_head wp_rx_free_list; - struct sk_buff_head wp_rx_used_list; - unsigned char state; -} sdla_pos_t; -#endif - -typedef struct -{ - unsigned long time_slot_map; - unsigned long logic_ch_map; - unsigned char num_of_time_slots; - unsigned char top_logic_ch; - unsigned long bar; - void *trace_info; - void *dev_to_ch_map[MAX_E1_CHANNELS]; - void *rx_dma_ptr; - void *tx_dma_ptr; - wan_xilinx_conf_t cfg; - unsigned long dma_mtu_off; - unsigned short dma_mtu; - unsigned char state_change_exit_isr; - unsigned long active_ch_map; - unsigned long fifo_addr_map; - wan_timer_t led_timer; - unsigned char tdmv_sync; - unsigned int chip_cfg_status; - wan_taskq_t port_task; - unsigned int port_task_cmd; - unsigned long wdt_rx_cnt; - unsigned long wdt_tx_cnt; - unsigned int security_id; - unsigned int security_cnt; - unsigned char firm_ver; - unsigned char firm_id; - unsigned int chip_security_cnt; - unsigned long rx_timeout,gtimeout; - unsigned int comm_enabled; - unsigned int lcfg_reg; - unsigned int tdmv_master_if_up; - unsigned int tdmv_mtu; - unsigned int tdmv_zaptel_cfg; - netskb_t *tdmv_api_rx; - netskb_t *tdmv_api_tx; - wan_skb_queue_t tdmv_api_tx_list; - - unsigned int tdmv_dchan_cfg_on_master; - unsigned int tdmv_chan; - unsigned int tdmv_dchan; - unsigned int tdmv_dchan_active_ch; - void *tdmv_chan_ptr; - - unsigned char tdmv_hw_dtmf; - - unsigned char led_ctrl; - unsigned int tdm_intr_status; - void *bar_virt; - unsigned short tdm_rx_dma_toggle; - unsigned short tdm_tx_dma_toggle; - unsigned int tdm_logic_ch_map; - - unsigned long sec_chk_cnt; - - wan_skb_queue_t rtp_tap_list; -} sdla_xilinx_t; - -typedef struct -{ - unsigned long current_offset; - unsigned long total_len; - unsigned long total_num; - unsigned long status; -} sdla_debug_t; - -/* Adapter Data Space. - * This structure is needed because we handle multiple cards, otherwise - * static data would do it. - */ -typedef struct sdla -{ - char devname[WAN_DRVNAME_SZ+1]; /* card name */ - void* hw; /* hardware configuration */ - wan_device_t wandev; /* WAN device data space */ - - unsigned open_cnt; /* number of open interfaces */ - unsigned long state_tick; /* link state timestamp */ - unsigned intr_mode; /* Type of Interrupt Mode */ - unsigned long in_isr; /* interrupt-in-service flag */ - char buff_int_mode_unbusy; /* flag for carrying out dev_tint */ - char dlci_int_mode_unbusy; /* flag for carrying out dev_tint */ - unsigned long configured; /* flag for previous configurations */ - - unsigned short irq_dis_if_send_count; /* Disabling irqs in if_send*/ - unsigned short irq_dis_poll_count; /* Disabling irqs in poll routine*/ - unsigned short force_enable_irq; - char TracingEnabled; /* flag for enabling trace */ - global_stats_t statistics; /* global statistics */ - unsigned long mbox_off; /* -> mailbox offset */ - wan_mbox_t wan_mbox; /* mailbox structure */ - unsigned long rxmb_off; /* -> receive mailbox */ - wan_mbox_t wan_rxmb; /* rx mailbox structure */ - unsigned long flags_off; /* -> adapter status flags */ - unsigned long fe_status_off; /* FE status structure offset */ -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) - unsigned char rx_data[MAX_PACKET_SIZE]; /* Rx buffer */ - unsigned int rx_len; /* Rx data len */ - unsigned char tx_data[MAX_PACKET_SIZE]; /* Tx buffer */ - unsigned int tx_len; /* Tx data len */ -#endif - WAN_IRQ_RETVAL (*isr)(struct sdla* card); /* interrupt service routine */ - void (*poll)(struct sdla* card); /* polling routine */ - int (*exec)(struct sdla* card, void* u_cmd, void* u_data); - /* Used by the listen() system call */ -#if defined(__LINUX__) - /* Wanpipe Socket Interface */ - int (*func) (netskb_t*, struct sock *); - struct sock *sk; -#endif - - /* Shutdown function */ - void (*disable_comm) (struct sdla *card); - - /* Secondary Port Device: Piggibacking */ - struct sdla *next; - struct sdla *list; - -#if defined(__LINUX__) - /* TTY driver variables */ - unsigned char tty_opt; - struct tty_struct *tty; - unsigned int tty_minor; - unsigned int tty_open; - unsigned char *tty_buf; - struct sk_buff_head tty_rx_empty; - struct sk_buff_head tty_rx_full; - wan_taskq_t tty_task_queue; -#endif - union - { -#if defined(__LINUX__) - sdla_x25_t x; - sdla_bitstrm_t b; - sdla_atm_t atm; - sdla_pos_t pos; -#endif - sdla_fr_t f; - sdla_ppp_t p; - sdla_chdlc_t c; - sdla_hdlc_t h; - sdla_ss7_t s; - sdla_sdlc_t sdlc; - sdla_adsl_t adsl; - sdla_xilinx_t aft; - sdla_debug_t debug; - } u; - unsigned char irq_equalize; - - /*????????????????*/ - /*Should be in wandev */ - unsigned int type; /* card type */ - unsigned int adptr_type; /* adapter type */ - unsigned char adptr_subtype; /* adapter subtype */ - wan_tasklet_t debug_task; - wan_timer_t debug_timer; - unsigned long debug_running; - unsigned char wan_debugging_state; /* WAN debugging state */ - int wan_debug_last_msg; /* Last WAN debug message */ - int (*wan_debugging)(struct sdla*);/* link debugging routine */ - unsigned long (*get_crc_frames)(struct sdla*);/* get no of CRC frames */ - unsigned long (*get_abort_frames)(struct sdla*);/* get no of Abort frames */ - unsigned long (*get_tx_underun_frames)(struct sdla*);/* get no of TX underun frames */ - unsigned short timer_int_enabled; - unsigned char backup; - unsigned long comm_enabled; - unsigned long update_comms_stats; - - sdla_fe_t fe; /* front end structures */ - - unsigned int rCount; - - /* Wanpipe Socket Interface */ - int (*get_snmp_data)(struct sdla*, netdevice_t*, void*); - - unsigned long intr_perm_off; - unsigned long intr_type_off; - - /* Hardware interface function pointers */ - sdlahw_iface_t hw_iface; - - int (*bind_api_to_svc)(struct sdla*, void *sk_id); - - unsigned long spurious; - - unsigned long intcount; - - wan_tdmv_conf_t tdmv_conf; -#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) - wan_tdmv_iface_t tdmv_iface; - wan_tdmv_t wan_tdmv; -#endif - - wan_hwec_conf_t hwec_conf; - wan_rtp_conf_t rtp_conf; - -#if defined(CONFIG_PRODUCT_WANPIPE_GENERIC) - struct sdla* same_card; -#endif - - -#if defined(__FreeBSD__) -# if defined(NETGRAPH) - int running; /* something is attached so we are running */ - /* ---netgraph bits --- */ - int datahooks; /* number of data hooks attached */ - node_p node; /* netgraph node */ - hook_p hook; /* data hook */ - hook_p debug_hook; -# if defined(ALTQ) - struct ifaltq xmitq_hipri; /* hi-priority transmit queue */ - struct ifaltq xmitq; /* transmit queue */ -# else - struct ifqueue xmitq_hipri; /* hi-priority transmit queue */ - struct ifqueue xmitq; /* transmit queue */ -# endif - int flags; /* state */ -# define WAN_RUNNING 0x01 /* board is active */ -# define WAN_OACTIVE 0x02 /* output is active */ - int out_dog; /* watchdog cycles output count-down */ -# if ( __FreeBSD__ >= 3 ) - struct callout_handle handle; /* timeout(9) handle */ -# endif - u_long lastinbytes, lastoutbytes; /* a second ago */ - u_long inrate, outrate; /* highest rate seen */ - u_long inlast; /* last input N secs ago */ - u_long out_deficit; /* output since last input */ - void (*wan_down)(struct sdla*); - int (*wan_up)(struct sdla*); - void (*wan_start)(struct sdla*); -# endif /* NETGRAPH */ - /* per card statistics */ - u_long inbytes, outbytes; /* stats */ - u_long oerrors, ierrors; - u_long opackets, ipackets; -#endif /* __FreeBSD__ */ - - /* This value is used for detecting TDM Voice - * rsync timeout, it should be long */ - unsigned long rsync_timeout; -} sdla_t; - -/****** Public Functions ****************************************************/ - -void wanpipe_open (sdla_t* card); /* wpmain.c */ -void wanpipe_close (sdla_t* card); /* wpmain.c */ - -int wpx_init (sdla_t* card, wandev_conf_t* conf); /* wpx.c */ -int wpf_init (sdla_t* card, wandev_conf_t* conf); /* wpf.c */ -int wpp_init (sdla_t* card, wandev_conf_t* conf); /* wpp.c */ -int wpc_init (sdla_t* card, wandev_conf_t* conf); /* Cisco HDLC */ -int wp_asyhdlc_init (sdla_t* card, wandev_conf_t* conf); /* Async HDLC */ -int wpbsc_init (sdla_t* card, wandev_conf_t* conf); /* BSC streaming */ -int wph_init(sdla_t* card, wandev_conf_t* conf); /* HDLC support */ -int wpft1_init (sdla_t* card, wandev_conf_t* conf); /* FT1 Config support */ -int wp_mprot_init(sdla_t* card, wandev_conf_t* conf); /* Sync PPP on top of RAW CHDLC */ -int wpbit_init (sdla_t* card, wandev_conf_t* conf); /* Bit Stream driver */ -int wpedu_init(sdla_t* card, wandev_conf_t* conf); /* Educational driver */ -int wpss7_init(sdla_t* card, wandev_conf_t* conf); /* SS7 driver */ -int wp_bscstrm_init(sdla_t* card, wandev_conf_t* conf); /* BiSync Streaming Nasdaq */ -int wp_hdlc_fr_init(sdla_t* card, wandev_conf_t* conf); /* Frame Relay over HDLC RAW Streaming */ -int wp_adsl_init(sdla_t* card, wandev_conf_t* conf); /* ADSL Driver */ -int wp_sdlc_init(sdla_t* card, wandev_conf_t* conf); /* SDLC Driver */ -int wp_atm_init(sdla_t* card, wandev_conf_t* conf); /* ATM Driver */ -int wp_pos_init(sdla_t* card, wandev_conf_t* conf); /* POS Driver */ -int wp_xilinx_init(sdla_t* card, wandev_conf_t* conf); /* Xilinx Hardware Support */ -int wp_aft_te1_init(sdla_t* card, wandev_conf_t* conf); /* Xilinx Hardware Support */ -int wp_aft_56k_init(sdla_t* card, wandev_conf_t* conf); /* Xilinx Hardware Support */ -int wp_aft_analog_init(sdla_t* card, wandev_conf_t* conf); /* Xilinx Hardware Support */ -int wp_adccp_init(sdla_t* card, wandev_conf_t* conf); -int wp_xilinx_if_init(sdla_t* card, netdevice_t* dev); -int wp_aft_te3_init(sdla_t* card, wandev_conf_t* conf); /* AFT TE3 Hardware Support */ -int wp_aft_te1_ss7_init(sdla_t* card, wandev_conf_t* conf); /* AFT TE1 SS7 Hardware Support */ -int aft_global_hw_device_init(void); - -int wanpipe_globals_util_init(void); /* Initialize All Global Tables */ - -#if defined(__LINUX__) -extern int wanpipe_queue_tq (wan_taskq_t *); -extern int wanpipe_mark_bh (void); -extern int change_dev_flags (netdevice_t *, unsigned); -extern unsigned long get_ip_address (netdevice_t *dev, int option); -extern void add_gateway(sdla_t *, netdevice_t *); - -#if 0 -extern void fastcall wp_tasklet_hi_schedule_per_cpu(struct tasklet_struct *t, int cpu_no); -extern void wp_tasklet_per_cpu_init (void); -#endif - -//FIXME: Take it out -//extern int wan_reply_udp( unsigned char *data, unsigned int mbox_len, int trace_opt); -//extern int wan_udp_pkt_type(sdla_t* card,unsigned char *data); - -extern int wan_ip_udp_setup(void* card_id, - wan_rtp_conf_t *rtp_conf, - u32 chan, - unsigned char *data, unsigned int mbox_len); - -extern int wanpipe_sdlc_unregister(netdevice_t *dev); -extern int wanpipe_sdlc_register(netdevice_t *dev, void *wp_sdlc_reg); -//ALEX_TODAY extern int check_conf_hw_mismatch(sdla_t *card, unsigned char media); -#endif - -void adsl_vcivpi_update(sdla_t* card, wandev_conf_t* conf); - -#ifdef CONFIG_PRODUCT_WANPIPE_ANNEXG -extern struct wanpipe_lapb_register_struct lapb_protocol; -#endif - -int wan_snmp_data(sdla_t* card, netdevice_t* dev, int cmd, struct ifreq* ifr); - -int wan_capture_trace_packet(sdla_t *card, wan_trace_t* trace_info, netskb_t *skb, char direction); -int wan_capture_trace_packet_offset(sdla_t *card, wan_trace_t* trace_info, netskb_t *skb, int off,char direction); - -#if defined(__LINUX__) -int wan_verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode); -int wan_memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); -int wan_memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len); -#endif - -/* LIP ATM prototypes */ -int init_atm_idle_buffer(unsigned char *buff, int buff_len, char *if_name, char hardware_flip); -int atm_add_data_to_skb(void* skb, void *data, int data_len, char *if_name); -int atm_pad_idle_cells_in_tx_skb(void *skb, void *tx_idle_skb, char *if_name); -void *atm_tx_skb_dequeue(void* wp_tx_pending_list, void *tx_idle_skb, char *if_name); - - -#if defined(__FreeBSD__) && defined(NETGRAPH) -int wan_ng_init(sdla_t*); -int wan_ng_remove(sdla_t*); -#endif - -#endif /* __KERNEL__ */ -#endif /* _WANPIPE_H */ diff --git a/patches/kdrivers/include/wanpipe_abstr.h b/patches/kdrivers/include/wanpipe_abstr.h index ee02e5b..47f8988 100644 --- a/patches/kdrivers/include/wanpipe_abstr.h +++ b/patches/kdrivers/include/wanpipe_abstr.h @@ -1,13 +1,18 @@ /***************************************************************************** -* wanpipe_abstr.c WANPIPE(tm) Kernel Abstraction Layer. +* wanpipe_abstr.h WANPIPE(tm) Kernel Abstraction Layer. * * Authors: Nenad Corbic -* Alex Feldman +* David Rokhvarg * * Copyright: (c) 2003 Sangoma Technologies Inc. * * ============================================================================ * Jan 20, 2003 Nenad Corbic Initial version +* +* Nov 27, 2007 David Rokhvarg Implemented functions/definitions for +* Sangoma MS Windows Driver and API. +* * ============================================================================ * 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 @@ -19,12 +24,25 @@ #ifndef _WANPIPE_ABSTR_H #define _WANPIPE_ABSTR_H +#if defined(__LINUX__) +# include +#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +# include +#elif defined(__WINDOWS__) +# include +#endif + extern unsigned char* wpabs_skb_data(void* skb); extern unsigned char* wpabs_skb_tail(void* skb); extern int wpabs_skb_len(void* skb); extern void* wpabs_skb_alloc(unsigned int len); extern void wpabs_skb_free(void* skb); -extern void wpabs_skb_copyback(void* skb, int off, int len, unsigned long cp); +#if defined(__WINDOWS__) || defined(__FreeBSD__) +extern void wpabs_skb_copyback(void*, int, int, caddr_t); +#else +extern void wpabs_skb_copyback(void*, int, int, unsigned long); +#endif + extern void wpabs_skb_copyback_user(void* skb, int off, int len, unsigned long cp); extern unsigned char* wpabs_skb_pull(void* skb, int len); extern unsigned char* wpabs_skb_put(void* skb, int len); @@ -64,7 +82,13 @@ extern int wpabs_netif_dev_up(void*); extern void wpabs_netif_wake_queue(void* dev); extern void* wpabs_timer_alloc(void); -extern void wpabs_init_timer(void*, void*, unsigned long); +extern void wpabs_init_timer(void*, void*, +#if defined(__WINDOWS__) + wan_timer_arg_t); +#else + unsigned long); +#endif + extern void wpabs_del_timer(void*); extern void wpabs_add_timer(void*,unsigned long); @@ -86,7 +110,7 @@ extern void* wpabs_spinlock_alloc(void); extern void wpabs_spinlock_free(void*); extern void wpabs_spin_lock_irqsave(void*,unsigned long*); extern void wpabs_spin_unlock_irqrestore(void*,unsigned long*); -extern void wpabs_spin_lock_init(void*); +extern void wpabs_spin_lock_init(void*, char*); extern void wpabs_rwlock_init (void*); extern void wpabs_read_rw_lock(void*); @@ -94,7 +118,6 @@ extern void wpabs_read_rw_unlock(void*); extern void wpabs_write_rw_lock_irq(void*,unsigned long*); extern void wpabs_write_rw_unlock_irq(void*,unsigned long*); - extern void wpabs_debug_event(const char * fmt, ...); extern void wpabs_debug_init(const char * fmt, ...); extern void wpabs_debug_cfg(const char * fmt, ...); @@ -109,7 +132,7 @@ extern int wpabs_test_bit(int bit, void *ptr); extern int wpabs_test_and_set_bit(int bit, void *ptr); extern int wpabs_clear_bit(int bit, void *ptr); -extern unsigned long wpabs_get_systemticks(void); +extern wan_ticks_t wpabs_get_systemticks(void); extern unsigned long wpabs_get_hz(void); extern unsigned short wpabs_htons(unsigned short data); extern unsigned short wpabs_ntohs(unsigned short); @@ -176,9 +199,6 @@ extern int wpabs_dma_free(void*, void*); extern unsigned long* wpabs_dma_get_vaddr(void*, void*); extern unsigned long wpabs_dma_get_paddr(void*, void*); -#define TRC_INCOMING_FRM 0x00 -#define TRC_OUTGOING_FRM 0x01 - extern int wpabs_trace_queue_len(void *trace_ptr); extern int wpabs_tracing_enabled(void*); extern int wpabs_trace_enqueue(void*, void*); @@ -190,16 +210,4 @@ extern unsigned char wpabs_get_last_trace_direction(void *trace_ptr); extern int wpabs_bpf_report(void *dev, void *skb, int,int); -#pragma pack(1) -typedef struct { - unsigned char status; - unsigned char data_avail; - unsigned short real_length; - unsigned short time_stamp; - unsigned long sec; - unsigned long usec; - unsigned char data[0]; -} wan_trace_pkt_t; -#pragma pack() - #endif diff --git a/patches/kdrivers/include/wanpipe_abstr_types.h b/patches/kdrivers/include/wanpipe_abstr_types.h new file mode 100644 index 0000000..797800f --- /dev/null +++ b/patches/kdrivers/include/wanpipe_abstr_types.h @@ -0,0 +1,36 @@ +/************************************************************************* +* wanpipe_abstr_types.h WANPIPE(tm) * +* * +* Wanpipe Kernel Abstraction type definitions * +* * +* * +* Author: Alex Feldman * +*========================================================================* +* Jan 24, 2008 Alex Feldman Initial version * +*************************************************************************/ + +#ifndef __WANPIPE_ABSTR_TYPES_H +# define __WANPIPE_ABSTR_TYPES_H + + + +#if defined(__FreeBSD__) +/******************* F R E E B S D ******************************/ +typedef int wan_ticks_t; +#elif defined(__OpenBSD__) +/******************* O P E N B S D ******************************/ +typedef int wan_ticks_t; +#elif defined(__NetBSD__) +/******************* N E T B S D ******************************/ +typedef int wan_ticks_t; +#elif defined(__LINUX__) +/*********************** L I N U X ******************************/ +typedef unsigned long wan_ticks_t; +#elif defined(__WINDOWS__) +/******************* W I N D O W S ******************************/ +typedef unsigned long wan_ticks_t; +#endif + + + +#endif /* __WANPIPE_ABSTR_TYPES_H */ diff --git a/patches/kdrivers/include/wanpipe_cfg.h b/patches/kdrivers/include/wanpipe_cfg.h index 8f9b833..358fcc6 100644 --- a/patches/kdrivers/include/wanpipe_cfg.h +++ b/patches/kdrivers/include/wanpipe_cfg.h @@ -1,19 +1,31 @@ #ifndef _WANPIPE_CFG_H_ #define _WANPIPE_CFG_H_ - #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) # include # include # include # include +# include +# include # include #elif defined(__LINUX__) # include # include # include # include +# include +# include # include +#elif defined(__WINDOWS__) +# include +# include +# include +# include +# include +# include +# include +# include #else # error "No OS Defined!" #endif @@ -23,12 +35,46 @@ #define LAN_INTERFACE 1 /* Miscellaneous */ +#if defined(__WINDOWS__) +#define WAN_IFNAME_SZ IFNAMSIZ/* max length of the interface name */ +#define WAN_DRVNAME_SZ IFNAMSIZ/* max length of the link driver name */ +#define WAN_ADDRESS_SZ 31 /* max length of the WAN media address */ + +#define WAN_AUTHNAMELEN 64 +/* +This is the maximum number of interfaces that any protocol may have. +For example: a number of DLCIs. +*/ +#define MAX_NUMBER_OF_PROTOCOL_INTERFACES (1007+16) + +/********** compilation flags ************/ +/* compile protocols in the LIP layer */ +#define CONFIG_PRODUCT_WANPIPE_FR +#define CONFIG_PRODUCT_WANPIPE_CHDLC +#define CONFIG_PRODUCT_WANPIPE_PPP +#define CONFIG_PRODUCT_WANPIPE_LAPB + +/* compile AFT T1/E1 code */ +#define CONFIG_PRODUCT_WANPIPE_AFT +/* compile AFT A200 Analog code */ +#define CONFIG_PRODUCT_WANPIPE_AFT_RM +/* compile HWEC code */ +#define CONFIG_WANPIPE_HWEC +/* compile ADSL code */ +#define CONFIG_PRODUCT_WANPIPE_ADSL +/* compile TDM API code */ +#define AFT_TDM_API_SUPPORT +/********** end of compilation flags ************/ + + +#else #define WAN_IFNAME_SZ 15 /* max length of the interface name */ #define WAN_DRVNAME_SZ 15 /* max length of the link driver name */ #define WAN_ADDRESS_SZ 31 /* max length of the WAN media address */ #define USED_BY_FIELD 30 /* max length of the used by field */ #define WAN_AUTHNAMELEN 64 +#endif /* Defines for UDP PACKET TYPE */ #define UDP_PTPIPE_TYPE 0x01 @@ -77,6 +123,7 @@ #define WANOPT_AFT_ISDN 11 #define WANOPT_AFT_56K 12 #define WANOPT_AFT101 13 +#define WANOPT_AFT_SERIAL 14 /* * Configuration options defines. @@ -87,6 +134,8 @@ #define WANOPT_NO 0 #define WANOPT_YES 1 +#define WANOPT_SIM 2 + /* intercace options */ #define WANOPT_RS232 0 #define WANOPT_V35 1 @@ -204,6 +253,10 @@ #define WANOPT_FE_OSC_CLOCK 0x00 #define WANOPT_FE_LINE_CLOCK 0x01 +#define WANOPT_NETWORK_SYNC_OUT 0x00 +#define WANOPT_NETWORK_SYNC_IN 0x01 + + enum wan_codec_format{ WP_NONE, @@ -224,10 +277,17 @@ enum { TDM_VOICE, TDM_VOICE_DCHAN, TDM_VOICE_API, +#if defined(__WINDOWS__) + /* has to be here to keep backward compatibility! */ + LIB_SANGOMA_API, + TDM_VOICE_API_V2, +#endif TDM_API, + WP_NETGRAPH, TRUNK }; + /* POS protocols */ enum { IBM4680, @@ -315,6 +375,7 @@ enum { (card_type == WANOPT_AFT_ANALOG) ? "A200/400" : \ (card_type == WANOPT_AFT_ISDN) ? "A500" : \ (card_type == WANOPT_AFT_56K) ? "A056" : \ + (card_type == WANOPT_AFT_SERIAL) ? "A14x" : \ "Unknown" #define COMPORT_DECODE(port) (port == WANOPT_PRI) ? "PRI" : "SEC" @@ -354,6 +415,8 @@ enum { #define FR_STATION_DECODE(station) \ (station == WANOPT_CPE) ? "CPE" : "Node" +#define DEFAULT_TE_RX_SLEVEL 120 + typedef char devname_t[WAN_DRVNAME_SZ+1]; typedef enum { @@ -415,6 +478,12 @@ typedef struct wan_adsl_conf unsigned short mtu; unsigned char atm_watchdog; + /* Number of cells received on each interrupt. Recommended values: 5 - 40. + Higher values for higher line speeds. + + */ + unsigned short RxCellCount; + }wan_adsl_conf_t; @@ -521,6 +590,12 @@ typedef struct wan_x25_conf /*---------------------------------------------------------------------------- * Frame relay specific link-level configuration. */ +#if defined(__WINDOWS__) +# define DLCI_LIST_LEN MAX_NUMBER_OF_PROTOCOL_INTERFACES +#else +# define DLCI_LIST_LEN 100 +#endif + typedef struct wan_fr_conf { unsigned int signalling; /* local in-channel signalling type */ @@ -530,11 +605,14 @@ typedef struct wan_fr_conf unsigned int n392; /* error threshold counter */ unsigned int n393; /* monitored events counter */ unsigned int dlci_num; /* number of DLCs (access node) */ - unsigned int dlci[100]; /* List of all DLCIs */ + unsigned int dlci[DLCI_LIST_LEN];/* List of all DLCIs */ unsigned char issue_fs_on_startup; unsigned char station; /* Node or CPE */ unsigned int eek_cfg; /* EEK Request Reply Mode */ unsigned int eek_timer; /* EEK Request Reply Timer */ +#if defined(__WINDOWS__) + unsigned char auto_dlci; /* 1 - yes, 0 - no */ +#endif } wan_fr_conf_t; /* used by wanpipemon to get DLCI status */ @@ -549,7 +627,6 @@ typedef struct wan_lip_fr_dlci unsigned char type; } wan_fr_dlci_t; - typedef struct wan_rtp_conf { unsigned int rtp_ip; @@ -561,31 +638,20 @@ typedef struct wan_rtp_conf unsigned char rtp_local_mac[WAN_IFNAME_SZ+1]; }wan_rtp_conf_t; - typedef struct wan_xilinx_conf { unsigned short dma_per_ch; /* DMA buffers per logic channel */ unsigned short mru; /* MRU of transparent channels */ unsigned int rbs; /* Robbit signalling support */ unsigned int data_mux_map; /* Data mux map */ - //unsigned int tdmv_span_no; - //unsigned int tdmv_dchan; /* hwHDLC: PRI SIG */ - //unsigned char tdmv_hw_dtmf; /* TDMV Enable/Disable HW DTMF */ unsigned int rx_crc_bytes; -// unsigned int ec_clk_src; /* Octasic Clock Source Port */ -// unsigned int ec_persist_disable; /* HW EC Persist */ - - -#if 0 - unsigned int rtp_ip; - unsigned short rtp_port; - unsigned short rtp_sample; - char rtp_devname[WAN_IFNAME_SZ+1]; +#if defined(__WINDOWS__) + unsigned short num_of_ch; /* Number of logical channels */ + unsigned int tdmv_span_no; + unsigned char tdmv_hwec; + unsigned int fe_ref_clock; + unsigned int tdmv_dchan; #endif - unsigned int err_throttle_period; - unsigned int err_throttle_timeout; - - } wan_xilinx_conf_t; typedef struct wan_xilinx_conf_if @@ -601,10 +667,14 @@ typedef struct wan_xilinx_conf_if unsigned char ss7_mode; unsigned char ss7_lssu_size; unsigned char tdmv_master_if; -// unsigned char tdmv_hwec; /* Enable/Disable HW EC */ - unsigned char rbs_cas_idle; /* Initial RBS/CAS value */ -// unsigned char hwec_dtmf; /* Enable/Disable HW DTMF */ +/* unsigned char tdmv_hwec; */ /* Enable/Disable HW EC */ + unsigned char rbs_cas_idle; /* Initial RBS/CAS value */ +/* unsigned char hwec_dtmf; */ /* Enable/Disable HW DTMF */ /* unsigned char tdmv_hwec_map[50];*/ /* Enable/Disable HW EC */ + unsigned char hdlc_repeat; +#if defined(__WINDOWS__) + unsigned char tdmv_hwec; +#endif }wan_xilinx_conf_if_t; @@ -796,7 +866,11 @@ typedef struct sppp_parms_struct { unsigned char ppp_prot; /* CHDLC */ +#if defined(__WINDOWS__) + unsigned int sppp_max_keepalive_count; +#else unsigned int keepalive_err_margin; +#endif }wan_sppp_if_conf_t; @@ -912,6 +986,22 @@ typedef struct wan_hwec_conf_ } wan_hwec_conf_t; +#define MAX_PARAM_LEN 50 +#define MAX_VALUE_LEN 50 +typedef struct wan_custom_param_ +{ + char name[MAX_PARAM_LEN+1]; + char sValue[MAX_VALUE_LEN+1]; + unsigned int dValue; +} wan_custom_param_t; + +typedef struct wan_custom_conf_ +{ + unsigned int param_no; + wan_custom_param_t *params; +} wan_custom_conf_t; + + /*---------------------------------------------------------------------------- * WAN device configuration. Passed to ROUTER_SETUP IOCTL. */ @@ -934,7 +1024,7 @@ typedef struct wandev_conf unsigned udp_port; /* UDP port for management */ unsigned char ttl; /* Time To Live for UDP security */ unsigned char ft1; /* FT1 Configurator Option */ - char interface; /* RS-232/V.35, etc. */ + char electrical_interface; /* RS-232/V.35, etc. */ char clocking; /* external/internal */ char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */ char connection; /* permanent/switched/on-demand */ @@ -951,9 +1041,11 @@ typedef struct wandev_conf /****** arbitrary data ***************/ unsigned data_size; /* data buffer size */ void* data; /* data buffer, e.g. firmware */ - +#if defined(__WINDOWS__) + struct{ +#else union{ /****** protocol-specific ************/ - +#endif wan_x25_conf_t x25; /* X.25 configuration */ wan_ppp_conf_t ppp; /* PPP configuration */ wan_fr_conf_t fr; /* frame relay configuration */ @@ -969,23 +1061,21 @@ typedef struct wandev_conf } u; /* No new variables are allowed above */ - - char card_type; /* Supported Sangoma Card type */ - unsigned pci_bus_no; /* S514 PCI bus number */ + unsigned int card_type; /* Supported Sangoma Card type */ + unsigned int pci_bus_no; /* S514 PCI bus number */ sdla_fe_cfg_t fe_cfg; /* Front end configurations */ - wan_tdmv_conf_t tdmv_conf; - wan_hwec_conf_t hwec_conf; - wan_rtp_conf_t rtp_conf; - + wan_tdmv_conf_t tdmv_conf; + wan_hwec_conf_t hwec_conf; + wan_rtp_conf_t rtp_conf; + wan_custom_conf_t oct_conf; unsigned char line_idle; /* IDLE FLAG/ IDLE MARK */ unsigned char ignore_front_end_status; unsigned int max_trace_queue; unsigned int max_rx_queue; - #if 0 /* Bitstreaming options */ unsigned int sync_options; @@ -998,7 +1088,10 @@ typedef struct wandev_conf unsigned int max_trace_queue; unsigned int max_rx_queue; #endif - + +#if defined(__WINDOWS__) + u16 card_sub_type; /* "S" 5141/5142/5143 or "A" 101/102/104/108/200/056 */ +#endif/* __WINDOWS__ */ } wandev_conf_t; /* 'config_id' definitions */ @@ -1030,15 +1123,17 @@ typedef struct wandev_conf #define WANCONFIG_LAPB 125 /* LIP LAPB Protocol Support */ #define WANCONFIG_XDLC 126 /* LIP XDLC Protocol Support */ #define WANCONFIG_TTY 127 /* LIP TTY Support */ -#define WANCONFIG_AFT_TE1 128 /* AFT Quad Hardware Support */ +#define WANCONFIG_AFT_TE1 128 /* AFT A1/2/4/8 Hardware Support */ #define WANCONFIG_XMTP2 129 /* LIP XMTP2 Protocol Support */ #define WANCONFIG_ASYHDLC 130 /* S514 ASY HDLC API Support */ #define WANCONFIG_LIP_ATM 131 /* ATM in LIP layer */ #define WANCONFIG_AFT_ANALOG 132 /* AFT Analog Driver */ #define WANCONFIG_ZAP 133 /* Used in wanpipemon when working with Zaptel driver */ #define WANCONFIG_LAPD 134 /* LIP LAPD Q921 Protocol Support */ -#define WANCONFIG_LIP_KATM 135 /* Kernel ATM Stack Support */ +#define WANCONFIG_LIP_KATM 135 /* Kernel ATM Stack Support */ #define WANCONFIG_AFT_56K 136 /* AFT 56K Support */ +#define WANCONFIG_AFT_ISDN_BRI 137 /* AFT ISDN BRI Driver */ +#define WANCONFIG_AFT_SERIAL 138 /* AFT Serial V32/RS232 Driver */ /*FIXME: This should be taken out, I just //used it so I don't break the apps that are @@ -1076,7 +1171,12 @@ typedef struct wandev_conf (protocol == WANCONFIG_GENERIC) ? "WANPIPE Generic driver": \ (protocol == WANCONFIG_MPCHDLC) ? "CHDLC": \ (protocol == WANCONFIG_ZAP) ? "ZAP": \ - (protocol == WANCONFIG_TTY) ? "TTY": "Unknown Protocol" + (protocol == WANCONFIG_AFT_56K) ? "AFT 56K": \ + (protocol == WANCONFIG_AFT_ISDN_BRI) ? "ISDN BRI": \ + (protocol == WANCONFIG_AFT_SERIAL) ? "Serial V35/RS232": \ + (protocol == WANCONFIG_AFT_ANALOG) ? "Analog FXO/FXS": \ + (protocol == WANCONFIG_AFT_TE1) ? "AFT A1/2/4/8" : \ + (protocol == WANCONFIG_TTY) ? "TTY" : "Unknown Protocol" typedef struct wan_tdmv_if_conf @@ -1140,7 +1240,12 @@ typedef struct wanif_conf unsigned keepalive_err_margin; /* keepalive_error_tolerance */ unsigned slarp_timer; /* SLARP request timer */ unsigned char ttl; /* Time To Live for UDP security */ +#if defined(__WINDOWS__) + /* 'interface' is reserved for C++ compiler!! */ + char electrical_interface; /* RS-232/V.35, etc. */ +#else char interface; /* RS-232/V.35, etc. */ +#endif char clocking; /* external/internal */ unsigned bps; /* data transfer rate */ unsigned mtu; /* maximum transmit unit size */ @@ -1191,13 +1296,19 @@ typedef struct wanif_conf wan_tdmv_if_conf_t tdmv; wan_hwec_if_conf_t hwec; - //unsigned char tdmv_echo_off; /* TDMV echo disable */ - //unsigned char tdmv_codec; /* TDMV codec */ + wan_custom_conf_t ec_conf; + /*unsigned char tdmv_echo_off; */ /* TDMV echo disable */ + /*unsigned char tdmv_codec; */ /* TDMV codec */ unsigned char single_tx_buf; /* Used in low latency applications */ unsigned char lip_prot; +#if defined(__WINDOWS__) + DEVICE_CONFIGURATION device_cfg; + struct { +#else union { +#endif wan_atm_conf_if_t atm; /* per interface configuration */ wan_x25_if_conf_t x25; wan_lapb_if_conf_t lapb; @@ -1207,7 +1318,11 @@ typedef struct wanif_conf wan_xilinx_conf_if_t aft; wan_xdlc_conf_t xdlc; wan_sppp_if_conf_t ppp; +#if defined(__WINDOWS__) + wan_sppp_if_conf_t chdlc; +#else wan_chdlc_conf_t chdlc; +#endif }u; } wanif_conf_t; @@ -1297,4 +1412,97 @@ enum { WPLIP_LAPD }; +#define TRC_INCOMING_FRM 0x00 +#define TRC_OUTGOING_FRM 0x01 +#pragma pack(1) +typedef struct { + unsigned char status; + unsigned char data_avail; + unsigned short real_length; + unsigned short time_stamp; + unsigned long sec; + unsigned long usec; + unsigned char data[0]; +} wan_trace_pkt_t; +#pragma pack() + +#if defined(__WINDOWS__) + +#define ACU_MTU 2048 +#define MODE_OPTION_HDLC "HDLC" +#define MODE_OPTION_BITSTRM "BitStream" + +#define SDLA_DECODE_USEDBY_FIELD(usedby) \ + (usedby == WANPIPE) ? "WANPIPE" : \ + (usedby == API) ? "API" : \ + (usedby == BRIDGE) ? "BRIDGE" : \ + (usedby == BRIDGE_NODE) ? "BRIDGE_NODE" : \ + (usedby == SWITCH) ? "SWITCH" : \ + (usedby == STACK) ? "STACK" : \ + (usedby == TDM_VOICE_API) ? "TDM VOICE API" : \ + (usedby == TDM_VOICE_DCHAN) ? "TDM VOICE DCHAN" : \ + (usedby == LIB_SANGOMA_API) ? "LIB SANGOMA API" : \ + (usedby == TDM_VOICE_API_V2) ? "TDM VOICE API V2" : \ + (usedby == ANNEXG) ? "ANNEXG" : "Unknown" + +#define CARD_WANOPT_DECODE(cardtype) \ + ((cardtype == WANOPT_S50X) ? "WANOPT_S50X" : \ + (cardtype == WANOPT_S51X) ? "WANOPT_S51X" : \ + (cardtype == WANOPT_ADSL) ? "WANOPT_ADSL" : \ + (cardtype == WANOPT_AFT) ? "WANOPT_AFT": \ + (cardtype == WANOPT_AFT102) ? "WANOPT_AFT102": \ + (cardtype == WANOPT_AFT104) ? "WANOPT_AFT104": \ + (cardtype == WANOPT_AFT108) ? "WANOPT_AFT108": \ + (cardtype == WANOPT_AFT_ANALOG) ? "WANOPT_AFT_ANALOG": \ + (cardtype == WANOPT_AFT_56K) ? "WANOPT_AFT_56K": \ + (cardtype == WANOPT_AFT300) ? "WANOPT_AFT300": "Invalid card") + +#if 1 + +typedef struct _buffer_settings{ + /* Number of received blocks of data before Receive event is indicated to API caller. */ + u16 buffer_multiplier_factor; + + /* Number of buffers for receiving or transmitting data on an API interface. */ + /* EACH buffer will contain 'buffer_multiplier_factor' blocks of data before + Receive event is indicated to API caller. + */ + u16 number_of_buffers_per_api_interface; +}buffer_settings_t; + +#define MIN_BUFFER_MULTIPLIER_FACTOR 1 +#define MAX_BUFFER_MULTIPLIER_FACTOR 7 + +#define MIN_NUMBER_OF_BUFFERS_PER_API_INTERFACE 50 +#define MAX_NUMBER_OF_BUFFERS_PER_API_INTERFACE 100 + +/* structure used with IoctlDriverConfigurationCommand*/ +typedef struct { + unsigned char command_code; + unsigned int return_code; + /* Port configuration */ + wandev_conf_t wandev_conf; + + /* + Per-Interface configuration. + For AFT card maximum NUM_OF_E1_CHANNELS (31) logic channels. + Configuration of each logic channel ('active_ch', HDLC or Transparent...) + */ + wanif_conf_t if_cfg[NUM_OF_E1_CHANNELS]; + + buffer_settings_t buffer_settings; +}driver_cfg_t; +#endif + +#define DRV_MODE_NORMAL 0 +#define DRV_MODE_AFTUP 1 + +/* cpecial id - when driver installed, it is "not configured". +user has to select the protocol.*/ +#define WANCONFIG_NONE 10 +/* special id - for AFT firmware update */ +#define WANCONFIG_AFT_FIRMWARE_UPDATE 11 + +#endif/* __WINDOWS__) */ + #endif diff --git a/patches/kdrivers/include/wanpipe_codec_iface.h b/patches/kdrivers/include/wanpipe_codec_iface.h index 8de17e2..d5d8301 100644 --- a/patches/kdrivers/include/wanpipe_codec_iface.h +++ b/patches/kdrivers/include/wanpipe_codec_iface.h @@ -1,5 +1,5 @@ /************************************************************************** - * wanpipe_codec_iface.c + * wanpipe_codec_iface.h * WANPIPE(tm) Multiprotocol WAN Link Driver. * TDM voice board configuration. * diff --git a/patches/kdrivers/include/wanpipe_common.h b/patches/kdrivers/include/wanpipe_common.h index 9b44e4d..4338af3 100644 --- a/patches/kdrivers/include/wanpipe_common.h +++ b/patches/kdrivers/include/wanpipe_common.h @@ -2,7 +2,7 @@ * Copyright (c) 2002 * Alex Feldman . All rights reserved. * - * $Id: wanpipe_common.h,v 1.175 2007/02/24 00:17:14 sangoma Exp $ + * $Id: wanpipe_common.h,v 1.213 2008/02/21 19:39:18 sangoma Exp $ */ /**************************************************************************** @@ -11,23 +11,26 @@ * Author: Alex Feldman * * ========================================================================== + * Nov 27, 2007 David Rokhvarg Implemented functions/definitions for + * Sangoma MS Windows Driver and API. + * * July 17, 2002 Alex Feldman Initial Version **************************************************************************** */ #ifndef __WANPIPE_COMMON_H -# define __WANPIPE_COMMON_H +# define __WANPIPE_COMMON_H -#ifdef __LINUX__ +#if defined(__LINUX__) # include +#elif defined(__WINDOWS__) +# include +# include +# include #else # include #endif -#ifdef WAN_DEBUG_MEM -extern atomic_t wan_debug_mem; -#endif - /**************************************************************************** ** D E F I N E S ****************************************************************************/ @@ -39,6 +42,8 @@ extern atomic_t wan_debug_mem; ((unsigned char *)&addr)[3] #endif +#define NAME_PLACEHOLDER + #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) # define WAN_LIST_HEAD(name, type) LIST_HEAD(name, type) @@ -95,6 +100,42 @@ extern atomic_t wan_debug_mem; #elif defined(__LINUX__) /* ********* L I N U X *****************/ +# define WAN_LIST_HEAD(name, type) struct name { struct type * lh_first; } +# define WAN_LIST_HEAD_INITIALIZER(head) { NULL } +# define WAN_LIST_ENTRY(type) struct { struct type *le_next; struct type **le_prev; } +# define WAN_LIST_FIRST(head) ((head)->lh_first) +# define WAN_LIST_END(head) NULL +# define WAN_LIST_EMPTY(head) (WAN_LIST_FIRST(head) == WAN_LIST_END(head)) +# define WAN_LIST_NEXT(elm, field) ((elm)->field.le_next) +# define WAN_LIST_FOREACH(var, head, field) for((var) = WAN_LIST_FIRST(head); \ + (var); \ + (var) = WAN_LIST_NEXT(var, field)) +# define WAN_LIST_INIT(head) do { WAN_LIST_FIRST(head) = NULL;}\ + while(0) + +#define WAN_LIST_INSERT_HEAD(head, elm, field) do { \ + if ((WAN_LIST_NEXT((elm), field) = WAN_LIST_FIRST((head))) != NULL) \ + WAN_LIST_FIRST((head))->field.le_prev = &WAN_LIST_NEXT((elm), field);\ + WAN_LIST_FIRST((head)) = (elm); \ + (elm)->field.le_prev = &WAN_LIST_FIRST((head)); \ +} while (0) +#define WAN_LIST_INSERT_AFTER(listelm, elm, field) do { \ + if ((WAN_LIST_NEXT((elm), field) = WAN_LIST_NEXT((listelm), field)) != NULL)\ + WAN_LIST_NEXT((listelm), field)->field.le_prev = \ + &WAN_LIST_NEXT((elm), field); \ + WAN_LIST_NEXT((listelm), field) = (elm); \ + (elm)->field.le_prev = &WAN_LIST_NEXT((listelm), field); \ +} while (0) +#define WAN_LIST_REMOVE(elm, field) do { \ + if (WAN_LIST_NEXT((elm), field) != NULL) \ + WAN_LIST_NEXT((elm), field)->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = WAN_LIST_NEXT((elm), field); \ +} while (0) + +#elif defined(__WINDOWS__) + + # define WAN_LIST_HEAD(name, type) struct name { struct type * lh_first; } # define WAN_LIST_HEAD_INITIALIZER(head) { NULL } # define WAN_LIST_ENTRY(type) struct { struct type *le_next; struct type **le_prev; } @@ -134,186 +175,15 @@ extern atomic_t wan_debug_mem; #if defined(WAN_KERNEL) -#if defined(__FreeBSD__) -# define WAN_TAILQ_FIRST(ifp) TAILQ_FIRST(&ifp->if_addrhead) -# define WAN_TAILQ_NEXT(ifa) TAILQ_NEXT(ifa, ifa_link) -#elif defined (__OpenBSD__) -# define WAN_TAILQ_FIRST(ifp) TAILQ_FIRST(&ifp->if_addrlist) -# define WAN_TAILQ_NEXT(ifa) TAILQ_NEXT(ifa, ifa_list) -#elif defined (__NetBSD__) -# define WAN_TAILQ_FIRST(ifp) TAILQ_FIRST(&ifp->if_addrlist) -# define WAN_TAILQ_NEXT(ifa) TAILQ_NEXT(ifa, ifa_list) -#elif defined(__LINUX__) -#elif defined(__SOLARIS__) -#elif defined(__WINDOWS__) -#else -# error "WAN_TAILQ_x macros doesn't supported yet!" -#endif - -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -# if defined(__FreeBSD__) -# define WAN_PKTATTR_DECL(pktattr) -# else -# define WAN_PKTATTR_DECL(pktattr) struct altq_pktattr pktattr -# endif -# define WAN_IFQ_SET_READY IFQ_SET_READY -# define WAN_IFQ_IS_EMPTY IFQ_IS_EMPTY -# define WAN_IFQ_INC_LEN IFQ_INC_LEN -# define WAN_IFQ_DEC_LEN IFQ_DEC_LEN -# define WAN_IFQ_INC_DROPS IFQ_INC_DROPS -# define WAN_IFQ_SET_MAXLEN IFQ_SET_MAXLEN -# define WAN_IFQ_PURGE IFQ_PURGE -# if (__FreeBSD_version > 503000) -# define WAN_IFQ_ENQUEUE(ifq, m, pattr, err) IFQ_ENQUEUE((ifq),(m),(err)) -# else -# define WAN_IFQ_ENQUEUE IFQ_ENQUEUE -# endif -# define WAN_IFQ_DEQUEUE IFQ_DEQUEUE -# define WAN_IFQ_POLL IFQ_POLL -# define WAN_IFQ_CLASSIFY IFQ_CLASSIFY -# define WAN_IFQ_INIT IFQ_INIT -# define WAN_IFQ_LEN IFQ_LEN -#elif defined(__LINUX__) -# define WAN_IFQ_INIT(ifq, max_pkt) skb_queue_head_init((ifq)) -# define WAN_IFQ_PURGE(ifq) skb_queue_purge((ifq)) -# define WAN_IFQ_ENQUEUE(ifq, skb, arg, err) skb_queue_tail((ifq), (skb)) -# define WAN_IFQ_LEN(ifq) skb_queue_len((ifq)) -#elif defined(__WINDOWS__) -#else -# error "Undefined IFQ_x macros!" -#endif - -#if defined(__FreeBSD__) -# if (__FreeBSD_version < 410000) -# define WAN_TASKLET_INIT(task, priority, func, arg) \ - (task)->running = 0; \ - (task)->task_func = func; (task)->data = arg -# define WAN_TASKLET_SCHEDULE(task) \ - if (!wan_test_bit(0, &(task)->running)){ \ - wan_set_bit(0, &(task)->running); \ - (task)->task_func((task)->data, 0); \ +static __inline void WP_MDELAY (u32 ms) { + /* wait for "milliseconds * 1/1000" of sec */ + for (; ms > 0; --ms){ + WP_DELAY(1000); } -# define __WAN_TASKLET_SCHEDULE(task) WAN_TASKLET_SCHEDULE(task) +} -# define WAN_TASKLET_RUNNING(task) \ - wan_test_bit(0, &(task)->running) - -# define WAN_TASKLET_END(task) wan_clear_bit(0, &(task)->running) -# define WAN_TASKLET_RUNNING(task) \ - wan_test_bit(0, &(task)->running) - -# define WAN_TASKLET_KILL(task) -# else -# define WAN_TASKLET_INIT(task, priority, func, arg) \ - (task)->running = 0; \ - TASK_INIT(&(task)->task_id, priority, func, (void*)arg) -# define WAN_TASKLET_SCHEDULE(task) \ - if (!wan_test_bit(0, &(task)->running)){ \ - wan_set_bit(0, &(task)->running); \ - taskqueue_enqueue(taskqueue_swi, &(task)->task_id); \ - } -# define __WAN_TASKLET_SCHEDULE(task) WAN_TASKLET_SCHEDULE(task) - -# define WAN_TASKLET_RUNNING(task) \ - wan_test_bit(0, &(task)->running) - -/* taskqueue_run(taskqueue_swi); \*/ -# define WAN_TASKLET_END(task) wan_clear_bit(0, &(task)->running) -# define WAN_TASKLET_KILL(task) -# endif -#elif defined(__OpenBSD__) || defined(__NetBSD__) -# define WAN_TASKLET_INIT(task, priority, func, arg) \ - (task)->running = 0; \ - (task)->task_func = func; (task)->data = arg -# define WAN_TASKLET_SCHEDULE(task) \ - if (!wan_test_bit(0, &(task)->running)){ \ - wan_set_bit(0, &(task)->running); \ - (task)->task_func((task)->data, 0); \ - } - -# define __WAN_TASKLET_SCHEDULE(task) WAN_TASKLET_SCHEDULE(task) - -# define WAN_TASKLET_RUNNING(task) \ - wan_test_bit(0, &(task)->running) -# define WAN_TASKLET_END(task) wan_clear_bit(0, &(task)->running) -# define WAN_TASKLET_KILL(task) - - -#elif defined(__LINUX__) - -# define WAN_TASKLET_INIT(task, priority, func, arg) \ - (task)->running = 0; \ - tasklet_init(&(task)->task_id,func,(unsigned long)arg) - -# define WAN_TASKLET_SCHEDULE(task) \ - wan_set_bit(0, &(task)->running); \ - tasklet_schedule(&(task)->task_id); - -#if 0 -# define WAN_WP_TASKLET_SCHEDULE_PER_CPU(task,cpu) \ - wan_set_bit(0, &(task)->running); \ - wp_tasklet_hi_schedule_per_cpu(&(task)->task_id,cpu); -#endif - -# define WAN_TASKLET_RUNNING(task) \ - wan_test_bit(0, &(task)->running) - -# define WAN_TASKLET_END(task) wan_clear_bit(0, &(task)->running) -# define WAN_TASKLET_KILL(task) tasklet_kill(&(task)->task_id) - - -#elif defined(__WINDOWS__) -#else -# error "Undefined WAN_TASKLET_x macro!" -#endif - -#if defined(__FreeBSD__) -# if (__FreeBSD_version < 410000) -# define WAN_TASKQ_INIT(task, priority, func, arg) \ - (task)->tfunc = func; task->data = arg -# else -# define WAN_TASKQ_INIT(task, priority, func, arg) \ - TASK_INIT(&task->tqueue, priority, func, arg) -# endif -#elif defined(__OpenBSD__) -# define WAN_TASKQ_INIT(task, priority, func, arg) \ - (task)->tfunc = func; task->data = arg -#elif defined(__NetBSD__) -# define WAN_TASKQ_INIT(task, priority, func, arg) \ - (task)->tfunc = func; task->data = arg -#elif defined(__LINUX__) -/* Due to 2.6.20 kernel the wan_taskq_t is now a direct - * workqueue struct not an abstracted structure */ -# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -# define WAN_TASKQ_INIT(task, priority, func, arg) \ - INIT_WORK((task),func,arg) -# else -# define WAN_TASKQ_INIT(task, priority, func, arg) \ - INIT_WORK((task),func) -# endif - -#elif defined(__WINDOWS__) -#else -# error "Undefined WAN_TASKQ_INIT macro!" -#endif - -#if defined(__FreeBSD__) && (__FreeBSD_version >= 410000) -# define WAN_IS_TASKQ_SCHEDULE -# define WAN_TASKQ_SCHEDULE(task) \ - taskqueue_enqueue(taskqueue_swi, &task->tqueue);\ - taskqueue_run(taskqueue_swi) -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -# define WAN_IS_TASKQ_SCHEDULE -# define WAN_TASKQ_SCHEDULE(task) \ - task->tfunc(task->data, 0) -#elif defined(__LINUX__) -# define WAN_IS_TASKQ_SCHEDULE -# define WAN_TASKQ_SCHEDULE(task) \ - wan_schedule_task(task) -#elif defined(__WINDOWS__) -#else -# error "Undefined WAN_TASKQ_SCHEDULE macro!" -#endif +#define WAN_STIMEOUT(start, timeout) \ + ((SYSTEM_TICKS - (start)) > ((timeout) * HZ)) #if defined(__LINUX__) # define WAN_COPY_FROM_USER(k,u,l) copy_from_user(k,u,l) @@ -322,6 +192,7 @@ extern atomic_t wan_debug_mem; # define WAN_COPY_FROM_USER(k,u,l) copyin(u,k,l) # define WAN_COPY_TO_USER(u,k,l) copyout(k,u,l) #elif defined(__WINDOWS__) + #else # error "Undefined WAN_COPY_FROM_USER/WAN_COPY_TO_USER macros!" #endif @@ -371,15 +242,15 @@ extern atomic_t wan_debug_mem; # define WAN_NET_RATELIMIT net_ratelimit #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -# define WAN_NETIF_QUEUE_STOPPED(dev) (dev)->if_flags & IFF_DRV_OACTIVE -# define WAN_NETIF_WAKE_QUEUE(dev) (dev)->if_flags &= ~IFF_DRV_OACTIVE +# define WAN_NETIF_QUEUE_STOPPED(dev) ((dev)->if_drv_flags & IFF_DRV_OACTIVE) +# define WAN_NETIF_WAKE_QUEUE(dev) ((dev)->if_drv_flags &= ~IFF_DRV_OACTIVE) #if 0 # define WAN_NETIF_STOP_QUEUE(dev) # define WAN_NETIF_START_QUEUE(dev) #endif -# define WAN_NETIF_STOP_QUEUE(dev) (dev)->if_flags |= IFF_DRV_OACTIVE -# define WAN_NETIF_START_QUEUE(dev) (dev)->if_flags &= ~IFF_DRV_OACTIVE -# define WAN_NETIF_RUNNING(dev) 1 +# define WAN_NETIF_STOP_QUEUE(dev) (dev)->if_drv_flags |= IFF_DRV_OACTIVE +# define WAN_NETIF_START_QUEUE(dev) (dev)->if_drv_flags &= ~IFF_DRV_OACTIVE +# define WAN_NETIF_RUNNING(dev) ((dev)->if_drv_flags&IFF_DRV_RUNNING) # define WAN_NETIF_UP(dev) ((dev)->if_flags&IFF_UP) # define WAN_NETDEVICE_STOP(dev) # define WAN_NETDEVICE_START(dev) @@ -393,41 +264,147 @@ extern atomic_t wan_debug_mem; # define WAN_NETIF_CARRIER_OK(dev) 1 #elif defined(__WINDOWS__) +# define WAN_NET_RATELIMIT() 1 +# define WAN_NETIF_QUEUE_STOPPED(dev) test_bit(0,&dev->tbusy) +# define WAN_NETIF_UP(dev) ((dev)->flags&IFF_UP) +# define WAN_NETIF_WAKE_QUEUE(dev) netif_wake_queue(dev) +# define WAN_NETIF_START_QUEUE(dev) netif_wake_queue(dev) +# define WAN_NETIF_CARRIER_OFF(dev) FUNC_NOT_IMPL +# define WAN_NETIF_STOP_QUEUE(dev) FUNC_NOT_IMPL +# define WAN_IFQ_LEN(ifqueue) skb_queue_len(ifqueue) + #else # error "Undefined WAN_NETIF_x macros!" #endif +/* Update Network Interface statistics */ +#if defined(__LINUX__) + +# define WAN_NETIF_STATS_INC_RX_PACKETS(common) (common)->if_stats.rx_packets++ +# define WAN_NETIF_STATS_INC_TX_PACKETS(common) (common)->if_stats.tx_packets++ +# define WAN_NETIF_STATS_RX_PACKETS(common) ((common)->if_stats.rx_packets) +# define WAN_NETIF_STATS_TX_PACKETS(common) ((common)->if_stats.tx_packets) +# define WAN_NETIF_STATS_INC_RX_BYTES(common,len) (common)->if_stats.rx_bytes+=(len) +# define WAN_NETIF_STATS_INC_TX_BYTES(common,len) (common)->if_stats.tx_bytes+=(len) +# define WAN_NETIF_STATS_INC_RX_ERRORS(common) (common)->if_stats.rx_errors++ +# define WAN_NETIF_STATS_INC_TX_ERRORS(common) (common)->if_stats.tx_errors++ +# define WAN_NETIF_STATS_INC_RX_DROPPED(common) (common)->if_stats.rx_dropped++ +# define WAN_NETIF_STATS_RX_DROPPED(common) (common)->if_stats.rx_dropped +# define WAN_NETIF_STATS_INC_TX_DROPPED(common) (common)->if_stats.tx_dropped++ +# define WAN_NETIF_STATS_INC_MULTICAST(common) (common)->if_stats.multicast++ +# define WAN_NETIF_STATS_INC_COLLISIONS(common) (common)->if_stats.collisions++ +# define WAN_NETIF_STATS_INC_RX_LENGTH_ERRORS(common) (common)->if_stats.rx_length_errors++ +# define WAN_NETIF_STATS_INC_RX_OVER_ERRORS(common) (common)->if_stats.rx_over_errors++ +# define WAN_NETIF_STATS_INC_RX_CRC_ERRORS(common) (common)->if_stats.rx_crc_errors++ +# define WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(common) (common)->if_stats.rx_frame_errors++ +# define WAN_NETIF_STATS_INC_RX_FIFO_ERRORS(common) (common)->if_stats.rx_fifo_errors++ +# define WAN_NETIF_STATS_INC_RX_MISSED_ERRORS(common) (common)->if_stats.rx_missed_errors++ +# define WAN_NETIF_STATS_INC_TX_ABORTED_ERRORS(common) (common)->if_stats.tx_aborted_errors++ +# define WAN_NETIF_STATS_INC_TX_CARRIER_ERRORS(common) (common)->if_stats.tx_carrier_errors++ +# define WAN_NETIF_STATS_TX_CARRIER_ERRORS(common) (common)->if_stats.tx_carrier_errors +# define WAN_NETIF_STATS_INC_TX_FIFO_ERRORS(common) (common)->if_stats.tx_fifo_errors++ +# define WAN_NETIF_STATS_INC_TX_HEARTBEAT_ERRORS(common) (common)->if_stats.tx_heartbeat_errors++ +# define WAN_NETIF_STATS_INC_TX_WINDOW_ERRORS(common) (common)->if_stats.tx_window_errors++ +# define WAN_NETIF_STATS_INC_RX_COMPRESSED(common) (common)->if_stats.rx_compressed++ +# define WAN_NETIF_STATS_INC_TX_COMPRESSED(common) (common)->if_stats.tx_compressed++ + +#elif defined(__FreeBSD__) || defined(__OpenBSD__) + +# define WAN_NETIF_STATS_INC_RX_PACKETS(common) if ((common)->dev) (common)->dev->if_ipackets++ +# define WAN_NETIF_STATS_INC_TX_PACKETS(common) if ((common)->dev) (common)->dev->if_opackets++ +# define WAN_NETIF_STATS_RX_PACKETS(common) ((common)->dev) ? (common)->dev->if_ipackets : 0 +# define WAN_NETIF_STATS_TX_PACKETS(common) ((common)->dev) ? (common)->dev->if_opackets : 0 +# define WAN_NETIF_STATS_INC_RX_BYTES(common,len) if ((common)->dev) (common)->dev->if_ibytes+=(len) +# define WAN_NETIF_STATS_INC_TX_BYTES(common,len) if ((common)->dev) (common)->dev->if_obytes+=(len) +# define WAN_NETIF_STATS_INC_RX_ERRORS(common) if ((common)->dev) (common)->dev->if_ierrors++ +# define WAN_NETIF_STATS_INC_TX_ERRORS(common) if ((common)->dev) (common)->dev->if_oerrors++ +# define WAN_NETIF_STATS_INC_RX_DROPPED(common) if ((common)->dev) (common)->dev->if_iqdrops++ +# define WAN_NETIF_STATS_RX_DROPPED(common) if ((common)->dev) (common)->dev->if_iqdrops +# define WAN_NETIF_STATS_INC_TX_DROPPED(common) +# define WAN_NETIF_STATS_INC_MULTICAST(common) if ((common)->dev) (common)->dev->if_omcasts++ +# define WAN_NETIF_STATS_INC_COLLISIONS(common) if ((common)->dev) (common)->dev->if_collisions++ +# define WAN_NETIF_STATS_INC_RX_LENGTH_ERRORS(common) if ((common)->dev) (common)->dev->if_ierrors++ +# define WAN_NETIF_STATS_INC_RX_OVER_ERRORS(common) if ((common)->dev) (common)->dev->if_ierrors++ +# define WAN_NETIF_STATS_INC_RX_CRC_ERRORS(common) if ((common)->dev) (common)->dev->if_ierrors++ +# define WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(common) if ((common)->dev) (common)->dev->if_ierrors++ +# define WAN_NETIF_STATS_INC_RX_FIFO_ERRORS(common) if ((common)->dev) (common)->dev->if_ierrors++ +# define WAN_NETIF_STATS_INC_RX_MISSED_ERRORS(common) if ((common)->dev) (common)->dev->if_ierrors++ +# define WAN_NETIF_STATS_INC_TX_ABORTED_ERRORS(common) if ((common)->dev) (common)->dev->if_oerrors++ +# define WAN_NETIF_STATS_INC_TX_CARRIER_ERRORS(common) if ((common)->dev) (common)->dev->if_oerrors++ +# define WAN_NETIF_STATS_TX_CARRIER_ERRORS(common) if ((common)->dev) (common)->dev->if_oerrors +# define WAN_NETIF_STATS_INC_TX_FIFO_ERRORS(common) if ((common)->dev) (common)->dev->if_oerrors++ +# define WAN_NETIF_STATS_INC_TX_HEARTBEAT_ERRORS(common) if ((common)->dev) (common)->dev->if_oerrors++ +# define WAN_NETIF_STATS_INC_TX_WINDOW_ERRORS(common) if ((common)->dev) (common)->dev->if_oerrors++ +# define WAN_NETIF_STATS_INC_RX_COMPRESSED(common) +# define WAN_NETIF_STATS_INC_TX_COMPRESSED(common) + +#elif defined(__WINDOWS__) + +# define WAN_NETIF_STATS_INC_RX_PACKETS(common) (common)->if_stats.rx_packets++ +# define WAN_NETIF_STATS_INC_TX_PACKETS(common) (common)->if_stats.tx_packets++ +# define WAN_NETIF_STATS_RX_PACKETS(common) ((common)->if_stats.rx_packets) +# define WAN_NETIF_STATS_TX_PACKETS(common) ((common)->if_stats.tx_packets) +# define WAN_NETIF_STATS_INC_RX_BYTES(common,len) (common)->if_stats.rx_bytes+=(len) +# define WAN_NETIF_STATS_INC_TX_BYTES(common,len) (common)->if_stats.tx_bytes+=(len) +# define WAN_NETIF_STATS_INC_RX_ERRORS(common) (common)->if_stats.rx_errors++ +# define WAN_NETIF_STATS_INC_TX_ERRORS(common) (common)->if_stats.tx_errors++ +# define WAN_NETIF_STATS_INC_RX_DROPPED(common) (common)->if_stats.rx_dropped++ +# define WAN_NETIF_STATS_RX_DROPPED(common) (common)->if_stats.rx_dropped +# define WAN_NETIF_STATS_INC_TX_DROPPED(common) (common)->if_stats.tx_dropped++ +# define WAN_NETIF_STATS_INC_MULTICAST(common) (common)->if_stats.multicast++ +# define WAN_NETIF_STATS_INC_COLLISIONS(common) (common)->if_stats.collisions++ +# define WAN_NETIF_STATS_INC_RX_LENGTH_ERRORS(common) (common)->if_stats.rx_length_errors++ +# define WAN_NETIF_STATS_INC_RX_OVER_ERRORS(common) (common)->if_stats.rx_over_errors++ +# define WAN_NETIF_STATS_INC_RX_CRC_ERRORS(common) (common)->if_stats.rx_crc_errors++ +# define WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(common) (common)->if_stats.rx_frame_errors++ +# define WAN_NETIF_STATS_INC_RX_FIFO_ERRORS(common) (common)->if_stats.rx_fifo_errors++ +# define WAN_NETIF_STATS_INC_RX_MISSED_ERRORS(common) (common)->if_stats.rx_missed_errors++ +# define WAN_NETIF_STATS_INC_TX_ABORTED_ERRORS(common) (common)->if_stats.tx_aborted_errors++ +# define WAN_NETIF_STATS_INC_TX_CARRIER_ERRORS(common) (common)->if_stats.tx_carrier_errors++ +# define WAN_NETIF_STATS_TX_CARRIER_ERRORS(common) (common)->if_stats.tx_carrier_errors +# define WAN_NETIF_STATS_INC_TX_FIFO_ERRORS(common) (common)->if_stats.tx_fifo_errors++ +# define WAN_NETIF_STATS_INC_TX_HEARTBEAT_ERRORS(common) (common)->if_stats.tx_heartbeat_errors++ +# define WAN_NETIF_STATS_INC_TX_WINDOW_ERRORS(common) (common)->if_stats.tx_window_errors++ +# define WAN_NETIF_STATS_INC_RX_COMPRESSED(common) (common)->if_stats.rx_compressed++ +# define WAN_NETIF_STATS_INC_TX_COMPRESSED(common) (common)->if_stats.tx_compressed++ + +#else + +# error "Undefined WAN_NETIF_STATSx macro!" +# define WAN_NETIF_STATS_INC_RXPACKETS(common) +# define WAN_NETIF_STATS_INC_TXPACKETS(common) +# define WAN_NETIF_STATS_INC_RXBYTES(common) +# define WAN_NETIF_STATS_INC_TXBYTES(common) +# define WAN_NETIF_STATS_INC_RXERRORS(common) +# define WAN_NETIF_STATS_INC_TXERRORS(common) +# define WAN_NETIF_STATS_INC_RXDROPPED(common) +# define WAN_NETIF_STATS_INC_TXDROPPED(common) +# define WAN_NETIF_STATS_INC_MULTICAST(common) +# define WAN_NETIF_STATS_INC_COLLISIONS(common) +# define WAN_NETIF_STATS_INC_RXLENGTHERRORS(common) +# define WAN_NETIF_STATS_INC_RXOVERERRORS(common) +# define WAN_NETIF_STATS_INC_RXCRCERRORS(common) +# define WAN_NETIF_STATS_INC_RXFRAMESERRORS(common) +# define WAN_NETIF_STATS_INC_RXFIFOERRORS(common) +# define WAN_NETIF_STATS_INC_RXMISSEDERRORS(common) + +# define WAN_NETIF_STATS_INC_TXABORTEDERRORS(common) +# define WAN_NETIF_STATS_INC_TXCARRIERERRORS(common) +# define WAN_NETIF_STATS_INC_TXFIFOERRORS(common) +# define WAN_NETIF_STATS_INC_TXHEARTBEATERRORS(common) +# define WAN_NETIF_STATS_INC_TXWINDOWERRORS(common) + +# define WAN_NETIF_STATS_INC_RXCOMPRESSED(common) +# define WAN_NETIF_STATS_INC_TXCOMPRESSED(common) +#endif + #if defined(__LINUX__) # define WAN_BPF_DIR_IN (1<<0) # define WAN_BPF_DIR_OUT (1<<1) # define WAN_BPF_REPORT(dev,m) #elif defined(__FreeBSD__) -# define WAN_BPF_DIR_IN (1<<0) -# define WAN_BPF_DIR_OUT (1<<1) -# if (__FreeBSD_version > 500000) -# define WAN_BPF_REPORT(dev,m,d) bpf_mtap((dev)->if_bpf, (m)) -# else -# define WAN_BPF_REPORT(dev,m,d) bpf_mtap((dev), (m)) -# endif #elif defined(__OpenBSD__) -# if (OpenBSD < 200611) -# define WAN_BPF_DIR_IN (1<<0) -# define WAN_BPF_DIR_OUT (1<<1) -# define WAN_BPF_REPORT(dev,m,d) bpf_mtap((dev)->if_bpf, (m)); -# else -# define WAN_BPF_DIR_IN BPF_DIRECTION_IN -# define WAN_BPF_DIR_OUT BPF_DIRECTION_OUT -# define WAN_BPF_REPORT(dev,m,d) \ - if (dir == WAN_BPF_DIR_IN){ \ - bpf_mtap((dev)->if_bpf, (m), BPF_DIRECTION_IN); \ - }else{ \ - bpf_mtap((dev)->if_bpf, (m), BPF_DIRECTION_OUT); \ - } -# endif #elif defined(__NetBSD__) -# define WAN_BPF_DIR_IN (1<<0) -# define WAN_BPF_DIR_OUT (1<<1) -# define WAN_BPF_REPORT(dev,m,d) bpf_mtap((dev)->if_bpf, (m)); #elif defined(__WINDOWS__) #else # error "Undefined WAN_BPF_REPORT macro!" @@ -461,6 +438,12 @@ extern atomic_t wan_debug_mem; } # define WAN_HOLD(str) str->refcnt++ #elif defined(__WINDOWS__) + +# define WAN_DEV_PUT(dev) wan_atomic_dec(&(dev)->refcnt) +# define WAN_DEV_HOLD(dev) wan_atomic_inc(&(dev)->refcnt) +# define __WAN_PUT(str) wan_atomic_dec(&(str)->refcnt) + +# define WAN_HOLD(str) wan_atomic_inc(&(str)->refcnt) #else # warning "Undefined WAN_HOLD/WAN_PUT macro!" #endif @@ -512,6 +495,15 @@ typedef char *va_list; #define WAN_VA_END(ap) (void) 0 #endif +/* String library definitions */ +#if defined(__LINUX__) +# define strncasecmp strnicmp +#elif defined(__WINDOWS__) +# define strlcpy strncpy +# define strncasecmp _strnicmp +# define snprintf _snprintf +# define vsnprintf _vsnprintf +#endif /**************************************************************************** ** T Y P E D E F S @@ -578,7 +570,25 @@ void wanpipe_debugging (void* data, int pending); #else void wanpipe_debugging (unsigned long data); #endif -static __inline int wan_skb_tailroom(void* skb); + + + + + +/**************************************************************************** +** MEMORY DEBUG F U N C T I O N S +****************************************************************************/ + +#ifdef WAN_DEBUG_MEM + +int sdla_memdbg_push(void *mem, char *func_name, int line, int len); +int sdla_memdbg_pull(void *mem, char *func_name, int line); + +#endif + + + + /**************************************************************************** ** I N L I N E F U N C T I O N S @@ -587,50 +597,60 @@ static __inline int wan_skb_tailroom(void* skb); /* ** wan_malloc - */ + +#ifdef WAN_DEBUG_MEM + +#define wan_malloc(size) __wan_malloc(size,(char*)__FUNCTION__,(int)__LINE__) +static __inline void* __wan_malloc(int size, char *func_name, int line) +#else static __inline void* wan_malloc(int size) +#endif { void* ptr = NULL; #if defined(__LINUX__) ptr = kmalloc(size, GFP_ATOMIC); - if (ptr){ - DEBUG_ADD_MEM(size); - } #elif defined(__SOLARIS__) ptr=kmem_alloc(size,KM_NOSLEEP); #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) ptr = malloc(size, M_DEVBUF, M_NOWAIT); #elif defined(__WINDOWS__) - ptr = ExAllocatePool(NonPagedPool, size); + ptr = kmalloc(size); #else # error "wan_malloc() function is not supported yet!" #endif if (ptr){ memset(ptr, 0, size); - DEBUG_ADD_MEM(size); +#ifdef WAN_DEBUG_MEM + sdla_memdbg_push(ptr, func_name, line, size); +#endif } return ptr; } +#ifdef WAN_DEBUG_MEM +#define wan_kmalloc(size) __wan_kmalloc(size,(char*)__FUNCTION__,(int)__LINE__) +static __inline void* __wan_kmalloc(int size, char *func_name, int line) +#else static __inline void* wan_kmalloc(int size) +#endif { void* ptr = NULL; #if defined(__LINUX__) ptr = kmalloc(size, GFP_KERNEL); - if (ptr){ - DEBUG_ADD_MEM(size); - } #elif defined(__SOLARIS__) ptr=kmem_alloc(size,KM_NOSLEEP); #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) ptr = malloc(size, M_DEVBUF, M_NOWAIT); #elif defined(__WINDOWS__) - ptr = ExAllocatePool(NonPagedPool, size); + ptr = kmalloc(size); #else # error "wan_malloc() function is not supported yet!" #endif if (ptr){ memset(ptr, 0, size); - DEBUG_ADD_MEM(size); +#ifdef WAN_DEBUG_MEM + sdla_memdbg_push(ptr, func_name, line, size); +#endif } return ptr; } @@ -638,13 +658,22 @@ static __inline void* wan_kmalloc(int size) /* ** wan_free - */ +#ifdef WAN_DEBUG_MEM +#define wan_free(ptr) __wan_free(ptr,(char*)__FUNCTION__,(int)__LINE__) +static __inline void __wan_free(void* ptr, char *func_name, int line) +#else static __inline void wan_free(void* ptr) +#endif { if (!ptr){ DEBUG_EVENT("wan_free: NULL PTR !!!!!\n"); return; } +#ifdef WAN_DEBUG_MEM + sdla_memdbg_pull(ptr, func_name, line); +#endif + #if defined(__LINUX__) kfree(ptr); #elif defined(__SOLARIS__) @@ -653,25 +682,28 @@ static __inline void wan_free(void* ptr) #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) return free(ptr, M_DEVBUF); #elif defined(__WINDOWS__) - ExFreePool(ptr); + kfree(ptr); #else # error "wan_free() function is not supported yet!" #endif } + +#ifdef WAN_DEBUG_MEM +#define wan_vmalloc(size) __wan_vmalloc(size,(char*)__FUNCTION__,(int)__LINE__) +static __inline void* __wan_vmalloc(int size, char *func_name, int line) +#else static __inline void* wan_vmalloc(int size) +#endif { void* ptr = NULL; #if defined(__LINUX__) ptr = vmalloc(size); - if (ptr){ - DEBUG_ADD_MEM(size); - } #elif defined(__FreeBSD__) ptr = (caddr_t)kmem_alloc(kernel_map, size + sizeof(vm_size_t)); if (ptr){ vm_size_t *ptr1 = (vm_size_t*)ptr; - bzero(ptr, size); + bzero(ptr, size + sizeof(vm_size_t)); *ptr1 = size + sizeof(vm_size_t); ptr = ptr1++; } @@ -685,12 +717,15 @@ static __inline void* wan_vmalloc(int size) } #elif defined(__SOLARIS__) #elif defined(__WINDOWS__) + ptr = kmalloc(size); #else # error "wan_vmalloc() function is not supported yet!" #endif if (ptr){ memset(ptr, 0, size); - DEBUG_ADD_MEM(size); +#ifdef WAN_DEBUG_MEM + sdla_memdbg_push(ptr, func_name, line, size); +#endif } return ptr; } @@ -698,12 +733,25 @@ static __inline void* wan_vmalloc(int size) /* ** wan_vfree - */ + + +#ifdef WAN_DEBUG_MEM +#define wan_vfree(ptr) __wan_vfree(ptr,(char*)__FUNCTION__,(int)__LINE__) +static __inline void __wan_vfree(void* ptr, char *func_name, int line) +#else static __inline void wan_vfree(void* ptr) +#endif + { if (!ptr){ DEBUG_EVENT("wan_vfree: NULL PTR !!!!!\n"); return; } + +#ifdef WAN_DEBUG_MEM + sdla_memdbg_pull(ptr, func_name, line); +#endif + #if defined(__LINUX__) vfree(ptr); #elif defined(__FreeBSD__) @@ -720,6 +768,7 @@ static __inline void wan_vfree(void* ptr) } #elif defined(__SOLARIS__) #elif defined(__WINDOWS__) + kfree(ptr); #else # error "wan_free() function is not supported yet!" #endif @@ -740,6 +789,8 @@ static __inline unsigned long wan_virt2bus(unsigned long* ptr) #elif defined(__OpenBSD__) || defined(__NetBSD__) return vtophys((vaddr_t)ptr); #elif defined(__WINDOWS__) + FUNC_NOT_IMPL + return 0; #else # error "wan_virt2bus() function is not supported yet!" #endif @@ -755,6 +806,8 @@ static __inline unsigned long* wan_bus2virt(unsigned long virt_addr) #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) return (unsigned long*)virt_addr; #elif defined(__WINDOWS__) + FUNC_NOT_IMPL + return 0; #else # error "wan_bus2virt() function is not supported yet!" #endif @@ -767,7 +820,7 @@ static __inline unsigned long* wan_bus2virt(unsigned long virt_addr) ** wan_dma_alloc */ static __inline int -wan_dma_alloc(void* hw, wan_dma_descr_t* dma_descr) +wan_dma_alloc_org(void* hw, wan_dma_descr_org_t* dma_descr) { int err = 0; #if defined(__FreeBSD__) @@ -842,6 +895,7 @@ wan_dma_alloc(void* hw, wan_dma_descr_t* dma_descr) err = -ENOMEM; } #elif defined(__WINDOWS__) + FUNC_NOT_IMPL return -EINVAL; #else # error "wan_dma_alloc() function is not supported yet!" @@ -853,7 +907,7 @@ wan_dma_alloc(void* hw, wan_dma_descr_t* dma_descr) ** wan_dma_free */ static __inline int -wan_dma_free(void* hw, wan_dma_descr_t* dma_descr) +wan_dma_free_org(void* hw, wan_dma_descr_org_t* dma_descr) { #if defined(__FreeBSD__) bus_dmamem_free(dma_descr->dmat, dma_descr->vAddr, dma_descr->dmamap); @@ -872,6 +926,7 @@ wan_dma_free(void* hw, wan_dma_descr_t* dma_descr) dma_descr->vAddr = NULL; dma_descr->pAddr = 0; #elif defined(__WINDOWS__) + FUNC_NOT_IMPL return -EINVAL; #else # error "wan_dma_free() function is not supported yet!" @@ -879,12 +934,12 @@ wan_dma_free(void* hw, wan_dma_descr_t* dma_descr) return 0; } -static __inline unsigned long* wan_dma_get_vaddr(void* card, wan_dma_descr_t* dma) +static __inline unsigned long* wan_dma_get_vaddr(void* card, wan_dma_descr_org_t* dma) { return dma->vAddr; } -static __inline unsigned long wan_dma_get_paddr(void* card, wan_dma_descr_t* dma) +static __inline unsigned long wan_dma_get_paddr(void* card, wan_dma_descr_org_t* dma) { return wan_virt2bus(dma->vAddr); } @@ -904,17 +959,18 @@ static __inline int wan_getcurrenttime(unsigned long *sec, unsigned long *usec) if (sec) *sec = tv.tv_sec; if (usec) *usec = tv.tv_usec; return 0; -#elif defined(__WINDOWS__) - LARGE_INTEGER tv; - NdisGetCurrentSystemTime(&tv); - if (sec) *sec = (unsigned long)tv.QuadPart; - return 0; #elif defined(__LINUX__) struct timeval tv; do_gettimeofday(&tv); if (sec) *sec = tv.tv_sec; if (usec) *usec = tv.tv_usec; return 0; +#elif defined(__WINDOWS__) + struct timeval tv; + do_gettimeofday(&tv); + if (sec) *sec = tv.tv_sec; + if (usec) *usec = tv.tv_usec; + return 0; #else # error "wan_getcurrenttime() function is not supported yet!" #endif @@ -944,6 +1000,12 @@ wan_init_timer(wan_timer_t* wan_timer, wan_timer_func_t timer_func, wan_timer_ar wan_timer->timer_func = timer_func; wan_timer->timer_arg = arg; #elif defined(__WINDOWS__) + wan_timer->timer_func = timer_func; + wan_timer->timer_arg = arg; + KeInitializeDpc(&wan_timer->timer_info.TimerDpcObject, + wan_timer->timer_func, + wan_timer->timer_arg); + KeInitializeTimer(&wan_timer->timer_info.Timer); #else # error "wan_init_timer() function is not supported yet!" #endif /* linux */ @@ -974,6 +1036,8 @@ wan_del_timer(wan_timer_t* wan_timer) timeout_del(&wan_timer->timer_info); #elif defined(__NetBSD__) callout_stop(&wan_timer->timer_info); +#elif defined(__WINDOWS__) + KeCancelTimer(&wan_timer->timer_info.Timer); #else # error "wan_del_timer() function is not supported yet!" #endif /* linux */ @@ -1002,7 +1066,7 @@ wan_add_timer(wan_timer_t* wan_timer, unsigned long delay) timeout(wan_timer->timer_func, (void*)wan_timer->timer_arg, delay); - WAN_ASSERT1(wan_timer->timer_info.callout == NULL); + WAN_ASSERT(wan_timer->timer_info.callout == NULL); #elif defined(__OpenBSD__) timeout_add(&wan_timer->timer_info, delay); #elif defined(__NetBSD__) @@ -1011,6 +1075,19 @@ wan_add_timer(wan_timer_t* wan_timer, unsigned long delay) delay, wan_timer->timer_func, wan_timer->timer_arg); +#elif defined(__WINDOWS__) + LARGE_INTEGER large_int_delay; + + if(0)DEBUG_TIMER("%s(): delay: %u\n", __FUNCTION__, delay); + + /* The 'delay' is in milliseconds + RtlConvertLongToLargeInteger(-10000000L * 1) - this is 1 second. + Converted to milliseconds: + */ + large_int_delay = RtlConvertLongToLargeInteger(-10000L * delay); + + KeSetTimer(&wan_timer->timer_info.Timer, large_int_delay, + &wan_timer->timer_info.TimerDpcObject); #else # error "wan_add_timer() function is not supported yet!" #endif /* linux */ @@ -1030,6 +1107,8 @@ static __inline unsigned char* wan_skb_data(void* skb) return mtod((struct mbuf*)skb, caddr_t); #elif defined(__SOLARIS__) return ((netskb_t*)mp)->b_rptr; +#elif defined(__WINDOWS__) + return dev_skb_data(skb); #else # error "wan_skb_data() function is not supported yet!" #endif @@ -1042,11 +1121,13 @@ static __inline unsigned char* wan_skb_data(void* skb) static __inline unsigned char* wan_skb_tail(void* skb) { #if defined(__LINUX__) - return wan_skb_tail_pointer((struct sk_buff*)skb); + return __wan_skb_tail_pointer(skb); #elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) return mtod((struct mbuf*)skb, caddr_t) + ((struct mbuf*)skb)->m_len; #elif defined(__SOLARIS__) return ((netskb_t*)mp)->b_wptr; +#elif defined(__WINDOWS__) + return dev_skb_tail(skb); #else # error "wan_skb_tail() function is not supported yet!" #endif @@ -1066,6 +1147,8 @@ static __inline void wan_skb_append(void* skbprev, void *skb, void *list) # endif #elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) m_cat (skbprev, skb); +#elif defined(__WINDOWS__) + skb_append(skbprev,skb); #else # error "wan_skb_append() function is not supported yet!" #endif @@ -1091,6 +1174,8 @@ static __inline int wan_skb_len(void* skb) tmp = tmp->b_cont; } return len; +#elif defined(__WINDOWS__) + return dev_skb_len(skb); #else # error "wan_skb_len() function is not supported yet!" #endif @@ -1098,19 +1183,29 @@ static __inline int wan_skb_len(void* skb) /* ** wan_skb_free() - -** Free kernel memory buffer. +** Free kernel memory buffer. */ + +#ifdef WAN_DEBUG_MEM +#define wan_skb_free(ptr) __wan_skb_free(ptr,(char*)__FUNCTION__,(int)__LINE__) +static __inline void __wan_skb_free(void* skb, char *func_name, int line) +#else static __inline void wan_skb_free(void* skb) -{ -#if defined(__LINUX__) -#if defined(WAN_DEBUG_MEM) - DEBUG_SUB_MEM(((struct sk_buff*)skb)->truesize); #endif +{ + +#if defined(WAN_DEBUG_MEM) + sdla_memdbg_pull(skb, func_name, line); +#endif + +#if defined(__LINUX__) dev_kfree_skb_any(skb); #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) m_freem(skb); #elif defined(__SOLARIS__) freemsg(skb); +#elif defined(__WINDOWS__) + dev_kfree_skb_any(skb); #else # error "wan_skb_free() function is not supported yet!" #endif @@ -1162,43 +1257,57 @@ static __inline int wan_skb_mark(void* pskb) ** wan_skb_alloc() - ** Allocate kernel buffer with len. */ +#if defined(WAN_DEBUG_MEM) +#define wan_skb_alloc(size) __wan_skb_alloc(size,(char*)__FUNCTION__,(int)__LINE__) +static __inline void* __wan_skb_alloc(unsigned int len, char *func_name, int line) +#else static __inline void* wan_skb_alloc(unsigned int len) +#endif { #if defined(__LINUX__) #if defined(WAN_DEBUG_MEM) struct sk_buff *skb=dev_alloc_skb(len); if (skb){ - DEBUG_ADD_MEM(skb->truesize); + sdla_memdbg_push(skb, func_name,line,skb->truesize); } return (void*)skb; #else return (void*)dev_alloc_skb(len); #endif #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - struct mbuf *new = NULL; + struct mbuf *nm = NULL; - if (len){ - MGETHDR(new, M_DONTWAIT, MT_DATA); - }else{ - MGET(new, M_DONTWAIT, MT_DATA); +# if 1 + nm = m_getcl(M_DONTWAIT,MT_DATA,M_PKTHDR); + if (nm != NULL){ + nm->m_data += 16; + wan_skb_set_mark(nm); } - if (new){ - if (new->m_flags & M_PKTHDR){ - new->m_pkthdr.len = 0; + return nm; +# else + int s = splimp(); + MGETHDR(nm, M_DONTWAIT, MT_DATA); + if (nm){ + if (nm->m_flags & M_PKTHDR){ + nm->m_pkthdr.len = 0; } - new->m_len = 0; - MCLGET(new, M_DONTWAIT); - if ((new->m_flags & M_EXT) == 0){ - wan_skb_free(new); + nm->m_len = 0; + MCLGET(nm, M_DONTWAIT); + if ((nm->m_flags & M_EXT) == 0){ + wan_skb_free(nm); + splx(s); return NULL; } /* Always reserve extra 16 bytes (as Linux) ** for the header */ - new->m_data += 16; - wan_skb_set_mark(new); - return (void*)new; + nm->m_data += 16; + wan_skb_set_mark(nm); + splx(s); + return (void*)nm; } + splx(s); return NULL; +# endif #elif defined (__SOLARIS__) mblk_t *mp=allocb(ROUNDUP(len+16, IOC_LINESIZE), BPRI_MED); if (mp){ @@ -1206,48 +1315,65 @@ static __inline void* wan_skb_alloc(unsigned int len) mp->b_rptr=(uchar_t *)ptr+16; } return mp; +#elif defined(__WINDOWS__) + return (void*)dev_alloc_skb(len); #else # error "wan_skb_alloc() function is not supported yet!" #endif } + +#if defined(WAN_DEBUG_MEM) +#define wan_skb_kalloc(size) __wan_skb_kalloc(size,(char*)__FUNCTION__,(int)__LINE__) +static __inline void* __wan_skb_kalloc(unsigned int len, char *func_name, int line) +#else static __inline void* wan_skb_kalloc(unsigned int len) +#endif { #if defined(__LINUX__) #if defined(WAN_DEBUG_MEM) struct sk_buff *skb=__dev_alloc_skb(len,GFP_KERNEL); if (skb){ - DEBUG_ADD_MEM(skb->truesize); + sdla_memdbg_push(skb, func_name,line,skb->truesize); } return (void*)skb; #else return (void*)__dev_alloc_skb(len,GFP_KERNEL); #endif #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - struct mbuf *new = NULL; + struct mbuf *nm = NULL; - if (len){ - MGETHDR(new, M_DONTWAIT, MT_DATA); - }else{ - MGET(new, M_DONTWAIT, MT_DATA); +# if 1 + nm = m_getcl(M_DONTWAIT,MT_DATA,M_PKTHDR); + if (nm != NULL){ + nm->m_data += 16; + wan_skb_set_mark(nm); } - if (new){ - if (new->m_flags & M_PKTHDR){ - new->m_pkthdr.len = 0; + return nm; +# else + int s = splimp(); + MGETHDR(nm, M_DONTWAIT, MT_DATA); + if (nm){ + if (nm->m_flags & M_PKTHDR){ + nm->m_pkthdr.len = 0; } - new->m_len = 0; - MCLGET(new, M_DONTWAIT); - if ((new->m_flags & M_EXT) == 0){ - wan_skb_free(new); + nm->m_len = 0; + MCLGET(nm, M_DONTWAIT); + if ((nm->m_flags & M_EXT) == 0){ + wan_skb_free(nm); + splx(s); return NULL; } /* Always reserve extra 16 bytes (as Linux) ** for the header */ - new->m_data += 16; - wan_skb_set_mark(new); - return (void*)new; + nm->m_data += 16; + wan_skb_set_mark(nm); + splx(s); + return (void*)nm; } + splx(s); return NULL; +# endif #elif defined (__SOLARIS__) mblk_t *mp=allocb(ROUNDUP(len+16, IOC_LINESIZE), BPRI_MED); if (mp){ @@ -1255,6 +1381,8 @@ static __inline void* wan_skb_kalloc(unsigned int len) mp->b_rptr=(uchar_t *)ptr+16; } return mp; +#elif defined(__WINDOWS__) + return (void*)dev_alloc_skb(len); #else # error "wan_skb_kalloc() function is not supported yet!" #endif @@ -1274,9 +1402,13 @@ static __inline void wan_skb_set_dev(void* pskb, void* dev) } #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) netskb_t* m = (netskb_t*)pskb; + WAN_SKBCRITASSERT(m); if (m){ m->m_pkthdr.rcvif = dev; } +#elif defined(__WINDOWS__) + struct sk_buff *skb = (struct sk_buff*)pskb; + skb->dev = dev; #else # error "wan_skb_set_dev() function is not supported yet!" #endif @@ -1292,10 +1424,14 @@ static __inline void wan_skb_set_protocol(void* pskb, unsigned int protocol) #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) struct mbuf *mbuf = (struct mbuf*)pskb; if (protocol == ETH_P_IPX){ - mbuf->m_flags |= M_PROTO1; + mbuf->m_flags |= WAN_MFLAG_IPX; } +#elif defined(__WINDOWS__) + struct sk_buff *skb = (struct sk_buff*)pskb; + /* RtlUshortByteSwap converts a USHORT from + little-endian to big-endian, and vice versa. */ + skb->protocol = RtlUshortByteSwap(protocol); #else - # warning "wan_skb_set_protocol() function is not supported yet!" #endif } @@ -1305,16 +1441,48 @@ static __inline void wan_skb_set_raw(void* pskb) #if defined(__LINUX__) struct sk_buff *skb = (struct sk_buff*)pskb; if (skb){ - wan_skb_reset_mac_header(skb); - wan_skb_reset_network_header(skb); + __wan_skb_reset_mac_header(skb); + __wan_skb_reset_network_header(skb); } #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +#elif defined(__WINDOWS__) + struct sk_buff *skb = (struct sk_buff*)pskb; + /* skb->mac.raw = skb->data; */ + FUNC_NOT_IMPL #else # warning "wan_skb_set_raw() function is not supported yet!" #endif } +static __inline void wan_skb_reset_mac_header(void* pskb) +{ +#if defined(__LINUX__) + struct sk_buff *skb = (struct sk_buff*)pskb; + if (skb){ + __wan_skb_reset_mac_header(skb); + } +#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL +#else +# warning "wan_skb_reset_mac_hdr() function is not supported yet!" +#endif +} +static __inline void wan_skb_reset_network_header(void* pskb) +{ +#if defined(__LINUX__) + struct sk_buff *skb = (struct sk_buff*)pskb; + if (skb){ + __wan_skb_reset_network_header(skb); + } +#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL +#else +# warning "wan_skb_reset_network_hdr() function is not supported yet!" +#endif +} /* ** wan_skb_set_csum() - @@ -1338,9 +1506,13 @@ static __inline void wan_skb_set_csum(void* skb, unsigned int csum) } #elif defined(__NetBSD__) || defined(__FreeBSD__) netskb_t* m = (netskb_t*)skb; + WAN_SKBCRITASSERT(m); if (m){ m->m_pkthdr.csum_data = csum; } +#elif defined(__WINDOWS__) + struct sk_buff *sk = (struct sk_buff*)skb; + sk->csum = csum; #else # error "wan_skb_set_csum() function is not supported yet!" #endif @@ -1357,6 +1529,7 @@ static __inline unsigned int wan_skb_csum(void* skb) return (sk) ? sk->csum : 0; #elif defined(__NetBSD__) || defined(__FreeBSD__) netskb_t* m = (netskb_t*)skb; + WAN_SKBCRITASSERT(m); return (m) ? m->m_pkthdr.csum_data : 0; #elif defined(__OpenBSD__) netskb_t* m = (netskb_t*)skb; @@ -1365,8 +1538,11 @@ static __inline unsigned int wan_skb_csum(void* skb) # else return (m) ? m->m_pkthdr.csum : 0; # endif +#elif defined(__WINDOWS__) + struct sk_buff *sk = (struct sk_buff*)skb; + return sk->csum; #else -# error "wan_skb_set_dev() function is not supported yet!" +# error "wan_skb_csum() function is not supported yet!" #endif } @@ -1380,10 +1556,13 @@ static __inline int wan_skb_check(void* skb) return 0; #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) netskb_t* m = (netskb_t*)skb; + WAN_SKBCRITASSERT(m); if (m->m_pkthdr.len != m->m_len){ return 1; } return 0; +#elif defined(__WINDOWS__) + return 0; #else # error "wan_skb_check() function is not supported yet!" #endif @@ -1401,6 +1580,8 @@ static __inline void wan_skb_reserve(void* skb, unsigned int len) struct mbuf *m = (struct mbuf*)skb; m->m_data += len; +#elif defined(__WINDOWS__) + skb_reserve(skb, len); #else # error "wan_skb_free() function is not supported yet!" #endif @@ -1418,9 +1599,11 @@ static __inline void wan_skb_copyback(void* skb, int off, int len, caddr_t cp) struct sk_buff* sk = (struct sk_buff*)skb; unsigned char* data = NULL; if (off == wan_skb_len(skb)){ - if (wan_skb_tail_pointer(sk) + len > wan_skb_end_pointer(sk)){ - DEBUG_EVENT("wan_skb_copyback: Internal Error (off=%d,len=%d,skb_len=%d)!\n", - off, len, wan_skb_len(skb)); + if (sk->tail + len > sk->end){ + DEBUG_EVENT( + "%s:%d: Internal Error (off=%d,len=%d,skb_len=%d)!\n", + __FUNCTION__,__LINE__, + off, len, wan_skb_len(skb)); return; }else{ data = skb_put(skb, len); @@ -1433,13 +1616,48 @@ static __inline void wan_skb_copyback(void* skb, int off, int len, caddr_t cp) skb_trim(skb, off + len); } } -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +#elif defined(__FreeBSD__) + struct mbuf* m = (struct mbuf*)skb; + caddr_t data = mtod(m, caddr_t); + + WAN_SKBCRITASSERT(m); + if (off + len > m->m_ext.ext_size){ + panic("%s:%d: Buffer is too small (%d:%d;%d)!", + __FUNCTION__,__LINE__, + off,len,m->m_ext.ext_size); + return; + } + bcopy(cp, &data[off], len); + m->m_len = off + len; + m->m_pkthdr.len = off + len; +#elif defined(__OpenBSD__) || defined(__NetBSD__) struct mbuf* m = (struct mbuf*)skb; caddr_t data = mtod(m, caddr_t); bcopy(cp, &data[off], len); m->m_len = off + len; m->m_pkthdr.len = off + len; +#elif defined(__WINDOWS__) + struct sk_buff* sk = (struct sk_buff*)skb; + unsigned char* data = NULL; + if (off == wan_skb_len(skb)){ + if (sk->tail + len > sk->end){ + DEBUG_EVENT( + "%s:%d: Internal Error (off=%d,len=%d,skb_len=%d)!\n", + __FUNCTION__,__LINE__, + off, len, wan_skb_len(skb)); + return; + }else{ + data = skb_put(skb, len); + memcpy(data, cp, len); + } + }else{ + if (off + len > wan_skb_len(skb)){ + data = skb_put(skb, len); + memcpy(data + off, cp, len); + skb_trim(skb, off + len); + } + } #else # error "wan_skb_copyback() function is not supported yet!" #endif @@ -1459,14 +1677,18 @@ static __inline int wan_skb_copyback_user(void* skb, int off, int len, caddr_t c struct sk_buff* sk = (struct sk_buff*)skb; unsigned char* data = NULL; if (off == wan_skb_len(skb)){ - if (wan_skb_tail_pointer(sk) + len > wan_skb_end_pointer(sk)){ - DEBUG_EVENT("wan_skb_copyback_user: Internal Error (off=%d,len=%d,skb_len=%d)!\n", + if (__wan_skb_tail_pointer(sk) + len > sk->end){ + DEBUG_EVENT( + "%s:%d: Internal Error (off=%d,len=%d,skb_len=%d)!\n", + __FUNCTION__,__LINE__, off, len, wan_skb_len(skb)); return -EINVAL; }else{ data = skb_put(skb, len); if (WAN_COPY_FROM_USER(data, cp, len)){ - DEBUG_EVENT("wan_skb_copyback_user: Internal Error (off=%d,len=%d,skb_len=%d)!\n", + DEBUG_EVENT( + "%s:%d: Internal Error (off=%d,len=%d,skb_len=%d)!\n", + __FUNCTION__,__LINE__, off, len, wan_skb_len(skb)); return -EFAULT; } @@ -1475,7 +1697,9 @@ static __inline int wan_skb_copyback_user(void* skb, int off, int len, caddr_t c if (off + len > wan_skb_len(skb)){ data = skb_put(skb, len); if (WAN_COPY_FROM_USER(data+off, cp, len)){ - DEBUG_EVENT("wan_skb_copyback_user: Internal Error (off=%d,len=%d,skb_len=%d)!\n", + DEBUG_EVENT( + "%s:%d: Internal Error (off=%d,len=%d,skb_len=%d)!\n", + __FUNCTION__,__LINE__, off, len, wan_skb_len(skb)); return -EFAULT; } @@ -1487,9 +1711,17 @@ static __inline int wan_skb_copyback_user(void* skb, int off, int len, caddr_t c struct mbuf* m = (struct mbuf*)skb; caddr_t data = mtod(m, caddr_t); + WAN_SKBCRITASSERT(m); + if (off + len > m->m_ext.ext_size){ + panic("%s:%d: Buffer is too small (%d:%d:%d)!\n", + __FUNCTION__,__LINE__, off,len,m->m_ext.ext_size); + return 0; + } WAN_COPY_FROM_USER(cp, &data[off], len); m->m_len = off + len; m->m_pkthdr.len = off + len; +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL #else # error "wan_skb_copyback_user() function is not supported yet!" #endif @@ -1506,15 +1738,21 @@ static __inline void wan_skb_copydata(void* skb, int off, int len, caddr_t cp) { #if defined(__LINUX__) if (off + len > wan_skb_len(skb)){ - DEBUG_EVENT("wan_skb_copydata: Internal error (off=%d, len=%d, skb_len=%d)!\n", + DEBUG_EVENT( + "%s:%d: Internal error (off=%d, len=%d, skb_len=%d)!\n", + __FUNCTION__,__LINE__, off, len, wan_skb_len(skb)); return; } memcpy(cp, wan_skb_data(skb), len); #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +# if (__FreeBSD_version >= 502000) + m_copydata(skb, off, len, cp); +# else caddr_t data = mtod((struct mbuf*)skb, caddr_t); bcopy(cp, &data[off], len); +# endif #elif defined(__SOLARIS__) mblk_t* tmp = (mblk_t*)skb; unsigned char* ptr = NULL; @@ -1526,6 +1764,15 @@ static __inline void wan_skb_copydata(void* skb, int off, int len, caddr_t cp) i += num; tmp = tmp->b_cont; } +#elif defined(__WINDOWS__) + if (off + len > wan_skb_len(skb)){ + DEBUG_EVENT( + "%s:%d: Internal error (off=%d, len=%d, skb_len=%d)!\n", + __FUNCTION__,__LINE__, + off, len, wan_skb_len(skb)); + return; + } + memcpy(cp, wan_skb_data(skb), len); #else # error "wan_skb_copydata() function is not supported yet!" #endif @@ -1540,6 +1787,8 @@ static __inline void * wan_skb_copy(void *skb) return skb_copy(skb,GFP_ATOMIC); #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) return m_copym(skb, 0, wan_skb_len(skb), M_DONTWAIT); +#elif defined(__WINDOWS__) + return skb_copy(skb,GFP_ATOMIC); #else # error "wan_skb_copy() function is not supported yet" #endif @@ -1555,6 +1804,8 @@ static __inline void * wan_skb_clone(void *skb) return skb_clone(skb,GFP_ATOMIC); #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) return m_copym(skb, 0, wan_skb_len(skb), M_DONTWAIT); +#elif defined(__WINDOWS__) + return skb_clone(skb,GFP_ATOMIC); #else # error "wan_skb_clone() function is not supported yet" #endif @@ -1562,9 +1813,6 @@ static __inline void * wan_skb_clone(void *skb) } - - - /* ** wan_skb2buffer() - ** Correct skb block. @@ -1575,23 +1823,29 @@ static __inline int wan_skb2buffer(void** skb) return 0; #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) netskb_t *m = (netskb_t*)(*skb); - netskb_t *new = NULL; + netskb_t *nm = NULL; + int s; - new = wan_skb_alloc(0); - if (new){ + s = splnet(); + nm = wan_skb_alloc(1); + if (nm){ struct mbuf *tmp = m; - char *buffer = new->m_data; + char *buffer = nm->m_data; for( ; tmp; tmp = tmp->m_next) { bcopy(mtod(tmp, caddr_t), buffer, tmp->m_len); buffer += tmp->m_len; - new->m_len += tmp->m_len; + nm->m_len += tmp->m_len; } wan_skb_free(m); - *skb = new; + *skb = nm; + splx(s); return 0; } + splx(s); return -EINVAL; +#elif defined(__WINDOWS__) + return 0; #else # error "wan_skb_correct() function is not supported yet!" #endif @@ -1606,6 +1860,15 @@ static __inline unsigned char* wan_skb_pull(void* skb, int len) #if defined(__LINUX__) return skb_pull((struct sk_buff*)skb, len); #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) + struct mbuf *m = (struct mbuf*)skb; + + WAN_SKBCRITASSERT(m); + if (len > m->m_ext.ext_size){ + panic("%s:%d: Buffer is too small (%d:%d)!\n", + __FUNCTION__,__LINE__, + len,m->m_ext.ext_size); + return NULL; + } m_adj(skb, len); #if 0 struct mbuf* m = (struct mbuf*)skb; @@ -1614,6 +1877,8 @@ static __inline unsigned char* wan_skb_pull(void* skb, int len) m->m_len = m->m_pkthdr.len; #endif return wan_skb_data(skb); +#elif defined(__WINDOWS__) + return skb_pull((struct sk_buff*)skb, len); #else # error "wan_skb_pull() function is not supported yet!" #endif @@ -1632,6 +1897,14 @@ static __inline unsigned char* wan_skb_put(void* skb, int len) int org_len = wan_skb_len(skb); unsigned char* data = wan_skb_data(skb); + WAN_SKBCRITASSERT(m); + if (org_len + len > m->m_ext.ext_size){ + panic("%s:%d: Buffer is too small (%d:%d:%d)!\n", + __FUNCTION__,__LINE__, + org_len,len,m->m_ext.ext_size); + return NULL; + } + m->m_len = org_len + len; m->m_pkthdr.len = org_len + len; /*Alex Sep27,2004 last tail but not data pointer return wan_skb_data(skb);*/ @@ -1641,6 +1914,8 @@ static __inline unsigned char* wan_skb_put(void* skb, int len) unsigned char *wptr=mp->b_wptr; mp->b_wptr += len; return mp->b_wptr; +#elif defined(__WINDOWS__) + return skb_put((struct sk_buff*)skb, len); #else # error "wan_skb_put() function is not supported yet!" #endif @@ -1658,29 +1933,34 @@ static __inline unsigned char* wan_skb_push(void* skb, int len) struct mbuf *m = (struct mbuf*)skb; int org_len = wan_skb_len(skb); + WAN_SKBCRITASSERT(m); if (m->m_flags & M_EXT){ if ((m->m_data - len) < m->m_ext.ext_buf){ - DEBUG_EVENT("Can't push %d bytes!\n", len); - return wan_skb_data(skb); + panic("%s:%d: Can't push %d bytes (%p:%p)!\n", + __FUNCTION__,__LINE__, + len,m->m_data,m->m_ext.ext_buf); + return NULL; } }else{ if ((m->m_data - len) < m->m_pktdat){ - DEBUG_EVENT("Can't push %d bytes!\n", len); - return wan_skb_data(skb); + panic("%s:%d: Can't push %d bytes (%p:%p)!\n", + __FUNCTION__,__LINE__, + len,m->m_data,m->m_pktdat); + return NULL; } } m->m_data -= len; m->m_len = org_len + len; m->m_pkthdr.len = org_len + len; return wan_skb_data(skb); +#elif defined(__WINDOWS__) + return skb_push((struct sk_buff*)skb, len); #else # error "wan_skb_push() function is not supported yet!" #endif } - - /* ** wan_skb_tailroom() - Tail room ** @@ -1693,10 +1973,13 @@ static __inline int wan_skb_tailroom(void* skb) #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) struct mbuf* m = (struct mbuf*)skb; + WAN_SKBCRITASSERT(m); if (m->m_flags & M_EXT){ - return (MCLBYTES - m->m_len); + return (m->m_ext.ext_size/*MCLBYTES*/ - m->m_len); } return (MHLEN - m->m_len); +#elif defined(__WINDOWS__) + return skb_tailroom(skb); #else # error "wan_skb_tailroom() function is not supported yet!" #endif @@ -1714,10 +1997,13 @@ static __inline int wan_skb_headroom(void* skb) #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) struct mbuf* m = (struct mbuf*)skb; + WAN_SKBCRITASSERT(m); if (m->m_flags & M_EXT){ return (m->m_data - m->m_ext.ext_buf); } return (m->m_data - m->m_pktdat); +#elif defined(__WINDOWS__) + return skb_headroom(skb); #else # error "wan_skb_headroom() function is not supported yet!" #endif @@ -1736,14 +2022,12 @@ static __inline void wan_skb_trim(void* skb, unsigned int len) skb_trim(skb, len); #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) struct mbuf* m = (struct mbuf*)skb; -#if 0 - /* Trim only moves tail to head+len (Oct13) */ - if (len == 0){ - m->m_data = m->m_ext.ext_buf; - } -#endif + + WAN_SKBCRITASSERT(m); m->m_pkthdr.len = len; m->m_len = m->m_pkthdr.len; +#elif defined(__WINDOWS__) + skb_trim(skb, len); #else # error "wan_skb_trim() function is not supported yet!" #endif @@ -1759,12 +2043,27 @@ static __inline void wan_skb_init(void* pskb, unsigned int len) #if defined(__LINUX__) struct sk_buff* skb = (struct sk_buff*)pskb; skb->data = skb->head + len; - wan_skb_reset_tail_pointer(skb); + __wan_skb_reset_tail_pointer(skb); skb->len = 0; skb->data_len = 0; + #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) struct mbuf* m = (struct mbuf*)pskb; - m->m_data = m->m_ext.ext_buf + len; + + WAN_SKBCRITASSERT(m); + if (m->m_ext.ext_buf == NULL){ + panic("wan_skb_init: Invalid mbuf ext_buf pointer!\n"); + return; + } + m->m_data = m->m_ext.ext_buf + len; + m->m_pkthdr.len = 0; //was len + m->m_len = 0; //was len +#elif defined(__WINDOWS__) + struct sk_buff* skb = (struct sk_buff*)pskb; + skb->data = skb->head + len; + skb->tail = skb->data; + skb->len = 0; + skb->data_len = 0; #else # error "wan_skb_init() function is not supported yet!" #endif @@ -1788,17 +2087,25 @@ static __inline int wan_skb_print(void* skb) int len = m->m_pkthdr.len, i; unsigned char *data = wan_skb_data(skb); - if (m->m_type & M_PKTHDR) - DEBUG_EVENT("M_PKTHDR flag set (%d)!\n", - m->m_pkthdr.len); - if (m->m_type & M_EXT) - DEBUG_EVENT("M_EXT flag set (%d)!\n", - m->m_pkthdr.len); DEBUG_EVENT("Packet %d bytes: ", len); - for(i=0;im_type & M_PKTHDR) + DEBUG_EVENT("M_PKTHDR flag set (%d)!\n", + m->m_pkthdr.len); + if (m->m_type & M_EXT) + DEBUG_EVENT("M_EXT flag set (%d)!\n", + m->m_pkthdr.len); + data = mtod(m, unsigned char*); + len = wan_skb_len(m); + DEBUG_EVENT("mbuf chain %d bytes: ", len); + for(i=0;im_next; + } +#elif defined(__WINDOWS__) + dev_print_skb(skb); #endif return 0; } @@ -1826,6 +2133,8 @@ static __inline void wan_skb_unlink(void* pskb) skb_unlink((struct sk_buff*)pskb); # endif #elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL #else # error "wan_skb_unlink() function is not supported yet!" #endif @@ -1842,6 +2151,8 @@ static __inline void wan_skb_queue_init(void *list) skb_queue_head_init(list); #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) WAN_IFQ_INIT((wan_skb_queue_t*)list, IFQ_MAXLEN); +#elif defined(__WINDOWS__) + skb_queue_head_init(list); #else # error "wan_skb_queue_init() function is not supported yet!" #endif @@ -1861,6 +2172,8 @@ static __inline void wan_skb_queue_purge(void *list) } #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) WAN_IFQ_PURGE(((wan_skb_queue_t*)list)); +#elif defined(__WINDOWS__) + skb_queue_purge(list); #else # error "wan_skb_queue_purge() function is not supported yet!" #endif @@ -1876,6 +2189,8 @@ static __inline void wan_skb_queue_tail(void* list, void* newsk) skb_queue_tail(list, newsk); #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) IF_ENQUEUE((wan_skb_queue_t*)list, (struct mbuf*)newsk); +#elif defined(__WINDOWS__) + skb_queue_tail(list, newsk); #else # error "wan_skb_queue_tail() function is not supported yet!" #endif @@ -1891,6 +2206,8 @@ static __inline void wan_skb_queue_head(void* list, void* newsk) skb_queue_head(list, newsk); #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) IF_PREPEND((wan_skb_queue_t*)list, (struct mbuf*)newsk); +#elif defined(__WINDOWS__) + skb_queue_head(list, newsk); #endif } @@ -1906,6 +2223,8 @@ static __inline int wan_skb_queue_len(void* list) #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) wan_skb_queue_t* ifqueue = (wan_skb_queue_t*)list; return WAN_IFQ_LEN(ifqueue); +#elif defined(__WINDOWS__) + return skb_queue_len(list); #else # error "wan_skb_queue_len() function is not supported yet!" #endif @@ -1923,8 +2242,10 @@ static __inline void *wan_skb_dequeue(void* list) #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) netskb_t* newsk = NULL; - IF_DEQUEUE((wan_skb_queue_t*)list, newsk); + IFQ_DEQUEUE((wan_skb_queue_t*)list, newsk); return (void*)newsk; +#elif defined(__WINDOWS__) + return skb_dequeue(list); #else # error "wan_skb_dequeue() function is not supported yet!" #endif @@ -1987,6 +2308,8 @@ static __inline int wan_netif_init(netdevice_t* dev, char* ifname) # else strcpy(dev->name, ifname); # endif +#elif defined(__WINDOWS__) + strncpy(dev->name, ifname, IFNAMSIZ); #else # error "wan_netif_init() function is not supported yet!" #endif @@ -2008,6 +2331,8 @@ static __inline int wan_netif_del(netdevice_t* dev) /* Do nothing */ #elif defined(__LINUX__) /* Do nothing */ +#elif defined(__WINDOWS__) + /* Do nothing */ #else # error "wan_netif_del() function is not supported yet!" #endif @@ -2018,7 +2343,6 @@ static __inline int wan_netif_del(netdevice_t* dev) #if defined(__LINUX__) static __inline void wan_netif_fake_init(netdevice_t *d) { - #ifdef LINUX_FEAT_2624 d->header_ops = NULL; #else @@ -2119,6 +2443,18 @@ wan_netif_alloc(unsigned char *devname, int ifType, int *err) } } return ifp; +#elif defined(__WINDOWS__) + netdevice_t *dev=wan_malloc(sizeof(netdevice_t)); + *err=0; + + if (!dev){ + *err=-ENOMEM; + return NULL; + } + memset(dev, 0, sizeof(netdevice_t)); + + strncpy(dev->name,devname,IFNAMSIZ); + return dev; #else # error "wan_netif_alloc() unsupported" #endif @@ -2143,6 +2479,8 @@ static __inline void wan_netif_free(netdevice_t *dev) #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) wan_netif_del(dev); IFFREE(dev); /*wan_free(dev);*/ +#elif defined(__WINDOWS__) + wan_free(dev); #else #error "wan_netif_free() not supported!" #endif @@ -2164,6 +2502,8 @@ static __inline char* wan_netif_name(netdevice_t* dev) # endif #elif defined(__OpenBSD__) || defined(__NetBSD__) sprintf(ifname, "%s", dev->if_xname); +#elif defined(__WINDOWS__) + strcpy(ifname, dev->name); #else # error "wan_get_ifname() function is not supported yet!" #endif @@ -2177,6 +2517,8 @@ static __inline void* wan_netif_priv(netdevice_t* dev) return dev->priv; #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) return dev->if_softc; +#elif defined(__WINDOWS__) + return dev->priv; #else # error "wan_netif_priv() function is not supported yet!" #endif @@ -2189,6 +2531,8 @@ static __inline int wan_netif_up(netdevice_t* dev) return WAN_NETIF_UP(dev); #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) return WAN_NETIF_UP(dev); +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL #else # error "wan_netif_up() function is not supported yet!" #endif @@ -2202,6 +2546,8 @@ static __inline void wan_netif_set_priv(netdevice_t* dev, void* priv) dev->priv = priv; #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) dev->if_softc = priv; +#elif defined(__WINDOWS__) + dev->priv = priv; #else # error "wan_netif_priv() function is not supported yet!" #endif @@ -2215,6 +2561,8 @@ static __inline short wan_netif_flags(netdevice_t* dev) return dev->flags; #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) return dev->if_flags; +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL #else # error "wan_netif_flags() function is not supported yet!" #endif @@ -2228,6 +2576,8 @@ static __inline int wan_netif_mcount(netdevice_t* dev) return dev->if_amcount; #elif defined(__OpenBSD__) || defined(__NetBSD__) return 0; +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL #else # error "wan_netif_mcount() function is not supported yet!" #endif @@ -2238,6 +2588,8 @@ static __inline int wan_netif_set_ticks(netdevice_t* dev, unsigned long ticks) #if defined(__LINUX__) dev->trans_start = ticks; #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +#elif defined(__WINDOWS__) + dev->trans_start = ticks; #else # error "wan_netif_set_ticks() function is not supported yet!" #endif @@ -2249,6 +2601,8 @@ static __inline int wan_netif_set_mtu(netdevice_t* dev, unsigned long mtu) #if defined(__LINUX__) #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) dev->if_mtu = mtu; +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL #else # error "wan_netif_set_mtu() function is not supported yet!" #endif @@ -2264,7 +2618,7 @@ wan_bpf_report(netdevice_t* dev, void* pkt, int flag, int dir) /* Do nothing */ #elif defined(__FreeBSD__) if (dev->if_bpf != NULL){ /* BF-0002 */ - WAN_BPF_REPORT(dev, pkt); + WAN_BPF_REPORT(dev, pkt, dir); } #elif defined(__OpenBSD__) || defined(__NetBSD__) if (dev->if_bpf != NULL){ /* BF-0002 */ @@ -2279,6 +2633,9 @@ wan_bpf_report(netdevice_t* dev, void* pkt, int flag, int dir) WAN_BPF_REPORT(dev, pkt, dir); } } +#elif defined(__WINDOWS__) + /* Do nothing */ + FUNC_NOT_IMPL #else # error "wan_bpf_report() function is not supported yet!" #endif @@ -2288,12 +2645,35 @@ wan_bpf_report(netdevice_t* dev, void* pkt, int flag, int dir) -static __inline void wan_spin_lock_init(void *lock) +static __inline void wan_spin_lock_init(void *lock, char *name) { #if defined(__LINUX__) spin_lock_init(((spinlock_t*)lock)); #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) /*(*(wan_smp_flag_t*)flag) = 0;*/ +#if defined(SPINLOCK_OLD) +#else + mtx_init((struct mtx*)lock, name, MTX_NETWORK_LOCK, MTX_DEF); +#endif +#elif defined(__WINDOWS__) + spin_lock_init((wan_spinlock_t*)lock); +#else +# warning "wan_spin_lock_init() function is not supported yet!" +#endif +} + +static __inline void wan_spin_lock_irq_init(void *lock, char *name) +{ +#if defined(__LINUX__) + spin_lock_init(((spinlock_t*)lock)); +#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) + /*(*(wan_smp_flag_t*)flag) = 0;*/ +#if defined(SPINLOCK_OLD) +#else + mtx_init((struct mtx*)lock, name, MTX_NETWORK_LOCK, MTX_SPIN); +#endif +#elif defined(__WINDOWS__) + spin_lock_init((wan_spinlock_t*)lock); #else # warning "wan_spin_lock_init() function is not supported yet!" #endif @@ -2302,15 +2682,21 @@ static __inline void wan_spin_lock_init(void *lock) static __inline int wan_spin_is_locked(void *lock) { #if defined(__LINUX__) - return spin_is_locked((spinlock_t*)lock); + return spin_is_locked(((spinlock_t*)lock)); #elif defined(__NetBSD__) || defined(__OpenBSD__) return 0;/*((*(wan_smp_flag_t*)flag) & imask[IPL_NET]);*/ #elif defined(__FreeBSD__) # if (__FreeBSD_version > 500000) +# if defined(SPINLOCK_OLD) return 0; +# else + return mtx_owned((struct mtx*)lock); +# endif # else return 0;/*((*(wan_smp_flag_t*)flag) & net_imask);*/ # endif +#elif defined(__WINDOWS__) + return 0;/* always returns 'unlocked' */ #else # warning "wan_spin_is_lock() function is not supported yet!" #endif @@ -2323,7 +2709,16 @@ static __inline void wan_spin_lock_irq(void *lock, wan_smp_flag_t *flag) #elif defined(__FreeBSD__) /* Feb 10, 2005 Change splnet to splimp ** (i think it was cause to system crash) */ - *flag = splimp(); +#if defined(SPINLOCK_OLD) + *flag = splhigh(); /*splimp();*/ +#else + if (!mtx_initialized((struct mtx*)lock)){ + DEBUG_EVENT( + "INTERNAL ERROR: Spin Lock IRQ is no initialized!\n"); + return; + } + mtx_lock_spin((struct mtx*)lock); +#endif #elif defined(__OpenBSD__) *flag = splnet(); #elif defined(__NetBSD__) @@ -2332,6 +2727,8 @@ static __inline void wan_spin_lock_irq(void *lock, wan_smp_flag_t *flag) # else *flag = splimp(); # endif +#elif defined(__WINDOWS__) + spin_lock_irqsave((wan_spinlock_t*)lock); #else # warning "wan_spin_lock_irq() function is not supported yet!" #endif @@ -2339,14 +2736,45 @@ static __inline void wan_spin_lock_irq(void *lock, wan_smp_flag_t *flag) static __inline void wan_spin_unlock_irq(void *lock, wan_smp_flag_t *flag) { #if defined(__LINUX__) - spin_unlock_irqrestore(((spinlock_t*)lock),*flag); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) + spin_unlock_irqrestore((spinlock_t*)lock,*flag); +#elif defined(__FreeBSD__) +#if defined(SPINLOCK_OLD) splx(*flag); +#else + if (!mtx_initialized((struct mtx*)lock)){ + DEBUG_EVENT( + "INTERNAL ERROR: Spin Lock IRQ is no initialized!\n"); + return; + } + mtx_unlock_spin((struct mtx*)lock); +#endif +#elif defined(__OpenBSD__) || defined(__NetBSD__) + splx(*flag); +#elif defined(__WINDOWS__) + spin_unlock_irqrestore((wan_spinlock_t*)lock); #else # warning "wan_spin_unlock_irq() function is not supported yet!" #endif } +static __inline int wan_spin_trylock(void *lock) +{ +#if defined(__LINUX__) + return spin_trylock(((spinlock_t*)lock)); +#elif defined(__FreeBSD__) + return mtx_trylock((struct mtx*)lock); +#elif defined(__OpenBSD__) + #warning "FIXME: Complete this code.!!!!!!!!!!!" +#elif defined(__NetBSD__) + #warning "FIXME: Complete this code.!!!!!!!!!!!" +#elif defined(__WINDOWS__) + return spin_trylock((wan_spinlock_t*)lock); +#else +# warning "wan_spin_trylock() function is not supported yet!" +#endif + return 0; +} + static __inline void wan_spin_lock(void *lock) { #if defined(__LINUX__) @@ -2354,7 +2782,16 @@ static __inline void wan_spin_lock(void *lock) #elif defined(__FreeBSD__) /* Feb 10, 2005 Change splnet to splimp ** (i think it was cause to system crash) */ +#if defined(SPINLOCK_OLD) *((wan_spinlock_t*)lock) = splimp(); +#else + if (!mtx_initialized((struct mtx*)lock)){ + DEBUG_EVENT( + "INTERNAL ERROR: Spin Lock IRQ is no initialized!\n"); + return; + } + mtx_lock((struct mtx*)lock); +#endif #elif defined(__OpenBSD__) *((wan_spinlock_t*)lock) = splnet(); #elif defined(__NetBSD__) @@ -2363,6 +2800,8 @@ static __inline void wan_spin_lock(void *lock) # else *((wan_spinlock_t*)lock) = splimp(); # endif +#elif defined(__WINDOWS__) + spin_lock((wan_spinlock_t*)lock); #else # warning "wan_spin_lock() function is not supported yet!" #endif @@ -2371,8 +2810,21 @@ static __inline void wan_spin_unlock(void *lock) { #if defined(__LINUX__) spin_unlock(((spinlock_t*)lock)); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +#elif defined(__FreeBSD__) +#if defined(SPINLOCK_OLD) splx(*(wan_spinlock_t*)lock); +#else + if (!mtx_initialized((struct mtx*)lock)){ + DEBUG_EVENT( + "INTERNAL ERROR: Spin Lock IRQ is no initialized!\n"); + return; + } + mtx_unlock((struct mtx*)lock); +#endif +#elif defined(__OpenBSD__) || defined(__NetBSD__) + splx(*(wan_spinlock_t*)lock); +#elif defined(__WINDOWS__) + spin_unlock((wan_spinlock_t*)lock); #else # warning "wan_spin_unlock() function is not supported yet!" #endif @@ -2438,5 +2890,47 @@ static __inline void wan_write_bus_4(void *phw, void *virt, int offset, unsigned } #endif +#if defined(__WINDOWS__) + +# define WAN_SPIN_LOCK_INIT(pSpinLock) \ +{ \ + int rc=1; \ + VERIFY_PASSIVE_IRQL(rc); \ + if(rc == 0){ \ + KeInitializeSpinLock(pSpinLock); \ + } \ +} + +/////////////////////////////////////////////////////// +//for use at IRQL <= DISPATCH_LEVEL +# define WAN_SPIN_LOCK_IRQSAVE(pSpinLock) \ +{ \ + int rc=SILENT; \ + VERIFY_DISPATCH_IRQL(rc); \ + if(rc == 0){ \ + KeAcquireSpinLock(pSpinLock, &old_IRQL);\ + } \ +} + +# define WAN_SPIN_UNLOCK_IRQSAVE(pSpinLock) \ + KeReleaseSpinLock(pSpinLock, old_IRQL); + +//for use at IRQL == DISPATCH_LEVEL - more efficient +//when known to run in DPC +# define WAN_SPIN_LOCK_DPC(pSpinLock) \ +{ \ + int rc=1; \ + if(0)DBG_IRQLOCK("WAN_SPIN_LOCK_DPC: caller: %s\n",__FUNCTION__); \ + \ + VERIFY_IRQL_EQUAL_DISPATCH(rc); \ + if(rc == 0){ \ + KeAcquireSpinLockAtDpcLevel(pSpinLock); \ + } \ +} + +# define WAN_SPIN_UNLOCK_DPC(pSpinLock) \ + KeReleaseSpinLockFromDpcLevel(pSpinLock); +#endif + #endif /* WAN_KERNEL */ #endif /* __WANPIPE_COMMON_H */ diff --git a/patches/kdrivers/include/wanpipe_common.h~ b/patches/kdrivers/include/wanpipe_common.h~ deleted file mode 100644 index fa8d5a4..0000000 --- a/patches/kdrivers/include/wanpipe_common.h~ +++ /dev/null @@ -1,2442 +0,0 @@ -/* - * Copyright (c) 2002 - * Alex Feldman . All rights reserved. - * - * $Id: wanpipe_common.h,v 1.175 2007/02/24 00:17:14 sangoma Exp $ - */ - -/**************************************************************************** - * wanpipe_common.h WANPIPE(tm) Multiprotocol WAN Link Driver. - * - * Author: Alex Feldman - * - * ========================================================================== - * July 17, 2002 Alex Feldman Initial Version - **************************************************************************** - */ - -#ifndef __WANPIPE_COMMON_H -# define __WANPIPE_COMMON_H - -#ifdef __LINUX__ -# include -#else -# include -#endif - -#ifdef WAN_DEBUG_MEM -extern atomic_t wan_debug_mem; -#endif - -/**************************************************************************** -** D E F I N E S -****************************************************************************/ -#ifndef NIPQUAD -# define NIPQUAD(addr) \ - ((unsigned char *)&addr)[0], \ - ((unsigned char *)&addr)[1], \ - ((unsigned char *)&addr)[2], \ - ((unsigned char *)&addr)[3] -#endif - -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) - -# define WAN_LIST_HEAD(name, type) LIST_HEAD(name, type) -# define WAN_LIST_HEAD_INITIALIZER(head) LIST_HEAD_INITIALIZER(head) -# define WAN_LIST_ENTRY(type) LIST_ENTRY(type) -# define WAN_LIST_EMPTY(head) LIST_EMPTY(head) -# define WAN_LIST_FIRST(head) LIST_FIRST(head) -# define WAN_LIST_FOREACH(var, head, field) LIST_FOREACH(var, head, field) -# define WAN_LIST_INIT(head) LIST_INIT(head) -# define WAN_LIST_INSERT_AFTER(listelm, elm, field) LIST_INSERT_AFTER(listelm, elm, field) -/*# define WAN_LIST_INSERT_BEFORE(listelm, elm, field) LIST_INSERT_BEFORE(listelm, elm, field)*/ -# define WAN_LIST_INSERT_HEAD(head, elm, field) LIST_INSERT_HEAD(head, elm, field) -# define WAN_LIST_NEXT(elm, field) LIST_NEXT(elm, field) -# define WAN_LIST_REMOVE(elm, field) LIST_REMOVE(elm, field) - -#elif defined(__SOLARIS__) - -/* ********* S O L A R I S *****************/ - -# define WAN_LIST_HEAD(name, type) struct name { struct type * lh_first; } -# define WAN_LIST_HEAD_INITIALIZER(head) { NULL } -# define WAN_LIST_ENTRY(type) struct { struct type *le_next; struct type **le_prev; } -# define WAN_LIST_FIRST(head) ((head)->lh_first) -# define WAN_LIST_END(head) NULL -# define WAN_LIST_EMPTY(head) (WAN_LIST_FIRST(head) == WAN_LIST_END(head)) -# define WAN_LIST_NEXT(elm, field) ((elm)->field.le_next) -# define WAN_LIST_FOREACH(var, head, field) for((var) = WAN_LIST_FIRST(head); \ - (var); \ - (var) = WAN_LIST_NEXT(var, field)) -# define WAN_LIST_INIT(head) do { WAN_LIST_FIRST(head) = NULL;}\ - while(0) - -#define WAN_LIST_INSERT_HEAD(head, elm, field) do { \ - if ((WAN_LIST_NEXT((elm), field) = WAN_LIST_FIRST((head))) != NULL) \ - WAN_LIST_FIRST((head))->field.le_prev = &WAN_LIST_NEXT((elm), field);\ - WAN_LIST_FIRST((head)) = (elm); \ - (elm)->field.le_prev = &WAN_LIST_FIRST((head)); \ -} while (0) -#define WAN_LIST_INSERT_AFTER(listelm, elm, field) do { \ - if ((WAN_LIST_NEXT((elm), field) = WAN_LIST_NEXT((listelm), field)) != NULL)\ - WAN_LIST_NEXT((listelm), field)->field.le_prev = \ - &WAN_LIST_NEXT((elm), field); \ - WAN_LIST_NEXT((listelm), field) = (elm); \ - (elm)->field.le_prev = &WAN_LIST_NEXT((listelm), field); \ -} while (0) -#define WAN_LIST_REMOVE(elm, field) do { \ - if (WAN_LIST_NEXT((elm), field) != NULL) \ - WAN_LIST_NEXT((elm), field)->field.le_prev = \ - (elm)->field.le_prev; \ - *(elm)->field.le_prev = WAN_LIST_NEXT((elm), field); \ -} while (0) - - -#elif defined(__LINUX__) -/* ********* L I N U X *****************/ - -# define WAN_LIST_HEAD(name, type) struct name { struct type * lh_first; } -# define WAN_LIST_HEAD_INITIALIZER(head) { NULL } -# define WAN_LIST_ENTRY(type) struct { struct type *le_next; struct type **le_prev; } -# define WAN_LIST_FIRST(head) ((head)->lh_first) -# define WAN_LIST_END(head) NULL -# define WAN_LIST_EMPTY(head) (WAN_LIST_FIRST(head) == WAN_LIST_END(head)) -# define WAN_LIST_NEXT(elm, field) ((elm)->field.le_next) -# define WAN_LIST_FOREACH(var, head, field) for((var) = WAN_LIST_FIRST(head); \ - (var); \ - (var) = WAN_LIST_NEXT(var, field)) -# define WAN_LIST_INIT(head) do { WAN_LIST_FIRST(head) = NULL;}\ - while(0) - -#define WAN_LIST_INSERT_HEAD(head, elm, field) do { \ - if ((WAN_LIST_NEXT((elm), field) = WAN_LIST_FIRST((head))) != NULL) \ - WAN_LIST_FIRST((head))->field.le_prev = &WAN_LIST_NEXT((elm), field);\ - WAN_LIST_FIRST((head)) = (elm); \ - (elm)->field.le_prev = &WAN_LIST_FIRST((head)); \ -} while (0) -#define WAN_LIST_INSERT_AFTER(listelm, elm, field) do { \ - if ((WAN_LIST_NEXT((elm), field) = WAN_LIST_NEXT((listelm), field)) != NULL)\ - WAN_LIST_NEXT((listelm), field)->field.le_prev = \ - &WAN_LIST_NEXT((elm), field); \ - WAN_LIST_NEXT((listelm), field) = (elm); \ - (elm)->field.le_prev = &WAN_LIST_NEXT((listelm), field); \ -} while (0) -#define WAN_LIST_REMOVE(elm, field) do { \ - if (WAN_LIST_NEXT((elm), field) != NULL) \ - WAN_LIST_NEXT((elm), field)->field.le_prev = \ - (elm)->field.le_prev; \ - *(elm)->field.le_prev = WAN_LIST_NEXT((elm), field); \ -} while (0) - -#else -# error "WAN_LISTx macros not supported yet!" -#endif - -#if defined(WAN_KERNEL) - -#if defined(__FreeBSD__) -# define WAN_TAILQ_FIRST(ifp) TAILQ_FIRST(&ifp->if_addrhead) -# define WAN_TAILQ_NEXT(ifa) TAILQ_NEXT(ifa, ifa_link) -#elif defined (__OpenBSD__) -# define WAN_TAILQ_FIRST(ifp) TAILQ_FIRST(&ifp->if_addrlist) -# define WAN_TAILQ_NEXT(ifa) TAILQ_NEXT(ifa, ifa_list) -#elif defined (__NetBSD__) -# define WAN_TAILQ_FIRST(ifp) TAILQ_FIRST(&ifp->if_addrlist) -# define WAN_TAILQ_NEXT(ifa) TAILQ_NEXT(ifa, ifa_list) -#elif defined(__LINUX__) -#elif defined(__SOLARIS__) -#elif defined(__WINDOWS__) -#else -# error "WAN_TAILQ_x macros doesn't supported yet!" -#endif - -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -# if defined(__FreeBSD__) -# define WAN_PKTATTR_DECL(pktattr) -# else -# define WAN_PKTATTR_DECL(pktattr) struct altq_pktattr pktattr -# endif -# define WAN_IFQ_SET_READY IFQ_SET_READY -# define WAN_IFQ_IS_EMPTY IFQ_IS_EMPTY -# define WAN_IFQ_INC_LEN IFQ_INC_LEN -# define WAN_IFQ_DEC_LEN IFQ_DEC_LEN -# define WAN_IFQ_INC_DROPS IFQ_INC_DROPS -# define WAN_IFQ_SET_MAXLEN IFQ_SET_MAXLEN -# define WAN_IFQ_PURGE IFQ_PURGE -# if (__FreeBSD_version > 503000) -# define WAN_IFQ_ENQUEUE(ifq, m, pattr, err) IFQ_ENQUEUE((ifq),(m),(err)) -# else -# define WAN_IFQ_ENQUEUE IFQ_ENQUEUE -# endif -# define WAN_IFQ_DEQUEUE IFQ_DEQUEUE -# define WAN_IFQ_POLL IFQ_POLL -# define WAN_IFQ_CLASSIFY IFQ_CLASSIFY -# define WAN_IFQ_INIT IFQ_INIT -# define WAN_IFQ_LEN IFQ_LEN -#elif defined(__LINUX__) -# define WAN_IFQ_INIT(ifq, max_pkt) skb_queue_head_init((ifq)) -# define WAN_IFQ_PURGE(ifq) skb_queue_purge((ifq)) -# define WAN_IFQ_ENQUEUE(ifq, skb, arg, err) skb_queue_tail((ifq), (skb)) -# define WAN_IFQ_LEN(ifq) skb_queue_len((ifq)) -#elif defined(__WINDOWS__) -#else -# error "Undefined IFQ_x macros!" -#endif - -#if defined(__FreeBSD__) -# if (__FreeBSD_version < 410000) -# define WAN_TASKLET_INIT(task, priority, func, arg) \ - (task)->running = 0; \ - (task)->task_func = func; (task)->data = arg -# define WAN_TASKLET_SCHEDULE(task) \ - if (!wan_test_bit(0, &(task)->running)){ \ - wan_set_bit(0, &(task)->running); \ - (task)->task_func((task)->data, 0); \ - } -# define __WAN_TASKLET_SCHEDULE(task) WAN_TASKLET_SCHEDULE(task) - -# define WAN_TASKLET_RUNNING(task) \ - wan_test_bit(0, &(task)->running) - -# define WAN_TASKLET_END(task) wan_clear_bit(0, &(task)->running) -# define WAN_TASKLET_RUNNING(task) \ - wan_test_bit(0, &(task)->running) - -# define WAN_TASKLET_KILL(task) -# else -# define WAN_TASKLET_INIT(task, priority, func, arg) \ - (task)->running = 0; \ - TASK_INIT(&(task)->task_id, priority, func, (void*)arg) -# define WAN_TASKLET_SCHEDULE(task) \ - if (!wan_test_bit(0, &(task)->running)){ \ - wan_set_bit(0, &(task)->running); \ - taskqueue_enqueue(taskqueue_swi, &(task)->task_id); \ - } -# define __WAN_TASKLET_SCHEDULE(task) WAN_TASKLET_SCHEDULE(task) - -# define WAN_TASKLET_RUNNING(task) \ - wan_test_bit(0, &(task)->running) - -/* taskqueue_run(taskqueue_swi); \*/ -# define WAN_TASKLET_END(task) wan_clear_bit(0, &(task)->running) -# define WAN_TASKLET_KILL(task) -# endif -#elif defined(__OpenBSD__) || defined(__NetBSD__) -# define WAN_TASKLET_INIT(task, priority, func, arg) \ - (task)->running = 0; \ - (task)->task_func = func; (task)->data = arg -# define WAN_TASKLET_SCHEDULE(task) \ - if (!wan_test_bit(0, &(task)->running)){ \ - wan_set_bit(0, &(task)->running); \ - (task)->task_func((task)->data, 0); \ - } - -# define __WAN_TASKLET_SCHEDULE(task) WAN_TASKLET_SCHEDULE(task) - -# define WAN_TASKLET_RUNNING(task) \ - wan_test_bit(0, &(task)->running) -# define WAN_TASKLET_END(task) wan_clear_bit(0, &(task)->running) -# define WAN_TASKLET_KILL(task) - - -#elif defined(__LINUX__) - -# define WAN_TASKLET_INIT(task, priority, func, arg) \ - (task)->running = 0; \ - tasklet_init(&(task)->task_id,func,(unsigned long)arg) - -# define WAN_TASKLET_SCHEDULE(task) \ - wan_set_bit(0, &(task)->running); \ - tasklet_schedule(&(task)->task_id); - -#if 0 -# define WAN_WP_TASKLET_SCHEDULE_PER_CPU(task,cpu) \ - wan_set_bit(0, &(task)->running); \ - wp_tasklet_hi_schedule_per_cpu(&(task)->task_id,cpu); -#endif - -# define WAN_TASKLET_RUNNING(task) \ - wan_test_bit(0, &(task)->running) - -# define WAN_TASKLET_END(task) wan_clear_bit(0, &(task)->running) -# define WAN_TASKLET_KILL(task) tasklet_kill(&(task)->task_id) - - -#elif defined(__WINDOWS__) -#else -# error "Undefined WAN_TASKLET_x macro!" -#endif - -#if defined(__FreeBSD__) -# if (__FreeBSD_version < 410000) -# define WAN_TASKQ_INIT(task, priority, func, arg) \ - (task)->tfunc = func; task->data = arg -# else -# define WAN_TASKQ_INIT(task, priority, func, arg) \ - TASK_INIT(&task->tqueue, priority, func, arg) -# endif -#elif defined(__OpenBSD__) -# define WAN_TASKQ_INIT(task, priority, func, arg) \ - (task)->tfunc = func; task->data = arg -#elif defined(__NetBSD__) -# define WAN_TASKQ_INIT(task, priority, func, arg) \ - (task)->tfunc = func; task->data = arg -#elif defined(__LINUX__) -/* Due to 2.6.20 kernel the wan_taskq_t is now a direct - * workqueue struct not an abstracted structure */ -# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -# define WAN_TASKQ_INIT(task, priority, func, arg) \ - INIT_WORK((task),func,arg) -# else -# define WAN_TASKQ_INIT(task, priority, func, arg) \ - INIT_WORK((task),func) -# endif - -#elif defined(__WINDOWS__) -#else -# error "Undefined WAN_TASKQ_INIT macro!" -#endif - -#if defined(__FreeBSD__) && (__FreeBSD_version >= 410000) -# define WAN_IS_TASKQ_SCHEDULE -# define WAN_TASKQ_SCHEDULE(task) \ - taskqueue_enqueue(taskqueue_swi, &task->tqueue);\ - taskqueue_run(taskqueue_swi) -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -# define WAN_IS_TASKQ_SCHEDULE -# define WAN_TASKQ_SCHEDULE(task) \ - task->tfunc(task->data, 0) -#elif defined(__LINUX__) -# define WAN_IS_TASKQ_SCHEDULE -# define WAN_TASKQ_SCHEDULE(task) \ - wan_schedule_task(task) -#elif defined(__WINDOWS__) -#else -# error "Undefined WAN_TASKQ_SCHEDULE macro!" -#endif - -#if defined(__LINUX__) -# define WAN_COPY_FROM_USER(k,u,l) copy_from_user(k,u,l) -# define WAN_COPY_TO_USER(u,k,l) copy_to_user(u,k,l) -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -# define WAN_COPY_FROM_USER(k,u,l) copyin(u,k,l) -# define WAN_COPY_TO_USER(u,k,l) copyout(k,u,l) -#elif defined(__WINDOWS__) -#else -# error "Undefined WAN_COPY_FROM_USER/WAN_COPY_TO_USER macros!" -#endif - -#if defined(__LINUX__) -# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,43)) -# define WAN_NETIF_WAKE_QUEUE(dev) do { \ - clear_bit(0, &dev->tbusy); \ - mark_bh(NET_BH); \ - } while(0) -# define WAN_NETIF_START_QUEUE(dev) do { \ - dev->tbusy = 0; \ - dev->interrupt = 0; \ - dev->start = 1; \ - } while(0); -# define WAN_NETIF_STOP_QUEUE(dev) set_bit(0, &dev->tbusy) -# define WAN_NETIF_RUNNING(dev) dev->start -# define WAN_NETDEVICE_START(dev) dev->start = 1 -# define WAN_NETDEVICE_STOP(dev) dev->start = 0 -# define WAN_NETIF_QUEUE_STOPPED(dev) test_bit(0,&dev->tbusy) -# define WAN_NETIF_CARRIER_OFF(dev) -# define WAN_NETIF_CARRIER_ON(dev) -# define WAN_NETIF_CARRIER_OK(dev) 1 -# else -#if 0 -# define WAN_NETIF_WAKE_QUEUE(dev) do{ \ - if (((wanpipe_common_t *)dev->priv)->usedby == TDM_VOICE){ \ - DEBUG_EVENT("%s: TDM VOICE not waking but starting!!!!\n",dev->name); \ - netif_start_queue(dev); \ - }else{ \ - netif_wake_queue(dev); \ - } \ - }while(0) -#endif -# define WAN_NETIF_WAKE_QUEUE(dev) netif_wake_queue(dev); -# define WAN_NETIF_START_QUEUE(dev) netif_start_queue(dev) -# define WAN_NETIF_STOP_QUEUE(dev) netif_stop_queue(dev) -# define WAN_NETIF_RUNNING(dev) netif_running(dev) -# define WAN_NETDEVICE_START(dev) -# define WAN_NETDEVICE_STOP(dev) -# define WAN_NETIF_QUEUE_STOPPED(dev) netif_queue_stopped(dev) -# define WAN_NETIF_CARRIER_OFF(dev) netif_carrier_off(dev) -# define WAN_NETIF_CARRIER_ON(dev) netif_carrier_on(dev) -# define WAN_NETIF_CARRIER_OK(dev) netif_carrier_ok(dev) -# endif -# define WAN_NETIF_UP(dev) ((dev)->flags&IFF_UP) -# define WAN_NET_RATELIMIT net_ratelimit - -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -# define WAN_NETIF_QUEUE_STOPPED(dev) (dev)->if_flags & IFF_DRV_OACTIVE -# define WAN_NETIF_WAKE_QUEUE(dev) (dev)->if_flags &= ~IFF_DRV_OACTIVE -#if 0 -# define WAN_NETIF_STOP_QUEUE(dev) -# define WAN_NETIF_START_QUEUE(dev) -#endif -# define WAN_NETIF_STOP_QUEUE(dev) (dev)->if_flags |= IFF_DRV_OACTIVE -# define WAN_NETIF_START_QUEUE(dev) (dev)->if_flags &= ~IFF_DRV_OACTIVE -# define WAN_NETIF_RUNNING(dev) 1 -# define WAN_NETIF_UP(dev) ((dev)->if_flags&IFF_UP) -# define WAN_NETDEVICE_STOP(dev) -# define WAN_NETDEVICE_START(dev) -# define NET_ADMIN_CHECK() -# define WAN_NET_RATELIMIT() 1 -# define MOD_INC_USE_COUNT -# define MOD_DEC_USE_COUNT - -# define WAN_NETIF_CARRIER_OFF(dev) -# define WAN_NETIF_CARRIER_ON(dev) -# define WAN_NETIF_CARRIER_OK(dev) 1 - -#elif defined(__WINDOWS__) -#else -# error "Undefined WAN_NETIF_x macros!" -#endif - -#if defined(__LINUX__) -# define WAN_BPF_DIR_IN (1<<0) -# define WAN_BPF_DIR_OUT (1<<1) -# define WAN_BPF_REPORT(dev,m) -#elif defined(__FreeBSD__) -# define WAN_BPF_DIR_IN (1<<0) -# define WAN_BPF_DIR_OUT (1<<1) -# if (__FreeBSD_version > 500000) -# define WAN_BPF_REPORT(dev,m,d) bpf_mtap((dev)->if_bpf, (m)) -# else -# define WAN_BPF_REPORT(dev,m,d) bpf_mtap((dev), (m)) -# endif -#elif defined(__OpenBSD__) -# if (OpenBSD < 200611) -# define WAN_BPF_DIR_IN (1<<0) -# define WAN_BPF_DIR_OUT (1<<1) -# define WAN_BPF_REPORT(dev,m,d) bpf_mtap((dev)->if_bpf, (m)); -# else -# define WAN_BPF_DIR_IN BPF_DIRECTION_IN -# define WAN_BPF_DIR_OUT BPF_DIRECTION_OUT -# define WAN_BPF_REPORT(dev,m,d) \ - if (dir == WAN_BPF_DIR_IN){ \ - bpf_mtap((dev)->if_bpf, (m), BPF_DIRECTION_IN); \ - }else{ \ - bpf_mtap((dev)->if_bpf, (m), BPF_DIRECTION_OUT); \ - } -# endif -#elif defined(__NetBSD__) -# define WAN_BPF_DIR_IN (1<<0) -# define WAN_BPF_DIR_OUT (1<<1) -# define WAN_BPF_REPORT(dev,m,d) bpf_mtap((dev)->if_bpf, (m)); -#elif defined(__WINDOWS__) -#else -# error "Undefined WAN_BPF_REPORT macro!" -#endif - - -#if defined (__LINUX__) -# define WAN_DEV_PUT(dev) wan_atomic_dec(&(dev)->refcnt) -# define WAN_DEV_HOLD(dev) wan_atomic_inc(&(dev)->refcnt) -# define __WAN_PUT(str) wan_atomic_dec(&(str)->refcnt) -# define WAN_PUT(str) if (atomic_dec_and_test(&(str)->refcnt)){ \ - wan_kfree(str); \ - } -# define WAN_HOLD(str) wan_atomic_inc(&(str)->refcnt) -#elif defined(__FreeBSD__) -# define WAN_DEV_PUT(dev) -# define WAN_DEV_HOLD(dev) -# define __WAN_PUT(str) wan_atomic_dec(&(str)->refcnt) -# define WAN_PUT(str) wan_atomic_dec(&str->refcnt); \ - if (str->refcnt){ \ - WAN_FREE(str); \ - } -# define WAN_HOLD(str) wan_atomic_inc(&(str)->refcnt) -#elif defined(__NetBSD__) || defined(__OpenBSD__) -# define WAN_DEV_PUT(dev) -# define WAN_DEV_HOLD(dev) -# define __WAN_PUT(str) str->refcnt-- -# define WAN_PUT(str) str->refcnt--; \ - if (str->refcnt){ \ - WAN_FREE(str); \ - } -# define WAN_HOLD(str) str->refcnt++ -#elif defined(__WINDOWS__) -#else -# warning "Undefined WAN_HOLD/WAN_PUT macro!" -#endif - -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -# ifdef ENABLE_SPPP -# define WAN_SPPP_ENABLED 1 -# define WAN_SPPP_ATTACH(ifp) sppp_attach(ifp) -# define WAN_SPPP_DETACH(ifp) sppp_detach(ifp) -# define WAN_SPPP_FLUSH(ifp) sppp_flush(ifp) -# define WAN_SPPP_PICK(ifp) sppp_pick(ifp) -# define WAN_SPPP_DEQUEUE(ifp) sppp_dequeue(ifp) -# define WAN_SPPP_ISEMPTY(ifp) sppp_isempty(ifp) -# define WAN_SPPP_INPUT(ifp,skb) sppp_input(ifp,skb) -# define WAN_SPPP_IOCTL(ifp,cmd,data) sppp_ioctl(ifp,cmd,data); -# else -# define WAN_SPPP_ENABLED 0 -# define WAN_SPPP_ATTACH(ifp) -# define WAN_SPPP_DETACH(ifp) -# define WAN_SPPP_FLUSH(ifp) -# define WAN_SPPP_PICK(ifp) NULL -# define WAN_SPPP_DEQUEUE(ifp) NULL -# define WAN_SPPP_ISEMPTY(ifp) 0 -# define WAN_SPPP_INPUT(ifp,skb) -# define WAN_SPPP_IOCTL(ifp,cmd,data) -EOPNOTSUPP -# endif -#elif defined(__LINUX__) -# define WAN_SPPP_ENABLED 1 -# define WAN_SPPP_IOCTL(ifp,cmd,data) -EOPNOTSUPP -#elif defined(__WINDOWS__) -#else -# error "Undefined WAN_SPPP_x macros!" -#endif - -#define WAN_MAX_TRACE_TIMEOUT (5*HZ) - -#if 0 -/* - * Variable argument list macro definitions - */ -#ifndef _VALIST -#define _VALIST -typedef char *va_list; -#endif /* _VALIST */ -#define _WAN_VA_SIZE(type) (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) - -#define WAN_VA_START(ap, A) ((ap) = (va_list) &(A) + _WAN_VA_SIZE(A)) -#define WAN_VA_ARG(ap, T) (*(T *)((ap) += _WAN_VA_SIZE(T),(ap) - _WAN_VA_SIZE (T))) -#define WAN_VA_END(ap) (void) 0 -#endif - - -/**************************************************************************** -** T Y P E D E F S -****************************************************************************/ -# if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) -/* - * Ethernet statistics collection data - */ -struct net_device_stats -{ - unsigned long rx_packets; /* total packets received */ - unsigned long tx_packets; /* total packets transmited */ - unsigned long rx_bytes; /* total bytes received */ - unsigned long tx_bytes; /* total bytes transmited */ - unsigned long rx_errors; /* bad packet received */ - unsigned long tx_errors; /* packet transmit problems */ - unsigned long rx_dropped; /* no space in buffers */ - unsigned long tx_dropped; /* no space available */ - unsigned long multicast; /* multicast packet received */ - unsigned long collisions; - - /* detailed rx_errors */ - unsigned long rx_length_errors; - unsigned long rx_over_errors; /* receiver ring off buff overflow */ - unsigned long rx_crc_errors; /* recv'd pkt with crc error */ - unsigned long rx_frame_errors; /* recv'd frame alignment error */ - unsigned long rx_fifo_errors; /* recv'r fifo overrun */ - unsigned long rx_missed_errors; /* receiver missed packet */ - - /* detailed tx_errors */ - unsigned long tx_aborted_errors; - unsigned long tx_carrier_errors; - unsigned long tx_fifo_errors; - unsigned long tx_heartbeat_errors; - unsigned long tx_window_errors; - - /* for cslip etc */ - unsigned long rx_compressed; - unsigned long tx_compressed; -}; -#endif - -/**************************************************************************** -** F U N C T I O N P R O T O T Y P E S -****************************************************************************/ -unsigned int wan_dec2uint (unsigned char* str, int len); -char* wanpipe_get_state_string (void*); -void wanpipe_set_state (void*, int); -char wanpipe_get_state (void*); -void wanpipe_card_lock_irq (void *,unsigned long *); -void wanpipe_card_unlock_irq (void *,unsigned long *); -void wanpipe_set_baud(void*card,unsigned int baud); -unsigned long wan_get_ip_addr (void*, int); -int wan_udp_pkt_type (void*, caddr_t); -int wan_reply_udp (void*, unsigned char*, unsigned int); -unsigned short wan_calc_checksum(char *data, int len); -void wanpipe_debug_timer_init(void*); -void wan_trace_info_init(wan_trace_t *trace, int max_trace_queue); -int wan_trace_purge (wan_trace_t *trace); -int wan_trace_enqueue(wan_trace_t *trace, void *skb_ptr); -int wan_tracing_enabled(wan_trace_t *trace_info); -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -void wanpipe_debugging (void* data, int pending); -#else -void wanpipe_debugging (unsigned long data); -#endif -static __inline int wan_skb_tailroom(void* skb); - -/**************************************************************************** -** I N L I N E F U N C T I O N S -****************************************************************************/ -/******************* WANPIPE MALLOC/FREE FUNCTION ******************/ -/* -** wan_malloc - -*/ -static __inline void* wan_malloc(int size) -{ - void* ptr = NULL; -#if defined(__LINUX__) - ptr = kmalloc(size, GFP_ATOMIC); - if (ptr){ - DEBUG_ADD_MEM(size); - } -#elif defined(__SOLARIS__) - ptr=kmem_alloc(size,KM_NOSLEEP); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - ptr = malloc(size, M_DEVBUF, M_NOWAIT); -#elif defined(__WINDOWS__) - ptr = ExAllocatePool(NonPagedPool, size); -#else -# error "wan_malloc() function is not supported yet!" -#endif - if (ptr){ - memset(ptr, 0, size); - DEBUG_ADD_MEM(size); - } - return ptr; -} - -static __inline void* wan_kmalloc(int size) -{ - void* ptr = NULL; -#if defined(__LINUX__) - ptr = kmalloc(size, GFP_KERNEL); - if (ptr){ - DEBUG_ADD_MEM(size); - } -#elif defined(__SOLARIS__) - ptr=kmem_alloc(size,KM_NOSLEEP); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - ptr = malloc(size, M_DEVBUF, M_NOWAIT); -#elif defined(__WINDOWS__) - ptr = ExAllocatePool(NonPagedPool, size); -#else -# error "wan_malloc() function is not supported yet!" -#endif - if (ptr){ - memset(ptr, 0, size); - DEBUG_ADD_MEM(size); - } - return ptr; -} - -/* -** wan_free - -*/ -static __inline void wan_free(void* ptr) -{ - if (!ptr){ - DEBUG_EVENT("wan_free: NULL PTR !!!!!\n"); - return; - } - -#if defined(__LINUX__) - kfree(ptr); -#elif defined(__SOLARIS__) - kmem_free(ptr,sizeof(*ptr)); - DEBUG_EVENT("%s: Feeing Size %i\n",__FUNCTION__,sizeof(*ptr)); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - return free(ptr, M_DEVBUF); -#elif defined(__WINDOWS__) - ExFreePool(ptr); -#else -# error "wan_free() function is not supported yet!" -#endif -} - -static __inline void* wan_vmalloc(int size) -{ - void* ptr = NULL; -#if defined(__LINUX__) - ptr = vmalloc(size); - if (ptr){ - DEBUG_ADD_MEM(size); - } -#elif defined(__FreeBSD__) - ptr = (caddr_t)kmem_alloc(kernel_map, size + sizeof(vm_size_t)); - if (ptr){ - vm_size_t *ptr1 = (vm_size_t*)ptr; - bzero(ptr, size); - *ptr1 = size + sizeof(vm_size_t); - ptr = ptr1++; - } -#elif defined(__OpenBSD__) || defined(__NetBSD__) - ptr = (caddr_t)uvm_km_alloc(kernel_map, size + sizeof(vsize_t)); - if (ptr){ - vsize_t *ptr1 = (vsize_t*)ptr; - bzero(ptr, size); - *ptr1 = size + sizeof(vsize_t); - ptr = ptr1++; - } -#elif defined(__SOLARIS__) -#elif defined(__WINDOWS__) -#else -# error "wan_vmalloc() function is not supported yet!" -#endif - if (ptr){ - memset(ptr, 0, size); - DEBUG_ADD_MEM(size); - } - return ptr; -} - -/* -** wan_vfree - -*/ -static __inline void wan_vfree(void* ptr) -{ - if (!ptr){ - DEBUG_EVENT("wan_vfree: NULL PTR !!!!!\n"); - return; - } -#if defined(__LINUX__) - vfree(ptr); -#elif defined(__FreeBSD__) - { - vm_size_t *ptr1 = (vm_size_t*)ptr; - ptr1 --; - kmem_free(kernel_map, (vm_offset_t)ptr1, (vm_size_t)*ptr1); - } -#elif defined(__OpenBSD__) || defined(__NetBSD__) - { - vsize_t *ptr1 = (vsize_t*)ptr; - ptr1 --; - uvm_km_free(kernel_map, (vaddr_t)ptr1, (vsize_t)*ptr1); - } -#elif defined(__SOLARIS__) -#elif defined(__WINDOWS__) -#else -# error "wan_free() function is not supported yet!" -#endif - return; -} - - -/******************* WANPIPE VIRT<->BUS SPACE FUNCTION ******************/ -/* -** wan_virt2bus -*/ -static __inline unsigned long wan_virt2bus(unsigned long* ptr) -{ -#if defined(__LINUX__) - return virt_to_bus(ptr); -#elif defined(__FreeBSD__) - return vtophys((vm_offset_t)ptr); -#elif defined(__OpenBSD__) || defined(__NetBSD__) - return vtophys((vaddr_t)ptr); -#elif defined(__WINDOWS__) -#else -# error "wan_virt2bus() function is not supported yet!" -#endif -} - -/* -** wan_bus2virt -*/ -static __inline unsigned long* wan_bus2virt(unsigned long virt_addr) -{ -#if defined(__LINUX__) - return bus_to_virt(virt_addr); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - return (unsigned long*)virt_addr; -#elif defined(__WINDOWS__) -#else -# error "wan_bus2virt() function is not supported yet!" -#endif -} - - -/******************* WANPIPE DMA FUNCTION ******************/ - -/* -** wan_dma_alloc -*/ -static __inline int -wan_dma_alloc(void* hw, wan_dma_descr_t* dma_descr) -{ - int err = 0; -#if defined(__FreeBSD__) - err = bus_dma_tag_create(/*parent*/NULL, - /*alignemnt*/1, - /*boundary*/0, - /*lowaddr*/BUS_SPACE_MAXADDR_32BIT, - /*highaddr*/BUS_SPACE_MAXADDR, - /*filter*/NULL, /*filterarg*/NULL, - /*maxsize*/dma_descr->max_length, -# if (__FreeBSD_version >= 502000) - /*nsegments*/1, -# else - /*nsegments*/BUS_SPACE_UNRESTRICTED, -# endif - /*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT, - /*flags*/0, -# if (__FreeBSD_version >= 502000) - /*lockfunc*/NULL, /*lockfuncarg*/NULL, -# endif - &dma_descr->dmat); - if (err){ - DEBUG_EVENT("Failed create DMA tag (size=%ld)!\n", - dma_descr->max_length); - dma_descr->max_length = 0; - return err; - } - err = bus_dmamem_alloc(dma_descr->dmat, - (void**)&dma_descr->vAddr, - BUS_DMA_NOWAIT, - &dma_descr->dmamap); - if (err){ - DEBUG_EVENT("Failed allocate DMA (size=%ld)!\n", - dma_descr->max_length); - bus_dma_tag_destroy(dma_descr->dmat); - dma_descr->max_length = 0; - return err; - } -#elif defined(__OpenBSD__) || defined(__NetBSD__) - err = bus_dmamem_alloc(dma_descr->dmat, /* dma tag */ - dma_descr->max_length, /* size */ - PAGE_SIZE, /* alignment */ - 0, /* boundary */ - &dma_descr->dmaseg, /* serments */ - 1, /* num of segments */ - &dma_descr->rsegs, /* R num of segments */ - BUS_DMA_NOWAIT); - if (err){ - DEBUG_EVENT("Failed allocate DMA segment (size=%ld)!\n", - dma_descr->max_length); - dma_descr->max_length = 0; - return err; - } - err = bus_dmamem_map(dma_descr->dmat, /* dma tag */ - &dma_descr->dmaseg, /* segments */ - dma_descr->rsegs, /* return num of segments */ - dma_descr->max_length, /* size */ - (caddr_t*)&dma_descr->vAddr, /* kernel virtual address */ - BUS_DMA_NOWAIT); - if (err){ - DEBUG_EVENT("Failed map DMA segment (size=%ld)!\n", - dma_descr->max_length); - dma_descr->max_length = 0; - bus_dmamem_free(dma_descr->dmat, &dma_descr->dmaseg, dma_descr->rsegs); - return err; - } -#elif defined(__LINUX__) - dma_descr->vAddr = pci_alloc_consistent(NULL, - dma_descr->max_length, - (dma_addr_t *)&dma_descr->pAddr); - if (dma_descr->vAddr == NULL){ - err = -ENOMEM; - } -#elif defined(__WINDOWS__) - return -EINVAL; -#else -# error "wan_dma_alloc() function is not supported yet!" -#endif - return err; -} - -/* -** wan_dma_free -*/ -static __inline int -wan_dma_free(void* hw, wan_dma_descr_t* dma_descr) -{ -#if defined(__FreeBSD__) - bus_dmamem_free(dma_descr->dmat, dma_descr->vAddr, dma_descr->dmamap); - return bus_dma_tag_destroy(dma_descr->dmat); -#elif defined(__OpenBSD__) || defined(__NetBSD__) - bus_dmamem_unmap(dma_descr->dmat, (caddr_t)dma_descr->vAddr, dma_descr->max_length); - bus_dmamem_free(dma_descr->dmat, &dma_descr->dmaseg, dma_descr->rsegs); -#elif defined(__LINUX__) - - DEBUG_TEST("Freeing Pages 0x%p len=%li order=%i\n", - dma_descr->vAddr, - dma_descr->max_length, - get_order(dma_descr->max_length)); - - pci_free_consistent(NULL, dma_descr->max_length,dma_descr->vAddr,dma_descr->pAddr); - dma_descr->vAddr = NULL; - dma_descr->pAddr = 0; -#elif defined(__WINDOWS__) - return -EINVAL; -#else -# error "wan_dma_free() function is not supported yet!" -#endif - return 0; -} - -static __inline unsigned long* wan_dma_get_vaddr(void* card, wan_dma_descr_t* dma) -{ - return dma->vAddr; -} - -static __inline unsigned long wan_dma_get_paddr(void* card, wan_dma_descr_t* dma) -{ - return wan_virt2bus(dma->vAddr); -} - - - - - -/********************** WANPIPE TIMER FUNCTION **************************/ - - -static __inline int wan_getcurrenttime(unsigned long *sec, unsigned long *usec) -{ -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - struct timeval tv; - microtime(&tv); - if (sec) *sec = tv.tv_sec; - if (usec) *usec = tv.tv_usec; - return 0; -#elif defined(__WINDOWS__) - LARGE_INTEGER tv; - NdisGetCurrentSystemTime(&tv); - if (sec) *sec = (unsigned long)tv.QuadPart; - return 0; -#elif defined(__LINUX__) - struct timeval tv; - do_gettimeofday(&tv); - if (sec) *sec = tv.tv_sec; - if (usec) *usec = tv.tv_usec; - return 0; -#else -# error "wan_getcurrenttime() function is not supported yet!" -#endif -} - -/* -** wan_init_timer -*/ -static __inline void -wan_init_timer(wan_timer_t* wan_timer, wan_timer_func_t timer_func, wan_timer_arg_t arg) -{ -#if defined(__LINUX__) - init_timer(&wan_timer->timer_info); - wan_timer->timer_info.function = timer_func; - wan_timer->timer_info.data = arg; -#elif defined(__FreeBSD__) - /* FIXME_ADSL_TIMER */ - callout_handle_init(&wan_timer->timer_info); - wan_timer->timer_func = timer_func; - wan_timer->timer_arg = arg; -#elif defined(__OpenBSD__) - timeout_set(&wan_timer->timer_info, timer_func, (void*)arg); - wan_timer->timer_func = timer_func; - wan_timer->timer_arg = arg; -#elif defined(__NetBSD__) - callout_init(&wan_timer->timer_info); - wan_timer->timer_func = timer_func; - wan_timer->timer_arg = arg; -#elif defined(__WINDOWS__) -#else -# error "wan_init_timer() function is not supported yet!" -#endif /* linux */ -} - -/* -** wan_del_timer -*/ -static __inline void -wan_del_timer(wan_timer_t* wan_timer) -{ -#if defined(__LINUX__) - if (!wan_timer->timer_info.function){ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s:%d Warning: WAN Timer del error: func=%p\n", - __FUNCTION__,__LINE__, - wan_timer->timer_info.function); - } - return; - } - del_timer(&wan_timer->timer_info); -#elif defined(__FreeBSD__) - untimeout(wan_timer->timer_func, - (void*)wan_timer->timer_arg, - wan_timer->timer_info); - callout_handle_init(&wan_timer->timer_info); -#elif defined(__OpenBSD__) - timeout_del(&wan_timer->timer_info); -#elif defined(__NetBSD__) - callout_stop(&wan_timer->timer_info); -#else -# error "wan_del_timer() function is not supported yet!" -#endif /* linux */ -} - -/* -** wan_add_timer -*/ -static __inline int -wan_add_timer(wan_timer_t* wan_timer, unsigned long delay) -{ -#if defined(__LINUX__) - if (timer_pending(&wan_timer->timer_info) || - !wan_timer->timer_info.function){ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s:%d Warning: WAN Timer add error: pending or func=%p\n", - __FUNCTION__,__LINE__, - wan_timer->timer_info.function); - } - return -EINVAL; - } - wan_timer->timer_info.expires = SYSTEM_TICKS + delay; - add_timer(&wan_timer->timer_info); -#elif defined(__FreeBSD__) - wan_timer->timer_info = - timeout(wan_timer->timer_func, - (void*)wan_timer->timer_arg, - delay); - WAN_ASSERT1(wan_timer->timer_info.callout == NULL); -#elif defined(__OpenBSD__) - timeout_add(&wan_timer->timer_info, delay); -#elif defined(__NetBSD__) - wan_timer->timer_info.c_time = delay; - callout_reset(&wan_timer->timer_info, - delay, - wan_timer->timer_func, - wan_timer->timer_arg); -#else -# error "wan_add_timer() function is not supported yet!" -#endif /* linux */ - return 0; -} - -/********************** WANPIPE KERNEL BUFFER **************************/ -/* -** wan_skb_data() - -** Returns pointer to data. -*/ -static __inline unsigned char* wan_skb_data(void* skb) -{ -#if defined(__LINUX__) - return ((struct sk_buff*)skb)->data; -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - return mtod((struct mbuf*)skb, caddr_t); -#elif defined(__SOLARIS__) - return ((netskb_t*)mp)->b_rptr; -#else -# error "wan_skb_data() function is not supported yet!" -#endif -} - -/* -** wan_skb_tail() - -** Returns pointer to data. -*/ -static __inline unsigned char* wan_skb_tail(void* skb) -{ -#if defined(__LINUX__) - return wan_skb_tail_pointer((struct sk_buff*)skb); -#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) - return mtod((struct mbuf*)skb, caddr_t) + ((struct mbuf*)skb)->m_len; -#elif defined(__SOLARIS__) - return ((netskb_t*)mp)->b_wptr; -#else -# error "wan_skb_tail() function is not supported yet!" -#endif -} - -/* -** wan_skb_append() - -** Returns pointer to data. -*/ -static __inline void wan_skb_append(void* skbprev, void *skb, void *list) -{ -#if defined(__LINUX__) -# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)) - skb_append(skbprev,skb); -# else - skb_append(skbprev,skb,list); -# endif -#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) - m_cat (skbprev, skb); -#else -# error "wan_skb_append() function is not supported yet!" -#endif -} - - - -/* -** wan_skb_len() - -** Returns current kernel buffer length. -*/ -static __inline int wan_skb_len(void* skb) -{ -#if defined(__LINUX__) - return ((struct sk_buff*)skb)->len; -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - return ((struct mbuf*)skb)->m_len; -#elif defined(__SOLARIS__) - mblk_t* tmp = skb; - int len = 0; - while(tmp) { - len += (tmp->b_wptr - tmp->b_rptr); - tmp = tmp->b_cont; - } - return len; -#else -# error "wan_skb_len() function is not supported yet!" -#endif -} - -/* -** wan_skb_free() - -** Free kernel memory buffer. -*/ -static __inline void wan_skb_free(void* skb) -{ -#if defined(__LINUX__) -#if defined(WAN_DEBUG_MEM) - DEBUG_SUB_MEM(((struct sk_buff*)skb)->truesize); -#endif - dev_kfree_skb_any(skb); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - m_freem(skb); -#elif defined(__SOLARIS__) - freemsg(skb); -#else -# error "wan_skb_free() function is not supported yet!" -#endif -} - -/* -** wan_skb_set_mark() - -** Set mark for skb. -*/ -static __inline void wan_skb_set_mark(void* pskb) -{ -#if defined(__LINUX__) - return; -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - ((netskb_t*)pskb)->m_flags |= WAN_MFLAG_PRV; -#endif - return; -} - -/* -** wan_skb_clear_mark() - -** Clear mark from skb. -*/ -static __inline void wan_skb_clear_mark(void* pskb) -{ -#if defined(__LINUX__) - return; -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - ((netskb_t*)pskb)->m_flags &= ~WAN_MFLAG_PRV; -#endif - return; -} - -/* -** wan_skb_mark() - -** Return 1 if mark is set, otherwise 0. -*/ -static __inline int wan_skb_mark(void* pskb) -{ -#if defined(__LINUX__) - return 0; -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - return (((netskb_t*)pskb)->m_flags & WAN_MFLAG_PRV); -#endif - return 0; -} - -/* -** wan_skb_alloc() - -** Allocate kernel buffer with len. -*/ -static __inline void* wan_skb_alloc(unsigned int len) -{ -#if defined(__LINUX__) -#if defined(WAN_DEBUG_MEM) - struct sk_buff *skb=dev_alloc_skb(len); - if (skb){ - DEBUG_ADD_MEM(skb->truesize); - } - return (void*)skb; -#else - return (void*)dev_alloc_skb(len); -#endif -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - struct mbuf *new = NULL; - - if (len){ - MGETHDR(new, M_DONTWAIT, MT_DATA); - }else{ - MGET(new, M_DONTWAIT, MT_DATA); - } - if (new){ - if (new->m_flags & M_PKTHDR){ - new->m_pkthdr.len = 0; - } - new->m_len = 0; - MCLGET(new, M_DONTWAIT); - if ((new->m_flags & M_EXT) == 0){ - wan_skb_free(new); - return NULL; - } - /* Always reserve extra 16 bytes (as Linux) - ** for the header */ - new->m_data += 16; - wan_skb_set_mark(new); - return (void*)new; - } - return NULL; -#elif defined (__SOLARIS__) - mblk_t *mp=allocb(ROUNDUP(len+16, IOC_LINESIZE), BPRI_MED); - if (mp){ - caddr_t ptr= (caddr_t) ROUNDUP((long)mp->b_rptr, 1); - mp->b_rptr=(uchar_t *)ptr+16; - } - return mp; -#else -# error "wan_skb_alloc() function is not supported yet!" -#endif -} - -static __inline void* wan_skb_kalloc(unsigned int len) -{ -#if defined(__LINUX__) -#if defined(WAN_DEBUG_MEM) - struct sk_buff *skb=__dev_alloc_skb(len,GFP_KERNEL); - if (skb){ - DEBUG_ADD_MEM(skb->truesize); - } - return (void*)skb; -#else - return (void*)__dev_alloc_skb(len,GFP_KERNEL); -#endif -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - struct mbuf *new = NULL; - - if (len){ - MGETHDR(new, M_DONTWAIT, MT_DATA); - }else{ - MGET(new, M_DONTWAIT, MT_DATA); - } - if (new){ - if (new->m_flags & M_PKTHDR){ - new->m_pkthdr.len = 0; - } - new->m_len = 0; - MCLGET(new, M_DONTWAIT); - if ((new->m_flags & M_EXT) == 0){ - wan_skb_free(new); - return NULL; - } - /* Always reserve extra 16 bytes (as Linux) - ** for the header */ - new->m_data += 16; - wan_skb_set_mark(new); - return (void*)new; - } - return NULL; -#elif defined (__SOLARIS__) - mblk_t *mp=allocb(ROUNDUP(len+16, IOC_LINESIZE), BPRI_MED); - if (mp){ - caddr_t ptr= (caddr_t) ROUNDUP((long)mp->b_rptr, 1); - mp->b_rptr=(uchar_t *)ptr+16; - } - return mp; -#else -# error "wan_skb_kalloc() function is not supported yet!" -#endif -} - - -/* -** wan_skb_set_dev() - -** Set device point. -*/ -static __inline void wan_skb_set_dev(void* pskb, void* dev) -{ -#if defined(__LINUX__) - struct sk_buff *skb = (struct sk_buff*)pskb; - if (skb){ - skb->dev = dev; - } -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - netskb_t* m = (netskb_t*)pskb; - if (m){ - m->m_pkthdr.rcvif = dev; - } -#else -# error "wan_skb_set_dev() function is not supported yet!" -#endif -} - -static __inline void wan_skb_set_protocol(void* pskb, unsigned int protocol) -{ -#if defined(__LINUX__) - struct sk_buff *skb = (struct sk_buff*)pskb; - if (skb){ - skb->protocol = htons(protocol); - } -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - struct mbuf *mbuf = (struct mbuf*)pskb; - if (protocol == ETH_P_IPX){ - mbuf->m_flags |= M_PROTO1; - } -#else - -# warning "wan_skb_set_protocol() function is not supported yet!" -#endif -} - -static __inline void wan_skb_set_raw(void* pskb) -{ -#if defined(__LINUX__) - struct sk_buff *skb = (struct sk_buff*)pskb; - if (skb){ - wan_skb_reset_mac_header(skb); - wan_skb_reset_network_header(skb); - } -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -#else -# warning "wan_skb_set_raw() function is not supported yet!" -#endif -} - - - -/* -** wan_skb_set_csum() - -** Set checksum. -*/ -static __inline void wan_skb_set_csum(void* skb, unsigned int csum) -{ -#if defined(__LINUX__) - struct sk_buff *sk = (struct sk_buff*)skb; - if (sk){ - sk->csum = csum; - } -#elif defined(__OpenBSD__) - netskb_t* m = (netskb_t*)skb; - if (m){ -# if (OpenBSD >= 200511) - m->m_pkthdr.csum_flags = csum; -# else - m->m_pkthdr.csum = csum; -# endif - } -#elif defined(__NetBSD__) || defined(__FreeBSD__) - netskb_t* m = (netskb_t*)skb; - if (m){ - m->m_pkthdr.csum_data = csum; - } -#else -# error "wan_skb_set_csum() function is not supported yet!" -#endif -} - -/* -** wan_skb_csum() - -** Return checksum value. -*/ -static __inline unsigned int wan_skb_csum(void* skb) -{ -#if defined(__LINUX__) - struct sk_buff *sk = (struct sk_buff*)skb; - return (sk) ? sk->csum : 0; -#elif defined(__NetBSD__) || defined(__FreeBSD__) - netskb_t* m = (netskb_t*)skb; - return (m) ? m->m_pkthdr.csum_data : 0; -#elif defined(__OpenBSD__) - netskb_t* m = (netskb_t*)skb; -# if (OpenBSD >= 200511) - return (m) ? m->m_pkthdr.csum_flags : 0; -# else - return (m) ? m->m_pkthdr.csum : 0; -# endif -#else -# error "wan_skb_set_dev() function is not supported yet!" -#endif -} - -/* -** wan_skb_check() - -** Check if packet consists from one skb block. -*/ -static __inline int wan_skb_check(void* skb) -{ -#if defined(__LINUX__) - return 0; -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - netskb_t* m = (netskb_t*)skb; - if (m->m_pkthdr.len != m->m_len){ - return 1; - } - return 0; -#else -# error "wan_skb_check() function is not supported yet!" -#endif -} - -/* -** wan_skb_reserve() - -** Reserve extra bytes before data -*/ -static __inline void wan_skb_reserve(void* skb, unsigned int len) -{ -#if defined(__LINUX__) - skb_reserve(skb, len); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - struct mbuf *m = (struct mbuf*)skb; - - m->m_data += len; -#else -# error "wan_skb_free() function is not supported yet!" -#endif -} - -/* -** wan_skb_copyback() - -** Copy data from a buffer back into the indicated mbuf chain, -** starting "off" bytes from the beginning, extending the mbuf -** chain if necessary. -*/ -static __inline void wan_skb_copyback(void* skb, int off, int len, caddr_t cp) -{ -#if defined(__LINUX__) - struct sk_buff* sk = (struct sk_buff*)skb; - unsigned char* data = NULL; - if (off == wan_skb_len(skb)){ - if (wan_skb_tail_pointer(sk) + len > wan_skb_end_pointer(sk)){ - DEBUG_EVENT("wan_skb_copyback: Internal Error (off=%d,len=%d,skb_len=%d)!\n", - off, len, wan_skb_len(skb)); - return; - }else{ - data = skb_put(skb, len); - memcpy(data, cp, len); - } - }else{ - if (off + len > wan_skb_len(skb)){ - data = skb_put(skb, len); - memcpy(data + off, cp, len); - skb_trim(skb, off + len); - } - } -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - struct mbuf* m = (struct mbuf*)skb; - caddr_t data = mtod(m, caddr_t); - - bcopy(cp, &data[off], len); - m->m_len = off + len; - m->m_pkthdr.len = off + len; -#else -# error "wan_skb_copyback() function is not supported yet!" -#endif -} - -/* -** wan_skb_copyback_user() - -** Copy data from a buffer back into the indicated mbuf chain, -** starting "off" bytes from the beginning, extending the mbuf -** chain if necessary. -** Data being copied is coming from user space, thus we must -** use a special function to copy it into kernel space. -*/ -static __inline int wan_skb_copyback_user(void* skb, int off, int len, caddr_t cp) -{ -#if defined(__LINUX__) - struct sk_buff* sk = (struct sk_buff*)skb; - unsigned char* data = NULL; - if (off == wan_skb_len(skb)){ - if (wan_skb_tail_pointer(sk) + len > wan_skb_end_pointer(sk)){ - DEBUG_EVENT("wan_skb_copyback_user: Internal Error (off=%d,len=%d,skb_len=%d)!\n", - off, len, wan_skb_len(skb)); - return -EINVAL; - }else{ - data = skb_put(skb, len); - if (WAN_COPY_FROM_USER(data, cp, len)){ - DEBUG_EVENT("wan_skb_copyback_user: Internal Error (off=%d,len=%d,skb_len=%d)!\n", - off, len, wan_skb_len(skb)); - return -EFAULT; - } - } - }else{ - if (off + len > wan_skb_len(skb)){ - data = skb_put(skb, len); - if (WAN_COPY_FROM_USER(data+off, cp, len)){ - DEBUG_EVENT("wan_skb_copyback_user: Internal Error (off=%d,len=%d,skb_len=%d)!\n", - off, len, wan_skb_len(skb)); - return -EFAULT; - } - skb_trim(skb, off + len); - } - } - return 0; -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - struct mbuf* m = (struct mbuf*)skb; - caddr_t data = mtod(m, caddr_t); - - WAN_COPY_FROM_USER(cp, &data[off], len); - m->m_len = off + len; - m->m_pkthdr.len = off + len; -#else -# error "wan_skb_copyback_user() function is not supported yet!" -#endif - return 0; -} - - -/* -** wan_skb_copyback() - -** Copy data from an mbuf chain starting "off" bytes from the beginning, -** continuing for "len" bytes, into the indicated buffer. -*/ -static __inline void wan_skb_copydata(void* skb, int off, int len, caddr_t cp) -{ -#if defined(__LINUX__) - if (off + len > wan_skb_len(skb)){ - DEBUG_EVENT("wan_skb_copydata: Internal error (off=%d, len=%d, skb_len=%d)!\n", - off, len, wan_skb_len(skb)); - return; - } - memcpy(cp, wan_skb_data(skb), len); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - caddr_t data = mtod((struct mbuf*)skb, caddr_t); - - bcopy(cp, &data[off], len); -#elif defined(__SOLARIS__) - mblk_t* tmp = (mblk_t*)skb; - unsigned char* ptr = NULL; - unsigned i = 0, num = 0; - while(tmp != NULL) { - ptr = tmp->b_rptr; - num = tmp->b_wptr - tmp->b_rptr; - bcopy(ptr, &cp[i], num); - i += num; - tmp = tmp->b_cont; - } -#else -# error "wan_skb_copydata() function is not supported yet!" -#endif -} - -/* -** wan_skb_copy() -*/ -static __inline void * wan_skb_copy(void *skb) -{ -#if defined(__LINUX__) - return skb_copy(skb,GFP_ATOMIC); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - return m_copym(skb, 0, wan_skb_len(skb), M_DONTWAIT); -#else -# error "wan_skb_copy() function is not supported yet" -#endif - -} - -/* -** wan_skb_clone() -*/ -static __inline void * wan_skb_clone(void *skb) -{ -#if defined(__LINUX__) - return skb_clone(skb,GFP_ATOMIC); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - return m_copym(skb, 0, wan_skb_len(skb), M_DONTWAIT); -#else -# error "wan_skb_clone() function is not supported yet" -#endif - -} - - - - - -/* -** wan_skb2buffer() - -** Correct skb block. -*/ -static __inline int wan_skb2buffer(void** skb) -{ -#if defined(__LINUX__) - return 0; -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - netskb_t *m = (netskb_t*)(*skb); - netskb_t *new = NULL; - - new = wan_skb_alloc(0); - if (new){ - struct mbuf *tmp = m; - char *buffer = new->m_data; - - for( ; tmp; tmp = tmp->m_next) { - bcopy(mtod(tmp, caddr_t), buffer, tmp->m_len); - buffer += tmp->m_len; - new->m_len += tmp->m_len; - } - wan_skb_free(m); - *skb = new; - return 0; - } - return -EINVAL; -#else -# error "wan_skb_correct() function is not supported yet!" -#endif -} - -/* -** wan_skb_pull() - -** -*/ -static __inline unsigned char* wan_skb_pull(void* skb, int len) -{ -#if defined(__LINUX__) - return skb_pull((struct sk_buff*)skb, len); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - m_adj(skb, len); -#if 0 - struct mbuf* m = (struct mbuf*)skb; - m->m_data += len; - m->m_pkthdr.len -= len; - m->m_len = m->m_pkthdr.len; -#endif - return wan_skb_data(skb); -#else -# error "wan_skb_pull() function is not supported yet!" -#endif -} - -/* -** wan_skb_put() - -** -*/ -static __inline unsigned char* wan_skb_put(void* skb, int len) -{ -#if defined(__LINUX__) - return skb_put((struct sk_buff*)skb, len); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - struct mbuf* m = (struct mbuf*)skb; - int org_len = wan_skb_len(skb); - unsigned char* data = wan_skb_data(skb); - - m->m_len = org_len + len; - m->m_pkthdr.len = org_len + len; -/*Alex Sep27,2004 last tail but not data pointer return wan_skb_data(skb);*/ - return data + org_len; -#elif defined(__SOLARIS__) - mblk_t mp=(mblk_t*)skb; - unsigned char *wptr=mp->b_wptr; - mp->b_wptr += len; - return mp->b_wptr; -#else -# error "wan_skb_put() function is not supported yet!" -#endif -} - -/* -** wan_skb_push() - -** -*/ -static __inline unsigned char* wan_skb_push(void* skb, int len) -{ -#if defined(__LINUX__) - return skb_push((struct sk_buff*)skb, len); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - struct mbuf *m = (struct mbuf*)skb; - int org_len = wan_skb_len(skb); - - if (m->m_flags & M_EXT){ - if ((m->m_data - len) < m->m_ext.ext_buf){ - DEBUG_EVENT("Can't push %d bytes!\n", len); - return wan_skb_data(skb); - } - }else{ - if ((m->m_data - len) < m->m_pktdat){ - DEBUG_EVENT("Can't push %d bytes!\n", len); - return wan_skb_data(skb); - } - } - m->m_data -= len; - m->m_len = org_len + len; - m->m_pkthdr.len = org_len + len; - return wan_skb_data(skb); -#else -# error "wan_skb_push() function is not supported yet!" -#endif -} - - - - -/* -** wan_skb_tailroom() - Tail room -** -** -*/ -static __inline int wan_skb_tailroom(void* skb) -{ -#if defined(__LINUX__) - return skb_tailroom(skb); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - struct mbuf* m = (struct mbuf*)skb; - - if (m->m_flags & M_EXT){ - return (MCLBYTES - m->m_len); - } - return (MHLEN - m->m_len); -#else -# error "wan_skb_tailroom() function is not supported yet!" -#endif -} - -/* -** wan_skb_tailroom() - Head room -** -** -*/ -static __inline int wan_skb_headroom(void* skb) -{ -#if defined(__LINUX__) - return skb_headroom(skb); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - struct mbuf* m = (struct mbuf*)skb; - - if (m->m_flags & M_EXT){ - return (m->m_data - m->m_ext.ext_buf); - } - return (m->m_data - m->m_pktdat); -#else -# error "wan_skb_headroom() function is not supported yet!" -#endif -} - - - -/* -** wan_skb_trim() - Trim from tail -** -** -*/ -static __inline void wan_skb_trim(void* skb, unsigned int len) -{ -#if defined(__LINUX__) - skb_trim(skb, len); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - struct mbuf* m = (struct mbuf*)skb; -#if 0 - /* Trim only moves tail to head+len (Oct13) */ - if (len == 0){ - m->m_data = m->m_ext.ext_buf; - } -#endif - m->m_pkthdr.len = len; - m->m_len = m->m_pkthdr.len; -#else -# error "wan_skb_trim() function is not supported yet!" -#endif -} - -/* -** wan_skb_init() - Setup skb data ptr -** -** -*/ -static __inline void wan_skb_init(void* pskb, unsigned int len) -{ -#if defined(__LINUX__) - struct sk_buff* skb = (struct sk_buff*)pskb; - skb->data = skb->head + len; - wan_skb_reset_tail_pointer(skb); - skb->len = 0; - skb->data_len = 0; -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - struct mbuf* m = (struct mbuf*)pskb; - m->m_data = m->m_ext.ext_buf + len; -#else -# error "wan_skb_init() function is not supported yet!" -#endif -} - -static __inline int wan_skb_print(void* skb) -{ -#if defined(__LINUX__) - int len = wan_skb_len(skb); - unsigned char *data = wan_skb_data(skb); - int i; - - DEBUG_EVENT("DBG Packet %d bytes: ",len); - for(i=0;im_pkthdr.len, i; - unsigned char *data = wan_skb_data(skb); - - if (m->m_type & M_PKTHDR) - DEBUG_EVENT("M_PKTHDR flag set (%d)!\n", - m->m_pkthdr.len); - if (m->m_type & M_EXT) - DEBUG_EVENT("M_EXT flag set (%d)!\n", - m->m_pkthdr.len); - DEBUG_EVENT("Packet %d bytes: ", len); - for(i=0;i= '0') && (ifname[len] <= '9')){ - if (!base){ - int i=0; - base = 1; - for(i=0;i= 502000) - if_initname(dev, ifname, IF_DUNIT_NONE); -# else - dev->if_unit = ifunit; - if (dev->if_name == NULL){ - dev->if_name = wan_malloc(prefix_len+1); - if (dev->if_name == NULL){ - return -ENOMEM; - } - } - memcpy(dev->if_name, ifname, prefix_len); - dev->if_name[prefix_len] = '\0'; -# endif - WAN_IFQ_SET_MAXLEN(&dev->if_snd, ifqmaxlen); -#elif defined(__OpenBSD__) || defined(__NetBSD__) - if (strlen(ifname) >= IFNAMSIZ){ - return -ENOMEM; - } - bcopy(ifname, dev->if_xname, strlen(ifname)); - WAN_IFQ_SET_MAXLEN(&dev->if_snd, IFQ_MAXLEN); -#elif defined(__LINUX__) -# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,43)) - dev->name = ifname; -# else - strcpy(dev->name, ifname); -# endif -#else -# error "wan_netif_init() function is not supported yet!" -#endif - return 0; -} - -static __inline int wan_netif_del(netdevice_t* dev) -{ - WAN_ASSERT(dev == NULL); -#if defined(__FreeBSD__) - dev->if_init = NULL; -# if (__FreeBSD_version >= 502000) - dev->if_dname = NULL; -# elif (__FreeBSD_version > 400000) - /* Free interface name (only for FreeBSD-4.0) */ - free(dev->if_name, M_DEVBUF); -# endif -#elif defined(__OpenBSD__) || defined(__NetBSD__) - /* Do nothing */ -#elif defined(__LINUX__) - /* Do nothing */ -#else -# error "wan_netif_del() function is not supported yet!" -#endif - return 0; -} - - -#if defined(__LINUX__) -static __inline void wan_netif_fake_init(netdevice_t *d) -{ - -#ifdef LINUX_FEAT_2624 - d->hard_header = NULL; - d->rebuild_header = NULL; - d->header_cache_update = NULL; - d->hard_header_cache = NULL; -#else - d->header_ops = NULL; -#endif - - return; -} -#endif - -static __inline void* -wan_netif_alloc(unsigned char *devname, int ifType, int *err) -{ -#if defined(__LINUX__) -# if defined(LINUX_2_6) -# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4)) - return __dev_alloc(devname, err); -# else - return alloc_netdev(0,devname,wan_netif_fake_init); -# endif -# elif defined(LINUX_2_4) - netdevice_t *dev=wan_malloc(sizeof(netdevice_t)); - *err=0; - - if (!dev){ - *err=-ENOMEM; - } - memset(dev, 0, sizeof(netdevice_t)); - - strncpy(dev->name,devname,30); - return dev; -# else - netdevice_t *dev=wan_malloc(sizeof(netdevice_t)); - *err=0; - - if (!dev){ - *err=-ENOMEM; - } - memset(dev, 0, sizeof(netdevice_t)); - - dev->name=wan_malloc(35); - if (!dev->name){ - wan_free(dev); - dev=NULL; - *err=-ENOMEM; - return NULL; - } - strncpy(dev->name,devname,30); - return dev; -# endif -#elif defined(__FreeBSD__) && (__FreeBSD_version > 600000) - struct ifnet* ifp; - ifp = IFALLOC(ifType); - /*ifp = wan_malloc(sizeof(struct ifnet));*/ - if (ifp == NULL){ - *err = -ENOMEM; - return NULL; - } - if (devname){ - *err = wan_netif_init(ifp, devname); - if (*err){ - wan_netif_del(ifp); - return NULL; - } - } - return ifp; -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - struct ifnet* ifp; - switch(ifType){ - case WAN_IFT_PPP: - ifp = (struct ifnet*)wan_malloc(sizeof(struct sppp)); - if (ifp) bzero((struct sppp*)ifp, sizeof(struct sppp)); - break; - case WAN_IFT_ETHER: - ifp = (struct ifnet*)wan_malloc(sizeof(wan_ethercom_t)); - if (ifp) bzero(WAN_IFP2AC(ifp), sizeof(wan_ethercom_t)); - break; - case WAN_IFT_OTHER: - default: - ifp = wan_malloc(sizeof(struct ifnet)); - if (ifp) bzero(ifp, sizeof(struct ifnet)); - break; - } - /*ifp = IFALLOC(ifType);*/ - /*ifp = wan_malloc(sizeof(struct ifnet));*/ - if (ifp == NULL){ - *err = -ENOMEM; - return NULL; - } - if (devname){ - *err = wan_netif_init(ifp, devname); - if (*err){ - wan_netif_del(ifp); - return NULL; - } - } - return ifp; -#else -# error "wan_netif_alloc() unsupported" -#endif - -} - -static __inline void wan_netif_free(netdevice_t *dev) -{ - -#if defined(__LINUX__) -# if defined(LINUX_2_6) - free_netdev(dev); -# elif defined(LINUX_2_4) - wan_free(dev); -# else - if (dev->name){ - wan_free(dev->name); - dev->name=NULL; - } - wan_free(dev); -# endif -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - wan_netif_del(dev); - IFFREE(dev); /*wan_free(dev);*/ -#else -#error "wan_netif_free() not supported!" -#endif - -} - - -static __inline char* wan_netif_name(netdevice_t* dev) -{ - static char ifname[IFNAMSIZ+1]; - WAN_ASSERT2(dev == NULL, NULL); -#if defined(__LINUX__) - strcpy(ifname, dev->name); -#elif defined(__FreeBSD__) -# if (__FreeBSD_version >= 502000) - strcpy(ifname, dev->if_xname); -# else - sprintf(ifname, "%s%d", dev->if_name, dev->if_unit); -# endif -#elif defined(__OpenBSD__) || defined(__NetBSD__) - sprintf(ifname, "%s", dev->if_xname); -#else -# error "wan_get_ifname() function is not supported yet!" -#endif - return ifname; -} - -static __inline void* wan_netif_priv(netdevice_t* dev) -{ - WAN_ASSERT2(dev == NULL, NULL); -#if defined(__LINUX__) - return dev->priv; -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - return dev->if_softc; -#else -# error "wan_netif_priv() function is not supported yet!" -#endif -} - -static __inline int wan_netif_up(netdevice_t* dev) -{ - WAN_ASSERT2(dev == NULL, -EINVAL); -#if defined(__LINUX__) - return WAN_NETIF_UP(dev); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - return WAN_NETIF_UP(dev); -#else -# error "wan_netif_up() function is not supported yet!" -#endif -} - - -static __inline void wan_netif_set_priv(netdevice_t* dev, void* priv) -{ - WAN_ASSERT1(dev == NULL); -#if defined(__LINUX__) - dev->priv = priv; -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - dev->if_softc = priv; -#else -# error "wan_netif_priv() function is not supported yet!" -#endif - return; -} - -static __inline short wan_netif_flags(netdevice_t* dev) -{ - WAN_ASSERT(dev == NULL); -#if defined(__LINUX__) - return dev->flags; -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - return dev->if_flags; -#else -# error "wan_netif_flags() function is not supported yet!" -#endif -} - -static __inline int wan_netif_mcount(netdevice_t* dev) -{ -#if defined(__LINUX__) - return dev->mc_count; -#elif defined(__FreeBSD__) - return dev->if_amcount; -#elif defined(__OpenBSD__) || defined(__NetBSD__) - return 0; -#else -# error "wan_netif_mcount() function is not supported yet!" -#endif -} - -static __inline int wan_netif_set_ticks(netdevice_t* dev, unsigned long ticks) -{ -#if defined(__LINUX__) - dev->trans_start = ticks; -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -#else -# error "wan_netif_set_ticks() function is not supported yet!" -#endif - return 0; -} - -static __inline int wan_netif_set_mtu(netdevice_t* dev, unsigned long mtu) -{ -#if defined(__LINUX__) -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - dev->if_mtu = mtu; -#else -# error "wan_netif_set_mtu() function is not supported yet!" -#endif - return 0; -} - - -static __inline void -wan_bpf_report(netdevice_t* dev, void* pkt, int flag, int dir) -{ - -#if defined(__LINUX__) - /* Do nothing */ -#elif defined(__FreeBSD__) - if (dev->if_bpf != NULL){ /* BF-0002 */ - WAN_BPF_REPORT(dev, pkt); - } -#elif defined(__OpenBSD__) || defined(__NetBSD__) - if (dev->if_bpf != NULL){ /* BF-0002 */ - if (flag){ - struct mbuf m0; - u_int32_t af = AF_INET; - m0.m_next = pkt; - m0.m_len = 4; - m0.m_data = (char*)⁡ - WAN_BPF_REPORT(dev, &m0, dir); - }else{ - WAN_BPF_REPORT(dev, pkt, dir); - } - } -#else -# error "wan_bpf_report() function is not supported yet!" -#endif -} - - - - - -static __inline void wan_spin_lock_init(void *lock) -{ -#if defined(__LINUX__) - spin_lock_init(((spinlock_t*)lock)); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - /*(*(wan_smp_flag_t*)flag) = 0;*/ -#else -# warning "wan_spin_lock_init() function is not supported yet!" -#endif -} - -static __inline int wan_spin_is_locked(void *lock) -{ -#if defined(__LINUX__) - return spin_is_locked((spinlock_t*)lock); -#elif defined(__NetBSD__) || defined(__OpenBSD__) - return 0;/*((*(wan_smp_flag_t*)flag) & imask[IPL_NET]);*/ -#elif defined(__FreeBSD__) -# if (__FreeBSD_version > 500000) - return 0; -# else - return 0;/*((*(wan_smp_flag_t*)flag) & net_imask);*/ -# endif -#else -# warning "wan_spin_is_lock() function is not supported yet!" -#endif -} - -static __inline void wan_spin_lock_irq(void *lock, wan_smp_flag_t *flag) -{ -#if defined(__LINUX__) - spin_lock_irqsave(((spinlock_t*)lock),*flag); -#elif defined(__FreeBSD__) - /* Feb 10, 2005 Change splnet to splimp - ** (i think it was cause to system crash) */ - *flag = splimp(); -#elif defined(__OpenBSD__) - *flag = splnet(); -#elif defined(__NetBSD__) -# if (__NetBSD_Version__ >= 106000200) - *flag = splvm(); -# else - *flag = splimp(); -# endif -#else -# warning "wan_spin_lock_irq() function is not supported yet!" -#endif -} -static __inline void wan_spin_unlock_irq(void *lock, wan_smp_flag_t *flag) -{ -#if defined(__LINUX__) - spin_unlock_irqrestore(((spinlock_t*)lock),*flag); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - splx(*flag); -#else -# warning "wan_spin_unlock_irq() function is not supported yet!" -#endif -} - -static __inline void wan_spin_lock(void *lock) -{ -#if defined(__LINUX__) - spin_lock(((spinlock_t*)lock)); -#elif defined(__FreeBSD__) - /* Feb 10, 2005 Change splnet to splimp - ** (i think it was cause to system crash) */ - *((wan_spinlock_t*)lock) = splimp(); -#elif defined(__OpenBSD__) - *((wan_spinlock_t*)lock) = splnet(); -#elif defined(__NetBSD__) -# if (__NetBSD_Version__ >= 106000200) - *((wan_spinlock_t*)lock) = splvm(); -# else - *((wan_spinlock_t*)lock) = splimp(); -# endif -#else -# warning "wan_spin_lock() function is not supported yet!" -#endif -} -static __inline void wan_spin_unlock(void *lock) -{ -#if defined(__LINUX__) - spin_unlock(((spinlock_t*)lock)); -#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - splx(*(wan_spinlock_t*)lock); -#else -# warning "wan_spin_unlock() function is not supported yet!" -#endif -} - - - -#if 0 -static __inline void wan_read_rw_lock(void *lock) -{ -#if defined(__LINUX__) - read_lock(((rwlock_t*)lock)); -#else -# warning "wan_read_rw_lock() function is not supported yet!" -#endif -} - -static __inline void wan_read_rw_unlock(void *lock) -{ -#if defined(__LINUX__) - read_unlock(((rwlock_t*)lock)); -#else -# warning "wan_read_rw_unlock() function is not supported yet!" -#endif -} - -static __inline void wan_write_rw_lock_irq(void *lock, unsigned long *flag) -{ -#if defined(__LINUX__) - write_lock_irqsave(((rwlock_t*)lock),flag); -#else -# warning "wan_read_rw_lock() function is not supported yet!" -#endif -} - -static __inline void wan_write_rw_unlock_irq(void *lock, unsigned long *flag) -{ -#if defined(__LINUX__) - write_unlock_irqrestore(((rwlock_t*)lock),flag); -#else -# warning "wan_read_rw_unlock() function is not supported yet!" -#endif -} -#endif - -#if 0 -static __inline void wan_read_bus_4(void *phw, void *virt, int offset, unsigned int *value) -{ -#if defined(__LINUX__) - *value = wp_readl((unsigned char*)virt + offset); -#else - sdla_bus_read_4(phw,offset,value); -#endif -} - -static __inline void wan_write_bus_4(void *phw, void *virt, int offset, unsigned int value) -{ -#if defined(__LINUX__) - wp_writel(value,(u8*)virt + offset); -#else - sdla_bus_write_4(phw,offset,value); -#endif -} -#endif - -#endif /* WAN_KERNEL */ -#endif /* __WANPIPE_COMMON_H */ diff --git a/patches/kdrivers/include/wanpipe_debug.h b/patches/kdrivers/include/wanpipe_debug.h index 990f8dd..ac22c60 100644 --- a/patches/kdrivers/include/wanpipe_debug.h +++ b/patches/kdrivers/include/wanpipe_debug.h @@ -19,6 +19,7 @@ #undef WAN_DEBUG_KERNEL #undef WAN_DEBUG_MOD #undef WAN_DEBUG_CFG +#undef WAN_DEBUG_REG #undef WAN_DEBUG_INIT_VAR #undef WAN_DEBUG_IOCTL #undef WAN_DEBUG_CMD @@ -39,24 +40,35 @@ #undef WAN_DEBUG_SNMP #undef WAN_DEBUG_TE3 #undef WAN_DEBUG_RM +#undef WAN_DEBUG_BRI #undef WAN_DEBUG_HWEC #undef WAN_DEBUG_TDMAPI #undef WAN_DEBUG_FE - +#undef WAN_DEBUG_NG #undef WAN_DEBUG_MEM +#undef WAN_DEBUG_BRI +#undef WAN_DEBUG_BRI_INIT +#undef WAN_DEBUG_FUNC #if defined (__WINDOWS__) -# define DEBUG_NONE if (0) DbgPrint -# define PRINT OutputLogString +void OutputLogString(PUCHAR pvFormat, ...); + +# define DEBUG_NONE +#if 1 +# define PRINT OutputLogString +#else +# define PRINT if(1)DbgPrint +#endif + # define DEBUG_PRINT DbgPrint -# define DEBUG_LIMIT DbgPrint # define _DEBUG_PRINT DbgPrint # define DEBUG_KERNEL DEBUG_NONE # define DEBUG_EVENT DEBUG_NONE # define DEBUG_MOD DEBUG_NONE # define DEBUG_CFG DEBUG_NONE +# define DEBUG_REG DEBUG_NONE # define DEBUG_INIT DEBUG_NONE # define DEBUG_IOCTL DEBUG_NONE # define DEBUG_CMD DEBUG_NONE @@ -71,6 +83,7 @@ # define DEBUG_TE1 DEBUG_NONE # define DEBUG_TE3 DEBUG_NONE # define DEBUG_56K DEBUG_NONE +# define DEBUG_BRI DEBUG_NONE # define DEBUG_PROCFS DEBUG_NONE # define DEBUG_TDMV DEBUG_NONE # define DEBUG_TEST DEBUG_NONE @@ -81,9 +94,11 @@ # define DEBUG_HWEC DEBUG_NONE # define DEBUG_TDMAPI DEBUG_NONE # define DEBUG_FE DEBUG_NONE +# define DEBUG_NG DEBUG_NONE # define WAN_DEBUG_FUNC_START DEBUG_NONE # define WAN_DEBUG_FUNC_END DEBUG_NONE # define WAN_DEBUG_FUNC_LINE DEBUG_NONE +# define DEBUG_BRI DEBUG_NONE # ifdef WAN_DEBUG_KERNEL # undef DEBUG_KERNEL @@ -101,6 +116,10 @@ # undef DEBUG_CFG # define DEBUG_CFG DEBUG_PRINT # endif +# ifdef WAN_DEBUG_REG +# undef DEBUG_REG +# define DEBUG_REG DEBUG_PRINT +# endif # ifdef WAN_DEBUG_INIT_VAR # undef DEBUG_INIT # define DEBUG_INIT DEBUG_PRINT @@ -155,6 +174,10 @@ # undef DEBUG_56K # define DEBUG_56K DEBUG_PRINT # endif +# ifdef WAN_DEBUG_BRI +# undef DEBUG_BRI +# define DEBUG_BRI DEBUG_PRINT +# endif # ifdef WAN_DEBUG_PROCFS # undef DEBUG_PROCFS # define DEBUG_PROCFS DEBUG_PRINT @@ -195,18 +218,107 @@ # undef DEBUG_TDMAPI # define DEBUG_TDMAPI DEBUG_PRINT # endif -# ifdef WAN_DEBUG_FE -# undef DEBUG_FE -# define DEBUG_FE DEBUG_PRINT +# ifdef WAN_DEBUG_NG +# undef DEBUG_NG +# define DEBUG_NG DEBUG_PRINT # endif +# ifdef WAN_DEBUG_BRI +# undef DEBUG_BRI +# define DEBUG_BRI DEBUG_PRINT +# endif +# ifdef WAN_DEBUG_BRI_INIT +# undef DEBUG_BRI_INIT +# define DEBUG_BRI_INIT DEBUG_PRINT +# endif + +# define DEBUG_ADD_MEM +# define DEBUG_SUB_MEM + +# define splimp() 0 +# define splx(l) + +#define ERR_DBG_OUT if(1)DbgPrint +#define DBG_NOT_IMPL if(0)DbgPrint +#define FUNC_NOT_IMPL if(0)DbgPrint("%s()-Not Implemented\n", __FUNCTION__); +#define DBG_DSL_NOT_IMPLD if(0)DbgPrint("%s()-Not Implemented\n", __FUNCTION__); + +/* debugging of wanpipe_kernel.h */ +#define DBG_KRN if(0)DbgPrint +#define DBG_8TE1 if(0)DbgPrint +#define DG_TDMCODEC if(0)DbgPrint +#define DBG_G3 if(0)DbgPrint + +#define DBG_FAST_TX if(0)DbgPrint +#define DBG_ACUAPI if(0)DbgPrint +#define DEBUG_IDLE_TX if(0)DbgPrint +#define DEBUG_SHARED_EVENT if(0)DbgPrint +#define DBG_ADSL_TX if(0)DbgPrint +#define DEBUG_NEW_TX if(0)DbgPrint +#define DBG_IRQLOCK if(0)DbgPrint +#define DBG_ADSL_FAST_TX if(0)DbgPrint +#define DBG_S514_INIT if(0)DbgPrint +#define DBG_SET_CFG if(0)DbgPrint +#define DBG_ADSL_INIT if(0)DbgPrint +#define DBG_HIGH_IMPED if(0)DbgPrint +#define DBG_LIP_OOB if(0)DbgPrint +#define DEBUG_AFT if(0)DbgPrint +#define DBG_TE1_INTERRUPT if(0)DbgPrint +#define DBG_BSTRM if(0)DbgPrint +#define DEBUG_FIRMWARE_UPDATE if(0)DbgPrint +#define DBG_ADSL_RX if(0)DbgPrint +#define DBG_8TE1_START if(0)DbgPrint +#define DBG_BITSTRM if(0)DbgPrint + +#define DBG_FE_LOCK if(0)DbgPrint + +/* sprotocol.sys */ +#define DEBUG_LIP if(0)DbgPrint +#define DBG_LIP_SKB if(0)DbgPrint +/* wanpipe.sys */ +#define DEBUG_REQUEST if(0)DbgPrint +#define DEBUG_IF_TX if(0)DbgPrint +#define DEBUG_COMMON if(0)DbgPrint +#define DEBUG_IF_RX if(0)DbgPrint +#define DEBUG_NET_IF if(0)DbgPrint + +/* These are defined in "sources" file of each driver */ +#if defined( VIRTUAL_IF_DRV ) + #define DRIVER_NAME "SDLADRV" +#elif defined( BUSENUM_DRV ) + #define DRIVER_NAME "SangBus" +#elif defined( NDIS_MINIPORT_DRIVER ) + #define DRIVER_NAME "WANPIPE" +#elif defined( SPROTOCOL ) + #define DRIVER_NAME "SPROTOCOL" +#endif + +#define DBG_BUFFER_LEN 512 + +static void my_func_dbg(char *drv_name, char *func, char *file, int line) +{ + DbgPrint("%s:%s(): File: %s, Line: %d.\n", drv_name, func, file, line); +} + +#define AFT_FUNC_DEBUG() if(0)my_func_dbg(DRIVER_NAME, __FUNCTION__, __FILE__, __LINE__) +#define TDM_FUNC_DBG() if(0)my_func_dbg(DRIVER_NAME, __FUNCTION__, __FILE__, __LINE__) +#define EC_FUNC_DEBUG() if(0)my_func_dbg(DRIVER_NAME, __FUNCTION__, __FILE__, __LINE__) +#define DBG_SET_CFG_FUNC() if(0)my_func_dbg(DRIVER_NAME, __FUNCTION__, __FILE__, __LINE__) +#define DBG_ACUAPI_FUNC() if(0)my_func_dbg(DRIVER_NAME, __FUNCTION__, __FILE__, __LINE__) +#define FUNC_DEBUG() if(0)my_func_dbg(DRIVER_NAME, __FUNCTION__, __FILE__, __LINE__) +#define TDM_FUNC_DBG() if(0)my_func_dbg(DRIVER_NAME, __FUNCTION__, __FILE__, __LINE__) +#define SKB_FUNC() if(0)my_func_dbg(DRIVER_NAME, __FUNCTION__, __FILE__, __LINE__) +#define PROT_FUNC_DEBUG() if(0)my_func_dbg(DRIVER_NAME, __FUNCTION__, __FILE__, __LINE__) #else /* !__WINDOWS__*/ +/* L I N U X */ + # define DEBUG_KERNEL(format,msg...) # define DEBUG_EVENT(format,msg...) # define DEBUG_MOD(format,msg...) # define DEBUG_CFG(format,msg...) +# define DEBUG_REG(format,msg...) # define DEBUG_INIT(format,msg...) # define DEBUG_IOCTL(format,msg...) # define DEBUG_CMD(format,msg...) @@ -221,6 +333,7 @@ # define DEBUG_TE1(format,msg...) # define DEBUG_TE3(format,msg...) # define DEBUG_56K(format,msg...) +# define DEBUG_BRI(format,msg...) # define DEBUG_PROCFS(format,msg...) # define DEBUG_TDMV(format,msg...) # define DEBUG_TEST(format,msg...) @@ -233,21 +346,21 @@ # define DEBUG_HWEC(format,msg...) # define DEBUG_TDMAPI(format,msg...) # define DEBUG_FE(format,msg...) +# define DEBUG_NG(format,msg...) # define WAN_DEBUG_FUNC_START # define WAN_DEBUG_FUNC_END # define WAN_DEBUG_FUNC_LINE +# define DEBUG_BRI(format,msg...) +# define DEBUG_BRI_INIT(format,msg...) # if (defined __FreeBSD__) || (defined __OpenBSD__) || defined(__NetBSD__) # define DEBUG_PRINT(format,msg...) log(LOG_INFO, format, ##msg) -# define DEBUG_LIMIT(format,msg...) log(LOG_INFO, format, ##msg) # define _DEBUG_PRINT(format,msg...) log(LOG_INFO, format, ##msg) # else /* !__FreeBSD__ && !__OpenBSD__ */ # define DEBUG_PRINT(format,msg...) printk(KERN_INFO format, ##msg) -# define DEBUG_LIMIT(format,msg...) printk(KERN_INFO format, ##msg) -//# define DEBUG_LIMIT(format,msg...) if (WAN_NET_RATELIMIT()) printk(KERN_INFO format, ##msg) # define _DEBUG_PRINT(format,msg...) printk(format,##msg) # endif /* __FreeBSD__ || __OpenBSD__ */ @@ -270,6 +383,10 @@ # undef DEBUG_CFG # define DEBUG_CFG(format,msg...) DEBUG_PRINT(format,##msg) # endif +# ifdef WAN_DEBUG_REG +# undef DEBUG_REG +# define DEBUG_REG(format,msg...) DEBUG_PRINT(format,##msg) +# endif # ifdef WAN_DEBUG_INIT_VAR # undef DEBUG_INIT # define DEBUG_INIT(format,msg...) DEBUG_PRINT(format,##msg) @@ -324,6 +441,10 @@ # undef DEBUG_56K # define DEBUG_56K(format,msg...) DEBUG_PRINT(format,##msg) # endif +# ifdef WAN_DEBUG_BRI +# undef DEBUG_BRI +# define DEBUG_BRI(format,msg...) DEBUG_PRINT(format,##msg) +# endif # ifdef WAN_DEBUG_PROCFS # undef DEBUG_PROCFS # define DEBUG_PROCFS(format,msg...) DEBUG_PRINT(format,##msg) @@ -340,19 +461,24 @@ # undef DEBUG_DBG # define DEBUG_DBG(format,msg...) DEBUG_PRINT(format,##msg) # endif + +#if 0 # ifdef WAN_DEBUG_MEM +/* This is not used any more */ # undef DEBUG_ADD_MEM -# define DEBUG_ADD_MEM(a) /*DEBUG_EVENT("%s:%d MEM ADDING %d\n",__FUNCTION__,__LINE__,a);*/(atomic_add(a,&wan_debug_mem)) +# define DEBUG_ADD_MEM(a) # undef DEBUG_SUB_MEM -# define DEBUG_SUB_MEM(a) /*DEBUG_EVENT("%s:%d MEM SUBSTR %d\n",__FUNCTION__,__LINE__,a);*/(atomic_sub(a,&wan_debug_mem)) +# define DEBUG_SUB_MEM(a) #endif +#endif + # ifdef WAN_DEBUG_DMA # undef DEBUG_DMA # define DEBUG_DMA(format,msg...) DEBUG_PRINT(format,##msg) # endif # ifdef WAN_DEBUG_SNMP # undef DEBUG_SNMP -# define DEBUG_SNMP(format,msg...) DEBUG_PRINT(format,##msg) +# define DEBUG_SNMP(format,msg...) DEBUG_PRINT(format,##msg) # endif # ifdef WAN_DEBUG_RM # undef DEBUG_RM @@ -364,13 +490,24 @@ # endif # ifdef WAN_DEBUG_TDMAPI # undef DEBUG_TDMAPI -# define DEBUG_TDMAPI(format,msg...) DEBUG_PRINT(format,##msg) +# define DEBUG_TDMAPI(format,msg...) DEBUG_PRINT(format,##msg) # endif # ifdef WAN_DEBUG_FE # undef DEBUG_FE # define DEBUG_FE(format,msg...) DEBUG_PRINT(format,##msg) # endif - +# ifdef WAN_DEBUG_BRI +# undef DEBUG_BRI +# define DEBUG_BRI(format,msg...) DEBUG_PRINT(format,##msg) +# endif +# ifdef WAN_DEBUG_BRI_INIT +# undef DEBUG_BRI_INIT +# define DEBUG_BRI_INIT(format,msg...) DEBUG_PRINT(format,##msg) +# endif +# ifdef WAN_DEBUG_NG +# undef DEBUG_NG +# define DEBUG_NG(format,msg...) DEBUG_PRINT(format,##msg) +# endif #endif /* __WINDOWS__ */ @@ -379,14 +516,18 @@ #if defined(WAN_DEBUG_FUNC) # undef WAN_DEBUG_FUNC_START -# define WAN_DEBUG_FUNC_START DEBUG_EVENT("[%s]: %s:%d: Start (%ld)\n",\ - __FILE__,__FUNCTION__,__LINE__, SYSTEM_TICKS); +# define WAN_DEBUG_FUNC_START DEBUG_EVENT("[%s]: %s:%d: Start (%d)\n",\ + __FILE__,__FUNCTION__,__LINE__, (unsigned int)SYSTEM_TICKS); # undef WAN_DEBUG_FUNC_END -# define WAN_DEBUG_FUNC_END DEBUG_EVENT("[%s]: %s:%d: End (%ld)\n", \ - __FILE__,__FUNCTION__,__LINE__,SYSTEM_TICKS); +# define WAN_DEBUG_FUNC_END DEBUG_EVENT("[%s]: %s:%d: End (%d)\n", \ + __FILE__,__FUNCTION__,__LINE__,(unsigned int)SYSTEM_TICKS); # undef WAN_DEBUG_FUNC_LINE -# define WAN_DEBUG_FUNC_LINE DEBUG_EVENT("[%s]: %s:%d: (%ld)\n", \ - __FILE__,__FUNCTION__,__LINE__,SYSTEM_TICKS); +# define WAN_DEBUG_FUNC_LINE DEBUG_EVENT("[%s]: %s:%d: (%d)\n", \ + __FILE__,__FUNCTION__,__LINE__,(unsigned int)SYSTEM_TICKS); + +#define BRI_FUNC() if(1)DEBUG_EVENT("%s(): line:%d\n", __FUNCTION__, __LINE__) +#else +#define BRI_FUNC() #endif #define WAN_ASSERT(val) if (val){ \ @@ -425,6 +566,29 @@ } +#if defined(__FreeBSD__) +# ifndef WAN_SKBDEBUG +# define WAN_SKBDEBUG 0 +# endif +# define WAN_SKBCRITASSERT(mm) if (WAN_SKBDEBUG){ \ + if ((mm) == NULL){ \ + panic("%s:%d: MBUF is NULL!\n", \ + __FUNCTION__,__LINE__); \ + } \ + if (((mm)->m_flags & (M_PKTHDR|M_EXT)) != (M_PKTHDR|M_EXT)){ \ + panic("%s:%d: Invalid MBUF m_flags=%X (m=%p)\n", \ + __FUNCTION__,__LINE__, \ + (mm)->m_flags,(mm)); \ + } \ + if ((unsigned long)(mm)->m_data < 0x100){ \ + panic("%s:%d: Invalid MBUF m_data=%p (m=%p)\n", \ + __FUNCTION__,__LINE__, \ + (mm)->m_data,(mm)); \ + } \ +} +#else +# define WAN_SKBCRITASSERT(mm) +#endif #define WAN_MEM_INIT(id) unsigned long mem_in_used_##id = 0x0l #define WAN_MEM_INC(id,size) mem_in_used_##id += size diff --git a/patches/kdrivers/include/wanpipe_defines.h b/patches/kdrivers/include/wanpipe_defines.h index 465205a..cdb162a 100644 --- a/patches/kdrivers/include/wanpipe_defines.h +++ b/patches/kdrivers/include/wanpipe_defines.h @@ -1,16 +1,17 @@ - -/* - ************************************************************************ - * wanpipe_defines.h * - * WANPIPE(tm) Global definition for Sangoma * - * Mailbox/API/UDP structures. * - * * - * Author: Alex Feldman * - *======================================================================* - * May 10 2002 Alex Feldman Initial version * - * * - ************************************************************************ - */ +/************************************************************************* +* wanpipe_defines.h * +* WANPIPE(tm) Global definition for Sangoma * +* Mailbox/API/UDP structures. * +* * +* Author: Alex Feldman * +*========================================================================* +* May 10, 2002 Alex Feldman Initial version * +* * +* Nov 27, 2007 David Rokhvarg Implemented functions/definitions for * +* Sangoma MS Windows Driver and API. * +* * +* * +*************************************************************************/ #ifndef __WANPIPE_DEFINES_H # define __WANPIPE_DEFINES_H @@ -27,11 +28,21 @@ #if defined(__LINUX__) # include # include +# include #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) # include # if defined(WAN_KERNEL) # include # endif +# include +#elif defined(__WINDOWS__) +# include +# include /* Basic data types */ +# include +# if defined(WAN_KERNEL) +# include +# endif +# include #endif /************************************************ @@ -117,12 +128,6 @@ # define WANPIPE_SUB_VERSION WANPIPE_SUB_VERSION_NetBSD # define WANPIPE_LITE_VERSION WANPIPE_LITE_VERSION_NetBSD #elif defined(__WINDOWS__) -# undef WANPIPE_VERSION -# undef WANPIPE_VERSION_BETA -# undef WANPIPE_SUB_VERSION -# define WANPIPE_VERSION WANPIPE_VERSION_Windows -# define WANPIPE_VERSION_BETA WANPIPE_VERSION_BETA_Windows -# define WANPIPE_SUB_VERSION WANPIPE_SUB_VERSION_Windows #endif #define WANROUTER_MAJOR_VER 2 @@ -186,8 +191,41 @@ typedef struct tcphdr tcphdr_t; # define w_tcp_seq th_seq # define w_tcp_ack_seq th_ack #elif defined(__WINDOWS__) -typedef void* iphdr_t; -typedef void* udphdr_t; +/* Intel X86 */ +#define __LITTLE_ENDIAN_BITFIELD + +struct iphdr { +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 ihl:4, + version:4; +#elif defined (__BIG_ENDIAN_BITFIELD) + __u8 version:4, + ihl:4; +#else +# error "unknown byteorder!" +#endif + __u8 tos; + __u16 tot_len; + __u16 id; + __u16 frag_off; + __u8 ttl; + __u8 protocol; + __u16 check; + __u32 saddr; + __u32 daddr; + /*The options start here. */ +}; + +struct udphdr { + __u16 source; + __u16 dest; + __u16 len; + __u16 check; +}; + +typedef struct iphdr iphdr_t; +typedef struct udphdr udphdr_t; + #else # error "Unknown OS system!" #endif @@ -212,9 +250,13 @@ typedef u_int64_t u64; ** GLOBAL SANGOMA MACROS ************************************************/ #if defined(__LINUX__) -# define strlcpy(d,s,l) strcpy(d,s) +# if !defined(strlcpy) +# define strlcpy(d,s,l) strcpy((d),(s)) +# endif #elif defined(__FreeBSD__) -# define strlcpy(d,s,l) strcpy(d,s) +# if !defined(strlcpy) +# define strlcpy(d,s,l) strcpy((d),(s)) +# endif #endif /************************************************ @@ -484,7 +526,11 @@ typedef struct { typedef struct { wan_api_rx_hdr_t api_rx_hdr; +#if defined(__WINDOWS__)/* zero-sized array does not comply to ANSI 'C' standard! */ + unsigned char data[1]; +#else unsigned char data[0]; +#endif #define wan_rxapi_xdlc_state api_rx_hdr.wan_hdr_xdlc_state #define wan_rxapi_xdlc_address api_rx_hdr.wan_hdr_xdlc_address #define wan_rxapi_xdlc_exception api_rx_hdr.wan_hdr_xdlc_exception @@ -508,11 +554,16 @@ typedef struct { typedef struct { wan_api_tx_hdr_t api_tx_hdr; +#if defined(__WINDOWS__)/* zero-sized array does not comply to ANSI 'C' standard! */ + unsigned char data[1]; +#else unsigned char data[0]; +#endif }wan_api_tx_element_t; #pragma pack() +#if !defined(__WINDOWS__) enum { SIOC_WAN_READ_REG = 0x01, SIOC_WAN_WRITE_REG, @@ -532,6 +583,7 @@ enum { SIOC_WAN_WRITE_PCIBRIDGE_REG, SIOC_WAN_ALL_WRITE_PCIBRIDGE_REG }; +#endif typedef struct wan_cmd_api_ { @@ -625,7 +677,11 @@ typedef struct wan_udp_hdr{ #define wan_udphdr_aft_num_frames wan_udphdr_u.aft.trace_info.num_frames #define wan_udphdr_aft_ismoredata wan_udphdr_u.aft.trace_info.ismoredata #define wan_udphdr_aft_data wan_udphdr_u.aft.data -#define wan_udphdr_data wan_udphdr_u.data +#if defined(__WINDOWS__) +# define wan_udphdr_data wan_udphdr_aft_data +#else +# define wan_udphdr_data wan_udphdr_u.data +#endif } wan_udp_hdr_t; @@ -659,7 +715,6 @@ typedef struct wan_udp_hdr{ # define WP_DELAY DELAY # define WP_SCHEDULE(arg,name) tsleep(&(arg),PPAUSE,(name),(arg)) # define SYSTEM_TICKS ticks -typedef int wan_ticks_t; # define HZ hz # define RW_LOCK_UNLOCKED 0 # define ETH_P_IP AF_INET @@ -669,6 +724,8 @@ typedef int wan_ticks_t; # define WAN_IFT_ETHER IFT_ETHER # define WAN_IFT_PPP IFT_PPP # define WAN_MFLAG_PRV M_PROTO1 +# define WAN_MFLAG_IPX M_PROTO2 +typedef u_long wan_ioctl_cmd_t; #elif defined(__OpenBSD__) /******************* O P E N B S D ******************************/ # define WAN_MOD_LOAD LKM_E_LOAD @@ -676,7 +733,6 @@ typedef int wan_ticks_t; # define WP_DELAY DELAY # define WP_SCHEDULE(arg,name) tsleep(&(arg),PPAUSE,(name),(arg)) # define SYSTEM_TICKS ticks -typedef int wan_ticks_t; # define HZ hz # define RW_LOCK_UNLOCKED 0 # define ETH_P_IP AF_INET @@ -686,25 +742,26 @@ typedef int wan_ticks_t; # define WAN_IFT_ETHER IFT_ETHER # define WAN_IFT_PPP IFT_PPP # define WAN_MFLAG_PRV M_PROTO1 +# define WAN_MFLAG_IPX M_PROTO2 +typedef u_long wan_ioctl_cmd_t; #elif defined(__NetBSD__) /******************* N E T B S D ******************************/ # define WAN_MOD_LOAD LKM_E_LOAD # define WAN_MOD_UNLOAD LKM_E_UNLOAD # define WP_DELAY DELAY # define SYSTEM_TICKS tick -typedef int wan_ticks_t; # define HZ hz # define RW_LOCK_UNLOCKED 0 # define WAN_IFT_OTHER IFT_OTHER # define WAN_IFT_ETHER IFT_ETHER # define WAN_IFT_PPP IFT_PPP +typedef u_long wan_ioctl_cmd_t; #elif defined(__LINUX__) /*********************** L I N U X ******************************/ # define ETHER_ADDR_LEN ETH_ALEN # define WP_DELAY(usecs) udelay(usecs) # define atomic_set_int(name, val) atomic_set(name, val) # define SYSTEM_TICKS jiffies -typedef unsigned long wan_ticks_t; # define WP_SCHEDULE(arg,name) schedule() # define wan_atomic_read atomic_read # define wan_atomic_set atomic_set @@ -713,10 +770,27 @@ typedef unsigned long wan_ticks_t; # define WAN_IFT_OTHER 0x00 # define WAN_IFT_ETHER 0x00 # define WAN_IFT_PPP 0x00 +typedef int wan_ioctl_cmd_t; #elif defined(__WINDOWS__) /******************* W I N D O W S ******************************/ -# define EINVAL 22 -# define IFNAMESIZ 16 +# define ETHER_ADDR_LEN 6 +# define WP_DELAY(usecs) KeStallExecutionProcessor(usecs);/* usecs is in MicroSeconds */ +# define SYSTEM_TICKS get_systemticks() +# define jiffies SYSTEM_TICKS +# define wan_atomic_read atomic_read +# define wan_atomic_set atomic_set +# define wan_atomic_inc atomic_inc +# define wan_atomic_dec atomic_dec +# define RW_LOCK_UNLOCKED 0 +typedef int wan_ioctl_cmd_t; + +#define ONE_MILLISECOND_INTERVAL 1000 +/* this macro allowed only at IRQL = PASSIVE_LEVEL*/ +#define WP_MILLISECONDS_DELAY(ms_delay){ \ + LARGE_INTEGER Interval; \ + Interval.QuadPart = Int32x32To64(ONE_MILLISECOND_INTERVAL*ms_delay, -10);\ + KeDelayExecutionThread(KernelMode, FALSE, &Interval); \ +} #endif #if defined(__FreeBSD__) @@ -729,9 +803,9 @@ typedef unsigned long wan_ticks_t; int load_##name (module_t mod, int cmd, void *arg){ \ switch(cmd){ \ case WAN_MOD_LOAD: return mod_init((devsw)); \ - case WAN_MOD_UNLOAD: \ - case WAN_MOD_SHUTDOWN: return mod_exit((devsw));\ - case WAN_MOD_QUIESCE: return 0; \ + case WAN_MOD_UNLOAD: return mod_exit((devsw)); \ + case WAN_MOD_SHUTDOWN: return 0;\ + case WAN_MOD_QUIESCE: return 0; \ } \ return -EINVAL; \ } \ @@ -815,9 +889,12 @@ typedef unsigned long wan_ticks_t; ** T Y P E D E F ****************************************************************** */ + +#if !defined(__WINDOWS__) #if !defined(offsetof) # define offsetof(type, member) ((size_t)(&((type*)0)->member)) #endif +#endif #if defined(__LINUX__) typedef struct sk_buff netskb_t; @@ -838,9 +915,7 @@ typedef void (*wan_taskq_func_t)(struct work_struct *); typedef struct tq_struct wan_taskq_t; typedef void* virt_addr_t; -# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) typedef unsigned long phys_addr_t; -#endif typedef spinlock_t wan_spinlock_t; typedef rwlock_t wan_rwlock_t; typedef unsigned long wan_smp_flag_t; @@ -877,7 +952,11 @@ typedef dev_t ttydriver_t; typedef struct tty ttystruct_t; typedef struct termios termios_t; typedef int (get_info_t)(char *, char **, off_t, int, int); +#if defined(SPINLOCK_OLD) typedef int wan_spinlock_t; +#else +typedef struct mtx wan_spinlock_t; +#endif typedef int wan_rwlock_t; typedef int wan_smp_flag_t; typedef int wan_rwlock_flag_t; @@ -946,22 +1025,39 @@ typedef void (wan_pci_ifunc_t)(void*); #elif defined(__SOLARIS__) typedef mblk_t netskb_t; - #elif defined(__WINDOWS__) -typedef UCHAR u8; -typedef UINT u16; -typedef USHORT u32; -typedef ULONG u64; -typedef char* caddr_t; -# if defined(NDIS_MINIPORT_DRIVER) -typedef NDIS_MINIPORT_TIMER wan_timer_info_t; -# else -typedef KTIMER wan_timer_info_t; -# endif -typedef void netdevice_t; -typedef void* wan_skb_queue_t; -typedef void (*wan_timer_func_t)(void*); +/*********************************************************************/ + +/*********************************************************************/ + +typedef struct sk_buff netskb_t; +typedef struct sk_buff_head wan_skb_queue_t; + +typedef struct +{ + u8 DestAddr[6]; + u8 SrcAddr[6]; + u16 EtherType; +} ethhdr_t; + +typedef void* wan_timer_arg_t; +typedef PKDEFERRED_ROUTINE wan_tasklet_func_t; +typedef PKDEFERRED_ROUTINE wan_taskq_func_t; + +typedef struct _wan_timer_info_t{ + KTIMER Timer; + KDPC TimerDpcObject; + LARGE_INTEGER TimerDueTime; +}wan_timer_info_t; + +typedef void (*wan_timer_func_t)(IN PKDPC Dpc, void* context, void * arg2, void * arg3); + +typedef struct { ULONG counter; } atomic_t; + +typedef int wan_rwlock_t; +typedef int wan_rwlock_flag_t; +typedef int pid_t; #endif /* @@ -1001,9 +1097,9 @@ typedef struct _wan_rwlock /* ** FIXME: Redefined from sdla_adsl.c -** DMA structure +** DMA structure for ADSL ONLY!!!!!!! */ -typedef struct _wan_dma_descr +typedef struct _wan_dma_descr_org { unsigned long* vAddr; unsigned long pAddr; @@ -1022,7 +1118,7 @@ typedef struct _wan_dma_descr int rsegs; #else /* other OS */ #endif -} wan_dma_descr_t;/*, *PDMA_DESCRIPTION;*/ +} wan_dma_descr_org_t;/*, *PDMA_DESCRIPTION;*/ /* ** TASK structure @@ -1037,6 +1133,8 @@ typedef struct _wan_tasklet void* data; #elif defined(__LINUX__) struct tasklet_struct task_id; +#elif defined(__WINDOWS__) + KDPC tqueue; #elif defined(__SOLARIS__) #error "wan_tasklet: not defined in solaris" #endif @@ -1060,6 +1158,8 @@ typedef struct _wan_taskq # else struct work_struct tqueue; # endif +#elif defined(__WINDOWS__) + KDPC tqueue; #elif defined(__SOLARIS__) #error "_wan_taskq: not defined in solaris" #endif @@ -1071,7 +1171,7 @@ typedef struct wan_trace { u_int32_t tracing_enabled; wan_skb_queue_t trace_queue; - unsigned long trace_timeout;/* WARNING: has to be 'unsigned long' !!!*/ + wan_ticks_t trace_timeout;/* WARNING: has to be 'unsigned long' !!!*/ unsigned int max_trace_queue; unsigned char last_trace_direction; u_int32_t missed_idle_rx_counter; @@ -1093,12 +1193,12 @@ typedef struct _wan_timer #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) wan_timer_func_t timer_func; #elif defined(__WINDOWS__) - KDPC TimerDpcObject; + wan_timer_func_t timer_func; #endif void* timer_arg; } wan_timer_t; -#if !defined(LINUX_2_6) +#if !defined(LINUX_2_6) && !defined(__WINDOWS__) /* Define this structure for BSDs and not Linux-2.6 */ struct seq_file { char* buf; /* pointer to buffer (buf)*/ @@ -1193,8 +1293,6 @@ typedef struct wan_udp_pkt { } wan_udp_pkt_t; - - #pragma pack(1) #if defined(WAN_BIG_ENDIAN) || (1) @@ -1244,6 +1342,7 @@ typedef struct wan_rtp_pkt { #pragma pack() + #endif /* KERNEL */ #endif /* __WANPIPE_DEFINES_H */ diff --git a/patches/kdrivers/include/wanpipe_ec_kernel.h b/patches/kdrivers/include/wanpipe_ec_kernel.h index 6a11279..6ca328f 100644 --- a/patches/kdrivers/include/wanpipe_ec_kernel.h +++ b/patches/kdrivers/include/wanpipe_ec_kernel.h @@ -21,18 +21,21 @@ # include #endif +#if defined(WAN_KERNEL) typedef struct wanec_iface_ { unsigned long init; - void* (*reg) (void*, int); + void* (*reg) (void*, u_int32_t, int, int, void*); int (*unreg) (void*, void*); int (*ioctl) (void); - int (*isr) (void*, void*); + int (*isr) (void*); int (*poll) (void*, void*); int (*event_ctrl) (void*, void*, wan_event_ctrl_t*); } wanec_iface_t; +#endif /* WAN_KERNEL */ + #endif /* __WANPIPE_EC_KERNEL_H */ diff --git a/patches/kdrivers/include/wanpipe_events.h b/patches/kdrivers/include/wanpipe_events.h index 07f2855..53b665b 100644 --- a/patches/kdrivers/include/wanpipe_events.h +++ b/patches/kdrivers/include/wanpipe_events.h @@ -24,11 +24,23 @@ (type == WAN_EC_TONE_STOP) ? "Stop" : \ "Unknown" +/* pcm law type (alaw or ulaw) */ +#define WAN_EC_PCM_U_LAW 0x01 +#define WAN_EC_PCM_A_LAW 0x02 +#define WAN_EC_DECODE_PCM_LAW(pcmlaw) \ + ((pcmlaw) == WAN_EC_PCM_U_LAW) ? "ULAW" : \ + ((pcmlaw) == WAN_EC_PCM_A_LAW) ? "ALAW" : "Unknown" + /* channel port (sout, rout, sin, rin) */ -#define WAN_EC_CHANNEL_PORT_SOUT 0x01 -#define WAN_EC_CHANNEL_PORT_SIN 0x02 -#define WAN_EC_CHANNEL_PORT_ROUT 0x03 -#define WAN_EC_CHANNEL_PORT_RIN 0x04 +#define WAN_EC_CHANNEL_PORT_SOUT 0x01 +#define WAN_EC_CHANNEL_PORT_SIN 0x02 +#define WAN_EC_CHANNEL_PORT_ROUT 0x04 +#define WAN_EC_CHANNEL_PORT_RIN 0x08 +#define WAN_EC_DECODE_CHANNEL_PORT(port) \ + ((port) == WAN_EC_CHANNEL_PORT_SOUT) ? "SOUT" : \ + ((port) == WAN_EC_CHANNEL_PORT_SIN) ? "SIN" : \ + ((port) == WAN_EC_CHANNEL_PORT_ROUT) ? "ROUT" : \ + ((port) == WAN_EC_CHANNEL_PORT_RIN) ? "RIN" : "Unknown" #define WAN_EVENT_RXHOOK_OFF 0x01 #define WAN_EVENT_RXHOOK_ON 0x02 @@ -77,9 +89,11 @@ #define WAN_EVENT_RM_ONHOOKTRANSFER 0x000E #define WAN_EVENT_RM_SETPOLARITY 0x000F #define WAN_EVENT_RM_SET_ECHOTUNE 0x0010 +#define WAN_EVENT_EC_CHAN_MODIFY 0x0011 +#define WAN_EVENT_EC_H100_REPORT 0x0012 #define WAN_EVENT_TYPE_DECODE(type) \ - ((type) == WAN_EVENT_EC_DTMF) ? "EC DTMF" : \ + ((type) == WAN_EVENT_EC_DTMF) ? "EC DTMF" : \ ((type) == WAN_EVENT_RM_POWER) ? "RM Power Alarm" : \ ((type) == WAN_EVENT_RM_LC) ? "RM Loop Closure" : \ ((type) == WAN_EVENT_RM_RING_TRIP) ? "RM Ring Trip" : \ @@ -95,6 +109,7 @@ ((type) == WAN_EVENT_RM_ONHOOKTRANSFER) ? "RM On-hook transfer" : \ ((type) == WAN_EVENT_RM_SETPOLARITY) ? "RM Set polarity" : \ ((type) == WAN_EVENT_RM_SET_ECHOTUNE) ? "RM Set echotune" : \ + ((type) == WAN_EVENT_EC_CHAN_MODIFY) ? "EC Chan Modify" : \ "(Unknown type)" /* tone type list */ @@ -130,7 +145,8 @@ typedef struct wan_event_ctrl_ { u_int16_t type; u_int8_t mode; - int mod_no; /* A200-Remora */ + int mod_no; /* A200-Remora */ + int channel; unsigned char ec_dtmf_port; /* EC DTMF: SOUT or ROUT */ unsigned long ts_map; u_int8_t tone; diff --git a/patches/kdrivers/include/wanpipe_fr_iface.h b/patches/kdrivers/include/wanpipe_fr_iface.h index bf75590..cdee472 100644 --- a/patches/kdrivers/include/wanpipe_fr_iface.h +++ b/patches/kdrivers/include/wanpipe_fr_iface.h @@ -66,7 +66,11 @@ extern int wp_fr_close_chan(void *chan_ptr); extern int wp_fr_ioctl (void *chan_ptr, int cmd, void *arg); extern int wp_fr_rx (void * prot_ptr, void *rx_pkt); +#if defined(__WINDOWS__) +extern int wp_fr_timer (void *prot_ptr, unsigned int *period); +#else extern int wp_fr_timer (void *prot_ptr, unsigned int *period, unsigned int carrier_reliable); +#endif extern int wp_fr_tx (void * chan_ptr, void *skb, int type); extern int wp_fr_pipemon(void *chan, int cmd, int dlci, unsigned char* data, unsigned int *len); extern int wp_fr_snmp(void* chan_ptr, void* data); diff --git a/patches/kdrivers/include/wanpipe_iface.h b/patches/kdrivers/include/wanpipe_iface.h index 8de4560..3368e13 100644 --- a/patches/kdrivers/include/wanpipe_iface.h +++ b/patches/kdrivers/include/wanpipe_iface.h @@ -94,23 +94,13 @@ struct if_settings /* WANPIPE Generic function interface */ # if defined(WAN_KERNEL) -/* ifType - SNMP */ -#if 0 -/* moved to wanpipe_defines.h */ -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) -# define WAN_IFT_OTHER IFT_OTHER -# define WAN_IFT_ETHER IFT_ETHER -# define WAN_IFT_PPP IFT_PPP -#elif defined(__LINUX__) -# define WAN_IFT_OTHER 0x00 -# define WAN_IFT_ETHER 0x00 -# define WAN_IFT_PPP 0x00 -#endif -#endif - typedef struct { +#if defined(__WINDOWS__) + netdevice_t*(*alloc)(int); +#else netdevice_t*(*alloc)(int, int ifType); +#endif void(*free)(netdevice_t*); int(*attach)(netdevice_t*, char*, int); void(*detach)(netdevice_t*, int); diff --git a/patches/kdrivers/include/wanpipe_includes.h b/patches/kdrivers/include/wanpipe_includes.h index 8f589d3..273bbe4 100644 --- a/patches/kdrivers/include/wanpipe_includes.h +++ b/patches/kdrivers/include/wanpipe_includes.h @@ -5,7 +5,11 @@ * * * Author: Alex Feldman * *======================================================================* - * Aug 10 2002 Alex Feldman Initial version * + * * + * Nov 27, 2007 David Rokhvarg Added header files needed to compile * + * Sangoma MS Windows Driver and API. * + * * + * Aug 10, 2002 Alex Feldman Initial version * * * ************************************************************************ */ @@ -39,6 +43,7 @@ # endif # include # include +# include # include # include # include @@ -68,6 +73,7 @@ # include # include # endif +# include # include # include # include @@ -99,6 +105,7 @@ #ifdef NETGRAPH # include # include +# include #endif /* NETGRAPH */ # include # if (__FreeBSD_version < 500000) @@ -320,19 +327,43 @@ /* ** *** W I N D O W S *** */ -# if defined(__KERNEL__) -# include /* PCI configuration struct */ -# include /* NDIS functions */ -# include -# include -# include /* offsetof, etc. */ -# include /* bit manipulation macros */ -# include /* operation return codes */ -# include /* for 'wan_udp_hdr_t' */ -# include -# else -# include -# endif /* if defined(__WINDOWS__) */ + + +#if defined(WAN_KERNEL) || defined(__KERNEL__) +# include +# include /* clock_t */ + +# if defined(VIRTUAL_IF_DRV) || defined(SPROTOCOL) +# include +# include +# include +# include +# include +# include +# include +# include +# include /* API definitions */ +# include +# endif + +#if defined( NDIS_MINIPORT_DRIVER ) +# undef BINARY_COMPATIBLE +# define BINARY_COMPATIBLE 0 /* compile for Win2000 and later */ +# define NDIS50_MINIPORT 1 +# include +# include +# include +#endif + +/*# include - UINT*/ +#else +# include +#endif + +#include +#include +#include /* offsetof, etc. */ + #elif defined (__SOLARIS__) # include # include diff --git a/patches/kdrivers/include/wanpipe_kernel.h b/patches/kdrivers/include/wanpipe_kernel.h index 6238335..937df55 100644 --- a/patches/kdrivers/include/wanpipe_kernel.h +++ b/patches/kdrivers/include/wanpipe_kernel.h @@ -28,24 +28,26 @@ #else # define wp_ip_rt_ioctl(_cmd_,_rptr_) ip_rt_ioctl(_cmd_,_rptr_) # define wp_devinet_ioctl(_cmd_,_rptr_) devinet_ioctl(_cmd_,_rptr_) -#endif +#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) -#define wan_skb_reset_mac_header(skb) skb_reset_mac_header(skb) -#define wan_skb_reset_network_header(skb) skb_reset_network_header(skb) -#define wan_skb_end_pointer(skb) skb_end_pointer(skb) -#define wan_skb_tail_pointer(skb) skb_tail_pointer(skb) -#define wan_skb_reset_tail_pointer(skb) skb_reset_tail_pointer(skb) -#define wan_skb_set_tail_pointer(skb,offset) skb_set_tail_pointer(skb,offset) +#define __wan_skb_reset_mac_header(skb) skb_reset_mac_header(skb) +#define __wan_skb_reset_network_header(skb) skb_reset_network_header(skb) +#define __wan_skb_reset_tail_pointer(skb) skb_reset_tail_pointer(skb) +#define __wan_skb_tail_pointer(skb) skb_tail_pointer(skb) +#define __wan_skb_set_tail_pointer(skb,offset) skb_set_tail_pointer(skb,offset) +#define __wan_skb_end_pointer(skb) skb_end_pointer(skb) #else -#define wan_skb_reset_mac_header(skb) ((skb)->mac.raw = (skb)->data) -#define wan_skb_reset_network_header(skb) ((skb)->nh.raw = (skb)->data) -#define wan_skb_tail_pointer(skb) ((skb)->tail) -#define wan_skb_end_pointer(skb) ((skb)->end) -#define wan_skb_reset_tail_pointer(skb) ((skb)->tail = (skb)->data) -#define wan_skb_set_tail_pointer(skb,offset) ((skb)->tail = ((skb)->data + offset)) +#define __wan_skb_reset_mac_header(skb) (skb->mac.raw = skb->data) +#define __wan_skb_reset_network_header(skb) (skb->nh.raw = skb->data) +#define __wan_skb_reset_tail_pointer(skb) (skb->tail = skb->data) +#define __wan_skb_end_pointer(skb) ((skb)->end) +#define __wan_skb_tail_pointer(skb) ((netskb_t*)skb)->tail +#define __wan_skb_set_tail_pointer(skb,offset) ((skb)->tail = ((skb)->data + offset)) #endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) || defined(LINUX_FEAT_2624) # ifndef LINUX_FEAT_2624 # define LINUX_FEAT_2624 1 @@ -65,6 +67,10 @@ #endif +/*========================================================================== + KERNEL 2.6. + *==========================================================================*/ + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) /* KERNEL 2.6.X */ @@ -91,19 +97,17 @@ { schedule_work(tq); } - + #define ADMIN_CHECK() {if (!capable(CAP_SYS_ADMIN)) {\ - if (WAN_NET_RATELIMIT()) { \ - DEBUG_EVENT("%s:%d: wanpipe: ADMIN_CHECK: Failed !\n",__FUNCTION__,__LINE__);\ - } \ + DEBUG_EVENT("wanpipe: ADMIN_CHECK: Failed Cap=0x%X Fsuid=0x%X Euid=0x%X\n", \ + current->cap_effective,current->fsuid,current->euid);\ return -EPERM; \ }\ } #define NET_ADMIN_CHECK() {if (!capable(CAP_NET_ADMIN)){\ - if (WAN_NET_RATELIMIT()) { \ - DEBUG_EVENT("%s:%d: wanpipe: NET_ADMIN_CHECK: Failed !\n",__FUNCTION__,__LINE__);\ - } \ + DEBUG_EVENT("wanpipe: NET_ADMIN_CHECK: Failed Cap=0x%X Fsuid=0x%X Euid=0x%X\n", \ + current->cap_effective,current->fsuid,current->euid);\ return -EPERM; \ }\ } @@ -160,6 +164,12 @@ #endif + + +/*========================================================================== + KERNEL 2.4.X + *==========================================================================*/ + #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) /* -------------------------------------------------- * KERNEL 2.4.X @@ -247,6 +257,12 @@ + +/*========================================================================== + KERNEL 2.2.X + *==========================================================================*/ + + #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) /*----------------------------------------------------- * KERNEL 2.2.X @@ -496,7 +512,60 @@ static inline int open_dev_check(netdevice_t *dev) #endif } -#else +#define WAN_IFQ_INIT(ifq, max_pkt) skb_queue_head_init((ifq)) +#define WAN_IFQ_DESTROY(ifq) +#define WAN_IFQ_PURGE(ifq) wan_skb_queue_purge((ifq)) +#define WAN_IFQ_DMA_PURGE(ifq) \ + { netskb_t *skb; \ + while ((skb=wan_skb_dequeue((ifq))) != NULL) { \ + if (skb_shinfo(skb)->frag_list || skb_shinfo(skb)->nr_frags) { \ + DEBUG_EVENT("WARNING [%s:%d]: SKB Corruption!\n", \ + __FUNCTION__,__LINE__); \ + continue; \ + } \ + wan_skb_free(skb); \ + } \ + } + +#define WAN_IFQ_ENQUEUE(ifq, skb, arg, err) skb_queue_tail((ifq), (skb)) +#define WAN_IFQ_LEN(ifq) skb_queue_len((ifq)) + +# define WAN_TASKLET_INIT(task, priority, func, arg) \ + (task)->running = 0; \ + tasklet_init(&(task)->task_id,func,(unsigned long)arg) + +# define WAN_TASKLET_SCHEDULE(task) \ + wan_set_bit(0, &(task)->running); \ + tasklet_schedule(&(task)->task_id); +#if 0 +# define WAN_WP_TASKLET_SCHEDULE_PER_CPU(task,cpu) \ + wan_set_bit(0, &(task)->running); \ + wp_tasklet_hi_schedule_per_cpu(&(task)->task_id,cpu); +#endif + +# define WAN_TASKLET_RUNNING(task) \ + wan_test_bit(0, &(task)->running) + +# define WAN_TASKLET_END(task) wan_clear_bit(0, &(task)->running) + +# define WAN_TASKLET_KILL(task) tasklet_kill(&(task)->task_id) + +/* Due to 2.6.20 kernel the wan_taskq_t is now a direct + * workqueue struct not an abstracted structure */ +# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) +# define WAN_TASKQ_INIT(task, priority, func, arg) \ + INIT_WORK((task),func,arg) +# else +# define WAN_TASKQ_INIT(task, priority, func, arg) \ + INIT_WORK((task),func) +# endif +# define WAN_IS_TASKQ_SCHEDULE +# define WAN_TASKQ_SCHEDULE(task) \ + wan_schedule_task(task) + + + +#else /* __KERNEL__ */ #include @@ -514,4 +583,7 @@ static inline int open_dev_check(netdevice_t *dev) #endif + #endif + + diff --git a/patches/kdrivers/include/wanpipe_kernel.h~ b/patches/kdrivers/include/wanpipe_kernel.h~ deleted file mode 100644 index c3f0180..0000000 --- a/patches/kdrivers/include/wanpipe_kernel.h~ +++ /dev/null @@ -1,513 +0,0 @@ - -#ifndef _WANPIPE_KERNEL_H -#define _WANPIPE_KERNEL_H - -#ifdef __KERNEL__ - -#include - -# if defined (__BIG_ENDIAN_BITFIELD) -# define WAN_BIG_ENDIAN 1 -# undef WAN_LITTLE_ENDIAN -# else -# undef WAN_BIG_ENDIAN -# define WAN_LITTLE_ENDIAN 1 -# endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,9) -# define MODULE_LICENSE(a) -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10) -# define snprintf(a,b,c,d...) sprintf(a,c,##d) -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) -# define wp_ip_rt_ioctl(_cmd_,_rptr_) -EINVAL -# define wp_devinet_ioctl(_cmd_,_rptr_) -EINVAL -#else -# define wp_ip_rt_ioctl(_cmd_,_rptr_) ip_rt_ioctl(_cmd_,_rptr_) -# define wp_devinet_ioctl(_cmd_,_rptr_) devinet_ioctl(_cmd_,_rptr_) -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) -#define wan_skb_reset_mac_header(skb) skb_reset_mac_header(skb) -#define wan_skb_reset_network_header(skb) skb_reset_network_header(skb) -#define wan_skb_end_pointer(skb) skb_end_pointer(skb) -#define wan_skb_tail_pointer(skb) skb_tail_pointer(skb) -#define wan_skb_reset_tail_pointer(skb) skb_reset_tail_pointer(skb) -#define wan_skb_set_tail_pointer(skb,offset) skb_set_tail_pointer(skb,offset) -#else -#define wan_skb_reset_mac_header(skb) ((skb)->mac.raw = (skb)->data) -#define wan_skb_reset_network_header(skb) ((skb)->nh.raw = (skb)->data) -#define wan_skb_tail_pointer(skb) ((skb)->tail) -#define wan_skb_end_pointer(skb) ((skb)->end) -#define wan_skb_reset_tail_pointer(skb) ((skb)->tail = (skb)->data) -#define wan_skb_set_tail_pointer(skb,offset) ((skb)->tail = ((skb)->data + offset)) -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) -# define LINUX_FEAT_2624 1 -# define wan_dev_get_by_name(name) dev_get_by_name(&init_net,name) -# define wan_dev_get_by_index(idx) dev_get_by_index(&init_net,idx) -# define wan_init_net(name) init_net.name -#else -# define wan_dev_get_by_name(name) dev_get_by_name(name) -# define wan_dev_get_by_index(idx) dev_get_by_index(idx) -# define wan_init_net(name) name -#endif - - -#ifndef IRQF_SHARED -#define IRQF_SHARED SA_SHIRQ -#endif - - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -/* KERNEL 2.6.X */ - - #define LINUX_2_6 - #define netdevice_t struct net_device - - #define FREE_READ 1 - #define FREE_WRITE 0 - - #define stop_net_queue(a) netif_stop_queue(a) - #define start_net_queue(a) netif_start_queue(a) - #define is_queue_stopped(a) netif_queue_stopped(a) - #define wake_net_dev(a) netif_wake_queue(a) - #define is_dev_running(a) netif_running(a) - #define wan_dev_kfree_skb(a,b) dev_kfree_skb_any(a) - - #define tq_struct work_struct - - #define wan_call_usermodehelper(a,b,c) call_usermodehelper(a,b,c,0) - - #define pci_present() 1 - - static inline void wan_schedule_task(struct tq_struct *tq) - { - schedule_work(tq); - } - - #define ADMIN_CHECK() {if (!capable(CAP_SYS_ADMIN)) {\ - DEBUG_EVENT("wanpipe: ADMIN_CHECK: Failed Cap=0x%X Fsuid=0x%X Euid=0x%X\n", \ - current->cap_effective,current->fsuid,current->euid);\ - return -EPERM; \ - }\ - } - - #define NET_ADMIN_CHECK() {if (!capable(CAP_NET_ADMIN)){\ - DEBUG_EVENT("wanpipe: NET_ADMIN_CHECK: Failed Cap=0x%X Fsuid=0x%X Euid=0x%X\n", \ - current->cap_effective,current->fsuid,current->euid);\ - return -EPERM; \ - }\ - } - - #define WAN_IRQ_CALL(fn,args,ret) ret = fn args - #define WAN_IRQ_RETURN(a) return a - #define WAN_IRQ_RETVAL irqreturn_t - #define WAN_IRQ_RETVAL_DECL(ret) irqreturn_t ret = WAN_IRQ_NONE - #define WAN_IRQ_RETVAL_SET(ret, val) ret = val - #define WAN_IRQ_HANDLED IRQ_HANDLED - #define WAN_IRQ_NONE IRQ_NONE - - #define mark_bh(a) - - #define wan_clear_bit(a,b) clear_bit((a),(unsigned long*)(b)) - #define wan_set_bit(a,b) set_bit((a),(unsigned long*)(b)) - #define wan_test_bit(a,b) test_bit((a),(unsigned long*)(b)) - #define wan_test_and_set_bit(a,b) test_and_set_bit((a),(unsigned long*)(b)) - #define wan_test_and_clear_bit(a,b) test_and_clear_bit((a),(unsigned long*)(b)) - - #define dev_init_buffers(a) - - #define WP_PDE(_a) PDE(_a) - - - - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9) - # define wp_rcu_read_lock(in_dev) rcu_read_lock() - # define wp_rcu_read_unlock(in_dev) rcu_read_unlock() - # define wp_readb(ptr) readb((void __iomem *)(ptr)) - # define wp_reads(ptr) reads((void __iomem *)(ptr)) - # define wp_readl(ptr) readl((void __iomem *)(ptr)) - # define wp_writeb(data,ptr) writeb(data,(void __iomem *)(ptr)) - # define wp_writew(data,ptr) writew(data,(void __iomem *)(ptr)) - # define wp_writel(data,ptr) writel(data,(void __iomem *)(ptr)) - # define wp_memset_io(ptr,data,len) memset_io((void __iomem *)(ptr),data,len) - #else - # define wp_rcu_read_lock(in_dev) read_lock_bh(&in_dev->lock) - # define wp_rcu_read_unlock(in_dev) read_unlock_bh(&in_dev->lock) - # define wp_readb(ptr) readb((ptr)) - # define wp_reads(ptr) reads((ptr)) - # define wp_readl(ptr) readl((ptr)) - # define wp_writeb(data,ptr) writeb(data,(ptr)) - # define wp_writew(data,ptr) writew(data,(ptr)) - # define wp_writel(data,ptr) writel(data,(ptr)) - # define wp_memset_io(ptr,data,len) memset_io((ptr),data,len) - #endif - - #if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,14) - #define htonl __constant_htonl - #define htons __constant_htons - #define ntohl __constant_ntohl - #define ntohs __constant_ntohs - #endif - - -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) -/* -------------------------------------------------- - * KERNEL 2.4.X - * -------------------------------------------------*/ - - #define LINUX_2_4 - #define netdevice_t struct net_device - - #define FREE_READ 1 - #define FREE_WRITE 0 - - #define stop_net_queue(a) netif_stop_queue(a) - #define start_net_queue(a) netif_start_queue(a) - #define is_queue_stopped(a) netif_queue_stopped(a) - #define wake_net_dev(a) netif_wake_queue(a) - #define is_dev_running(a) netif_running(a) - #define wan_dev_kfree_skb(a,b) dev_kfree_skb_any(a) - #define pci_get_device(a,b,c) pci_find_device(a,b,c) - - #define __dev_get(a) dev_get(a) - - static inline void wan_schedule_task(struct tq_struct *tq) - { - schedule_task(tq); - } - - #ifndef INIT_WORK - # define INIT_WORK INIT_TQUEUE - #endif - - #define wan_call_usermodehelper(a,b,c) call_usermodehelper(a,b,c) - - #define ADMIN_CHECK() {if (!capable(CAP_SYS_ADMIN)) {\ - DEBUG_EVENT("wanpipe: ADMIN_CHECK: Failed Cap=0x%X Fsuid=0x%X Euid=0x%X\n", \ - current->cap_effective,current->fsuid,current->euid);\ - return -EPERM; \ - }\ - } - - #define NET_ADMIN_CHECK() {if (!capable(CAP_NET_ADMIN)){\ - DEBUG_EVENT("wanpipe: NET_ADMIN_CHECK: Failed Cap=0x%X Fsuid=0x%X Euid=0x%X\n", \ - current->cap_effective,current->fsuid,current->euid);\ - return -EPERM; \ - }\ - } - - #define WAN_IRQ_CALL(fn,args,ret) fn args - #define WAN_IRQ_RETURN(a) return - #define WAN_IRQ_RETVAL void - #define WAN_IRQ_RETVAL_DECL(ret) - #define WAN_IRQ_RETVAL_SET(ret, val) - #ifndef WAN_IRQ_NONE - # define WAN_IRQ_NONE (0) - #endif - - #ifndef WAN_IRQ_HANDLED - # define WAN_IRQ_HANDLED (1) - #endif - - #define wan_clear_bit(a,b) clear_bit((a),(b)) - #define wan_set_bit(a,b) set_bit((a),(b)) - #define wan_test_bit(a,b) test_bit((a),(b)) - #define wan_test_and_set_bit(a,b) test_and_set_bit((a),(b)) - #define wan_test_and_clear_bit(a,b) test_and_clear_bit((a),(b)) - - static inline struct proc_dir_entry *WP_PDE(const struct inode *inode) - { - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,21) - return (struct proc_dir_entry *)inode->u.generic_ip; - #else - return (struct proc_dir_entry *)inode->i_private; - #endif - } - - #define wp_rcu_read_lock(in_dev) read_lock_bh(&in_dev->lock) - #define wp_rcu_read_unlock(in_dev) read_unlock_bh(&in_dev->lock) - #define wp_readb(ptr) readb((ptr)) - #define wp_reads(ptr) reads((ptr)) - #define wp_readl(ptr) readl((ptr)) - - #define wp_writeb(data,ptr) writeb(data,(ptr)) - #define wp_writew(data,ptr) writew(data,(ptr)) - #define wp_writel(data,ptr) writel(data,(ptr)) - #define wp_memset_io(ptr,data,len) memset_io((ptr),data,len) - - - -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0) -/*----------------------------------------------------- - * KERNEL 2.2.X - * ---------------------------------------------------*/ - - #define LINUX_2_1 - #define net_device device - #define netdevice_t struct device - #define FREE_READ 1 - #define FREE_WRITE 0 - - #define S_IRUGO 0 - - #define __exit - - #ifndef get_order - # define get_order(x) __get_order(x) - #endif - - #define pci_get_device(a,b,c) pci_find_device(a,b,c) - #define wan_dev_kfree_skb(a,b) kfree_skb(a) - #define dev_kfree_skb_any(a) kfree_skb(a) - - #define netif_wake_queue(dev) do { \ - clear_bit(0, &(dev)->tbusy); \ - mark_bh(NET_BH); \ - } while(0) - #define netif_start_queue(dev) do { \ - (dev)->tbusy = 0; \ - (dev)->interrupt = 0; \ - (dev)->start = 1; \ - } while (0) - - #define netif_stop_queue(dev) (set_bit(0, &(dev)->tbusy)) - #define netif_running(dev) (dev)->start - #define netdevice_start(dev) (dev)->start = 1 - #define netdevice_stop(dev) (dev)->start = 0 - #define netif_queue_stopped(dev) (test_bit(0,&(dev)->tbusy)) - #define netif_set_tx_timeout(dev, tf, tm) - - #define stop_net_queue(dev) netif_stop_queue(dev) - #define start_net_queue(dev) netif_start_queue(dev) - #define is_queue_stopped(dev) netif_queue_stopped(dev) - #define wake_net_dev(dev) netif_wake_queue(dev) - #define is_dev_running(dev) netif_running(dev) - - #define dev_kfree_skb_irq(x) kfree_skb(x) - - #define tasklet_struct tq_struct - - #define __dev_get(a) dev_get(a) - - #ifndef DECLARE_WAITQUEUE - #define DECLARE_WAITQUEUE(wait, current) struct wait_queue wait = { current, NULL } - #endif - - #define tasklet_kill(a) { if ((a)->sync) {} } - - #define request_mem_region(addr, size, name) ((void *)1) - #define release_mem_region(addr, size) - #define pci_enable_device(x) (0) - #define pci_resource_start(dev, bar) dev->base_address[bar] - - #define wp_rcu_read_lock(in_dev) - #define wp_rcu_read_unlock(in_dev) - #define wp_readb(ptr) readb((ptr)) - #define wp_reads(ptr) reads((ptr)) - #define wp_readl(ptr) readl((ptr)) - #define wp_writeb(data,ptr) writeb(data,(ptr)) - #define wp_writew(data,ptr) writew(data,(ptr)) - #define wp_writel(data,ptr) writel(data,(ptr)) - #define wp_memset_io(ptr,data,len) memset_io((ptr),data,len) - - static inline void tasklet_hi_schedule(struct tasklet_struct *tasklet) - { - queue_task(tasklet, &tq_immediate); - mark_bh(IMMEDIATE_BH); - } - - static inline void tasklet_schedule(struct tasklet_struct *tasklet) - { - queue_task(tasklet, &tq_immediate); - mark_bh(IMMEDIATE_BH); - } - - static inline void tasklet_init(struct tasklet_struct *tasklet, - void (*func)(unsigned long), - unsigned long data) - { - tasklet->next = NULL; - tasklet->sync = 0; - tasklet->routine = (void (*)(void *))func; - tasklet->data = (void *)data; - } - - static inline void wan_schedule_task(struct tq_struct *tq) - { - queue_task(tq, &tq_scheduler); - } - - /* Setup Dma Memory size copied directly from 3c505.c */ - static inline int __get_order(unsigned long size) - { - int order; - - size = (size - 1) >> (PAGE_SHIFT - 1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; - } - - typedef int (get_info_t)(char *, char **, off_t, int, int); - - #define ADMIN_CHECK() {if (!capable(CAP_SYS_ADMIN)) return -EPERM;} - #define NET_ADMIN_CHECK() {if (!capable(CAP_NET_ADMIN)) return -EPERM;} - - #define WAN_IRQ_CALL(fn,args,ret) fn args - #define WAN_IRQ_RETURN(a) return - #define WAN_IRQ_RETVAL void - #define WAN_IRQ_RETVAL_DECL(ret) - #define WAN_IRQ_RETVAL_SET(ret, val) - #ifndef WAN_IRQ_NONE - # define WAN_IRQ_NONE (0) - #endif - - #ifndef WAN_IRQ_HANDLED - # define WAN_IRQ_HANDLED (1) - #endif - - typedef unsigned long mm_segment_t; - - #ifndef INIT_WORK - # define INIT_WORK INIT_TQUEUE - #endif - - #define wan_clear_bit(a,b) clear_bit((a),(b)) - #define wan_set_bit(a,b) set_bit((a),(b)) - #define wan_test_bit(a,b) test_bit((a),(b)) - #define wan_test_and_set_bit(a,b) test_and_set_bit((a),(b)) - #define wan_test_and_clear_bit(a,b) test_and_clear_bit((a),(b)) - - static inline struct proc_dir_entry *WP_PDE(const struct inode *inode) - { - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) - return (struct proc_dir_entry *)inode->u.generic_ip; - #else - return (struct proc_dir_entry *)inode->i_private; - #endif - } - -#else -/* KERNEL 2.0.X */ - - - #define LINUX_2_0 - #define netdevice_t struct device - - static inline struct proc_dir_entry *WP_PDE(const struct inode *inode) - { - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) - return (struct proc_dir_entry *)inode->i_private; - #else - return (struct proc_dir_entry *)inode->u.generic_ip; - #endif - } - - #define test_and_set_bit set_bit - #define net_ratelimit() 1 - - #define stop_net_queue(a) (set_bit(0, &a->tbusy)) - #define start_net_queue(a) (clear_bit(0,&a->tbusy)) - #define is_queue_stopped(a) (a->tbusy) - #define wake_net_dev(a) {clear_bit(0,&a->tbusy);mark_bh(NET_BH);} - #define is_dev_running(a) (test_bit(0,(void*)&a->start)) - #define wan_dev_kfree_skb(a,b) kfree_skb(a,b) - #define pci_get_device(a,b,c) pci_find_device(a,b,c) - #define spin_lock_init(a) - #define spin_lock(a) - #define spin_unlock(a) - - #define __dev_get(a) dev_get(a) - - #define netif_wake_queue(dev) do { \ - clear_bit(0, &dev->tbusy); \ - mark_bh(NET_BH); \ - } while(0) - #define netif_start_queue(dev) do { \ - dev->tbusy = 0; \ - dev->interrupt = 0; \ - dev->start = 1; \ - } while (0) - #define netif_stop_queue(dev) set_bit(0, &dev->tbusy) - #define netif_running(dev) dev->start - #define netdevice_start(dev) dev->start = 1 - #define netdevice_stop(dev) dev->start = 0 - #define netif_set_tx_timeout(dev, tf, tm) - #define dev_kfree_skb_irq(x) kfree_skb(x) - - typedef int (write_proc_t)(char *, char **, off_t, int, int); - - #define net_device_stats enet_statistics - - static inline int copy_from_user(void *a, void *b, int len){ - int err = verify_area(VERIFY_READ, b, len); - if (err) - return err; - - memcpy_fromfs (a, b, len); - return 0; - } - - static inline int copy_to_user(void *a, void *b, int len){ - int err = verify_area(VERIFY_WRITE, b, len); - if (err) - return err; - memcpy_tofs (a, b,len); - return 0; - } - - #define WAN_IRQ_CALL(fn,args,ret) fn args - #define WAN_IRQ_RETURN(a) return - #define WAN_IRQ_RETVAL void - #define WAN_IRQ_RETVAL_DECL(ret) - #define WAN_IRQ_RETVAL_SET(ret, val) - - #ifndef WAN_IRQ_NONE - # define WAN_IRQ_NONE (0) - #endif - - #ifndef WAN_IRQ_HANDLED - # define WAN_IRQ_HANDLED (1) - #endif - - typedef unsigned long mm_segment_t; - -#endif - -static inline int open_dev_check(netdevice_t *dev) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18) - return is_dev_running(dev); -#else - return 0; -#endif -} - -#else - -#include - -/* This file is not being included from kernel space - * we need to define what kersdladrv_pci_tblnel version we are - * running */ - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) - #define LINUX_2_6 -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) - #define LINUX_2_4 -#else - #define LINUX_2_4 -#endif - - -#endif -#endif diff --git a/patches/kdrivers/include/wanpipe_lapb_iface.h b/patches/kdrivers/include/wanpipe_lapb_iface.h index 8c15d44..afc62e0 100644 --- a/patches/kdrivers/include/wanpipe_lapb_iface.h +++ b/patches/kdrivers/include/wanpipe_lapb_iface.h @@ -46,7 +46,10 @@ extern int wp_lapb_close(void *lapb_ptr); extern int wp_lapb_rx(void *lapb_ptr, void *skb); extern int wp_lapb_bh(void *lapb_ptr); extern int wp_lapb_tx(void *lapb_ptr, void *skb, int type); +#if defined(__WINDOWS__) +extern int wp_lapb_timer(void *lapb_ptr, unsigned int *period); +#else extern int wp_lapb_timer(void *lapb_ptr, unsigned int *period, unsigned int); - +#endif #endif diff --git a/patches/kdrivers/include/wanpipe_lip.h b/patches/kdrivers/include/wanpipe_lip.h index 662691d..18c3e15 100644 --- a/patches/kdrivers/include/wanpipe_lip.h +++ b/patches/kdrivers/include/wanpipe_lip.h @@ -1,4 +1,4 @@ -/* $Header: /usr/local/cvsroot/wanpipe_common/include/wanpipe_lip.h,v 1.38 2007/02/21 18:46:09 sangoma Exp $ */ +/* $Header: /usr/local/cvsroot/wanpipe_common/include/wanpipe_lip.h,v 1.43 2008/01/09 17:45:29 sangoma Exp $ */ #ifndef _WANPIPE_LIP_HEADER_ #define _WANPIPE_LIP_HEADER_ @@ -25,6 +25,30 @@ # if defined(CONFIG_PRODUCT_WANPIPE_XDLC) # include # endif +#elif defined(__WINDOWS__) +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# if defined(CONFIG_PRODUCT_WANPIPE_LAPB) || defined(CONFIG_PRODUCT_WANPIPE_LIP_LAPD) +# include +# endif +# if defined(CONFIG_PRODUCT_WANPIPE_XDLC) +# include +# endif +/* Prototypes for interface between LIP and 'sprotocol' code in virt_adap_enum.c: */ +int sdla_tx_down(void* dev, void *tx_skb); +int sdla_data_rx_up(void* sdla_net_dev, void *rx_skb); + #else # include # include @@ -155,7 +179,11 @@ enum { */ #define MAX_LCN 255 #define MAX_DECODE_BUF_SZ 1000 +#if defined(__WINDOWS__) +#define MAX_PROC_NAME WAN_IFNAME_SZ +#else #define MAX_PROC_NAME 10 +#endif #ifndef MAX_PROC_EVENTS #define MAX_PROC_EVENTS 20 @@ -166,7 +194,7 @@ enum { /*#define MAX_TX_BUF 10*/ #define MAX_TX_BUF 10 #define MAX_ATM_TX_BUF 35 -#define MAX_RX_Q 128 +#define MAX_RX_Q 32 #define WPLIP_MAGIC_LINK 0xDAFE1234 #define WPLIP_MAGIC_DEV 0xDAFE4321 @@ -199,7 +227,7 @@ typedef struct wplip_link * * Packet direction UP * */ - WAN_LIST_HEAD(,wplip_dev) list_head_ifdev; + WAN_LIST_HEAD(NAME_PLACEHOLDER,wplip_dev) list_head_ifdev; unsigned int dev_cnt; wan_rwlock_t dev_list_lock; @@ -212,7 +240,7 @@ typedef struct wplip_link * Eg. Load balancing over multiple * links */ - WAN_LIST_HEAD(,wplip_dev_list) list_head_tx_ifdev; + WAN_LIST_HEAD(NAME_PLACEHOLDER,wplip_dev_list) list_head_tx_ifdev; unsigned int tx_dev_cnt; wan_rwlock_t tx_dev_list_lock; @@ -221,7 +249,11 @@ typedef struct wplip_link unsigned char carrier_state; unsigned char prot_state; +#if defined(__WINDOWS__) + void *prot_obj; /* this is the pointer to protocol object */ +#else void *prot; +#endif wan_timer_t prot_timer; unsigned char protocol; @@ -247,6 +279,9 @@ typedef struct wplip_link wan_skb_queue_t tx_queue; wan_skb_queue_t rx_queue; wan_tasklet_t task; +#if defined(__FreeBSD__) && defined(WPLIP_TQ_THREAD) + struct taskqueue *tq; +#endif struct wplip_dev *cur_tx; @@ -269,6 +304,10 @@ typedef struct wplip_link wan_taskq_t prot_task; u32 latency_qlen; +#if defined(__WINDOWS__) + void *sdla_card; /* for wplip_link_callback_tx_down() */ +#endif + } wplip_link_t; @@ -298,8 +337,9 @@ typedef struct wplip_dev{ #if defined(__LINUX__) struct proc_dir_entry *dent; #endif +#if defined(__WINDOWS__) struct net_device_stats ifstats; - +#endif unsigned char used; unsigned char protocol; @@ -320,8 +360,9 @@ typedef struct wplip_dev{ unsigned int interface_down; unsigned int if_down; - wan_taskq_t if_task; + wan_taskq_t if_task; + } wplip_dev_t; typedef struct wplip_dev_list @@ -363,7 +404,11 @@ typedef struct wplip_prot_iface unsigned int *len); int (*rx) (void *prot_ptr, void *rx_pkt); +#if defined(__WINDOWS__) + int (*timer) (void *prot_ptr, unsigned int *period); +#else int (*timer) (void *prot_ptr, unsigned int *period, unsigned int); +#endif int (*bh) (void *); int (*snmp) (void *, void *); int (*task) (void *prot_ptr); @@ -417,6 +462,12 @@ extern int wplip_link_callback_tx_down(void *lip_link, void *skb); extern int wplip_callback_kick_prot_task(void *lip_link); extern int wplip_set_hw_idle_frame (void *liplink_ptr, unsigned char *data, int len); +#if defined(__WINDOWS__) +extern wplip_reg_t wplip_protocol; +extern int wanpipe_lip_init(void); +extern int wanpipe_lip_exit(void); +#endif + /* wanpipe_lip_sub.c */ extern wplip_link_t* wplip_create_link(char *devname); extern void wplip_remove_link(wplip_link_t *lip_link); @@ -486,6 +537,7 @@ extern int wplip_lipdev_prot_change_state(void *wplip_id, int state, unsigned char*,int); + extern int wplip_lipdev_prot_update_state_change(wplip_dev_t *wplip_id,unsigned char*,int); @@ -523,7 +575,11 @@ static __inline int wplip_trigger_bh(wplip_link_t *lip_link) } if (wan_skb_queue_len(&lip_link->rx_queue)){ +#if defined(__LINUX__) || !defined(WPLIP_TQ_THREAD) WAN_TASKLET_SCHEDULE((&lip_link->task)); +#else + WAN_TASKQUEUE_SCHEDULE(lip_link->tq,&lip_link->task); +#endif return 0; } @@ -540,14 +596,22 @@ static __inline int wplip_trigger_bh(wplip_link_t *lip_link) #if 0 gdbg_flag=0; #endif +#if defined(__LINUX__) || !defined(WPLIP_TQ_THREAD) WAN_TASKLET_SCHEDULE((&lip_link->task)); +#else + WAN_TASKQUEUE_SCHEDULE(lip_link->tq,&lip_link->task); +#endif return 0; } static __inline int wplip_kick_trigger_bh(wplip_link_t *lip_link) { wan_clear_bit(WPLIP_BH_AWAITING_KICK,&lip_link->tq_working); +#if defined(__LINUX__) || !defined(WPLIP_TQ_THREAD) WAN_TASKLET_SCHEDULE((&lip_link->task)); +#else + WAN_TASKQUEUE_SCHEDULE(lip_link->tq,&lip_link->task); +#endif return 0; } @@ -603,6 +667,22 @@ static __inline int wplip_decode_protocol(wplip_dev_t *lip_dev, void *ptr) return WPLIP_IPX; } + return WPLIP_IP; +#elif defined(__WINDOWS__) + struct sk_buff *skb=(struct sk_buff*)ptr; + + DEBUG_LIP("wplip_decode_protocol()\n"); + + switch (wpabs_htons(skb->protocol)){ + + case ETH_P_IP: + return WPLIP_IP; + case ETH_P_IPV6: + return WPLIP_IPV6; + case ETH_P_IPX: + return WPLIP_IPX; + } + return WPLIP_IP; #else # error ("wplip_decode_protocol: Unknown Protocol!\n"); @@ -626,12 +706,145 @@ static __inline void wp_lip_config_bridge_mode(wplip_dev_t *lip_dev) } #endif +#if defined(__WINDOWS__) +#define PACKET_TYPE_DECODE(type) \ + ((type == WPLIP_RAW) ? "WPLIP_RAW" : \ + (type == WPLIP_IP) ? "WPLIP_IP" : \ + (type == WPLIP_IPV6) ? "WPLIP_IPV6" : \ + (type == WPLIP_IPX) ? "WPLIP_IPX": \ + (type == WPLIP_FR_ARP) ? "WPLIP_FR_ARP": "Unknown Packet type") +//convert integer definition of a protocol to string +static char * get_protocol_string(int protocol) +{ +#define MAX_PROT_NAME_LENGTH 256 +#define snprintf _snprintf + static char protocol_name[MAX_PROT_NAME_LENGTH]; + + switch(protocol) + { + case WANCONFIG_X25: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "X25"); + break; + + case WANCONFIG_FR: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "Frame Relay"); + break; + + case WANCONFIG_PPP: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "PPP"); + break; + + case WANCONFIG_CHDLC: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "CHDLC"); + break; + + case WANCONFIG_BSC: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "BiSync Streaming"); + break; + + case WANCONFIG_HDLC: + //used with CHDLC firmware + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "HDLC Streaming"); + break; + + case WANCONFIG_MPPP://and WANCONFIG_MPROT too + //snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "Multi Port PPP"); + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "PPP"); + break; + + case WANCONFIG_LAPB: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "LAPB"); + break; + + case WANCONFIG_BITSTRM: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "Bit Stream"); + break; + + case WANCONFIG_EDUKIT: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "WAN EduKit"); + break; + + case WANCONFIG_SS7: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "SS7"); + break; + + case WANCONFIG_BSCSTRM: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "Bisync Streaming Nasdaq"); + break; + + case WANCONFIG_MFR: + //snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "Multi-Port Frame Relay"); + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "Frame Relay"); + break; + + case WANCONFIG_ADSL: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "LLC Ethernet (ADSL)"); + break; + + case WANCONFIG_SDLC: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "SDLC"); + break; + + case WANCONFIG_ATM: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "ATM"); + break; + + case WANCONFIG_POS: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "Point-of-Sale"); + break; + + case WANCONFIG_AFT: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "AFT"); + break; + + case WANCONFIG_AFT_TE3: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "AFT"); + break; + + case WANCONFIG_DEBUG: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "Real Time Debugging"); + break; + + case WANCONFIG_ADCCP: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "Special HDLC LAPB"); + break; + + case WANCONFIG_MLINK_PPP: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "Multi-Link PPP"); + break; + + case WANCONFIG_GENERIC: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "WANPIPE Generic driver"); + break; + + case WANCONFIG_MPCHDLC: + //snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "Multi-Port CHDLC"); + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "CHDLC"); + break; + + case WANCONFIG_TTY: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "TTY"); + break; +/* + case PROTOCOL_TDM_VOICE: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "TDM Voice"); + break; +*/ + default: + snprintf((char*)protocol_name, MAX_PROT_NAME_LENGTH, "Invalid Protocol"); + break; + } + + return (char*)protocol_name; +} + +#endif /*__KERNEL__*/ #endif -/*_WANPIPE_X25_HEADER_*/ +/*_WANPIPE_LIP_HEADER_*/ #endif diff --git a/patches/kdrivers/include/wanpipe_lip_kernel.h b/patches/kdrivers/include/wanpipe_lip_kernel.h index f30c082..cee5b7b 100644 --- a/patches/kdrivers/include/wanpipe_lip_kernel.h +++ b/patches/kdrivers/include/wanpipe_lip_kernel.h @@ -31,8 +31,14 @@ typedef struct wplip_reg int (*wplip_bind_link) (void*, netdevice_t *); int (*wplip_unbind_link) (void*, netdevice_t *); +#if defined(__WINDOWS__) + int (*wplip_if_reg) (void* lip_link_ptr, char *dev_name, + wanif_conf_t *conf, void** new_lip_dev); + int (*wplip_if_unreg) (void *); +#else int (*wplip_if_reg) (void*, char*, wanif_conf_t *); int (*wplip_if_unreg) (netdevice_t *); +#endif void (*wplip_disconnect) (void*, int); void (*wplip_connect) (void*, int); diff --git a/patches/kdrivers/include/wanpipe_sppp_iface.h b/patches/kdrivers/include/wanpipe_sppp_iface.h index 428cec0..5351daf 100644 --- a/patches/kdrivers/include/wanpipe_sppp_iface.h +++ b/patches/kdrivers/include/wanpipe_sppp_iface.h @@ -38,10 +38,18 @@ extern int wp_sppp_close(void *sppp_ptr); extern int wp_sppp_rx(void *sppp_ptr, void *skb); extern int wp_sppp_bh(void *sppp_ptr); extern int wp_sppp_tx(void *sppp_ptr, void *skb, int type); + +#if defined(__WINDOWS__) +extern void *wp_register_sppp_prot(void *, char *, void *, wplip_prot_reg_t *); +extern int wp_sppp_timer(void *sppp_ptr, unsigned int *period); +#else extern int wp_sppp_timer(void *sppp_ptr, unsigned int *period, unsigned int carrier_reliable); +#endif extern int wp_sppp_pipemon(void *sppp, int cmd, int addr, unsigned char* data, unsigned int *len); extern int wp_sppp_task(void *sppp_ptr); + + #endif @@ -253,7 +261,11 @@ typedef struct ppp_conn_info unsigned char ipx_remote[6] ; /* 16: */ unsigned char ipx_router[48] ; /* 1C: */ unsigned char auth_status ; /* 4C: */ +#if defined(__WINDOWS__)/* zero-sized array does not comply to ANSI 'C' standard! */ + unsigned char peer_id[1] ; /* 4D: */ +#else unsigned char peer_id[0] ; /* 4D: */ +#endif } ppp_conn_info_t; diff --git a/patches/kdrivers/include/wanpipe_tdm_api.h b/patches/kdrivers/include/wanpipe_tdm_api.h index 2d016b9..996e1cc 100644 --- a/patches/kdrivers/include/wanpipe_tdm_api.h +++ b/patches/kdrivers/include/wanpipe_tdm_api.h @@ -25,283 +25,43 @@ # include # include # include +# include #elif defined(__WINDOWS__) # if defined(__KERNEL__) # include # include +# include # include + +enum{ + TDMAPI_BUFFER_NO_CODEC=1, + TDMAPI_BUFFER_HDLC_DATA, + TDMAPI_BUFFER_ERROR, + TDMAPI_BUFFER_READY, + TDMAPI_BUFFER_ACCEPTED +}; + +#define inline __inline # endif # include + #else # include # include # include # include # include +# include #endif -#if defined(__WINDOWS__) -typedef HANDLE sng_fd_t; -#else -typedef int sng_fd_t; -#endif - -enum wanpipe_tdm_api_cmds { - - SIOC_WP_TDM_GET_USR_MTU_MRU, /* 0x00 */ - - SIOC_WP_TDM_SET_USR_PERIOD, /* 0x01 */ - SIOC_WP_TDM_GET_USR_PERIOD, /* 0x02 */ - - SIOC_WP_TDM_SET_HW_MTU_MRU, /* 0x03 */ - SIOC_WP_TDM_GET_HW_MTU_MRU, /* 0x04 */ - - SIOC_WP_TDM_SET_CODEC, /* 0x05 */ - SIOC_WP_TDM_GET_CODEC, /* 0x06 */ - - SIOC_WP_TDM_SET_POWER_LEVEL, /* 0x07 */ - SIOC_WP_TDM_GET_POWER_LEVEL, /* 0x08 */ - - SIOC_WP_TDM_TOGGLE_RX, /* 0x09 */ - SIOC_WP_TDM_TOGGLE_TX, /* 0x0A */ - - SIOC_WP_TDM_GET_HW_CODING, /* 0x0B */ - SIOC_WP_TDM_SET_HW_CODING, /* 0x0C */ - - SIOC_WP_TDM_GET_FULL_CFG, /* 0x0D */ - - SIOC_WP_TDM_SET_EC_TAP, /* 0x0E */ - SIOC_WP_TDM_GET_EC_TAP, /* 0x0F */ - - SIOC_WP_TDM_ENABLE_RBS_EVENTS, /* 0x10 */ - SIOC_WP_TDM_DISABLE_RBS_EVENTS, /* 0x11 */ - SIOC_WP_TDM_WRITE_RBS_BITS, /* 0x12 */ - - SIOC_WP_TDM_GET_STATS, /* 0x13 */ - SIOC_WP_TDM_FLUSH_BUFFERS, /* 0x14 */ - - SIOC_WP_TDM_READ_EVENT, /* 0x15 */ - - SIOC_WP_TDM_ENABLE_DTMF_EVENTS, /* 0x16 */ - SIOC_WP_TDM_DISABLE_DTMF_EVENTS, /* 0x17 */ - - SIOC_WP_TDM_ENABLE_RM_DTMF_EVENTS, /* 0x18 */ - SIOC_WP_TDM_DISABLE_RM_DTMF_EVENTS, /* 0x19 */ - - SIOC_WP_TDM_ENABLE_RXHOOK_EVENTS, /* 0x1A */ - SIOC_WP_TDM_DISABLE_RXHOOK_EVENTS, /* 0x1B */ - - SIOC_WP_TDM_ENABLE_RING_DETECT_EVENTS, - SIOC_WP_TDM_DISABLE_RING_DETECT_EVENTS, - - SIOC_WP_TDM_ENABLE_RING_TRIP_DETECT_EVENTS, - SIOC_WP_TDM_DISABLE_RING_TRIP_DETECT_EVENTS, - - SIOC_WP_TDM_TXSIG_KEWL, - SIOC_WP_TDM_EVENT_TXSIG_START, - SIOC_WP_TDM_EVENT_TXSIG_OFFHOOK, - SIOC_WP_TDM_EVENT_TXSIG_ONHOOK, - SIOC_WP_TDM_EVENT_ONHOOKTRANSFER, - SIOC_WP_TDM_EVENT_SETPOLARITY, - - SIOC_WP_TDM_SET_RX_GAINS, - SIOC_WP_TDM_SET_TX_GAINS, - SIOC_WP_TDM_CLEAR_RX_GAINS, - SIOC_WP_TDM_CLEAR_TX_GAINS, - - SIOC_WP_TDM_GET_FE_ALARMS, - SIOC_WP_TDM_ENABLE_HWEC, - SIOC_WP_TDM_DISABLE_HWEC, - - SIOC_WP_TDM_NOTSUPP /* */ - - -}; - -enum wanpipe_tdm_api_events { - WP_TDM_EVENT_RBS, - WP_TDM_EVENT_DTMF, - WP_TDM_EVENT_NONE, - WP_TDM_EVENT_RXHOOK, - WP_TDM_EVENT_RING, - WP_TDM_EVENT_TONE, - WP_TDM_EVENT_RING_DETECT, - WP_TDM_EVENT_RING_TRIP, - WP_TDM_EVENT_TXSIG_KEWL, - WP_TDM_EVENT_TXSIG_START, - WP_TDM_EVENT_TXSIG_OFFHOOK, - WP_TDM_EVENT_TXSIG_ONHOOK, - WP_TDM_EVENT_ONHOOKTRANSFER, - WP_TDM_EVENT_SETPOLARITY, - WP_TDM_EVENT_FE_ALARM -}; - -#define WPTDM_A_BIT WAN_RBS_SIG_A -#define WPTDM_B_BIT WAN_RBS_SIG_B -#define WPTDM_C_BIT WAN_RBS_SIG_C -#define WPTDM_D_BIT WAN_RBS_SIG_D - -#define WP_TDMAPI_EVENT_RXHOOK_OFF 0x01 -#define WP_TDMAPI_EVENT_RXHOOK_ON 0x02 - -#define WP_TDMAPI_EVENT_RING_PRESENT 0x01 -#define WP_TDMAPI_EVENT_RING_STOP 0x02 - - -typedef struct { - union { - struct { - unsigned char _event_type; - unsigned char _rbs_rx_bits; - unsigned int _time_stamp; - u_int16_t channel; - union { - struct { - u_int8_t alarm; - }fe; - struct { - u_int8_t rbs_bits; - }rbs; - struct { - u_int8_t state; - }rxhook; - struct { - u_int8_t state; - }ring; - struct { - u_int8_t digit; /* DTMF: digit */ - u_int8_t port; /* DTMF: SOUT/ROUT */ - u_int8_t type; /* DTMF: PRESET/STOP */ - }dtmf; - u_int16_t polarity; - u_int16_t ohttimer; - } u_event; - }wp_event; - struct { - unsigned char _rbs_rx_bits; - unsigned int _time_stamp; - } wp_rx; - unsigned char reserved[16]; - }wp_rx_hdr_u; -#define wp_tdm_api_event_type wp_rx_hdr_u.wp_event._event_type -#define wp_tdm_api_event_rbs_rx_bits wp_rx_hdr_u.wp_event._rbs_rx_bits -#define wp_tdm_api_event_time_stamp wp_rx_hdr_u.wp_event._time_stamp -#define wp_tdm_api_event_channel wp_rx_hdr_u.wp_event.channel -#define wp_tdm_api_event_rxhook_state wp_rx_hdr_u.wp_event.u_event.rxhook.state -#define wp_tdm_api_event_ring_state wp_rx_hdr_u.wp_event.u_event.ring.state -#define wp_tdm_api_event_dtmf_digit wp_rx_hdr_u.wp_event.u_event.dtmf.digit -#define wp_tdm_api_event_dtmf_type wp_rx_hdr_u.wp_event.u_event.dtmf.type -#define wp_tdm_api_event_dtmf_port wp_rx_hdr_u.wp_event.u_event.dtmf.port -#define wp_tdm_api_event_ohttimer wp_rx_hdr_u.wp_event.u_event.ohttimer -#define wp_tdm_api_event_polarity wp_rx_hdr_u.wp_event.u_event.polarity -#define wp_tdm_api_event_fe_alarm wp_rx_hdr_u.wp_event.u_event.fe.alarm -} wp_tdm_api_rx_hdr_t; - -typedef struct { - wp_tdm_api_rx_hdr_t hdr; - unsigned char data[1]; -} wp_tdm_api_rx_element_t; - -typedef struct { - union { - struct { - unsigned char _rbs_rx_bits; - unsigned int _time_stamp; - }wp_tx; - unsigned char reserved[16]; - }wp_tx_hdr_u; -#define wp_api_time_stamp wp_tx_hdr_u.wp_tx._time_stamp -} wp_tdm_api_tx_hdr_t; - -typedef struct { - wp_tdm_api_tx_hdr_t hdr; - unsigned char data[1]; -} wp_tdm_api_tx_element_t; - - - -typedef struct wp_tdm_chan_stats -{ - unsigned int rx_packets; /* total packets received */ - unsigned int tx_packets; /* total packets transmitted */ - unsigned int rx_bytes; /* total bytes received */ - unsigned int tx_bytes; /* total bytes transmitted */ - unsigned int rx_errors; /* bad packets received */ - unsigned int tx_errors; /* packet transmit problems */ - unsigned int rx_dropped; /* no space in linux buffers */ - unsigned int tx_dropped; /* no space available in linux */ - unsigned int multicast; /* multicast packets received */ -#if !defined(__WINDOWS__) - unsigned int collisions; -#endif - /* detailed rx_errors: */ - unsigned int rx_length_errors; - unsigned int rx_over_errors; /* receiver ring buff overflow */ - unsigned int rx_crc_errors; /* recved pkt with crc error */ - unsigned int rx_frame_errors; /* recv'd frame alignment error */ -#if !defined(__WINDOWS__) - unsigned int rx_fifo_errors; /* recv'r fifo overrun */ -#endif - unsigned int rx_missed_errors; /* receiver missed packet */ - - /* detailed tx_errors */ -#if !defined(__WINDOWS__) - unsigned int tx_aborted_errors; - unsigned int tx_carrier_errors; -#endif - unsigned int tx_fifo_errors; - unsigned int tx_heartbeat_errors; - unsigned int tx_window_errors; - -}wp_tdm_chan_stats_t; - - - -typedef struct wanpipe_tdm_api_cmd{ - unsigned int cmd; - unsigned int hw_tdm_coding; /* Set/Get HW TDM coding: uLaw muLaw */ - unsigned int hw_mtu_mru; /* Set/Get HW TDM MTU/MRU */ - unsigned int usr_period; /* Set/Get User Period in ms */ - unsigned int tdm_codec; /* Set/Get TDM Codec: SLinear */ - unsigned int power_level; /* Set/Get Power level treshold */ - unsigned int rx_disable; /* Enable/Disable Rx */ - unsigned int tx_disable; /* Enable/Disable Tx */ - unsigned int usr_mtu_mru; /* Set/Get User TDM MTU/MRU */ - unsigned int ec_tap; /* Echo Cancellation Tap */ - unsigned int rbs_poll; /* Enable/Disable RBS Polling */ - unsigned int rbs_rx_bits; /* Rx RBS Bits */ - unsigned int rbs_tx_bits; /* Tx RBS Bits */ - unsigned int hdlc; /* HDLC based device */ - unsigned int idle_flag; /* IDLE flag to Tx */ - unsigned int fe_alarms; /* FE Alarms detected */ - wp_tdm_chan_stats_t stats; /* TDM Statistics */ - wp_tdm_api_rx_hdr_t event; /* TDM Event */ - unsigned int data_len; - void *data; -}wanpipe_tdm_api_cmd_t; - -typedef struct wanpipe_tdm_api_event{ - int (*wp_rbs_event)(sng_fd_t fd, unsigned char rbs_bits); - int (*wp_dtmf_event)(sng_fd_t fd, unsigned char dtmf, unsigned char type, unsigned char port); - int (*wp_rxhook_event)(sng_fd_t fd, unsigned char hook_state); - int (*wp_rxring_event)(sng_fd_t fd, unsigned char ring_state); - int (*wp_ringtrip_event)(sng_fd_t fd, unsigned char ring_state); - int (*wp_fe_alarm_event)(sng_fd_t fd, unsigned char fe_alarm_event); -}wanpipe_tdm_api_event_t; - -typedef struct wanpipe_tdm_api{ - wanpipe_tdm_api_cmd_t wp_tdm_cmd; - wanpipe_tdm_api_event_t wp_tdm_event; -}wanpipe_tdm_api_t; - - - #ifdef WAN_KERNEL -/* Maximum API Len = 200ms = 1600 */ -#define WP_TDM_API_MAX_LEN 8*200 +#if !defined(__WINDOWS__) +#define WP_TDM_API_MAX_LEN 1024 +#endif + #define WP_TDM_API_CHUNK_SZ 8 enum { @@ -384,7 +144,7 @@ typedef struct wanpipe_tdm_api_dev { wait_queue_head_t poll_wait; #endif - u32 rbs_poll_cnt; + wan_ticks_t rbs_poll_cnt; u32 busy; u32 tx_q_len; u32 critical; @@ -419,6 +179,9 @@ typedef struct wanpipe_tdm_api_dev { #if defined(__WINDOWS__) u32 original_active_ch; #endif + + uint8_t dtmfsupport; + }wanpipe_tdm_api_dev_t; static __inline int is_tdm_api(void *chan, wanpipe_tdm_api_dev_t *tdm_api) @@ -536,7 +299,6 @@ static inline int wp_tdmapi_check_mtu(void* pcard, unsigned long timeslot_map, i *mtu = chunksz * num_of_channels; return 0; } - #endif diff --git a/patches/kdrivers/include/wanpipe_tdm_api_iface.h b/patches/kdrivers/include/wanpipe_tdm_api_iface.h new file mode 100644 index 0000000..d453046 --- /dev/null +++ b/patches/kdrivers/include/wanpipe_tdm_api_iface.h @@ -0,0 +1,326 @@ +/***************************************************************************** +* wanpipe_tdm_api.h +* +* WANPIPE(tm) AFT TE1 Hardware Support +* +* Authors: Nenad Corbic +* +* Copyright (c) 2007, Sangoma Technologies +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * 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. +* * Neither the name of the 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 ``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 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. + +* ============================================================================ +* Oct 04, 2005 Nenad Corbic Initial version. +* +* Jul 25, 2006 David Rokhvarg Ported to Windows. +*****************************************************************************/ + +#ifndef __WANPIPE_TDM_API_IFACE_H_ +#define __WANPIPE_TDM_API_IFACE_H_ + + +#if defined(__WINDOWS__) +typedef HANDLE sng_fd_t; +#else +typedef int sng_fd_t; +#endif + +/* Indicate to library that new features exist */ +#define WP_TDM_FEATURE_DTMF_EVENTS 1 +#define WP_TDM_FEATURE_FE_ALARM 1 +#define WP_TDM_FEATURE_EVENTS 1 + +enum wanpipe_tdm_api_cmds { + + SIOC_WP_TDM_GET_USR_MTU_MRU, /* 0x00 */ + + SIOC_WP_TDM_SET_USR_PERIOD, /* 0x01 */ + SIOC_WP_TDM_GET_USR_PERIOD, /* 0x02 */ + + SIOC_WP_TDM_SET_HW_MTU_MRU, /* 0x03 */ + SIOC_WP_TDM_GET_HW_MTU_MRU, /* 0x04 */ + + SIOC_WP_TDM_SET_CODEC, /* 0x05 */ + SIOC_WP_TDM_GET_CODEC, /* 0x06 */ + + SIOC_WP_TDM_SET_POWER_LEVEL, /* 0x07 */ + SIOC_WP_TDM_GET_POWER_LEVEL, /* 0x08 */ + + SIOC_WP_TDM_TOGGLE_RX, /* 0x09 */ + SIOC_WP_TDM_TOGGLE_TX, /* 0x0A */ + + SIOC_WP_TDM_GET_HW_CODING, /* 0x0B */ + SIOC_WP_TDM_SET_HW_CODING, /* 0x0C */ + + SIOC_WP_TDM_GET_FULL_CFG, /* 0x0D */ + + SIOC_WP_TDM_SET_EC_TAP, /* 0x0E */ + SIOC_WP_TDM_GET_EC_TAP, /* 0x0F */ + + SIOC_WP_TDM_ENABLE_RBS_EVENTS, /* 0x10 */ + SIOC_WP_TDM_DISABLE_RBS_EVENTS, /* 0x11 */ + SIOC_WP_TDM_WRITE_RBS_BITS, /* 0x12 */ + + SIOC_WP_TDM_GET_STATS, /* 0x13 */ + SIOC_WP_TDM_FLUSH_BUFFERS, /* 0x14 */ + + SIOC_WP_TDM_READ_EVENT, /* 0x15 */ + + SIOC_WP_TDM_SET_EVENT, /* 0x16 */ + + SIOC_WP_TDM_SET_RX_GAINS, /* 0x17 */ + SIOC_WP_TDM_SET_TX_GAINS, /* 0x18 */ + SIOC_WP_TDM_CLEAR_RX_GAINS, /* 0x19 */ + SIOC_WP_TDM_CLEAR_TX_GAINS, /* 0x1A */ + + SIOC_WP_TDM_GET_FE_ALARMS, /* 0x1B */ + + SIOC_WP_TDM_ENABLE_HWEC, /* 0x1C */ + SIOC_WP_TDM_DISABLE_HWEC, /* 0x1D */ + + SIOC_WP_TDM_SET_FE_STATUS, /* 0x1E */ + SIOC_WP_TDM_GET_FE_STATUS, /* 0x1F */ + + SIOC_WP_TDM_NOTSUPP /* */ + +}; + +enum wanpipe_tdm_api_events { + WP_TDMAPI_EVENT_NONE, + WP_TDMAPI_EVENT_RBS, + WP_TDMAPI_EVENT_ALARM, + WP_TDMAPI_EVENT_DTMF, + WP_TDMAPI_EVENT_RM_DTMF, + WP_TDMAPI_EVENT_RXHOOK, + WP_TDMAPI_EVENT_RING, + WP_TDMAPI_EVENT_RING_DETECT, + WP_TDMAPI_EVENT_RING_TRIP_DETECT, + WP_TDMAPI_EVENT_TONE, + WP_TDMAPI_EVENT_TXSIG_KEWL, + WP_TDMAPI_EVENT_TXSIG_START, + WP_TDMAPI_EVENT_TXSIG_OFFHOOK, + WP_TDMAPI_EVENT_TXSIG_ONHOOK, + WP_TDMAPI_EVENT_ONHOOKTRANSFER, + WP_TDMAPI_EVENT_SETPOLARITY +}; + +#define WP_TDMAPI_EVENT_FE_ALARM WP_TDMAPI_EVENT_ALARM + + +#define WP_TDMAPI_EVENT_ENABLE 0x01 +#define WP_TDMAPI_EVENT_DISABLE 0x02 +#define WP_TDMAPI_EVENT_MODE_DECODE(mode) \ + ((mode) == WP_TDMAPI_EVENT_ENABLE) ? "Enable" : \ + ((mode) == WP_TDMAPI_EVENT_DISABLE) ? "Disable" : \ + "(Unknown mode)" + +#define WPTDM_A_BIT WAN_RBS_SIG_A +#define WPTDM_B_BIT WAN_RBS_SIG_B +#define WPTDM_C_BIT WAN_RBS_SIG_C +#define WPTDM_D_BIT WAN_RBS_SIG_D + +#define WP_TDMAPI_EVENT_RXHOOK_OFF 0x01 +#define WP_TDMAPI_EVENT_RXHOOK_ON 0x02 +#define WP_TDMAPI_EVENT_RXHOOK_DECODE(state) \ + ((state) == WP_TDMAPI_EVENT_RXHOOK_OFF) ? "Off-hook" : \ + ((state) == WP_TDMAPI_EVENT_RXHOOK_ON) ? "On-hook" : \ + "(Unknown state)" + +#define WP_TDMAPI_EVENT_RING_PRESENT 0x01 +#define WP_TDMAPI_EVENT_RING_STOP 0x02 +#define WP_TDMAPI_EVENT_RING_DECODE(state) \ + ((state) == WP_TDMAPI_EVENT_RING_PRESENT) ? "Ring Present" : \ + ((state) == WP_TDMAPI_EVENT_RING_STOP) ? "Ring Stop" : \ + "(Unknown state)" + +#define WP_TDMAPI_EVENT_RING_TRIP_PRESENT 0x01 +#define WP_TDMAPI_EVENT_RING_TRIP_STOP 0x02 +#define WP_TDMAPI_EVENT_RING_TRIP_DECODE(state) \ + ((state) == WP_TDMAPI_EVENT_RING_TRIP_PRESENT) ? "Ring Present" : \ + ((state) == WP_TDMAPI_EVENT_RING_TRIP_STOP) ? "Ring Stop" : \ + "(Unknown state)" + +#define WP_TDMAPI_EVENT_TONE_DIAL 0x01 +#define WP_TDMAPI_EVENT_TONE_BUSY 0x02 +#define WP_TDMAPI_EVENT_TONE_RING 0x03 +#define WP_TDMAPI_EVENT_TONE_CONGESTION 0x04 + + +typedef struct { + + u_int8_t type; + u_int8_t mode; + u_int32_t time_stamp; + u_int16_t channel; + u_int32_t chan_map; + union { + struct { + u_int8_t alarm; + } te1_alarm; + struct { + u_int8_t rbs_bits; + } te1_rbs; + struct { + u_int8_t state; + u_int8_t sig; + } rm_hook; + struct { + u_int8_t state; + } rm_ring; + struct { + u_int8_t type; + } rm_tone; + struct { + u_int8_t digit; /* DTMF: digit */ + u_int8_t port; /* DTMF: SOUT/ROUT */ + u_int8_t type; /* DTMF: PRESET/STOP */ + } dtmf; + struct { + u_int16_t polarity; + u_int16_t ohttimer; + } rm_common; + } wp_tdm_api_event_u; +#define wp_tdm_api_event_type type +#define wp_tdm_api_event_mode mode +#define wp_tdm_api_event_alarm wp_tdm_api_event_u.te1_alarm.alarm +#define wp_tdm_api_event_alarm wp_tdm_api_event_u.te1_alarm.alarm +#define wp_tdm_api_event_rbs_bits wp_tdm_api_event_u.te1_rbs.rbs_bits +#define wp_tdm_api_event_hook_state wp_tdm_api_event_u.rm_hook.state +#define wp_tdm_api_event_hook_sig wp_tdm_api_event_u.rm_hook.sig +#define wp_tdm_api_event_ring_state wp_tdm_api_event_u.rm_ring.state +#define wp_tdm_api_event_tone_type wp_tdm_api_event_u.rm_tone.type +#define wp_tdm_api_event_dtmf_digit wp_tdm_api_event_u.dtmf.digit +#define wp_tdm_api_event_dtmf_type wp_tdm_api_event_u.dtmf.type +#define wp_tdm_api_event_dtmf_port wp_tdm_api_event_u.dtmf.port +#define wp_tdm_api_event_ohttimer wp_tdm_api_event_u.rm_common.ohttimer +#define wp_tdm_api_event_polarity wp_tdm_api_event_u.rm_common.polarity +} wp_tdm_api_event_t; + +typedef struct { + union { + unsigned char reserved[16]; + }wp_rx_hdr_u; +} wp_tdm_api_rx_hdr_t; + +typedef struct { + wp_tdm_api_rx_hdr_t hdr; + unsigned char data[1]; +} wp_tdm_api_rx_element_t; + +typedef struct { + union { + struct { + unsigned char _rbs_rx_bits; + unsigned int _time_stamp; + }wp_tx; + unsigned char reserved[16]; + }wp_tx_hdr_u; +#define wp_api_time_stamp wp_tx_hdr_u.wp_tx._time_stamp +} wp_tdm_api_tx_hdr_t; + +typedef struct { + wp_tdm_api_tx_hdr_t hdr; + unsigned char data[1]; +} wp_tdm_api_tx_element_t; + + + +typedef struct wp_tdm_chan_stats +{ + unsigned int rx_packets; /* total packets received */ + unsigned int tx_packets; /* total packets transmitted */ + unsigned int rx_bytes; /* total bytes received */ + unsigned int tx_bytes; /* total bytes transmitted */ + unsigned int rx_errors; /* bad packets received */ + unsigned int tx_errors; /* packet transmit problems */ + unsigned int rx_dropped; /* no space in linux buffers */ + unsigned int tx_dropped; /* no space available in linux */ + unsigned int multicast; /* multicast packets received */ +#if !defined(__WINDOWS__) + unsigned int collisions; +#endif + /* detailed rx_errors: */ + unsigned int rx_length_errors; + unsigned int rx_over_errors; /* receiver ring buff overflow */ + unsigned int rx_crc_errors; /* recved pkt with crc error */ + unsigned int rx_frame_errors; /* recv'd frame alignment error */ +#if !defined(__WINDOWS__) + unsigned int rx_fifo_errors; /* recv'r fifo overrun */ +#endif + unsigned int rx_missed_errors; /* receiver missed packet */ + + /* detailed tx_errors */ +#if !defined(__WINDOWS__) + unsigned int tx_aborted_errors; + unsigned int tx_carrier_errors; +#endif + unsigned int tx_fifo_errors; + unsigned int tx_heartbeat_errors; + unsigned int tx_window_errors; + +}wp_tdm_chan_stats_t; + + + +typedef struct wanpipe_tdm_api_cmd{ + unsigned int cmd; + unsigned int hw_tdm_coding; /* Set/Get HW TDM coding: uLaw muLaw */ + unsigned int hw_mtu_mru; /* Set/Get HW TDM MTU/MRU */ + unsigned int usr_period; /* Set/Get User Period in ms */ + unsigned int tdm_codec; /* Set/Get TDM Codec: SLinear */ + unsigned int power_level; /* Set/Get Power level treshold */ + unsigned int rx_disable; /* Enable/Disable Rx */ + unsigned int tx_disable; /* Enable/Disable Tx */ + unsigned int usr_mtu_mru; /* Set/Get User TDM MTU/MRU */ + unsigned int ec_tap; /* Echo Cancellation Tap */ + unsigned int rbs_poll; /* Enable/Disable RBS Polling */ + unsigned int rbs_rx_bits; /* Rx RBS Bits */ + unsigned int rbs_tx_bits; /* Tx RBS Bits */ + unsigned int hdlc; /* HDLC based device */ + unsigned int idle_flag; /* IDLE flag to Tx */ + unsigned int fe_alarms; /* FE Alarms detected */ + wp_tdm_chan_stats_t stats; /* TDM Statistics */ + /* Do NOT add anything above this! Important for binary backward compatibility. */ + wp_tdm_api_event_t event; /* TDM Event */ + unsigned int data_len; + void *data; + unsigned char fe_status; /* FE status - Connected or Disconnected */ +}wanpipe_tdm_api_cmd_t; + +typedef struct wanpipe_tdm_api_event{ + int (*wp_rbs_event)(sng_fd_t fd, unsigned char rbs_bits); + int (*wp_dtmf_event)(sng_fd_t fd, unsigned char dtmf, unsigned char type, unsigned char port); + int (*wp_rxhook_event)(sng_fd_t fd, unsigned char hook_state); + int (*wp_ring_detect_event)(sng_fd_t fd, unsigned char ring_state); + int (*wp_ring_trip_detect_event)(sng_fd_t fd, unsigned char ring_state); + int (*wp_fe_alarm_event)(sng_fd_t fd, unsigned char fe_alarm_event); +}wanpipe_tdm_api_event_t; + +typedef struct wanpipe_tdm_api{ + wanpipe_tdm_api_cmd_t wp_tdm_cmd; + wanpipe_tdm_api_event_t wp_tdm_event; +}wanpipe_tdm_api_t; + + +#endif diff --git a/patches/kdrivers/include/wanpipe_version.h b/patches/kdrivers/include/wanpipe_version.h index 62fba45..f1bd810 100644 --- a/patches/kdrivers/include/wanpipe_version.h +++ b/patches/kdrivers/include/wanpipe_version.h @@ -6,14 +6,14 @@ #define WANPIPE_COMPANY "Sangoma Technologies Inc" /********** LINUX **********/ -#define WANPIPE_VERSION "3.2.7.1" +#define WANPIPE_VERSION "3.3.2" #define WANPIPE_SUB_VERSION "0" -#define WANPIPE_VERSION_BETA 0 +#define WANPIPE_VERSION_BETA 1 #define WANPIPE_LITE_VERSION "1.1.1" /********** FreeBSD **********/ -#define WANPIPE_VERSION_FreeBSD "2.8.5" -#define WANPIPE_SUB_VERSION_FreeBSD "2" +#define WANPIPE_VERSION_FreeBSD "3.2" +#define WANPIPE_SUB_VERSION_FreeBSD "0" #define WANPIPE_VERSION_BETA_FreeBSD 1 #define WANPIPE_LITE_VERSION_FreeBSD "1.1.1" @@ -28,10 +28,58 @@ #define WANPIPE_SUB_VERSION_NetBSD "5" #define WANPIPE_VERSION_BETA_NetBSD 1 +#if defined(__WINDOWS__) /********** Windows **********/ -#define WANPIPE_VERSION_Windows "1.1.1" -#define WANPIPE_SUB_VERSION_Windows "4" -#define WANPIPE_VERSION_BETA_Windows 1 +typedef struct _DRIVER_VERSION { + unsigned int major; + unsigned int minor; + unsigned int minor1; + unsigned int minor2; +}DRIVER_VERSION, *PDRIVER_VERSION; + +# define WANPIPE_VERSION_MAJOR 6 +# define WANPIPE_VERSION_MINOR 0 + +#if 1 +# define WANPIPE_VERSION_MINOR1 4 +# define WANPIPE_VERSION_MINOR2 6 +#else +# define WANPIPE_VERSION_MINOR1 4 +# define WANPIPE_VERSION_MINOR2 4 +#endif + +static DRIVER_VERSION drv_version = { WANPIPE_VERSION_MAJOR, + WANPIPE_VERSION_MINOR, + WANPIPE_VERSION_MINOR1, + WANPIPE_VERSION_MINOR2 + }; + +#undef VER_PRODUCTVERSION +#undef VER_PRODUCTVERSION_STR +#undef VER_PRODUCTNAME_STR +#undef VER_COMPANYNAME_STR + +#define VER_PRODUCTVERSION 6,0,4,6 +#define VER_PRODUCTVERSION_STR "6.0.4.6" +#define __BUILDDATE__ January 15, 2008 + +#define VER_COMPANYNAME_STR "Sangoma Technologies Corporation" +#define VER_LEGALCOPYRIGHT_YEARS "1984-2008" +#define VER_LEGALCOPYRIGHT_STR "Copyright (c) Sangoma Technologies Corporation" +#define VER_PRODUCTNAME_STR "Sangoma WANPIPE (TM)" + +# undef WANPIPE_VERSION +# undef WANPIPE_VERSION_BETA +# undef WANPIPE_SUB_VERSION + +# define WANPIPE_VERSION_Windows "1.1.1" +# define WANPIPE_SUB_VERSION_Windows "4" +# define WANPIPE_VERSION_BETA_Windows 1 + +# define WANPIPE_VERSION WANPIPE_VERSION_Windows +# define WANPIPE_VERSION_BETA WANPIPE_VERSION_BETA_Windows +# define WANPIPE_SUB_VERSION WANPIPE_SUB_VERSION_Windows +#endif/* __WINDOWS__ */ #endif diff --git a/patches/kdrivers/include/wanproc.h b/patches/kdrivers/include/wanproc.h index f081940..83e2615 100644 --- a/patches/kdrivers/include/wanproc.h +++ b/patches/kdrivers/include/wanproc.h @@ -20,6 +20,7 @@ enum { WANPIPE_PROCFS_CONFIG = 0x1, WANPIPE_PROCFS_HWPROBE, + WANPIPE_PROCFS_HWPROBE_VERBOSE, WANPIPE_PROCFS_STATUS, WANPIPE_PROCFS_INTERFACES, WANPIPE_PROCFS_DEV @@ -83,6 +84,7 @@ enum { int config_get_info(char* buf, char** start, off_t offs, int len); int status_get_info(char* buf, char** start, off_t offs, int len); int probe_get_info(char* buf, char** start, off_t offs, int len); +int probe_get_info_verbose(char* buf, char** start, off_t offs, int len); int wandev_get_info(char* buf, char** start, off_t offs, int len); int interfaces_get_info(char* buf, char** start, off_t offs, int len); int wanproc_active_dev(char* buf, char** start, off_t offs, int len); diff --git a/patches/kdrivers/include/wanrouter.h b/patches/kdrivers/include/wanrouter.h index 49be101..629fc8e 100644 --- a/patches/kdrivers/include/wanrouter.h +++ b/patches/kdrivers/include/wanrouter.h @@ -5,6 +5,7 @@ * * Author: Nenad Corbic * Alex Feldman +* David Rokhvarg * Gideon Hack * Additions: Arnaldo Melo * @@ -15,6 +16,9 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * ============================================================================ +* Nov 27, 2007 David Rokhvarg Implemented functions/definitions for +* Sangoma MS Windows Driver and API. +* * May 25, 2001 Alex Feldman Added T1/E1 support (TE1). * Jul 21, 2000 Nenad Corbic Added WAN_FT1_READY State * Feb 24, 2000 Nenad Corbic Added support for socket based x25api @@ -120,6 +124,10 @@ enum router_ioctls #endif +#if defined(__WINDOWS__) +#undef __LINUX__ +#endif + /* identifiers for displaying proc file data for dual port adapters */ #define PROC_DATA_PORT_0 0x8000 /* the data is for port 0 */ #define PROC_DATA_PORT_1 0x8001 /* the data is for port 1 */ @@ -133,10 +141,11 @@ enum router_ioctls #define NLPID_ISIS 0x83 /* ISO/IEC ISIS */ #define NLPID_Q933 0x08 /* CCITT Q.933 */ - +#if !defined(__WINDOWS__) #ifndef WAN_DRVNAME_SZ #define WAN_DRVNAME_SZ 15 #endif +#endif /****** Data Types **********************************************************/ /*---------------------------------------------------------------------------- @@ -179,6 +188,9 @@ enum fe_status { FE_DISCONNECTED, FE_CONNECTED }; +#define WAN_FE_UNITIALIZED FE_UNITIALIZED +#define WAN_FE_DISCONNECTED FE_DISCONNECTED +#define WAN_FE_CONNECTED FE_CONNECTED /* 'modem_status' masks */ #define WAN_MODEM_CTS 0x0001 /* CTS line active */ @@ -211,6 +223,11 @@ typedef struct wan_conf # include # endif +#elif defined(__WINDOWS__) +# include +# include +# include +# include #else //# include # include @@ -244,11 +261,6 @@ typedef struct wan_conf /****** Kernel Interface ****************************************************/ - -/*---------------------------------------------------------------------------- - * WAN device data space. - */ - typedef struct wan_rtp_chan { netskb_t *rx_skb; @@ -258,7 +270,9 @@ typedef struct wan_rtp_chan }wan_rtp_chan_t; - +/*---------------------------------------------------------------------------- + * WAN device data space. + */ struct wan_dev_le { WAN_LIST_ENTRY(wan_dev_le) dev_link; netdevice_t *dev; @@ -266,12 +280,11 @@ struct wan_dev_le { #define WAN_DEVLE2DEV(devle) (devle && devle->dev) ? devle->dev : NULL WAN_LIST_HEAD(wan_dev_lhead, wan_dev_le); - typedef struct wan_device { unsigned magic; /* magic number */ char* name; /* -> WAN device name (ASCIIZ) */ - void* private; /* -> driver private data */ + void* priv; /* -> driver private data */ unsigned config_id; /* Configuration ID */ /****** hardware configuration ******/ unsigned ioport; /* adapter I/O port base #1 */ @@ -289,7 +302,7 @@ typedef struct wan_device unsigned int udp_port; /* UDP port for management */ unsigned char ttl; /* Time To Live for UDP security */ unsigned int enable_tx_int; /* Transmit Interrupt enabled or not */ - char interface; /* RS-232/V.35, etc. */ + char electrical_interface; /* RS-232/V.35, etc. */ char clocking; /* external/internal */ char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */ char station; /* DTE/DCE, primary/secondary, etc. */ @@ -364,9 +377,15 @@ typedef struct wan_device void (*ringtrip) (void* card_id, wan_event_t*); void (*ringdetect) (void* card_id, wan_event_t*); } event_callback; + unsigned char ignore_front_end_status; unsigned char line_idle; +#if defined(__WINDOWS__) + u32 card_type; + sdla_fe_cfg_t fe_cfg; +#else unsigned char card_type; +#endif atomic_t if_cnt; atomic_t if_up_cnt; wan_sdlc_conf_t sdlc_cfg; @@ -403,9 +422,10 @@ typedef struct wan_device sdla_fe_notify_iface_t fe_notify_iface; void *ec_dev; + unsigned long ec_enable_map; - unsigned long ec_map; - unsigned long ec_intmask; + unsigned long fe_ec_map; + wan_ticks_t ec_intmask; int (*ec_enable)(void *pcard, int, int); @@ -413,9 +433,7 @@ typedef struct wan_device unsigned char (*read_ec)(void*, unsigned short); int (*hwec_reset)(void* card_id, int); int (*hwec_enable)(void* card_id, int, int); - - void (*critical_event) (void *, int); - + unsigned long rtp_tap_call_map; unsigned long rtp_tap_call_status; wan_rtp_chan_t rtp_chan[32]; @@ -474,10 +492,11 @@ extern void wan_skb_destructor (struct sk_buff *skb); extern unsigned long wan_get_ip_address (netdevice_t *dev, int option); -void *wanpipe_ec_register(void*, int); +void *wanpipe_ec_register(void*, u_int32_t, int,int, void*); int wanpipe_ec_unregister(void*,void*); -int wanpipe_ec_isr(void*,void*); +int wanpipe_ec_isr(void*); int wanpipe_ec_poll(void*,void*); +int wanpipe_ec_ready(void*); int wanpipe_ec_event_ctrl(void*,void*,wan_event_ctrl_t*); #endif /* __KERNEL__ */ diff --git a/patches/kdrivers/include/xhfc24succ.h b/patches/kdrivers/include/xhfc24succ.h new file mode 100755 index 0000000..2615393 --- /dev/null +++ b/patches/kdrivers/include/xhfc24succ.h @@ -0,0 +1,2113 @@ +/*___________________________________________________________________________________*/ +/* */ +/* (C) Copyright Cologne Chip AG, 2006 */ +/*___________________________________________________________________________________*/ +/* */ + +/* */ +/* File name: xhfc24succ.h */ +/* File content: This file contains the XHFC-2S4U / XHFC-4SU register definitions. */ +/* Creation date: 10.01.2006 16:34 */ +/* Creator: Genero 3.2 */ +/* Data base: HFC XML 1.5 for XHFC-1SU, XHFC-2SU, XHFC-2S4U and XHFC-4SU */ +/* Address range: 0x00 - 0xFF */ +/* */ +/* The information presented can not be considered as assured characteristics. */ +/* Data can change without notice. Please check version numbers in case of doubt. */ +/* */ +/* For further information or questions please contact support@CologneChip.com */ +/* */ +/* */ +/*___________________________________________________________________________________*/ +/* */ +/* WARNING: This file has been generated automatically and should not be */ +/* changed to maintain compatibility with later versions. */ +/*___________________________________________________________________________________*/ +/* */ + + +#ifndef _XHFC24SUCC_H_ +#define _XHFC24SUCC_H_ + +/* Sangoma: 'BYTE' type defined in octtype.h */ +//#ifndef __OCTTYPE_H__ +//typedef unsigned char BYTE; +//#endif + +typedef unsigned char REGWORD; // maximum register length (standard) +typedef unsigned char REGADDR; // address width + + + +typedef enum {no=0, yes} REGBOOL; + + +typedef enum +{ + // register and bitmap access modes: + writeonly=0, // write only + readonly, // read only + readwrite, // read/write + // following modes only for mixed mode registers: + readwrite_write, // read/write and write only + readwrite_read, // read/write and read only + write_read, // write only and read only + readwrite_write_read // read/write, write only and read only +} ACCESSMODE; + + + +/*___________________________________________________________________________________*/ +/* */ +/* common chip information: */ +/*___________________________________________________________________________________*/ + + #define CHIP_NAME_2S4U "XHFC-2S4U" + #define CHIP_NAME_4SU "XHFC-4SU" + #define CHIP_TITLE_2S4U "ISDN HDLC FIFO controller 2 S/T interfaces combined with 4 Up interfaces (Universal ISDN Ports)" + #define CHIP_TITLE_4SU "ISDN HDLC FIFO controller with 4 S/T interfaces combined with 4 Up interfaces (Universal ISDN Ports)" + #define CHIP_MANUFACTURER "Cologne Chip" + #define CHIP_ID_2S4U 0x62 + #define CHIP_ID_4SU 0x63 + #define CHIP_REGISTER_COUNT 122 + #define CHIP_DATABASE "Version HFC-XMLHFC XML 1.5 for XHFC-1SU, XHFC-2SU, XHFC-2S4U and XHFC-4SU - GeneroGenero 3.2 " + +// This register file can also be used for XHFC-2SU and XHFC-1SU programming. +// For this reason these chip names, IDs and titles are defined here as well: + + #define CHIP_NAME_2SU "XHFC-2SU" + #define CHIP_TITLE_2SU "ISDN HDLC FIFO controller with 2 combined S/T and Up Interfaces" + #define CHIP_ID_2SU 0x61 + + #define CHIP_NAME_1SU "XHFC-1SU" + #define CHIP_TITLE_1SU "ISDN HDLC FIFO controller with a combined S/T and Up Interface" + #define CHIP_ID_1SU 0x60 + + + + +/*___________________________________________________________________________________*/ +/* */ +/* Begin of XHFC-2S4U / XHFC-4SU register definitions. */ +/*___________________________________________________________________________________*/ +/* */ + +#define R_CIRM 0x00 // register access + #define M_CLK_OFF 0x01 // bitmap mask (1bit) + #define M_WAIT_PROC 0x02 // bitmap mask (1bit) + #define M_WAIT_REG 0x04 // bitmap mask (1bit) + #define M_SRES 0x08 // bitmap mask (1bit) + #define M_HFC_RES 0x10 // bitmap mask (1bit) + #define M_PCM_RES 0x20 // bitmap mask (1bit) + #define M_SU_RES 0x40 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_clk_off:1; + REGWORD v_wait_proc:1; + REGWORD v_wait_reg:1; + REGWORD v_sres:1; + REGWORD v_hfc_res:1; + REGWORD v_pcm_res:1; + REGWORD v_su_res:1; + REGWORD reserved_0:1; + } bit_r_cirm; // register and bitmap data + typedef union {REGWORD reg; bit_r_cirm bit;} reg_r_cirm; // register and bitmap access + + +#define R_CTRL 0x01 // register access + #define M_FIFO_LPRIO 0x02 // bitmap mask (1bit) + #define M_NT_SYNC 0x08 // bitmap mask (1bit) + #define M_OSC_OFF 0x20 // bitmap mask (1bit) + #define M_SU_CLK 0xC0 // bitmap mask (2bit) + #define M1_SU_CLK 0x40 + + typedef struct // bitmap construction + { + REGWORD reserved_1:1; + REGWORD v_fifo_lprio:1; + REGWORD reserved_2:1; + REGWORD v_nt_sync:1; + REGWORD reserved_3:1; + REGWORD v_osc_off:1; + REGWORD v_su_clk:2; + } bit_r_ctrl; // register and bitmap data + typedef union {REGWORD reg; bit_r_ctrl bit;} reg_r_ctrl; // register and bitmap access + + +#define R_CLK_CFG 0x02 // register access + #define M_CLK_PLL 0x01 // bitmap mask (1bit) + #define M_CLKO_HI 0x02 // bitmap mask (1bit) + #define M_CLKO_PLL 0x04 // bitmap mask (1bit) + #define M_PCM_CLK 0x20 // bitmap mask (1bit) + #define M_CLKO_OFF 0x40 // bitmap mask (1bit) + #define M_CLK_F1 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_clk_pll:1; + REGWORD v_clko_hi:1; + REGWORD v_clko_pll:1; + REGWORD reserved_4:2; + REGWORD v_pcm_clk:1; + REGWORD v_clko_off:1; + REGWORD v_clk_f1:1; + } bit_r_clk_cfg; // register and bitmap data + typedef union {REGWORD reg; bit_r_clk_cfg bit;} reg_r_clk_cfg; // register and bitmap access + + +#define A_Z1 0x04 // register access + #define M_Z1 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_z1:8; + } bit_a_z1; // register and bitmap data + typedef union {REGWORD reg; bit_a_z1 bit;} reg_a_z1; // register and bitmap access + + +#define A_Z2 0x06 // register access + #define M_Z2 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_z2:8; + } bit_a_z2; // register and bitmap data + typedef union {REGWORD reg; bit_a_z2 bit;} reg_a_z2; // register and bitmap access + + +#define R_RAM_ADDR 0x08 // register access + #define M_RAM_ADDR0 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_ram_addr0:8; + } bit_r_ram_addr; // register and bitmap data + typedef union {REGWORD reg; bit_r_ram_addr bit;} reg_r_ram_addr; // register and bitmap access + + +#define R_RAM_CTRL 0x09 // register access + #define M_RAM_ADDR1 0x0F // bitmap mask (4bit) + #define M1_RAM_ADDR1 0x01 + #define M_ADDR_RES 0x40 // bitmap mask (1bit) + #define M_ADDR_INC 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_ram_addr1:4; + REGWORD reserved_5:2; + REGWORD v_addr_res:1; + REGWORD v_addr_inc:1; + } bit_r_ram_ctrl; // register and bitmap data + typedef union {REGWORD reg; bit_r_ram_ctrl bit;} reg_r_ram_ctrl; // register and bitmap access + + +#define R_FIRST_FIFO 0x0B // register access + #define M_FIRST_FIFO_DIR 0x01 // bitmap mask (1bit) + #define M_FIRST_FIFO_NUM 0x1E // bitmap mask (4bit) + #define M1_FIRST_FIFO_NUM 0x02 + + typedef struct // bitmap construction + { + REGWORD v_first_fifo_dir:1; + REGWORD v_first_fifo_num:4; + REGWORD reserved_6:3; + } bit_r_first_fifo; // register and bitmap data + typedef union {REGWORD reg; bit_r_first_fifo bit;} reg_r_first_fifo; // register and bitmap access + + +#define R_FIFO_THRES 0x0C // register access + #define M_THRES_TX 0x0F // bitmap mask (4bit) + #define M1_THRES_TX 0x01 + #define M_THRES_RX 0xF0 // bitmap mask (4bit) + #define M1_THRES_RX 0x10 + + typedef struct // bitmap construction + { + REGWORD v_thres_tx:4; + REGWORD v_thres_rx:4; + } bit_r_fifo_thres; // register and bitmap data + typedef union {REGWORD reg; bit_r_fifo_thres bit;} reg_r_fifo_thres; // register and bitmap access + + +#define A_F1 0x0C // register access + #define M_F1 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_f1:8; + } bit_a_f1; // register and bitmap data + typedef union {REGWORD reg; bit_a_f1 bit;} reg_a_f1; // register and bitmap access + + +#define R_FIFO_MD 0x0D // register access + #define M_FIFO_MD 0x03 // bitmap mask (2bit) + #define M1_FIFO_MD 0x01 + #define M_DF_MD 0x0C // bitmap mask (2bit) + #define M1_DF_MD 0x04 + #define M_UNIDIR_MD 0x10 // bitmap mask (1bit) + #define M_UNIDIR_RX 0x20 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_fifo_md:2; + REGWORD v_df_md:2; + REGWORD v_unidir_md:1; + REGWORD v_unidir_rx:1; + REGWORD reserved_7:2; + } bit_r_fifo_md; // register and bitmap data + typedef union {REGWORD reg; bit_r_fifo_md bit;} reg_r_fifo_md; // register and bitmap access + + +#define A_F2 0x0D // register access + #define M_F2 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_f2:8; + } bit_a_f2; // register and bitmap data + typedef union {REGWORD reg; bit_a_f2 bit;} reg_a_f2; // register and bitmap access + + +#define A_INC_RES_FIFO 0x0E // register access + #define M_INC_F 0x01 // bitmap mask (1bit) + #define M_RES_FIFO 0x02 // bitmap mask (1bit) + #define M_RES_LOST 0x04 // bitmap mask (1bit) + #define M_RES_FIFO_ERR 0x08 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_inc_f:1; + REGWORD v_res_fifo:1; + REGWORD v_res_lost:1; + REGWORD v_res_fifo_err:1; + REGWORD reserved_8:4; + } bit_a_inc_res_fifo; // register and bitmap data + typedef union {REGWORD reg; bit_a_inc_res_fifo bit;} reg_a_inc_res_fifo; // register and bitmap access + + +#define A_FIFO_STA 0x0E // register access + #define M_FIFO_ERR 0x01 // bitmap mask (1bit) + #define M_ABO_DONE 0x10 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_fifo_err:1; + REGWORD reserved_11:3; + REGWORD v_abo_done:1; + REGWORD reserved_12:3; + } bit_a_fifo_sta; // register and bitmap data + typedef union {REGWORD reg; bit_a_fifo_sta bit;} reg_a_fifo_sta; // register and bitmap access + + +#define R_FSM_IDX 0x0F // register access + #define M_IDX 0x1F // bitmap mask (5bit) + #define M1_IDX 0x01 + + typedef struct // bitmap construction + { + REGWORD v_idx:5; + REGWORD reserved_10:3; + } bit_r_fsm_idx; // register and bitmap data + typedef union {REGWORD reg; bit_r_fsm_idx bit;} reg_r_fsm_idx; // register and bitmap access + + +#define R_FIFO 0x0F // register access + #define M_FIFO_DIR 0x01 // bitmap mask (1bit) + #define M_FIFO_NUM 0x1E // bitmap mask (4bit) + #define M1_FIFO_NUM 0x02 + #define M_REV 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_fifo_dir:1; + REGWORD v_fifo_num:4; + REGWORD reserved_9:2; + REGWORD v_rev:1; + } bit_r_fifo; // register and bitmap data + typedef union {REGWORD reg; bit_r_fifo bit;} reg_r_fifo; // register and bitmap access + + +#define R_SLOT 0x10 // register access + #define M_SL_DIR 0x01 // bitmap mask (1bit) + #define M_SL_NUM 0xFE // bitmap mask (7bit) + + typedef struct // bitmap construction + { + REGWORD v_sl_dir:1; + REGWORD v_sl_num:7; + } bit_r_slot; // register and bitmap data + typedef union {REGWORD reg; bit_r_slot bit;} reg_r_slot; // register and bitmap access + + +#define R_IRQ_OVIEW 0x10 // register access + #define M_FIFO_BL0_IRQ 0x01 // bitmap mask (1bit) + #define M_FIFO_BL1_IRQ 0x02 // bitmap mask (1bit) + #define M_FIFO_BL2_IRQ 0x04 // bitmap mask (1bit) + #define M_FIFO_BL3_IRQ 0x08 // bitmap mask (1bit) + #define M_MISC_IRQ 0x10 // bitmap mask (1bit) + #define M_CH_IRQ 0x20 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_fifo_bl0_irq:1; + REGWORD v_fifo_bl1_irq:1; + REGWORD v_fifo_bl2_irq:1; + REGWORD v_fifo_bl3_irq:1; + REGWORD v_misc_irq:1; + REGWORD v_ch_irq:1; + REGWORD reserved_19:2; + } bit_r_irq_oview; // register and bitmap data + typedef union {REGWORD reg; bit_r_irq_oview bit;} reg_r_irq_oview; // register and bitmap access + + +#define R_MISC_IRQMSK 0x11 // register access + #define M_SLIP_IRQMSK 0x01 // bitmap mask (1bit) + #define M_TI_IRQMSK 0x02 // bitmap mask (1bit) + #define M_PROC_IRQMSK 0x04 // bitmap mask (1bit) + #define M_CI_IRQMSK 0x10 // bitmap mask (1bit) + #define M_WAK_IRQMSK 0x20 // bitmap mask (1bit) + #define M_MON_TX_IRQMSK 0x40 // bitmap mask (1bit) + #define M_MON_RX_IRQMSK 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_slip_irqmsk:1; + REGWORD v_ti_irqmsk:1; + REGWORD v_proc_irqmsk:1; + REGWORD reserved_13:1; + REGWORD v_ci_irqmsk:1; + REGWORD v_wak_irqmsk:1; + REGWORD v_mon_tx_irqmsk:1; + REGWORD v_mon_rx_irqmsk:1; + } bit_r_misc_irqmsk; // register and bitmap data + typedef union {REGWORD reg; bit_r_misc_irqmsk bit;} reg_r_misc_irqmsk; // register and bitmap access + + +#define R_MISC_IRQ 0x11 // register access + #define M_SLIP_IRQ 0x01 // bitmap mask (1bit) + #define M_TI_IRQ 0x02 // bitmap mask (1bit) + #define M_PROC_IRQ 0x04 // bitmap mask (1bit) + #define M_CI_IRQ 0x10 // bitmap mask (1bit) + #define M_WAK_IRQ 0x20 // bitmap mask (1bit) + #define M_MON_TX_IRQ 0x40 // bitmap mask (1bit) + #define M_MON_RX_IRQ 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_slip_irq:1; + REGWORD v_ti_irq:1; + REGWORD v_proc_irq:1; + REGWORD reserved_20:1; + REGWORD v_ci_irq:1; + REGWORD v_wak_irq:1; + REGWORD v_mon_tx_irq:1; + REGWORD v_mon_rx_irq:1; + } bit_r_misc_irq; // register and bitmap data + typedef union {REGWORD reg; bit_r_misc_irq bit;} reg_r_misc_irq; // register and bitmap access + + +#define R_SU_IRQ 0x12 // register access + #define M_SU0_IRQ 0x01 // bitmap mask (1bit) + #define M_SU1_IRQ 0x02 // bitmap mask (1bit) + #define M_SU2_IRQ 0x04 // bitmap mask (1bit) + #define M_SU3_IRQ 0x08 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_su0_irq:1; + REGWORD v_su1_irq:1; + REGWORD v_su2_irq:1; + REGWORD v_su3_irq:1; + REGWORD reserved_27:4; + } bit_r_su_irq; // register and bitmap data + typedef union {REGWORD reg; bit_r_su_irq bit;} reg_r_su_irq; // register and bitmap access + + +#define R_SU_IRQMSK 0x12 // register access + #define M_SU0_IRQMSK 0x01 // bitmap mask (1bit) + #define M_SU1_IRQMSK 0x02 // bitmap mask (1bit) + #define M_SU2_IRQMSK 0x04 // bitmap mask (1bit) + #define M_SU3_IRQMSK 0x08 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_su0_irqmsk:1; + REGWORD v_su1_irqmsk:1; + REGWORD v_su2_irqmsk:1; + REGWORD v_su3_irqmsk:1; + REGWORD reserved_29:4; + } bit_r_su_irqmsk; // register and bitmap data + typedef union {REGWORD reg; bit_r_su_irqmsk bit;} reg_r_su_irqmsk; // register and bitmap access + + +#define R_AF0_OVIEW 0x13 // register access + #define M_SU0_AF0 0x01 // bitmap mask (1bit) + #define M_SU1_AF0 0x02 // bitmap mask (1bit) + #define M_SU2_AF0 0x04 // bitmap mask (1bit) + #define M_SU3_AF0 0x08 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_su0_af0:1; + REGWORD v_su1_af0:1; + REGWORD v_su2_af0:1; + REGWORD v_su3_af0:1; + REGWORD reserved_28:4; + } bit_r_af0_oview; // register and bitmap data + typedef union {REGWORD reg; bit_r_af0_oview bit;} reg_r_af0_oview; // register and bitmap access + + +#define R_IRQ_CTRL 0x13 // register access + #define M_FIFO_IRQ_EN 0x01 // bitmap mask (1bit) + #define M_GLOB_IRQ_EN 0x08 // bitmap mask (1bit) + #define M_IRQ_POL 0x10 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_fifo_irq_en:1; + REGWORD reserved_14:2; + REGWORD v_glob_irq_en:1; + REGWORD v_irq_pol:1; + REGWORD reserved_15:3; + } bit_r_irq_ctrl; // register and bitmap data + typedef union {REGWORD reg; bit_r_irq_ctrl bit;} reg_r_irq_ctrl; // register and bitmap access + + +#define A_USAGE 0x14 // register access + #define M_USAGE 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_usage:8; + } bit_a_usage; // register and bitmap data + typedef union {REGWORD reg; bit_a_usage bit;} reg_a_usage; // register and bitmap access + + +#define R_PCM_MD0 0x14 // register access + #define M_PCM_MD 0x01 // bitmap mask (1bit) + #define M_C4_POL 0x02 // bitmap mask (1bit) + #define M_F0_NEG 0x04 // bitmap mask (1bit) + #define M_F0_LEN 0x08 // bitmap mask (1bit) + #define M_PCM_IDX 0xF0 // bitmap mask (4bit) + #define M1_PCM_IDX 0x10 + + typedef struct // bitmap construction + { + REGWORD v_pcm_md:1; + REGWORD v_c4_pol:1; + REGWORD v_f0_neg:1; + REGWORD v_f0_len:1; + REGWORD v_pcm_idx:4; + } bit_r_pcm_md0; // register and bitmap data + typedef union {REGWORD reg; bit_r_pcm_md0 bit;} reg_r_pcm_md0; // register and bitmap access + + +#define R_SL_SEL0 0x15 // register access + #define M_SL_SEL0 0x7F // bitmap mask (7bit) + #define M_SH_SEL0 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_sl_sel0:7; + REGWORD v_sh_sel0:1; + } bit_r_sl_sel0; // register and bitmap data + typedef union {REGWORD reg; bit_r_sl_sel0 bit;} reg_r_sl_sel0; // register and bitmap access + + +#define R_SL_SEL1 0x15 // register access + #define M_SL_SEL1 0x7F // bitmap mask (7bit) + #define M_SH_SEL1 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_sl_sel1:7; + REGWORD v_sh_sel1:1; + } bit_r_sl_sel1; // register and bitmap data + typedef union {REGWORD reg; bit_r_sl_sel1 bit;} reg_r_sl_sel1; // register and bitmap access + + +#define R_SL_SEL7 0x15 // register access + #define M_SL_SEL7 0x7F // bitmap mask (7bit) + + typedef struct // bitmap construction + { + REGWORD v_sl_sel7:7; + REGWORD reserved_30:1; + } bit_r_sl_sel7; // register and bitmap data + typedef union {REGWORD reg; bit_r_sl_sel7 bit;} reg_r_sl_sel7; // register and bitmap access + + +#define R_MSS0 0x15 // register access + #define M_MSS_MOD 0x01 // bitmap mask (1bit) + #define M_MSS_MOD_REP 0x02 // bitmap mask (1bit) + #define M_MSS_SRC_EN 0x04 // bitmap mask (1bit) + #define M_MSS_SRC_GRD 0x08 // bitmap mask (1bit) + #define M_MSS_OUT_EN 0x10 // bitmap mask (1bit) + #define M_MSS_OUT_REP 0x20 // bitmap mask (1bit) + #define M_MSS_SRC 0xC0 // bitmap mask (2bit) + #define M1_MSS_SRC 0x40 + + typedef struct // bitmap construction + { + REGWORD v_mss_mod:1; + REGWORD v_mss_mod_rep:1; + REGWORD v_mss_src_en:1; + REGWORD v_mss_src_grd:1; + REGWORD v_mss_out_en:1; + REGWORD v_mss_out_rep:1; + REGWORD v_mss_src:2; + } bit_r_mss0; // register and bitmap data + typedef union {REGWORD reg; bit_r_mss0 bit;} reg_r_mss0; // register and bitmap access + + +#define R_PCM_MD1 0x15 // register access + #define M_PCM_OD 0x02 // bitmap mask (1bit) + #define M_PLL_ADJ 0x0C // bitmap mask (2bit) + #define M1_PLL_ADJ 0x04 + #define M_PCM_DR 0x30 // bitmap mask (2bit) + #define M1_PCM_DR 0x10 + #define M_PCM_LOOP 0x40 // bitmap mask (1bit) + #define M_PCM_SMPL 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD reserved_31:1; + REGWORD v_pcm_od:1; + REGWORD v_pll_adj:2; + REGWORD v_pcm_dr:2; + REGWORD v_pcm_loop:1; + REGWORD v_pcm_smpl:1; + } bit_r_pcm_md1; // register and bitmap data + typedef union {REGWORD reg; bit_r_pcm_md1 bit;} reg_r_pcm_md1; // register and bitmap access + + +#define R_PCM_MD2 0x15 // register access + #define M_SYNC_OUT1 0x02 // bitmap mask (1bit) + #define M_SYNC_SRC 0x04 // bitmap mask (1bit) + #define M_SYNC_OUT2 0x08 // bitmap mask (1bit) + #define M_C2O_EN 0x10 // bitmap mask (1bit) + #define M_C2I_EN 0x20 // bitmap mask (1bit) + #define M_PLL_ICR 0x40 // bitmap mask (1bit) + #define M_PLL_MAN 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD reserved_32:1; + REGWORD v_sync_out1:1; + REGWORD v_sync_src:1; + REGWORD v_sync_out2:1; + REGWORD v_c2o_en:1; + REGWORD v_c2i_en:1; + REGWORD v_pll_icr:1; + REGWORD v_pll_man:1; + } bit_r_pcm_md2; // register and bitmap data + typedef union {REGWORD reg; bit_r_pcm_md2 bit;} reg_r_pcm_md2; // register and bitmap access + + +#define R_MSS1 0x15 // register access + #define M_MSS_OFFS 0x07 // bitmap mask (3bit) + #define M1_MSS_OFFS 0x01 + #define M_MS_SSYNC1 0x08 // bitmap mask (1bit) + #define M_MSS_DLY 0xF0 // bitmap mask (4bit) + #define M1_MSS_DLY 0x10 + + typedef struct // bitmap construction + { + REGWORD v_mss_offs:3; + REGWORD v_ms_ssync1:1; + REGWORD v_mss_dly:4; + } bit_r_mss1; // register and bitmap data + typedef union {REGWORD reg; bit_r_mss1 bit;} reg_r_mss1; // register and bitmap access + + +#define R_SH0L 0x15 // register access + #define M_SH0L 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_sh0l:8; + } bit_r_sh0l; // register and bitmap data + typedef union {REGWORD reg; bit_r_sh0l bit;} reg_r_sh0l; // register and bitmap access + + +#define R_SH0H 0x15 // register access + #define M_SH0H 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_sh0h:8; + } bit_r_sh0h; // register and bitmap data + typedef union {REGWORD reg; bit_r_sh0h bit;} reg_r_sh0h; // register and bitmap access + + +#define R_SH1L 0x15 // register access + #define M_SH1L 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_sh1l:8; + } bit_r_sh1l; // register and bitmap data + typedef union {REGWORD reg; bit_r_sh1l bit;} reg_r_sh1l; // register and bitmap access + + +#define R_SH1H 0x15 // register access + #define M_SH1H 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_sh1h:8; + } bit_r_sh1h; // register and bitmap data + typedef union {REGWORD reg; bit_r_sh1h bit;} reg_r_sh1h; // register and bitmap access + + +#define R_RAM_USE 0x15 // register access + #define M_SRAM_USE 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_sram_use:8; + } bit_r_ram_use; // register and bitmap data + typedef union {REGWORD reg; bit_r_ram_use bit;} reg_r_ram_use; // register and bitmap access + + +#define R_SU_SEL 0x16 // register access + #define M_SU_SEL 0x03 // bitmap mask (2bit) + #define M1_SU_SEL 0x01 + #define M_MULT_SU 0x08 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_su_sel:2; + REGWORD reserved_25:1; + REGWORD v_mult_su:1; + REGWORD reserved_26:4; + } bit_r_su_sel; // register and bitmap data + typedef union {REGWORD reg; bit_r_su_sel bit;} reg_r_su_sel; // register and bitmap access + + +#define R_CHIP_ID 0x16 // register access + #define M_CHIP_ID 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_chip_id:8; + } bit_r_chip_id; // register and bitmap data + typedef union {REGWORD reg; bit_r_chip_id bit;} reg_r_chip_id; // register and bitmap access + + +#define R_SU_SYNC 0x17 // register access + #define M_SYNC_SEL 0x07 // bitmap mask (3bit) + #define M1_SYNC_SEL 0x01 + #define M_MAN_SYNC 0x08 // bitmap mask (1bit) + #define M_AUTO_SYNCI 0x10 // bitmap mask (1bit) + #define M_D_MERGE_TX 0x20 // bitmap mask (1bit) + #define M_E_MERGE_RX 0x40 // bitmap mask (1bit) + #define M_D_MERGE_RX 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_sync_sel:3; + REGWORD v_man_sync:1; + REGWORD v_auto_synci:1; + REGWORD v_d_merge_tx:1; + REGWORD v_e_merge_rx:1; + REGWORD v_d_merge_rx:1; + } bit_r_su_sync; // register and bitmap data + typedef union {REGWORD reg; bit_r_su_sync bit;} reg_r_su_sync; // register and bitmap access + + +#define R_BERT_STA 0x17 // register access + #define M_RD_SYNC_SRC 0x07 // bitmap mask (3bit) + #define M1_RD_SYNC_SRC 0x01 + #define M_BERT_SYNC 0x10 // bitmap mask (1bit) + #define M_BERT_INV_DATA 0x20 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_rd_sync_src:3; + REGWORD reserved_21:1; + REGWORD v_bert_sync:1; + REGWORD v_bert_inv_data:1; + REGWORD reserved_22:2; + } bit_r_bert_sta; // register and bitmap data + typedef union {REGWORD reg; bit_r_bert_sta bit;} reg_r_bert_sta; // register and bitmap access + + +#define R_F0_CNTL 0x18 // register access + #define M_F0_CNTL 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_f0_cntl:8; + } bit_r_f0_cntl; // register and bitmap data + typedef union {REGWORD reg; bit_r_f0_cntl bit;} reg_r_f0_cntl; // register and bitmap access + + +#define R_F0_CNTH 0x19 // register access + #define M_F0_CNTH 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_f0_cnth:8; + } bit_r_f0_cnth; // register and bitmap data + typedef union {REGWORD reg; bit_r_f0_cnth bit;} reg_r_f0_cnth; // register and bitmap access + + +#define R_BERT_ECL 0x1A // register access + #define M_BERT_ECL 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_bert_ecl:8; + } bit_r_bert_ecl; // register and bitmap data + typedef union {REGWORD reg; bit_r_bert_ecl bit;} reg_r_bert_ecl; // register and bitmap access + + +#define R_TI_WD 0x1A // register access + #define M_EV_TS 0x0F // bitmap mask (4bit) + #define M1_EV_TS 0x01 + #define M_WD_TS 0xF0 // bitmap mask (4bit) + #define M1_WD_TS 0x10 + + typedef struct // bitmap construction + { + REGWORD v_ev_ts:4; + REGWORD v_wd_ts:4; + } bit_r_ti_wd; // register and bitmap data + typedef union {REGWORD reg; bit_r_ti_wd bit;} reg_r_ti_wd; // register and bitmap access + + +#define R_BERT_ECH 0x1B // register access + #define M_BERT_ECH 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_bert_ech:8; + } bit_r_bert_ech; // register and bitmap data + typedef union {REGWORD reg; bit_r_bert_ech bit;} reg_r_bert_ech; // register and bitmap access + + +#define R_BERT_WD_MD 0x1B // register access + #define M_PAT_SEQ 0x07 // bitmap mask (3bit) + #define M1_PAT_SEQ 0x01 + #define M_BERT_ERR 0x08 // bitmap mask (1bit) + #define M_AUTO_WD_RES 0x20 // bitmap mask (1bit) + #define M_WD_RES 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_pat_seq:3; + REGWORD v_bert_err:1; + REGWORD reserved_16:1; + REGWORD v_auto_wd_res:1; + REGWORD reserved_17:1; + REGWORD v_wd_res:1; + } bit_r_bert_wd_md; // register and bitmap data + typedef union {REGWORD reg; bit_r_bert_wd_md bit;} reg_r_bert_wd_md; // register and bitmap access + + +#define R_STATUS 0x1C // register access + #define M_BUSY 0x01 // bitmap mask (1bit) + #define M_PROC 0x02 // bitmap mask (1bit) + #define M_LOST_STA 0x08 // bitmap mask (1bit) + #define M_PCM_INIT 0x10 // bitmap mask (1bit) + #define M_WAK_STA 0x20 // bitmap mask (1bit) + #define M_MISC_IRQSTA 0x40 // bitmap mask (1bit) + #define M_FR_IRQSTA 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_busy:1; + REGWORD v_proc:1; + REGWORD reserved_23:1; + REGWORD v_lost_sta:1; + REGWORD v_pcm_init:1; + REGWORD v_wak_sta:1; + REGWORD v_misc_irqsta:1; + REGWORD v_fr_irqsta:1; + } bit_r_status; // register and bitmap data + typedef union {REGWORD reg; bit_r_status bit;} reg_r_status; // register and bitmap access + + +#define R_SL_MAX 0x1D // register access + #define M_SL_MAX 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_sl_max:8; + } bit_r_sl_max; // register and bitmap data + typedef union {REGWORD reg; bit_r_sl_max bit;} reg_r_sl_max; // register and bitmap access + + +#define R_PWM_CFG 0x1E // register access + #define M_PWM0_16KHZ 0x10 // bitmap mask (1bit) + #define M_PWM1_16KHZ 0x20 // bitmap mask (1bit) + #define M_PWM_FRQ 0xC0 // bitmap mask (2bit) + #define M1_PWM_FRQ 0x40 + + typedef struct // bitmap construction + { + REGWORD reserved_18:4; + REGWORD v_pwm0_16khz:1; + REGWORD v_pwm1_16khz:1; + REGWORD v_pwm_frq:2; + } bit_r_pwm_cfg; // register and bitmap data + typedef union {REGWORD reg; bit_r_pwm_cfg bit;} reg_r_pwm_cfg; // register and bitmap access + + +#define R_CHIP_RV 0x1F // register access + #define M_CHIP_RV 0x0F // bitmap mask (4bit) + #define M1_CHIP_RV 0x01 + + typedef struct // bitmap construction + { + REGWORD v_chip_rv:4; + REGWORD reserved_24:4; + } bit_r_chip_rv; // register and bitmap data + typedef union {REGWORD reg; bit_r_chip_rv bit;} reg_r_chip_rv; // register and bitmap access + + +#define R_FIFO_BL0_IRQ 0x20 // register access + #define M_FIFO0_TX_IRQ 0x01 // bitmap mask (1bit) + #define M_FIFO0_RX_IRQ 0x02 // bitmap mask (1bit) + #define M_FIFO1_TX_IRQ 0x04 // bitmap mask (1bit) + #define M_FIFO1_RX_IRQ 0x08 // bitmap mask (1bit) + #define M_FIFO2_TX_IRQ 0x10 // bitmap mask (1bit) + #define M_FIFO2_RX_IRQ 0x20 // bitmap mask (1bit) + #define M_FIFO3_TX_IRQ 0x40 // bitmap mask (1bit) + #define M_FIFO3_RX_IRQ 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_fifo0_tx_irq:1; + REGWORD v_fifo0_rx_irq:1; + REGWORD v_fifo1_tx_irq:1; + REGWORD v_fifo1_rx_irq:1; + REGWORD v_fifo2_tx_irq:1; + REGWORD v_fifo2_rx_irq:1; + REGWORD v_fifo3_tx_irq:1; + REGWORD v_fifo3_rx_irq:1; + } bit_r_fifo_bl0_irq; // register and bitmap data + typedef union {REGWORD reg; bit_r_fifo_bl0_irq bit;} reg_r_fifo_bl0_irq; // register and bitmap access + + +#define R_FIFO_BL1_IRQ 0x21 // register access + #define M_FIFO4_TX_IRQ 0x01 // bitmap mask (1bit) + #define M_FIFO4_RX_IRQ 0x02 // bitmap mask (1bit) + #define M_FIFO5_TX_IRQ 0x04 // bitmap mask (1bit) + #define M_FIFO5_RX_IRQ 0x08 // bitmap mask (1bit) + #define M_FIFO6_TX_IRQ 0x10 // bitmap mask (1bit) + #define M_FIFO6_RX_IRQ 0x20 // bitmap mask (1bit) + #define M_FIFO7_TX_IRQ 0x40 // bitmap mask (1bit) + #define M_FIFO7_RX_IRQ 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_fifo4_tx_irq:1; + REGWORD v_fifo4_rx_irq:1; + REGWORD v_fifo5_tx_irq:1; + REGWORD v_fifo5_rx_irq:1; + REGWORD v_fifo6_tx_irq:1; + REGWORD v_fifo6_rx_irq:1; + REGWORD v_fifo7_tx_irq:1; + REGWORD v_fifo7_rx_irq:1; + } bit_r_fifo_bl1_irq; // register and bitmap data + typedef union {REGWORD reg; bit_r_fifo_bl1_irq bit;} reg_r_fifo_bl1_irq; // register and bitmap access + + +#define R_FIFO_BL2_IRQ 0x22 // register access + #define M_FIFO8_TX_IRQ 0x01 // bitmap mask (1bit) + #define M_FIFO8_RX_IRQ 0x02 // bitmap mask (1bit) + #define M_FIFO9_TX_IRQ 0x04 // bitmap mask (1bit) + #define M_FIFO9_RX_IRQ 0x08 // bitmap mask (1bit) + #define M_FIFO10_TX_IRQ 0x10 // bitmap mask (1bit) + #define M_FIFO10_RX_IRQ 0x20 // bitmap mask (1bit) + #define M_FIFO11_TX_IRQ 0x40 // bitmap mask (1bit) + #define M_FIFO11_RX_IRQ 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_fifo8_tx_irq:1; + REGWORD v_fifo8_rx_irq:1; + REGWORD v_fifo9_tx_irq:1; + REGWORD v_fifo9_rx_irq:1; + REGWORD v_fifo10_tx_irq:1; + REGWORD v_fifo10_rx_irq:1; + REGWORD v_fifo11_tx_irq:1; + REGWORD v_fifo11_rx_irq:1; + } bit_r_fifo_bl2_irq; // register and bitmap data + typedef union {REGWORD reg; bit_r_fifo_bl2_irq bit;} reg_r_fifo_bl2_irq; // register and bitmap access + + +#define R_FIFO_BL3_IRQ 0x23 // register access + #define M_FIFO12_TX_IRQ 0x01 // bitmap mask (1bit) + #define M_FIFO12_RX_IRQ 0x02 // bitmap mask (1bit) + #define M_FIFO13_TX_IRQ 0x04 // bitmap mask (1bit) + #define M_FIFO13_RX_IRQ 0x08 // bitmap mask (1bit) + #define M_FIFO14_TX_IRQ 0x10 // bitmap mask (1bit) + #define M_FIFO14_RX_IRQ 0x20 // bitmap mask (1bit) + #define M_FIFO15_TX_IRQ 0x40 // bitmap mask (1bit) + #define M_FIFO15_RX_IRQ 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_fifo12_tx_irq:1; + REGWORD v_fifo12_rx_irq:1; + REGWORD v_fifo13_tx_irq:1; + REGWORD v_fifo13_rx_irq:1; + REGWORD v_fifo14_tx_irq:1; + REGWORD v_fifo14_rx_irq:1; + REGWORD v_fifo15_tx_irq:1; + REGWORD v_fifo15_rx_irq:1; + } bit_r_fifo_bl3_irq; // register and bitmap data + typedef union {REGWORD reg; bit_r_fifo_bl3_irq bit;} reg_r_fifo_bl3_irq; // register and bitmap access + + +#define R_FILL_BL0 0x24 // register access + #define M_FILL_FIFO0_TX 0x01 // bitmap mask (1bit) + #define M_FILL_FIFO0_RX 0x02 // bitmap mask (1bit) + #define M_FILL_FIFO1_TX 0x04 // bitmap mask (1bit) + #define M_FILL_FIFO1_RX 0x08 // bitmap mask (1bit) + #define M_FILL_FIFO2_TX 0x10 // bitmap mask (1bit) + #define M_FILL_FIFO2_RX 0x20 // bitmap mask (1bit) + #define M_FILL_FIFO3_TX 0x40 // bitmap mask (1bit) + #define M_FILL_FIFO3_RX 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_fill_fifo0_tx:1; + REGWORD v_fill_fifo0_rx:1; + REGWORD v_fill_fifo1_tx:1; + REGWORD v_fill_fifo1_rx:1; + REGWORD v_fill_fifo2_tx:1; + REGWORD v_fill_fifo2_rx:1; + REGWORD v_fill_fifo3_tx:1; + REGWORD v_fill_fifo3_rx:1; + } bit_r_fill_bl0; // register and bitmap data + typedef union {REGWORD reg; bit_r_fill_bl0 bit;} reg_r_fill_bl0; // register and bitmap access + + +#define R_FILL_BL1 0x25 // register access + #define M_FILL_FIFO4_TX 0x01 // bitmap mask (1bit) + #define M_FILL_FIFO4_RX 0x02 // bitmap mask (1bit) + #define M_FILL_FIFO5_TX 0x04 // bitmap mask (1bit) + #define M_FILL_FIFO5_RX 0x08 // bitmap mask (1bit) + #define M_FILL_FIFO6_TX 0x10 // bitmap mask (1bit) + #define M_FILL_FIFO6_RX 0x20 // bitmap mask (1bit) + #define M_FILL_FIFO7_TX 0x40 // bitmap mask (1bit) + #define M_FILL_FIFO7_RX 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_fill_fifo4_tx:1; + REGWORD v_fill_fifo4_rx:1; + REGWORD v_fill_fifo5_tx:1; + REGWORD v_fill_fifo5_rx:1; + REGWORD v_fill_fifo6_tx:1; + REGWORD v_fill_fifo6_rx:1; + REGWORD v_fill_fifo7_tx:1; + REGWORD v_fill_fifo7_rx:1; + } bit_r_fill_bl1; // register and bitmap data + typedef union {REGWORD reg; bit_r_fill_bl1 bit;} reg_r_fill_bl1; // register and bitmap access + + +#define R_FILL_BL2 0x26 // register access + #define M_FILL_FIFO8_TX 0x01 // bitmap mask (1bit) + #define M_FILL_FIFO8_RX 0x02 // bitmap mask (1bit) + #define M_FILL_FIFO9_TX 0x04 // bitmap mask (1bit) + #define M_FILL_FIFO9_RX 0x08 // bitmap mask (1bit) + #define M_FILL_FIFO10_TX 0x10 // bitmap mask (1bit) + #define M_FILL_FIFO10_RX 0x20 // bitmap mask (1bit) + #define M_FILL_FIFO11_TX 0x40 // bitmap mask (1bit) + #define M_FILL_FIFO11_RX 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_fill_fifo8_tx:1; + REGWORD v_fill_fifo8_rx:1; + REGWORD v_fill_fifo9_tx:1; + REGWORD v_fill_fifo9_rx:1; + REGWORD v_fill_fifo10_tx:1; + REGWORD v_fill_fifo10_rx:1; + REGWORD v_fill_fifo11_tx:1; + REGWORD v_fill_fifo11_rx:1; + } bit_r_fill_bl2; // register and bitmap data + typedef union {REGWORD reg; bit_r_fill_bl2 bit;} reg_r_fill_bl2; // register and bitmap access + + +#define R_FILL_BL3 0x27 // register access + #define M_FILL_FIFO12_TX 0x01 // bitmap mask (1bit) + #define M_FILL_FIFO12_RX 0x02 // bitmap mask (1bit) + #define M_FILL_FIFO13_TX 0x04 // bitmap mask (1bit) + #define M_FILL_FIFO13_RX 0x08 // bitmap mask (1bit) + #define M_FILL_FIFO14_TX 0x10 // bitmap mask (1bit) + #define M_FILL_FIFO14_RX 0x20 // bitmap mask (1bit) + #define M_FILL_FIFO15_TX 0x40 // bitmap mask (1bit) + #define M_FILL_FIFO15_RX 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_fill_fifo12_tx:1; + REGWORD v_fill_fifo12_rx:1; + REGWORD v_fill_fifo13_tx:1; + REGWORD v_fill_fifo13_rx:1; + REGWORD v_fill_fifo14_tx:1; + REGWORD v_fill_fifo14_rx:1; + REGWORD v_fill_fifo15_tx:1; + REGWORD v_fill_fifo15_rx:1; + } bit_r_fill_bl3; // register and bitmap data + typedef union {REGWORD reg; bit_r_fill_bl3 bit;} reg_r_fill_bl3; // register and bitmap access + + +#define R_CI_TX 0x28 // register access + #define M_GCI_C 0x3F // bitmap mask (6bit) + + typedef struct // bitmap construction + { + REGWORD v_gci_c:6; + REGWORD reserved_33:2; + } bit_r_ci_tx; // register and bitmap data + typedef union {REGWORD reg; bit_r_ci_tx bit;} reg_r_ci_tx; // register and bitmap access + + +#define R_CI_RX 0x28 // register access + #define M_GCI_I 0x3F // bitmap mask (6bit) + + typedef struct // bitmap construction + { + REGWORD v_gci_i:6; + REGWORD reserved_35:2; + } bit_r_ci_rx; // register and bitmap data + typedef union {REGWORD reg; bit_r_ci_rx bit;} reg_r_ci_rx; // register and bitmap access + + +#define R_GCI_CFG0 0x29 // register access + #define M_MON_END 0x01 // bitmap mask (1bit) + #define M_MON_SLOW 0x02 // bitmap mask (1bit) + #define M_MON_DLL 0x04 // bitmap mask (1bit) + #define M_MON_CI6 0x08 // bitmap mask (1bit) + #define M_GCI_SWAP_TXHS 0x10 // bitmap mask (1bit) + #define M_GCI_SWAP_RXHS 0x20 // bitmap mask (1bit) + #define M_GCI_SWAP_STIO 0x40 // bitmap mask (1bit) + #define M_GCI_EN 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_mon_end:1; + REGWORD v_mon_slow:1; + REGWORD v_mon_dll:1; + REGWORD v_mon_ci6:1; + REGWORD v_gci_swap_txhs:1; + REGWORD v_gci_swap_rxhs:1; + REGWORD v_gci_swap_stio:1; + REGWORD v_gci_en:1; + } bit_r_gci_cfg0; // register and bitmap data + typedef union {REGWORD reg; bit_r_gci_cfg0 bit;} reg_r_gci_cfg0; // register and bitmap access + + +#define R_GCI_STA 0x29 // register access + #define M_MON_RXR 0x01 // bitmap mask (1bit) + #define M_MON_TXR 0x02 // bitmap mask (1bit) + #define M_GCI_MX 0x04 // bitmap mask (1bit) + #define M_GCI_MR 0x08 // bitmap mask (1bit) + #define M_GCI_RX 0x10 // bitmap mask (1bit) + #define M_GCI_ABO 0x20 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_mon_rxr:1; + REGWORD v_mon_txr:1; + REGWORD v_gci_mx:1; + REGWORD v_gci_mr:1; + REGWORD v_gci_rx:1; + REGWORD v_gci_abo:1; + REGWORD reserved_36:2; + } bit_r_gci_sta; // register and bitmap data + typedef union {REGWORD reg; bit_r_gci_sta bit;} reg_r_gci_sta; // register and bitmap access + + +#define R_GCI_CFG1 0x2A // register access + #define M_GCI_SL 0x1F // bitmap mask (5bit) + #define M1_GCI_SL 0x01 + + typedef struct // bitmap construction + { + REGWORD v_gci_sl:5; + REGWORD reserved_34:3; + } bit_r_gci_cfg1; // register and bitmap data + typedef union {REGWORD reg; bit_r_gci_cfg1 bit;} reg_r_gci_cfg1; // register and bitmap access + + +#define R_MON_RX 0x2A // register access + #define M_MON_RX 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_mon_rx:8; + } bit_r_mon_rx; // register and bitmap data + typedef union {REGWORD reg; bit_r_mon_rx bit;} reg_r_mon_rx; // register and bitmap access + + +#define R_MON_TX 0x2B // register access + #define M_MON_TX 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_mon_tx:8; + } bit_r_mon_tx; // register and bitmap data + typedef union {REGWORD reg; bit_r_mon_tx bit;} reg_r_mon_tx; // register and bitmap access + + +#define A_SU_WR_STA 0x30 // register access + #define M_SU_SET_STA 0x0F // bitmap mask (4bit) + #define M1_SU_SET_STA 0x01 + #define M_SU_LD_STA 0x10 // bitmap mask (1bit) + #define M_SU_ACT 0x60 // bitmap mask (2bit) + #define M1_SU_ACT 0x20 + #define M_SU_SET_G2_G3 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_su_set_sta:4; + REGWORD v_su_ld_sta:1; + REGWORD v_su_act:2; + REGWORD v_su_set_g2_g3:1; + } bit_a_su_wr_sta; // register and bitmap data + typedef union {REGWORD reg; bit_a_su_wr_sta bit;} reg_a_su_wr_sta; // register and bitmap access + + +#define A_SU_RD_STA 0x30 // register access + #define M_SU_STA 0x0F // bitmap mask (4bit) + #define M1_SU_STA 0x01 + #define M_SU_FR_SYNC 0x10 // bitmap mask (1bit) + #define M_SU_T2_EXP 0x20 // bitmap mask (1bit) + #define M_SU_INFO0 0x40 // bitmap mask (1bit) + #define M_G2_G3 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_su_sta:4; + REGWORD v_su_fr_sync:1; + REGWORD v_su_t2_exp:1; + REGWORD v_su_info0:1; + REGWORD v_g2_g3:1; + } bit_a_su_rd_sta; // register and bitmap data + typedef union {REGWORD reg; bit_a_su_rd_sta bit;} reg_a_su_rd_sta; // register and bitmap access + + +#define A_SU_CTRL0 0x31 // register access + #define M_B1_TX_EN 0x01 // bitmap mask (1bit) + #define M_B2_TX_EN 0x02 // bitmap mask (1bit) + #define M_SU_MD 0x04 // bitmap mask (1bit) + #define M_ST_D_LPRIO 0x08 // bitmap mask (1bit) + #define M_ST_SQ_EN 0x10 // bitmap mask (1bit) + #define M_SU_TST_SIG 0x20 // bitmap mask (1bit) + #define M_ST_PU_CTRL 0x40 // bitmap mask (1bit) + #define M_SU_STOP 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_b1_tx_en:1; + REGWORD v_b2_tx_en:1; + REGWORD v_su_md:1; + REGWORD v_st_d_lprio:1; + REGWORD v_st_sq_en:1; + REGWORD v_su_tst_sig:1; + REGWORD v_st_pu_ctrl:1; + REGWORD v_su_stop:1; + } bit_a_su_ctrl0; // register and bitmap data + typedef union {REGWORD reg; bit_a_su_ctrl0 bit;} reg_a_su_ctrl0; // register and bitmap access + + +#define A_SU_DLYL 0x31 // register access + #define M_SU_DLYL 0x1F // bitmap mask (5bit) + #define M1_SU_DLYL 0x01 + + typedef struct // bitmap construction + { + REGWORD v_su_dlyl:5; + REGWORD reserved_46:3; + } bit_a_su_dlyl; // register and bitmap data + typedef union {REGWORD reg; bit_a_su_dlyl bit;} reg_a_su_dlyl; // register and bitmap access + + +#define A_SU_CTRL1 0x32 // register access + #define M_G2_G3_EN 0x01 // bitmap mask (1bit) + #define M_D_RES 0x04 // bitmap mask (1bit) + #define M_ST_E_IGNO 0x08 // bitmap mask (1bit) + #define M_ST_E_LO 0x10 // bitmap mask (1bit) + #define M_BAC_D 0x40 // bitmap mask (1bit) + #define M_B12_SWAP 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_g2_g3_en:1; + REGWORD reserved_37:1; + REGWORD v_d_res:1; + REGWORD v_st_e_igno:1; + REGWORD v_st_e_lo:1; + REGWORD reserved_38:1; + REGWORD v_bac_d:1; + REGWORD v_b12_swap:1; + } bit_a_su_ctrl1; // register and bitmap data + typedef union {REGWORD reg; bit_a_su_ctrl1 bit;} reg_a_su_ctrl1; // register and bitmap access + + +#define A_SU_DLYH 0x32 // register access + #define M_SU_DLYH 0x1F // bitmap mask (5bit) + #define M1_SU_DLYH 0x01 + + typedef struct // bitmap construction + { + REGWORD v_su_dlyh:5; + REGWORD reserved_47:3; + } bit_a_su_dlyh; // register and bitmap data + typedef union {REGWORD reg; bit_a_su_dlyh bit;} reg_a_su_dlyh; // register and bitmap access + + +#define A_SU_CTRL2 0x33 // register access + #define M_B1_RX_EN 0x01 // bitmap mask (1bit) + #define M_B2_RX_EN 0x02 // bitmap mask (1bit) + #define M_MS_SSYNC2 0x04 // bitmap mask (1bit) + #define M_BAC_S_SEL 0x08 // bitmap mask (1bit) + #define M_SU_SYNC_NT 0x10 // bitmap mask (1bit) + #define M_SU_2KHZ 0x20 // bitmap mask (1bit) + #define M_SU_TRI 0x40 // bitmap mask (1bit) + #define M_SU_EXCHG 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_b1_rx_en:1; + REGWORD v_b2_rx_en:1; + REGWORD v_ms_ssync2:1; + REGWORD v_bac_s_sel:1; + REGWORD v_su_sync_nt:1; + REGWORD v_su_2khz:1; + REGWORD v_su_tri:1; + REGWORD v_su_exchg:1; + } bit_a_su_ctrl2; // register and bitmap data + typedef union {REGWORD reg; bit_a_su_ctrl2 bit;} reg_a_su_ctrl2; // register and bitmap access + + +#define A_MS_TX 0x34 // register access + #define M_MS_TX 0x0F // bitmap mask (4bit) + #define M1_MS_TX 0x01 + #define M_UP_S_TX 0x40 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_ms_tx:4; + REGWORD reserved_39:2; + REGWORD v_up_s_tx:1; + REGWORD reserved_40:1; + } bit_a_ms_tx; // register and bitmap data + typedef union {REGWORD reg; bit_a_ms_tx bit;} reg_a_ms_tx; // register and bitmap access + + +#define A_MS_RX 0x34 // register access + #define M_MS_RX 0x0F // bitmap mask (4bit) + #define M1_MS_RX 0x01 + #define M_MS_RX_RDY 0x10 // bitmap mask (1bit) + #define M_UP_S_RX 0x40 // bitmap mask (1bit) + #define M_MS_TX_RDY 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_ms_rx:4; + REGWORD v_ms_rx_rdy:1; + REGWORD reserved_48:1; + REGWORD v_up_s_rx:1; + REGWORD v_ms_tx_rdy:1; + } bit_a_ms_rx; // register and bitmap data + typedef union {REGWORD reg; bit_a_ms_rx bit;} reg_a_ms_rx; // register and bitmap access + + +#define A_ST_CTRL3 0x35 // register access + #define M_ST_SEL 0x01 // bitmap mask (1bit) + #define M_ST_PULSE 0xFE // bitmap mask (7bit) + + typedef struct // bitmap construction + { + REGWORD v_st_sel:1; + REGWORD v_st_pulse:7; + } bit_a_st_ctrl3; // register and bitmap data + typedef union {REGWORD reg; bit_a_st_ctrl3 bit;} reg_a_st_ctrl3; // register and bitmap access + + +#define A_UP_CTRL3 0x35 // register access + #define M_UP_SEL 0x01 // bitmap mask (1bit) + #define M_UP_VIO 0x02 // bitmap mask (1bit) + #define M_UP_DC_STR 0x04 // bitmap mask (1bit) + #define M_UP_DC_OFF 0x08 // bitmap mask (1bit) + #define M_UP_RPT_PAT 0x10 // bitmap mask (1bit) + #define M_UP_SCRM_MD 0x20 // bitmap mask (1bit) + #define M_UP_SCRM_TX_OFF 0x40 // bitmap mask (1bit) + #define M_UP_SCRM_RX_OFF 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_up_sel:1; + REGWORD v_up_vio:1; + REGWORD v_up_dc_str:1; + REGWORD v_up_dc_off:1; + REGWORD v_up_rpt_pat:1; + REGWORD v_up_scrm_md:1; + REGWORD v_up_scrm_tx_off:1; + REGWORD v_up_scrm_rx_off:1; + } bit_a_up_ctrl3; // register and bitmap data + typedef union {REGWORD reg; bit_a_up_ctrl3 bit;} reg_a_up_ctrl3; // register and bitmap access + + +#define A_SU_STA 0x35 // register access + #define M_ST_D_HPRIO9 0x01 // bitmap mask (1bit) + #define M_ST_D_LPRIO11 0x02 // bitmap mask (1bit) + #define M_ST_D_CONT 0x04 // bitmap mask (1bit) + #define M_ST_D_ACT 0x08 // bitmap mask (1bit) + #define M_SU_AF0 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_st_d_hprio9:1; + REGWORD v_st_d_lprio11:1; + REGWORD v_st_d_cont:1; + REGWORD v_st_d_act:1; + REGWORD reserved_49:3; + REGWORD v_su_af0:1; + } bit_a_su_sta; // register and bitmap data + typedef union {REGWORD reg; bit_a_su_sta bit;} reg_a_su_sta; // register and bitmap access + + +#define A_MS_DF 0x36 // register access + #define M_BAC_NINV 0x01 // bitmap mask (1bit) + #define M_SG_AB_INV 0x02 // bitmap mask (1bit) + #define M_SQ_T_SRC 0x04 // bitmap mask (1bit) + #define M_M_S_SRC 0x08 // bitmap mask (1bit) + #define M_SQ_T_DST 0x10 // bitmap mask (1bit) + #define M_SU_RX_VAL 0x20 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_bac_ninv:1; + REGWORD v_sg_ab_inv:1; + REGWORD v_sq_t_src:1; + REGWORD v_m_s_src:1; + REGWORD v_sq_t_dst:1; + REGWORD v_su_rx_val:1; + REGWORD reserved_41:2; + } bit_a_ms_df; // register and bitmap data + typedef union {REGWORD reg; bit_a_ms_df bit;} reg_a_ms_df; // register and bitmap access + + +#define A_SU_CLK_DLY 0x37 // register access + #define M_SU_CLK_DLY 0x0F // bitmap mask (4bit) + #define M1_SU_CLK_DLY 0x01 + #define M_ST_SMPL 0x70 // bitmap mask (3bit) + #define M1_ST_SMPL 0x10 + + typedef struct // bitmap construction + { + REGWORD v_su_clk_dly:4; + REGWORD v_st_smpl:3; + REGWORD reserved_42:1; + } bit_a_su_clk_dly; // register and bitmap data + typedef union {REGWORD reg; bit_a_su_clk_dly bit;} reg_a_su_clk_dly; // register and bitmap access + + +#define R_PWM0 0x38 // register access + #define M_PWM0 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_pwm0:8; + } bit_r_pwm0; // register and bitmap data + typedef union {REGWORD reg; bit_r_pwm0 bit;} reg_r_pwm0; // register and bitmap access + + +#define R_PWM1 0x39 // register access + #define M_PWM1 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_pwm1:8; + } bit_r_pwm1; // register and bitmap data + typedef union {REGWORD reg; bit_r_pwm1 bit;} reg_r_pwm1; // register and bitmap access + + +#define A_B1_TX 0x3C // register access + #define M_B1_TX 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_b1_tx:8; + } bit_a_b1_tx; // register and bitmap data + typedef union {REGWORD reg; bit_a_b1_tx bit;} reg_a_b1_tx; // register and bitmap access + + +#define A_B1_RX 0x3C // register access + #define M_B1_RX 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_b1_rx:8; + } bit_a_b1_rx; // register and bitmap data + typedef union {REGWORD reg; bit_a_b1_rx bit;} reg_a_b1_rx; // register and bitmap access + + +#define A_B2_TX 0x3D // register access + #define M_B2_TX 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_b2_tx:8; + } bit_a_b2_tx; // register and bitmap data + typedef union {REGWORD reg; bit_a_b2_tx bit;} reg_a_b2_tx; // register and bitmap access + + +#define A_B2_RX 0x3D // register access + #define M_B2_RX 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_b2_rx:8; + } bit_a_b2_rx; // register and bitmap data + typedef union {REGWORD reg; bit_a_b2_rx bit;} reg_a_b2_rx; // register and bitmap access + + +#define A_D_TX 0x3E // register access + #define M_D_TX_S 0x01 // bitmap mask (1bit) + #define M_D_TX_BAC 0x20 // bitmap mask (1bit) + #define M_D_TX 0xC0 // bitmap mask (2bit) + #define M1_D_TX 0x40 + + typedef struct // bitmap construction + { + REGWORD v_d_tx_s:1; + REGWORD reserved_43:4; + REGWORD v_d_tx_bac:1; + REGWORD v_d_tx:2; + } bit_a_d_tx; // register and bitmap data + typedef union {REGWORD reg; bit_a_d_tx bit;} reg_a_d_tx; // register and bitmap access + + +#define A_D_RX 0x3E // register access + #define M_D_RX_S 0x01 // bitmap mask (1bit) + #define M_D_RX_AB 0x10 // bitmap mask (1bit) + #define M_D_RX_SG 0x20 // bitmap mask (1bit) + #define M_D_RX 0xC0 // bitmap mask (2bit) + #define M1_D_RX 0x40 + + typedef struct // bitmap construction + { + REGWORD v_d_rx_s:1; + REGWORD reserved_50:3; + REGWORD v_d_rx_ab:1; + REGWORD v_d_rx_sg:1; + REGWORD v_d_rx:2; + } bit_a_d_rx; // register and bitmap data + typedef union {REGWORD reg; bit_a_d_rx bit;} reg_a_d_rx; // register and bitmap access + + +#define A_E_RX 0x3F // register access + #define M_E_RX_S 0x01 // bitmap mask (1bit) + #define M_E_RX_AB 0x10 // bitmap mask (1bit) + #define M_E_RX_SG 0x20 // bitmap mask (1bit) + #define M_E_RX 0xC0 // bitmap mask (2bit) + #define M1_E_RX 0x40 + + typedef struct // bitmap construction + { + REGWORD v_e_rx_s:1; + REGWORD reserved_51:3; + REGWORD v_e_rx_ab:1; + REGWORD v_e_rx_sg:1; + REGWORD v_e_rx:2; + } bit_a_e_rx; // register and bitmap data + typedef union {REGWORD reg; bit_a_e_rx bit;} reg_a_e_rx; // register and bitmap access + + +#define A_BAC_S_TX 0x3F // register access + #define M_S_TX 0x01 // bitmap mask (1bit) + #define M_BAC_TX 0x20 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_s_tx:1; + REGWORD reserved_44:4; + REGWORD v_bac_tx:1; + REGWORD reserved_45:2; + } bit_a_bac_s_tx; // register and bitmap data + typedef union {REGWORD reg; bit_a_bac_s_tx bit;} reg_a_bac_s_tx; // register and bitmap access + + +#define R_GPIO_OUT1 0x40 // register access + #define M_GPIO_OUT8 0x01 // bitmap mask (1bit) + #define M_GPIO_OUT9 0x02 // bitmap mask (1bit) + #define M_GPIO_OUT10 0x04 // bitmap mask (1bit) + #define M_GPIO_OUT11 0x08 // bitmap mask (1bit) + #define M_GPIO_OUT12 0x10 // bitmap mask (1bit) + #define M_GPIO_OUT13 0x20 // bitmap mask (1bit) + #define M_GPIO_OUT14 0x40 // bitmap mask (1bit) + #define M_GPIO_OUT15 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_gpio_out8:1; + REGWORD v_gpio_out9:1; + REGWORD v_gpio_out10:1; + REGWORD v_gpio_out11:1; + REGWORD v_gpio_out12:1; + REGWORD v_gpio_out13:1; + REGWORD v_gpio_out14:1; + REGWORD v_gpio_out15:1; + } bit_r_gpio_out1; // register and bitmap data + typedef union {REGWORD reg; bit_r_gpio_out1 bit;} reg_r_gpio_out1; // register and bitmap access + + +#define R_GPIO_IN1 0x40 // register access + #define M_GPIO_IN8 0x01 // bitmap mask (1bit) + #define M_GPIO_IN9 0x02 // bitmap mask (1bit) + #define M_GPIO_IN10 0x04 // bitmap mask (1bit) + #define M_GPIO_IN11 0x08 // bitmap mask (1bit) + #define M_GPIO_IN12 0x10 // bitmap mask (1bit) + #define M_GPIO_IN13 0x20 // bitmap mask (1bit) + #define M_GPIO_IN14 0x40 // bitmap mask (1bit) + #define M_GPIO_IN15 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_gpio_in8:1; + REGWORD v_gpio_in9:1; + REGWORD v_gpio_in10:1; + REGWORD v_gpio_in11:1; + REGWORD v_gpio_in12:1; + REGWORD v_gpio_in13:1; + REGWORD v_gpio_in14:1; + REGWORD v_gpio_in15:1; + } bit_r_gpio_in1; // register and bitmap data + typedef union {REGWORD reg; bit_r_gpio_in1 bit;} reg_r_gpio_in1; // register and bitmap access + + +#define R_GPIO_OUT3 0x41 // register access + #define M_GPIO_OUT24 0x01 // bitmap mask (1bit) + #define M_GPIO_OUT25 0x02 // bitmap mask (1bit) + #define M_GPIO_OUT26 0x04 // bitmap mask (1bit) + #define M_GPIO_OUT27 0x08 // bitmap mask (1bit) + #define M_GPIO_OUT28 0x10 // bitmap mask (1bit) + #define M_GPIO_OUT29 0x20 // bitmap mask (1bit) + #define M_GPIO_OUT30 0x40 // bitmap mask (1bit) + #define M_GPIO_OUT31 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_gpio_out24:1; + REGWORD v_gpio_out25:1; + REGWORD v_gpio_out26:1; + REGWORD v_gpio_out27:1; + REGWORD v_gpio_out28:1; + REGWORD v_gpio_out29:1; + REGWORD v_gpio_out30:1; + REGWORD v_gpio_out31:1; + } bit_r_gpio_out3; // register and bitmap data + typedef union {REGWORD reg; bit_r_gpio_out3 bit;} reg_r_gpio_out3; // register and bitmap access + + +#define R_GPIO_IN3 0x41 // register access + #define M_GPIO_IN24 0x01 // bitmap mask (1bit) + #define M_GPIO_IN25 0x02 // bitmap mask (1bit) + #define M_GPIO_IN26 0x04 // bitmap mask (1bit) + #define M_GPIO_IN27 0x08 // bitmap mask (1bit) + #define M_GPIO_IN28 0x10 // bitmap mask (1bit) + #define M_GPIO_IN29 0x20 // bitmap mask (1bit) + #define M_GPIO_IN30 0x40 // bitmap mask (1bit) + #define M_GPIO_IN31 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_gpio_in24:1; + REGWORD v_gpio_in25:1; + REGWORD v_gpio_in26:1; + REGWORD v_gpio_in27:1; + REGWORD v_gpio_in28:1; + REGWORD v_gpio_in29:1; + REGWORD v_gpio_in30:1; + REGWORD v_gpio_in31:1; + } bit_r_gpio_in3; // register and bitmap data + typedef union {REGWORD reg; bit_r_gpio_in3 bit;} reg_r_gpio_in3; // register and bitmap access + + +#define R_GPIO_EN1 0x42 // register access + #define M_GPIO_EN8 0x01 // bitmap mask (1bit) + #define M_GPIO_EN9 0x02 // bitmap mask (1bit) + #define M_GPIO_EN10 0x04 // bitmap mask (1bit) + #define M_GPIO_EN11 0x08 // bitmap mask (1bit) + #define M_GPIO_EN12 0x10 // bitmap mask (1bit) + #define M_GPIO_EN13 0x20 // bitmap mask (1bit) + #define M_GPIO_EN14 0x40 // bitmap mask (1bit) + #define M_GPIO_EN15 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_gpio_en8:1; + REGWORD v_gpio_en9:1; + REGWORD v_gpio_en10:1; + REGWORD v_gpio_en11:1; + REGWORD v_gpio_en12:1; + REGWORD v_gpio_en13:1; + REGWORD v_gpio_en14:1; + REGWORD v_gpio_en15:1; + } bit_r_gpio_en1; // register and bitmap data + typedef union {REGWORD reg; bit_r_gpio_en1 bit;} reg_r_gpio_en1; // register and bitmap access + + +#define R_GPIO_EN3 0x43 // register access + #define M_GPIO_EN24 0x01 // bitmap mask (1bit) + #define M_GPIO_EN25 0x02 // bitmap mask (1bit) + #define M_GPIO_EN26 0x04 // bitmap mask (1bit) + #define M_GPIO_EN27 0x08 // bitmap mask (1bit) + #define M_GPIO_EN28 0x10 // bitmap mask (1bit) + #define M_GPIO_EN29 0x20 // bitmap mask (1bit) + #define M_GPIO_EN30 0x40 // bitmap mask (1bit) + #define M_GPIO_EN31 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_gpio_en24:1; + REGWORD v_gpio_en25:1; + REGWORD v_gpio_en26:1; + REGWORD v_gpio_en27:1; + REGWORD v_gpio_en28:1; + REGWORD v_gpio_en29:1; + REGWORD v_gpio_en30:1; + REGWORD v_gpio_en31:1; + } bit_r_gpio_en3; // register and bitmap data + typedef union {REGWORD reg; bit_r_gpio_en3 bit;} reg_r_gpio_en3; // register and bitmap access + + +#define R_GPIO_SEL_BL 0x44 // register access + #define M_GPIO_BL0 0x01 // bitmap mask (1bit) + #define M_GPIO_BL1 0x02 // bitmap mask (1bit) + #define M_GPIO_BL2 0x04 // bitmap mask (1bit) + #define M_GPIO_BL3 0x08 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_gpio_bl0:1; + REGWORD v_gpio_bl1:1; + REGWORD v_gpio_bl2:1; + REGWORD v_gpio_bl3:1; + REGWORD reserved_54:4; + } bit_r_gpio_sel_bl; // register and bitmap data + typedef union {REGWORD reg; bit_r_gpio_sel_bl bit;} reg_r_gpio_sel_bl; // register and bitmap access + + +#define R_GPIO_OUT2 0x45 // register access + #define M_GPIO_OUT16 0x01 // bitmap mask (1bit) + #define M_GPIO_OUT17 0x02 // bitmap mask (1bit) + #define M_GPIO_OUT18 0x04 // bitmap mask (1bit) + #define M_GPIO_OUT19 0x08 // bitmap mask (1bit) + #define M_GPIO_OUT20 0x10 // bitmap mask (1bit) + #define M_GPIO_OUT21 0x20 // bitmap mask (1bit) + #define M_GPIO_OUT22 0x40 // bitmap mask (1bit) + #define M_GPIO_OUT23 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_gpio_out16:1; + REGWORD v_gpio_out17:1; + REGWORD v_gpio_out18:1; + REGWORD v_gpio_out19:1; + REGWORD v_gpio_out20:1; + REGWORD v_gpio_out21:1; + REGWORD v_gpio_out22:1; + REGWORD v_gpio_out23:1; + } bit_r_gpio_out2; // register and bitmap data + typedef union {REGWORD reg; bit_r_gpio_out2 bit;} reg_r_gpio_out2; // register and bitmap access + + +#define R_GPIO_IN2 0x45 // register access + #define M_GPIO_IN16 0x01 // bitmap mask (1bit) + #define M_GPIO_IN17 0x02 // bitmap mask (1bit) + #define M_GPIO_IN18 0x04 // bitmap mask (1bit) + #define M_GPIO_IN19 0x08 // bitmap mask (1bit) + #define M_GPIO_IN20 0x10 // bitmap mask (1bit) + #define M_GPIO_IN21 0x20 // bitmap mask (1bit) + #define M_GPIO_IN22 0x40 // bitmap mask (1bit) + #define M_GPIO_IN23 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_gpio_in16:1; + REGWORD v_gpio_in17:1; + REGWORD v_gpio_in18:1; + REGWORD v_gpio_in19:1; + REGWORD v_gpio_in20:1; + REGWORD v_gpio_in21:1; + REGWORD v_gpio_in22:1; + REGWORD v_gpio_in23:1; + } bit_r_gpio_in2; // register and bitmap data + typedef union {REGWORD reg; bit_r_gpio_in2 bit;} reg_r_gpio_in2; // register and bitmap access + + +#define R_PWM_MD 0x46 // register access + #define M_WAK_EN 0x02 // bitmap mask (1bit) + #define M_PWM0_MD 0x30 // bitmap mask (2bit) + #define M1_PWM0_MD 0x10 + #define M_PWM1_MD 0xC0 // bitmap mask (2bit) + #define M1_PWM1_MD 0x40 + + typedef struct // bitmap construction + { + REGWORD reserved_52:1; + REGWORD v_wak_en:1; + REGWORD reserved_53:2; + REGWORD v_pwm0_md:2; + REGWORD v_pwm1_md:2; + } bit_r_pwm_md; // register and bitmap data + typedef union {REGWORD reg; bit_r_pwm_md bit;} reg_r_pwm_md; // register and bitmap access + + +#define R_GPIO_EN2 0x47 // register access + #define M_GPIO_EN16 0x01 // bitmap mask (1bit) + #define M_GPIO_EN17 0x02 // bitmap mask (1bit) + #define M_GPIO_EN18 0x04 // bitmap mask (1bit) + #define M_GPIO_EN19 0x08 // bitmap mask (1bit) + #define M_GPIO_EN20 0x10 // bitmap mask (1bit) + #define M_GPIO_EN21 0x20 // bitmap mask (1bit) + #define M_GPIO_EN22 0x40 // bitmap mask (1bit) + #define M_GPIO_EN23 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_gpio_en16:1; + REGWORD v_gpio_en17:1; + REGWORD v_gpio_en18:1; + REGWORD v_gpio_en19:1; + REGWORD v_gpio_en20:1; + REGWORD v_gpio_en21:1; + REGWORD v_gpio_en22:1; + REGWORD v_gpio_en23:1; + } bit_r_gpio_en2; // register and bitmap data + typedef union {REGWORD reg; bit_r_gpio_en2 bit;} reg_r_gpio_en2; // register and bitmap access + + +#define R_GPIO_IN0 0x48 // register access + #define M_GPIO_IN0 0x01 // bitmap mask (1bit) + #define M_GPIO_IN1 0x02 // bitmap mask (1bit) + #define M_GPIO_IN2 0x04 // bitmap mask (1bit) + #define M_GPIO_IN3 0x08 // bitmap mask (1bit) + #define M_GPIO_IN4 0x10 // bitmap mask (1bit) + #define M_GPIO_IN5 0x20 // bitmap mask (1bit) + #define M_GPIO_IN6 0x40 // bitmap mask (1bit) + #define M_GPIO_IN7 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_gpio_in0:1; + REGWORD v_gpio_in1:1; + REGWORD v_gpio_in2:1; + REGWORD v_gpio_in3:1; + REGWORD v_gpio_in4:1; + REGWORD v_gpio_in5:1; + REGWORD v_gpio_in6:1; + REGWORD v_gpio_in7:1; + } bit_r_gpio_in0; // register and bitmap data + typedef union {REGWORD reg; bit_r_gpio_in0 bit;} reg_r_gpio_in0; // register and bitmap access + + +#define R_GPIO_OUT0 0x48 // register access + #define M_GPIO_OUT0 0x01 // bitmap mask (1bit) + #define M_GPIO_OUT1 0x02 // bitmap mask (1bit) + #define M_GPIO_OUT2 0x04 // bitmap mask (1bit) + #define M_GPIO_OUT3 0x08 // bitmap mask (1bit) + #define M_GPIO_OUT4 0x10 // bitmap mask (1bit) + #define M_GPIO_OUT5 0x20 // bitmap mask (1bit) + #define M_GPIO_OUT6 0x40 // bitmap mask (1bit) + #define M_GPIO_OUT7 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_gpio_out0:1; + REGWORD v_gpio_out1:1; + REGWORD v_gpio_out2:1; + REGWORD v_gpio_out3:1; + REGWORD v_gpio_out4:1; + REGWORD v_gpio_out5:1; + REGWORD v_gpio_out6:1; + REGWORD v_gpio_out7:1; + } bit_r_gpio_out0; // register and bitmap data + typedef union {REGWORD reg; bit_r_gpio_out0 bit;} reg_r_gpio_out0; // register and bitmap access + + +#define R_GPIO_EN0 0x4A // register access + #define M_GPIO_EN0 0x01 // bitmap mask (1bit) + #define M_GPIO_EN1 0x02 // bitmap mask (1bit) + #define M_GPIO_EN2 0x04 // bitmap mask (1bit) + #define M_GPIO_EN3 0x08 // bitmap mask (1bit) + #define M_GPIO_EN4 0x10 // bitmap mask (1bit) + #define M_GPIO_EN5 0x20 // bitmap mask (1bit) + #define M_GPIO_EN6 0x40 // bitmap mask (1bit) + #define M_GPIO_EN7 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_gpio_en0:1; + REGWORD v_gpio_en1:1; + REGWORD v_gpio_en2:1; + REGWORD v_gpio_en3:1; + REGWORD v_gpio_en4:1; + REGWORD v_gpio_en5:1; + REGWORD v_gpio_en6:1; + REGWORD v_gpio_en7:1; + } bit_r_gpio_en0; // register and bitmap data + typedef union {REGWORD reg; bit_r_gpio_en0 bit;} reg_r_gpio_en0; // register and bitmap access + + +#define R_GPIO_SEL 0x4C // register access + #define M_GPIO_SEL0 0x01 // bitmap mask (1bit) + #define M_GPIO_SEL1 0x02 // bitmap mask (1bit) + #define M_GPIO_SEL2 0x04 // bitmap mask (1bit) + #define M_GPIO_SEL3 0x08 // bitmap mask (1bit) + #define M_GPIO_SEL4 0x10 // bitmap mask (1bit) + #define M_GPIO_SEL5 0x20 // bitmap mask (1bit) + #define M_GPIO_SEL6 0x40 // bitmap mask (1bit) + #define M_GPIO_SEL7 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_gpio_sel0:1; + REGWORD v_gpio_sel1:1; + REGWORD v_gpio_sel2:1; + REGWORD v_gpio_sel3:1; + REGWORD v_gpio_sel4:1; + REGWORD v_gpio_sel5:1; + REGWORD v_gpio_sel6:1; + REGWORD v_gpio_sel7:1; + } bit_r_gpio_sel; // register and bitmap data + typedef union {REGWORD reg; bit_r_gpio_sel bit;} reg_r_gpio_sel; // register and bitmap access + + +#define R_PLL_STA 0x50 // register access + #define M_PLL_LOCK 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD reserved_56:7; + REGWORD v_pll_lock:1; + } bit_r_pll_sta; // register and bitmap data + typedef union {REGWORD reg; bit_r_pll_sta bit;} reg_r_pll_sta; // register and bitmap access + + +#define R_PLL_CTRL 0x50 // register access + #define M_PLL_NRES 0x01 // bitmap mask (1bit) + #define M_PLL_TST 0x02 // bitmap mask (1bit) + #define M_PLL_FREEZE 0x20 // bitmap mask (1bit) + #define M_PLL_M 0xC0 // bitmap mask (2bit) + #define M1_PLL_M 0x40 + + typedef struct // bitmap construction + { + REGWORD v_pll_nres:1; + REGWORD v_pll_tst:1; + REGWORD reserved_55:3; + REGWORD v_pll_freeze:1; + REGWORD v_pll_m:2; + } bit_r_pll_ctrl; // register and bitmap data + typedef union {REGWORD reg; bit_r_pll_ctrl bit;} reg_r_pll_ctrl; // register and bitmap access + + +#define R_PLL_P 0x51 // register access + #define M_PLL_P 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_pll_p:8; + } bit_r_pll_p; // register and bitmap data + typedef union {REGWORD reg; bit_r_pll_p bit;} reg_r_pll_p; // register and bitmap access + + +#define R_PLL_N 0x52 // register access + #define M_PLL_N 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_pll_n:8; + } bit_r_pll_n; // register and bitmap data + typedef union {REGWORD reg; bit_r_pll_n bit;} reg_r_pll_n; // register and bitmap access + + +#define R_PLL_S 0x53 // register access + #define M_PLL_S 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_pll_s:8; + } bit_r_pll_s; // register and bitmap data + typedef union {REGWORD reg; bit_r_pll_s bit;} reg_r_pll_s; // register and bitmap access + + +#define A_FIFO_DATA 0x80 // register access + #define M_FIFO_DATA 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_fifo_data:8; + } bit_a_fifo_data; // register and bitmap data + typedef union {REGWORD reg; bit_a_fifo_data bit;} reg_a_fifo_data; // register and bitmap access + + +#define A_FIFO_DATA_NOINC 0x84 // register access + #define M_FIFO_DATA_NOINC 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_fifo_data_noinc:8; + } bit_a_fifo_data_noinc; // register and bitmap data + typedef union {REGWORD reg; bit_a_fifo_data_noinc bit;} reg_a_fifo_data_noinc; // register and bitmap access + + +#define R_INT_DATA 0x88 // register access + #define M_INT_DATA 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_int_data:8; + } bit_r_int_data; // register and bitmap data + typedef union {REGWORD reg; bit_r_int_data bit;} reg_r_int_data; // register and bitmap access + + +#define R_RAM_DATA 0xC0 // register access + #define M_RAM_DATA 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_ram_data:8; + } bit_r_ram_data; // register and bitmap data + typedef union {REGWORD reg; bit_r_ram_data bit;} reg_r_ram_data; // register and bitmap access + + +#define A_SL_CFG 0xD0 // register access + #define M_CH_SDIR 0x01 // bitmap mask (1bit) + #define M_CH_SNUM 0x3E // bitmap mask (5bit) + #define M1_CH_SNUM 0x02 + #define M_ROUT 0xC0 // bitmap mask (2bit) + #define M1_ROUT 0x40 + + typedef struct // bitmap construction + { + REGWORD v_ch_sdir:1; + REGWORD v_ch_snum:5; + REGWORD v_rout:2; + } bit_a_sl_cfg; // register and bitmap data + typedef union {REGWORD reg; bit_a_sl_cfg bit;} reg_a_sl_cfg; // register and bitmap access + + +#define A_CH_MSK 0xF4 // register access + #define M_CH_MSK 0xFF // bitmap mask (8bit) + + typedef struct // bitmap construction + { + REGWORD v_ch_msk:8; + } bit_a_ch_msk; // register and bitmap data + typedef union {REGWORD reg; bit_a_ch_msk bit;} reg_a_ch_msk; // register and bitmap access + + +#define A_CON_HDLC 0xFA // register access + #define M_IFF 0x01 // bitmap mask (1bit) + #define M_HDLC_TRP 0x02 // bitmap mask (1bit) + #define M_FIFO_IRQ 0x1C // bitmap mask (3bit) + #define M1_FIFO_IRQ 0x04 + #define M_DATA_FLOW 0xE0 // bitmap mask (3bit) + #define M1_DATA_FLOW 0x20 + + typedef struct // bitmap construction + { + REGWORD v_iff:1; + REGWORD v_hdlc_trp:1; + REGWORD v_fifo_irq:3; + REGWORD v_data_flow:3; + } bit_a_con_hdlc; // register and bitmap data + typedef union {REGWORD reg; bit_a_con_hdlc bit;} reg_a_con_hdlc; // register and bitmap access + + +#define A_SUBCH_CFG 0xFB // register access + #define M_BIT_CNT 0x07 // bitmap mask (3bit) + #define M1_BIT_CNT 0x01 + #define M_START_BIT 0x38 // bitmap mask (3bit) + #define M1_START_BIT 0x08 + #define M_LOOP_FIFO 0x40 // bitmap mask (1bit) + #define M_INV_DATA 0x80 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_bit_cnt:3; + REGWORD v_start_bit:3; + REGWORD v_loop_fifo:1; + REGWORD v_inv_data:1; + } bit_a_subch_cfg; // register and bitmap data + typedef union {REGWORD reg; bit_a_subch_cfg bit;} reg_a_subch_cfg; // register and bitmap access + + +#define A_CHANNEL 0xFC // register access + #define M_CH_FDIR 0x01 // bitmap mask (1bit) + #define M_CH_FNUM 0x1E // bitmap mask (4bit) + #define M1_CH_FNUM 0x02 + + typedef struct // bitmap construction + { + REGWORD v_ch_fdir:1; + REGWORD v_ch_fnum:4; + REGWORD reserved_57:3; + } bit_a_channel; // register and bitmap data + typedef union {REGWORD reg; bit_a_channel bit;} reg_a_channel; // register and bitmap access + + +#define A_FIFO_SEQ 0xFD // register access + #define M_NEXT_FIFO_DIR 0x01 // bitmap mask (1bit) + #define M_NEXT_FIFO_NUM 0x1E // bitmap mask (4bit) + #define M1_NEXT_FIFO_NUM 0x02 + #define M_SEQ_END 0x40 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_next_fifo_dir:1; + REGWORD v_next_fifo_num:4; + REGWORD reserved_58:1; + REGWORD v_seq_end:1; + REGWORD reserved_59:1; + } bit_a_fifo_seq; // register and bitmap data + typedef union {REGWORD reg; bit_a_fifo_seq bit;} reg_a_fifo_seq; // register and bitmap access + + +#define A_FIFO_CTRL 0xFF // register access + #define M_FIFO_IRQMSK 0x01 // bitmap mask (1bit) + #define M_BERT_EN 0x02 // bitmap mask (1bit) + #define M_MIX_IRQ 0x04 // bitmap mask (1bit) + #define M_FR_ABO 0x08 // bitmap mask (1bit) + #define M_NO_CRC 0x10 // bitmap mask (1bit) + #define M_NO_REP 0x20 // bitmap mask (1bit) + + typedef struct // bitmap construction + { + REGWORD v_fifo_irqmsk:1; + REGWORD v_bert_en:1; + REGWORD v_mix_irq:1; + REGWORD v_fr_abo:1; + REGWORD v_no_crc:1; + REGWORD v_no_rep:1; + REGWORD reserved_60:2; + } bit_a_fifo_ctrl; // register and bitmap data + typedef union {REGWORD reg; bit_a_fifo_ctrl bit;} reg_a_fifo_ctrl; // register and bitmap access + + +#endif /* _XHFC24SUCC_H_ */ + +/*___________________________________________________________________________________*/ +/* */ +/* End of XHFC-2S4U / XHFC-4SU register definitions. */ +/* */ +/* Total number of registers processed: 122 of 122 */ +/* Total number of bitmaps processed : 523 */ +/* */ +/*___________________________________________________________________________________*/ +/* */ diff --git a/patches/kdrivers/src/diff b/patches/kdrivers/src/diff new file mode 100644 index 0000000..5e15c04 --- /dev/null +++ b/patches/kdrivers/src/diff @@ -0,0 +1,390 @@ +Only in /root/3.3/wanpipe/patches/kdrivers/src/lip/: bin +Only in /common/lip: CVS +Only in /common/lip: hupdate +Only in /common/lip: include +Only in /common/lip: include_old +Only in /root/3.3/wanpipe/patches/kdrivers/src/lip/: lip_katm +diff -dur /root/3.3/wanpipe/patches/kdrivers/src/lip/Makefile /common/lip/Makefile +--- /root/3.3/wanpipe/patches/kdrivers/src/lip/Makefile 2008-01-24 12:23:03.000000000 -0500 ++++ /common/lip/Makefile 2007-05-17 20:09:10.000000000 -0400 +@@ -5,9 +5,11 @@ + # Rewritten to use lists instead of if-statements. + # + ++PWD=$(shell pwd) + FRDIR=../fr + SPPPDIR=../sppp + ATMDIR=../atm ++LAPDIR=../lapb + LIP_KATMDIR=../lip_katm + LIP_ATMDIR=../lip_atm + COMMON=../wanpipe +@@ -18,16 +20,18 @@ + CONFIG_WANPIPE_ATM=n + CONFIG_WANPIPE_LIP_KATM=y + CONFIG_WANPIPE_LIP_ATM=y ++CONFIG_WANPIPE_LIP_LAPB=n ++CONFIG_WANPIPE_TTY=y + + EXTRA_CFLAGS=$(EXTRA_FLAGS) +-EXTRA_CFLAGS+=-DWANLIP_DRIVER -DWPLIP_TTY_SUPPORT ++EXTRA_CFLAGS+=-DWANLIP_DRIVER + + wanpipe_lip-y := wanpipe_lip_iface.o wanpipe_lip_sub.o + wanpipe_lip-y += wanpipe_lip_netdev.o wanpipe_lip_prot.o + wanpipe_lip-y += wanpipe_lip_bh.o wanpipe_lip_ipx.o + wanpipe_lip-y += $(COMMON)/wanpipe_abstr.o $(ROUTER)/wanpipe_linux_iface.o + +-ifeq "${CONFIG_WANPIPE_FR}" "y" ++ifeq "${CONFIG_WANPIPE_TTY}" "y" + PRODUCT_DEFINES += -DWPLIP_TTY_SUPPORT + wanpipe_lip-y += wanpipe_lip_tty.o + endif +@@ -64,6 +68,18 @@ + EXTRA_CFLAGS += -I$(ATMDIR) -I$(ATMDIR)/include + endif + ++ifeq "${CONFIG_WANPIPE_LIP_LAPB}" "y" ++PRODUCT_DEFINES += -DCONFIG_PRODUCT_WANPIPE_LIP_LAPD ++PRODUCT_DEFINES += -DCONFIG_PRODUCT_WANPIPE_LIP_LAPB ++wanpipe_lip-y += $(LAPDIR)/wanpipe_lapb_iface.o ++wanpipe_lip-y += $(LAPDIR)/wanpipe_lapb_in.o ++wanpipe_lip-y += $(LAPDIR)/wanpipe_lapb_out.o ++wanpipe_lip-y += $(LAPDIR)/wanpipe_lapb_sub.o ++wanpipe_lip-y += $(LAPDIR)/wanpipe_lapb_timer.o ++EXTRA_CFLAGS += -I$(PWD)/$(LAPDIR) -I$(PWD)/$(LAPDIR)/include ++endif ++ ++ + EXTRA_CFLAGS += $(PRODUCT_DEFINES) + + +Only in /common/lip: Makefile5.FreeBSD +Only in /common/lip: Makefile6.FreeBSD +Only in /common/lip: Makefile.Kbuild.Linux +Only in /common/lip: Makefile.Kbuild.Linux~ +Only in /common/lip: Makefile.Linux +Only in /common/lip: .#Makefile.Linux.1.12 +Only in /common/lip: .#Makefile.Linux.1.2 +Only in /common/lip: .#Makefile.Linux.1.20 +Only in /common/lip: mod +Only in /common/lip: modinfo +Only in /common/lip: Module.symvers +Only in /common/lip: test-fr.sh +Only in /common/lip: test.sh +Only in /common/lip/tmp: CVS +Only in /common/lip: .tmp_versions +diff -dur /root/3.3/wanpipe/patches/kdrivers/src/lip/wanpipe_lip_bh.c /common/lip/wanpipe_lip_bh.c +--- /root/3.3/wanpipe/patches/kdrivers/src/lip/wanpipe_lip_bh.c 2008-01-24 12:23:03.000000000 -0500 ++++ /common/lip/wanpipe_lip_bh.c 2008-02-05 18:27:27.000000000 -0500 +@@ -121,7 +121,7 @@ + + } + +- if (WAN_NETIF_QUEUE_STOPPED(lip_dev->common.dev)){ ++ if (WAN_NETIF_UP(lip_dev->common.dev) && WAN_NETIF_QUEUE_STOPPED(lip_dev->common.dev)){ + if (lip_dev->common.usedby == API){ + DEBUG_TEST("%s: Api waking stack!\n",lip_dev->name); + WAN_NETIF_START_QUEUE(lip_dev->common.dev); +Only in /common/lip: .#wanpipe_lip_bh.c.1.13 +Only in /common/lip: .#wanpipe_lip_bh.c.1.17 +Only in /common/lip: .#wanpipe_lip_bh.c.1.4 +Only in /common/lip: .#wanpipe_lip_bh.c.1.8 +Only in /common/lip: wanpipe_lip_bh.o +Only in /common/lip: .wanpipe_lip_bh.o.cmd +diff -dur /root/3.3/wanpipe/patches/kdrivers/src/lip/wanpipe_lip_iface.c /common/lip/wanpipe_lip_iface.c +--- /root/3.3/wanpipe/patches/kdrivers/src/lip/wanpipe_lip_iface.c 2008-01-24 12:23:03.000000000 -0500 ++++ /common/lip/wanpipe_lip_iface.c 2008-03-12 17:30:19.000000000 -0400 +@@ -452,12 +452,11 @@ + } + } + +- wplip_close_lipdev_prot(lip_dev); +- + wan_set_bit(WPLIP_DEV_UNREGISTER,&lip_dev->critical); + wan_clear_bit(WAN_DEV_READY,&lip_dev->interface_down); +- + ++ wplip_close_lipdev_prot(lip_dev); ++ + wan_spin_lock_irq(&lip_link->bh_lock,&flags); + lip_link->cur_tx=NULL; + wan_skb_queue_purge(&lip_dev->tx_queue); +@@ -840,15 +839,11 @@ + return 0; + } + +-int wplip_lipdev_prot_change_state(void *wplip_id,int state, +- unsigned char *data, int len) +-{ +- wplip_dev_t *lip_dev = (wplip_dev_t *)wplip_id; + +- DEBUG_EVENT("%s: Lip Dev Prot State %s!\n", +- lip_dev->name, STATE_DECODE(state)); + +- lip_dev->common.state = state; ++int wplip_lipdev_prot_update_state_change(wplip_dev_t *lip_dev, unsigned char *data, int len) ++{ ++ int state = lip_dev->common.state; + + if (lip_dev->common.usedby == API) { + +@@ -857,27 +852,24 @@ + } + + if (state == WAN_CONNECTED){ +- lip_dev->common.state = state; + WAN_NETIF_CARRIER_ON(lip_dev->common.dev); + WAN_NETIF_START_QUEUE(lip_dev->common.dev); +- wan_update_api_state(lip_dev); + }else{ +- lip_dev->common.state = state; + WAN_NETIF_CARRIER_OFF(lip_dev->common.dev); + WAN_NETIF_STOP_QUEUE(lip_dev->common.dev); + } ++ ++ wan_update_api_state(lip_dev); + + wplip_trigger_bh(lip_dev->lip_link); + + }else if (lip_dev->common.lip) { /*STACK*/ + + if (state == WAN_CONNECTED){ +- lip_dev->common.state = state; + WAN_NETIF_CARRIER_ON(lip_dev->common.dev); + WAN_NETIF_START_QUEUE(lip_dev->common.dev); + wplip_connect(lip_dev->common.lip,0); + }else{ +- lip_dev->common.state = state; + WAN_NETIF_CARRIER_OFF(lip_dev->common.dev); + #if defined(WANPIPE_IFNET_QUEUE_POLICY_INIT_OFF) + WAN_NETIF_STOP_QUEUE(lip_dev->common.dev); +@@ -887,12 +879,10 @@ + + }else{ + if (state == WAN_CONNECTED){ +- lip_dev->common.state = state; + WAN_NETIF_CARRIER_ON(lip_dev->common.dev); + WAN_NETIF_WAKE_QUEUE(lip_dev->common.dev); + wplip_trigger_bh(lip_dev->lip_link); + }else{ +- lip_dev->common.state = state; + WAN_NETIF_CARRIER_OFF(lip_dev->common.dev); + #if defined(WANPIPE_IFNET_QUEUE_POLICY_INIT_OFF) + WAN_NETIF_STOP_QUEUE(lip_dev->common.dev); +@@ -911,6 +901,27 @@ + } + + ++ ++ ++int wplip_lipdev_prot_change_state(void *wplip_id,int state, ++ unsigned char *data, int len) ++{ ++ wplip_dev_t *lip_dev = (wplip_dev_t *)wplip_id; ++ ++ DEBUG_EVENT("%s: Lip Dev Prot State %s!\n", ++ lip_dev->name, STATE_DECODE(state)); ++ ++ lip_dev->common.state = state; ++ ++ if (wan_test_bit(WPLIP_DEV_UNREGISTER,&lip_dev->critical) || ++ wan_test_bit(0,&lip_dev->if_down)) { ++ return 0; ++ } ++ ++ return wplip_lipdev_prot_update_state_change(lip_dev,data,len); ++} ++ ++ + /*============================================================== + * wplip_connect + * +Only in /common/lip: wanpipe_lip_iface.c~ +Only in /common/lip: .#wanpipe_lip_iface.c.1.2 +Only in /common/lip: .#wanpipe_lip_iface.c.1.20 +Only in /common/lip: .#wanpipe_lip_iface.c.1.33 +Only in /common/lip: .#wanpipe_lip_iface.c.1.34 +Only in /common/lip: .#wanpipe_lip_iface.c.1.37 +Only in /common/lip: .#wanpipe_lip_iface.c.1.39 +Only in /common/lip: .#wanpipe_lip_iface.c.1.6 +Only in /common/lip: wanpipe_lip_iface.o +Only in /common/lip: .wanpipe_lip_iface.o.cmd +Only in /common/lip: wanpipe_lip_ipx.o +Only in /common/lip: .wanpipe_lip_ipx.o.cmd +Only in /common/lip: wanpipe_lip.ko +Only in /common/lip: .wanpipe_lip.ko.cmd +diff -dur /root/3.3/wanpipe/patches/kdrivers/src/lip/wanpipe_lip.mod.c /common/lip/wanpipe_lip.mod.c +--- /root/3.3/wanpipe/patches/kdrivers/src/lip/wanpipe_lip.mod.c 2008-01-24 12:23:03.000000000 -0500 ++++ /common/lip/wanpipe_lip.mod.c 2008-03-10 14:07:39.000000000 -0400 +@@ -4,25 +4,93 @@ + + MODULE_INFO(vermagic, VERMAGIC_STRING); + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,6) || defined(WANPIPE_MOD_266_FORCE_UPDATE) +-#undef unix + struct module __this_module + __attribute__((section(".gnu.linkonce.this_module"))) = { +- .name = __stringify(KBUILD_MODNAME), ++ .name = KBUILD_MODNAME, + .init = init_module, + #ifdef CONFIG_MODULE_UNLOAD + .exit = cleanup_module, + #endif + }; +-#endif + + static const struct modversion_info ____versions[] ++__attribute_used__ + __attribute__((section("__versions"))) = { +- ++ { 0x89e24b9c, "struct_module" }, ++ { 0x52c0a61d, "_write_unlock_irqrestore" }, ++ { 0xa5a6ef53, "skb_queue_head" }, ++ { 0x12da5bb2, "__kmalloc" }, ++ { 0xec7bc0d, "__mod_timer" }, ++ { 0xc6405fec, "skb_append" }, ++ { 0x4827a016, "del_timer" }, ++ { 0x3d7c39ea, "_read_lock" }, ++ { 0xe1b7029c, "print_tainted" }, ++ { 0x79aa04a2, "get_random_bytes" }, ++ { 0xab978df6, "malloc_sizes" }, ++ { 0x3adc4c7c, "remove_wait_queue" }, ++ { 0x3093180f, "_write_lock_irqsave" }, ++ { 0x772274b1, "netif_carrier_on" }, ++ { 0xc4f02fe7, "skb_clone" }, ++ { 0x14990642, "skb_copy" }, ++ { 0x1bcd461f, "_spin_lock" }, ++ { 0xf6a5a6c8, "schedule_work" }, ++ { 0x669e2d2f, "seq_printf" }, ++ { 0x87b6fae2, "netif_carrier_off" }, ++ { 0xfb1d0a92, "alloc_netdev" }, ++ { 0x3026fe48, "tty_register_driver" }, ++ { 0x87cddf59, "_spin_lock_irqsave" }, ++ { 0x1d26aa98, "sprintf" }, ++ { 0x5ddb19f0, "in_dev_finish_destroy" }, ++ { 0x7d11c268, "jiffies" }, ++ { 0x58502b7a, "tty_set_operations" }, ++ { 0x92cfbd9d, "netif_rx" }, ++ { 0xffd5a395, "default_wake_function" }, ++ { 0x1b7d4074, "printk" }, ++ { 0x5152e605, "memcmp" }, ++ { 0x15e074de, "free_netdev" }, ++ { 0xed5c73bf, "__tasklet_schedule" }, ++ { 0x2da418b5, "copy_to_user" }, ++ { 0x604efc6a, "register_netdev" }, ++ { 0xa20fdde, "_spin_unlock_irqrestore" }, ++ { 0xa5808bbf, "tasklet_init" }, ++ { 0x1902adf, "netpoll_trap" }, ++ { 0xb13e533f, "atm_dev_register" }, ++ { 0x149a799f, "dev_kfree_skb_any" }, ++ { 0x79ad224b, "tasklet_kill" }, ++ { 0x1c53db6e, "skb_over_panic" }, ++ { 0xb356ebea, "skb_queue_tail" }, ++ { 0x19070091, "kmem_cache_alloc" }, ++ { 0x89ac5254, "tty_std_termios" }, ++ { 0x9aebf873, "__alloc_skb" }, ++ { 0x4292364c, "schedule" }, ++ { 0x89d282ea, "kfree_skb" }, ++ { 0x6b2dc060, "dump_stack" }, ++ { 0xb08e0988, "skb_under_panic" }, ++ { 0xb00b9d99, "eth_type_trans" }, ++ { 0xad97dcd, "ether_setup" }, ++ { 0x95ec5a88, "tty_unregister_driver" }, ++ { 0x19cacd0, "init_waitqueue_head" }, ++ { 0xd0b91f9b, "init_timer" }, ++ { 0x6989a769, "vsnprintf" }, ++ { 0x20f26d60, "tty_hangup" }, ++ { 0x59968f3c, "__wake_up" }, ++ { 0xf6ebc03b, "net_ratelimit" }, ++ { 0xf66fb709, "atm_dev_deregister" }, ++ { 0xa3d44f8c, "add_wait_queue" }, ++ { 0x37a0cba, "kfree" }, ++ { 0x2e60bace, "memcpy" }, ++ { 0x2e2ed056, "skb_dequeue" }, ++ { 0x828fe72a, "unregister_netdev" }, ++ { 0x25da070, "snprintf" }, ++ { 0x45e37139, "__netif_schedule" }, ++ { 0xf2a644fb, "copy_from_user" }, ++ { 0x9e7d6bd0, "__udelay" }, + }; + + static const char __module_depends[] + __attribute_used__ + __attribute__((section(".modinfo"))) = +-"depends=wanrouter"; ++"depends=atm"; + ++ ++MODULE_INFO(srcversion, "332567BBD00B67D83582BEF"); +Only in /common/lip: wanpipe_lip.mod.o +Only in /common/lip: .wanpipe_lip.mod.o.cmd +diff -dur /root/3.3/wanpipe/patches/kdrivers/src/lip/wanpipe_lip_netdev.c /common/lip/wanpipe_lip_netdev.c +--- /root/3.3/wanpipe/patches/kdrivers/src/lip/wanpipe_lip_netdev.c 2008-01-24 12:23:03.000000000 -0500 ++++ /common/lip/wanpipe_lip_netdev.c 2008-03-12 17:29:15.000000000 -0400 +@@ -55,6 +55,10 @@ + if (!lip_dev || !lip_dev->lip_link){ + return -ENODEV; + } ++ ++ if (wan_test_bit(WPLIP_DEV_UNREGISTER,&lip_dev->critical)) { ++ return -ENODEV; ++ } + + #if defined(__LINUX__) + # if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18) +@@ -63,6 +67,7 @@ + # endif + #endif + ++ wan_clear_bit(0,&lip_dev->if_down); + + #if 0 + /* Done in if register now, do it interface up down +@@ -85,6 +90,10 @@ + WAN_NETIF_WAKE_QUEUE(dev); + #endif + ++ /* Its possible for state update to be skipped if interface was down */ ++ wplip_lipdev_prot_update_state_change(lip_dev,NULL,0); ++ ++ + if (!wan_test_bit(WAN_DEV_READY,&lip_dev->interface_down)) { + wan_set_bit(WAN_DEV_READY,&lip_dev->interface_down); + wplip_trigger_if_task(lip_dev); +@@ -125,6 +134,8 @@ + } + #endif + ++ wan_set_bit(0,&lip_dev->if_down); ++ + #if 0 + /* Done in if register now, do it interface up down + * feature on 2.4 kernels */ +Only in /common/lip: .#wanpipe_lip_netdev.c.1.12 +Only in /common/lip: .#wanpipe_lip_netdev.c.1.15 +Only in /common/lip: .#wanpipe_lip_netdev.c.1.17 +Only in /common/lip: .#wanpipe_lip_netdev.c.1.24 +Only in /common/lip: .#wanpipe_lip_netdev.c.1.25 +Only in /common/lip: .#wanpipe_lip_netdev.c.1.29 +Only in /common/lip: .#wanpipe_lip_netdev.c.1.4 +Only in /common/lip: wanpipe_lip_netdev.o +Only in /common/lip: .wanpipe_lip_netdev.o.cmd +Only in /common/lip: wanpipe_lip.o +Only in /common/lip: .wanpipe_lip.o.cmd +Only in /common/lip: wanpipe_lip_prot.c~ +Only in /common/lip: .#wanpipe_lip_prot.c.1.21 +Only in /common/lip: .#wanpipe_lip_prot.c.1.25 +Only in /common/lip: .#wanpipe_lip_prot.c.1.35 +Only in /common/lip: .#wanpipe_lip_prot.c.1.37 +Only in /common/lip: .#wanpipe_lip_prot.c.1.46 +Only in /common/lip: .#wanpipe_lip_prot.c.1.5 +Only in /common/lip: wanpipe_lip_prot.o +Only in /common/lip: .wanpipe_lip_prot.o.cmd +Only in /common/lip: .#wanpipe_lip_sub.c.1.15 +Only in /common/lip: .#wanpipe_lip_sub.c.1.2 +Only in /common/lip: wanpipe_lip_sub.o +Only in /common/lip: .wanpipe_lip_sub.o.cmd +Only in /common/lip: wanpipe_lip_tty.o +Only in /common/lip: .wanpipe_lip_tty.o.cmd +Only in /common/lip: xupdate diff --git a/patches/kdrivers/src/lip/bin/wanpipe_lip_atm.gcc3.i386.o b/patches/kdrivers/src/lip/bin/wanpipe_lip_atm.gcc3.i386.o index 78eaec3..1ee33de 100644 Binary files a/patches/kdrivers/src/lip/bin/wanpipe_lip_atm.gcc3.i386.o and b/patches/kdrivers/src/lip/bin/wanpipe_lip_atm.gcc3.i386.o differ diff --git a/patches/kdrivers/src/lip/bin/wanpipe_lip_atm.gcc3.i386.regparm.o b/patches/kdrivers/src/lip/bin/wanpipe_lip_atm.gcc3.i386.regparm.o index 3133efa..d148ca9 100644 Binary files a/patches/kdrivers/src/lip/bin/wanpipe_lip_atm.gcc3.i386.regparm.o and b/patches/kdrivers/src/lip/bin/wanpipe_lip_atm.gcc3.i386.regparm.o differ diff --git a/patches/kdrivers/src/lip/bin/wanpipe_lip_atm.gcc3.i686.o b/patches/kdrivers/src/lip/bin/wanpipe_lip_atm.gcc3.i686.o index bfaf20c..d63a5f5 100644 Binary files a/patches/kdrivers/src/lip/bin/wanpipe_lip_atm.gcc3.i686.o and b/patches/kdrivers/src/lip/bin/wanpipe_lip_atm.gcc3.i686.o differ diff --git a/patches/kdrivers/src/lip/bin/wanpipe_lip_atm.gcc3.i686.regparm.o b/patches/kdrivers/src/lip/bin/wanpipe_lip_atm.gcc3.i686.regparm.o index f8b0a02..fc58154 100644 Binary files a/patches/kdrivers/src/lip/bin/wanpipe_lip_atm.gcc3.i686.regparm.o and b/patches/kdrivers/src/lip/bin/wanpipe_lip_atm.gcc3.i686.regparm.o differ diff --git a/patches/kdrivers/src/lip/bin/wanpipe_sppp.gcc3.i386.o b/patches/kdrivers/src/lip/bin/wanpipe_sppp.gcc3.i386.o index 719f642..30f8f89 100644 Binary files a/patches/kdrivers/src/lip/bin/wanpipe_sppp.gcc3.i386.o and b/patches/kdrivers/src/lip/bin/wanpipe_sppp.gcc3.i386.o differ diff --git a/patches/kdrivers/src/lip/bin/wanpipe_sppp.gcc3.i386.regparm.o b/patches/kdrivers/src/lip/bin/wanpipe_sppp.gcc3.i386.regparm.o index 5ae39da..f990f8d 100644 Binary files a/patches/kdrivers/src/lip/bin/wanpipe_sppp.gcc3.i386.regparm.o and b/patches/kdrivers/src/lip/bin/wanpipe_sppp.gcc3.i386.regparm.o differ diff --git a/patches/kdrivers/src/lip/bin/wanpipe_sppp.gcc3.i686.o b/patches/kdrivers/src/lip/bin/wanpipe_sppp.gcc3.i686.o index 5b2c1ac..6d39568 100644 Binary files a/patches/kdrivers/src/lip/bin/wanpipe_sppp.gcc3.i686.o and b/patches/kdrivers/src/lip/bin/wanpipe_sppp.gcc3.i686.o differ diff --git a/patches/kdrivers/src/lip/bin/wanpipe_sppp.gcc3.i686.regparm.o b/patches/kdrivers/src/lip/bin/wanpipe_sppp.gcc3.i686.regparm.o index 9ca5e8b..f281bb3 100644 Binary files a/patches/kdrivers/src/lip/bin/wanpipe_sppp.gcc3.i686.regparm.o and b/patches/kdrivers/src/lip/bin/wanpipe_sppp.gcc3.i686.regparm.o differ diff --git a/patches/kdrivers/src/lip/lip_katm/wanpipe_katm_iface.o b/patches/kdrivers/src/lip/lip_katm/wanpipe_katm_iface.o deleted file mode 100644 index 9888155..0000000 Binary files a/patches/kdrivers/src/lip/lip_katm/wanpipe_katm_iface.o and /dev/null differ diff --git a/patches/kdrivers/src/lip/lip_katm/wanpipe_katm_sub.o b/patches/kdrivers/src/lip/lip_katm/wanpipe_katm_sub.o deleted file mode 100644 index b4a6696..0000000 Binary files a/patches/kdrivers/src/lip/lip_katm/wanpipe_katm_sub.o and /dev/null differ diff --git a/patches/kdrivers/src/lip/wanpipe_lip_bh.c b/patches/kdrivers/src/lip/wanpipe_lip_bh.c index 1619e63..bee2485 100644 --- a/patches/kdrivers/src/lip/wanpipe_lip_bh.c +++ b/patches/kdrivers/src/lip/wanpipe_lip_bh.c @@ -13,13 +13,20 @@ void wplip_link_bh(void* data, int pending); static int wplip_bh_receive(wplip_link_t *lip_link) { netskb_t *skb; + unsigned long timeout_cnt = 2000; int err; while((skb=wan_skb_dequeue(&lip_link->rx_queue)) != NULL){ + err=wplip_prot_rx(lip_link,skb); if (err){ wan_skb_free(skb); } + + if (--timeout_cnt == 0){ + DEBUG_EVENT("%s: Link RxBH Time squeeze\n",lip_link->name); + break; + } } return 0; @@ -30,7 +37,7 @@ static int wplip_bh_transmit(wplip_link_t *lip_link) netskb_t *skb; wplip_dev_t *lip_dev=NULL; int err=0; - unsigned long timeout_cnt=SYSTEM_TICKS; + unsigned int timeout_cnt=1000; if (wan_test_bit(WPLIP_BH_AWAITING_KICK,&lip_link->tq_working)){ if (wan_test_bit(WPLIP_KICK,&lip_link->tq_working)){ @@ -54,7 +61,7 @@ static int wplip_bh_transmit(wplip_link_t *lip_link) goto wplip_bh_link_transmit_exit; } - if (SYSTEM_TICKS-timeout_cnt > 10){ + if (--timeout_cnt == 0){ DEBUG_EVENT("%s: Link TxBH Time squeeze\n",lip_link->name); goto wplip_bh_link_transmit_exit; } @@ -88,11 +95,9 @@ static int wplip_bh_transmit(wplip_link_t *lip_link) } for (;;){ - - if (SYSTEM_TICKS-timeout_cnt > 10){ - if (WAN_NET_RATELIMIT()) { - DEBUG_EVENT("%s: LipDev TxBH Time squeeze --- Sanity\n",lip_link->name); - } + + if (--timeout_cnt == 0){ + DEBUG_EVENT("%s: LipDev TxBH Time squeeze\n",lip_link->name); goto wplip_bh_transmit_exit; } @@ -111,14 +116,14 @@ static int wplip_bh_transmit(wplip_link_t *lip_link) goto wplip_bh_transmit_exit; } - lip_dev->ifstats.tx_packets++; - lip_dev->ifstats.tx_bytes += len; + WAN_NETIF_STATS_INC_TX_PACKETS(&lip_dev->common); //lip_dev->ifstats.tx_packets++; + WAN_NETIF_STATS_INC_TX_BYTES(&lip_dev->common,len); //lip_dev->ifstats.tx_bytes += len; } - if (!wan_test_bit(0,&lip_dev->if_down) && - WAN_NETIF_QUEUE_STOPPED(lip_dev->common.dev)){ + if (WAN_NETIF_QUEUE_STOPPED(lip_dev->common.dev)){ if (lip_dev->common.usedby == API){ + DEBUG_TEST("%s: Api waking stack!\n",lip_dev->name); WAN_NETIF_START_QUEUE(lip_dev->common.dev); #if defined(__LINUX__) wan_wakeup_api(lip_dev); @@ -131,13 +136,13 @@ static int wplip_bh_transmit(wplip_link_t *lip_link) WAN_NETIF_WAKE_QUEUE (lip_dev->common.dev); } } + + wplip_prot_kick(lip_link,lip_dev); if (wan_skb_queue_len(&lip_dev->tx_queue)){ wan_set_bit(WPLIP_MORE_LINK_TX,&lip_link->tq_working); } - wplip_prot_kick(lip_link,lip_dev); - wplip_bh_transmit_skip: lip_dev=WAN_LIST_NEXT(lip_dev,list_entry); @@ -146,25 +151,8 @@ wplip_bh_transmit_skip: } if (lip_dev == lip_link->cur_tx){ -#if 0 -/* This logic can be used to speed up tx - however it uses MUCH more CPU */ - ++tx_pkt_cnt; - if (tx_pkt_cnt > 2) { - break; - } - - if (SYSTEM_TICKS-timeout_cnt > 2){ - break; - } - - if (!wan_test_bit(WPLIP_MORE_LINK_TX,&lip_link->tq_working)) { - break; - } -#else /* We went through the whole list */ break; -#endif } } @@ -210,7 +198,7 @@ void wplip_link_bh(void* data, int pending) #endif { wplip_link_t *lip_link = (wplip_link_t *)data; -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +#ifndef __LINUX__ wan_smp_flag_t s; #endif @@ -221,10 +209,10 @@ void wplip_link_bh(void* data, int pending) return; } -#if defined(__LINUX__) +#ifdef __LINUX__ wan_spin_lock(&lip_link->bh_lock); #else - wan_spin_lock_irq(NULL, &s); + wan_spin_lock_irq(&lip_link->bh_lock, &s); #endif wan_set_bit(WPLIP_BH_RUNNING,&lip_link->tq_working); @@ -236,12 +224,11 @@ void wplip_link_bh(void* data, int pending) WAN_TASKLET_END((&lip_link->task)); -#if defined(__LINUX__) +#ifdef __LINUX__ wan_spin_unlock(&lip_link->bh_lock); #else - wan_spin_unlock_irq(NULL, &s); + wan_spin_unlock_irq(&lip_link->bh_lock, &s); #endif - wplip_retrigger_bh(lip_link); } diff --git a/patches/kdrivers/src/lip/wanpipe_lip_bh.c~ b/patches/kdrivers/src/lip/wanpipe_lip_bh.c~ deleted file mode 100644 index 13ae288..0000000 --- a/patches/kdrivers/src/lip/wanpipe_lip_bh.c~ +++ /dev/null @@ -1,237 +0,0 @@ -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -# include -#else -#include -#endif - -#if defined(__LINUX__) -void wplip_link_bh(unsigned long data); -#else -void wplip_link_bh(void* data, int pending); -#endif - -static int wplip_bh_receive(wplip_link_t *lip_link) -{ - netskb_t *skb; - unsigned long timeout_cnt = 2000; - int err; - - while((skb=wan_skb_dequeue(&lip_link->rx_queue)) != NULL){ - - err=wplip_prot_rx(lip_link,skb); - if (err){ - wan_skb_free(skb); - } - - if (--timeout_cnt == 0){ - DEBUG_EVENT("%s: Link RxBH Time squeeze\n",lip_link->name); - break; - } - } - - return 0; -} - -static int wplip_bh_transmit(wplip_link_t *lip_link) -{ - netskb_t *skb; - wplip_dev_t *lip_dev=NULL; - int err=0; - unsigned int timeout_cnt=1000; - - if (wan_test_bit(WPLIP_BH_AWAITING_KICK,&lip_link->tq_working)){ - if (wan_test_bit(WPLIP_KICK,&lip_link->tq_working)){ - DEBUG_TEST("%s: KICK but await still set!\n", - lip_link->name); - }else{ - return 0; - } - } - - wan_clear_bit(WPLIP_KICK,&lip_link->tq_working); - wan_clear_bit(WPLIP_BH_AWAITING_KICK,&lip_link->tq_working); - - wan_clear_bit(WPLIP_MORE_LINK_TX,&lip_link->tq_working); - - while((skb=wan_skb_dequeue(&lip_link->tx_queue))){ - err=wplip_data_tx_down(lip_link,skb); - if (err != 0){ - wan_skb_queue_head(&lip_link->tx_queue,skb); - wan_set_bit(WPLIP_BH_AWAITING_KICK,&lip_link->tq_working); - goto wplip_bh_link_transmit_exit; - } - - if (--timeout_cnt == 0){ - DEBUG_EVENT("%s: Link TxBH Time squeeze\n",lip_link->name); - goto wplip_bh_link_transmit_exit; - } - } - - if ((lip_dev=lip_link->cur_tx) != NULL){ - - if (lip_dev->magic != WPLIP_MAGIC_DEV){ - DEBUG_EVENT("%s: Error1: Invalid Dev Magic dev=%p Magic=0x%lX\n", - lip_link->name, - lip_dev, - lip_dev->magic); - goto wplip_bh_transmit_exit; - } - - }else{ - lip_dev=WAN_LIST_FIRST(&lip_link->list_head_ifdev); - if (!lip_dev){ - goto wplip_bh_transmit_exit; - } - - if (lip_dev->magic != WPLIP_MAGIC_DEV){ - DEBUG_EVENT("%s: Error2: Invalid Dev Magic dev=%p Magic=0x%lX\n", - lip_link->name, - lip_dev, - lip_dev->magic); - goto wplip_bh_transmit_exit; - } - - lip_link->cur_tx=lip_dev; - } - - for (;;){ - - if (--timeout_cnt == 0){ - DEBUG_EVENT("%s: LipDev TxBH Time squeeze\n",lip_link->name); - goto wplip_bh_transmit_exit; - } - - if (wan_test_bit(WPLIP_DEV_UNREGISTER,&lip_dev->critical)){ - goto wplip_bh_transmit_skip; - } - - skb=wan_skb_dequeue(&lip_dev->tx_queue); - if (skb){ - int len=wan_skb_len(skb); - - err=wplip_data_tx_down(lip_link,skb); - if (err != 0){ - wan_skb_queue_head(&lip_dev->tx_queue,skb); - wan_set_bit(WPLIP_BH_AWAITING_KICK,&lip_link->tq_working); - goto wplip_bh_transmit_exit; - } - - lip_dev->ifstats.tx_packets++; - lip_dev->ifstats.tx_bytes += len; - - } - - if (WAN_NETIF_QUEUE_STOPPED(lip_dev->common.dev)){ - if (lip_dev->common.usedby == API){ -#warning "NENAD" - DEBUG_EVENT("%s: Api waking stack!\n",lip_dev->name); - WAN_NETIF_START_QUEUE(lip_dev->common.dev); -#if defined(__LINUX__) - wan_wakeup_api(lip_dev); -#endif - }else if (lip_dev->common.lip){ /*STACK*/ - WAN_NETIF_START_QUEUE(lip_dev->common.dev); - wplip_kick(lip_dev->common.lip,0); - - }else{ - WAN_NETIF_WAKE_QUEUE (lip_dev->common.dev); - } - } - - if (wan_skb_queue_len(&lip_dev->tx_queue)){ - wan_set_bit(WPLIP_MORE_LINK_TX,&lip_link->tq_working); - } - - wplip_prot_kick(lip_link,lip_dev); - -wplip_bh_transmit_skip: - - lip_dev=WAN_LIST_NEXT(lip_dev,list_entry); - if (lip_dev == NULL){ - lip_dev=WAN_LIST_FIRST(&lip_link->list_head_ifdev); - } - - if (lip_dev == lip_link->cur_tx){ - /* We went through the whole list */ - break; - } - - } - -wplip_bh_transmit_exit: - - lip_link->cur_tx=lip_dev; - -wplip_bh_link_transmit_exit: - - if (wan_skb_queue_len(&lip_link->tx_queue)){ - wan_set_bit(WPLIP_MORE_LINK_TX,&lip_link->tq_working); - } - - if (wan_test_bit(WPLIP_MORE_LINK_TX,&lip_link->tq_working)){ - return 1; - } - - return 0; - -} - - -static int wplip_retrigger_bh(wplip_link_t *lip_link) -{ - if (wan_test_bit(WPLIP_MORE_LINK_TX, &lip_link->tq_working) || - wan_skb_queue_len(&lip_link->rx_queue)){ - return wplip_trigger_bh(lip_link); - } -#if 0 - if (gdbg_flag){ - DEBUG_EVENT("%s: Not triggered\n", __FUNCTION__); - } -#endif - return -EINVAL; -} - - -#if defined(__LINUX__) -void wplip_link_bh(unsigned long data) -#else -void wplip_link_bh(void* data, int pending) -#endif -{ - wplip_link_t *lip_link = (wplip_link_t *)data; -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) - wan_smp_flag_t s; -#endif - - DEBUG_TEST("%s: Link BH\n",__FUNCTION__); - - if (wan_test_bit(WPLIP_LINK_DOWN,&lip_link->tq_working)){ - DEBUG_EVENT("%s: Link down in BH\n",__FUNCTION__); - return; - } - -#if defined(__LINUX__) - wan_spin_lock(&lip_link->bh_lock); -#else - wan_spin_lock_irq(NULL, &s); -#endif - wan_set_bit(WPLIP_BH_RUNNING,&lip_link->tq_working); - - wplip_bh_receive(lip_link); - - wplip_bh_transmit(lip_link); - - wan_clear_bit(WPLIP_BH_RUNNING,&lip_link->tq_working); - - WAN_TASKLET_END((&lip_link->task)); - - wplip_retrigger_bh(lip_link); - -#if defined(__LINUX__) - wan_spin_unlock(&lip_link->bh_lock); -#else - wan_spin_unlock_irq(NULL, &s); -#endif - -} - diff --git a/patches/kdrivers/src/lip/wanpipe_lip_iface.c b/patches/kdrivers/src/lip/wanpipe_lip_iface.c index c960f8e..4f983ab 100644 --- a/patches/kdrivers/src/lip/wanpipe_lip_iface.c +++ b/patches/kdrivers/src/lip/wanpipe_lip_iface.c @@ -5,6 +5,8 @@ * * =========================================================== * + * Feb 09 2007 Joel M. Pareja Added link state notification + * for NETGRAPH failover support. * Dec 02 2003 Nenad Corbic Initial Driver */ @@ -23,13 +25,16 @@ * Definitions */ - /*============================================================= * Global Parameters */ /* Function interface between LIP layer and kernel */ extern wan_iface_t wan_iface; +#if defined(NETGRAPH) +extern void wan_ng_link_state(wanpipe_common_t *common, int state); +#endif + struct wplip_link_list list_head_link; wan_rwlock_t wplip_link_lock; unsigned char wplip_link_num[MAX_LIP_LINKS]; @@ -109,12 +114,15 @@ static int wplip_register (void **lip_link_ptr, wanif_conf_t *conf, char *devnam lip_link->state = WAN_DISCONNECTED; lip_link->carrier_state = WAN_DISCONNECTED; - lip_link->latency_qlen=100; - *lip_link_ptr = lip_link; +#if defined(__FreeBSD__) && defined(WPLIP_TQ_THREAD) + lip_link->tq = taskqueue_create_fast("wplip_taskq",M_NOWAIT, + taskqueue_thread_enqueue, &lip_link->tq); + taskqueue_start_threads(&lip_link->tq,1,PI_NET,"%s taskq",devname); +#endif return 0; } @@ -144,6 +152,14 @@ static int wplip_unreg(void *lip_link_ptr) return -ENODEV; } +#if defined(__FreeBSD__) && defined(WPLIP_TQ_THREAD) + if (lip_link->tq){ + WAN_TASKQUEUE_DRAIN(lip_link->tq, &lip_link->task); + WAN_TASKQUEUE_FREE(lip_link->tq); + lip_link->tq = NULL; + } +#endif + #ifdef WPLIP_TTY_SUPPORT if (lip_link->tty_opt && lip_link->tty_open){ tty_hangup(lip_link->tty); @@ -245,6 +261,10 @@ static int wplip_if_reg(void *lip_link_ptr, char *dev_name, wanif_conf_t *conf) #if defined(__OpenBSD__) }else if(strcmp(conf->usedby, "TRUNK") == 0){ usedby = TRUNK; +#endif +#if defined(__FreeBSD__) + }else if(strcmp(conf->usedby, "NETGRAPH") == 0){ + usedby = WP_NETGRAPH; #endif }else{ DEBUG_EVENT( "%s: LIP device invalid 'usedby': %s\n", @@ -310,6 +330,11 @@ static int wplip_if_reg(void *lip_link_ptr, char *dev_name, wanif_conf_t *conf) lip_dev->name); break; + case WP_NETGRAPH: + DEBUG_EVENT( "%s: Running in NETGRAPH mode\n", + lip_dev->name); + break; + default: DEBUG_EVENT( "%s: LIP device invalid 'usedby': %s\n", lip_dev->name, conf->usedby); @@ -426,12 +451,12 @@ static int wplip_if_unreg (netdevice_t *dev) return err; } } - + wan_set_bit(WPLIP_DEV_UNREGISTER,&lip_dev->critical); wan_clear_bit(WAN_DEV_READY,&lip_dev->interface_down); wplip_close_lipdev_prot(lip_dev); - + wan_spin_lock_irq(&lip_link->bh_lock,&flags); lip_link->cur_tx=NULL; wan_skb_queue_purge(&lip_dev->tx_queue); @@ -467,7 +492,6 @@ static int wplip_bind_link(void *lip_id,netdevice_t *dev) wplip_dev_list_t *lip_dev_list_el; wan_smp_flag_t flags; - if (!lip_id){ return -ENODEV; } @@ -476,11 +500,9 @@ static int wplip_bind_link(void *lip_id,netdevice_t *dev) return -ENODEV; } - if (wan_test_bit(WPLIP_LINK_DOWN,&lip_link->tq_working)){ return -ENETDOWN; } - lip_dev_list_el=wan_malloc(sizeof(wplip_dev_list_t)); memset(lip_dev_list_el,0,sizeof(wplip_dev_list_t)); @@ -557,20 +579,14 @@ static int wplip_rx(void *wplip_id, void *skb) { wplip_link_t *lip_link = (wplip_link_t*)wplip_id; - DEBUG_RX("%s: LIP LINK %s() pkt=%d %p\n", lip_link->name,__FUNCTION__, - skb?wan_skb_len(skb):0, + wan_skb_len(skb), skb); if (wan_test_bit(WPLIP_LINK_DOWN,&lip_link->tq_working)){ return -ENODEV; } - - if (skb == NULL) { - wplip_trigger_bh(lip_link); - return 0; - } #ifdef WPLIP_TTY_SUPPORT if (lip_link->tty_opt){ @@ -583,7 +599,7 @@ static int wplip_rx(void *wplip_id, void *skb) } } #endif - + if (wan_skb_queue_len(&lip_link->rx_queue) > MAX_RX_Q){ DEBUG_TEST("%s: Critical Rx Error: Rx buf overflow 0x%lX!\n", lip_link->name, @@ -592,7 +608,6 @@ static int wplip_rx(void *wplip_id, void *skb) return -ENOBUFS; } - wan_skb_queue_tail(&lip_link->rx_queue,skb); wplip_trigger_bh(lip_link); @@ -670,11 +685,11 @@ int wplip_data_rx_up(wplip_dev_t* lip_dev, void *skb) #else wan_skb_free(skb); #endif - lip_dev->ifstats.rx_errors++; + WAN_NETIF_STATS_INC_RX_ERRORS(&lip_dev->common); //lip_dev->ifstats.rx_errors++; return 1; }else{ - lip_dev->ifstats.rx_packets++; - lip_dev->ifstats.rx_bytes+=len; + WAN_NETIF_STATS_INC_RX_PACKETS(&lip_dev->common); //lip_dev->ifstats.rx_packets++; + WAN_NETIF_STATS_INC_RX_BYTES(&lip_dev->common,len); //lip_dev->ifstats.rx_bytes+=len; } } break; @@ -685,24 +700,24 @@ int wplip_data_rx_up(wplip_dev_t* lip_dev, void *skb) int err=wplip_rx(lip_dev->common.lip,skb); if (err){ wan_skb_free(skb); - lip_dev->ifstats.rx_dropped++; + WAN_NETIF_STATS_INC_RX_DROPPED(&lip_dev->common); //lip_dev->ifstats.rx_dropped++; }else{ - lip_dev->ifstats.rx_packets++; - lip_dev->ifstats.rx_bytes+=len; + WAN_NETIF_STATS_INC_RX_PACKETS(&lip_dev->common); //lip_dev->ifstats.rx_packets++; + WAN_NETIF_STATS_INC_RX_BYTES(&lip_dev->common,len); //lip_dev->ifstats.rx_bytes+=len; } }else{ wan_skb_free(skb); - lip_dev->ifstats.rx_dropped++; + WAN_NETIF_STATS_INC_RX_DROPPED(&lip_dev->common); //lip_dev->ifstats.rx_dropped++; } break; default: if (wan_iface.input && wan_iface.input(lip_dev->common.dev, skb) == 0){ - lip_dev->ifstats.rx_packets++; - lip_dev->ifstats.rx_bytes += len; + WAN_NETIF_STATS_INC_RX_PACKETS(&lip_dev->common); //lip_dev->ifstats.rx_packets++; + WAN_NETIF_STATS_INC_RX_BYTES(&lip_dev->common,len); //lip_dev->ifstats.rx_bytes += len; }else{ wan_skb_free(skb); - lip_dev->ifstats.rx_dropped++; + WAN_NETIF_STATS_INC_RX_DROPPED(&lip_dev->common); //lip_dev->ifstats.rx_dropped++; } break; @@ -781,7 +796,9 @@ int wplip_data_tx_down(wplip_link_t *lip_link, void *skb) return dev->hard_start_xmit(skb,dev); #else - if (dev->if_output) return dev->if_output(dev, skb, NULL,NULL); + if (!(WAN_NETIF_QUEUE_STOPPED(dev)) && dev->if_output){ + return dev->if_output(dev, skb, NULL,NULL); + } wan_skb_free(skb); return 0; #endif @@ -798,10 +815,6 @@ int wplip_data_tx_down(wplip_link_t *lip_link, void *skb) int wplip_link_prot_change_state(void *wplip_id,int state, unsigned char *data, int len) { wplip_link_t *lip_link = (wplip_link_t *)wplip_id; - - if (wan_test_bit(WPLIP_LINK_DOWN,&lip_link->tq_working)) { - return 0; - } if (lip_link->prot_state != state){ lip_link->prot_state=state; @@ -827,10 +840,11 @@ int wplip_link_prot_change_state(void *wplip_id,int state, unsigned char *data, } + int wplip_lipdev_prot_update_state_change(wplip_dev_t *lip_dev, unsigned char *data, int len) { int state = lip_dev->common.state; - + if (lip_dev->common.usedby == API) { if (data && len){ @@ -844,12 +858,12 @@ int wplip_lipdev_prot_update_state_change(wplip_dev_t *lip_dev, unsigned char *d WAN_NETIF_CARRIER_OFF(lip_dev->common.dev); WAN_NETIF_STOP_QUEUE(lip_dev->common.dev); } - + wan_update_api_state(lip_dev); wplip_trigger_bh(lip_dev->lip_link); - } else if (lip_dev->common.lip) { /*STACK*/ + }else if (lip_dev->common.lip) { /*STACK*/ if (state == WAN_CONNECTED){ WAN_NETIF_CARRIER_ON(lip_dev->common.dev); @@ -857,31 +871,38 @@ int wplip_lipdev_prot_update_state_change(wplip_dev_t *lip_dev, unsigned char *d wplip_connect(lip_dev->common.lip,0); }else{ WAN_NETIF_CARRIER_OFF(lip_dev->common.dev); -#if defined(WANPIPE_LIP_IFNET_QUEUE_POLICY_INIT_OFF) +#if defined(WANPIPE_IFNET_QUEUE_POLICY_INIT_OFF) WAN_NETIF_STOP_QUEUE(lip_dev->common.dev); #endif wplip_disconnect(lip_dev->common.lip,0); } - } else { + }else{ if (state == WAN_CONNECTED){ WAN_NETIF_CARRIER_ON(lip_dev->common.dev); WAN_NETIF_WAKE_QUEUE(lip_dev->common.dev); wplip_trigger_bh(lip_dev->lip_link); }else{ WAN_NETIF_CARRIER_OFF(lip_dev->common.dev); -#if defined(WANPIPE_LIP_IFNET_QUEUE_POLICY_INIT_OFF) +#if defined(WANPIPE_IFNET_QUEUE_POLICY_INIT_OFF) WAN_NETIF_STOP_QUEUE(lip_dev->common.dev); #endif } wplip_trigger_if_task(lip_dev); +#if defined(NETGRAPH) + if (lip_dev->common.usedby == WP_NETGRAPH) { + /* Inform netgraph of status of node */ + wan_ng_link_state(&lip_dev->common, lip_dev->common.state); + } +#endif } - + return 0; - } + + int wplip_lipdev_prot_change_state(void *wplip_id,int state, unsigned char *data, int len) { @@ -911,7 +932,10 @@ int wplip_lipdev_prot_change_state(void *wplip_id,int state, static void wplip_connect(void *wplip_id,int reason) { - wplip_link_t *lip_link = (wplip_link_t *)wplip_id; + wplip_link_t *lip_link = (wplip_link_t *)wplip_id; +#if defined(NETGRAPH) + wanpipe_common_t *common = NULL; +#endif if (lip_link->carrier_state != WAN_CONNECTED){ wan_smp_flag_t flags; @@ -936,6 +960,11 @@ static void wplip_connect(void *wplip_id,int reason) lip_link->state = WAN_CONNECTED; } +#if defined(NETGRAPH) + /* Inform netgraph of status of node */ + common = &(WAN_LIST_FIRST(&lip_link->list_head_ifdev))->common; + wan_ng_link_state(common, WAN_CONNECTED); +#endif } /*============================================================== @@ -949,6 +978,9 @@ static void wplip_connect(void *wplip_id,int reason) static void wplip_disconnect(void *wplip_id,int reason) { wplip_link_t *lip_link = (wplip_link_t *)wplip_id; +#if defined(NETGRAPH) + wanpipe_common_t *common = NULL; +#endif if (lip_link->carrier_state != WAN_DISCONNECTED){ DEBUG_EVENT("%s: Lip Link Carrier Disconnected!\n", @@ -962,6 +994,10 @@ static void wplip_disconnect(void *wplip_id,int reason) lip_link->state = WAN_DISCONNECTED; DEBUG_EVENT("%s: Lip Link Disconnected!\n",lip_link->name); } +#if defined(NETGRAPH) + common = &(WAN_LIST_FIRST(&lip_link->list_head_ifdev))->common; + wan_ng_link_state(common, WAN_DISCONNECTED); +#endif } @@ -1081,7 +1117,7 @@ int wplip_callback_tx_down(void *wplip_id, void *skb) DEBUG_TEST("%s: %s() Error Lip Link Carrier not connected !\n", lip_dev->name,__FUNCTION__); wan_skb_free(skb); - lip_dev->ifstats.tx_carrier_errors++; + WAN_NETIF_STATS_INC_TX_CARRIER_ERRORS(&lip_dev->common); //lip_dev->ifstats.tx_carrier_errors++; return 0; } @@ -1477,6 +1513,8 @@ static unsigned char wplip_copyright[]="(c) 1995-2004 Sangoma Technologies Inc." int wanpipe_lip_init(void*); int wanpipe_lip_exit(void*); +int wanpipe_lip_shutdown(void*); +int wanpipe_lip_ready_unload(void*); int wanpipe_lip_init(void *arg) { @@ -1539,11 +1577,17 @@ int wanpipe_lip_exit (void *arg) } #if 0 -MODULE_AUTHOR("Nenad Corbic "); -MODULE_DESCRIPTION("Wanpipe L.I.P Network Layer - Sangoma Tech. Copyright 2004"); -MODULE_LICENSE("GPL"); -module_init(wanpipe_lip_init); -module_exit(wanpipe_lip_exit); +int wanpipe_lip_shutdown(void *arg) +{ + DEBUG_EVENT("Shutting down WANPIPE LIP module ...\n"); + return 0; +} + +int wanpipe_lip_ready_unload(void *arg) +{ + DEBUG_EVENT("Is WANPIPE LIP module ready to unload...\n"); + return 0; +} #endif WAN_MODULE_DEFINE( @@ -1551,7 +1595,8 @@ WAN_MODULE_DEFINE( "Nenad Corbic ", "Wanpipe L.I.P Network Layer - Sangoma Tech. Copyright 2004", "GPL", - wanpipe_lip_init, wanpipe_lip_exit, NULL); + wanpipe_lip_init, wanpipe_lip_exit,/* wanpipe_lip_shutdown, wanpipe_lip_ready_unload,*/ + NULL); WAN_MODULE_DEPEND(wanpipe_lip, wanrouter, 1, WANROUTER_MAJOR_VER, WANROUTER_MAJOR_VER); WAN_MODULE_DEPEND(wanpipe_lip, wanpipe, 1, diff --git a/patches/kdrivers/src/lip/wanpipe_lip_iface.c~ b/patches/kdrivers/src/lip/wanpipe_lip_iface.c~ deleted file mode 100644 index d031cd1..0000000 --- a/patches/kdrivers/src/lip/wanpipe_lip_iface.c~ +++ /dev/null @@ -1,1538 +0,0 @@ -/************************************************************* - * wanpipe_lip.c WANPIPE Link Interface Protocol Layer (LIP) - * - * - * - * =========================================================== - * - * Dec 02 2003 Nenad Corbic Initial Driver - */ - - -/*============================================================= - * Includes - */ - -#if defined(__FreeBSD__) || defined(__OpenBSD__) -#include -#elif defined(__LINUX__) -#include -#endif - -/*============================================================= - * Definitions - */ - - -/*============================================================= - * Global Parameters - */ -/* Function interface between LIP layer and kernel */ -extern wan_iface_t wan_iface; - -struct wplip_link_list list_head_link; -wan_rwlock_t wplip_link_lock; -unsigned char wplip_link_num[MAX_LIP_LINKS]; -#if 0 -int gdbg_flag=0; -#endif - -/*============================================================= - * Function Prototypes - */ - -static int wplip_if_unreg (netdevice_t *dev); -static int wplip_bind_link(void *lip_id,netdevice_t *dev); -static int wplip_unbind_link(void *lip_id,netdevice_t *dev); -static void wplip_disconnect(void *wplip_id,int reason); -static void wplip_connect(void *wplip_id,int reason); -static int wplip_rx(void *wplip_id, void *skb); -static int wplip_unreg(void *reg_ptr); - -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -static void wplip_if_task (void *arg, int dummy); -#else -# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -static void wplip_if_task (void *arg); -# else -static void wplip_if_task (struct work_struct *work); -# endif -#endif - -extern int register_wanpipe_lip_protocol (wplip_reg_t *lip_reg); -extern void unregister_wanpipe_lip_protocol (void); - - -/*============================================================= - * Global Module Interface Functions - */ - - -/*============================================================= - * wplip_register - * - * Description: - * - * Usedby: - */ -/* EXPORT_SYMBOL(wplip_register); */ -static int wplip_register (void **lip_link_ptr, wanif_conf_t *conf, char *devname) -{ - wplip_link_t *lip_link = (wplip_link_t*)*lip_link_ptr; - - /* Create the new X25 link for this Lapb - * connection */ - if (lip_link){ - return -EEXIST; - } - - lip_link = wplip_create_link(devname); - if (!lip_link){ - DEBUG_EVENT("%s: LIP register: Failed to create link\n", - MODNAME); - return -ENOMEM; - } - - DEBUG_TEST("%s: Registering LIP Link\n",lip_link->name); - - - if (conf){ - int err=wplip_reg_link_prot(lip_link,conf); - if (err){ - wplip_free_link(lip_link); - return err; - } - } - - wplip_insert_link(lip_link); - - lip_link->state = WAN_DISCONNECTED; - lip_link->carrier_state = WAN_DISCONNECTED; - - - lip_link->latency_qlen=100; - - - *lip_link_ptr = lip_link; - - return 0; -} - -/*============================================================== - * wplip_unreg - * - * Description: - * This function is called during system setup to - * remove the whole x25 link and all x25 svc defined - * within the x25 link. - * - * For each x25 link and x25 svc the proc file - * entry is removed. - * - * Usedby: - * Lapb layer. - */ - -static int wplip_unreg(void *lip_link_ptr) -{ - wplip_link_t *lip_link = (wplip_link_t*)lip_link_ptr; - wplip_dev_t *lip_dev; - wplip_dev_list_t *lip_dev_list_el; - int err; - - if (wplip_link_exists(lip_link) != 0){ - return -ENODEV; - } - -#ifdef WPLIP_TTY_SUPPORT - if (lip_link->tty_opt && lip_link->tty_open){ - tty_hangup(lip_link->tty); - return -EBUSY; - } -#endif - - wan_del_timer(&lip_link->prot_timer); - - wan_set_bit(WPLIP_LINK_DOWN,&lip_link->tq_working); - while((lip_dev = WAN_LIST_FIRST(&lip_link->list_head_ifdev)) != NULL){ - - DEBUG_EVENT("%s: Unregistering dev %s\n", - lip_link->name,lip_dev->name); - - - err=wplip_if_unreg(lip_dev->common.dev); - if (err<0){ - wan_clear_bit(WPLIP_LINK_DOWN,&lip_link->tq_working); - return err; - } - } - - - while((lip_dev_list_el = WAN_LIST_FIRST(&lip_link->list_head_tx_ifdev)) != NULL){ - - DEBUG_EVENT("%s: Unregistering master dev %s\n", - lip_link->name, - wan_netif_name(lip_dev_list_el->dev)); - - WAN_DEV_PUT(lip_dev_list_el->dev); - lip_dev_list_el->dev=NULL; - - WAN_LIST_REMOVE(lip_dev_list_el,list_entry); - lip_link->tx_dev_cnt--; - - wan_free(lip_dev_list_el); - lip_dev_list_el=NULL; - } - - - if (lip_link->protocol){ - wplip_unreg_link_prot(lip_link); - } - - wplip_remove_link(lip_link); - wplip_free_link(lip_link); - - return 0; -} - - -static int wplip_if_reg(void *lip_link_ptr, char *dev_name, wanif_conf_t *conf) -{ - wplip_link_t *lip_link = (wplip_link_t*)lip_link_ptr; - wplip_dev_t *lip_dev; - int usedby=0; - int err; - - if (!conf){ - DEBUG_EVENT("%s: LIP DEV: If Registartion without configuration!\n",dev_name); - return -EINVAL; - } - -#ifdef WPLIP_TTY_SUPPORT - if (lip_link->tty_opt){ - return 0; - } -#endif - - if (wplip_link_exists(lip_link) != 0){ - DEBUG_EVENT("%s: LIP: Invalid Link !\n", - dev_name); - return -EINVAL; - } - - if (dev_name == NULL){ - DEBUG_EVENT("%s: LIP: Invalid device name : NULL!\n", - lip_link->name); - return -EINVAL; - } - - if (!wplip_lipdev_exists(lip_link,dev_name)){ - DEBUG_EVENT("%s: LIP: Invalid lip link device %s!\n", - __FUNCTION__,dev_name); - return -EEXIST; - } - - if(strcmp(conf->usedby, "API") == 0) { - usedby = API; - }else if(strcmp(conf->usedby, "WANPIPE") == 0){ - usedby = WANPIPE; - }else if(strcmp(conf->usedby, "STACK") == 0){ - usedby = STACK; - }else if(strcmp(conf->usedby, "BRIDGE") == 0){ - usedby = BRIDGE; - }else if(strcmp(conf->usedby, "BRIDGE_NODE") == 0){ - usedby = BRIDGE_NODE; -#if defined(__OpenBSD__) - }else if(strcmp(conf->usedby, "TRUNK") == 0){ - usedby = TRUNK; -#endif - }else{ - DEBUG_EVENT( "%s: LIP device invalid 'usedby': %s\n", - dev_name, conf->usedby); - return -EINVAL; - } - - if ((lip_dev = wplip_create_lipdev(dev_name, usedby)) == NULL){ - DEBUG_EVENT("%s: LIP: Failed to create lip priv device %s\n", - lip_link->name,dev_name); - return -ENOMEM; - } - -#if defined(__LINUX__) - if (conf->mtu){ - lip_dev->common.dev->mtu = conf->mtu; - } -#endif - - WAN_HOLD(lip_link); - lip_dev->lip_link = lip_link; - lip_dev->protocol = conf->protocol; - lip_dev->common.usedby = usedby; - lip_dev->common.state = WAN_DISCONNECTED; - WAN_NETIF_CARRIER_OFF(lip_dev->common.dev); - -#if defined(__LINUX__) - if (conf->true_if_encoding){ - DEBUG_EVENT("%s: LIP: Setting IF Type to Broadcast\n",dev_name); - lip_dev->common.dev->flags &= ~IFF_POINTOPOINT; - lip_dev->common.dev->flags |= IFF_BROADCAST; - } -#endif - - switch (usedby){ - - case API: - wan_reg_api(lip_dev, lip_dev->common.dev, lip_link->name); - DEBUG_EVENT( "%s: Running in API mode\n", - lip_dev->name); - break; - case WANPIPE: - DEBUG_EVENT( "%s: Running in WANPIPE mode\n", - lip_dev->name); - break; - case STACK: - DEBUG_EVENT( "%s: Running in STACK mode\n", - lip_dev->name); - break; - - case BRIDGE: - DEBUG_EVENT( "%s: Running in BRIDGE mode\n", - lip_dev->name); - break; - - case BRIDGE_NODE: - DEBUG_EVENT( "%s: Running in BRIDGE Node mode\n", - lip_dev->name); - break; - - case TRUNK: - DEBUG_EVENT( "%s: Running in TRUNK mode\n", - lip_dev->name); - break; - - default: - DEBUG_EVENT( "%s: LIP device invalid 'usedby': %s\n", - lip_dev->name, conf->usedby); - __WAN_PUT(lip_link); - lip_dev->lip_link = NULL; - wplip_free_lipdev(lip_dev); - return -EINVAL; - } - - lip_dev->ipx_net_num = conf->network_number; - if (lip_dev->ipx_net_num) { - DEBUG_EVENT("%s: IPX Network Number = 0x%lX\n", - lip_dev->name, lip_dev->ipx_net_num); - } - - lip_dev->max_mtu_sz=MAX_TX_BUF; - lip_dev->max_mtu_sz_orig=MAX_TX_BUF; - - err=wplip_reg_lipdev_prot(lip_dev,conf); - if (err){ - __WAN_PUT(lip_link); - lip_dev->lip_link = NULL; - wplip_free_lipdev(lip_dev); - return err; - } - - wplip_insert_lipdev(lip_link,lip_dev); - WAN_TASKQ_INIT((&lip_dev->if_task),0,wplip_if_task,lip_dev); - - err=wplip_open_lipdev_prot(lip_dev); - if (err){ - wplip_remove_lipdev(lip_link,lip_dev); - __WAN_PUT(lip_link); - lip_dev->lip_link = NULL; - wplip_free_lipdev(lip_dev); - return err; - } - -#ifdef __LINUX__ - if (conf->if_down && usedby != API && usedby != STACK){ - wan_set_bit(DYN_OPT_ON,&lip_dev->interface_down); - DEBUG_EVENT("%s: Dynamic interface configuration enabled\n", - dev_name); - }else{ - wan_clear_bit(DYN_OPT_ON,&lip_dev->interface_down); - } - lip_link->latency_qlen=lip_dev->common.dev->tx_queue_len; -#endif - - if (lip_link->state == WAN_CONNECTED){ - DEBUG_TEST("%s: LIP CREATE Link already on!\n", - lip_dev->name); - WAN_NETIF_CARRIER_ON(lip_dev->common.dev); - WAN_NETIF_WAKE_QUEUE(lip_dev->common.dev); - wplip_trigger_bh(lip_dev->lip_link); - } - - DEBUG_TEST("%s: LIP LIPDEV Created %p Magic 0x%lX\n", - lip_link->name, - lip_dev, - lip_dev->magic); - return 0; -} - -/*============================================================== - * wplip_if_unreg - * - * Description: - * This function is called during system setup to - * remove the x25 link and each x25 svc defined - * in the wanpipe configuration file. - * - * For each x25 link and x25 svc the proc file - * entry is removed. - * - * Usedby: - * Lapb layer. - */ - -static int wplip_if_unreg (netdevice_t *dev) -{ - wplip_dev_t *lip_dev = (wplip_dev_t *)wan_netif_priv(dev); - wplip_link_t *lip_link = NULL; - wplip_link_t *stack_lip_link = NULL; - wan_smp_flag_t flags; - - if (!lip_dev) - return -ENODEV; - - if (WAN_NETIF_UP(dev)){ - DEBUG_EVENT("%s: Failed to unregister: Device UP!\n", - wan_netif_name(dev)); - return -EBUSY; - } - - lip_link = lip_dev->lip_link; - - if (wplip_link_exists(lip_link) != 0){ - DEBUG_EVENT("%s: Failed to unregister: no link device\n", - wan_netif_name(dev)); - return -ENODEV; - } - - /* Check for a Higher Lip Link layer attached - * to this device. If exists, call unregister to - * remove it before unregistering this device */ - stack_lip_link=lip_dev->common.lip; /*STACK*/ - if (stack_lip_link){ - int err; - DEBUG_TEST("%s: IF UNREG: Calling Top Layer LIP UNREG\n", - lip_dev->name); - err=wplip_unreg(stack_lip_link); - if (err){ - return err; - } - } - - wplip_close_lipdev_prot(lip_dev); - - wan_set_bit(WPLIP_DEV_UNREGISTER,&lip_dev->critical); - wan_clear_bit(WAN_DEV_READY,&lip_dev->interface_down); - - - wan_spin_lock_irq(&lip_link->bh_lock,&flags); - lip_link->cur_tx=NULL; - wan_skb_queue_purge(&lip_dev->tx_queue); - wan_spin_unlock_irq(&lip_link->bh_lock,&flags); - - DEBUG_EVENT("%s: Unregistering LIP device\n", - wan_netif_name(dev)); - - if (lip_dev->common.prot_ptr){ - wplip_unreg_lipdev_prot(lip_dev); - } - - if (lip_dev->common.usedby == API){ - wan_unreg_api(lip_dev, lip_link->name); - } - - wplip_remove_lipdev(lip_link,lip_dev); - - __WAN_PUT(lip_dev->lip_link); - lip_dev->lip_link=NULL; - - wplip_free_lipdev(lip_dev); - - return 0; -} - - - -static int wplip_bind_link(void *lip_id,netdevice_t *dev) -{ - - wplip_link_t *lip_link = (wplip_link_t*)lip_id; - wplip_dev_list_t *lip_dev_list_el; - wan_smp_flag_t flags; - - if (!lip_id){ - return -ENODEV; - } - - if (wplip_link_exists(lip_link) != 0){ - return -ENODEV; - } - - if (wan_test_bit(WPLIP_LINK_DOWN,&lip_link->tq_working)){ - return -ENETDOWN; - } - - lip_dev_list_el=wan_malloc(sizeof(wplip_dev_list_t)); - memset(lip_dev_list_el,0,sizeof(wplip_dev_list_t)); - - lip_dev_list_el->magic=WPLIP_MAGIC_DEV_EL; - - WAN_DEV_HOLD(dev); - - lip_dev_list_el->dev=dev; - - wan_spin_lock_irq(&lip_link->bh_lock,&flags); - - WAN_LIST_INSERT_HEAD(&lip_link->list_head_tx_ifdev,lip_dev_list_el,list_entry); - lip_link->tx_dev_cnt++; - - wan_spin_unlock_irq(&lip_link->bh_lock,&flags); - - return 0; -} - -static int wplip_unbind_link(void *lip_id,netdevice_t *dev) -{ - wplip_link_t *lip_link = (wplip_link_t*)lip_id; - wplip_dev_list_t *lip_dev_list_el=NULL; - wan_smp_flag_t flags; - int err=-ENODEV; - - if (!lip_id){ - return -EFAULT; - } - - if (wplip_link_exists(lip_link) != 0){ - return -EFAULT; - } - - - wan_spin_lock_irq(&lip_link->bh_lock,&flags); - - WAN_LIST_FOREACH(lip_dev_list_el,&lip_link->list_head_tx_ifdev,list_entry){ - if (lip_dev_list_el->dev == dev){ - WAN_LIST_REMOVE(lip_dev_list_el,list_entry); - lip_link->tx_dev_cnt--; - err=0; - break; - } - } - - wan_spin_unlock_irq(&lip_link->bh_lock,&flags); - - if (err==0){ - WAN_DEV_PUT(lip_dev_list_el->dev); - lip_dev_list_el->dev=NULL; - wan_free(lip_dev_list_el); - } - - return err; -} - - - - - -/*============================================================== - * wplip_rx - * - * Description: - * - * - * Usedby: - * Lower layer to pass us an rx packet. - */ - -static int wplip_rx(void *wplip_id, void *skb) -{ - wplip_link_t *lip_link = (wplip_link_t*)wplip_id; - - DEBUG_RX("%s: LIP LINK %s() pkt=%d %p\n", - lip_link->name,__FUNCTION__, - wan_skb_len(skb), - skb); - - if (wan_test_bit(WPLIP_LINK_DOWN,&lip_link->tq_working)){ - return -ENODEV; - } - -#ifdef WPLIP_TTY_SUPPORT - if (lip_link->tty_opt){ - if (lip_link->tty && lip_link->tty_open){ - wplip_tty_receive(lip_link,skb); - wanpipe_tty_trigger_poll(lip_link); - return 0; - }else{ - return -ENODEV; - } - } -#endif - - if (wan_skb_queue_len(&lip_link->rx_queue) > MAX_RX_Q){ - DEBUG_TEST("%s: Critical Rx Error: Rx buf overflow 0x%lX!\n", - lip_link->name, - lip_link->tq_working); - wplip_trigger_bh(lip_link); - return -ENOBUFS; - } - - wan_skb_queue_tail(&lip_link->rx_queue,skb); - wplip_trigger_bh(lip_link); - - return 0; -} - -/*============================================================== - * wplip_data_rx_up - * - * Description: - * This function is used to pass data to the upper - * layer. If the lip dev is used by TCP/IP the packet - * is passed up the the TCP/IP stack, otherwise - * it is passed to the upper protocol layer. - * - * Locking: - * This function will ALWAYS get called from - * the BH handler with the bh_lock, thus - * its protected. - * - * Usedby: - */ - -int wplip_data_rx_up(wplip_dev_t* lip_dev, void *skb) -{ - int len=wan_skb_len(skb); - - DEBUG_TEST("LIP LINK %s() pkt=%i\n", - __FUNCTION__,wan_skb_len(skb)); - -#if 0 - DEBUG_EVENT("%s: %s() Packet Len=%d (DEBUG DROPPED)\n", - lip_dev->name, __FUNCTION__,wan_skb_len(skb)); - - wan_skb_free(skb); - return 0; -#endif - - switch (lip_dev->common.usedby){ - -#if defined(__LINUX__) - case API: - { - unsigned char *buf; - int err; - - if (wan_skb_headroom(skb) < sizeof(wan_api_rx_hdr_t)){ - DEBUG_EVENT("%s: Critical Error Rx pkt Hdrm=%d < ApiHdrm=%d\n", - lip_dev->name,wan_skb_headroom(skb), - sizeof(wan_api_rx_hdr_t)); - wan_skb_free(skb); - break; - } - - buf=wan_skb_push(skb,sizeof(wan_api_rx_hdr_t)); - memset(buf,0,sizeof(wan_api_rx_hdr_t)); - - ((netskb_t *)skb)->protocol = htons(PVC_PROT); - wan_skb_reset_mac_header(((netskb_t *)skb)); - wan_skb_reset_network_header(((netskb_t *)skb)); - ((netskb_t *)skb)->dev = lip_dev->common.dev; - ((netskb_t *)skb)->pkt_type = WAN_PACKET_DATA; - - if ((err=wan_api_rx(lip_dev,skb)) != 0){ -#if 0 - if (net_ratelimit()){ - DEBUG_EVENT("%s: Error: Rx Socket busy err=%i!\n", - lip_dev->name,err); - } -#endif - -#if 0 - #LAPB SHOULD PUSH BACK TO THE STACK - wan_skb_pull(skb,sizeof(wan_api_rx_hdr_t)); -#else - wan_skb_free(skb); -#endif - lip_dev->ifstats.rx_errors++; - return 1; - }else{ - lip_dev->ifstats.rx_packets++; - lip_dev->ifstats.rx_bytes+=len; - } - } - break; -#endif - - case STACK: - if (lip_dev->common.lip){ - int err=wplip_rx(lip_dev->common.lip,skb); - if (err){ - wan_skb_free(skb); - lip_dev->ifstats.rx_dropped++; - }else{ - lip_dev->ifstats.rx_packets++; - lip_dev->ifstats.rx_bytes+=len; - } - }else{ - wan_skb_free(skb); - lip_dev->ifstats.rx_dropped++; - } - - break; - default: - if (wan_iface.input && wan_iface.input(lip_dev->common.dev, skb) == 0){ - lip_dev->ifstats.rx_packets++; - lip_dev->ifstats.rx_bytes += len; - }else{ - wan_skb_free(skb); - lip_dev->ifstats.rx_dropped++; - } - - break; - } - return 0; -} - - -/*============================================================== - * wplip_data_tx_down - * - * Description: - * This function is used to pass data down to the - * lower layer. - * - * Locking: - * This function will ALWAYS get called from - * the BH handler with the bh_lock, thus - * its protected. - * - * Return Codes: - * - * 0: Packet send successful, lower layer - * will deallocate packet - * - * Non 0: Packet send failed, upper layer - * must handle the packet - * - */ - -int wplip_data_tx_down(wplip_link_t *lip_link, void *skb) -{ - wplip_dev_list_t *lip_dev_list_el; - netdevice_t *dev; - - DEBUG_TEST("%s: LIP LINK %s() pkt=%d\n", - lip_link->name,__FUNCTION__,wan_skb_len(skb)); - - - if (!lip_link->tx_dev_cnt){ - DEBUG_EVENT("%s: %s: Tx Dev List empty! dropping...\n", - __FUNCTION__,lip_link->name); - return -ENODEV; - } - - /* FIXME: - * For now, we can only transmit on a FIRST Tx device */ - lip_dev_list_el=WAN_LIST_FIRST(&lip_link->list_head_tx_ifdev); - if (!lip_dev_list_el){ - DEBUG_EVENT("%s: %s: Tx Dev List empty! dropping...\n", - __FUNCTION__,lip_link->name); - return -ENODEV; - } - - if (lip_dev_list_el->magic != WPLIP_MAGIC_DEV_EL){ - DEBUG_EVENT("%s: %s: Error: Invalid dev magic number! dropping...\n", - __FUNCTION__,lip_link->name); - return -EFAULT; - } - - dev=lip_dev_list_el->dev; - if (!dev){ - DEBUG_EVENT("%s: %s: Error: No dev! dropping...\n", - __FUNCTION__,lip_link->name); - return -ENODEV; - } - - if (WAN_NETIF_QUEUE_STOPPED(dev)){ - return -EBUSY; - } - -#if defined(__LINUX__) - if (lip_link->latency_qlen != dev->tx_queue_len) { - dev->tx_queue_len=lip_link->latency_qlen; - } - - return dev->hard_start_xmit(skb,dev); -#else - if (dev->if_output) return dev->if_output(dev, skb, NULL,NULL); - wan_skb_free(skb); - return 0; -#endif -} - -/*============================================================== - * wplip_link_prot_change_state - * - * Description: - * The lower layer calls this function, when it - * becomes disconnected. - */ - -int wplip_link_prot_change_state(void *wplip_id,int state, unsigned char *data, int len) -{ - wplip_link_t *lip_link = (wplip_link_t *)wplip_id; - - if (lip_link->prot_state != state){ - lip_link->prot_state=state; - - DEBUG_EVENT("%s: Lip Link Protocol State %s!\n", - lip_link->name, STATE_DECODE(state)); - - if (lip_link->prot_state == WAN_CONNECTED && - lip_link->carrier_state == WAN_CONNECTED){ - DEBUG_EVENT("%s: Lip Link Connected!\n", - lip_link->name); - lip_link->state = WAN_CONNECTED; - } - - if (lip_link->prot_state != WAN_CONNECTED){ - DEBUG_EVENT("%s: Lip Link Disconnected!\n", - lip_link->name); - lip_link->state = WAN_DISCONNECTED; - } - } - - return 0; -} - -int wplip_lipdev_prot_change_state(void *wplip_id,int state, - unsigned char *data, int len) -{ - wplip_dev_t *lip_dev = (wplip_dev_t *)wplip_id; - - DEBUG_EVENT("%s: Lip Dev Prot State %s!\n", - lip_dev->name, STATE_DECODE(state)); - - lip_dev->common.state = state; - - if (lip_dev->common.usedby == API) { - - if (data && len){ - wplip_prot_oob(lip_dev,data,len); - } - - if (state == WAN_CONNECTED){ - lip_dev->common.state = state; - WAN_NETIF_CARRIER_ON(lip_dev->common.dev); - WAN_NETIF_START_QUEUE(lip_dev->common.dev); - }else{ - lip_dev->common.state = state; - WAN_NETIF_CARRIER_OFF(lip_dev->common.dev); - WAN_NETIF_STOP_QUEUE(lip_dev->common.dev); - } - - wan_update_api_state(lip_dev); - - wplip_trigger_bh(lip_dev->lip_link); - - }else if (lip_dev->common.lip) { /*STACK*/ - - if (state == WAN_CONNECTED){ - lip_dev->common.state = state; - WAN_NETIF_CARRIER_ON(lip_dev->common.dev); - WAN_NETIF_START_QUEUE(lip_dev->common.dev); - wplip_connect(lip_dev->common.lip,0); - }else{ - lip_dev->common.state = state; - WAN_NETIF_CARRIER_OFF(lip_dev->common.dev); -#if defined(WANPIPE_LIP_IFNET_QUEUE_POLICY_INIT_OFF) - WAN_NETIF_STOP_QUEUE(lip_dev->common.dev); -#endif - wplip_disconnect(lip_dev->common.lip,0); - } - - }else{ - if (state == WAN_CONNECTED){ - lip_dev->common.state = state; - WAN_NETIF_CARRIER_ON(lip_dev->common.dev); - WAN_NETIF_WAKE_QUEUE(lip_dev->common.dev); - wplip_trigger_bh(lip_dev->lip_link); - }else{ - lip_dev->common.state = state; - WAN_NETIF_CARRIER_OFF(lip_dev->common.dev); -#if defined(WANPIPE_LIP_IFNET_QUEUE_POLICY_INIT_OFF) - WAN_NETIF_STOP_QUEUE(lip_dev->common.dev); -#endif - } - wplip_trigger_if_task(lip_dev); - } - - return 0; -} - - -/*============================================================== - * wplip_connect - * - * Description: - * The lowyer layer calls this function, when it - * becomes connected. - */ - -static void wplip_connect(void *wplip_id,int reason) -{ - wplip_link_t *lip_link = (wplip_link_t *)wplip_id; - - if (lip_link->carrier_state != WAN_CONNECTED){ - wan_smp_flag_t flags; - - DEBUG_EVENT("%s: Lip Link Carrier Connected! \n", - lip_link->name); - - wan_spin_lock_irq(&lip_link->bh_lock,&flags); - wan_skb_queue_purge(&lip_link->tx_queue); - wan_skb_queue_purge(&lip_link->rx_queue); - wan_spin_unlock_irq(&lip_link->bh_lock,&flags); - - wplip_kick(lip_link,0); - - lip_link->carrier_state = WAN_CONNECTED; - } - - if (lip_link->prot_state == WAN_CONNECTED){ - - DEBUG_EVENT("%s: Lip Link Connected! \n", - lip_link->name); - - lip_link->state = WAN_CONNECTED; - } -} - -/*============================================================== - * wplip_disconnect - * - * Description: - * The lowyer layer calls this function, when it - * becomes disconnected. - */ - -static void wplip_disconnect(void *wplip_id,int reason) -{ - wplip_link_t *lip_link = (wplip_link_t *)wplip_id; - - if (lip_link->carrier_state != WAN_DISCONNECTED){ - DEBUG_EVENT("%s: Lip Link Carrier Disconnected!\n", - lip_link->name); - lip_link->carrier_state = WAN_DISCONNECTED; - } - - /* state = carrier_state & prot_state - * Therefore, the overall state is down */ - if (lip_link->state != WAN_DISCONNECTED){ - lip_link->state = WAN_DISCONNECTED; - DEBUG_EVENT("%s: Lip Link Disconnected!\n",lip_link->name); - } -} - - - -/*============================================================== - * wplip_kick - * - * Description: - */ - -void wplip_kick(void *wplip_id,int reason) -{ - wplip_link_t *lip_link = (wplip_link_t *)wplip_id; - -#warning "NENAD" - DEBUG_EVENT("%s: LIP Kick!\n", - lip_link->name); - -#ifdef WPLIP_TTY_SUPPORT - if (lip_link->tty_opt){ - wanpipe_tty_trigger_poll(lip_link); - }else -#endif - { - wan_clear_bit(WPLIP_BH_AWAITING_KICK,&lip_link->tq_working); - wan_set_bit(WPLIP_KICK,&lip_link->tq_working); - wplip_kick_trigger_bh(lip_link); - } -} - -#define INTERFACES_FRM "%-15s| %-12s| %-6u| %-18s|\n" -static int wplip_get_if_status(void *wplip_id, void *mptr) -{ -#if defined(__LINUX__) - wplip_link_t *lip_link = (wplip_link_t *)wplip_id; - struct seq_file *m = (struct seq_file *)mptr; - wplip_dev_t *cur_dev; - unsigned long flag; - - WP_READ_LOCK(&lip_link->dev_list_lock,flag); - - WAN_LIST_FOREACH(cur_dev,&lip_link->list_head_ifdev,list_entry){ - PROC_ADD_LINE(m, - INTERFACES_FRM, - cur_dev->name, lip_link->name, - cur_dev->prot_addr, - STATE_DECODE(cur_dev->common.state)); - } - - WP_READ_UNLOCK(&lip_link->dev_list_lock,flag); - - return m->count; -#else - return -EINVAL; -#endif -} - - -int wplip_link_callback_tx_down(void *wplink_id, void *skb) -{ - wplip_link_t *lip_link = (wplip_link_t *)wplink_id; - - if (!lip_link || !skb){ - DEBUG_EVENT("%s: Assertion error lip_dev=NULL!\n", - __FUNCTION__); - return 1; - } - - DEBUG_TEST("%s:%s: Protocol Packet Len=%i\n", - lip_link->name,__FUNCTION__,wan_skb_len(skb)); - - - if (lip_link->carrier_state != WAN_CONNECTED){ - DEBUG_TEST("%s: %s() Error Lip Link Carrier not connected !\n", - lip_link->name,__FUNCTION__); - wan_skb_free(skb); - return 0; - } - - if (wan_skb_queue_len(&lip_link->tx_queue) >= MAX_TX_BUF){ - DEBUG_TEST("%s: %s() Error Protocol Tx queue full !\n", - lip_link->name,__FUNCTION__); - wplip_trigger_bh(lip_link); - return 1; - } - - wan_skb_unlink(skb); - wan_skb_queue_tail(&lip_link->tx_queue,skb); - wplip_trigger_bh(lip_link); - - return 0; -} -int wplip_callback_tx_down(void *wplip_id, void *skb) -{ - wplip_dev_t *lip_dev = (wplip_dev_t *)wplip_id; - - if (!lip_dev){ - DEBUG_EVENT("%s: Assertion error lip_dev=NULL!\n", - __FUNCTION__); - return 1; - } - - if (!skb){ - int free_space=lip_dev->max_mtu_sz - wan_skb_queue_len(&lip_dev->tx_queue); - if (free_space < 0) { - return 0; - } else { - return free_space; - } - } - - - DEBUG_TEST("%s:%s: Packet Len=%i\n", - lip_dev->name,__FUNCTION__,wan_skb_len(skb)); - - - if (lip_dev->lip_link->carrier_state != WAN_CONNECTED){ - DEBUG_TEST("%s: %s() Error Lip Link Carrier not connected !\n", - lip_dev->name,__FUNCTION__); - wan_skb_free(skb); - lip_dev->ifstats.tx_carrier_errors++; - return 0; - } - - if (wan_skb_queue_len(&lip_dev->tx_queue) >= lip_dev->max_mtu_sz){ - wplip_trigger_bh(lip_dev->lip_link); - DEBUG_TEST("%s: %s() Error Tx queue full Kick=%d!\n", - lip_dev->name,__FUNCTION__, - wan_test_bit(WPLIP_BH_AWAITING_KICK,&lip_dev->lip_link->tq_working)); - return 1; - } - - wan_skb_unlink(skb); - wan_skb_queue_tail(&lip_dev->tx_queue,skb); - wplip_trigger_bh(lip_dev->lip_link); - - return 0; -} - -int wplip_callback_kick_prot_task (void *wplink_id) -{ - wplip_link_t *lip_link = (wplip_link_t *)wplink_id; - - if (!lip_link){ - DEBUG_EVENT("%s: Assertion error lip_dev=NULL!\n", - __FUNCTION__); - return 1; - } - - WAN_TASKQ_SCHEDULE((&lip_link->prot_task)); - - return 0; -} - -unsigned int wplip_get_ipv4_addr (void *wplip_id, int type) -{ - wplip_dev_t *lip_dev = (wplip_dev_t *)wplip_id; -#ifdef __LINUX__ - - struct in_ifaddr *ifaddr; - struct in_device *in_dev; - - if ((in_dev = in_dev_get(lip_dev->common.dev)) == NULL){ - return 0; - } - - if ((ifaddr = in_dev->ifa_list)== NULL ){ - in_dev_put(in_dev); - return 0; - } - in_dev_put(in_dev); - - switch (type){ - - case WAN_LOCAL_IP: - return ifaddr->ifa_local; - break; - - case WAN_POINTOPOINT_IP: - return ifaddr->ifa_address; - break; - - case WAN_NETMASK_IP: - return ifaddr->ifa_mask; - break; - - case WAN_BROADCAST_IP: - return ifaddr->ifa_broadcast; - break; - default: - return 0; - } -#else - netdevice_t *ifp = NULL; - struct ifaddr *ifa = NULL; - struct sockaddr_in *si; - - ifp = lip_dev->common.dev; - for (ifa = WAN_TAILQ_FIRST(ifp); ifa; ifa = WAN_TAILQ_NEXT(ifa)){ - if (ifa->ifa_addr->sa_family == AF_INET) { - si = (struct sockaddr_in *)ifa->ifa_addr; - if (si) break; - } - } - - if (ifa) { - switch (type){ - case WAN_LOCAL_IP: - if (ifa->ifa_addr){ - return (satosin(ifa->ifa_addr))->sin_addr.s_addr; - } - break; - case WAN_POINTOPOINT_IP: - if (ifa->ifa_dstaddr){ - return (satosin(ifa->ifa_dstaddr))->sin_addr.s_addr; - } - break; - case WAN_NETMASK_IP: - if (ifa->ifa_netmask){ - return (satosin(ifa->ifa_netmask))->sin_addr.s_addr; - } - break; - case WAN_BROADCAST_IP: - if (ifa->ifa_broadaddr){ - return (satosin(ifa->ifa_broadaddr))->sin_addr.s_addr; - } - break; - } - } -#endif - return 0; -} - - -/* PROTOCOL MUST CALL THIS ONLY - * FROM A PROT TASK */ - -int wplip_set_ipv4_addr (void *wplip_id, - unsigned int local, - unsigned int remote, - unsigned int netmask, - unsigned int dns) -{ - wplip_dev_t *lip_dev = (wplip_dev_t *)wplip_id; -#if defined(__LINUX__) - struct sockaddr_in *if_data; - struct ifreq if_info; - int err=0; - mm_segment_t fs; - netdevice_t *dev=lip_dev->common.dev; - - /* Setup a structure for adding/removing routes */ - memset(&if_info, 0, sizeof(if_info)); - strcpy(if_info.ifr_name, dev->name); - - if_data = (struct sockaddr_in *)&if_info.ifr_addr; - if_data->sin_addr.s_addr = local; - if_data->sin_family = AF_INET; - - fs = get_fs(); /* Save file system */ - set_fs(get_ds()); - err = wp_devinet_ioctl(SIOCSIFADDR, &if_info); - set_fs(fs); - - memset(&if_info, 0, sizeof(if_info)); - strcpy(if_info.ifr_name, dev->name); - - if_data = (struct sockaddr_in *)&if_info.ifr_dstaddr; - if_data->sin_addr.s_addr = remote; - if_data->sin_family = AF_INET; - - fs = get_fs(); /* Save file system */ - set_fs(get_ds()); - err = wp_devinet_ioctl(SIOCSIFDSTADDR, &if_info); - set_fs(fs); - - return 0; -#else - netdevice_t *ifp = NULL; - struct ifaddr *ifa = NULL; - struct sockaddr_in *si = NULL; - - ifp = lip_dev->common.dev; - for (ifa = WAN_TAILQ_FIRST(ifp); ifa; ifa = WAN_TAILQ_NEXT(ifa)){ - if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET){ - si = (struct sockaddr_in *)ifa->ifa_addr; - if (si) break; - } - } - if (ifa && si){ - int error; -#if defined(__FreeBSD__) - struct in_ifaddr *ia; -#endif - -#if defined(__NetBSD__) && (__NetBSD_Version__ >= 103080000) - struct sockaddr_in new_sin = *si; - - new_sin.sin_addr.s_addr = htonl(src); - error = in_ifinit(ifp, ifatoia(ifa), &new_sin, 1); -#else - /* delete old route */ - error = rtinit(ifa, (int)RTM_DELETE, RTF_HOST); - - /* set new address */ - si->sin_addr.s_addr = local; -#if defined(__FreeBSD__) - ia = ifatoia(ifa); - LIST_REMOVE(ia, ia_hash); - LIST_INSERT_HEAD(INADDR_HASH(si->sin_addr.s_addr), ia, ia_hash); -#endif -#if 0 - /* Local IP address */ - si = (struct sockaddr_in*)ifa->ifa_addr; - if (si){ - /* write new local IP address */ - si->sin_addr.s_addr = local; - } -#endif - /* Remote IP address */ - si = (struct sockaddr_in*)ifa->ifa_dstaddr; - if (si){ - /* write new remote IP address */ - si->sin_addr.s_addr = remote; - } - /* Netmask */ - si = (struct sockaddr_in*)ifa->ifa_netmask; - if (si){ - /* write new remote IP address */ - si->sin_addr.s_addr = htonl(0xFFFFFFFC); - } - - /* add new route */ - error = rtinit(ifa, (int)RTM_ADD, RTF_HOST); -#endif - } - return 0; -#endif -} - -void wplip_add_gateway(void *wplip_id) -{ - -#if 0 - wplip_dev_t *lip_dev = (wplip_dev_t *)wplip_id; -#endif - return; -} - - -int wplip_set_hw_idle_frame (void *liplink_ptr, unsigned char *data, int len) -{ - - wplip_link_t *lip_link = (wplip_link_t *)liplink_ptr; - - if (!lip_link){ - DEBUG_EVENT("%s: Assertion error lip_dev=NULL!\n", - __FUNCTION__); - return 1; - } - - DEBUG_EVENT("%s: Warning: %s Not supported!\n", - lip_link->name,__FUNCTION__); - - return 0; -} - - -/*************************************************************** - * Private Device Functions - */ - -#ifdef __LINUX__ -static int wplip_change_dev_flags (netdevice_t *dev, unsigned flags) -{ - struct ifreq if_info; - mm_segment_t fs = get_fs(); - int err; - - memset(&if_info, 0, sizeof(if_info)); - strcpy(if_info.ifr_name, dev->name); - if_info.ifr_flags = flags; - - set_fs(get_ds()); /* get user space block */ - err = wp_devinet_ioctl(SIOCSIFFLAGS, &if_info); - set_fs(fs); - - return err; -} -#endif - - -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -static void wplip_if_task (void *arg, int dummy) -#else -# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -static void wplip_if_task (void *arg) -# else -static void wplip_if_task (struct work_struct *work) -# endif -#endif -{ -#if defined(__LINUX__) - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) - wplip_dev_t *lip_dev=(wplip_dev_t *)container_of(work, wplip_dev_t, if_task); -#else - wplip_dev_t *lip_dev=(wplip_dev_t *)arg; -#endif - wplip_link_t *lip_link; - netdevice_t *dev; - - if (!lip_dev || !lip_dev->common.dev){ - return; - } - - if (wan_test_bit(WPLIP_DEV_UNREGISTER,&lip_dev->critical)){ - return; - } - - if (!wan_test_bit(DYN_OPT_ON,&lip_dev->interface_down) || - !wan_test_bit(WAN_DEV_READY,&lip_dev->interface_down)){ - return; - } - - DEBUG_TEST("%s:%d: Device %s\n",__FUNCTION__,__LINE__,lip_dev->name); - - lip_link = lip_dev->lip_link; - dev=lip_dev->common.dev; - - switch (lip_dev->common.state){ - - case WAN_DISCONNECTED: - - /* If the dynamic interface configuration is on, and interface - * is up, then bring down the netowrk interface */ - - if (wan_test_bit(DYN_OPT_ON,&lip_dev->interface_down) && - !wan_test_bit(DEV_DOWN, &lip_dev->interface_down) && - dev->flags & IFF_UP){ - - DEBUG_EVENT("%s: Interface %s down.\n", - lip_link->name,dev->name); - wplip_change_dev_flags(dev,(dev->flags&~IFF_UP)); - wan_set_bit(DEV_DOWN,&lip_dev->interface_down); - - } - - break; - - case WAN_CONNECTED: - - /* In SMP machine this code can execute before the interface - * comes up. In this case, we must make sure that we do not - * try to bring up the interface before dev_open() is finished */ - - - /* DEV_DOWN will be set only when we bring down the interface - * for the very first time. This way we know that it was us - * that brought the interface down */ - - if (wan_test_bit(DYN_OPT_ON,&lip_dev->interface_down) && - wan_test_bit(DEV_DOWN, &lip_dev->interface_down) && - !(dev->flags & IFF_UP)){ - - DEBUG_EVENT("%s: Interface %s up.\n", - lip_link->name,dev->name); - wplip_change_dev_flags(dev,(dev->flags|IFF_UP)); - wan_clear_bit(DEV_DOWN,&lip_dev->interface_down); - } - - break; - } - -#endif - -} - -void wplip_trigger_if_task(wplip_dev_t *lip_dev) -{ - - if (wan_test_bit(WPLIP_DEV_UNREGISTER,&lip_dev->critical)){ - return; - } - - if (wan_test_bit(DYN_OPT_ON,&lip_dev->interface_down) && - wan_test_bit(WAN_DEV_READY,&lip_dev->interface_down)){ - WAN_TASKQ_SCHEDULE((&lip_dev->if_task)); - } - - return; -} - -/*************************************************************** - * Module Interface Functions - * - */ - -/*============================================================== - * wanpipe_lip_init - * - * Description: - * This function is called on module startup. - * (ex: modprobe wanpipe_lip) - * - * Register the lip callback functions to the - * wanmain which are used by the socket or - * upper layer. - */ - - -static unsigned char wplip_fullname[]="WANPIPE(tm) L.I.P Network Layer"; -static unsigned char wplip_copyright[]="(c) 1995-2004 Sangoma Technologies Inc."; - -int wanpipe_lip_init(void*); -int wanpipe_lip_exit(void*); - -int wanpipe_lip_init(void *arg) -{ - wplip_reg_t reg; - int err; - - if (WANPIPE_VERSION_BETA){ - DEBUG_EVENT("%s Beta %s.%s %s\n", - wplip_fullname, WANPIPE_VERSION, WANPIPE_SUB_VERSION,wplip_copyright); - }else{ - DEBUG_EVENT("%s Stable %s.%s %s\n", - wplip_fullname, WANPIPE_VERSION, WANPIPE_SUB_VERSION, wplip_copyright); - } - - err=wplip_init_prot(); - if (err){ - wplip_free_prot(); - return err; - } - - wplip_link_lock=RW_LOCK_UNLOCKED; - - memset(®,0,sizeof(wplip_reg_t)); - - reg.wplip_bind_link = wplip_bind_link; - reg.wplip_unbind_link = wplip_unbind_link; - - reg.wplip_if_reg = wplip_if_reg; - reg.wplip_if_unreg = wplip_if_unreg; - - reg.wplip_disconnect = wplip_disconnect; - reg.wplip_connect = wplip_connect; - - reg.wplip_rx = wplip_rx; - reg.wplip_kick = wplip_kick; - - reg.wplip_register = wplip_register; - reg.wplip_unreg = wplip_unreg; - - reg.wplip_get_if_status = wplip_get_if_status; - - register_wanpipe_lip_protocol(®); - - memset(&wplip_link_num,0,sizeof(wplip_link_num)); - - return 0; -} - -int wanpipe_lip_exit (void *arg) -{ - if (!WAN_LIST_EMPTY(&list_head_link)){ - DEBUG_EVENT("%s: Major error: List not empty!\n",__FUNCTION__); - } - - unregister_wanpipe_lip_protocol(); - wplip_free_prot(); - - DEBUG_EVENT("WANPIPE L.I.P: Unloaded\n"); - return 0; -} - -#if 0 -MODULE_AUTHOR("Nenad Corbic "); -MODULE_DESCRIPTION("Wanpipe L.I.P Network Layer - Sangoma Tech. Copyright 2004"); -MODULE_LICENSE("GPL"); -module_init(wanpipe_lip_init); -module_exit(wanpipe_lip_exit); -#endif - -WAN_MODULE_DEFINE( - wanpipe_lip,"wanpipe_lip", - "Nenad Corbic ", - "Wanpipe L.I.P Network Layer - Sangoma Tech. Copyright 2004", - "GPL", - wanpipe_lip_init, wanpipe_lip_exit, NULL); -WAN_MODULE_DEPEND(wanpipe_lip, wanrouter, 1, - WANROUTER_MAJOR_VER, WANROUTER_MAJOR_VER); -WAN_MODULE_DEPEND(wanpipe_lip, wanpipe, 1, - WANPIPE_MAJOR_VER, WANPIPE_MAJOR_VER); - diff --git a/patches/kdrivers/src/lip/wanpipe_lip_netdev.c b/patches/kdrivers/src/lip/wanpipe_lip_netdev.c index 7ed8cb8..57f09b5 100644 --- a/patches/kdrivers/src/lip/wanpipe_lip_netdev.c +++ b/patches/kdrivers/src/lip/wanpipe_lip_netdev.c @@ -29,10 +29,6 @@ int wplip_if_output (netdevice_t* dev,netskb_t* skb,struct sockaddr* sa, struct char* get_master_dev_name(wplip_link_t *lip_link); -#ifdef __LINUX__ -static int wplip_change_mtu(netdevice_t *dev, int new_mtu); -#endif - /*============================================================== * wplip_open_dev * @@ -59,23 +55,18 @@ int wplip_open_dev(netdevice_t *dev) if (!lip_dev || !lip_dev->lip_link){ return -ENODEV; } - + if (wan_test_bit(WPLIP_DEV_UNREGISTER,&lip_dev->critical)) { return -ENODEV; } #if defined(__LINUX__) - # if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18) if (netif_running(dev)) return -EBUSY; # endif - - /* Updated the lower level MTU based on the interface MTU */ - wplip_change_mtu(lip_dev->common.dev, dev->mtu); #endif - wan_clear_bit(0,&lip_dev->if_down); #if 0 @@ -87,7 +78,7 @@ int wplip_open_dev(netdevice_t *dev) } #endif -#if defined(WANPIPE_LIP_IFNET_QUEUE_POLICY_INIT_OFF) +#if defined(WANPIPE_IFNET_QUEUE_POLICY_INIT_OFF) if (lip_dev->lip_link->state == WAN_CONNECTED){ WAN_NETIF_CARRIER_ON(dev); WAN_NETIF_WAKE_QUEUE(dev); @@ -100,7 +91,8 @@ int wplip_open_dev(netdevice_t *dev) #endif /* Its possible for state update to be skipped if interface was down */ - wplip_lipdev_prot_update_state_change(lip_dev,NULL,0); + wplip_lipdev_prot_update_state_change(lip_dev,NULL,0); + if (!wan_test_bit(WAN_DEV_READY,&lip_dev->interface_down)) { wan_set_bit(WAN_DEV_READY,&lip_dev->interface_down); @@ -135,8 +127,6 @@ int wplip_stop_dev(netdevice_t *dev) return 0; } - wan_set_bit(0,&lip_dev->if_down); - #ifdef WPLIP_TTY_SUPPORT if (lip_dev->lip_link->tty_opt && lip_dev->lip_link->tty_open){ tty_hangup(lip_dev->lip_link->tty); @@ -144,6 +134,8 @@ int wplip_stop_dev(netdevice_t *dev) } #endif + wan_set_bit(0,&lip_dev->if_down); + #if 0 /* Done in if register now, do it interface up down * feature on 2.4 kernels */ @@ -154,7 +146,7 @@ int wplip_stop_dev(netdevice_t *dev) } - +#if defined(__LINUX__) /*============================================================== * wplip_ifstats * @@ -176,12 +168,12 @@ struct net_device_stats* wplip_ifstats (netdevice_t *dev) wan_netif_name(dev),__FUNCTION__); if (lip_dev){ - return &lip_dev->ifstats; + return &lip_dev->common.if_stats; } return &gstats; } - +#endif /*============================================================== @@ -224,7 +216,6 @@ int wplip_if_output (netdevice_t* dev,netskb_t* skb,struct sockaddr* sa, struct return 1; } - #if 1 if (lip_dev->common.state != WAN_CONNECTED){ #else @@ -232,18 +223,18 @@ int wplip_if_output (netdevice_t* dev,netskb_t* skb,struct sockaddr* sa, struct lip_dev->common.state != WAN_CONNECTED){ #endif -#if defined(WANPIPE_LIP_IFNET_QUEUE_POLICY_INIT_OFF) +#if defined(WANPIPE_IFNET_QUEUE_POLICY_INIT_OFF) /* This causes a buffer starvations on some * applications like OSPF, since packets are * trapped in the Interface TX queue */ WAN_NETIF_STOP_QUEUE(dev); wan_netif_set_ticks(dev, SYSTEM_TICKS); - ++lip_dev->ifstats.tx_carrier_errors; + WAN_NETIF_STATS_INC_TX_CARRIER_ERRORS(&lip_dev->common); //++lip_dev->ifstats.tx_carrier_errors; return 1; #else wan_skb_free(skb); - lip_dev->ifstats.tx_carrier_errors++; + WAN_NETIF_STATS_INC_TX_CARRIER_ERRORS(&lip_dev->common); //lip_dev->ifstats.tx_carrier_errors++; WAN_NETIF_START_QUEUE(dev); wan_netif_set_ticks(dev, SYSTEM_TICKS); return 0; @@ -264,7 +255,7 @@ int wplip_if_output (netdevice_t* dev,netskb_t* skb,struct sockaddr* sa, struct if (lip_dev->common.usedby == API){ if (wan_skb_len(skb) <= sizeof(wan_api_tx_hdr_t)){ wan_skb_free(skb); - lip_dev->ifstats.tx_errors++; + WAN_NETIF_STATS_INC_TX_ERRORS(&lip_dev->common); //lip_dev->ifstats.tx_errors++; WAN_NETIF_START_QUEUE(dev); wan_netif_set_ticks(dev, SYSTEM_TICKS); return 0; @@ -300,7 +291,7 @@ int wplip_if_output (netdevice_t* dev,netskb_t* skb,struct sockaddr* sa, struct default: /* Packet dropped due to error */ WAN_NETIF_START_QUEUE(dev); - lip_dev->ifstats.tx_errors++; + WAN_NETIF_STATS_INC_TX_ERRORS(&lip_dev->common); //lip_dev->ifstats.tx_errors++; wan_netif_set_ticks(dev, SYSTEM_TICKS); wan_skb_free(skb); err=0; @@ -332,55 +323,6 @@ int wplip_if_output (netdevice_t* dev,netskb_t* skb,struct sockaddr* sa, struct } #if defined(__LINUX__) - -static int wplip_change_mtu(netdevice_t *dev, int new_mtu) -{ - wplip_dev_t *lip_dev = (wplip_dev_t *)wan_netif_priv(dev); - wplip_link_t *lip_link = lip_dev->lip_link; - netdevice_t *hw_dev; - wplip_dev_list_t *lip_dev_list_el; - int err = 0; - - if (!lip_link->tx_dev_cnt){ - DEBUG_EVENT("%s: %s: Tx Dev not available\n", - __FUNCTION__,lip_link->name); - return -ENODEV; - } - - /* FIXME: - * For now, we can only transmit on a FIRST Tx device */ - lip_dev_list_el=WAN_LIST_FIRST(&lip_link->list_head_tx_ifdev); - if (!lip_dev_list_el){ - DEBUG_EVENT("%s: %s: Tx Dev List empty!\n", - __FUNCTION__,lip_link->name); - return -ENODEV; - } - - if (lip_dev_list_el->magic != WPLIP_MAGIC_DEV_EL){ - DEBUG_EVENT("%s: %s: Error: Invalid dev magic number!\n", - __FUNCTION__,lip_link->name); - return -EFAULT; - } - - hw_dev=lip_dev_list_el->dev; - if (!hw_dev){ - DEBUG_EVENT("%s: %s: Error: No dev! dropping...\n", - __FUNCTION__,lip_link->name); - return -ENODEV; - } - - if (hw_dev->change_mtu) { - err = hw_dev->change_mtu(hw_dev,new_mtu); - } - - if (err == 0) { - dev->mtu = new_mtu; - } - - return err; -} - - static void wplip_tx_timeout (netdevice_t *dev) { wplip_dev_t *lip_dev = (wplip_dev_t *)wan_netif_priv(dev); @@ -408,7 +350,8 @@ static void wplip_tx_timeout (netdevice_t *dev) } #endif -static int wplip_ioctl (netdevice_t *dev, struct ifreq *ifr, int cmd) +static int +wplip_ioctl (netdevice_t *dev, struct ifreq *ifr, wan_ioctl_cmd_t cmd) { wplip_dev_t *lip_dev= wplip_get_lipdev(dev); @@ -438,15 +381,6 @@ static int wplip_ioctl (netdevice_t *dev, struct ifreq *ifr, int cmd) err= -EINVAL; break; } - - if (!WAN_NETIF_UP(dev)){ - return -ENETDOWN; - } - - if (wan_test_bit(WPLIP_DEV_UNREGISTER,&lip_dev->critical) || - wan_test_bit(0,&lip_dev->if_down)) { - return -ENETDOWN; - } wan_spin_lock_irq(&lip_link->bh_lock,&flags); @@ -651,8 +585,6 @@ int wplip_if_init(netdevice_t *dev) lip_dev->common.iface.ioctl = &wplip_ioctl; lip_dev->common.iface.tx_timeout= &wplip_tx_timeout; lip_dev->common.iface.get_stats = &wplip_ifstats; - lip_dev->common.iface.get_stats = &wplip_ifstats; - lip_dev->common.iface.change_mtu = &wplip_change_mtu; return 0; #else diff --git a/patches/kdrivers/src/lip/wanpipe_lip_netdev.c~ b/patches/kdrivers/src/lip/wanpipe_lip_netdev.c~ deleted file mode 100644 index a47a1c9..0000000 --- a/patches/kdrivers/src/lip/wanpipe_lip_netdev.c~ +++ /dev/null @@ -1,612 +0,0 @@ -/************************************************************* - * wanpipe_lip_netdev.c WANPIPE Link Interface Protocol Layer (LIP) - * - * - * - * =========================================================== - * - * Mar 30 2004 Nenad Corbic Initial Driver - */ - - -/*============================================================= - * Includes - */ - -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -# include -#else -# include -#endif - - -/*============================================================= - * Definitions - */ -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) -int wplip_if_output (netdevice_t* dev,netskb_t* skb,struct sockaddr* sa, struct rtentry* rt); -#endif - -char* get_master_dev_name(wplip_link_t *lip_link); - -/*============================================================== - * wplip_open_dev - * - * Description: - * This function enables the svc network device, and - * sets it up for data transfer. - * - * It is called by the kernel during interfaces - * startup via ifconfig: - * ex: ifconfig wp1_svc up - * - * If the network device contains IP data, its - * operation mode is set to TCP/IP otherwise, - * the opteration mode is API. - * - * Usedby: - * Kernel during ifconfig system call. - */ - -int wplip_open_dev(netdevice_t *dev) -{ - wplip_dev_t *lip_dev = (wplip_dev_t *)wan_netif_priv(dev); - - if (!lip_dev || !lip_dev->lip_link){ - return -ENODEV; - } - -#if defined(__LINUX__) -# if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18) - if (netif_running(dev)) - return -EBUSY; -# endif -#endif - - -#if 0 - /* Done in if register now, do it interface up down - * feature on 2.4 kernels */ - err=wplip_open_lipdev_prot(lip_dev); - if (err){ - return err; - } -#endif - -#if defined(WANPIPE_LIP_IFNET_QUEUE_POLICY_INIT_OFF) - if (lip_dev->lip_link->state == WAN_CONNECTED){ - WAN_NETIF_CARRIER_ON(dev); - WAN_NETIF_WAKE_QUEUE(dev); - } -#else - if (lip_dev->lip_link->state == WAN_CONNECTED){ - WAN_NETIF_CARRIER_ON(dev); - } - WAN_NETIF_WAKE_QUEUE(dev); -#endif - - if (!wan_test_bit(WAN_DEV_READY,&lip_dev->interface_down)) { - wan_set_bit(WAN_DEV_READY,&lip_dev->interface_down); - wplip_trigger_if_task(lip_dev); - } - return 0; -} - -/*============================================================== - * wplip_stop_dev - * - * Description: - * This function disables the svc network device. - * - * It is called by the kernel during interfaces - * shutdown via ifconfig: - * ex: ifconfig wp1_svc down - * - * If the svc is in connected state, the call - * will be disconnected. - * - * Usedby: - * Kernel during ifconfig system call. - */ - -int wplip_stop_dev(netdevice_t *dev) -{ - - wplip_dev_t *lip_dev = (wplip_dev_t *)wan_netif_priv(dev); - - if (!lip_dev || !lip_dev->lip_link){ - return 0; - } - -#ifdef WPLIP_TTY_SUPPORT - if (lip_dev->lip_link->tty_opt && lip_dev->lip_link->tty_open){ - tty_hangup(lip_dev->lip_link->tty); - return -EBUSY; - } -#endif - -#if 0 - /* Done in if register now, do it interface up down - * feature on 2.4 kernels */ - wplip_close_lipdev_prot(lip_dev); -#endif - - return 0; -} - - - -/*============================================================== - * wplip_ifstats - * - * Description: - * This fucntion interfaces the /proc file system - * to the svc device. The svc keeps protocol and - * packet statistcs. This function passes these - * statistics to the /proc file system. - * - * Usedby: - * Kernel /proc/net/dev file system - */ -static struct net_device_stats gstats; -struct net_device_stats* wplip_ifstats (netdevice_t *dev) -{ - wplip_dev_t *lip_dev = (wplip_dev_t *)wan_netif_priv(dev); - - DEBUG_TEST("%s: LIP %s()\n", - wan_netif_name(dev),__FUNCTION__); - - if (lip_dev){ - return &lip_dev->ifstats; - } - - return &gstats; -} - - - -/*============================================================== - * wplip_if_send - * - * Description: - * Call back function used by the kernel or the - * upper protocol layer to transmit data for each - * svc withing the x25 link. - * - * Data can only be tranmsitted if the svc state - * is connected. - * - * If state != CONNECTED && If svc mode=TCP/IP - * place an x25 call and try to establish - * connection. - * - * If state != CONNECTED && If svc mode=API - * refuse the packet, and indicate to - * the upper layer that the connection has - * not been made. - * - * - * Usedby: - * Kernel TCP/IP stack or upper layers to transmit data. - */ - -#if defined(__LINUX__) -int wplip_if_send (netskb_t* skb, netdevice_t* dev) -#else -int wplip_if_output (netdevice_t* dev,netskb_t* skb,struct sockaddr* sa, struct rtentry* rt) -#endif -{ - wplip_dev_t *lip_dev =wplip_get_lipdev(dev); - wan_api_tx_hdr_t *api_tx_hdr =NULL; - int err, type; - - if (!lip_dev || !lip_dev->lip_link){ - WAN_NETIF_STOP_QUEUE(dev); - return 1; - } - - -#if 1 - if (lip_dev->common.state != WAN_CONNECTED){ -#else - if (lip_dev->lip_link->carrier_state != WAN_CONNECTED || - lip_dev->common.state != WAN_CONNECTED){ -#endif - -#if defined(WANPIPE_LIP_IFNET_QUEUE_POLICY_INIT_OFF) - /* This causes a buffer starvations on some - * applications like OSPF, since packets are - * trapped in the Interface TX queue */ - - WAN_NETIF_STOP_QUEUE(dev); - wan_netif_set_ticks(dev, SYSTEM_TICKS); - ++lip_dev->ifstats.tx_carrier_errors; - return 1; -#else - wan_skb_free(skb); - lip_dev->ifstats.tx_carrier_errors++; - WAN_NETIF_START_QUEUE(dev); - wan_netif_set_ticks(dev, SYSTEM_TICKS); - return 0; -#endif - } - - /*if (wan_skb_check(skb)){ - ** if (wan_skb2buffer((void**)&skb)){ - ** wan_skb_free(skb); - ** lip_dev->ifstats.tx_errors++; - ** WAN_NETIF_START_QUEUE(dev); - ** wan_netif_set_ticks(dev, SYSTEM_TICKS); - ** return 0; - ** - ** } - **} */ - - if (lip_dev->common.usedby == API){ - if (wan_skb_len(skb) <= sizeof(wan_api_tx_hdr_t)){ - wan_skb_free(skb); - lip_dev->ifstats.tx_errors++; - WAN_NETIF_START_QUEUE(dev); - wan_netif_set_ticks(dev, SYSTEM_TICKS); - return 0; - } - api_tx_hdr=(wan_api_tx_hdr_t*)wan_skb_pull(skb,sizeof(wan_api_tx_hdr_t)); - - type = WPLIP_RAW; - }else{ -#if defined(__LINUX__) - type = wplip_decode_protocol(lip_dev,skb); -#else - type = wplip_decode_protocol(lip_dev,sa); -#endif - } - - - err=wplip_prot_tx(lip_dev, api_tx_hdr, skb, type); - switch (err){ - - case 0: - /* Packet queued ok */ - wan_netif_set_ticks(dev, SYSTEM_TICKS); - WAN_NETIF_START_QUEUE(dev); - err=0; - break; - - case 1: - /* Packet failed to queue layer busy */ -#warning "NENAD" - DEBUG_EVENT("%s: Api Dev BUSY!\n",lip_dev->name); - WAN_NETIF_STOP_QUEUE(dev); - err=1; - break; - - default: - /* Packet dropped due to error */ - WAN_NETIF_START_QUEUE(dev); - lip_dev->ifstats.tx_errors++; - wan_netif_set_ticks(dev, SYSTEM_TICKS); - wan_skb_free(skb); - err=0; - break; - } - - wplip_trigger_bh(lip_dev->lip_link); - -#if defined(__LINUX__) - if (lip_dev->protocol != WANCONFIG_LIP_ATM) { - if (dev->tx_queue_len < lip_dev->max_mtu_sz && - dev->tx_queue_len > 0) { - DEBUG_EVENT("%s: Resizing Tx Queue Len to %li\n", - lip_dev->name,dev->tx_queue_len); - lip_dev->max_mtu_sz = dev->tx_queue_len; - wplip_lipdev_latency_change(lip_dev->lip_link); - - } else if (dev->tx_queue_len > lip_dev->max_mtu_sz && - lip_dev->max_mtu_sz != lip_dev->max_mtu_sz_orig) { - DEBUG_EVENT("%s: Resizing Tx Queue Len to %i\n", - lip_dev->name,lip_dev->max_mtu_sz_orig); - lip_dev->max_mtu_sz = lip_dev->max_mtu_sz_orig; - wplip_lipdev_latency_change(lip_dev->lip_link); - } - } -#endif - - return err; -} - -#if defined(__LINUX__) -static void wplip_tx_timeout (netdevice_t *dev) -{ - wplip_dev_t *lip_dev = (wplip_dev_t *)wan_netif_priv(dev); - wplip_link_t *lip_link = lip_dev->lip_link; - - /* If our device stays busy for at least 5 seconds then we will - * kick start the device by making dev->tbusy = 0. We expect - * that our device never stays busy more than 5 seconds. So this - * is only used as a last resort. - */ - -#if 0 - gdbg_flag=1; -#endif - wan_clear_bit(WPLIP_BH_AWAITING_KICK,&lip_link->tq_working); - wplip_kick_trigger_bh(lip_link); - - WAN_NETIF_WAKE_QUEUE (dev); - - if (lip_dev->common.usedby == API){ - wan_update_api_state(lip_dev); - } - - wan_netif_set_ticks(dev, SYSTEM_TICKS); -} -#endif - -static int wplip_ioctl (netdevice_t *dev, struct ifreq *ifr, int cmd) -{ - - wplip_dev_t *lip_dev= wplip_get_lipdev(dev); - wplip_link_t *lip_link; - wan_smp_flag_t flags; - int err=0; - wan_udp_pkt_t *wan_udp_pkt; - - if (!lip_dev || !lip_dev->lip_link){ - DEBUG_EVENT("%s:%d: Assertion Error on lip_dev (%s)!\n", - __FUNCTION__,__LINE__, wan_netif_name(dev)); - return -EINVAL; - } - - lip_link = lip_dev->lip_link; - if (lip_link == NULL){ - DEBUG_EVENT("%s:%d: Assertion Error on lip_dev (%s)!\n", - __FUNCTION__,__LINE__, wan_netif_name(dev)); - return -EINVAL; - } - - switch (cmd){ - -#if defined(__LINUX__) - case SIOC_WANPIPE_BIND_SK: - if (ifr == NULL){ - err= -EINVAL; - break; - } - - wan_spin_lock_irq(&lip_link->bh_lock,&flags); - - if (lip_dev->common.usedby == API){ - dev->watchdog_timeo=HZ*60; - } - - err=wan_bind_api_to_svc(lip_dev,ifr->ifr_data); - wan_spin_unlock_irq(&lip_link->bh_lock,&flags); - break; - - case SIOC_WANPIPE_UNBIND_SK: - if (ifr == NULL){ - err= -EINVAL; - break; - } - - wan_spin_lock_irq(&lip_link->bh_lock,&flags); - err=wan_unbind_api_from_svc(lip_dev,ifr->ifr_data); - if (lip_dev->common.usedby == API && - lip_dev->protocol == WANCONFIG_XDLC){ - wplip_close_lipdev_prot(lip_dev); - } - wan_spin_unlock_irq(&lip_link->bh_lock,&flags); - break; - - case SIOC_WANPIPE_CHECK_TX: - case SIOC_ANNEXG_CHECK_TX: - err=0; - break; - - case SIOC_WANPIPE_DEV_STATE: - err = lip_dev->common.state; - break; - - case SIOC_ANNEXG_KICK: - break; -#endif - - case SIOC_WANPIPE_PIPEMON: - - wan_spin_lock_irq(&lip_link->bh_lock,&flags); - if (lip_dev->udp_pkt_len != 0){ - wan_spin_unlock_irq(&lip_link->bh_lock,&flags); - return -EBUSY; - } - lip_dev->udp_pkt_len = sizeof(wan_udp_hdr_t); - wan_spin_unlock_irq(&lip_link->bh_lock,&flags); - - wan_udp_pkt=(wan_udp_pkt_t*)&lip_dev->udp_pkt_data; - if (WAN_COPY_FROM_USER(&wan_udp_pkt->wan_udp_hdr,ifr->ifr_data,sizeof(wan_udp_hdr_t))){ - lip_dev->udp_pkt_len=0; - return -EFAULT; - } - - wan_spin_lock_irq(&lip_link->bh_lock,&flags); - - if(wan_udp_pkt->wan_udp_command == WAN_GET_MASTER_DEV_NAME){ - char* master_dev_name; - - master_dev_name = get_master_dev_name(lip_link); - if(master_dev_name == NULL){ - - wan_udp_pkt->wan_udp_return_code = 1; - wan_udp_pkt->wan_udp_data_len = 1; - }else{ - strncpy(&wan_udp_pkt->wan_udp_data[0], - master_dev_name, - strlen(master_dev_name)); - wan_udp_pkt->wan_udp_return_code = 0; - wan_udp_pkt->wan_udp_data_len = strlen(master_dev_name); - } - }else{ - if (wplip_prot_udp_mgmt_pkt(lip_dev,wan_udp_pkt) <= 0){ - lip_dev->udp_pkt_len=0; - wan_spin_unlock_irq(&lip_link->bh_lock,&flags); - return -EINVAL; - } - } - - if (lip_dev->udp_pkt_len > sizeof(wan_udp_pkt_t)){ - DEBUG_EVENT("%s: Error: Pipemon buf too bit on the way up! %i\n", - lip_dev->name,lip_dev->udp_pkt_len); - lip_dev->udp_pkt_len=0; - wan_spin_unlock_irq(&lip_link->bh_lock,&flags); - return -EINVAL; - } - - wan_spin_unlock_irq(&lip_link->bh_lock,&flags); - - /* This area will still be critical to other - * PIPEMON commands due to udp_pkt_len - * thus we can release the irq */ - - if (WAN_COPY_TO_USER(ifr->ifr_data,&wan_udp_pkt->wan_udp_hdr,sizeof(wan_udp_hdr_t))){ - lip_dev->udp_pkt_len=0; - return -EFAULT; - } - - lip_dev->udp_pkt_len=0; - return 0; - - case SIOC_WANPIPE_SNMP: - wplip_prot_udp_snmp_pkt(lip_dev,cmd,ifr); - return 0; - - case SIOC_WANPIPE_SNMP_IFSPEED: - DEBUG_EVENT("%s: SNMP Speed not supported on protocol interface!\n", - lip_dev->name); - return -1; - - default: - -#if defined(__LINUX__) - if (cmd >= SIOC_WANPIPE_DEVPRIVATE) - { - - wan_spin_lock_irq(&lip_link->bh_lock,&flags); - cmd-=SIOC_WANPIPE_DEVPRIVATE; - if (ifr == NULL){ - err=wplip_prot_ioctl(lip_dev,cmd,NULL); - }else{ - err=wplip_prot_ioctl(lip_dev,cmd,ifr->ifr_data); - } - wan_spin_unlock_irq(&lip_link->bh_lock,&flags); - - return err; - } -#endif - -# if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) - return 1; -#else - DEBUG_TEST("%s: Command %x not supported!\n", - lip_link->name,cmd); - return -EOPNOTSUPP; -#endif - } - - return err; - -} - -char* get_master_dev_name(wplip_link_t *lip_link) -{ - wplip_dev_list_t *lip_dev_list_el; - netdevice_t *dev; - - if (!lip_link->tx_dev_cnt){ - DEBUG_EVENT("%s: %s: Tx Dev List empty!\n", - __FUNCTION__,lip_link->name); - return NULL; - } - - lip_dev_list_el=WAN_LIST_FIRST(&lip_link->list_head_tx_ifdev); - if (!lip_dev_list_el){ - DEBUG_EVENT("%s: %s: Tx Dev List empty!\n", - __FUNCTION__,lip_link->name); - return NULL; - } - - if (lip_dev_list_el->magic != WPLIP_MAGIC_DEV_EL){ - DEBUG_EVENT("%s: %s: Error: Invalid dev magic number!\n", - __FUNCTION__,lip_link->name); - return NULL; - } - - dev=lip_dev_list_el->dev; - if (!dev){ - DEBUG_EVENT("%s: %s: Error: No dev!\n", - __FUNCTION__,lip_link->name); - return NULL; - } - - return wan_netif_name(dev); -} - -/*============================================================== - * wplip_if_init - * - * Description: - * During device registration, this function is - * called to fill in the call back functions - * used in nework device setup and operation. - * - * The kernel interfaces the driver, using the - * call back functions below. - * - * Usedby: - * Kernel during register_netdevice() in x25_register - * function. - */ -int wplip_if_init(netdevice_t *dev) -{ - wplip_dev_t* lip_dev= wplip_get_lipdev(dev); - -#if defined(__LINUX__) - lip_dev->common.is_netdev = 1; - lip_dev->common.iface.open = &wplip_open_dev; - lip_dev->common.iface.close = &wplip_stop_dev; - lip_dev->common.iface.send = &wplip_if_send; - lip_dev->common.iface.ioctl = &wplip_ioctl; - lip_dev->common.iface.tx_timeout= &wplip_tx_timeout; - lip_dev->common.iface.get_stats = &wplip_ifstats; - - return 0; -#else - DEBUG_EVENT("%s: Initialize network interface...\n", - wan_netif_name(dev)); - - lip_dev->common.is_netdev = 1; - lip_dev->common.iface.open = &wplip_open_dev; - lip_dev->common.iface.close = &wplip_stop_dev; - lip_dev->common.iface.output = &wplip_if_output; - lip_dev->common.iface.ioctl = &wplip_ioctl; - - dev->if_type = IFT_PPP; - dev->if_mtu = 1500; -#if 0 -/* Remove this later (wanpipe_bsd_iface.c doing this) */ - dev->if_output = NULL; - dev->if_start = &wplip_if_start; - dev->if_ioctl = NULL; /* &wplip_ioctl; */ - - /* Initialize media-specific parameters */ - dev->if_flags |= IFF_POINTOPOINT; - dev->if_flags |= IFF_NOARP; - - dev->if_mtu = 1500; - WAN_IFQ_SET_MAXLEN(&dev->if_snd, 100); - dev->if_snd.ifq_len = 0; - dev->if_type = IFT_PPP; -#endif - return 0; -#endif -} - - diff --git a/patches/kdrivers/src/lip/wanpipe_lip_prot.c b/patches/kdrivers/src/lip/wanpipe_lip_prot.c index 37cbebf..f72d2c5 100644 --- a/patches/kdrivers/src/lip/wanpipe_lip_prot.c +++ b/patches/kdrivers/src/lip/wanpipe_lip_prot.c @@ -140,7 +140,6 @@ int wplip_reg_lipdev_prot(wplip_dev_t *lip_dev, wanif_conf_t *conf) return -EINVAL; } - WPLIP_PROT_EXIST(lip_dev->protocol,-ENODEV); prot_iface=wplip_prot_ops[lip_dev->protocol]; diff --git a/patches/kdrivers/src/lip/wanpipe_lip_sub.c b/patches/kdrivers/src/lip/wanpipe_lip_sub.c index fccc73c..bd5d785 100644 --- a/patches/kdrivers/src/lip/wanpipe_lip_sub.c +++ b/patches/kdrivers/src/lip/wanpipe_lip_sub.c @@ -60,7 +60,7 @@ wplip_link_t *wplip_create_link(char *devname) wan_skb_queue_init(&lip_link->tx_queue); wan_skb_queue_init(&lip_link->rx_queue); - wan_spin_lock_init(&lip_link->bh_lock); + wan_spin_lock_irq_init(&lip_link->bh_lock, "wan_lip_bh_lock"); wan_atomic_set(&lip_link->refcnt,0); diff --git a/patches/kdrivers/src/lip/wanpipe_lip_tty.c b/patches/kdrivers/src/lip/wanpipe_lip_tty.c index 2ab095a..52b8897 100644 --- a/patches/kdrivers/src/lip/wanpipe_lip_tty.c +++ b/patches/kdrivers/src/lip/wanpipe_lip_tty.c @@ -303,7 +303,7 @@ void wplip_tty_receive(wplip_link_t *lip_link, void *skb) if (WAN_NET_RATELIMIT()){ DEBUG_EVENT( "%s: Received packet size too big: %d bytes, Max: %d!\n", - lip_link->name,wan_skb_len(skb),TTY_MAX_MTU); + lip_link->name,wan_skb_len(skb),TTY_FLIPBUF_SIZE); } wan_skb_free(skb); return; diff --git a/patches/kdrivers/src/net/Makefile b/patches/kdrivers/src/net/Makefile index 9730673..d13010c 100644 --- a/patches/kdrivers/src/net/Makefile +++ b/patches/kdrivers/src/net/Makefile @@ -17,33 +17,31 @@ CONFIG_WANPIPE_MULTPPP=n EXTRA_CFLAGS=$(EXTRA_FLAGS) -PRODUCT_DEFINES= -DCONFIG_PRODUCT_WANPIPE_BASE -DCONFIG_PRODUCT_WANPIPE_AFT +PRODUCT_DEFINES= -DCONFIG_PRODUCT_WANPIPE_BASE -DCONFIG_PRODUCT_WANPIPE_AFT -DCONFIG_PRODUCT_WANPIPE_AFT_CORE PRODUCT_DEFINES+= -DCONFIG_PRODUCT_WANPIPE_AFT_TE1 -DCONFIG_PRODUCT_WANPIPE_AFT_TE3 -PRODUCT_DEFINES+= -DCONFIG_WANPIPE_HWEC -DCONFIG_PRODUCT_WANPIPE_SOCK_DATASCOPE +PRODUCT_DEFINES+= -DCONFIG_WANPIPE_HWEC -DCONFIG_PRODUCT_WANPIPE_SOCK_DATASCOPE -DCONFIG_PRODUCT_WANPIPE_AFT_BRI -DCONFIG_PRODUCT_WANPIPE_AFT_SERIAL PRODUCT_DEFINES+= -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN -DCONFIG_PRODUCT_WANPIPE_CODEC_SLINEAR_LAW -PRODUCT_DEFINES+= -DCONFIG_PRODUCT_WANPIPE_MULTPROT wanpipe-y := sdlamain.o ifneq (,$(ZAPDIR)) PRODUCT_DEFINES += -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE -wanpipe-y += sdla_tdmv.o sdla_remora_tdmv.o +wanpipe-y += sdla_tdmv.o sdla_remora_tdmv.o sdla_bri_tdmv.o ifneq (,$(wildcard $(ZAPHDLC))) PRODUCT_DEFINES+= -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN_ZAPTEL endif endif - wanpipe-y += sdla_ft1.o sdla_te1.o sdla_te3.o sdla_56k.o sdla_8te1.o wanpipe-y += wanpipe_tdm_api.o wanpipe-y += sdla_xilinx.o sdla_aft_te1.o aft_a104.o wanpipe-y += aft_analog.o sdla_aft_te3.o wanpipe_utils.o wanpipe-y += wanpipe_abstr.o wanpipe_linux_iface.o wanpipe-y += wanpipe_tdm_api.o sdla_remora.o +wanpipe-y += sdla_bri.o aft_bri.o sdla_serial.o wanpipe-y += wanpipe_codec.o wanpipe_codec_law.o -wanpipe-y += wanpipe_multppp.o EXTRA_CFLAGS += $(PRODUCT_DEFINES) @@ -76,7 +74,7 @@ wanec-y += $(OCTAPIDIR)/oct6100_user.o wanec-objs := $(wanec-y) -sdladrv-objs := sdladrv_src.o sdladrv_fe.o +sdladrv-objs := sdladrv_src.o sdladrv_fe.o sdladrv_utils.o wanrouter-objs := ../wanrouter/wanmain.o ../wanrouter/wanproc.o ../wanrouter/waniface.o diff --git a/patches/kdrivers/src/net/Module.symvers b/patches/kdrivers/src/net/Module.symvers index a072c79..bf2445d 100644 --- a/patches/kdrivers/src/net/Module.symvers +++ b/patches/kdrivers/src/net/Module.symvers @@ -1,56 +1,56 @@ -0xf7567a8a wanpipe_api_buf_check /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0xf27fa082 wanpipe_lip_connect /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x9d773de8 sdla_register /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL -0xc0ef42f1 wp_sppp_input /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL -0x57e6ed60 wanpipe_api_sock_rx /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0xf0688524 wanrouter_proc_add_interface /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x59fb2682 sdla_hw_probe /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL -0x9a7a6658 wanpipe_lip_rx /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x8f31cdeb proc_router /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x94be524d register_wanec_iface /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x1036a1ab bind_api_listen_to_protocol /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x524e2f20 register_wanpipe_fw_protocol /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x9ce78a9e register_wan_device /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x84824c8d wanrouter_proc_add_protocol /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x90a9f616 wp_sppp_detach /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL -0xc9b2c3fb wp_sppp_attach /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL -0x56712648 wanpipe_ec_event_ctrl /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x7cd3c2bc wanpipe_ec_poll /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0xd23480a3 wanrouter_proc_delete_protocol /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0xdfd0f6c6 sdla_get_hw_adptr_cnt /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL -0x10723cdb wanpipe_ec_register /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x1e82f485 wp_sppp_change_mtu /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL -0x02364d27 wanrouter_encapsulate /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x136b2537 wan_skb_destructor /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0xfa083e32 register_wanpipe_api_socket /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0xade2d0d7 sdla_get_hw_probe /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL -0xef48df91 proc_add_line /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x22a2999f sdla_unregister /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL -0x85c05713 wanrouter_type_trans /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0xfd74fadb wan_set_ip_address /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0xc98aebe6 wan_get_ip_address /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x7d68ed07 protocol_disconnected /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0xc5224c15 bind_api_to_protocol /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x38eb6851 unregister_wanpipe_api_socket /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0xaac011d2 wanpipe_lip_kick /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x3b604364 unbind_api_listen_from_protocol /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x6df6c4e0 wan_run_wanrouter /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0xeb418feb sdla_hw_bridge_probe /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL -0x04df932b unregister_wanec_iface /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x19823ac0 wanpipe_ec_isr /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x13405f6b unregister_wanpipe_fw_protocol /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0xe72f44cb wanpipe_api_listen_rx /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0xe6bc2d6d wp_sppp_open /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL -0x238f240b wp_sppp_reopen /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL -0x72ddd010 wp_sppp_do_ioctl /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL -0x5b7efb57 wanpipe_api_poll_wake /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x651a840a wan_add_gateway /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x805cbe1e wp_sppp_close /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL -0x2f21a326 unregister_wanpipe_lip_protocol /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0xa4d9f3e3 wanrouter_proc_delete_interface /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x0ebe03d1 unregister_wan_device /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x22317d82 wanpipe_lip_disconnect /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0xed6a48f7 protocol_connected /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x53350bd4 wanpipe_ec_unregister /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x49a433d4 register_wanpipe_lip_protocol /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL -0x00525339 protocol_connecting /root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0xf7567a8a wanpipe_api_buf_check /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0xf27fa082 wanpipe_lip_connect /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x345b760c sdla_register /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL +0xc0ef42f1 wp_sppp_input /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL +0x57e6ed60 wanpipe_api_sock_rx /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0xc4376a57 wanrouter_proc_add_interface /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x59fb2682 sdla_hw_probe /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL +0x9a7a6658 wanpipe_lip_rx /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x8f31cdeb proc_router /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x1f1e3c4b register_wanec_iface /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x1036a1ab bind_api_listen_to_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x524e2f20 register_wanpipe_fw_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x3eeca618 register_wan_device /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0xf7820561 wanrouter_proc_add_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0xc9b2c3fb wp_sppp_attach /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL +0x90a9f616 wp_sppp_detach /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL +0x01530a2f wanpipe_ec_event_ctrl /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x7cd3c2bc wanpipe_ec_poll /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x0ffb17c1 wanrouter_proc_delete_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0xdfd0f6c6 sdla_get_hw_adptr_cnt /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL +0xc2143791 wanpipe_ec_register /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x1e82f485 wp_sppp_change_mtu /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL +0x02364d27 wanrouter_encapsulate /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x136b2537 wan_skb_destructor /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0xfa083e32 register_wanpipe_api_socket /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0xade2d0d7 sdla_get_hw_probe /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL +0xef48df91 proc_add_line /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x22a2999f sdla_unregister /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL +0x85c05713 wanrouter_type_trans /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0xc98aebe6 wan_get_ip_address /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0xfd74fadb wan_set_ip_address /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x7d68ed07 protocol_disconnected /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0xc5224c15 bind_api_to_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x38eb6851 unregister_wanpipe_api_socket /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0xaac011d2 wanpipe_lip_kick /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x3b604364 unbind_api_listen_from_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x6df6c4e0 wan_run_wanrouter /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0xeb418feb sdla_hw_bridge_probe /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/sdladrv EXPORT_SYMBOL +0x04df932b unregister_wanec_iface /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x562d2ade wanpipe_ec_isr /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x13405f6b unregister_wanpipe_fw_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0xe72f44cb wanpipe_api_listen_rx /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0xe6bc2d6d wp_sppp_open /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL +0x238f240b wp_sppp_reopen /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL +0x72ddd010 wp_sppp_do_ioctl /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL +0x5b7efb57 wanpipe_api_poll_wake /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x651a840a wan_add_gateway /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x805cbe1e wp_sppp_close /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanpipe_syncppp EXPORT_SYMBOL +0xc7f525d5 wanrouter_proc_delete_interface /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x2f21a326 unregister_wanpipe_lip_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x0ebe03d1 unregister_wan_device /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x22317d82 wanpipe_lip_disconnect /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0xed6a48f7 protocol_connected /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x53350bd4 wanpipe_ec_unregister /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x11fbf1e8 register_wanpipe_lip_protocol /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL +0x00525339 protocol_connecting /hda5/wanpipe/3.1.X/wanpipe-3.1.0.p7/patches/kdrivers/src/net/wanrouter EXPORT_SYMBOL diff --git a/patches/kdrivers/src/net/aft_a104.c b/patches/kdrivers/src/net/aft_a104.c index 0f28735..6b7fe3c 100644 --- a/patches/kdrivers/src/net/aft_a104.c +++ b/patches/kdrivers/src/net/aft_a104.c @@ -26,17 +26,16 @@ # include # include # include +# include #elif defined(__WINDOWS__) -# include -# include -# include -# include +# include +# include # include /* Socket Driver common area */ # include # include - -# include +# include +# include extern void @@ -46,6 +45,7 @@ sdla_te_timer( void*, void* ); + #else # include # include @@ -55,19 +55,24 @@ sdla_te_timer( # include /* Socket Driver common area */ # include # include +# include //# include # include # include # include +# include + #endif #define INIT_FE_ONLY 0 +#if !defined(__WINDOWS__) #if 1 #define AFT_FUNC_DEBUG() #else #define AFT_FUNC_DEBUG() DEBUG_EVENT("%s:%d\n",__FUNCTION__,__LINE__) #endif +#endif /*============================================== * PRIVATE FUNCITONS @@ -75,7 +80,7 @@ sdla_te_timer( */ #if defined(CONFIG_WANPIPE_HWEC) static int aft_hwec_reset(void *pcard, int reset); -static int aft_hwec_enable(void *pcard, int enable, int channel); +static int aft_hwec_enable(void *pcard, int enable, int fe_chan); #endif int __a104_write_fe (void *pcard, ...); @@ -98,7 +103,11 @@ static int request_fifo_baddr_and_size(sdla_t *card, private_area_t *chan) /* Calculate the optimal fifo size based * on the number of time slots requested */ - if (IS_T1_CARD(card)){ + if (IS_SERIAL_CARD(card)) { + + req_fifo_size=32; + + } else if (IS_T1_CARD(card)){ if (chan->num_of_time_slots == NUM_OF_T1_CHANNELS){ req_fifo_size=32; @@ -448,6 +457,10 @@ int a104_led_ctrl(sdla_t *card, int color, int led_pos, int on) AFT_FUNC_DEBUG(); #if INIT_FE_ONLY #else + if (IS_SERIAL_CARD(card)) { + return 0; + } + if (card->adptr_subtype == AFT_SUBTYPE_SHARK){ /* INSERT LED CODE */ @@ -528,7 +541,8 @@ int a104_global_chip_config(sdla_t *card) wan_set_bit(AFT_CHIPCFG_TE1_CFG_BIT,®); }else if (IS_56K_CARD(card)){ wan_set_bit(AFT_CHIPCFG_56K_CFG_BIT,®); - + }else if (IS_SERIAL_CARD(card)) { + /* No bit to set nere */ }else{ DEBUG_EVENT("%s: Error: Xilinx doesn't support non T1/E1 interface!\n", card->devname); @@ -536,6 +550,7 @@ int a104_global_chip_config(sdla_t *card) } /* Enable FRONT END Interrupt */ + wan_set_bit(AFT_CHIPCFG_FE_INTR_CFG_BIT,®); DEBUG_CFG("--- Chip enable/config. -- \n"); @@ -551,6 +566,10 @@ int a104_global_chip_config(sdla_t *card) wan_spin_unlock_irq(&card->wandev.lock,&flags); card->hw_iface.hw_unlock(card->hw,&smp_flags); + }else if (IS_SERIAL_CARD(card)) { + + /* There is no CPLD reset for Serial card */ + }else if (card->adptr_subtype == AFT_SUBTYPE_SHARK){ wan_smp_flag_t smp_flags,flags; @@ -566,7 +585,7 @@ int a104_global_chip_config(sdla_t *card) wan_spin_unlock_irq(&card->wandev.lock,&flags); card->hw_iface.hw_unlock(card->hw,&smp_flags); } - + err=aft_test_hdlc(card); if (err != 0){ DEBUG_EVENT("%s: Error: HDLC Core Not Ready (0x%X)!\n", @@ -598,7 +617,6 @@ int a104_global_chip_config(sdla_t *card) card->hw_iface.bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); } } - #endif/*INIT_FE_ONLY*/ return 0; } @@ -682,6 +700,7 @@ static int aft_ds_set_clock_ref(sdla_t *card, u32 *reg, u32 master_port) return 0; } + static void aft_set_hwec_clock_src(sdla_t *card) { wan_smp_flag_t smp_flags, flags; @@ -708,26 +727,23 @@ static void aft_set_hwec_clock_src(sdla_t *card) } } -int a104_chip_config(sdla_t *card) + +int a104_chip_config(sdla_t *card, wandev_conf_t *conf) { u32 reg=0, ctrl_ram_reg=0; int i,err=0, max_channels; wan_smp_flag_t smp_flags, flags; AFT_FUNC_DEBUG(); -#if INIT_FE_ONLY - err = -EINVAL; - - if (card->wandev.fe_iface.config){ - err=card->wandev.fe_iface.config(&card->fe); - } -#else + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG), ®); if (!wan_test_bit(AFT_LCFG_FE_IFACE_RESET_BIT,®)){ + DEBUG_EVENT("%s: Error: Physical Port %d is busy!\n", card->devname, card->wandev.comm_port+1); return -EBUSY; } + /* On A108 Cards the T1/E1 will be configured per PORT * not per CARD */ @@ -754,6 +770,15 @@ int a104_chip_config(sdla_t *card) aft_fe_intr_ctrl(card, 0); + if(card->adptr_type == AFT_ADPTR_56K){ + + aft_56k_write_cpld(card, 0x00,0x00);//reset_on_LXT441PE(card); + WP_DELAY(1000); + + aft_56k_write_cpld(card, 0x00, 0x03);//reset_off_LXT441PE(card); + WP_DELAY(1000); + } + err = -EINVAL; if (card->wandev.fe_iface.config){ err=card->wandev.fe_iface.config(&card->fe); @@ -771,7 +796,7 @@ int a104_chip_config(sdla_t *card) card->devname, (IS_T1_CARD(card))?"T1":"E1"); return -EINVAL; - } + } /* Run rest of initialization not from lock */ if (card->wandev.fe_iface.post_init){ err=card->wandev.fe_iface.post_init(&card->fe); @@ -903,6 +928,7 @@ int a104_chip_config(sdla_t *card) card->devname,reg); } + card->wandev.ec_dev = NULL; card->wandev.hwec_reset = NULL; card->wandev.hwec_enable = NULL; @@ -914,7 +940,6 @@ int a104_chip_config(sdla_t *card) card->hw_iface.getcfg(card->hw, SDLA_HWEC_NO, &max_ec_chans); - card->hw_iface.bus_read_4(card->hw,AFT_CHIP_CFG_REG, &cfg_reg); if (max_ec_chans > aft_chipcfg_get_ec_channels(cfg_reg)){ DEBUG_EVENT("%s: Critical Error: Exceeded Maximum Available Echo Channels!\n", @@ -930,12 +955,22 @@ int a104_chip_config(sdla_t *card) #if defined(CONFIG_WANPIPE_HWEC) card->wandev.hwec_reset = aft_hwec_reset; card->wandev.hwec_enable = aft_hwec_enable; - card->wandev.ec_dev = wanpipe_ec_register(card, max_ec_chans); + card->wandev.ec_dev = wanpipe_ec_register( + card, + 0, + WAN_FE_MAX_CHANNELS(&card->fe), + max_ec_chans, + (void*)&conf->oct_conf); if (!card->wandev.ec_dev) { - return -EINVAL; + DEBUG_EVENT( + "%s: Failed to register device in HW Echo Canceller module!\n", + card->devname); + return -EINVAL; } + aft_set_hwec_clock_src(card); + #else DEBUG_EVENT("%s: Wanpipe HW Echo Canceller module is not compiled!\n", @@ -1007,7 +1042,7 @@ int a104_chip_config(sdla_t *card) aft_wdt_reset(card); aft_wdt_set(card,AFT_WDTCTRL_TIMEOUT); -#endif + AFT_FUNC_DEBUG(); return 0; @@ -1064,6 +1099,10 @@ int a104_chip_unconfig(sdla_t *card) __aft_fe_intr_ctrl(card,0); wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); card->hw_iface.hw_unlock(card->hw,&smp_flags1); + }else if (IS_56K_CARD(card)) { + //reset_on_LXT441PE(card); + aft_56k_write_cpld(card, 0x00,0x00); + WP_DELAY(1000); } wan_set_bit(AFT_LCFG_FE_IFACE_RESET_BIT,®); @@ -1285,289 +1324,6 @@ int a104_check_ec_security(sdla_t *card) } -/*============================================================================ - * Read TE1/56K Front end registers - */ -int __a104_write_fe (void *pcard, ...) -{ - va_list args; - sdla_t *card = (sdla_t*)pcard; - int port_no, org_off, off, value; - u8 qaccess = card->wandev.state == WAN_CONNECTED ? 1 : 0; - - va_start(args, pcard); - port_no = va_arg(args, int); - off = va_arg(args, int); - value = va_arg(args, int); - va_end(args); - - if (card->u.aft.firm_id == AFT_PMC_FE_CORE_ID){ - off &= ~AFT4_BIT_DEV_ADDR_CLEAR; - }else if (card->u.aft.firm_id == AFT_DS_FE_CORE_ID){ - if (off & 0x800) off |= 0x2000; - if (off & 0x1000) off |= 0x4000; - off &= ~AFT8_BIT_DEV_ADDR_CLEAR; - if ((card->adptr_type == A101_ADPTR_2TE1 || card->adptr_type == A101_ADPTR_1TE1) && - port_no == 1){ - off |= AFT8_BIT_DEV_MAXIM_ADDR_CPLD; - } - } - - card->hw_iface.bus_read_2(card->hw, - AFT_MCPU_INTERFACE_ADDR, - (u16*)&org_off); - - card->hw_iface.bus_write_2(card->hw,AFT_MCPU_INTERFACE_ADDR, (u16)off); - - - /* AF: Sep 10, 2003 - * IMPORTANT - * This delays are required to avoid bridge optimization - * (combining two writes together) - */ - if (!qaccess){ - WP_DELAY(5); - } - - card->hw_iface.bus_write_1(card->hw,AFT_MCPU_INTERFACE, (u8)value); - if (!qaccess){ - WP_DELAY(5); - } - - card->hw_iface.bus_write_2( card->hw, - AFT_MCPU_INTERFACE_ADDR, - (u16)org_off); - - - if (!qaccess){ - WP_DELAY(5); - } - - return 0; -} - -int a104_write_fe (void *pcard, ...) -{ - va_list args; - sdla_t *card = (sdla_t*)pcard; - int port_no, off, value; - - if (card->hw_iface.fe_test_and_set_bit(card->hw,0)){ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT( - "%s: %s:%d: Critical Error: Re-entry in FE!\n", - card->devname, - __FUNCTION__,__LINE__); - } - return -EINVAL; - } - - va_start(args, pcard); - port_no = va_arg(args, int); - off = va_arg(args, int); - value = va_arg(args, int); - va_end(args); - - __a104_write_fe(card, port_no, off, value); - - card->hw_iface.fe_clear_bit(card->hw,0); - - return 0; -} - - -/*============================================================================ - * Read TE1 Front end registers - */ -unsigned char __a104_read_fe (void *pcard, ...) -{ - va_list args; - sdla_t *card = (sdla_t*)pcard; - int port_no, org_off, off, tmp; - u8 qaccess = card->wandev.state == WAN_CONNECTED ? 1 : 0; - - va_start(args, pcard); - port_no = (int)va_arg(args, int); - off = (int)va_arg(args, int); - va_end(args); - - if (card->u.aft.firm_id == AFT_PMC_FE_CORE_ID){ - off &= ~AFT4_BIT_DEV_ADDR_CLEAR; - }else if (card->u.aft.firm_id == AFT_DS_FE_CORE_ID){ - if (off & 0x0800) off |= 0x2000; - if (off & 0x1000) off |= 0x4000; - off &= ~AFT8_BIT_DEV_ADDR_CLEAR; - if ((card->adptr_type == A101_ADPTR_2TE1 || card->adptr_type == A101_ADPTR_1TE1) && - port_no == 1){ - off |= AFT8_BIT_DEV_MAXIM_ADDR_CPLD; - } - } - - card->hw_iface.bus_read_2(card->hw, - AFT_MCPU_INTERFACE_ADDR, - (u16*)&org_off); - - card->hw_iface.bus_write_2(card->hw, AFT_MCPU_INTERFACE_ADDR, (u16)off); - - card->hw_iface.bus_read_1(card->hw,AFT_MCPU_INTERFACE, (u8*)&tmp); - if (!qaccess){ - WP_DELAY(5); - } - - card->hw_iface.bus_write_2(card->hw, - AFT_MCPU_INTERFACE_ADDR, - (u16)org_off); - - if (!qaccess){ - WP_DELAY(5); - } - - return (u8)tmp; -} - -unsigned char a104_read_fe (void *pcard, ...) -{ - va_list args; - sdla_t *card = (sdla_t*)pcard; - int port_no, off; - unsigned char tmp; - - - if (card->hw_iface.fe_test_and_set_bit(card->hw,0)){ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", - card->devname, __FUNCTION__,__LINE__); - } - return 0x00; - } - - va_start(args, pcard); - port_no = (int)va_arg(args, int); - off = (int)va_arg(args, int); - va_end(args); - - - tmp = __a104_read_fe(card, port_no, off); - - card->hw_iface.fe_clear_bit(card->hw,0); - return tmp; -} - -/*============================================================================ - * Read/Write 56k Front End registers. Different from TE1!! - */ -unsigned char __a56k_read_fe (void *pcard, ...) -{ - va_list args; - sdla_t *card = (sdla_t*)pcard; - int port_no, off, tmp; - u8 qaccess = card->wandev.state == WAN_CONNECTED ? 1 : 0; - - va_start(args, pcard); - port_no = (int)va_arg(args, int); - off = (int)va_arg(args, int); - va_end(args); - - off &= ~AFT8_BIT_DEV_ADDR_CLEAR; - - card->hw_iface.bus_write_2(card->hw, AFT56K_MCPU_INTERFACE_ADDR, (u16)off); - - card->hw_iface.bus_read_4(card->hw, AFT56K_MCPU_INTERFACE, &tmp); - - if (!qaccess){ - WP_DELAY(5); - } -#if 0 - DEBUG_56K("%s(): port_no: 0x%X, off: 0x%X, cpld_data: 0x%X\n", - __FUNCTION__, port_no, off, tmp); -#endif - return (u8)tmp; -} - -unsigned char a56k_read_fe (void *pcard, ...) -{ - va_list args; - sdla_t *card = (sdla_t*)pcard; - unsigned int port_no, off; - unsigned int cpld_data=0; - - if (card->hw_iface.fe_test_and_set_bit(card->hw,0)){ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", - card->devname, __FUNCTION__,__LINE__); - } - return 0x00; - } - - va_start(args, pcard); - port_no = (int)va_arg(args, int); - off = (int)va_arg(args, int); - va_end(args); - - cpld_data = __a56k_read_fe(card, port_no, off); - - card->hw_iface.fe_clear_bit(card->hw,0); - - return (unsigned char)cpld_data; -} - -int __a56k_write_fe (void *pcard, ...) -{ - va_list args; - sdla_t *card = (sdla_t*)pcard; - int port_no, off, value; - u8 qaccess = card->wandev.state == WAN_CONNECTED ? 1 : 0; - - va_start(args, pcard); - port_no = va_arg(args, int); - off = va_arg(args, int); - value = va_arg(args, int); - va_end(args); - - off &= ~AFT8_BIT_DEV_ADDR_CLEAR; - - card->hw_iface.bus_write_2(card->hw, AFT56K_MCPU_INTERFACE_ADDR, (u16)off); - - card->hw_iface.bus_write_2(card->hw, AFT56K_MCPU_INTERFACE, (u16)value); - if (!qaccess){ - WP_DELAY(5); - } -#if 0 - DEBUG_56K("%s(): port_no: 0x%X, off: 0x%X, value: 0x%X\n", - __FUNCTION__, port_no, off, value); -#endif - return 0; -} - -int a56k_write_fe (void *pcard, ...) -{ - va_list args; - sdla_t *card = (sdla_t*)pcard; - int port_no, off, value; - - if (card->hw_iface.fe_test_and_set_bit(card->hw,0)){ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT( - "%s: %s:%d: Critical Error: Re-entry in FE!\n", - card->devname, - __FUNCTION__,__LINE__); - } - return -EINVAL; - } - - va_start(args, pcard); - port_no = va_arg(args, int); - off = va_arg(args, int); - value = va_arg(args, int); - va_end(args); - - __a56k_write_fe(card, port_no, off, value); - - card->hw_iface.fe_clear_bit(card->hw,0); - - return 0; -} - /*============================================================================ * Read/Write 56k CPLD. Different from TE1!! */ @@ -1708,7 +1464,7 @@ int a108m_write_cpld(sdla_t *card, unsigned short off,u_int16_t data) card->hw_iface.bus_write_1(card->hw, AFT_MCPU_INTERFACE, - data); + (u8)data); /*ALEX: Restore the original address */ card->hw_iface.bus_write_2(card->hw, AFT_MCPU_INTERFACE_ADDR, @@ -1755,11 +1511,10 @@ static int aft_hwec_reset(void *pcard, int reset) card->devname); if (card->u.aft.firm_id == AFT_DS_FE_CORE_ID) { - if(card->adptr_type == A108_ADPTR_8TE1){ - aft_te1_write_cpld(card,0x00,0x0F); - } else { - aft_te1_write_cpld(card,0x00,0x07); - } + /* Changed for all Dallas chips + changed from 0x07 to 0x0F to support + external clocking */ + aft_te1_write_cpld(card,0x00,0x0F); }else{ if (IS_T1_CARD(card)){ @@ -1804,51 +1559,35 @@ static int aft_hwec_reset(void *pcard, int reset) ** 1 - channel out of channel map ** < 0 - failed ******************************************************************************/ -static int aft_hwec_enable(void *pcard, int enable, int channel) +static int aft_hwec_enable(void *pcard, int enable, int fe_chan) { sdla_t *card = (sdla_t*)pcard; + int hw_chan = fe_chan; unsigned int value; WAN_ASSERT(card == NULL); - if(!wan_test_bit(channel, &card->wandev.ec_enable_map)){ - return 1; + + if (IS_T1_CARD(card)){ + hw_chan = fe_chan-1; } - DEBUG_TEST("[HWEC]: %s: %s bypass mode for channel %d!\n", - card->devname, - (enable) ? "Enable" : "Disable", - channel); card->hw_iface.bus_read_4( card->hw, - AFT_PORT_REG(card,0x1000) + channel * 4, + AFT_PORT_REG(card,0x1000) + hw_chan * 4, &value); - if (enable){ - if (!wan_test_and_set_bit(channel,&card->wandev.ec_map)) { - value |= 0x20; - } else { - DEBUG_EVENT("[HWEC]: %s: %s bypass mode overrun detected for channel %d!\n", - card->devname, - (enable) ? "Enable" : "Disable", - channel); - return 0; - } + if (enable){ + value |= 0x20; } else { - if (wan_test_and_clear_bit(channel,&card->wandev.ec_map)) { - value &= ~0x20; - } else { - DEBUG_EVENT("[HWEC]: %s: %s bypass mode overrun detected for channel %d!\n", - card->devname, - (enable) ? "Enable" : "Disable", - channel); - return 0; - } + value &= ~0x20; } - + DEBUG_HWEC("[HWEC]: %s: %s bypass mode for fe_chan:%d (value=%X)...!\n", + card->devname, + (enable) ? "Enable" : "Disable", + fe_chan, value); card->hw_iface.bus_write_4( card->hw, - AFT_PORT_REG(card,0x1000) + channel * 4, + AFT_PORT_REG(card,0x1000) + hw_chan * 4, value); - return 0; } #endif diff --git a/patches/kdrivers/src/net/aft_analog.c b/patches/kdrivers/src/net/aft_analog.c index 158ef69..0dfa03b 100644 --- a/patches/kdrivers/src/net/aft_analog.c +++ b/patches/kdrivers/src/net/aft_analog.c @@ -26,20 +26,14 @@ # include #elif defined(__WINDOWS__) # include -# include # include -# include # include /* Socket Driver common area */ # include -//# include # include # include # include # include -//#define DEBUG_FE DbgPrint -#define DEBUG_FE - #else # include # include @@ -56,13 +50,14 @@ # include #endif + /*============================================== * PRIVATE FUNCITONS * */ #if defined(CONFIG_WANPIPE_HWEC) static int aft_analog_hwec_reset(void *pcard, int reset); -static int aft_analog_hwec_enable(void *pcard, int enable, int channel); +static int aft_analog_hwec_enable(void *pcard, int enable, int fe_chan); #endif static int aft_map_fifo_baddr_and_size(sdla_t *card, unsigned char fifo_size, unsigned char *addr); @@ -341,7 +336,7 @@ int aft_analog_global_chip_config(sdla_t *card) wan_set_bit(AFT_CHIPCFG_SFR_IN_BIT,®); if (card->fe.fe_cfg.cfg.remora.network_sync) { - DEBUG_EVENT("%s: Analog Clock set to External!\n", + DEBUG_EVENT("%s: Analog Clock set to Network Sync!\n", card->devname); wan_set_bit(AFT_CHIPCFG_ANALOG_CLOCK_SELECT_BIT,®); } @@ -350,6 +345,7 @@ int aft_analog_global_chip_config(sdla_t *card) card->hw_iface.bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); + WP_DELAY(10); /* Disable the chip/hdlc reset condition */ @@ -383,10 +379,9 @@ int aft_analog_global_chip_config(sdla_t *card) DEBUG_EVENT("%s: Remora config done!\n",card->devname); - card->hw_iface.bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); - wan_set_bit(AFT_CHIPCFG_FE_INTR_CFG_BIT,®); - card->hw_iface.bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); - + /* Enable global front end interrupt */ + __aft_fe_intr_ctrl(card, 1); + return 0; } @@ -411,7 +406,7 @@ int aft_analog_global_chip_unconfig(sdla_t *card) return 0; } -int aft_analog_chip_config(sdla_t *card) +int aft_analog_chip_config(sdla_t *card, wandev_conf_t *conf) { u32 reg=0; int err=0; @@ -452,10 +447,12 @@ int aft_analog_chip_config(sdla_t *card) /* Enable Octasic Chip */ if (card->adptr_subtype == AFT_SUBTYPE_SHARK){ - u16 max_ec_chans; - u32 cfg_reg; + u16 max_ec_chans, max_ports_no; + u32 cfg_reg, fe_port_map; card->hw_iface.getcfg(card->hw, SDLA_HWEC_NO, &max_ec_chans); + card->hw_iface.getcfg(card->hw, SDLA_PORTS_NO, &max_ports_no); + card->hw_iface.getcfg(card->hw, SDLA_PORT_MAP, &fe_port_map); card->hw_iface.bus_read_4(card->hw,AFT_CHIP_CFG_REG, &cfg_reg); if (max_ec_chans > aft_chipcfg_get_a200_ec_channels(cfg_reg)){ @@ -473,7 +470,12 @@ int aft_analog_chip_config(sdla_t *card) if (max_ec_chans){ #if defined(CONFIG_WANPIPE_HWEC) - card->wandev.ec_dev = wanpipe_ec_register(card, max_ec_chans); + card->wandev.ec_dev = wanpipe_ec_register( + card, + fe_port_map, + max_ports_no, + max_ec_chans, + (void*)&conf->oct_conf); card->wandev.hwec_reset = aft_analog_hwec_reset; card->wandev.hwec_enable = aft_analog_hwec_enable; #else @@ -681,404 +683,6 @@ int a200_check_ec_security(sdla_t *card) } return 0; } - -/*============================================================================ - * Read TE1/56K Front end registers - */ -int __aft_analog_write_fe (void* pcard, ...) -{ - va_list args; - sdla_t *card = (sdla_t*)pcard; - int mod_no, type, chain; - int reg, value; - u32 data = 0; - unsigned char cs = 0x00, ctrl_byte = 0x00; - int i; - - WAN_ASSERT(card == NULL); - WAN_ASSERT(card->hw_iface.bus_write_4 == NULL); - WAN_ASSERT(card->hw_iface.bus_read_4 == NULL); - - va_start(args, pcard); - mod_no = va_arg(args, int); - type = va_arg(args, int); - chain = va_arg(args, int); - reg = va_arg(args, int); - value = va_arg(args, int); - va_end(args); -#if 0 - if (!wan_test_bit(mod_no, card->fe.fe_param.remora.module_map)){ - DEBUG_EVENT("%s: %s:%d: Internal Error: Module %d\n", - card->devname, __FUNCTION__,__LINE__,mod_no); - return -EINVAL; - } -#endif - DEBUG_FE( - "%s:%d: Module %d: Write RM FE code (%d:%02X)!\n", - __FUNCTION__,__LINE__, - mod_no, reg, (u8)value); - - /* bit 0-7: data byte */ - data = value & 0xFF; - if (type == MOD_TYPE_FXO){ - - /* bit 8-15: register number */ - data |= (reg & 0xFF) << 8; - - /* bit 16-23: chip select byte - ** bit 16 - ** - ** - ** */ - cs = 0x20; - cs |= MOD_SPI_CS_FXO_WRITE; - if (mod_no % 2 == 0){ - /* Select second chip in a chain */ - cs |= MOD_SPI_CS_FXO_CHIP_1; - } - data |= (cs & 0xFF) << 16; - - /* bit 24-31: ctrl byte - ** bit 24 - ** - ** - ** */ - ctrl_byte = mod_no / 2; -#if !defined(SPI2STEP) - if (card->u.aft.firm_ver > 3){ - ctrl_byte |= MOD_SPI_CTRL_START; - }else{ - ctrl_byte |= MOD_SPI_CTRL_V3_START; - } -#endif - ctrl_byte |= MOD_SPI_CTRL_CHAIN; /* always chain */ - data |= ctrl_byte << 24; - - }else if (type == MOD_TYPE_FXS){ - - /* bit 8-15: register byte */ - reg = reg & 0x7F; - reg |= MOD_SPI_ADDR_FXS_WRITE; - data |= (reg & 0xFF) << 8; - - /* bit 16-23: chip select byte - ** bit 16 - ** - ** - ** */ - if (mod_no % 2){ - /* Select first chip in a chain */ - cs = MOD_SPI_CS_FXS_CHIP_0; - }else{ - /* Select second chip in a chain */ - cs = MOD_SPI_CS_FXS_CHIP_1; - } - data |= cs << 16; - - /* bit 24-31: ctrl byte - ** bit 24 - ** - ** - ** */ - ctrl_byte = mod_no / 2; -#if !defined(SPI2STEP) - if (card->u.aft.firm_ver > 3){ - ctrl_byte |= MOD_SPI_CTRL_START; - }else{ - ctrl_byte |= MOD_SPI_CTRL_V3_START; - } -#endif - ctrl_byte |= MOD_SPI_CTRL_FXS; - if (chain){ - ctrl_byte |= MOD_SPI_CTRL_CHAIN; - } - data |= ctrl_byte << 24; - - }else{ - DEBUG_EVENT("%s: Module %d: Unsupported module type %d!\n", - card->devname, mod_no, type); - return -EINVAL; - } - - card->hw_iface.bus_write_4( card->hw, - SPI_INTERFACE_REG, - data); -#if defined(SPI2STEP) - WP_DELAY(1); - if (card->u.aft.firm_ver > 3){ - data |= MOD_SPI_START; - }else{ - data |= MOD_SPI_V3_START; - } - card->hw_iface.bus_write_4( card->hw, - SPI_INTERFACE_REG, - data); -#endif -#if 0 - DEBUG_EVENT("%s: %s: Module %d - Execute SPI command %08X\n", - card->fe.name, - __FUNCTION__, - mod_no, - data); -#endif - - for (i=0;i<10;i++){ - WP_DELAY(10); - card->hw_iface.bus_read_4( card->hw, - SPI_INTERFACE_REG, - &data); - - if (data & MOD_SPI_BUSY){ - continue; - } - } - - if (data & MOD_SPI_BUSY) { - DEBUG_EVENT("%s: Module %d: Internal Error: SPI busy (%s:%d)!\n", - card->devname, mod_no, - __FUNCTION__,__LINE__); - return -EINVAL; - } - return 0; -} -int aft_analog_write_fe (void* pcard, ...) -{ - va_list args; - sdla_t *card = (sdla_t*)pcard; - int mod_no, type, chain, reg, value; -#if defined(WAN_DEBUG_FE) - char *fname; - int fline; -#endif - - WAN_ASSERT(card == NULL); - WAN_ASSERT(card->hw_iface.bus_write_4 == NULL); - WAN_ASSERT(card->hw_iface.bus_read_4 == NULL); - - va_start(args, pcard); - mod_no = va_arg(args, int); - type = va_arg(args, int); - chain = va_arg(args, int); - reg = va_arg(args, int); - value = va_arg(args, int); -#if defined(WAN_DEBUG_FE) - fname = va_arg(args, char*); - fline = va_arg(args, int); -#endif - va_end(args); - - if (card->hw_iface.fe_test_and_set_bit(card->hw,0)){ -#if defined(WAN_DEBUG_FE) - DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE (%s:%d)!\n", - card->devname, __FUNCTION__,__LINE__, fname, fline); -#else - DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", - card->devname, __FUNCTION__,__LINE__); -#endif - return -EINVAL; - } - - __aft_analog_write_fe(card, mod_no, type, chain, reg, value); - - card->hw_iface.fe_clear_bit(card->hw,0); - return 0; -} - -unsigned char __aft_analog_read_fe (void* pcard, ...) -{ - va_list args; - sdla_t *card = (sdla_t*)pcard; - int mod_no, type, chain, reg; - u32 data = 0; - unsigned char cs = 0x00, ctrl_byte = 0x00; - int i; - - WAN_ASSERT(card == NULL); - WAN_ASSERT(card->hw_iface.bus_write_4 == NULL); - WAN_ASSERT(card->hw_iface.bus_read_4 == NULL); - - va_start(args, pcard); - mod_no = va_arg(args, int); - type = va_arg(args, int); - chain = va_arg(args, int); - reg = va_arg(args, int); - va_end(args); -#if 0 - if (!wan_test_bit(mod_no, card->fe.fe_param.remora.module_map)){ - DEBUG_EVENT("%s: %s:%d: Internal Error: Module %d\n", - card->devname, __FUNCTION__,__LINE__,mod_no); - return 0x00; - } -#endif - DEBUG_FE( - "%s:%d: Module %d: Read RM FE code (%d)!\n", - __FUNCTION__,__LINE__, - mod_no, reg); - - /* bit 0-7: data byte */ - data = 0x00; - if (type == MOD_TYPE_FXO){ - - /* bit 8-15: register byte */ - data |= (reg & 0xFF) << 8; - - /* bit 16-23: chip select byte - ** bit 16 - ** - ** - ** */ - cs = 0x20; - cs |= MOD_SPI_CS_FXO_READ; - if (mod_no % 2 == 0){ - /* Select second chip in a chain */ - cs |= MOD_SPI_CS_FXO_CHIP_1; - } - data |= (cs & 0xFF) << 16; - - /* bit 24-31: ctrl byte - ** bit 24 - ** - ** - ** */ - ctrl_byte = mod_no / 2; -#if !defined(SPI2STEP) - if (card->u.aft.firm_ver > 3){ - ctrl_byte |= MOD_SPI_CTRL_START; - }else{ - ctrl_byte |= MOD_SPI_CTRL_V3_START; - } -#endif - ctrl_byte |= MOD_SPI_CTRL_CHAIN; /* always chain */ - data |= ctrl_byte << 24; - - }else if (type == MOD_TYPE_FXS){ - - /* bit 8-15: register byte */ - reg = reg & 0x7F; - reg |= MOD_SPI_ADDR_FXS_READ; - data |= (reg & 0xFF) << 8; - - /* bit 16-23: chip select byte - ** bit 16 - ** - ** - ** */ - if (mod_no % 2){ - /* Select first chip in a chain */ - cs = MOD_SPI_CS_FXS_CHIP_0; - }else{ - /* Select second chip in a chain */ - cs = MOD_SPI_CS_FXS_CHIP_1; - } - data |= cs << 16; - - /* bit 24-31: ctrl byte - ** bit 24 - ** - ** - ** */ - ctrl_byte = mod_no / 2; -#if !defined(SPI2STEP) - if (card->u.aft.firm_ver > 3){ - ctrl_byte |= MOD_SPI_CTRL_START; - }else{ - ctrl_byte |= MOD_SPI_CTRL_V3_START; - } -#endif - ctrl_byte |= MOD_SPI_CTRL_FXS; - if (chain){ - ctrl_byte |= MOD_SPI_CTRL_CHAIN; - } - data |= ctrl_byte << 24; - - }else{ - DEBUG_EVENT("%s: Module %d: Unsupported module type %d!\n", - card->devname, mod_no, type); - return -EINVAL; - } - - card->hw_iface.bus_write_4( card->hw, - SPI_INTERFACE_REG, - data); -#if defined(SPI2STEP) - WP_DELAY(1); - if (card->u.aft.firm_ver > 3){ - data |= MOD_SPI_START; - }else{ - data |= MOD_SPI_V3_START; - } - card->hw_iface.bus_write_4( card->hw, - SPI_INTERFACE_REG, - data); -#endif -#if 0 - DEBUG_EVENT("%s: %s: Module %d - Execute SPI command %08X\n", - card->fe.name, - __FUNCTION__, - mod_no, - data); -#endif - for (i=0;i<10;i++){ - WP_DELAY(10); - card->hw_iface.bus_read_4( card->hw, - SPI_INTERFACE_REG, - &data); - if (data & MOD_SPI_BUSY) { - continue; - } - } - - if (data & MOD_SPI_BUSY){ - DEBUG_EVENT("%s: Module %d: Internal Error: SPI busy (%s:%d)!\n", - card->devname, mod_no, - __FUNCTION__,__LINE__); - return 0xFF; - } - - return (u8)(data & 0xFF); -} - -unsigned char aft_analog_read_fe (void* pcard, ...) -{ - va_list args; - sdla_t *card = (sdla_t*)pcard; - int mod_no, type, chain, reg; - unsigned char data = 0; -#if defined(WAN_DEBUG_FE) - char *fname; - int fline; -#endif - - WAN_ASSERT(card == NULL); - WAN_ASSERT(card->hw_iface.bus_write_4 == NULL); - WAN_ASSERT(card->hw_iface.bus_read_4 == NULL); - - va_start(args, pcard); - mod_no = va_arg(args, int); - type = va_arg(args, int); - chain = va_arg(args, int); - reg = va_arg(args, int); -#if defined(WAN_DEBUG_FE) - fname = va_arg(args, char*); - fline = va_arg(args, int); -#endif - va_end(args); - - if (card->hw_iface.fe_test_and_set_bit(card->hw,0)){ -#if defined(WAN_DEBUG_FE) - DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE (%s:%d)!\n", - card->devname, __FUNCTION__,__LINE__,fname,fline); -#else - DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", - card->devname, __FUNCTION__,__LINE__); -#endif - return 0x00; - } - data = __aft_analog_read_fe (card, mod_no, type, chain, reg); - - card->hw_iface.fe_clear_bit(card->hw,0); - return data; -} unsigned char aft_analog_read_cpld(sdla_t *card, unsigned short cpld_off) { @@ -1112,9 +716,10 @@ unsigned char aft_analog_read_cpld(sdla_t *card, unsigned short cpld_off) return tmp; } -int aft_analog_write_cpld(sdla_t *card, unsigned short off,u_int16_t data) +int aft_analog_write_cpld(sdla_t *card, unsigned short off, u_int16_t data_in) { u16 org_off; + u8 data=(u8)data_in; if (card->hw_iface.fe_test_and_set_bit(card->hw,0)){ DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", @@ -1196,51 +801,31 @@ static int aft_analog_hwec_reset(void *pcard, int reset) ** < 0 - failed ******************************************************************************/ #define AFT_REMORA_MUX_TS_EC_ENABLE 0x210 -static int aft_analog_hwec_enable(void *pcard, int enable, int channel) +static int aft_analog_hwec_enable(void *pcard, int enable, int fe_chan) { sdla_t *card = (sdla_t*)pcard; unsigned int value = 0x00; + int hw_chan = fe_chan-1; WAN_ASSERT(card == NULL); - if(!wan_test_bit(channel, &card->wandev.ec_enable_map)){ - return 1; - } card->hw_iface.bus_read_4( card->hw, AFT_REMORA_MUX_TS_EC_ENABLE, &value); if (enable){ - if (!wan_test_and_set_bit(channel,&card->wandev.ec_map)) { - value |= (1 << channel); - } else { - DEBUG_EVENT("[HWEC]: %s: %s bypass mode overrun detected for channel %d!\n", - card->devname, - (enable) ? "Enable" : "Disable", - channel); - return 0; - } + value |= (1 << hw_chan); } else { - if (wan_test_and_clear_bit(channel,&card->wandev.ec_map)) { - value &= ~(1 << channel); - } else { - DEBUG_EVENT("[HWEC]: %s: %s bypass mode overrun detected for channel %d!\n", - card->devname, - (enable) ? "Enable" : "Disable", - channel); - return 0; - } + value &= ~(1 << fe_chan); } + DEBUG_HWEC("[HWEC]: %s: %s bypass mode for fe_chan:%d (value=%X)...!\n", + card->devname, + (enable) ? "Enable" : "Disable", + fe_chan, value); card->hw_iface.bus_write_4( card->hw, AFT_REMORA_MUX_TS_EC_ENABLE, value); - DEBUG_HWEC("[HWEC]: %s: %s bypass mode for channel %d (value=%X)!\n", - card->devname, - (enable) ? "Enable" : "Disable", - channel, - value); - return 0; } #endif diff --git a/patches/kdrivers/src/net/aft_bri.c b/patches/kdrivers/src/net/aft_bri.c new file mode 100755 index 0000000..7200967 --- /dev/null +++ b/patches/kdrivers/src/net/aft_bri.c @@ -0,0 +1,1818 @@ +/***************************************************************************** +* aft_bri.c +* +* WANPIPE(tm) ISDN BRI Hardware Support +* +* Authors: David Rokhvarg +* +* Copyright: (c) 2003-2005 Sangoma Technologies 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. +* ============================================================================ +* Nov 9, 2006 David Rokhvarg Initial Version +*****************************************************************************/ + +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) + +# include +# include +# include +# include /* Socket Driver common area */ +# include +# include +# include + +#elif defined(__WINDOWS__) + +# include +# include +# include + +# include +# include /* Socket Driver common area */ +# include +# include + +# include + +extern +void +sdla_te_timer( + IN PKDPC, + void*, + void*, + void* + ); + +#else + +/* L I N U X */ + +# include +# include +# include +# include +# include +# include /* Socket Driver common area */ +# include +# include +# include +# include +# include + +#endif + +#undef BRI_DBG + +#if 0 +#warning "BRI_DBG - Debugging Enabled" +#define BRI_DBG if(1)DEBUG_EVENT +#else +#define BRI_DBG if(0)DEBUG_EVENT +#endif + +#if 0 +#warning "DEBUG_REG - Debugging Enabled" +#undef DEBUG_REG +#define DEBUG_REG if(0)DEBUG_EVENT +#endif + +#if 0 +#warning "DEBUG_BRI - Debugging Enabled" +#undef DEBUG_BRI +#define DEBUG_BRI if(0)DEBUG_EVENT +#endif + +#if 0 +#warning "BRI_FUNC - Debugging Enabled" +#undef BRI_FUNC() +#define BRI_FUNC() DEBUG_EVENT("%s(): Line: %d\n", __FUNCTION__, __LINE__) +#endif + + + +static inline void aft_set_bri_fifo_map(sdla_t *card, int port, unsigned int map) +{ + if (port >= MAX_BRI_MODULES) { + card->u.aft.fifo_addr_map_l2 |= map; + } else { + card->u.aft.fifo_addr_map |= map; + } +} + +static inline void aft_clear_bri_fifo_map(sdla_t *card, unsigned int map) +{ + if (WAN_FE_LINENO(&card->fe) >= MAX_BRI_MODULES) { + card->u.aft.fifo_addr_map_l2 &= map; + } else { + card->u.aft.fifo_addr_map &= map; + } +} + +static inline unsigned long aft_get_bri_fifo_map(sdla_t *card) +{ + if (WAN_FE_LINENO(&card->fe) >= MAX_BRI_MODULES) { + return card->u.aft.fifo_addr_map_l2; + } + return card->u.aft.fifo_addr_map; +} + + +/*============================================== + * PRIVATE FUNCITONS + * + */ +#if defined(CONFIG_WANPIPE_HWEC) +static int aft_bri_hwec_reset(void *pcard, int reset); +static int aft_bri_hwec_enable(void *pcard, int enable, int fe_chan); +#endif + +static int +read_bri_fe_byte(sdla_t *card, unsigned char mod_no, unsigned char reg, unsigned char *value, + unsigned char type, unsigned char optional_arg); +static int +write_bri_fe_byte(sdla_t *card, unsigned char mod_no, unsigned char addr, unsigned char value); + + +int bri_write_cpld(sdla_t *card, unsigned short off,unsigned char data); + +static int aft_map_fifo_baddr_and_size(sdla_t *card, unsigned char fifo_size, unsigned char *addr); + +static char fifo_size_vector[] = {1, 2, 4, 8, 16, 32}; +static char fifo_code_vector[] = {0, 1, 3, 7,0xF,0x1F}; + +static int request_fifo_baddr_and_size(sdla_t *card, private_area_t *chan) +{ + unsigned char req_fifo_size,fifo_size; + int i; + + BRI_FUNC(); + + /* Calculate the optimal fifo size based + * on the number of time slots requested */ + + if (chan->num_of_time_slots == 1) { + req_fifo_size=1; + } else if (chan->num_of_time_slots == 2 || chan->num_of_time_slots == 3) { + req_fifo_size=2; + } else { + DEBUG_EVENT("%s:%s: Invalid number of timeslots %d\n", + card->devname,chan->if_name,chan->num_of_time_slots); + return -EINVAL; + } + + + for (i=0;ife);i++){ + + /* This loop will not run when FE_LINE==0 */ + + /* Each bri line is separate, thus + we must account for the line number + and recognize that other cards + have requested fifo */ + DEBUG_TEST("%s: Presetting Fifo: Line=%i, Value=0x%08X\n", + card->devname,i,(0x03 << i%MAX_BRI_MODULES)*2); + aft_set_bri_fifo_map(card,i,(0x03 << (i%MAX_BRI_MODULES)*2)); + } + + DEBUG_BRI("%s:%s: Optimal Fifo Size =%d Timeslots=%d FifoMap=0x%08lX\n", + card->devname,chan->if_name,req_fifo_size,chan->num_of_time_slots, + aft_get_bri_fifo_map(card)); + + fifo_size=(u8)aft_map_fifo_baddr_and_size(card,req_fifo_size,&chan->fifo_base_addr); + if (fifo_size == 0 || chan->fifo_base_addr == 31){ + DEBUG_EVENT("%s:%s: Error: Failed to obtain fifo size %d or addr %d \n", + card->devname,chan->if_name,fifo_size,chan->fifo_base_addr); + return -EINVAL; + } + + DEBUG_TEST("%s:%s: Optimal Fifo Size =%d Timeslots=%d New Fifo Size=%d \n", + card->devname,chan->if_name,req_fifo_size,chan->num_of_time_slots,fifo_size); + + + for (i=0;ififo_size_code=fifo_code_vector[i]; + break; + } + } + + if (fifo_size != req_fifo_size){ + DEBUG_EVENT("%s:%s: Warning: Failed to obtain the req fifo %d got %d\n", + card->devname,chan->if_name,req_fifo_size,fifo_size); + } + + DEBUG_TEST("%s: %s:Fifo Size=%d Timeslots=%d Fifo Code=%d Addr=%d\n", + card->devname,chan->if_name,fifo_size, + chan->num_of_time_slots,chan->fifo_size_code, + chan->fifo_base_addr); + + chan->fifo_size = fifo_size; + + return 0; +} + + +static int aft_map_fifo_baddr_and_size(sdla_t *card, unsigned char fifo_size, unsigned char *addr) +{ + u32 reg=0; + u8 i; + + BRI_FUNC(); + + for (i=0;idevname,reg,aft_get_bri_fifo_map(card)); + + for (i=0;i<32;i+=fifo_size){ + if (aft_get_bri_fifo_map(card) & (reg<fe), (reg<devname,aft_get_bri_fifo_map(card)p,i); + + return fifo_size; + } + + if (fifo_size == 1){ + return 0; + } + + fifo_size = fifo_size >> 1; + + return aft_map_fifo_baddr_and_size(card,fifo_size,addr); +} + + +static int aft_free_fifo_baddr_and_size (sdla_t *card, private_area_t *chan) +{ + u32 reg=0; + int i; + + BRI_FUNC(); + + for (i=0;ififo_size;i++){ + wan_set_bit(i,®); + } + + DEBUG_TEST("%s: Unmapping 0x%X from 0x%lX\n", + card->devname,reg<fifo_base_addr, aft_get_bri_fifo_map(card)); + + aft_clear_bri_fifo_map(card, ~(reg<fifo_base_addr)) + + DEBUG_TEST("%s: New Map is 0x%lX\n", + card->devname, aft_get_bri_fifo_map(card)); + + + chan->fifo_size=0; + chan->fifo_base_addr=0; + + return 0; +} + + +static int aft_request_logical_channel_num (sdla_t *card, private_area_t *chan) +{ + signed char logic_ch=-1; + int err; + int if_cnt=wan_atomic_read(&card->wandev.if_cnt); + int if_offset=2; + long i; + + BRI_FUNC(); + + DEBUG_TEST("-- Request_Xilinx_logic_channel_num:-- (if_offset=%i)\n",if_offset); + + DEBUG_TEST("%s:%d Global Num Timeslots=%d Global Logic ch Map 0x%lX \n", + __FUNCTION__,__LINE__, + card->u.aft.num_of_time_slots, + card->u.aft.logic_ch_map); + + + /* Check that the time slot is not being used. If it is + * stop the interface setup. Notice, though we proceed + * to check for all timeslots before we start binding + * the channels in. This way, we don't have to go back + * and clean the time_slot_map */ + for (i=0;iu.aft.num_of_time_slots;i++){ + if (wan_test_bit(i,&chan->time_slot_map)){ + + if (chan->first_time_slot == -1){ + DEBUG_EVENT("%s: First TSlot :%ld\n", + card->devname,i); + chan->first_time_slot=i; + } + + chan->last_time_slot=i; + + DEBUG_CFG("%s: Configuring %s for timeslot %ld\n", + card->devname, chan->if_name,i+1); + + if (wan_test_bit(i,&card->u.aft.time_slot_map)){ + DEBUG_EVENT("%s: Channel/Time Slot resource conflict!\n", + card->devname); + DEBUG_EVENT("%s: %s: Channel/Time Slot %ld, aready in use!\n", + card->devname,chan->if_name,(i+1)); + + return -EEXIST; + } + } + } + + + err=request_fifo_baddr_and_size(card,chan); + if (err){ + return -1; + } + + for (i=0;iu.aft.num_of_time_slots;i++){ + if (wan_test_bit(i,&chan->time_slot_map)){ + if (card->u.aft.security_id == 0){ + /* Unchannelized card must config + * its hdlc logic ch on FIRST logic + * ch number */ + + if (chan->channelized_cfg) { + if (card->u.aft.tdmv_dchan){ + /* In this case we KNOW that there is + * only a single hdlc channel */ + if (i==0 && !chan->hdlc_eng){ + continue; + } + } + }else{ + if (i==0 || i==1){ + if (!chan->hdlc_eng && + if_cnt < (card->u.aft.num_of_time_slots-if_offset)){ + continue; + } + } + } + } + + if (!wan_test_and_set_bit(i,&card->u.aft.logic_ch_map)){ + logic_ch=(char)i; + break; + } + } + } + + if (logic_ch == -1){ + return logic_ch; + } + + for (i=0;iu.aft.num_of_time_slots;i++){ + if (!wan_test_bit(i,&card->u.aft.logic_ch_map)){ + break; + } + } + + if (card->u.aft.dev_to_ch_map[(unsigned char)logic_ch]){ + DEBUG_EVENT("%s: Error, request logical ch=%d map busy\n", + card->devname,logic_ch); + return -1; + } + + card->u.aft.dev_to_ch_map[(unsigned char)logic_ch]=(void*)chan; + + if (logic_ch >= card->u.aft.top_logic_ch){ + card->u.aft.top_logic_ch=logic_ch; + aft_dma_max_logic_ch(card); + } + + DEBUG_CFG("!!! %s: Binding logic ch %d Ptr=%p\n",chan->if_name,logic_ch,chan); + return logic_ch; +} + + + +static int aft_test_hdlc(sdla_t *card) +{ + int i; + int err; + u32 reg; + + BRI_FUNC(); + + for (i=0;i<10;i++){ + card->hw_iface.bus_read_4(card->hw,AFT_CHIP_CFG_REG, ®); + + if (!wan_test_bit(AFT_CHIPCFG_HDLC_CTRL_RDY_BIT,®) || + !wan_test_bit(AFT_CHIPCFG_RAM_READY_BIT,®)){ + /* The HDLC Core is not ready! we have + * an error. */ + err = -EINVAL; + WP_DELAY(200); + }else{ + err=0; + break; + } + } + + return err; +} + + +/*============================================== + * PUBLIC FUNCITONS + * + */ + +int aft_bri_test_sync(sdla_t *card, int tx_only) +{ + volatile int i,err=1; + u32 reg; + + BRI_FUNC(); + + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG), ®); + + if (wan_test_bit(AFT_LCFG_FE_IFACE_RESET_BIT,®)){ + DEBUG_EVENT("%s: Warning: BRI Reset Enabled %d! \n", + card->devname, card->wandev.comm_port+1); + } + + for (i=0;i<500;i++){ + + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG), ®); + if (tx_only){ + if (wan_test_bit(AFT_LCFG_TX_FE_SYNC_STAT_BIT,®)){ + err=-1; + WP_DELAY(200); + }else{ + err=0; + break; + } + }else{ + if (wan_test_bit(AFT_LCFG_TX_FE_SYNC_STAT_BIT,®) || + wan_test_bit(AFT_LCFG_RX_FE_SYNC_STAT_BIT,®)){ + err=-1; + WP_DELAY(200); + }else{ + err=0; + break; + } + } + } + + DEBUG_BRI("%s: DELAY INDEX = %i, AFT_LINE_CFG_REG: 0x%X\n", + card->devname,i, reg); + + return err; +} + +int aft_bri_led_ctrl(sdla_t *card, int color, int led_pos, int on) +{ + BRI_FUNC(); + /* no control over LEDs on BRI card */ + return 0; +} + + +int aft_bri_cpld0_set(sdla_t *card, int hwec_reset) +{ + u8 cpld_reg=0; + u32 reg=0; + + card->hw_iface.bus_read_4(card->hw,AFT_CHIP_CFG_REG,®); + + if (hwec_reset) { + /* Reset ECHO Canceler */ + wan_clear_bit(BRI_CPLD0_ECHO_RESET_BIT,&cpld_reg); + } else { + /* Clear Reset Echo Canceler */ + wan_set_bit(BRI_CPLD0_ECHO_RESET_BIT,&cpld_reg); + } + + /* If the jumper is used as a network sync we must + * configure the CPLD for INPUT, Otherwise send the clock + * out as OUTPUT */ + if (wan_test_bit(AFT_CHIPCFG_A500_NET_SYNC_CLOCK_SELECT_BIT,®)) { + wan_clear_bit(BRI_CPLD0_NETWORK_SYNC_OUT_BIT,&cpld_reg); + } else { + wan_set_bit(BRI_CPLD0_NETWORK_SYNC_OUT_BIT,&cpld_reg); + } + + DEBUG_TEST("%s: Writing to CPLD0 0x%02X (REG=0x%08X)\n", + card->devname,cpld_reg,reg); + + aft_bri_write_cpld(card,0x00,cpld_reg); + + return 0; +} + + +int aft_bri_global_chip_config(sdla_t *card) +{ + u32 reg; + int err=0; + wan_smp_flag_t smp_flags,flags; + + BRI_FUNC(); + + //FIME: hardcoded + card->u.aft.firm_id = AFT_DS_FE_CORE_ID; + + /*============ GLOBAL CHIP CONFIGURATION ===============*/ + + /* Enable the chip/hdlc reset condition */ + reg=0; + wan_set_bit(AFT_CHIPCFG_SFR_EX_BIT,®); + wan_set_bit(AFT_CHIPCFG_SFR_IN_BIT,®); + + DEBUG_CFG("--- AFT Chip Reset. -- \n"); + + card->hw_iface.bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); + + WP_DELAY(10); + + /* Disable the chip/hdlc reset condition */ + wan_clear_bit(AFT_CHIPCFG_SFR_EX_BIT,®); + wan_clear_bit(AFT_CHIPCFG_SFR_IN_BIT,®); + + wan_clear_bit(AFT_CHIPCFG_FE_INTR_CFG_BIT,®); + + if (!IS_BRI_CARD(card)) { + DEBUG_EVENT("%s: Error: Xilinx doesn't support non BRI interface!\n", + card->devname); + return -EINVAL; + } + + DEBUG_CFG("--- Chip enable/config. -- \n"); + + if (card->fe.fe_cfg.cfg.remora.network_sync) { + DEBUG_EVENT("%s: ISDN BRI Clock set to (External) Network Sync!\n", + card->devname); + wan_set_bit(AFT_CHIPCFG_A500_NET_SYNC_CLOCK_SELECT_BIT,®); + } else { + wan_clear_bit(AFT_CHIPCFG_A500_NET_SYNC_CLOCK_SELECT_BIT,®); + + } + + card->hw_iface.bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); + + card->hw_iface.hw_lock(card->hw,&smp_flags); + wan_spin_lock_irq(&card->wandev.lock,&flags); + + /* Reset HWEC and Set CPLD based on network sync */ + aft_bri_cpld0_set(card,1); + + wan_spin_unlock_irq(&card->wandev.lock,&flags); + card->hw_iface.hw_unlock(card->hw,&smp_flags); + + err=aft_test_hdlc(card); + if (err != 0){ + DEBUG_EVENT("%s: Error: HDLC Core Not Ready (0x%X)!\n", + card->devname,reg); + return -EINVAL; + } else{ + DEBUG_CFG("%s: HDLC Core Ready\n", + card->devname); + } + err = -EINVAL; + if (card->wandev.fe_iface.global_config){ + err=card->wandev.fe_iface.global_config(&card->fe); + } + if (err){ + return err; + } + + aft_fe_intr_ctrl(card, 1); + + return 0; + +} + +int aft_bri_global_chip_unconfig(sdla_t *card) +{ + u32 reg=0; + + BRI_FUNC(); + + /* Global BRI unconfig */ + if (card->wandev.fe_iface.global_unconfig){ + card->wandev.fe_iface.global_unconfig(&card->fe); + } + + /* Set Octasic to reset */ + aft_bri_cpld0_set(card,1); + + /* Disable the chip/hdlc reset condition */ + wan_set_bit(AFT_CHIPCFG_SFR_EX_BIT,®); + wan_set_bit(AFT_CHIPCFG_SFR_IN_BIT,®); + wan_clear_bit(AFT_CHIPCFG_FE_INTR_CFG_BIT,®); + + card->hw_iface.bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); + + return 0; +} + + +int aft_bri_hwec_config(sdla_t *card, wandev_conf_t *conf) +{ + /* Enable Octasic Chip */ + u16 max_ec_chans, max_ports_no; + u32 cfg_reg, fe_port_map; + + + card->wandev.ec_dev = NULL; + card->wandev.hwec_reset = NULL; + card->wandev.hwec_enable = NULL; + + card->hw_iface.getcfg(card->hw, SDLA_HWEC_NO, &max_ec_chans); + card->hw_iface.getcfg(card->hw, SDLA_PORTS_NO, &max_ports_no); + card->hw_iface.getcfg(card->hw, SDLA_PORT_MAP, &fe_port_map); + + card->hw_iface.bus_read_4(card->hw,AFT_CHIP_CFG_REG, &cfg_reg); + + if (max_ec_chans > A500_MAX_EC_CHANS){ + DEBUG_EVENT( + "%s: Critical Error: Exceeded Maximum Available Echo Channels!\n", + card->devname); + DEBUG_EVENT( + "%s: Critical Error: Max Allowed=%d Configured=%d (%X)\n", + card->devname, + A500_MAX_EC_CHANS, + max_ec_chans, + cfg_reg); + return -EINVAL; + } + + if (max_ec_chans){ +#if defined(CONFIG_WANPIPE_HWEC) + max_ports_no = 2;/* number of B-chans on BRI line is 2 */ + card->wandev.ec_dev = wanpipe_ec_register( + card, + fe_port_map, + max_ports_no, + max_ec_chans, + (void*)&conf->oct_conf); + + if (!card->wandev.ec_dev) { + DEBUG_EVENT( + "%s: Failed to register device in HW Echo Canceller module!\n", + card->devname); + return -EINVAL; + } + + card->wandev.hwec_reset = aft_bri_hwec_reset; + card->wandev.hwec_enable = aft_bri_hwec_enable; + + if (card->fe.fe_cfg.cfg.bri.clock_mode == WANOPT_FE_LINE_CLOCK) { + wan_event_ctrl_t *event = wan_malloc(sizeof(wan_event_ctrl_t)); + if (event) { + memset(event,0,sizeof(wan_event_ctrl_t)); + event->type=WAN_EVENT_EC_H100_REPORT; + event->mode=WAN_EVENT_DISABLE; + wanpipe_ec_event_ctrl(card->wandev.ec_dev,card,event); + DEBUG_EVENT("%s: Wanpipe HW Echo Canceller H100 Ignore!\n", + card->devname); + } + } +#else + DEBUG_EVENT("%s: Wanpipe HW Echo Canceller modele is not compiled!\n", + card->devname); +#endif + }else{ + DEBUG_EVENT( + "%s: WARNING: No Echo Canceller channels are available!\n", + card->devname); + } + + return 0; +} + +int aft_bri_chip_config(sdla_t *card, wandev_conf_t *conf) +{ + u32 reg=0, ctrl_ram_reg=0; + int i,err=0; + wan_smp_flag_t smp_flags; + int used_cnt; + u32 physical_card_config_counter; + + BRI_FUNC(); + + + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &used_cnt); + + /* Check for NETWORK SYNC IN Clocking, if network sync in + * is enabled ignore all clock_modes */ + card->hw_iface.bus_read_4(card->hw,AFT_CHIP_CFG_REG,®); + if (wan_test_bit(AFT_CHIPCFG_A500_NET_SYNC_CLOCK_SELECT_BIT,®)) { + card->fe.fe_cfg.cfg.bri.clock_mode=0; + } + + reg=0; + + if (used_cnt > 1) { + card->hw_iface.hw_lock(card->hw,&smp_flags); + + aft_fe_intr_ctrl(card, 0); + + err = -EINVAL; + if (card->wandev.fe_iface.config){ + err=card->wandev.fe_iface.config(&card->fe); + } + + aft_fe_intr_ctrl(card, 1); + + card->hw_iface.hw_unlock(card->hw,&smp_flags); + + if (err) { + DEBUG_EVENT("%s: Failed BRI configuration!\n", + card->devname); + return err; + } + + if (card->wandev.fe_iface.post_init){ + err=card->wandev.fe_iface.post_init(&card->fe); + } + + + err=aft_bri_hwec_config(card,conf); + + return err; + } + + + /*========================================================== + * This section of the code will run only ONCE + * On VERY FIRST BRI Module config + *=========================================================*/ + + card->hw_iface.hw_lock(card->hw,&smp_flags); + + aft_fe_intr_ctrl(card, 0); + + err = -EINVAL; + if (card->wandev.fe_iface.config){ + err=card->wandev.fe_iface.config(&card->fe); + } + + if (err == 0) { + aft_bri_led_ctrl(card, WAN_AFT_RED, 0,WAN_AFT_ON); + aft_bri_led_ctrl(card, WAN_AFT_GREEN, 0, WAN_AFT_OFF); + aft_fe_intr_ctrl(card, 1); + } + + card->hw_iface.hw_unlock(card->hw,&smp_flags); + + if (err){ + DEBUG_EVENT("%s: Failed BRI configuration!\n", + card->devname); + return -EINVAL; + } + /* Run rest of initialization not from lock */ + if (card->wandev.fe_iface.post_init){ + err=card->wandev.fe_iface.post_init(&card->fe); + } + + DEBUG_EVENT("%s: Front end successful\n", + card->devname); + + + /*============ LINE/PORT CONFIG REGISTER ===============*/ + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &physical_card_config_counter); + DEBUG_BRI("physical_card_config_counter: %d\n", physical_card_config_counter); + + if (physical_card_config_counter == 1){ + /* FE synch. For BRI reset done only ONCE for both lines */ + card->hw_iface.bus_read_4(card->hw, AFT_PORT_REG(card,AFT_LINE_CFG_REG),®); + wan_set_bit(AFT_LCFG_FE_IFACE_RESET_BIT,®); + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG),reg); + } + + WP_DELAY(10); + + wan_clear_bit(AFT_LCFG_FE_IFACE_RESET_BIT,®); + + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG),reg); + + WP_DELAY(10); + + err=aft_bri_test_sync(card,1); + + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG),®); + if (err != 0){ + DEBUG_EVENT("%s: Error: Front End Interface Not Ready (0x%08X)!\n", + card->devname,reg); + return err; + } else{ + DEBUG_EVENT("%s: Front End Interface Ready 0x%08X\n", + card->devname,reg); + } + + + err=aft_bri_hwec_config(card,conf); + if (err) { + return err; + } + +#if defined(__WINDOWS__) + /*connect to interrupt line and only AFTER THAT enable device's interrupts.*/ + if(connect_to_interrupt_line(card)){ + return 1; + } + /*at this point we can handle front end interrupts*/ + card->init_flag = 0; +#endif + + /* Enable only Front End Interrupt + * Wait for front end to come up before enabling DMA */ + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG), ®); + wan_clear_bit(AFT_LCFG_DMA_INTR_BIT,®); + wan_clear_bit(AFT_LCFG_FIFO_INTR_BIT,®); + wan_clear_bit(AFT_LCFG_TDMV_INTR_BIT,®); + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG), reg); + + card->u.aft.lcfg_reg=reg; + + + /*============ DMA CONTROL REGISTER ===============*/ + + /* Disable Global DMA because we will be + * waiting for the front end to come up */ + reg=0; + aft_dmactrl_set_max_logic_ch(®,0); + wan_clear_bit(AFT_DMACTRL_GLOBAL_INTR_BIT,®); + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),reg); + + + /* Initialize all BRI timeslots ONLY on VERY FIRST BRI module */ + reg=0; + for (i=0;i<32;i++){ + ctrl_ram_reg=AFT_PORT_REG(card,AFT_CONTROL_RAM_ACCESS_BASE_REG); + ctrl_ram_reg+=(i*4); + + aft_ctrlram_set_logic_ch(®,0x1F); + aft_ctrlram_set_fifo_size(®,0); + aft_ctrlram_set_fifo_base(®,0x1F); + + wan_set_bit(AFT_CTRLRAM_HDLC_MODE_BIT,®); + wan_set_bit(AFT_CTRLRAM_HDLC_TXCH_RESET_BIT,®); + wan_set_bit(AFT_CTRLRAM_HDLC_RXCH_RESET_BIT,®); + + card->hw_iface.bus_write_4(card->hw, ctrl_ram_reg, reg); + } + + aft_wdt_reset(card); + + return 0; + +} + +int aft_bri_chip_unconfig(sdla_t *card) +{ + wan_smp_flag_t smp_flags,smp_flags1; + + BRI_FUNC(); + + /* chip unconfig is done in disable_comms() */ + + /* Disable Octasic for this BRI module */ + if (card->wandev.ec_dev){ +#if defined(CONFIG_WANPIPE_HWEC) + DEBUG_EVENT("%s: Unregisterd HWEC\n", + card->devname); + wanpipe_ec_unregister(card->wandev.ec_dev, card); +#else + DEBUG_EVENT("%s: Wanpipe HW Echo Canceller modele is not compiled!\n", + card->devname); +#endif + } + + card->wandev.hwec_enable = NULL; + card->wandev.ec_dev = NULL; + + /* Unconfiging, only on shutdown */ + if (card->wandev.fe_iface.pre_release){ + card->wandev.fe_iface.pre_release(&card->fe); + } + card->hw_iface.hw_lock(card->hw,&smp_flags1); + wan_spin_lock_irq(&card->wandev.lock, &smp_flags); + __aft_fe_intr_ctrl(card,0); + if (card->wandev.fe_iface.unconfig){ + card->wandev.fe_iface.unconfig(&card->fe); + } + __aft_fe_intr_ctrl(card,0); + wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + card->hw_iface.hw_unlock(card->hw,&smp_flags1); + + return 0; +} + +int aft_bri_chan_dev_config(sdla_t *card, void *chan_ptr) +{ + u32 reg; + long i; + int chan_num=-EBUSY; + private_area_t *chan = (private_area_t*)chan_ptr; + u32 ctrl_ram_reg,dma_ram_reg; + + BRI_FUNC(); + + if(chan->dchan_time_slot >= 0){ + BRI_FUNC(); + chan->logic_ch_num = 2; + card->u.aft.dev_to_ch_map[BRI_DCHAN_LOGIC_CHAN]=(void*)chan; + /* configure bri dchan here */ + return 0; + } + + chan_num=aft_request_logical_channel_num(card, chan); + if (chan_num < 0){ + return -EBUSY; + } + chan->logic_ch_num = chan_num; + + dma_ram_reg=AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + dma_ram_reg+=(chan->logic_ch_num*4); + + reg=0; + card->hw_iface.bus_write_4(card->hw, dma_ram_reg, reg); + + card->hw_iface.bus_read_4(card->hw, dma_ram_reg, ®); + + aft_dmachain_set_fifo_size(®, chan->fifo_size_code); + aft_dmachain_set_fifo_base(®, chan->fifo_base_addr); + + /* Initially always disable rx synchronization */ + wan_clear_bit(AFT_DMACHAIN_RX_SYNC_BIT,®); + + /* Enable SS7 if configured by user */ + if (chan->cfg.ss7_enable){ + wan_set_bit(AFT_DMACHAIN_SS7_ENABLE_BIT,®); + }else{ + wan_clear_bit(AFT_DMACHAIN_SS7_ENABLE_BIT,®); + } + + if (chan->channelized_cfg && !chan->hdlc_eng){ + aft_dmachain_enable_tdmv_and_mtu_size(®,chan->mru); + } + + card->hw_iface.bus_write_4(card->hw, dma_ram_reg, reg); + + reg=0; + + + for (i=0;iu.aft.num_of_time_slots;i++){ + + + ctrl_ram_reg=AFT_PORT_REG(card,AFT_CONTROL_RAM_ACCESS_BASE_REG); + ctrl_ram_reg+=(i*4); + + if (wan_test_bit(i,&chan->time_slot_map)){ + + BRI_FUNC(); + + wan_set_bit(i,&card->u.aft.time_slot_map); + + card->hw_iface.bus_read_4(card->hw, ctrl_ram_reg, ®); + + aft_ctrlram_set_logic_ch(®,chan->logic_ch_num); + + if (i == chan->first_time_slot){ + wan_set_bit(AFT_CTRLRAM_SYNC_FST_TSLOT_BIT,®); + } + + aft_ctrlram_set_fifo_size(®,chan->fifo_size_code); + + aft_ctrlram_set_fifo_base(®,chan->fifo_base_addr); + + + if (chan->hdlc_eng){ + wan_set_bit(AFT_CTRLRAM_HDLC_MODE_BIT,®); + }else{ + wan_clear_bit(AFT_CTRLRAM_HDLC_MODE_BIT,®); + } + + if (chan->cfg.data_mux){ + wan_set_bit(AFT_CTRLRAM_DATA_MUX_ENABLE_BIT,®); + }else{ + wan_clear_bit(AFT_CTRLRAM_DATA_MUX_ENABLE_BIT,®); + } + + if (0){ /* FIXME card->fe.fe_cfg.cfg.te1cfg.fcs == 32){ */ + wan_set_bit(AFT_CTRLRAM_HDLC_CRC_SIZE_BIT,®); + }else{ + wan_clear_bit(AFT_CTRLRAM_HDLC_CRC_SIZE_BIT,®); + } + + /* Enable SS7 if configured by user */ + if (chan->cfg.ss7_enable){ + wan_set_bit(AFT_CTRLRAM_SS7_ENABLE_BIT,®); + }else{ + wan_clear_bit(AFT_CTRLRAM_SS7_ENABLE_BIT,®); + } + + wan_clear_bit(AFT_CTRLRAM_HDLC_TXCH_RESET_BIT,®); + wan_clear_bit(AFT_CTRLRAM_HDLC_RXCH_RESET_BIT,®); + + DEBUG_CFG("%s: Configuring %s LC=%i for timeslot %ld : Offset 0x%X Reg 0x%X\n", + card->devname, chan->if_name, chan->logic_ch_num, i, + ctrl_ram_reg,reg); + + card->hw_iface.bus_write_4(card->hw, ctrl_ram_reg, reg); + + } + } + + + if (chan->channelized_cfg && !chan->hdlc_eng){ + + BRI_FUNC(); + + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG),®); + aft_lcfg_tdmv_cnt_inc(®); + + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG),reg); + card->u.aft.lcfg_reg=reg; + + wan_set_bit(chan->logic_ch_num,&card->u.aft.tdm_logic_ch_map); + + DEBUG_TEST("%s: TDMV CNT = %i\n", + card->devname, + (reg>>AFT_LCFG_TDMV_CH_NUM_SHIFT)&AFT_LCFG_TDMV_CH_NUM_MASK); + } + + return 0; +} + +int aft_bri_chan_dev_unconfig(sdla_t *card, void *chan_ptr) +{ + private_area_t *chan = (private_area_t *)chan_ptr; + volatile int i; + u32 dma_ram_reg,ctrl_ram_reg,reg; + + DEBUG_BRI("%s: 1 BRI DEV UNCONFIG %i\n", + card->devname, chan->logic_ch_num); + + if( chan->dchan_time_slot >= 0) { + + DEBUG_BRI("%s: 2 BRI DEV DCHAN UNCONFIG %i\n", + card->devname, chan->logic_ch_num); + + chan->logic_ch_num = 2; + card->u.aft.dev_to_ch_map[BRI_DCHAN_LOGIC_CHAN]=NULL; + /* configure bri dchan here */ + return 0; + } + + /* Select an HDLC logic channel for configuration */ + if (chan->logic_ch_num != -1){ + + DEBUG_BRI("%s: 2 BRI DEV UNCONFIG %i\n", + card->devname, chan->logic_ch_num); + + dma_ram_reg=AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + dma_ram_reg+=(chan->logic_ch_num*4); + + card->hw_iface.bus_read_4(card->hw, dma_ram_reg, ®); + + aft_dmachain_set_fifo_base(®,0x1F); + aft_dmachain_set_fifo_size(®,0); + card->hw_iface.bus_write_4(card->hw, dma_ram_reg, reg); + + + for (i=0;iu.aft.num_of_time_slots;i++){ + if (wan_test_bit(i,&chan->time_slot_map)){ + BRI_FUNC(); + ctrl_ram_reg=AFT_PORT_REG(card,AFT_CONTROL_RAM_ACCESS_BASE_REG); + ctrl_ram_reg+=(i*4); + + reg=0; + aft_ctrlram_set_logic_ch(®,0x1F); + + aft_ctrlram_set_fifo_base(®,0x1F); + aft_ctrlram_set_fifo_size(®,0); + + wan_set_bit(AFT_CTRLRAM_HDLC_MODE_BIT,®); + wan_set_bit(AFT_CTRLRAM_HDLC_TXCH_RESET_BIT,®); + wan_set_bit(AFT_CTRLRAM_HDLC_RXCH_RESET_BIT,®); + + card->hw_iface.bus_write_4(card->hw, ctrl_ram_reg, reg); + } + } + + aft_free_logical_channel_num(card,chan->logic_ch_num); + aft_free_fifo_baddr_and_size(card,chan); + + for (i=0;iu.aft.num_of_time_slots;i++){ + if (wan_test_bit(i,&chan->time_slot_map)){ + wan_clear_bit(i,&card->u.aft.time_slot_map); + } + } + + if (chan->channelized_cfg && !chan->hdlc_eng){ + BRI_FUNC(); + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_LINE_CFG_REG),®); + aft_lcfg_tdmv_cnt_dec(®); + card->hw_iface.bus_write_4(card->hw, + AFT_PORT_REG(card,AFT_LINE_CFG_REG),reg); + wan_clear_bit(chan->logic_ch_num,&card->u.aft.tdm_logic_ch_map); + DEBUG_TEST("%s: TDMV CNT = %i\n", + card->devname, + (reg>>AFT_LCFG_TDMV_CH_NUM_SHIFT)&AFT_LCFG_TDMV_CH_NUM_MASK); + } + + /* Do not clear the logi_ch_num here. + We will do it at the end of del_if_private() funciton */ + } + + return 0; +} + +int bri_check_ec_security(sdla_t *card) +{ + u32 cfg_reg; + u32 security_bit=AFT_CHIPCFG_A500_EC_SECURITY_BIT; + + card->hw_iface.bus_read_4(card->hw,AFT_CHIP_CFG_REG, &cfg_reg); + if (wan_test_bit(security_bit,&cfg_reg)){ + return 1; + } + return 0; +} + + +unsigned char aft_bri_read_cpld(sdla_t *card, unsigned short cpld_off) +{ + u8 tmp=0; + int err = -EINVAL; + + BRI_FUNC(); + + if (card->hw_iface.fe_test_and_set_bit(card->hw,0)){ + DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", + card->devname, __FUNCTION__,__LINE__); + return 0x00; + } + + if (card->hw_iface.read_cpld){ + err = card->hw_iface.read_cpld(card->hw, (u16)cpld_off, &tmp); + } + + card->hw_iface.fe_clear_bit(card->hw,0); + + return tmp; +} + +int aft_bri_write_cpld(sdla_t *card, unsigned short off,unsigned short data) +{ + int err = -EINVAL; + + BRI_FUNC(); + + + if (card->hw_iface.fe_test_and_set_bit(card->hw,0)){ + DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", + card->devname, __FUNCTION__,__LINE__); + return 0x00; + } + + if (card->hw_iface.write_cpld){ + err = card->hw_iface.write_cpld(card->hw, (u16)off, (u8)data); + } + + card->hw_iface.fe_clear_bit(card->hw,0); + + return 0; +} + + +int bri_write_cpld(sdla_t *card, unsigned short off,unsigned char data) +{ + u16 org_off; + + BRI_FUNC(); + + if (card->hw_iface.fe_test_and_set_bit(card->hw,0)){ + DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", + card->devname, __FUNCTION__,__LINE__); + return 0x00; + } + + off &= ~AFT8_BIT_DEV_ADDR_CLEAR; + off |= AFT8_BIT_DEV_MAXIM_ADDR_CPLD; + + /*ALEX: Save the current original address */ + card->hw_iface.bus_read_2(card->hw, + AFT_MCPU_INTERFACE_ADDR, + &org_off); + + /* This delay is required to avoid bridge optimization + * (combining two writes together)*/ + WP_DELAY(5); + + card->hw_iface.bus_write_2(card->hw, + AFT_MCPU_INTERFACE_ADDR, + off); + + /* This delay is required to avoid bridge optimization + * (combining two writes together)*/ + WP_DELAY(5); + + card->hw_iface.bus_write_1(card->hw, + AFT_MCPU_INTERFACE, + data); + /*ALEX: Restore the original address */ + card->hw_iface.bus_write_2(card->hw, + AFT_MCPU_INTERFACE_ADDR, + org_off); + card->hw_iface.fe_clear_bit(card->hw,0); + + return 0; +} + + +void aft_bri_fifo_adjust(sdla_t *card, u32 level) +{ + u32 fifo_size,reg; + card->hw_iface.bus_read_4(card->hw, AFT_FIFO_MARK_REG, &fifo_size); + + BRI_FUNC(); + + aft_fifo_mark_gset(®,(u8)level); + + if (level == 1) { + /* FIXME: This is a kluge. Have fifo adjust for each + fifo size + For 32 bit fifo if level is 1 set it to zero */ + reg&=~(0x1); + } + + if (fifo_size == reg){ + return; + } + + card->hw_iface.bus_write_4(card->hw, AFT_FIFO_MARK_REG, reg); + DEBUG_EVENT("%s: Fifo Level Map:0x%08X\n",card->devname,reg); +} + + +#if defined(CONFIG_WANPIPE_HWEC) +static int aft_bri_hwec_reset(void *pcard, int reset) +{ + sdla_t *card = (sdla_t*)pcard; + wan_smp_flag_t smp_flags; + wan_smp_flag_t flags; + int err = -EINVAL; + + card->hw_iface.hw_lock(card->hw,&smp_flags); + wan_spin_lock_irq(&card->wandev.lock,&flags); + if (!reset){ + DEBUG_EVENT("%s: Clear Echo Canceller chip reset.\n", + card->devname); + + /* Clear RESET on HWEC */ + aft_bri_cpld0_set(card,0); + + WP_DELAY(1000); + err = 0; + + }else{ + DEBUG_EVENT("%s: Set Echo Canceller chip reset.\n", + card->devname); + + /* RESET HWEC */ + aft_bri_cpld0_set(card,1); + + err = 0; + } + wan_spin_unlock_irq(&card->wandev.lock,&flags); + card->hw_iface.hw_unlock(card->hw,&smp_flags); + return err; +} +#endif + +#if defined(CONFIG_WANPIPE_HWEC) +/****************************************************************************** +** aft_bri_hwec_enable() +** +** Return: 0 - success +** 1 - channel out of channel map +** < 0 - failed +******************************************************************************/ +static int aft_bri_hwec_enable(void *pcard, int enable, int fe_chan) +{ + sdla_t *card = (sdla_t*)pcard; + unsigned int value, new_chan, bri_chan; + + DEBUG_HWEC("%s(): pcard: 0x%p\n", __FUNCTION__, pcard); + + WAN_ASSERT(card == NULL); + + DEBUG_HWEC("[HWEC BRI]: %s: %s bypass mode for channel %d, LineNo: %d!\n", + card->devname, + (enable) ? "Enable" : "Disable", + fe_chan, WAN_FE_LINENO(&card->fe)); + + /* make sure channel is 0 or 1, nothing else!! */ + if(fe_chan != 1 && fe_chan != 2){ + DEBUG_HWEC("[HWEC BRI]: %s: invalid channel %d. Must be 1 or 2!\n", + card->devname, fe_chan); + return -EINVAL; + } + + new_chan = 2 * WAN_FE_LINENO(&card->fe); /* 0, 2, 4...*/ + bri_chan = new_chan + (fe_chan-1); /* {0,1}, {2,3}, {4,5}... */ + + DEBUG_HWEC("bri_chan: %d\n", bri_chan); + + DEBUG_BRI("Offset: 0x%X!\n", AFT_PORT_REG(card,0x1000) + bri_chan * 4); + + card->hw_iface.bus_read_4( + card->hw, + AFT_PORT_REG(card,0x1000) + bri_chan * 4, + &value); + if (enable){ + value |= 0x20; + }else{ + value &= ~0x20; + } + + DEBUG_HWEC("[HWEC BRI]: %s: writing: 0x%08X!\n",card->devname, value); + + card->hw_iface.bus_write_4( + card->hw, + AFT_PORT_REG(card,0x1000) + bri_chan * 4, + value); + + return 0; +} +#endif + + +/*************************************************************************** + BRI card +***************************************************************************/ + +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_BRI) + +/*============================================================================ + * Write BRI register + */ + +int aft_bri_write_fe(void* pcard, ...) +{ + va_list args; + sdla_t *card = (sdla_t*)pcard; + int mod_no, type, chain, reg, value; +#if defined(WAN_DEBUG_FE) + char *fname; + int fline; +#endif + + WAN_ASSERT(card == NULL); + WAN_ASSERT(card->hw_iface.bus_write_4 == NULL); + WAN_ASSERT(card->hw_iface.bus_read_4 == NULL); + + va_start(args, pcard); + mod_no = va_arg(args, int); + type = va_arg(args, int); + chain = va_arg(args, int); + reg = va_arg(args, int); + value = va_arg(args, int); +#if defined(WAN_DEBUG_FE) + fname = va_arg(args, char*); + fline = va_arg(args, int); +#endif + va_end(args); + + if (card->hw_iface.fe_test_and_set_bit(card->hw,0)){ +#if defined(WAN_DEBUG_FE) + DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE (%s:%d)!\n", + card->devname, __FUNCTION__,__LINE__, fname, fline); +#else + DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", + card->devname, __FUNCTION__,__LINE__); +#endif + return -EINVAL; + } + + write_bri_fe_byte(card, mod_no, reg, value); + + card->hw_iface.fe_clear_bit(card->hw,0); + return 0; +} + + +/*============================================================================ + * Read bri register + */ + +unsigned char aft_bri_read_fe (void* pcard, ...) +{ + va_list args; + sdla_t *card = (sdla_t*)pcard; + int mod_no, type, optional_arg, reg; + unsigned char data = 0; +#if defined(WAN_DEBUG_FE) + char *fname; + int fline; +#endif + + WAN_ASSERT(card == NULL); + WAN_ASSERT(card->hw_iface.bus_write_4 == NULL); + WAN_ASSERT(card->hw_iface.bus_read_4 == NULL); + + va_start(args, pcard); + mod_no = va_arg(args, int); + type = va_arg(args, int); + optional_arg = va_arg(args, int); + reg = va_arg(args, int); +#if defined(WAN_DEBUG_FE) + fname = va_arg(args, char*); + fline = va_arg(args, int); +#endif + va_end(args); + + if (card->hw_iface.fe_test_and_set_bit(card->hw,0)){ +#if defined(WAN_DEBUG_FE) + DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE (%s:%d)!\n", + card->devname, __FUNCTION__,__LINE__,fname,fline); +#else + DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", + card->devname, __FUNCTION__,__LINE__); +#endif + return 0x00; + } + + read_bri_fe_byte(card, mod_no, reg, &data, type, optional_arg); + + card->hw_iface.fe_clear_bit(card->hw,0); + return data; +} + +/*============================================================================ + * Read bri register - debugging version + */ + +unsigned char __aft_bri_read_fe (void* pcard, ...) +{ + va_list args; + sdla_t *card = (sdla_t*)pcard; + int mod_no, type, optional_arg, reg; + unsigned char data = 0; +#if defined(WAN_DEBUG_FE) + char *fname; + int fline; +#endif + + WAN_ASSERT(card == NULL); + WAN_ASSERT(card->hw_iface.bus_write_4 == NULL); + WAN_ASSERT(card->hw_iface.bus_read_4 == NULL); + + va_start(args, pcard); + mod_no = va_arg(args, int); + type = va_arg(args, int); + optional_arg = va_arg(args, int); + reg = va_arg(args, int); +#if defined(WAN_DEBUG_FE) + fname = va_arg(args, char*); + fline = va_arg(args, int); +#endif + va_end(args); + + read_bri_fe_byte(card, mod_no, reg, &data, type, optional_arg); + + return data; +} + + +#define SPI_DELAY if(0)WP_DELAY(10) + +#undef SPI_MAX_RETRY_COUNT +#define SPI_MAX_RETRY_COUNT 1000 + +#define MYBREAK if(1)break + +#define FAST_SPI 0 + +static int +read_bri_fe_byte(sdla_t *card, unsigned char mod_no, unsigned char reg, unsigned char *value, + unsigned char type, unsigned char optional_arg) +{ + bri_reg_t data, dummy; + u_int32_t *data_ptr = (u_int32_t*)&data; + u_int32_t *dummy_ptr = (u_int32_t*)&dummy; + u_int32_t retry_counter; + u_int8_t rm_no=0xFF; + + WAN_ASSERT(card == NULL); + +#if defined(WAN_DEBUG_REG) + BRI_DBG("%s():%s\n", __FUNCTION__, card->devname); +#endif + + if(type != MOD_TYPE_NT && type != MOD_TYPE_TE){ +#if 0 + BRI_DBG("%s(): Warning: unknown module type! (%d)\n", __FUNCTION__, type); +#endif + } + + /* setup address offset for fe */ + data.reset=0; + data.start=1; + data.reserv1=0; + + if(type == MOD_TYPE_NONE){ + /* the only case we get here is if running module detection code. */ + rm_no = optional_arg; + }else{ + /* Input mod_no is an even number between 0 and 22 (including). + Calculate rm_no - should be between 0 and 3 (including). + */ + if(mod_no % 2){ + DEBUG_BRI("%s(): Warning: module number (%d) is not even!!\n", + __FUNCTION__, mod_no); + } + rm_no = mod_no / (MAX_BRI_MODULES_PER_REMORA*2); +#if 0 + BRI_DBG("%s(input): rm_no: %d, mod_no: %d\n", __FUNCTION__, rm_no, mod_no); +#endif + /* Translate mod_no to be between 0 and 2 (including) */ + mod_no = (mod_no / 2) % MAX_BRI_MODULES_PER_REMORA; + } +#if 0 + BRI_DBG("%s(updated): rm_no: %d, mod_no: %d\n", __FUNCTION__, rm_no, mod_no); +#endif + if(rm_no > MAX_BRI_REMORAS - 1){ + DEBUG_EVENT("%s:%s(): Line:%d: invalid rm_no: %d!!(mod_no: %d)\n", + card->devname, __FUNCTION__, __LINE__, rm_no, mod_no); + return 0; + } + + data.remora_addr = rm_no; + data.mod_addr = mod_no; + + data.data = reg; + data.contrl = 0; + data.contrl |= ADDR_BIT; + + /* check spi not busy */ + for (retry_counter = 0; retry_counter < SPI_MAX_RETRY_COUNT; retry_counter++){ + card->hw_iface.bus_read_4(card->hw, SPI_INTERFACE_REG, dummy_ptr); + if(dummy.start == 1){SPI_DELAY;}else{MYBREAK;} + } + if(0)DEBUG_EVENT("%s(): Line:%d: retry_counter: %d, dummy.start: %d\n",__FUNCTION__, __LINE__, retry_counter, dummy.start); + if(dummy.start == 1){ + DEBUG_EVENT("%s:%s(): Line:%d: SPI TIMEOUT!!\n", card->devname, __FUNCTION__, __LINE__); + return 0; + } + +#if 0 + BRI_DBG("%s():Line:%d: bus_write_4(): data: 0x%08X\n", __FUNCTION__, __LINE__, data); +#endif + /* setup the address */ + card->hw_iface.bus_write_4(card->hw, SPI_INTERFACE_REG, *data_ptr); + + /* printf("2. data: 0x%08X\n", *data_ptr); */ + /* wait for end of spi operation */ +#if !FAST_SPI + for (retry_counter = 0; retry_counter < SPI_MAX_RETRY_COUNT; retry_counter++){ + card->hw_iface.bus_read_4(card->hw, SPI_INTERFACE_REG, dummy_ptr); + if(dummy.start == 1){SPI_DELAY;}else{MYBREAK;} + } + SPI_DELAY; + if(0)DEBUG_EVENT("%s(): Line:%d: retry_counter: %d, dummy.start: %d\n",__FUNCTION__, __LINE__, retry_counter, dummy.start); + if(dummy.start == 1){ + DEBUG_EVENT("%s:%s(): Line:%d: SPI TIMEOUT!!\n", card->devname, __FUNCTION__, __LINE__); + return 0; + } +#endif + + /* setup data for read spi operation */ + data.reset=0; + data.start=1; + data.reserv1=0; + + data.remora_addr = rm_no; + data.mod_addr = mod_no; + + data.data = 0; + data.contrl = 0; + data.contrl |= READ_BIT; + +#if FAST_SPI + SPI_DELAY; +#else + for (retry_counter = 0; retry_counter < SPI_MAX_RETRY_COUNT; retry_counter++){ + card->hw_iface.bus_read_4(card->hw, SPI_INTERFACE_REG, dummy_ptr); + if(dummy.start == 1){SPI_DELAY;}else{MYBREAK;} + } + SPI_DELAY; + if(0)DEBUG_EVENT("%s(): Line:%d: retry_counter: %d, dummy.start: %d\n",__FUNCTION__, __LINE__, retry_counter, dummy.start); + if(dummy.start == 1){ + DEBUG_EVENT("%s:%s(): Line:%d: SPI TIMEOUT!!\n", card->devname, __FUNCTION__, __LINE__); + return 0; + } +#endif + +#if 0 + BRI_DBG("%s():Line:%d: bus_write_4(): data: 0x%08X\n", __FUNCTION__, __LINE__, data); +#endif + /* start read spi operation */ + card->hw_iface.bus_write_4(card->hw, SPI_INTERFACE_REG, *data_ptr); + +#if FAST_SPI + SPI_DELAY; +#else + /* wait for end of spi operation */ + for (retry_counter = 0; retry_counter < SPI_MAX_RETRY_COUNT; retry_counter++){ + card->hw_iface.bus_read_4(card->hw, SPI_INTERFACE_REG, data_ptr); + if(data.start == 1){SPI_DELAY;}else{MYBREAK;} + } +#if 0 + BRI_DBG("%s():Line:%d: bus_read_4(): data: 0x%08X\n", __FUNCTION__, __LINE__, data); +#endif + SPI_DELAY; + if(0)DEBUG_EVENT("%s(): Line:%d: retry_counter: %d, dummy.start: %d\n",__FUNCTION__, __LINE__, retry_counter, dummy.start); + if(data.start == 1){ + DEBUG_EVENT("%s:%s(): Line:%d: SPI TIMEOUT!!\n", card->devname, __FUNCTION__, __LINE__); + return 0; + } +#endif + //printf("3. data: 0x%08X\n", *data_ptr); + + *value = data.data; + +#if defined(WAN_DEBUG_REG) + DEBUG_EVENT("%s():%s: mod_no:%d reg=0x%X (%d) value=0x%02X\n", + __FUNCTION__, + card->devname, + mod_no, + reg, + reg, + *value); +#endif + return 0; +} + +static int +write_bri_fe_byte(sdla_t *card, unsigned char mod_no, unsigned char addr, unsigned char value) +{ + bri_reg_t data, dummy; + u_int32_t *data_ptr = (u_int32_t*)&data; + u_int32_t *dummy_ptr = (u_int32_t*)&dummy; + u_int8_t rm_no=0xFF; + u_int32_t retry_counter; + + WAN_ASSERT(card == NULL); + +#if defined(WAN_DEBUG_REG) + DEBUG_EVENT("%s():%s: mod_no:%d addr=0x%X (%d) value=0x%02X\n", + __FUNCTION__, + card->devname, + mod_no, + addr, + addr, + value); +#endif + + /* Input mod_no is an even number between 0 and 22 (including). + Calculate rm_no - should be between 0 and 3 (including). + */ + rm_no = mod_no / (MAX_BRI_MODULES_PER_REMORA*2); +#if 0 + BRI_DBG("%s(input): rm_no: %d, mod_no: %d\n", __FUNCTION__, rm_no, mod_no); +#endif + /* Translate mod_no to be between 0 and 2 (including) */ + mod_no = (mod_no / 2) % MAX_BRI_MODULES_PER_REMORA; +#if 0 + BRI_DBG("%s(updated): rm_no: %d, mod_no: %d\n", __FUNCTION__, rm_no, mod_no); +#endif + if(rm_no > MAX_BRI_REMORAS - 1){ + DEBUG_EVENT("%s:%s(): Line:%d: invalid rm_no: %d!!(mod_no: %d)\n", + card->devname, __FUNCTION__, __LINE__, rm_no, mod_no); + return 0; + } + + /* setup address offset for fe */ + data.reset = 0; + data.start = 1; + data.reserv1 = 0; + + data.remora_addr = rm_no; + //data.mod_addr = 0; + data.mod_addr = mod_no; + + data.data = addr; + data.contrl = 0; + data.contrl |= ADDR_BIT; + + /* printf("1. data: 0x%08X\n", *data_ptr); */ + + /* check spi not busy */ + for (retry_counter = 0; retry_counter < SPI_MAX_RETRY_COUNT; retry_counter++){ + card->hw_iface.bus_read_4(card->hw, SPI_INTERFACE_REG, dummy_ptr); + if(dummy.start == 1){SPI_DELAY;}else{MYBREAK;} + } + SPI_DELAY; + if(0)DEBUG_EVENT("%s(): Line:%d: retry_counter: %d, dummy.start: %d\n",__FUNCTION__, __LINE__, retry_counter, dummy.start); + if(dummy.start == 1){ + DEBUG_EVENT("%s:%s(): Line:%d: SPI TIMEOUT!!\n", card->devname, __FUNCTION__, __LINE__); + return 0; + } + + card->hw_iface.bus_write_4( card->hw, SPI_INTERFACE_REG, *data_ptr); + + /* start write spi operation */ + data.reset=0; + data.start=1; + data.reserv1=0; + + //data.remora_addr =0; + //data.mod_addr =0; + data.remora_addr = rm_no; + data.mod_addr = mod_no; + + data.data = value; + data.contrl = 0; + + /* printf("2. data: 0x%08X\n", *data_ptr); */ +#if FAST_SPI + SPI_DELAY; +#else + /* wait for end of spi operation */ + for (retry_counter = 0; retry_counter < SPI_MAX_RETRY_COUNT; retry_counter++){ + card->hw_iface.bus_read_4(card->hw, SPI_INTERFACE_REG, dummy_ptr); + if(dummy.start == 1){SPI_DELAY;}else{MYBREAK;} + } + SPI_DELAY; + if(0)DEBUG_EVENT("%s(): Line:%d: retry_counter: %d, dummy.start: %d\n",__FUNCTION__, __LINE__, retry_counter, dummy.start); + if(dummy.start == 1){ + DEBUG_EVENT("%s:%s(): Line:%d: SPI TIMEOUT!!\n", card->devname, __FUNCTION__, __LINE__); + return 0; + } +#endif + /* write the actual data */ + card->hw_iface.bus_write_4( card->hw, SPI_INTERFACE_REG, *data_ptr); +/* + card->hw_iface.bus_read_4(card->hw, 0x40, dummy_ptr); + card->hw_iface.bus_read_4(card->hw, SPI_INTERFACE_REG, dummy_ptr); + if((*data_ptr & 0xFFFF) != (*dummy_ptr & 0xFFFF)){ + DEBUG_EVENT("%s:%s(): Line:%d: Error: *data_ptr: 0x%02X, *dummy_ptr: 0x%02X\n", + card->devname, __FUNCTION__, __LINE__, *data_ptr, *dummy_ptr); + } +*/ + return 0; +} + +/********************************************************************************/ +/* D channel Transmit */ +int aft_bri_dchan_transmit(sdla_t *card, void *chan_ptr, void *src_data_buffer, unsigned int buffer_len) +{ + int err = 0; + /*private_area_t *chan = (private_area_t*)chan_ptr;*/ + + BRI_FUNC(); + + if (card->wandev.fe_iface.isdn_bri_dchan_tx){ + err = card->wandev.fe_iface.isdn_bri_dchan_tx( + &card->fe, + src_data_buffer, + buffer_len); + }else{ + DEBUG_EVENT("%s():%s: Warning: uninitialized isdn_bri_dchan_tx() pointer.\n", + __FUNCTION__, card->devname); + } + + return err; +} + +/********************************************************************************/ +/* D channel Receive */ +/* +int aft_bri_dchan_receive( sdla_t *card, void *chan_ptr, void *dst_data_buffer, unsigned int buffer_len) +{ + u32 reg; + int err = 0; + private_area_t *chan = (private_area_t*)chan_ptr; + + BRI_FUNC(); + + if (card->wandev.fe_iface.isdn_bri_dchan_rx){ + err = card->wandev.fe_iface.isdn_bri_dchan_rx( + &card->fe, + dst_data_buffer, + buffer_len); + }else{ + DEBUG_EVENT("%s():%s: Warning: uninitialized isdn_bri_dchan_rx() pointer.\n", + __FUNCTION__, card->devname); + } + + return err; +} +*/ +#endif/* #if defined(CONFIG_PRODUCT_WANPIPE_AFT_BRI) */ diff --git a/patches/kdrivers/src/net/diff b/patches/kdrivers/src/net/diff index 468eb2c..090c976 100644 --- a/patches/kdrivers/src/net/diff +++ b/patches/kdrivers/src/net/diff @@ -1,1162 +1,594 @@ ---- sdla_aft_te3.c 2008-02-19 18:54:10.000000000 -0500 -+++ /common/wanpipe/sdla_aft_te3.c 2008-02-02 12:33:18.000000000 -0500 -@@ -281,12 +281,11 @@ - #endif - static int if_open (netdevice_t* dev); - static int if_close (netdevice_t* dev); --static int if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd); -- --static struct net_device_stats* if_stats (netdevice_t* dev); -+static int if_do_ioctl(netdevice_t*, struct ifreq*, wan_ioctl_cmd_t); - - #if defined(__LINUX__) - static int if_send (netskb_t* skb, netdevice_t* dev); -+static struct net_device_stats* if_stats (netdevice_t* dev); +--- sdla_aft_te1.c 2007-11-05 17:34:32.000000000 -0500 ++++ /common/wanpipe/sdla_aft_te1.c 2007-11-21 17:30:49.000000000 -0500 +@@ -26,6 +26,7 @@ + # include + # include + # include ++# include #else - static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct rtentry *rt); + # include + # include +@@ -38,10 +39,8 @@ + # include + # include + # include +-#if defined(CONFIG_PRODUCT_WANPIPE_AFT_SERIAL) + # include #endif -@@ -372,8 +371,8 @@ - static int aft_alloc_rx_dma_buff(sdla_t *card, private_area_t *chan, int num); - static int aft_init_requeue_free_skb(private_area_t *chan, netskb_t *skb); +-#endif --static int write_framer(void *pcard,unsigned short framer_off,unsigned short framer_data); --static unsigned int read_framer(void *pcard,unsigned short framer_off); -+//static int write_framer(void *pcard,unsigned short framer_off,unsigned short framer_data); -+//static unsigned int read_framer(void *pcard,unsigned short framer_off); - #if 0 - //FIXME to be taken out check with M.F. - static void framer_reset(sdla_t *card); -@@ -499,9 +498,6 @@ + #if defined(CONFIG_WANPIPE_HWEC) + # include +@@ -141,6 +140,14 @@ + # undef AFT_CLOCK_SYNC + #endif + ++#if 1 ++# warning "AFT_SERIAL_DEBUGGING is enabled" ++# define AFT_SINGLE_DMA_CHAIN 1 ++# define AFT_SERIAL_DEBUG ++#else ++# undef AFT_SERIAL_DEBUG ++#endif ++ + #if defined(__LINUX__) + #define AFT_TDM_API_SUPPORT 1 + #else +@@ -159,6 +166,7 @@ + # undef AFT_RTP_SUPPORT + #endif + ++ + #if defined(WANPIPE_64BIT_4G_DMA) + #warning "Wanpipe compiled for 64bit 4G DMA" + #endif +@@ -330,6 +338,7 @@ + static void wp_aft_tdmv_per_port_isr(sdla_t *card); + static void wp_aft_fifo_per_port_isr(sdla_t *card); + static void wp_aft_wdt_per_port_isr(sdla_t *card, int wdt_intr); ++static void wp_aft_serial_status_isr(sdla_t *card, u32 status); + + /* Bottom half handlers */ + #if defined(__LINUX__) +@@ -816,17 +825,17 @@ + card->hw_iface.getcfg(card->hw, SDLA_COREREV, &card->u.aft.firm_ver); + card->hw_iface.getcfg(card->hw, SDLA_COREID, &card->u.aft.firm_id); + +- /* FIXME:hardcoded!! */ +- card->u.aft.firm_id = AFT_DS_FE_CORE_ID; +- + if (conf == NULL){ + DEBUG_EVENT("%s: Bad configuration structre!\n", + card->devname); return -EINVAL; } --#if defined(WAN_DEBUG_MEM) -- DEBUG_EVENT("%s: Total Mem %d\n",__FUNCTION__,wan_atomic_read(&wan_debug_mem)); --#endif - - if (card->adptr_subtype == AFT_SUBTYPE_SHARK) { - DEBUG_EVENT("%s: Starting SHARK T3/E3 Adapter!\n", -@@ -512,7 +508,7 @@ - card->wandev.clocking = conf->clocking; - card->wandev.ignore_front_end_status = conf->ignore_front_end_status; - card->wandev.ttl = conf->ttl; -- card->wandev.interface = conf->interface; -+ card->wandev.electrical_interface = conf->electrical_interface; - card->wandev.comm_port = conf->comm_port; - card->wandev.udp_port = conf->udp_port; - card->wandev.new_if_cnt = 0; -@@ -534,14 +530,16 @@ - card->fe.write_fe_cpld = write_fe_cpld; - - // card->fe.read_cpld = read_cpld; -- card->fe.write_framer = write_framer; -- card->fe.read_framer = read_framer; -+ card->fe.write_fe_reg = card->hw_iface.fe_write; -+ card->fe.read_fe_reg = card->hw_iface.fe_read; -+ //card->fe.write_framer = write_framer; -+ //card->fe.read_framer = read_framer; - - // card->wandev.write_front_end_reg = write_front_end_reg; - // card->wandev.read_front_end_reg = read_front_end_reg; - card->wandev.fe_enable_timer = enable_timer; - card->wandev.te_link_state = handle_front_end_state; --//ALEX conf->interface = -+//ALEX conf->electrical_interface = - // IS_T1_CARD(card) ? WANOPT_V35 : WANOPT_RS232; - - if (card->wandev.comm_port == WANOPT_PRI){ -@@ -667,12 +665,12 @@ - */ - static int update (wan_device_t* wandev) - { -- sdla_t* card = wandev->private; -+ sdla_t* card = wandev->priv; - netdevice_t* dev; - volatile private_area_t* chan; - - /* sanity checks */ -- if((wandev == NULL) || (wandev->private == NULL)) -+ if((wandev == NULL) || (wandev->priv == NULL)) - return -EFAULT; - - if(wandev->state == WAN_UNCONFIGURED) -@@ -744,7 +742,7 @@ - */ - static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) - { -- sdla_t* card = wandev->private; -+ sdla_t* card = wandev->priv; - private_area_t* chan; - int err = 0; - netskb_t *skb; -@@ -1015,7 +1013,6 @@ - chan->common.iface.close = &if_close; - chan->common.iface.output = &if_send; - chan->common.iface.ioctl = &if_do_ioctl; -- chan->common.iface.get_stats = &if_stats; - chan->common.iface.tx_timeout = &if_tx_timeout; - if (wan_iface.attach){ - if (!ifunit(wan_netif_name(dev))){ -@@ -1211,6 +1208,8 @@ - dev->type = ARPHRD_PPP; - dev->mtu = card->wandev.mtu; - dev->hard_header_len = 16; -+ dev->hard_header = NULL; -+ dev->rebuild_header = NULL; - dev->addr_len = 0; - } - -@@ -1286,6 +1285,7 @@ - WAN_NETIF_STOP_QUEUE(dev); - WAN_NETIF_CARRIER_OFF(dev); - +- /* Make special hardware initialization for ISDN BRI board */ ++ /* Make special hardware initialization for Serial board */ + memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); + - /* If FRONT End is down, it means that the DMA - * is disabled. In this case don't try to - * reset fifo. Let the enable_data_error_intr() -@@ -1504,7 +1504,9 @@ - xilinx_tx_fifo_under_recover(card,chan); - wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); ++ FE_MEDIA(&(card->fe.fe_cfg)) = WAN_MEDIA_SERIAL; ++ + wp_serial_iface_init(&card->wandev.fe_iface); + card->fe.name = card->devname; + card->fe.card = card; +@@ -850,9 +859,7 @@ -- aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); -+ if (!chan->single_dma_chain){ -+ aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); -+ } - } + card->u.aft.num_of_time_slots = 1; - -@@ -1662,6 +1664,7 @@ - } - - -+#if defined(__LINUX__) - /*============================================================================ - * if_stats - * -@@ -1714,9 +1717,7 @@ - - return &chan->if_stats; - } +- return -EINVAL; - -- -- -+#endif - - /*======================================================================== - * -@@ -1737,7 +1738,8 @@ - * wanpipemon debugger - * - */ --static int if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) -+static int -+if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, wan_ioctl_cmd_t cmd) - { - private_area_t* chan= (private_area_t*)wan_netif_priv(dev); - sdla_t *card; -@@ -1857,8 +1859,8 @@ - - default: - #ifndef WANPIPE_GENERIC -- DEBUG_EVENT("%s: Command %x not supported!\n", -- card->devname,cmd); -+ DEBUG_IOCTL("%s: Command %x not supported!\n", -+ card->devname,cmd); - return -EOPNOTSUPP; - #else - if (card->wandev.ioctl){ -@@ -2444,10 +2446,10 @@ - static void wp_bh (void* data, int dummy) +- return wan_aft_init(card,conf); ++ return wan_aft_init(card,conf); + } #endif - { -- private_area_t* chan = (private_area_t *)data; -- netskb_t *new_skb,*skb; -- unsigned char pkt_error; -- unsigned long timeout=SYSTEM_TICKS; -+ private_area_t *chan = (private_area_t *)data; -+ netskb_t *new_skb,*skb; -+ unsigned char pkt_error; -+ wan_ticks_t timeout=SYSTEM_TICKS; - - DEBUG_TEST("%s: ------------ BEGIN --------------: %lu\n", - __FUNCTION__,SYSTEM_TICKS); -@@ -2621,6 +2623,9 @@ - card->devname); - return 0; - } -+ -+ DEBUG_TEST("%s: RX FIFO=0x%08X TX FIFO=0x%08X\n", -+ card->devname,rx_status,tx_status); - if (IS_TE3(&card->fe.fe_cfg)){ - num_of_logic_ch=1; -@@ -2879,7 +2884,6 @@ - XILINX_DMA_RX_INTR_PENDING_REG, - &dma_rx_reg); - -- - DEBUG_TEST("%s: DMA_RX_INTR_REG(0x%X) = 0x%X ActCH=0x%lX\n", - card->devname, - XILINX_DMA_RX_INTR_PENDING_REG,dma_rx_reg, -@@ -2998,7 +3002,9 @@ - chan->if_name,wan_test_bit(0,&chan->up)); - } - aft_reset_rx_watchdog(card); -- aft_enable_rx_watchdog(card,AFT_MAX_WTD_TIMEOUT); -+ if (!chan->single_dma_chain){ -+ aft_enable_rx_watchdog(card,AFT_MAX_WTD_TIMEOUT); -+ } - } +@@ -1472,12 +1479,11 @@ - DEBUG_TEST("%s: Rx WatchDog Expired %p!\n", -@@ -3218,34 +3224,6 @@ - wan_udp_pkt->wan_udp_return_code = 0; - break; - -- case WAN_GET_MEDIA_TYPE: -- case WAN_FE_GET_STAT: -- case WAN_FE_SET_LB_MODE: -- case WAN_FE_FLUSH_PMON: -- case WAN_FE_GET_CFG: -- -- if (IS_TE3(&card->fe.fe_cfg)){ -- WAN_FECALL(&card->wandev, process_udp, -- (&card->fe, -- &wan_udp_pkt->wan_udp_cmd, -- &wan_udp_pkt->wan_udp_data[0])); -- }else{ -- wan_udp_pkt->wan_udp_return_code = WAN_UDP_INVALID_CMD; -- } -- break; -- -- case WAN_GET_PROTOCOL: -- wan_udp_pkt->wan_udp_aft_num_frames = card->wandev.config_id; -- wan_udp_pkt->wan_udp_return_code = CMD_OK; -- wan_udp_pkt->wan_udp_data_len = 1; -- break; -- -- case WAN_GET_PLATFORM: -- wan_udp_pkt->wan_udp_data[0] = WAN_PLATFORM_ID; -- wan_udp_pkt->wan_udp_return_code = CMD_OK; -- wan_udp_pkt->wan_udp_data_len = 1; -- break; -- - case READ_OPERATIONAL_STATS: - wan_udp_pkt->wan_udp_return_code = 0; - memcpy(wan_udp_pkt->wan_udp_data,&chan->opstats,sizeof(aft_op_stats_t)); -@@ -3270,7 +3248,42 @@ - wan_udp_pkt->wan_udp_data_len=0; - break; - -+ case WAN_GET_PROTOCOL: -+ wan_udp_pkt->wan_udp_aft_num_frames = card->wandev.config_id; -+ wan_udp_pkt->wan_udp_return_code = CMD_OK; -+ wan_udp_pkt->wan_udp_data_len = 1; -+ break; -+ -+ case WAN_GET_PLATFORM: -+ wan_udp_pkt->wan_udp_data[0] = WAN_PLATFORM_ID; -+ wan_udp_pkt->wan_udp_return_code = CMD_OK; -+ wan_udp_pkt->wan_udp_data_len = 1; -+ break; -+ -+ case WAN_GET_MASTER_DEV_NAME: -+ wan_udp_pkt->wan_udp_data_len = 0; -+ wan_udp_pkt->wan_udp_return_code = 0xCD; -+ break; -+ -+ case WAN_GET_MEDIA_TYPE: -+ if (card->wandev.fe_iface.get_fe_media){ -+ wan_udp_pkt->wan_udp_data[0] = -+ card->wandev.fe_iface.get_fe_media(&card->fe); -+ wan_udp_pkt->wan_udp_return_code = WAN_CMD_OK; -+ wan_udp_pkt->wan_udp_data_len = sizeof(unsigned char); -+ }else{ -+ wan_udp_pkt->wan_udp_return_code = WAN_UDP_INVALID_CMD; -+ } -+ break; -+ - default: -+ if ((wan_udp_pkt->wan_udp_command & 0xF0) == WAN_FE_UDP_CMD_START){ -+ WAN_FECALL(&card->wandev, process_udp, -+ (&card->fe, -+ &wan_udp_pkt->wan_udp_cmd, -+ &wan_udp_pkt->wan_udp_data[0])); -+ break; -+ } - wan_udp_pkt->wan_udp_data_len = 0; - wan_udp_pkt->wan_udp_return_code = 0xCD; - -@@ -3927,7 +3940,7 @@ - - /* TE1 Update T1/E1 alarms */ - if (IS_TE3(&card->fe.fe_cfg)) { -- WAN_FECALL(&card->wandev, read_alarm, (&card->fe, 0)); -+ WAN_FECALL(&card->wandev, read_alarm, (&card->fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE)); - /* TE1 Update T1/E1 perfomance counters */ - WAN_FECALL(&card->wandev, read_pmon, (&card->fe, 0)); - } -@@ -3971,7 +3984,9 @@ - wanpipe_lip_kick(chan,0); } - #endif -- aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); -+ if (!chan->single_dma_chain){ -+ aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); -+ } - } - - static int xilinx_write_ctrl_hdlc(sdla_t *card, u32 timeslot, u8 reg_off, u32 data) -@@ -4213,7 +4228,7 @@ - - card->hw_iface.bus_write_4(card->hw,XILINX_CHIP_CFG_REG,reg); - -- WP_DELAY(100); -+ WP_DELAY(10); - - /* Disable the chip/hdlc reset condition */ - wan_clear_bit(CHIP_RESET_BIT,®); -@@ -4280,8 +4295,6 @@ - DEBUG_CFG("--- T3 Exar Chip enable/config. -- \n"); - - card->hw_iface.bus_write_4(card->hw,XILINX_CHIP_CFG_REG,reg); -- -- WP_DELAY(100); - - xilinx_delay(1); - #if 0 -@@ -4453,6 +4466,15 @@ - card->u.xilinx.dev_to_ch_map[0]=(void*)chan; - } - -+ /* Setup global DMA parameters */ -+ if (chan->single_dma_chain){ -+ card->hw_iface.bus_read_4(card->hw,XILINX_DMA_CONTROL_REG,®); -+ reg&=~DMA_CHAIN_TE3_MASK; -+ reg|=1&DMA_CHAIN_TE3_MASK; -+ card->hw_iface.bus_write_4(card->hw,XILINX_DMA_CONTROL_REG,reg); -+ } -+ -+ - reg=0; - if (chan->hdlc_eng){ -@@ -4571,6 +4593,9 @@ - } - - -+#if 0 -+/* Alex -+** This functions are moved to sdladrv_fe.c */ - #define BIT_DEV_ADDR_CLEAR 0x600 - - static int write_framer(void *pcard, unsigned short framer_off,unsigned short framer_data) -@@ -4585,12 +4610,10 @@ - card->hw_iface.bus_write_2(card->hw, - 0x46, - framer_off); -- WP_DELAY(5); - - card->hw_iface.bus_write_2(card->hw, - 0x44, - framer_data); -- WP_DELAY(5); - return 0; - } - -@@ -4605,18 +4628,17 @@ - card->hw_iface.bus_write_2(card->hw, - 0x46, - framer_off); -- WP_DELAY(5); - - card->hw_iface.bus_read_4(card->hw, - 0x44, - &framer_data); -- WP_DELAY(5); - - DEBUG_TEST("READ FRAMER OFFSET=0x%02X DATA=0x%02X\n", - framer_off,framer_data); - - return framer_data; - } -+#endif - - #if 0 - static void framer_reset(sdla_t *card) -@@ -4805,7 +4827,7 @@ - - wan_set_bit(TxDMA_HI_DMA_GO_READY_BIT,®); - -- DEBUG_TX("%s: TXDMA_HI=0x%X DmaDescr=0x%lX len=%i\n", -+ DEBUG_TEST("%s: TXDMA_HI=0x%X DmaDescr=0x%lX len=%i\n", - __FUNCTION__,reg,dma_chain->dma_addr,len); - - card->hw_iface.bus_write_4(card->hw,dma_descr,reg); -@@ -4973,6 +4995,24 @@ - } - } - -+#if 0 -+ if (0){ -+ netskb_t *nskb=__dev_alloc_skb(wan_skb_len(skb),GFP_DMA|GFP_ATOMIC); -+ if (!nskb) { -+ wan_skb_free(skb); -+ wan_clear_bit(0,&dma_chain->init); -+ chan->if_stats.tx_errors++; -+ return -EINVAL; -+ } else { -+ unsigned char *buf = wan_skb_put(nskb,wan_skb_len(skb)); -+ memcpy(buf,wan_skb_data(skb),wan_skb_len(skb)); -+ wan_skb_free(skb); -+ skb=nskb; -+ } -+ } -+#endif -+ -+ - dma_chain->skb=skb; - - dma_chain->dma_addr = -@@ -5032,7 +5072,7 @@ - if (!wan_test_bit(TX_INTR_PENDING,&chan->dma_chain_status)){ - aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); - } +- if (IS_T1_CARD(card) || IS_FXOFXS_CARD(card)){ +- /* Convert active_ch bit map to user */ +- chan->wp_tdm_api_dev.active_ch = conf->active_ch << 1; +- }else{ ++ if (IS_E1_CARD(card)){ + chan->wp_tdm_api_dev.active_ch = conf->active_ch; - } -+ } - - wan_clear_bit(TX_DMA_BUSY,&chan->dma_status); ++ }else{ ++ chan->wp_tdm_api_dev.active_ch = conf->active_ch << 1; ++ } -@@ -5106,7 +5146,7 @@ + DEBUG_TEST("%s: TDM API ACTIVE CH 0x%08X CHAN=%i\n", + chan->if_name, chan->wp_tdm_api_dev.active_ch,chan->wp_tdm_api_dev.tdm_chan); +@@ -2221,9 +2227,12 @@ - wan_set_bit(RxDMA_HI_DMA_GO_READY_BIT,®); + for (i=0;idma_addr,dma_descr); +- err = card->hw_iface.busdma_alloc(card->hw,&chan->tx_dma_chain_table[i]); ++ err = card->hw_iface.busdma_alloc( ++ card->hw, ++ &chan->tx_dma_chain_table[i]); + if (err){ +- DEBUG_EVENT("%s:%s: Unable to load TX DMA buffer %d (%d)!\n", ++ DEBUG_EVENT( ++ "%s:%s: Unable to load TX DMA buffer %d (%d)!\n", + card->devname, chan->if_name, i, err); + err = -EINVAL; + break; +@@ -2233,9 +2242,12 @@ + chan->tx_dma_chain_table[i].dma_virt, + chan->dma_mru); + +- err = card->hw_iface.busdma_alloc(card->hw,&chan->rx_dma_chain_table[i]); ++ err = card->hw_iface.busdma_alloc( ++ card->hw, ++ &chan->rx_dma_chain_table[i]); + if (err){ +- DEBUG_EVENT("%s:%s: Unable to load RX DMA buffer %d (%d)!\n", ++ DEBUG_EVENT( ++ "%s:%s: Unable to load RX DMA buffer %d (%d)!\n", + card->devname, chan->if_name, i, err); + err = -EINVAL; + break; +@@ -2249,8 +2261,12 @@ - card->hw_iface.bus_write_4(card->hw,dma_descr,reg); -@@ -5406,7 +5446,7 @@ - aft_enable_rx_watchdog(card,AFT_MAX_WTD_TIMEOUT); - chan->rx_no_data_cnt=-1; + for (i=0;ihw_iface.busdma_free(card->hw,&chan->rx_dma_chain_table[i]); +- card->hw_iface.busdma_free(card->hw,&chan->tx_dma_chain_table[i]); ++ card->hw_iface.busdma_free( ++ card->hw, ++ &chan->rx_dma_chain_table[i]); ++ card->hw_iface.busdma_free( ++ card->hw, ++ &chan->tx_dma_chain_table[i]); + } + err = card->hw_iface.busdma_tag_destroy( + card->hw, +@@ -2530,7 +2546,8 @@ + wan_spin_unlock_irq(&card->wandev.lock,&flags); + + if (card->wandev.config_id == WANCONFIG_AFT_ANALOG || +- card->wandev.config_id == WANCONFIG_AFT_ISDN_BRI) { ++ card->wandev.config_id == WANCONFIG_AFT_ISDN_BRI || ++ card->wandev.config_id == WANCONFIG_AFT_SERIAL) { + wan_spin_lock_irq(&card->wandev.lock,&flags); + card->fe.fe_status = FE_CONNECTED; + handle_front_end_state(card); +@@ -2635,10 +2652,16 @@ + aft_free_tx_descriptors(chan); + aft_free_rx_descriptors(chan); + ++ wan_spin_unlock_irq(&card->wandev.lock,&flags); ++ + for (i=0;ihw_iface.busdma_free(card->hw,&chan->rx_dma_chain_table[i]); +- card->hw_iface.busdma_free(card->hw,&chan->tx_dma_chain_table[i]); ++ card->hw_iface.busdma_free( ++ card->hw, ++ &chan->rx_dma_chain_table[i]); ++ card->hw_iface.busdma_free( ++ card->hw, ++ &chan->tx_dma_chain_table[i]); + } + card->hw_iface.busdma_tag_destroy( + card->hw, +@@ -2649,6 +2672,8 @@ + &chan->tx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS); + ++ wan_spin_lock_irq(&card->wandev.lock,&flags); ++ + WAN_IFQ_DMA_PURGE(&chan->wp_rx_free_list); + WAN_IFQ_DESTROY(&chan->wp_rx_free_list); + +@@ -2759,7 +2784,7 @@ + + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &card_use_cnt); + if (card_use_cnt == 1) { +- DEBUG_BRI("%s: BRI Disabling TDMV INTR\n", ++ DEBUG_TEST("%s: BRI Disabling TDMV INTR\n", + card->devname); + aft_tdm_intr_ctrl(card,0); + aft_fifo_intr_ctrl(card, 0); +@@ -4529,8 +4554,9 @@ + * buffer and pass it up */ + *new_skb=wan_skb_alloc(len + 20); + if (!*new_skb){ +- DEBUG_EVENT("%s:%s: Failed to allocate rx skb pkt (len=%d)!\n", +- card->devname,chan->if_name,(len+20)); ++ DEBUG_EVENT( ++ "%s:%s: Failed to allocate rx skb pkt (len=%d)!\n", ++ card->devname,chan->if_name,(len+20)); + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); //chan->if_stats.rx_dropped++; + goto rx_comp_error; + } +@@ -5246,7 +5272,7 @@ + + card_list=__sdla_get_ptr_isr_array(card->hw); + +- DEBUG_BRI("%s(): card_list ptr: 0x%p\n", __FUNCTION__, card_list); ++ DEBUG_TEST("%s(): card_list ptr: 0x%p\n", __FUNCTION__, card_list); + + for (i=0; iwandev.fe_iface.isr) { + tmp_card->wandev.fe_iface.isr(&tmp_card->fe); +@@ -5315,11 +5341,12 @@ + static WAN_IRQ_RETVAL wp_aft_global_isr (sdla_t* card) + { + u32 reg_sec=0,reg=0; +- u32 a108_reg=0, a56k_reg=0; ++ u32 a108_reg=0, a56k_reg=0, serial_reg=0; + u32 fifo_port_intr=0; + u32 dma_port_intr=0; + u32 wdt_port_intr=0; + u32 tdmv_port_intr=0; ++ u32 status_port_intr=0; + u32 fe_intr=0; + u32 max_ports=IS_BRI_CARD(card)?MAX_BRI_LINES:8; + +@@ -5358,16 +5385,17 @@ + __sdla_bus_read_4(card->hw,AFT_CHIP_CFG_REG, ®); + reg_sec=reg; + ++ DEBUG_TEST("%s:ISR = 0x%X\n",card->devname,reg); ++ + if (wan_test_bit(AFT_CHIPCFG_FE_INTR_STAT_BIT,®)){ + + #ifdef AFT_IRQ_STAT_DEBUG + card->wandev.stats.rx_dropped++; + #endif +- DEBUG_BRI("%s(): line: %d\n", __FUNCTION__, __LINE__); + + if (wan_test_bit(AFT_CHIPCFG_FE_INTR_CFG_BIT,®)) { + +- DEBUG_BRI("%s: Got Front End Interrupt 0x%08X\n", ++ DEBUG_ISR("%s: Got Front End Interrupt 0x%08X\n", + card->devname,reg); + + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); +@@ -5412,12 +5440,27 @@ + wdt_port_intr = aft_chipcfg_a108_get_wdt_intr_stats(a108_reg); + tdmv_port_intr = aft_chipcfg_a108_get_tdmv_intr_stats(a108_reg); + +- }else if(IS_56K_CARD(card)){ ++ } else if (IS_SERIAL_CARD(card)) { ++ __sdla_bus_read_4(card->hw,AFT_CHIP_STAT_REG, &serial_reg); ++ ++#ifdef AFT_SERIAL_DEBUG ++if (serial_reg) { ++ DEBUG_EVENT("%s: SERIAL ISR = 0x%08X\n", ++ card->devname,serial_reg); ++} ++#endif ++ ++ fifo_port_intr = aft_chipcfg_a108_get_fifo_intr_stats(serial_reg); ++ dma_port_intr = aft_chipcfg_a108_get_dma_intr_stats(serial_reg); ++ wdt_port_intr = aft_chipcfg_serial_get_wdt_intr_stats(serial_reg); ++ status_port_intr = aft_chipcfg_serial_get_status_intr_stats(serial_reg, card->wandev.comm_port); ++ ++ } else if(IS_56K_CARD(card)) { + __sdla_bus_read_4(card->hw,AFT_CHIP_STAT_REG, &a56k_reg); + fifo_port_intr = wan_test_bit(AFT_CHIPCFG_A56K_FIFO_INTR_BIT,&a56k_reg); + dma_port_intr = wan_test_bit(AFT_CHIPCFG_A56K_DMA_INTR_BIT,&a56k_reg); + wdt_port_intr = wan_test_bit(AFT_CHIPCFG_A56K_WDT_INTR_BIT,&a56k_reg); +- }else{ ++ } else { + fifo_port_intr = aft_chipcfg_get_hdlc_intr_stats(reg); + dma_port_intr = aft_chipcfg_get_dma_intr_stats(reg); + wdt_port_intr = aft_chipcfg_get_wdt_intr_stats(reg); +@@ -5432,6 +5475,7 @@ + dma_port_intr || + fifo_port_intr || + dma_port_intr || ++ status_port_intr || + wdt_port_intr) { + /* Pass Through */ + } else { +@@ -5473,10 +5517,15 @@ #endif - { --#if defined(__LINUX__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) -+#if defined(__LINUX__) -+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) - sdla_t *card = (sdla_t *)container_of(work, sdla_t, u.aft.port_task); -+# else -+ sdla_t *card = (sdla_t *)card_ptr; -+# endif + } + ++ ++ #else - sdla_t *card = (sdla_t *)card_ptr; --#endif -+#endif - wan_smp_flag_t smp_flags,isr_flags; + #warning "NCDEBUG DMA IGNORED" + #endif - if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ ---- sdla_te3.c 2008-01-11 14:07:46.000000000 -0500 -+++ /common/wanpipe/sdla_te3.c 2008-01-18 17:18:00.000000000 -0500 -@@ -52,27 +52,18 @@ - ** DEFINES AND MACROS - ******************************************************************************/ - --#if defined(DEBUG) --# define WRITE_CPLD(reg,val) \ -- DEBUG_EVENT("%s: Write to CPLD reg %d value %X\n", \ -- fe->name, reg, val); -- --# define WRITE_REG(reg,val) \ -- DEBUG_EVENT("%s: Write to Framer off %X value %X\n", \ -- fe->name, reg, val); --#else -- --# define WRITE_CPLD(reg,val) \ -- (fe->write_cpld) ? fe->write_cpld(fe->card, reg, val) : -EINVAL -+#define WRITE_CPLD(reg,val) \ -+ fe->write_cpld(fe->card, (reg), (val)) - --# define WRITE_EXAR_CPLD(reg,val) \ -- (fe->write_fe_cpld) ? fe->write_fe_cpld(fe->card, reg, val) : -EINVAL -+#define WRITE_EXAR_CPLD(reg,val) \ -+ fe->write_fe_cpld(fe->card, (reg), (val)) - --# define WRITE_REG(reg,val) \ -- (fe->write_framer) ? fe->write_framer(fe->card, reg, val) : -EINVAL --# define READ_REG(reg) \ -- (fe->read_framer) ? fe->read_framer(fe->card, reg) : 0 --#endif -+#define WRITE_REG(reg,val) \ -+ fe->write_fe_reg( \ -+ ((sdla_t*)fe->card)->hw,(int)(reg),(int)(val)); -+#define READ_REG(reg) \ -+ fe->read_fe_reg( \ -+ ((sdla_t*)fe->card)->hw,(int)(reg)); - - #define WAN_FE_SWAP_BIT(value, mask) \ - if ((value) & mask){ \ -@@ -105,8 +96,9 @@ - static int sdla_e3_isr(sdla_fe_t *fe); - static int sdla_te3_isr(sdla_fe_t *fe); - static int sdla_te3_udp(sdla_fe_t *fe, void*, unsigned char*); --static unsigned int sdla_te3_alarm(sdla_fe_t *fe, int); -+static unsigned int sdla_te3_read_alarms(sdla_fe_t *fe, int); - static int sdla_te3_read_pmon(sdla_fe_t *fe, int); -+static int sdla_te3_flush_pmon(sdla_fe_t *fe); - - static int sdla_te3_update_alarm_info(sdla_fe_t* fe, struct seq_file* m, int* stop_cnt); - static int sdla_te3_update_pmon_info(sdla_fe_t* fe, struct seq_file* m, int* stop_cnt); -@@ -221,6 +213,8 @@ - { - unsigned char value; - -+ WAN_ASSERT(fe->write_fe_reg == NULL); -+ WAN_ASSERT(fe->read_fe_reg == NULL); - value = READ_REG(REG_TxDS3_LAPD_STATUS); - if (value & BIT_TxDS3_LAPD_STATUS_INT){ - DEBUG_EVENT("%s: LAPD Interrupt!\n", -@@ -240,43 +234,35 @@ - { - unsigned char value, status; - -+ WAN_ASSERT(fe->write_fe_reg == NULL); -+ WAN_ASSERT(fe->read_fe_reg == NULL); - /* RxDS3 Interrupt status register (0x13) */ - value = READ_REG(REG_RxDS3_INT_STATUS); - status = READ_REG(REG_RxDS3_CFG_STATUS); - if (fe->fe_cfg.frame == WAN_FR_DS3_Cbit && value & BIT_RxDS3_INT_STATUS_CPBIT_ERR){ -- if (WAN_NET_RATELIMIT()){ -- DEBUG_TE3("%s: CP Bit Error interrupt detected!\n", -+ DEBUG_TE3("%s: CP Bit Error interrupt detected!\n", - fe->name); -- } - } - if (value & BIT_RxDS3_INT_STATUS_LOS){ - if (status & BIT_RxDS3_CFG_STATUS_RxLOS){ -- if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: LOS Status ON!\n", - fe->name); -- } - fe->fe_alarm |= WAN_TE3_BIT_LOS_ALARM; - }else{ -- if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: LOS Status OFF!\n", - fe->name); -- } - fe->fe_alarm &= ~WAN_TE3_BIT_LOS_ALARM; ++ ++ ++ + if (wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { + + if (tdmv_port_intr && +@@ -5596,9 +5645,13 @@ } } - if (value & BIT_RxDS3_INT_STATUS_AIS){ -- if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: AIS status %s!\n", - fe->name, - (status & BIT_RxDS3_CFG_STATUS_RxAIS) ? "ON" : "OFF"); -- } - } - if (value & BIT_RxDS3_INT_STATUS_IDLE){ -- if (WAN_NET_RATELIMIT()){ -- DEBUG_TE3("%s: IDLE condition status %s!\n", -+ DEBUG_EVENT("%s: IDLE condition status %s!\n", - fe->name, - (status & BIT_RxDS3_CFG_STATUS_RxIDLE) ? "ON" : "OFF"); -- } - } - if (value & BIT_RxDS3_INT_STATUS_OOF){ - if (status & BIT_RxDS3_CFG_STATUS_RxLOS){ -@@ -302,27 +288,23 @@ - } - } - if (fe->fe_cfg.frame == WAN_FR_DS3_Cbit && value & BIT_RxDS3_INT_STATUS_AIC){ -- if (WAN_NET_RATELIMIT()){ - DEBUG_TE3("%s: AIC bit-field status %s!\n", - fe->name, - (status & BIT_RxDS3_STATUS_RxAIC) ? "ON" : "OFF"); -- } - } - if (value & BIT_RxDS3_INT_STATUS_PBIT_ERR){ -- if (WAN_NET_RATELIMIT()){ - DEBUG_TE3("%s: P-Bit error interrupt!\n", - fe->name); -- } - } - /* RxDS3 FEAC Interrupt (0x17) */ - value = READ_REG(REG_RxDS3_FEAC_INT); - if (value & BIT_RxDS3_FEAC_REMOVE_INT_STATUS){ -- DEBUG_TE3("%s: RxFEAC Remove Interrupt!\n", -+ DEBUG_EVENT("%s: RxFEAC Remove Interrupt!\n", - fe->name); - } - if (value & BIT_RxDS3_FEAC_VALID_INT_STATUS){ -- DEBUG_TE3("%s: RxFEAC Valid Interrupt!\n", -+ DEBUG_EVENT("%s: RxFEAC Valid Interrupt!\n", - fe->name); - } - -@@ -340,6 +322,8 @@ - { - unsigned char value; - -+ WAN_ASSERT(fe->write_fe_reg == NULL); -+ WAN_ASSERT(fe->read_fe_reg == NULL); - value = READ_REG(REG_BLOCK_INT_STATUS); - if (value & BIT_BLOCK_INT_STATUS_RxDS3_E3){ - sdla_ds3_rx_isr(fe); -@@ -379,6 +363,9 @@ - unsigned char int_status1, int_status2; - unsigned char status; - -+ WAN_ASSERT(fe->write_fe_reg == NULL); -+ WAN_ASSERT(fe->read_fe_reg == NULL); ++ if (status_port_intr) { ++ wp_aft_serial_status_isr(card, status_port_intr); ++ } + - int_status1 = READ_REG(REG_RxE3_INT_STATUS_1); - int_status2 = READ_REG(REG_RxE3_INT_STATUS_2); - status = READ_REG(REG_RxE3_CFG_STATUS_2); -@@ -457,6 +444,9 @@ - { - unsigned char value; - -+ WAN_ASSERT(fe->write_fe_reg == NULL); -+ WAN_ASSERT(fe->read_fe_reg == NULL); -+ - value = READ_REG(REG_BLOCK_INT_STATUS); - if (value & BIT_BLOCK_INT_STATUS_RxDS3_E3){ - sdla_e3_rx_isr(fe); -@@ -478,10 +468,8 @@ - static int sdla_te3_isr(sdla_fe_t *fe) - { - sdla_fe_cfg_t *fe_cfg = &fe->fe_cfg; -- unsigned char value; - int err = 0; - -- value = READ_REG(REG_BLOCK_INT_STATUS); - switch(fe_cfg->media){ - case WAN_MEDIA_DS3: - err = sdla_ds3_isr(fe); -@@ -490,113 +478,135 @@ - err = sdla_e3_isr(fe); - break; - } -- fe->fe_alarm = sdla_te3_alarm(fe, 1); -+ sdla_te3_set_status(fe); - return err; + if (wan_test_bit(card->wandev.comm_port,&wdt_port_intr)){ + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); +- wp_aft_wdt_per_port_isr(card,1); ++ wp_aft_wdt_per_port_isr(card,1); + card->u.aft.wdt_tx_cnt=SYSTEM_TICKS; + #ifdef AFT_IRQ_STAT_DEBUG + card->wandev.stats.rx_fifo_errors++; +@@ -5684,6 +5737,32 @@ + WAN_IRQ_RETURN(irq_ret); } - /****************************************************************************** -- * sdla_te3_alarm() -+ * sdla_te3_read_alarms() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ --static unsigned int sdla_te3_alarm(sdla_fe_t *fe, int update) -+static unsigned int sdla_te3_read_framer_alarms(sdla_fe_t *fe) - { - sdla_fe_cfg_t *fe_cfg = &fe->fe_cfg; -- unsigned int alarm = 0; -+ unsigned int alarms = 0; - unsigned char value; -- + -+ WAN_ASSERT(fe->write_fe_reg == NULL); -+ WAN_ASSERT(fe->read_fe_reg == NULL); -+ - if (fe_cfg->media == WAN_MEDIA_DS3){ - value = READ_REG(REG_RxDS3_CFG_STATUS); - if (value & BIT_RxDS3_CFG_STATUS_RxAIS){ -- alarm |= WAN_TE3_BIT_AIS_ALARM; -- DEBUG_TE3("%s: (T3/E3) AIS Alarm is ON\n", fe->name); -+ alarms |= WAN_TE3_BIT_AIS_ALARM; - }else{ -- alarm &= ~WAN_TE3_BIT_AIS_ALARM; -- DEBUG_TE3("%s: (T3/E3) AIS Alarm is OFF\n", fe->name); -+ alarms &= ~WAN_TE3_BIT_AIS_ALARM; - } - if (value & BIT_RxDS3_CFG_STATUS_RxLOS){ -- alarm |= WAN_TE3_BIT_LOS_ALARM; -- DEBUG_TE3("%s: (T3/E3) LOS Alarm is ON\n", fe->name); -+ alarms |= WAN_TE3_BIT_LOS_ALARM; - }else{ -- alarm &= ~WAN_TE3_BIT_LOS_ALARM; -- DEBUG_TE3("%s: (T3/E3) LOS Alarm is OFF\n", fe->name); -+ alarms &= ~WAN_TE3_BIT_LOS_ALARM; - } - if (value & BIT_RxDS3_CFG_STATUS_RxOOF){ -- alarm |= WAN_TE3_BIT_OOF_ALARM; -- DEBUG_TE3("%s: (T3/E3) OOF Alarm is ON\n", fe->name); -+ alarms |= WAN_TE3_BIT_OOF_ALARM; - }else{ -- alarm &= ~WAN_TE3_BIT_OOF_ALARM; -- DEBUG_TE3("%s: (T3/E3) OOF Alarm is OFF\n", fe->name); -+ alarms &= ~WAN_TE3_BIT_OOF_ALARM; - } - value = READ_REG(REG_RxDS3_STATUS); - if (value & BIT_RxDS3_STATUS_RxFERF){ -- alarm |= WAN_TE3_BIT_YEL_ALARM; -- DEBUG_TE3("%s: (T3/E3) YEL Alarm is ON\n", fe->name); -+ alarms |= WAN_TE3_BIT_YEL_ALARM; - }else{ -- alarm &= ~WAN_TE3_BIT_YEL_ALARM; -- DEBUG_TE3("%s: (T3/E3) YEL Alarm is OFF\n", fe->name); -+ alarms &= ~WAN_TE3_BIT_YEL_ALARM; - } - }else{ - value = READ_REG(REG_RxE3_CFG_STATUS_2); - if (value & BIT_RxE3_CFG_STATUS_RxOOF){ -- DEBUG_TE3("%s: (T3/E3) OOF Alarm ON!\n", -- fe->name); -- alarm |= WAN_TE3_BIT_OOF_ALARM; -+ alarms |= WAN_TE3_BIT_OOF_ALARM; - }else{ -- DEBUG_TE3("%s: (T3/E3) OOF Alarm OFF!\n", -- fe->name); -- alarm &= ~WAN_TE3_BIT_OOF_ALARM; -+ alarms &= ~WAN_TE3_BIT_OOF_ALARM; - } - - if (value & BIT_RxE3_CFG_STATUS_RxLOF){ -- DEBUG_TE3("%s: (T3/E3) LOF Alarm ON!\n", -- fe->name); -- alarm |= WAN_TE3_BIT_LOF_ALARM; -+ alarms |= WAN_TE3_BIT_LOF_ALARM; - }else{ -- DEBUG_TE3("%s: (T3/E3) LOF Alarm OFF!\n", -- fe->name); -- alarm &= ~WAN_TE3_BIT_LOF_ALARM; -+ alarms &= ~WAN_TE3_BIT_LOF_ALARM; - } - - if (value & BIT_RxE3_CFG_STATUS_RxLOS){ -- DEBUG_TE3("%s: (T3/E3) LOS Alarm ON!\n", -- fe->name); -- alarm |= WAN_TE3_BIT_LOS_ALARM; -+ alarms |= WAN_TE3_BIT_LOS_ALARM; - }else{ -- DEBUG_TE3("%s: (T3/E3) LOS Alarm OFF!\n", -- fe->name); -- alarm &= ~WAN_TE3_BIT_LOS_ALARM; -+ alarms &= ~WAN_TE3_BIT_LOS_ALARM; - } - - if (value & BIT_RxE3_CFG_STATUS_RxAIS){ -- DEBUG_TE3("%s: (T3/E3) AIS Alarm ON!\n", -- fe->name); -- alarm |= WAN_TE3_BIT_AIS_ALARM; -+ alarms |= WAN_TE3_BIT_AIS_ALARM; - }else{ -- DEBUG_TE3("%s: (T3/E3) AIS Alarm OFF!\n", -- fe->name); -- alarm &= ~WAN_TE3_BIT_AIS_ALARM; -+ alarms &= ~WAN_TE3_BIT_AIS_ALARM; - } - - if (value & BIT_RxE3_CFG_STATUS_RxFERF){ -- DEBUG_TE3("%s: (T3/E3) Rx FERF status is ON (YELLOW)!\n", -- fe->name); -- alarm |= WAN_TE3_BIT_YEL_ALARM; -+ alarms |= WAN_TE3_BIT_YEL_ALARM; - }else{ -- DEBUG_TE3("%s: (T3/E3) Rx FERF status is OFF!\n", -- fe->name); -- alarm &= ~WAN_TE3_BIT_YEL_ALARM; -+ alarms &= ~WAN_TE3_BIT_YEL_ALARM; - } - } -+ return alarms; -+} - -- fe->fe_alarm = alarm; -- if (update){ -- sdla_te3_set_status(fe); -+static int sdla_te3_print_alarms(sdla_fe_t *fe, unsigned int alarms) ++static void wp_aft_serial_status_isr(sdla_t *card, u32 serial_intr_status) +{ -+ -+ DEBUG_EVENT("%s: %s Framer Alarms status (%X):\n", -+ fe->name, -+ FE_MEDIA_DECODE(fe), -+ alarms); ++ u32 reg; + -+ if (!alarms){ -+ DEBUG_EVENT("%s: %s Alarms status: No alarms detected!\n", -+ fe->name, -+ FE_MEDIA_DECODE(fe)); -+ return 0; - } -- return alarm; -+ if (alarms & WAN_TE3_BIT_AIS_ALARM){ -+ DEBUG_EVENT("%s: AIS Alarm is ON\n", fe->name); -+ } -+ if (alarms & WAN_TE3_BIT_LOS_ALARM){ -+ DEBUG_EVENT("%s: LOS Alarm is ON\n", fe->name); -+ } -+ if (alarms & WAN_TE3_BIT_OOF_ALARM){ -+ DEBUG_EVENT("%s: OOF Alarm is ON\n", fe->name); -+ } -+ if (alarms & WAN_TE3_BIT_YEL_ALARM){ -+ DEBUG_EVENT("%s: YEL Alarm is ON\n", fe->name); -+ } -+ if (alarms & WAN_TE3_BIT_LOF_ALARM){ -+ DEBUG_EVENT("%s: LOF Alarm OFF!\n", fe->name); -+ } -+ -+ return 0; -+} ++ __sdla_bus_read_4(card->hw, AFT_PORT_REG(card,AFT_SERIAL_LINE_CFG_REG), ®); + -+static unsigned int sdla_te3_read_alarms(sdla_fe_t *fe, int action) -+{ -+ unsigned int alarms = 0; -+ -+ if (IS_FE_ALARM_READ(action)){ -+ alarms = sdla_te3_read_framer_alarms(fe); -+ } -+ -+ if (IS_FE_ALARM_PRINT(action)){ -+ sdla_te3_print_alarms(fe, alarms); -+ } -+ -+ if (IS_FE_ALARM_UPDATE(action)){ -+ fe->fe_alarm = alarms; -+ sdla_te3_set_status(fe); ++ if (wan_test_bit(AFT_CHIPCFG_SERIAL_CTS_STATUS_INTR_BIT,&serial_intr_status)) { ++ DEBUG_EVENT("%s: CTS ISR Status 0x%02X\n", ++ card->devname, ++ wan_test_bit(AFT_SERIAL_LCFG_CTS_BIT,®)); + } -+ return alarms; - } - - -@@ -616,18 +626,20 @@ - } - - /****************************************************************************** -- * sdla_te3_read_pmon() -- * -- * Description: -- * Arguments: -- * Returns: -- ****************************************************************************** -- */ -+* sdla_te3_read_pmon() -+* -+* Description: -+* Arguments: -+* Returns: -+******************************************************************************/ - static int sdla_te3_read_pmon(sdla_fe_t *fe, int action) ++ ++ if (wan_test_bit(AFT_CHIPCFG_SERIAL_DCD_STATUS_INTR_BIT,&serial_intr_status)) { ++ DEBUG_EVENT("%s: DCS ISR Status 0x%02X\n", ++ card->devname, ++ wan_test_bit(AFT_SERIAL_LCFG_DCD_BIT,®)); ++ } ++ ++ if (wan_test_bit(AFT_CHIPCFG_SERIAL_RTS_STATUS_INTR_BIT,&serial_intr_status)) { ++ DEBUG_EVENT("%s: RTS ISR Status 0x%02X\n", ++ card->devname, ++ wan_test_bit(AFT_SERIAL_LCFG_RTS_BIT,®)); ++ } ++} ++ + static void wp_aft_dma_per_port_isr(sdla_t *card) { - sdla_te3_pmon_t *pmon = (sdla_te3_pmon_t*)&fe->fe_stats.u.te3_pmon; - unsigned char value_msb, value_lsb; + int i; +@@ -5721,7 +5800,7 @@ + + /* Receive DMA Engine */ + __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_RX_DMA_INTR_PENDING_REG),&dma_rx_reg); +- DEBUG_BRI("Line: %d: dma_rx_reg: 0x%X\n", __LINE__, dma_rx_reg); ++ DEBUG_TEST("Line: %d: dma_rx_reg: 0x%X\n", __LINE__, dma_rx_reg); -+ WAN_ASSERT(fe->write_fe_reg == NULL); -+ WAN_ASSERT(fe->read_fe_reg == NULL); -+ - value_msb = READ_REG(REG_PMON_LCV_MSB); - value_lsb = READ_REG(REG_PMON_LCV_LSB); - pmon->pmon_lcv += ((value_msb << 8) | value_lsb); -@@ -651,6 +663,112 @@ - } + dma_rx_reg&=card->u.aft.active_ch_map; - /****************************************************************************** -+* sdla_te3_flush_pmon() -+* -+* Description: -+* Arguments: -+* Returns: -+******************************************************************************/ -+static int sdla_te3_flush_pmon(sdla_fe_t *fe) -+{ -+ sdla_te3_pmon_t *pmon = (sdla_te3_pmon_t*)&fe->fe_stats.u.te3_pmon; -+ -+ pmon->pmon_lcv = 0; -+ pmon->pmon_framing = 0; -+ pmon->pmon_parity = 0; -+ pmon->pmon_febe = 0; -+ pmon->pmon_cpbit = 0; -+ return 0; -+} -+ -+/****************************************************************************** -+* sdla_te3_old_set_lb_modes() -+* -+* Description: -+* Arguments: -+* Returns: -+******************************************************************************/ -+static int -+sdla_te3_old_set_lb_modes(sdla_fe_t *fe, unsigned char type, unsigned char mode) -+{ -+ -+ WAN_ASSERT(fe->write_cpld == NULL); -+ DEBUG_EVENT("%s: %s %s mode...\n", -+ fe->name, -+ WAN_TE3_LB_MODE_DECODE(mode), -+ WAN_TE3_LB_TYPE_DECODE(type)); -+ -+ if (mode == WAN_TE3_DEACTIVATE_LB){ -+ fe->te3_param.cpld_status &= ~BIT_CPLD_STATUS_LLB; -+ fe->te3_param.cpld_status &= ~BIT_CPLD_STATUS_RLB; -+ }else{ -+ switch(type){ -+ case WAN_TE3_LIU_LB_ANALOG: -+ fe->te3_param.cpld_status |= BIT_CPLD_STATUS_LLB; -+ fe->te3_param.cpld_status &= ~BIT_CPLD_STATUS_RLB; -+ break; -+ case WAN_TE3_LIU_LB_REMOTE: -+ fe->te3_param.cpld_status &= ~BIT_CPLD_STATUS_LLB; -+ fe->te3_param.cpld_status |= BIT_CPLD_STATUS_RLB; -+ break; -+ case WAN_TE3_LIU_LB_DIGITAL: -+ fe->te3_param.cpld_status |= BIT_CPLD_STATUS_LLB; -+ fe->te3_param.cpld_status |= BIT_CPLD_STATUS_RLB; -+ break; -+ default : -+ DEBUG_EVENT("%s: (T3/E3) Unknown loopback mode!\n", -+ fe->name); -+ break; -+ } -+ } -+ /* Write value to CPLD Status/Control register */ -+ WRITE_CPLD(REG_CPLD_STATUS, fe->te3_param.cpld_status); -+ return 0; -+} -+ -+static int -+sdla_te3_set_lb_modes(sdla_fe_t *fe, unsigned char type, unsigned char mode) -+{ -+ unsigned char data = 0x00; -+ -+ WAN_ASSERT(fe->write_fe_reg == NULL); -+ WAN_ASSERT(fe->read_fe_reg == NULL); -+ DEBUG_EVENT("%s: %s %s mode...\n", -+ fe->name, -+ WAN_TE3_LB_MODE_DECODE(mode), -+ WAN_TE3_LB_TYPE_DECODE(type)); -+ -+ data = READ_REG(REG_LINE_INTERFACE_DRIVE); -+ if (mode == WAN_TE3_DEACTIVATE_LB){ -+ data &= ~BIT_LINE_INTERFACE_DRIVE_LLOOP; -+ data &= ~BIT_LINE_INTERFACE_DRIVE_RLOOP; -+ }else{ -+ switch(type){ -+ case WAN_TE3_LIU_LB_NORMAL: -+ break; -+ case WAN_TE3_LIU_LB_ANALOG: -+ data |= BIT_LINE_INTERFACE_DRIVE_LLOOP; -+ data &= ~BIT_LINE_INTERFACE_DRIVE_RLOOP; -+ break; -+ case WAN_TE3_LIU_LB_REMOTE: -+ data &= ~BIT_LINE_INTERFACE_DRIVE_LLOOP; -+ data |= BIT_LINE_INTERFACE_DRIVE_RLOOP; -+ break; -+ case WAN_TE3_LIU_LB_DIGITAL: -+ data |= BIT_LINE_INTERFACE_DRIVE_LLOOP; -+ data |= BIT_LINE_INTERFACE_DRIVE_RLOOP; -+ break; -+ default : -+ DEBUG_EVENT("%s: (T3/E3) Unknown loopback mode!\n", -+ fe->name); -+ break; -+ } -+ } -+ WRITE_REG(REG_LINE_INTERFACE_DRIVE, data); -+ return 0; -+} -+ -+/****************************************************************************** - * sdla_te3_udp() +@@ -5730,10 +5809,10 @@ + } + + dma_rx_reg &= card->u.aft.logic_ch_map; +- DEBUG_BRI("Line: %d: dma_rx_reg: 0x%X\n", __LINE__, dma_rx_reg); ++ DEBUG_TEST("Line: %d: dma_rx_reg: 0x%X\n", __LINE__, dma_rx_reg); + + dma_rx_reg &= ~(card->u.aft.tdm_logic_ch_map); +- DEBUG_BRI("Line: %d: dma_rx_reg: 0x%X\n", __LINE__, dma_rx_reg); ++ DEBUG_TEST("Line: %d: dma_rx_reg: 0x%X\n", __LINE__, dma_rx_reg); + + for (i=0; icommon); //chan->if_stats.rx_frame_errors++; + #endif + +- DEBUG_BRI("%s: RX Interrupt pend. \n", card->devname); ++ DEBUG_TEST("%s: RX Interrupt pend. \n", card->devname); + + aft_dma_rx_complete(card,chan,0); + +@@ -6295,8 +6374,7 @@ + + case AFT_HWEC_STATUS: + *(unsigned long *)&wan_udp_pkt->wan_udp_data[0] = +- IS_E1_CARD(card) ? card->wandev.ec_map: +- card->wandev.ec_map << 1; ++ card->wandev.fe_ec_map; + wan_udp_pkt->wan_udp_data_len = sizeof(unsigned long); + wan_udp_pkt->wan_udp_return_code = 0; + break; +@@ -8025,7 +8103,8 @@ + * aft_dma_chain_init * - * Description: -@@ -660,7 +778,9 @@ */ - static int sdla_te3_udp(sdla_fe_t *fe, void *pudp_cmd, unsigned char *data) +-static void aft_tx_dma_chain_init(private_area_t *chan, wan_dma_descr_t *dma_chain) ++static void ++aft_tx_dma_chain_init(private_area_t *chan, wan_dma_descr_t *dma_chain) { -+ sdla_t *card = (sdla_t*)fe->card; - wan_cmd_t *udp_cmd = (wan_cmd_t*)pudp_cmd; -+ int err = -EINVAL; + #define card chan->card - switch(udp_cmd->wan_cmd_command){ - case WAN_GET_MEDIA_TYPE: -@@ -671,19 +791,26 @@ +@@ -8512,16 +8591,18 @@ + wan_skb_trim(dma_chain->skb,0); + + /* A-DMA */ +- card->hw_iface.busdma_map( card->hw, +- dma_chain, +- wan_skb_tail(dma_chain->skb), +- chan->dma_mru, +- chan->dma_mru, +- SDLA_DMA_PREREAD); +- card->hw_iface.busdma_sync( card->hw, +- dma_chain, +- MAX_AFT_DMA_CHAINS, chan->single_dma_chain, +- SDLA_DMA_PREREAD); ++ card->hw_iface.busdma_map( ++ card->hw, ++ dma_chain, ++ wan_skb_tail(dma_chain->skb), ++ chan->dma_mru, ++ chan->dma_mru, ++ SDLA_DMA_PREREAD); ++ card->hw_iface.busdma_sync( ++ card->hw, ++ dma_chain, ++ MAX_AFT_DMA_CHAINS, chan->single_dma_chain, ++ SDLA_DMA_PREREAD); + DEBUG_DMA("%s: RXDMA PHY = 0x%08X VIRT = %p \n", + chan->if_name, + dma_chain->dma_addr,wan_skb_tail(dma_chain->skb)+dma_chain->dma_offset); +@@ -8636,16 +8717,18 @@ + + } - case WAN_FE_SET_LB_MODE: - /* Activate/Deactivate Line Loopback modes */ --// err = sdla_set_te1_lb_modes(card, data[0], data[1]); --// udp_cmd->wan_cmd_return_code = --// (!err) ? WAN_CMD_OK : WAN_UDP_FAILED_CMD; --// udp_cmd->wan_cmd_data_len = 0x00; -+ if (card->adptr_subtype == AFT_SUBTYPE_NORMAL){ -+ err = sdla_te3_old_set_lb_modes(fe, data[0], data[1]); -+ }else if (card->adptr_subtype == AFT_SUBTYPE_SHARK){ -+ err = sdla_te3_set_lb_modes(fe, data[0], data[1]); -+ } -+ udp_cmd->wan_cmd_return_code = -+ (!err) ? WAN_CMD_OK : WAN_UDP_FAILED_CMD; -+ udp_cmd->wan_cmd_data_len = 0x00; - break; +- card->hw_iface.busdma_map( card->hw, +- dma_chain, +- wan_skb_tail(dma_chain->skb), +- chan->dma_mru, +- chan->dma_mru, +- SDLA_DMA_PREREAD); +- card->hw_iface.busdma_sync( card->hw, +- dma_chain, +- 1, chan->single_dma_chain, +- SDLA_DMA_PREREAD); ++ card->hw_iface.busdma_map( ++ card->hw, ++ dma_chain, ++ wan_skb_tail(dma_chain->skb), ++ chan->dma_mru, ++ chan->dma_mru, ++ SDLA_DMA_PREREAD); ++ card->hw_iface.busdma_sync( ++ card->hw, ++ dma_chain, ++ 1, chan->single_dma_chain, ++ SDLA_DMA_PREREAD); + intr=0; + if (!wan_test_bit(RX_INTR_PENDING,&chan->dma_chain_status)){ + +@@ -8861,13 +8944,16 @@ + dma_chain, + SDLA_DMA_POSTREAD); - case WAN_FE_GET_STAT: - /* TE1_56K Read T1/E1/56K alarms */ --#if 0 -- *(unsigned long *)&data[0] = sdla_te3_alarm(fe, 0); --#endif -- /* TE1 Update T1/E1 perfomance counters */ - sdla_te3_read_pmon(fe, 0); -+ if (udp_cmd->wan_cmd_fe_force){ -+ /* force to read FE alarms */ -+ DEBUG_EVENT("%s: Force to read Front-End alarms\n", -+ fe->name); -+ fe->fe_stats.alarms = -+ sdla_te3_read_alarms(fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE); -+ } - memcpy(&data[0], &fe->fe_stats, sizeof(sdla_fe_stats_t)); - udp_cmd->wan_cmd_return_code = WAN_CMD_OK; - udp_cmd->wan_cmd_data_len = sizeof(sdla_fe_stats_t); -@@ -691,7 +818,7 @@ ++#if defined(__FreeBSD__) ++ wan_skb_put(dma_chain->skb, rx_el->len); ++#endif + wan_skb_queue_tail(&chan->wp_rx_complete_list,dma_chain->skb); + rx_data_available=1; - case WAN_FE_FLUSH_PMON: - /* TE1 Flush T1/E1 pmon counters */ --// memset(&fe->fe_stats.u.te3_pmon, 0, sizeof(sdla_te3_pmon_t)); -+ sdla_te3_flush_pmon(fe); - udp_cmd->wan_cmd_return_code = WAN_CMD_OK; - break; - -@@ -716,6 +843,9 @@ +- DEBUG_BRI("%s: RxInt Pending chain %d Rxlist=%d LO:0x%X HI:0x%X!\n", ++ DEBUG_TEST("%s: RxInt Pending chain %d Rxlist=%d LO:0x%X HI:0x%X Len=%i!\n", + chan->if_name,dma_chain->index, + wan_skb_queue_len(&chan->wp_rx_complete_list), +- rx_el->align,rx_el->reg); ++ rx_el->align,rx_el->reg, rx_el->len); + + rx_hndlr_skip_rx: + dma_chain->skb=NULL; +@@ -10314,24 +10400,27 @@ + #else + + #if 1 +- card->hw_iface.busdma_sync( card->hw, +- &chan->tx_dma_chain_table[0], +- MAX_AFT_DMA_CHAINS, +- chan->single_dma_chain, +- SDLA_DMA_POSTREAD); ++ card->hw_iface.busdma_sync( ++ card->hw, ++ &chan->tx_dma_chain_table[0], ++ MAX_AFT_DMA_CHAINS, ++ chan->single_dma_chain, ++ SDLA_DMA_POSTREAD); + + WAN_TDMV_CALL(rx_tx_span, (card), err); + +- card->hw_iface.busdma_sync( card->hw, +- &chan->tx_dma_chain_table[0], +- MAX_AFT_DMA_CHAINS, +- chan->single_dma_chain, +- SDLA_DMA_PREWRITE); +- card->hw_iface.busdma_sync( card->hw, +- &chan->rx_dma_chain_table[0], +- MAX_AFT_DMA_CHAINS, +- chan->single_dma_chain, +- SDLA_DMA_PREREAD); ++ card->hw_iface.busdma_sync( ++ card->hw, ++ &chan->tx_dma_chain_table[0], ++ MAX_AFT_DMA_CHAINS, ++ chan->single_dma_chain, ++ SDLA_DMA_PREWRITE); ++ card->hw_iface.busdma_sync( ++ card->hw, ++ &chan->rx_dma_chain_table[0], ++ MAX_AFT_DMA_CHAINS, ++ chan->single_dma_chain, ++ SDLA_DMA_PREREAD); + + #else + #warning "NCDEBUG: rx_tx_span disabled irq" +@@ -11281,7 +11370,7 @@ + static int aft_hwec_config (sdla_t *card, private_area_t *chan, wanif_conf_t *conf, int ctrl) { - sdla_fe_cfg_t *fe_cfg = &fe->fe_cfg; + int err = 0; +- unsigned int channel=0; ++ int fe_chan = 0; + unsigned int tdmv_hwec_option=0; + + if (conf) { +@@ -11291,38 +11380,41 @@ + if (chan->common.usedby == TDM_VOICE_API || + chan->common.usedby == TDM_VOICE){ -+ WAN_ASSERT(fe->write_fe_reg == NULL); -+ WAN_ASSERT(fe->read_fe_reg == NULL); -+ - DEBUG_EVENT("%s: Enabling interrupts for %s (%d)!\n", - fe->name, FE_MEDIA_DECODE(fe), IS_DS3(fe_cfg)); - /* Enable Framer Interrupts */ -@@ -778,6 +908,7 @@ - sdla_fe_cfg_t *fe_cfg = &fe->fe_cfg; - unsigned char data = 0x00; ++ /* Nov 6, 2007 Calling EC function with FE channel number. */ + if (IS_TE1_CARD(card)) { + if (IS_T1_CARD(card)){ +- channel = chan->first_time_slot; ++ fe_chan = chan->first_time_slot+1; + }else{ +- channel = chan->first_time_slot; ++ fe_chan = chan->first_time_slot; + } ++ } else if (IS_FXOFXS_CARD(card)) { ++ fe_chan = chan->first_time_slot+1; + } else { +- channel = chan->first_time_slot; ++ fe_chan = chan->first_time_slot+1; + } + + #if defined(CONFIG_WANPIPE_HWEC) + if (ctrl == 0 && card->wandev.ec_enable){ +- card->wandev.ec_enable(card, 0, channel); ++ card->wandev.ec_enable(card, 0, fe_chan); + + } else if (tdmv_hwec_option && card->wandev.ec_enable){ -+ WAN_ASSERT(fe->write_cpld == NULL); - if (fe_cfg->media == WAN_MEDIA_E3){ - data |= BIT_CPLD_CNTRL_E3; - } -@@ -812,33 +943,7 @@ - name); - data &= ~BIT_CPLD_STATUS_TAOS; - } -- switch(liu->lb_mode){ -- case WAN_TE3_LIU_LB_NORMAL: -- break; -- case WAN_TE3_LIU_LB_ANALOG: -- DEBUG_TE3("%s: (T3/E3) Enable Analog Loopback mode!\n", -- name); -- data |= BIT_CPLD_STATUS_LLB; -- data &= ~BIT_CPLD_STATUS_RLB; -- break; -- case WAN_TE3_LIU_LB_REMOTE: -- DEBUG_TE3("%s: (T3/E3) Enable Remote Loopback mode!\n", -- name); -- data &= ~BIT_CPLD_STATUS_LLB; -- data |= BIT_CPLD_STATUS_RLB; -- break; -- case WAN_TE3_LIU_LB_DIGITAL: -- DEBUG_TE3("%s: (T3/E3) Enable Digital Loopback mode!\n", -- name); -- data |= BIT_CPLD_STATUS_LLB; -- data |= BIT_CPLD_STATUS_RLB; -- break; -- default : -- DEBUG_EVENT("%s: (T3/E3) Unknown loopback mode!\n", -- name); -- break; -- } -- /* Write value to CPLD Status/Control register */ -+ /* Write value to CPLD Status register */ - WRITE_CPLD(REG_CPLD_STATUS, data); - return 0; - } -@@ -857,11 +962,13 @@ - sdla_fe_cfg_t *fe_cfg = &fe->fe_cfg; - unsigned char data = 0x00; + if(IS_BRI_CARD(card)){ +- DEBUG_HWEC("%s(): original channel: %d\n", __FUNCTION__, channel); ++ DEBUG_HWEC("%s(): original fe_chan: %d\n", __FUNCTION__, fe_chan); -+ WAN_ASSERT(fe->write_fe_cpld == NULL); -+ fe->te3_param.cpld_cntrl = 0x00; - if (fe_cfg->media == WAN_MEDIA_E3){ -- data |= BIT_EXAR_CPLD_CNTRL_E3; -+ fe->te3_param.cpld_cntrl |= BIT_EXAR_CPLD_CNTRL_E3; - } - /* Write value to CPLD Control register */ -- WRITE_EXAR_CPLD(REG_EXAR_CPLD_CNTRL, data); -+ WRITE_EXAR_CPLD(REG_EXAR_CPLD_CNTRL, fe->te3_param.cpld_cntrl); - - data = 0x00; - if (liu->rx_equal == WAN_TRUE){ -@@ -892,33 +999,6 @@ - data &= ~BIT_LINE_INTERFACE_DRIVE_TAOS; - } - -- switch(liu->lb_mode){ -- case WAN_TE3_LIU_LB_NORMAL: -- break; -- case WAN_TE3_LIU_LB_ANALOG: -- DEBUG_TE3("%s: (T3/E3) Enable Analog Loopback mode!\n", -- name); -- data |= BIT_LINE_INTERFACE_DRIVE_LLOOP; -- data &= ~BIT_LINE_INTERFACE_DRIVE_RLOOP; -- break; -- case WAN_TE3_LIU_LB_REMOTE: -- DEBUG_TE3("%s: (T3/E3) Enable Remote Loopback mode!\n", -- name); -- data &= ~BIT_LINE_INTERFACE_DRIVE_LLOOP; -- data |= BIT_LINE_INTERFACE_DRIVE_RLOOP; -- break; -- case WAN_TE3_LIU_LB_DIGITAL: -- DEBUG_TE3("%s: (T3/E3) Enable Digital Loopback mode!\n", -- name); -- data |= BIT_LINE_INTERFACE_DRIVE_LLOOP; -- data |= BIT_LINE_INTERFACE_DRIVE_RLOOP; -- break; -- default : -- DEBUG_EVENT("%s: (T3/E3) Unknown loopback mode!\n", -- name); -- break; -- } -- WRITE_REG(REG_LINE_INTERFACE_DRIVE, data); - - return 0; - } -@@ -934,8 +1014,9 @@ - fe_iface->polling = &sdla_te3_polling; - fe_iface->isr = &sdla_te3_isr; - fe_iface->process_udp = &sdla_te3_udp; -- fe_iface->read_alarm = &sdla_te3_alarm; -+ fe_iface->read_alarm = &sdla_te3_read_alarms; - fe_iface->read_pmon = &sdla_te3_read_pmon; -+ fe_iface->flush_pmon = &sdla_te3_flush_pmon; - fe_iface->set_fe_alarm = &sdla_te3_set_alarm; - fe_iface->get_fe_status = &sdla_te3_get_fe_status; - fe_iface->get_fe_media = &sdla_te3_get_fe_media; -@@ -954,6 +1035,9 @@ - u16 adptr_subtype; - unsigned char data = 0x00; - -+ WAN_ASSERT(fe->write_fe_reg == NULL); -+ WAN_ASSERT(fe->read_fe_reg == NULL); -+ - card->hw_iface.getcfg(card->hw, SDLA_ADAPTERSUBTYPE, &adptr_subtype); - - data = READ_REG(0x02); -@@ -1067,7 +1151,7 @@ - fe->fe_status = FE_DISCONNECTED; - DEBUG_EVENT("%s: %s disconnected!\n", - fe->name, FE_MEDIA_DECODE(fe)); -- sdla_te3_alarm(fe, 1); -+ sdla_te3_read_alarms(fe, 1); + /* translate channel to be 0 or 1, nothing else!! */ +- channel = (channel % 2); +- DEBUG_HWEC("%s(): new channel: %d\n", __FUNCTION__, channel); ++ fe_chan = (fe_chan % 2); ++ DEBUG_HWEC("%s(): new fe_chan: %d\n", __FUNCTION__, fe_chan); + } - sdla_te3_set_intr(fe); - return 0; +- DEBUG_HWEC("%s: HW echo canceller Enabled on channel %d\n", ++ DEBUG_HWEC("[HWEC] %s: Enable Echo Canceller on fe_chan %d\n", + chan->if_name, +- channel); ++ fe_chan); + +- err = card->wandev.ec_enable(card, 1, channel); ++ err = card->wandev.ec_enable(card, 1, fe_chan); + if (err) { +- DEBUG_EVENT("%s: Failed to enable HWEC on channel %d\n", +- chan->if_name,channel); ++ DEBUG_EVENT("%s: Failed to enable HWEC on fe chan %d\n", ++ chan->if_name,fe_chan); + return err; + } + } diff --git a/patches/kdrivers/src/net/modules.order b/patches/kdrivers/src/net/modules.order deleted file mode 100644 index eb0e518..0000000 --- a/patches/kdrivers/src/net/modules.order +++ /dev/null @@ -1,7 +0,0 @@ -kernel//root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/sdladrv.ko -kernel//root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanrouter.ko -kernel//root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanpipe.ko -kernel//root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanpipe_syncppp.ko -kernel//root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/af_wanpipe.ko -kernel//root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wanec.ko -kernel//root/development/3.2/wanpipe-3.2.5.3/patches/kdrivers/src/net/wan_aften.ko diff --git a/patches/kdrivers/src/net/output b/patches/kdrivers/src/net/output deleted file mode 100644 index 875f33e..0000000 --- a/patches/kdrivers/src/net/output +++ /dev/null @@ -1,1385 +0,0 @@ -47a48,54 -> #if !defined(__WINDOWS__) -> #if 1 -> #define AFT_FUNC_DEBUG() -> #else -> #define AFT_FUNC_DEBUG() DEBUG_EVENT("%s:%d\n",__FUNCTION__,__LINE__) -> #endif -> #endif -58a66,71 -> #if 1 -> # define AFT_API_SUPPORT -> #else -> # undef AFT_API_SUPPORT -> #endif -> -65c78 -< #define AUDIO_RINGCHECK ---- -> #undef AUDIO_RINGCHECK -82c95 -< #define WP_RM_POLL_TIMER 1000 ---- -> #define WP_RM_POLL_TIMER 100 -92,93d104 -< //WP_RM_POLL_RING, -< //WP_RM_POLL_RING_STOP, -109c120,122 -< WP_RM_POLL_RING_DETECT ---- -> WP_RM_POLL_RING_DETECT, -> WP_RM_POLL_READ, -> WP_RM_POLL_WRITE -111a125,150 -> #define WP_RM_POLL_DECODE(type) \ -> ((type) == WP_RM_POLL_TONE_DIAL) ? "Tone (dial)": \ -> ((type) == WP_RM_POLL_TONE_BUSY) ? "Tone (busy)": \ -> ((type) == WP_RM_POLL_TONE_RING) ? "Tone (ring)": \ -> ((type) == WP_RM_POLL_TONE_CONGESTION) ? "Tone (congestion)": \ -> ((type) == WP_RM_POLL_TONE_DONE) ? "Tone (done)":\ -> ((type) == WP_RM_POLL_TDMV) ? "TDMV":\ -> ((type) == WP_RM_POLL_EVENT) ? "RM-Event":\ -> ((type) == WP_RM_POLL_INIT) ? "Init":\ -> ((type) == WP_RM_POLL_POWER) ? "Power":\ -> ((type) == WP_RM_POLL_LC) ? "Loop closure":\ -> ((type) == WP_RM_POLL_RING_TRIP) ? "Ring Trip":\ -> ((type) == WP_RM_POLL_DTMF) ? "DTMF":\ -> ((type) == WP_RM_POLL_RING) ? "Ring":\ -> ((type) == WP_RM_POLL_TONE) ? "Tone":\ -> ((type) == WP_RM_POLL_TXSIG_KEWL) ? "TX Sig KEWL":\ -> ((type) == WP_RM_POLL_TXSIG_START) ? "TX Sig Start":\ -> ((type) == WP_RM_POLL_TXSIG_OFFHOOK) ? "TX Sig Off-hook":\ -> ((type) == WP_RM_POLL_TXSIG_ONHOOK) ? "TX Sig On-hook":\ -> ((type) == WP_RM_POLL_ONHOOKTRANSFER) ? "On-hook transfer":\ -> ((type) == WP_RM_POLL_SETPOLARITY) ? "Set polarity":\ -> ((type) == WP_RM_POLL_RING_DETECT) ? "Ring Detect":\ -> ((type) == WP_RM_POLL_READ) ? "FE Read":\ -> ((type) == WP_RM_POLL_WRITE) ? "FE Write":"Unknown RM poll event" -> -> -334a374 -> static int acim2tiss[16] = { 0x0, 0x1, 0x4, 0x5, 0x7, 0x0, 0x0, 0x6, 0x0, 0x0, 0x0, 0x2, 0x0, 0x3 }; -346c386 -< static int battdebounce = DEFAULT_BATT_DEBOUNCE; ---- -> static int battdebounce = 64; //DEFAULT_BATT_DEBOUNCE; -357a398 -> static int wp_remora_pre_release(void* pfe); -427a469,479 -> -> #if 0 -> { -> unsigned int value; -> -> /* Enable Slow speed SPI */ -> card->hw_iface.bus_read_4(card->hw, 0x40, &data); -> data |= 0x00000020; -> card->hw_iface.bus_write_4(card->hw, 0x40, data); -> } -> #endif -481c533 -< fe->name, mod_no, ---- -> fe->name, mod_no+1, -490c542 -< fe->name, mod_no, ---- -> fe->name, mod_no+1, -501c553 -< fe->name, mod_no); ---- -> fe->name, mod_no+1); -519c571 -< fe->name, mod_no,mod_no+1); ---- -> fe->name, mod_no+1,mod_no+2); -526c578 -< fe->name, mod_no,mod_no+1); ---- -> fe->name, mod_no+1,mod_no+2); -541c593 -< fe->name, mod_no,mod_no+1); ---- -> fe->name, mod_no+1,mod_no+2); -561c613 -< fe->name, mod_no, byte); ---- -> fe->name, mod_no+1, byte); -578c630 -< fe->name, mod_no); ---- -> fe->name, mod_no+1); -583c635 -< fe->name, mod_no,mod_no+1, ---- -> fe->name, mod_no+1,mod_no+2, -599c651 -< mod_no, ---- -> mod_no+1, -619c671 -< fe->name, mod_no, value); ---- -> fe->name, mod_no+1, value); -627c679 -< fe->name, mod_no, value); ---- -> fe->name, mod_no+1, value); -635c687 -< fe->name, mod_no, value); ---- -> fe->name, mod_no+1, value); -642d693 -< -654,656d704 -< start_ticks = SYSTEM_TICKS; -< WRITE_RM_REG(mod_no, 14, 0x0); /* DIFF DEMO 0x10 */ -< -660c708,711 -< WRITE_RM_REG(mod_no, 93, 0x1F); ---- -> //WRITE_RM_REG(mod_no, 93, 0x1F); -> WRITE_RM_REG(mod_no, 14, 0x0); /* DIFF DEMO 0x10 */ -> -> start_ticks = SYSTEM_TICKS; -672c723 -< "%s: Module %d: Failed to powerup within %d ms (%d mV only)!\n", ---- -> "%s: Module %d: Failed to powerup within %d ms (%dV : %dV)!\n", -674c725 -< mod_no, ---- -> mod_no+1, -676c727 -< vbat * 375); ---- -> (vbat * 375)/1000, (0xc0 * 375)/1000); -680c731 -< mod_no); ---- -> mod_no+1); -688c739 -< fe->name, mod_no, ---- -> fe->name, mod_no+1, -697c748 -< DEBUG_RM( ---- -> DEBUG_EVENT( -699c750 -< fe->name, mod_no); ---- -> fe->name, mod_no+1); -708d758 -< #if 1 -714,716c764,766 -< "%s: Module %d: Timeout waiting for DC-DC calibration\n", -< fe->name, -< mod_no); ---- -> "%s: Module %d: Timeout waiting for DC-DC calibration (%02X)\n", -> fe->name, mod_no+1, -> READ_RM_REG(mod_no, 93)); -721d770 -< #endif -725c774 -< static int wp_proslic_powerleak_test(sdla_fe_t *fe, int mod_no) ---- -> static int wp_proslic_powerleak_test(sdla_fe_t *fe, int mod_no, int fast) -735,740c784,785 -< while((vbat = READ_RM_REG(mod_no, 82)) >= 0x6){ -< if ((SYSTEM_TICKS - start_ticks) > (HZ/2)){ -< break; -< } -< wait_just_a_bit(HZ/10, 0); -< } ---- -> wait_just_a_bit(HZ, fast); -> vbat = READ_RM_REG(mod_no, 82); -744c789 -< fe->name, mod_no, ---- -> fe->name, mod_no+1, -752c797 -< mod_no, ---- -> mod_no+1, -757a803,907 -> static int wp_proslic_calibrate(sdla_fe_t *fe, int mod_no, int fast) -> { -> volatile unsigned long start_ticks; -> -> /* perform all calibration */ -> WRITE_RM_REG(mod_no, 97, 0x1f); -> /* start */ -> WRITE_RM_REG(mod_no, 96, 0x5f); -> -> start_ticks = SYSTEM_TICKS; -> while(READ_RM_REG(mod_no, 96)){ -> if ((SYSTEM_TICKS - start_ticks) > 2*HZ){ -> DEBUG_EVENT( -> "%s: Module %d: Timeout on module calibration!\n", -> fe->name, mod_no+1); -> return -1; -> } -> wait_just_a_bit(HZ/10, fast); -> } -> return 0; -> } -> -> static int wp_proslic_manual_calibrate(sdla_fe_t *fe, int mod_no, int fast) -> { -> volatile unsigned long start_ticks; -> int i=0; -> -> WRITE_RM_REG(mod_no, 21, 0x00); -> WRITE_RM_REG(mod_no, 22, 0x00); -> WRITE_RM_REG(mod_no, 23, 0x00); -> WRITE_RM_REG(mod_no, 64, 0x00); -> -> /* Step 14 */ -> WRITE_RM_REG(mod_no, 97, 0x18); -> WRITE_RM_REG(mod_no, 96, 0x47); -> -> /* Step 15 */ -> start_ticks = SYSTEM_TICKS; -> while(READ_RM_REG(mod_no, 96) != 0){ -> if ((SYSTEM_TICKS - start_ticks) > 800){ -> DEBUG_EVENT( -> "%s: Module %d: Timeout on SLIC calibration (15)!\n", -> fe->name, mod_no+1); -> return -1; -> } -> wait_just_a_bit(HZ/10, fast); -> } -> -> wait_just_a_bit(HZ/10, fast); -> WRITE_RM_REG(mod_no, 88, 0x00); -> WRITE_RM_REG(mod_no, 89, 0x00); -> WRITE_RM_REG(mod_no, 90, 0x00); -> WRITE_RM_REG(mod_no, 91, 0x00); -> WRITE_RM_REG(mod_no, 92, 0x00); -> WRITE_RM_REG(mod_no, 93, 0x00); -> -> /* Step 16 */ -> /* Insert manual calibration for sangoma Si3210 */ -> WRITE_RM_REG(mod_no, 98, 0x10); -> WRITE_RM_REG(mod_no, 99, 0x10); -> -> for (i = 0x1f; i > 0; i--){ -> WRITE_RM_REG(mod_no, 98, i); -> wait_just_a_bit(4, fast); -> if ((READ_RM_REG(mod_no, 88)) == 0){ -> break; -> } -> } -> for (i = 0x1f; i > 0; i--){ -> WRITE_RM_REG(mod_no, 99, i); -> wait_just_a_bit(4, fast); -> if ((READ_RM_REG(mod_no, 89)) == 0){ -> break; -> } -> } -> WRITE_RM_REG(mod_no, 64, 0x01); -> wait_just_a_bit(HZ, fast); -> WRITE_RM_REG(mod_no, 64, 0x00); -> /* Step 17 */ -> WRITE_RM_REG(mod_no, 23, 0x04); -> -> /* Step 18 */ -> /* DAC offset and without common mode calibration. */ -> WRITE_RM_REG(mod_no, 97, 0x01); /* Manual after */ -> /* Calibrate common mode and differential DAC mode DAC + ILIM */ -> WRITE_RM_REG(mod_no, 96, 0x40); -> -> /* Step 19 */ -> wait_just_a_bit(HZ*2, fast); -> start_ticks = SYSTEM_TICKS; -> while(READ_RM_REG(mod_no, 96) != 0){ -> if ((SYSTEM_TICKS - start_ticks) > 400){ -> DEBUG_EVENT( -> "%s: Module %d: Timeout on SLIC calibration (%ld:%ld!\n", -> fe->name, mod_no+1,start_ticks,SYSTEM_TICKS); -> return -1; -> } -> wait_just_a_bit(HZ/10, fast); -> } -> DEBUG_RM("%s: Module %d: Calibration is done\n", -> fe->name, mod_no+1); -> /*READ_RM_REG(mod_no, 96);*/ -> -> return 0; -> } -762,765c912,914 -< volatile unsigned long start_ticks; -< unsigned short tmp[5]; -< unsigned char value; -< volatile int i, x; ---- -> unsigned short tmp[5]; -> unsigned char value; -> volatile int x; -782a932,935 -> if (!fast){ -> fe->rm_param.mod[mod_no].u.fxs.proslic_power = PROSLIC_POWER_UNKNOWN; -> } -> -788c941 -< mod_no); ---- -> mod_no+1); -811c964 -< mod_no); ---- -> mod_no+1); -817c970 -< if (wp_proslic_powerleak_test(fe, mod_no)){ ---- -> if (wp_proslic_powerleak_test(fe, mod_no, fast)){ -821c974 -< mod_no); ---- -> mod_no+1); -829c982 -< mod_no); ---- -> mod_no+1); -836,873c989,993 -< /* Step 14 */ -< WRITE_RM_REG(mod_no, 97, 0x1E); -< WRITE_RM_REG(mod_no, 96, 0x47); -< -< /* Step 15 */ -< start_ticks = SYSTEM_TICKS; -< while(READ_RM_REG(mod_no, 96) != 0){ -< if ((SYSTEM_TICKS - start_ticks) > 400){ -< DEBUG_EVENT( -< "%s: Module %d: Timeout on SLIC calibration (15)!\n", -< fe->name, mod_no); -< return -1; -< } -< wait_just_a_bit(HZ/10, fast); -< } -< -< /* Step 16 */ -< /* Insert manual calibration for sangoma Si3210 */ -< WRITE_RM_REG(mod_no, 98, 0x10); -< //WRITE_RM_REG(mod_no, 98, 0x1F/*0x10*/); -< for (i = 0x1f; i > 0; i--){ -< -< WRITE_RM_REG(mod_no, 98, i); -< wait_just_a_bit(4, fast); -< if ((READ_RM_REG(mod_no, 88)) == 0){ -< break; -< } -< } -< -< WRITE_RM_REG(mod_no, 99, 0x10); -< //WRITE_RM_REG(mod_no, 99, 0x1F/*0x10*/); -< for (i = 0x1f; i > 0; i--){ -< -< WRITE_RM_REG(mod_no, 99, i); -< wait_just_a_bit(4, fast); -< if ((READ_RM_REG(mod_no, 89)) == 0){ -< break; -< } ---- -> //if (wp_proslic_calibrate(fe, mod_no, fast)){ -> // return -1; -> //} -> if (wp_proslic_manual_calibrate(fe, mod_no, fast)){ -> return -1; -876,891c996,1002 -< /* Step 17 */ -< value = READ_RM_REG(mod_no, 23); -< WRITE_RM_REG(mod_no, 23, value | 0x04); -< -< /* Step 18 */ -< /* DAC offset and without common mode calibration. */ -< WRITE_RM_REG(mod_no, 97, 0x01/*0x18*/); /* Manual after */ -< /* Calibrate common mode and differential DAC mode DAC + ILIM */ -< WRITE_RM_REG(mod_no, 96, 0x40/*0x47*/); -< -< /* Step 19 */ -< start_ticks = SYSTEM_TICKS; -< while(READ_RM_REG(mod_no, 96) != 0){ -< if ((SYSTEM_TICKS - start_ticks) > 2000/*400*/){ -< DEBUG_EVENT( -< "%s: Module %d: Timeout on SLIC calibration (19:%02X)!\n", ---- -> /* Perform DC-DC calibration */ -> WRITE_RM_REG(mod_no, 93, 0x99); -> wait_just_a_bit(10, fast); -> value = READ_RM_REG(mod_no, 107); -> if ((value < 0x2) || (value > 0xd)) { -> DEBUG_EVENT( -> "%s: Module %d: DC-DC calibration has a surprising direct 107 of 0x%02x!\n", -893,897c1004,1006 -< mod_no, -< READ_RM_REG(mod_no, 96)); -< return -1; -< } -< wait_just_a_bit(HZ/10, fast); ---- -> mod_no+1, -> value); -> WRITE_RM_REG(mod_no, 107, 0x8); -899,900c1008 -< DEBUG_RM("%s: SLIC calibration complete (%ld)\n", -< fe->name, SYSTEM_TICKS-start_ticks); ---- -> -915,982d1022 -< /* Step 20 */ -< wp_proslic_setreg_indirect(fe, mod_no, 88, 0); -< wp_proslic_setreg_indirect(fe, mod_no, 89, 0); -< wp_proslic_setreg_indirect(fe, mod_no, 90, 0); -< wp_proslic_setreg_indirect(fe, mod_no, 91, 0); -< wp_proslic_setreg_indirect(fe, mod_no, 92, 0); -< wp_proslic_setreg_indirect(fe, mod_no, 93, 0); -< wp_proslic_setreg_indirect(fe, mod_no, 94, 0); -< wp_proslic_setreg_indirect(fe, mod_no, 95, 0); -< -< if (!fast){ -< /* Disable interrupt while full initialization */ -< WRITE_RM_REG(mod_no, 21, 0); -< WRITE_RM_REG(mod_no, 22, 0); -< WRITE_RM_REG(mod_no, 23, 0); -< -< #if defined(AFT_RM_INTR_SUPPORT) -< fe->rm_param.mod[mod_no].u.fxs.imask1 = 0x00; -< fe->rm_param.mod[mod_no].u.fxs.imask2 = 0x03; -< fe->rm_param.mod[mod_no].u.fxs.imask3 = 0x01; -< #else -< fe->rm_param.mod[mod_no].u.fxs.imask1 = 0x00; -< fe->rm_param.mod[mod_no].u.fxs.imask2 = 0x00; -< fe->rm_param.mod[mod_no].u.fxs.imask3 = 0x00; -< #endif -< } -< -< WRITE_RM_REG(mod_no, 64, 0);/* (0) */ -< -< //Alex Apr 3 - WRITE_RM_REG(mod_no, 64, 0x1); -< -< value = READ_RM_REG(mod_no, 68); -< /* -< ** FIXME ???value = value & 0x03; -< ** if (value & 4){ -< ** printf("Module %d Timeout!\n", mod_no); -< ** return -1; -< ** } */ -< -< #if 1 -< WRITE_RM_REG(mod_no, 64, 0x00); -< -< /* this is a singular calibration bit for longitudinal calibration */ -< WRITE_RM_REG(mod_no, 97, 0x01); -< WRITE_RM_REG(mod_no, 96, 0x40); -< -< value = READ_RM_REG(mod_no, 96); -< -< WRITE_RM_REG(mod_no, 18,0xff); -< WRITE_RM_REG(mod_no, 19,0xff); -< WRITE_RM_REG(mod_no, 20,0xff); -< -< /* WRITE_RM_REG(mod_no, 64,0x1); */ -< #endif -< -< /* Perform DC-DC calibration */ -< WRITE_RM_REG(mod_no, 93, 0x99); -< /*wait_just_a_bit(10, fast);*/ -< value = READ_RM_REG(mod_no, 107); -< if ((value < 0x2) || (value > 0xd)) { -< DEBUG_EVENT( -< "%s: Module %d: DC-DC calibration has a surprising direct 107 of 0x%02x!\n", -< fe->name, -< mod_no, -< value); -< WRITE_RM_REG(mod_no, 107, 0x8); -< } -< -991c1031 -< mod_no); ---- -> mod_no+1); -1015,1021c1055,1068 -< #if 0 -< /* Enable loopback */ -< WRITE_RM_REG(mod_no, 8, 0x2); -< WRITE_RM_REG(mod_no, 14, 0x0); -< WRITE_RM_REG(mod_no, 64, 0x0); -< WRITE_RM_REG(mod_no, 1, 0x08); -< #endif ---- -> if (!strcmp(fxo_modes[fe->fe_cfg.cfg.remora.opermode].name, "AUSTRALIA")) { -> value = acim2tiss[fxo_modes[fe->fe_cfg.cfg.remora.opermode].acim]; -> WRITE_RM_REG(mod_no, 10, 0x8 | value); -> if (fxo_modes[fe->fe_cfg.cfg.remora.opermode].ring_osc){ -> wp_proslic_setreg_indirect( -> fe, mod_no, 20, -> fxo_modes[fe->fe_cfg.cfg.remora.opermode].ring_osc); -> } -> if (fxo_modes[fe->fe_cfg.cfg.remora.opermode].ring_x){ -> wp_proslic_setreg_indirect( -> fe, mod_no, 21, -> fxo_modes[fe->fe_cfg.cfg.remora.opermode].ring_x); -> } -> } -1023c1070,1073 -< WRITE_RM_REG(mod_no, 64, 0x1); ---- -> /* lowpower */ -> if (fe->fe_cfg.cfg.remora.fxs_lowpower == WANOPT_YES){ -> WRITE_RM_REG(mod_no, 72, 0x10); -> } -1024a1075,1166 -> if (fe->fe_cfg.cfg.remora.fxs_fastringer == WANOPT_YES){ -> /* Speed up Ringer */ -> wp_proslic_setreg_indirect(fe, mod_no, 20, 0x7e6d); -> wp_proslic_setreg_indirect(fe, mod_no, 21, 0x01b9); -> /* Beef up Ringing voltage to 89V */ -> if (!strcmp(fxo_modes[fe->fe_cfg.cfg.remora.opermode].name, "AUSTRALIA")) { -> WRITE_RM_REG(mod_no, 74, 0x3f); -> if (wp_proslic_setreg_indirect(fe, mod_no, 21, 0x247)){ -> return -1; -> } -> DEBUG_EVENT("%s: Module %d: Boosting fast ringer (89V peak)\n", -> fe->name, mod_no + 1); -> } else if (fe->fe_cfg.cfg.remora.fxs_lowpower == WANOPT_YES){ -> if (wp_proslic_setreg_indirect(fe, mod_no, 21, 0x14b)){ -> return -1; -> } -> DEBUG_EVENT("%s: Module %d: Reducing fast ring power (50V peak)\n", -> fe->name, mod_no + 1); -> } else { -> DEBUG_EVENT("%s: Module %d: Speeding up ringer (25Hz)\n", -> fe->name, mod_no + 1); -> } -> }else{ -> if (!strcmp(fxo_modes[fe->fe_cfg.cfg.remora.opermode].name, "AUSTRALIA")) { -> WRITE_RM_REG(mod_no, 74, 0x3f); -> if (wp_proslic_setreg_indirect(fe, mod_no, 21, 0x1d1)){ -> return -1; -> } -> DEBUG_EVENT("%s: Module %d: Boosting ringer (89V peak)\n", -> fe->name, mod_no+1); -> } else if (fe->fe_cfg.cfg.remora.fxs_lowpower == WANOPT_YES){ -> if (wp_proslic_setreg_indirect(fe, mod_no, 21, 0x108)){ -> return -1; -> } -> DEBUG_EVENT("%s: Module %d: Reducing ring power (50V peak)\n", -> fe->name, mod_no+1); -> } -> } -> -> /* Adjust RX/TX gains */ -> if (fe->fe_cfg.cfg.remora.fxs_txgain || fe->fe_cfg.cfg.remora.fxs_rxgain) { -> DEBUG_EVENT("%s: Module %d: Adjust TX Gain to %s\n", -> fe->name, mod_no+1, -> (fe->fe_cfg.cfg.remora.fxs_txgain == 35) ? "3.5dB": -> (fe->fe_cfg.cfg.remora.fxs_txgain == -35) ? "-3.5dB":"0dB"); -> value = READ_RM_REG(mod_no, 9); -> switch (fe->fe_cfg.cfg.remora.fxs_txgain) { -> case 35: -> value |= 0x8; -> break; -> case -35: -> value |= 0x4; -> break; -> case 0: -> break; -> } -> -> DEBUG_EVENT("%s: Module %d: Adjust RX Gain to %s\n", -> fe->name, mod_no+1, -> (fe->fe_cfg.cfg.remora.fxs_rxgain == 35) ? "3.5dB": -> (fe->fe_cfg.cfg.remora.fxs_rxgain == -35) ? "-3.5dB":"0dB"); -> switch (fe->fe_cfg.cfg.remora.fxs_rxgain) { -> case 35: -> value |= 0x2; -> break; -> case -35: -> value |= 0x01; -> break; -> case 0: -> break; -> } -> WRITE_RM_REG(mod_no, 9, value); -> } -> -> if (!fast){ -> /* Disable interrupt while full initialization */ -> WRITE_RM_REG(mod_no, 21, 0); -> WRITE_RM_REG(mod_no, 22, 0xFC); -> WRITE_RM_REG(mod_no, 23, 0); -> -> #if defined(AFT_RM_INTR_SUPPORT) -> fe->rm_param.mod[mod_no].u.fxs.imask1 = 0x00; -> fe->rm_param.mod[mod_no].u.fxs.imask2 = 0x03; -> fe->rm_param.mod[mod_no].u.fxs.imask3 = 0x01; -> #else -> fe->rm_param.mod[mod_no].u.fxs.imask1 = 0x00; -> fe->rm_param.mod[mod_no].u.fxs.imask2 = 0xFC; -> fe->rm_param.mod[mod_no].u.fxs.imask3 = 0x00; -> #endif -> } -> -> #if 0 -1026c1168 -< fe->name, mod_no, ---- -> fe->name, mod_no+1, -1031d1172 -< #if 0 -1057a1199 -> WRITE_RM_REG(mod_no, 64, 0x1); -1059,1063c1201,1209 -< DEBUG_RM("%s: Module %d: Current Battery1 %dV, Battery2 %dV (%d)\n", -< fe->name, mod_no, -< READ_RM_REG(mod_no, 82)*375/1000, -< READ_RM_REG(mod_no, 83)*375/1000, -< __LINE__); ---- -> wait_just_a_bit(HZ, fast); -> if (READ_RM_REG(mod_no, 81) < 0x0A){ -> DEBUG_EVENT( -> "%s: Module %d: TIP/RING is too low on FXS %d!\n", -> fe->name, -> mod_no, -> READ_RM_REG(mod_no, 81) * 375 / 1000); -> return -1; -> } -1065,1067c1211,1214 -< /* lowpower */ -< //WRITE_RM_REG(mod_no, 72, 0x14); -< //todayWRITE_RM_REG(mod_no, 64, 0x1); ---- -> DEBUG_RM("%s: Module %d: Current Battery1 %dV, Battery2 %dV\n", -> fe->name, mod_no+1, -> READ_RM_REG(mod_no, 82)*375/1000, -> READ_RM_REG(mod_no, 83)*375/1000); -1081c1228 -< mod_no, ---- -> mod_no+1, -1160c1307 -< mod_no); ---- -> mod_no+1); -1165c1312 -< mod_no, ---- -> mod_no+1, -1178a1326 -> WRITE_RM_REG(mod_no, 2, 0x04 | 0x03); /* Ring detect mode (begin/end) */ -1181a1330,1374 -> /* Take values for fxotxgain and fxorxgain and apply them to module */ -> if (fe->fe_cfg.cfg.remora.fxo_txgain) { -> if (fe->fe_cfg.cfg.remora.fxo_txgain >= -150 && fe->fe_cfg.cfg.remora.fxo_txgain < 0) { -> DEBUG_EVENT("%s: Module %d: Adjust TX Gain to %2d.%d dB\n", -> fe->name, mod_no+1, -> fe->fe_cfg.cfg.remora.fxo_txgain / 10, -> fe->fe_cfg.cfg.remora.fxo_txgain % -10); -> WRITE_RM_REG(mod_no, 38, 16 + (fe->fe_cfg.cfg.remora.fxo_txgain/-10)); -> if(fe->fe_cfg.cfg.remora.fxo_txgain % 10) { -> WRITE_RM_REG(mod_no, 40, 16 + (-fe->fe_cfg.cfg.remora.fxo_txgain%10)); -> } -> } -> else if (fe->fe_cfg.cfg.remora.fxo_txgain <= 120 && fe->fe_cfg.cfg.remora.fxo_txgain > 0) { -> DEBUG_EVENT("%s: Module %d: Adjust TX Gain to %2d.%d dB\n", -> fe->name, mod_no+1, -> fe->fe_cfg.cfg.remora.fxo_txgain / 10, -> fe->fe_cfg.cfg.remora.fxo_txgain % 10); -> WRITE_RM_REG(mod_no, 38, fe->fe_cfg.cfg.remora.fxo_txgain/10); -> if (fe->fe_cfg.cfg.remora.fxo_txgain % 10){ -> WRITE_RM_REG(mod_no, 40, (fe->fe_cfg.cfg.remora.fxo_txgain % 10)); -> } -> } -> } -> if (fe->fe_cfg.cfg.remora.fxo_rxgain) { -> if (fe->fe_cfg.cfg.remora.fxo_rxgain >= -150 && fe->fe_cfg.cfg.remora.fxo_rxgain < 0) { -> DEBUG_EVENT("%s: Module %d: Adjust RX Gain to %2d.%d dB\n", -> fe->name, mod_no+1, -> fe->fe_cfg.cfg.remora.fxo_rxgain / 10, -> (-1) * (fe->fe_cfg.cfg.remora.fxo_rxgain % 10)); -> WRITE_RM_REG(mod_no, 39, 16 + (fe->fe_cfg.cfg.remora.fxo_rxgain/-10)); -> if(fe->fe_cfg.cfg.remora.fxo_rxgain%10) { -> WRITE_RM_REG(mod_no, 41, 16 + (-fe->fe_cfg.cfg.remora.fxo_rxgain%10)); -> } -> }else if (fe->fe_cfg.cfg.remora.fxo_rxgain <= 120 && fe->fe_cfg.cfg.remora.fxo_rxgain > 0) { -> DEBUG_EVENT("%s: Module %d: Adjust RX Gain to %2d.%d dB\n", -> fe->name, mod_no+1, -> fe->fe_cfg.cfg.remora.fxo_rxgain / 10, -> fe->fe_cfg.cfg.remora.fxo_rxgain % 10); -> WRITE_RM_REG(mod_no, 39, fe->fe_cfg.cfg.remora.fxo_rxgain/10); -> if(fe->fe_cfg.cfg.remora.fxo_rxgain % 10) { -> WRITE_RM_REG(mod_no, 41, (fe->fe_cfg.cfg.remora.fxo_rxgain%10)); -> } -> } -> } -> -1186c1379 -< mod_no); ---- -> mod_no+1); -1199c1392 -< int wp_remora_iface_init(void *pfe_iface) ---- -> int wp_remora_iface_init(void *p_fe, void *pfe_iface) -1200a1394 -> sdla_fe_t *fe = (sdla_fe_t*)p_fe; -1207a1402 -> fe_iface->pre_release = &wp_remora_pre_release; -1218c1413 -< #if defined(AFT_TDM_API_SUPPORT) ---- -> #if defined(AFT_TDM_API_SUPPORT) || defined(AFT_API_SUPPORT) -1221a1417,1418 -> WAN_LIST_INIT(&fe->event); -> wan_spin_lock_irq_init(&fe->lockirq); -1279a1477 -> #if 0 -1282,1283c1480,1481 -< wan_spin_lock_init(&fe->lock); -< ---- -> wan_spin_lock_init(&fe->lockirq); -> #endif -1308,1309c1506 -< fe->name, -< mod_no); ---- -> fe->name, mod_no+1); -1318c1515 -< mod_no); ---- -> mod_no+1); -1329,1330c1526 -< fe->name, -< mod_no, ---- -> fe->name, mod_no+1, -1339c1535 -< mod_no); ---- -> mod_no+1); -1348,1349c1544 -< fe->name, -< mod_no); ---- -> fe->name, mod_no+1); -1350a1546 -> ((sdla_t*)fe->card)->fe_no_intr = 0x1; -1355,1356c1551 -< fe->name, -< mod_no); ---- -> fe->name, mod_no+1); -1360,1361c1555,1560 -< sane = 1; -< if (retry++ < 10) goto retry_cfg; ---- -> if (!sane/*retry++ < 10*/){ -> sane = 1; -> DEBUG_EVENT("%s: Module %d: Retry configuration...\n", -> fe->name, mod_no+1); -> goto retry_cfg; -> } -1363,1364c1562 -< fe->name, -< mod_no, ---- -> fe->name, mod_no+1, -1376c1574 -< ---- -> -1435,1436d1632 -< sdla_fe_timer_event_t *fe_event; -< wan_smp_flag_t smp_flags; -1446a1643,1668 -> -> for(mod_no = 0; mod_no < MAX_REMORA_MODULES; mod_no++){ -> if (wan_test_bit(mod_no, &fe->rm_param.module_map)) { -> wan_clear_bit(mod_no, &fe->rm_param.module_map); -> } -> } -> return 0; -> } -> -> /* -> ****************************************************************************** -> * sdla_te_pre_release() -> * -> * Description: T1/E1 pre release routines (not locked). -> * Arguments: -> * Returns: -> ****************************************************************************** -> */ -> static int wp_remora_pre_release(void* pfe) -> { -> sdla_fe_t *fe = (sdla_fe_t*)pfe; -> sdla_fe_timer_event_t *fe_event = NULL; -> wan_smp_flag_t smp_flags; -> int empty = 0; -> -> /* Kill TE timer poll command */ -1454,1457c1676,1685 -< wan_spin_lock_irq(&fe->lock,&smp_flags); -< while(!WAN_LIST_EMPTY(&fe->event)){ -< fe_event = WAN_LIST_FIRST(&fe->event); -< WAN_LIST_REMOVE(fe_event, next); ---- -> do{ -> wan_spin_lock_irq(&fe->lockirq,&smp_flags); -> if (!WAN_LIST_EMPTY(&fe->event)){ -> fe_event = WAN_LIST_FIRST(&fe->event); -> WAN_LIST_REMOVE(fe_event, next); -> }else{ -> empty = 1; -> } -> wan_spin_unlock_irq(&fe->lockirq,&smp_flags); -> /* Free should be called not from spin_lock_irq (windows) !!!! */ -1459,1460c1687,1688 -< } -< wan_spin_unlock_irq(&fe->lock,&smp_flags); ---- -> fe_event = NULL; -> }while(!empty); -1462,1466d1689 -< for(mod_no = 0; mod_no < MAX_REMORA_MODULES; mod_no++){ -< if (wan_test_bit(mod_no, &fe->rm_param.module_map)) { -< wan_clear_bit(mod_no, &fe->rm_param.module_map); -< } -< } -1610c1833 -< fe->name, mod_no); ---- -> fe->name, mod_no+1); -1615c1838 -< fe->name, mod_no); ---- -> fe->name, mod_no+1); -1645c1868 -< DEBUG_RM("%s: RM timer!\n", fe->name); ---- -> DEBUG_TEST("%s: RM timer!\n", fe->name); -1660c1883 -< wan_spin_lock_irq(&fe->lock,&smp_flags); ---- -> wan_spin_lock_irq(&fe->lockirq,&smp_flags); -1662c1885 -< wan_spin_unlock_irq(&fe->lock,&smp_flags); ---- -> wan_spin_unlock_irq(&fe->lockirq,&smp_flags); -1675c1898 -< sdla_rm_add_timer(fe, 1000); ---- -> sdla_rm_add_timer(fe, WP_RM_POLL_TIMER); -1693c1916 -< DEBUG_RM("%s: Add new RM timer!\n", fe->name); ---- -> DEBUG_TEST("%s: Add new RM timer!\n", fe->name); -1725c1948 -< wan_spin_lock_irq(&fe->lock,&smp_flags); ---- -> wan_spin_lock_irq(&fe->lockirq,&smp_flags); -1728c1951 -< wan_spin_unlock_irq(&fe->lock,&smp_flags); ---- -> wan_spin_unlock_irq(&fe->lockirq,&smp_flags); -1736c1959,1965 -< wan_spin_unlock_irq(&fe->lock,&smp_flags); ---- -> wan_spin_unlock_irq(&fe->lockirq,&smp_flags); -> -> #if defined(__WINDOWS__) -> /* FIXME: Try to make common code for all OS */ -> /* poll is NOT locked outside! */ -> wan_spin_lock_irq(&card->wandev.lock,&smp_flags); -> #endif -1739,1740c1968,1969 -< DEBUG_RM("%s: Module %d: RM Polling State=%s Cmd=0x%X!\n", -< fe->name, mod_no, ---- -> DEBUG_EVENT("[RM] %s: Module %d: RM Polling State=%s Cmd=%s(%X) Mode=%s!\n", -> fe->name, mod_no+1, -1742c1971,1973 -< fe_event->type); ---- -> WP_RM_POLL_DECODE(fe_event->type), fe_event->type, -> WAN_EVENT_MODE_DECODE(fe_event->mode)); -> -1810,1811c2041,2042 -< DEBUG_EVENT("%s: Module %d: %s %s events (%d)!\n", -< fe->name, mod_no, ---- -> DEBUG_RM("%s: Module %d: %s %s events (%d)!\n", -> fe->name, mod_no+1, -1813c2044 -< WAN_EVENT_TYPE_DECODE(fe_event->type), ---- -> WP_RM_POLL_DECODE(fe_event->type), -1844c2075 -< fe->name, mod_no); ---- -> fe->name, mod_no+1); -1925c2156 -< #if defined(__WINDOWS__) ---- -> #if 0 /*defined(__WINDOWS__)*/ -1946,1954c2177,2188 -< imask = READ_RM_REG(mod_no, 3); -< if (fe_event->mode == WAN_EVENT_ENABLE){ -< imask |= 0x80; -< wan_set_bit(WAN_RM_EVENT_RING_DETECT, -< &fe->rm_param.mod[mod_no].events); -< }else{ -< imask &= ~0x80; -< wan_clear_bit(WAN_RM_EVENT_RING_DETECT, -< &fe->rm_param.mod[mod_no].events); ---- -> if (fe->rm_param.mod[mod_no].type == MOD_TYPE_FXO){ -> imask = READ_RM_REG(mod_no, 3); -> if (fe_event->mode == WAN_EVENT_ENABLE){ -> imask |= 0x80; -> wan_set_bit(WAN_RM_EVENT_RING_DETECT, -> &fe->rm_param.mod[mod_no].events); -> }else{ -> imask &= ~0x80; -> wan_clear_bit(WAN_RM_EVENT_RING_DETECT, -> &fe->rm_param.mod[mod_no].events); -> } -> WRITE_RM_REG(mod_no, 3, imask); -1956d2189 -< WRITE_RM_REG(mod_no, 3, imask); -1971a2205,2219 -> case WP_RM_POLL_READ: -> DEBUG_EVENT("%s: Module %d: Reading %s register: Reg[%d]=%02X\n", -> fe->name, mod_no, -> WP_REMORA_DECODE_TYPE(fe->rm_param.mod[mod_no].type), -> fe_event->rm_event.reg, -> READ_RM_REG(mod_no,fe_event->rm_event.reg)); -> break; -> case WP_RM_POLL_WRITE: -> DEBUG_EVENT("%s: Module %d: Writting %s register: Reg[%d]=%02X\n", -> fe->name, mod_no, -> WP_REMORA_DECODE_TYPE(fe->rm_param.mod[mod_no].type), -> fe_event->rm_event.reg, -> fe_event->rm_event.value); -> WRITE_RM_REG(mod_no, fe_event->rm_event.reg, fe_event->rm_event.value); -> break; -1978a2227,2231 -> /* poll is NOT locked outside! */ -> wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); -> #endif -> -> #if 0/*defined(__WINDOWS__)*/ -1999c2252 -< sdla_rm_add_timer(fe, HZ); ---- -> sdla_rm_add_timer(fe, WP_RM_POLL_TIMER); -2043c2296 -< wan_spin_lock_irq(&fe->lock,&smp_flags); ---- -> wan_spin_lock_irq(&fe->lockirq,&smp_flags); -2046a2300,2306 -> #if defined(__WINDOWS__) -> /* only one event allowed at a time */ -> DEBUG_RM("%s: returning EBUSY\n", -> fe->name); -> wan_spin_unlock_irq(&fe->lockirq, &smp_flags); -> return EBUSY; -> #else -2053c2313 -< wan_spin_unlock_irq(&fe->lock, &smp_flags); ---- -> wan_spin_unlock_irq(&fe->lockirq, &smp_flags); -2056a2317 -> #endif -2058c2319 -< wan_spin_unlock_irq(&fe->lock, &smp_flags); ---- -> wan_spin_unlock_irq(&fe->lockirq, &smp_flags); -2061a2323,2378 -> /****************************************************************************** -> * wp_remora_event_verification() -> * -> * Description: -> * Arguments: mod_no - Module number (1,2,3,... MAX_REMORA_MODULES) -> * Returns: -> ******************************************************************************/ -> static int -> wp_remora_event_verification(sdla_fe_t *fe, wan_event_ctrl_t *ectrl) -> { -> int mod_no = ectrl->mod_no-1; -> -> /* Event verification */ -> if (fe->rm_param.mod[mod_no].type == MOD_TYPE_FXS){ -> switch(ectrl->type){ -> case WAN_EVENT_RM_POWER: -> case WAN_EVENT_RM_LC: -> case WAN_EVENT_RM_DTMF: -> case WAN_EVENT_RM_RING_TRIP: -> case WAN_EVENT_RM_RING: -> case WAN_EVENT_RM_TONE: -> case WAN_EVENT_RM_TXSIG_KEWL: -> case WAN_EVENT_RM_TXSIG_START: -> case WAN_EVENT_RM_TXSIG_OFFHOOK: -> case WAN_EVENT_RM_TXSIG_ONHOOK: -> case WAN_EVENT_RM_ONHOOKTRANSFER: -> case WAN_EVENT_RM_SETPOLARITY: -> break; -> default: -> DEBUG_EVENT( -> "%s: Module %d: Remora RING Event is only valid for FXS module (%X)\n", -> fe->name,mod_no+1, -> ectrl->type); -> return -EINVAL; -> } -> }else if (fe->rm_param.mod[mod_no].type == MOD_TYPE_FXO){ -> switch(ectrl->type){ -> case WAN_EVENT_RM_RING_DETECT: -> case WAN_EVENT_RM_TXSIG_START: -> case WAN_EVENT_RM_TXSIG_OFFHOOK: -> case WAN_EVENT_RM_TXSIG_ONHOOK: -> break; -> default: -> DEBUG_EVENT( -> "%s: Module %d: Remora RING Event is only valid for FXO module(%X)\n", -> fe->name,mod_no+1, -> ectrl->type); -> return -EINVAL; -> } -> }else{ -> DEBUG_EVENT( -> "%s: Module %d: Unknown Module type %X\n", -> fe->name,mod_no+1, -> fe->rm_param.mod[mod_no].type); -> return -EINVAL; -> } -2062a2380,2381 -> return 0; -> } -2074c2393 -< int mod_no, err = 0; ---- -> int mod_no = ectrl->mod_no-1, err = 0; -2077,2079c2396,2397 -< mod_no = ectrl->mod_no; -< -< if (mod_no >= MAX_REMORA_MODULES){ ---- -> -> if (mod_no+1 > MAX_REMORA_MODULES){ -2081c2399 -< fe->name, mod_no); ---- -> fe->name, mod_no+1); -2090,2092c2408,2415 -< DEBUG_RM("%s: Module %d: Scheduling %s event type!\n", -< fe->name, mod_no, -< WAN_EVENT_TYPE_DECODE(ectrl->type)); ---- -> if (wp_remora_event_verification(fe, ectrl)){ -> return -EINVAL; -> } -> -> DEBUG_RM("%s: Module %d: Scheduling %s event (%s:%X)!\n", -> fe->name, mod_no+1, -> WAN_EVENT_TYPE_DECODE(ectrl->type), -> WAN_EVENT_MODE_DECODE(ectrl->mode), ectrl->mode); -2095c2418,2419 -< fe_event.rm_event.mod_no= ectrl->mod_no; ---- -> fe_event.rm_event.mod_no= mod_no; -> fe_event.delay = WP_RM_POLL_TIMER; -2103,2105d2426 -< case WAN_EVENT_RM_RING_TRIP: -< fe_event.type = WP_RM_POLL_RING_TRIP; -< break; -2108a2430,2432 -> case WAN_EVENT_RM_RING_TRIP: -> fe_event.type = WP_RM_POLL_RING_TRIP; -> break; -2111a2436,2438 -> case WAN_EVENT_RM_RING_DETECT: -> fe_event.type = WP_RM_POLL_RING_DETECT; -> break; -2135,2144c2462 -< case WAN_EVENT_RM_RING_DETECT: -< fe_event.type = WP_RM_POLL_RING_DETECT; -< break; -< default: -< DEBUG_EVENT("%s: Module %d: Invalid wan event type %X\n", -< fe->name,mod_no, -< ectrl->type); -< return -EINVAL; -< } -< ---- -> } -2152,2153c2470,2471 -< DEBUG_EVENT("%s: Module %d: Enable Dial tone\n", -< fe->name, mod_no); ---- -> DEBUG_RM("%s: Module %d: Enable Dial tone\n", -> fe->name, mod_no+1); -2176,2177c2494,2495 -< DEBUG_EVENT("%s: Module %d: Enable Busy tone\n", -< fe->name, mod_no); ---- -> DEBUG_RM("%s: Module %d: Enable Busy tone\n", -> fe->name, mod_no+1); -2200,2201c2518,2519 -< DEBUG_EVENT("%s: Module %d: Enable Ring tone\n", -< fe->name, mod_no); ---- -> DEBUG_RM("%s: Module %d: Enable Ring tone\n", -> fe->name, mod_no+1); -2224,2225c2542,2543 -< DEBUG_EVENT("%s: Module %d: Enable Congestion tone\n", -< fe->name, mod_no); ---- -> DEBUG_RM("%s: Module %d: Enable Congestion tone\n", -> fe->name, mod_no+1); -2327,2329c2645,2648 -< wan_cmd_t *udp_cmd = (wan_cmd_t*)p_udp_cmd; -< sdla_fe_debug_t *fe_debug; -< int err = -EINVAL; ---- -> wan_cmd_t *udp_cmd = (wan_cmd_t*)p_udp_cmd; -> sdla_fe_debug_t *fe_debug; -> sdla_fe_timer_event_t event; -> int err = -EINVAL; -2358,2384d2676 -< #if 0 -< /* verify TIP/RING voltage */ -< if (!fast){ -< WRITE_RM_REG(mod_no, 8, 0x2); -< wait_just_a_bit(HZ, fast); -< start_ticks = SYSTEM_TICKS; -< while(READ_RM_REG(mod_no, 81) < 0x75){ -< if ((SYSTEM_TICKS - start_ticks) > HZ*10){ -< break; -< } -< wait_just_a_bit(HZ, fast); -< } -< wait_just_a_bit(HZ, fast); -< if (READ_RM_REG(mod_no, 81) < 0x75){ -< if (sane){ -< DEBUG_EVENT( -< "%s: Module %d: TIP/RING is too low on FXS %d!\n", -< fe->name, -< mod_no, -< READ_RM_REG(mod_no, 81) * 375 / 1000); -< } -< WRITE_RM_REG(mod_no, 8, 0x0); -< return -1; -< } -< WRITE_RM_REG(mod_no, 8, 0x0); -< } -< #endif -2393d2684 -< #if 0 -2395,2396c2686,2698 -< case WAN_FE_DEBUG_VOLTAGE: -< /* FIXME: Add code */ ---- -> case WAN_FE_DEBUG_REG: -> event.type = (fe_debug->fe_debug_reg.read) ? -> WP_RM_POLL_READ : WP_RM_POLL_WRITE; -> event.rm_event.mod_no = fe_debug->mod_no; -> event.rm_event.reg = (u_int16_t)fe_debug->fe_debug_reg.reg; -> event.rm_event.value = fe_debug->fe_debug_reg.value; -> event.delay = WP_RM_POLL_TIMER; -> sdla_rm_add_event(fe, &event); -> udp_cmd->wan_cmd_return_code = WAN_CMD_OK; -> break; -> default: -> udp_cmd->wan_cmd_return_code = WAN_UDP_INVALID_CMD; -> udp_cmd->wan_cmd_data_len = 0; -2399d2700 -< #endif -2422c2723 -< fe->name, mod_no); ---- -> fe->name, mod_no+1); -2450c2751 -< #if defined(AFT_TDM_API_SUPPORT) ---- -> #if defined(AFT_TDM_API_SUPPORT) || defined(AFT_API_SUPPORT) -2452a2754,2756 -> //#undef DEBUG_RM -> //#define DEBUG_RM DEBUG_EVENT -> -2483a2788 -> -2488c2793 -< fe->rm_param.mod[mod_no].u.fxo.ringdebounce += (WP_RM_CHUNKSIZE * 16); ---- -> fe->rm_param.mod[mod_no].u.fxo.ringdebounce += (WP_RM_CHUNKSIZE * 4); -2506c2811 -< fe->rm_param.mod[mod_no].u.fxo.ringdebounce -= WP_RM_CHUNKSIZE * 4; ---- -> fe->rm_param.mod[mod_no].u.fxo.ringdebounce -= WP_RM_CHUNKSIZE * 2; -2557a2863,2865 -> DEBUG_RM("%s: Module %d: On-Hook status!\n", -> fe->name, -> mod_no + 1); -2567a2876 -> -2568a2878 -> -2629,2632c2939,2940 -< "%s: Module %d: %lu Polarity reversed (%d -> %d)\n", -< fe->name, -< mod_no + 1, -< SYSTEM_TICKS, ---- -> "%s: Module %d: Polarity reversed (%d -> %d) (%ul)\n", -> fe->name, mod_no + 1, -2634c2942,2943 -< fe->rm_param.mod[mod_no].u.fxo.lastpol); ---- -> fe->rm_param.mod[mod_no].u.fxo.lastpol, -> (unsigned int)SYSTEM_TICKS); -2643a2953,2954 -> //#undef DEBUG_RM -> //#define DEBUG_RM DEBUG_TEST -2724c3035 -< #if defined(AFT_TDM_API_SUPPORT) ---- -> #if defined(AFT_TDM_API_SUPPORT) || defined(AFT_API_SUPPORT) -2735,2739c3046 -< -< if (SYSTEM_TICKS - fe->rm_param.last_watchdog < WP_RM_WATCHDOG_TIMEOUT) { -< return 0; -< } -< fe->rm_param.last_watchdog = SYSTEM_TICKS; ---- -> -2807a3115 -> -2809,2810c3117,3122 -< if (wp_remora_check_intr(fe)){ -< wp_remora_intr(fe); ---- -> if (SYSTEM_TICKS - fe->rm_param.last_watchdog > WP_RM_WATCHDOG_TIMEOUT) { -> fe->rm_param.last_watchdog = SYSTEM_TICKS; -> -> if (wp_remora_check_intr(fe)){ -> wp_remora_intr(fe); -> } -2833c3145 -< fe->name, mod_no); ---- -> fe->name, mod_no+1); -2838c3150 -< fe->name, mod_no); ---- -> fe->name, mod_no+1); -2858c3170 -< fe->name, mod_no, type); ---- -> fe->name, mod_no+1, type); -2875c3187 -< fe->name, mod_no, type); ---- -> fe->name, mod_no+1, type); -2898c3210 -< fe->name, mod_no); ---- -> fe->name, mod_no+1); -2923d3234 -< -2932,2933d3242 -< //mod_no = fe->rm_param.intcount % MAX_REMORA_MODULES; -< -3010,3011d3318 -< DEBUG_TDMAPI("mod_no: %d\n", mod_no); -< -3025c3332 -< fe->name, mod_no); ---- -> fe->name, mod_no+1); -3037c3344 -< fe->name, mod_no); ---- -> fe->name, mod_no+1); -3043c3350 -< fe->name, mod_no); ---- -> fe->name, mod_no+1); -3056c3363 -< fe->name, mod_no); ---- -> fe->name, mod_no+1); -3074,3075c3381,3382 -< fe->name, mod_no); -< event.rxhook = WAN_EVENT_RING_TRIP_PRESENT; ---- -> fe->name, mod_no+1); -> event.ring_mode = WAN_EVENT_RING_TRIP_PRESENT; -3079,3080c3386,3387 -< fe->name, mod_no); -< event.rxhook = WAN_EVENT_RING_TRIP_STOP; ---- -> fe->name, mod_no+1); -> event.ring_mode = WAN_EVENT_RING_TRIP_STOP; -3085a3393,3416 -> if (stat2 & 0x80) { -> DEBUG_EVENT("%s: Module %d: Power Alarm Q6!\n", -> fe->name, mod_no+1); -> } -> if (stat2 & 0x40) { -> DEBUG_EVENT("%s: Module %d: Power Alarm Q5!\n", -> fe->name, mod_no+1); -> } -> if (stat2 & 0x20) { -> DEBUG_EVENT("%s: Module %d: Power Alarm Q4!\n", -> fe->name, mod_no+1); -> } -> if (stat2 & 0x10) { -> DEBUG_EVENT("%s: Module %d: Power Alarm Q3!\n", -> fe->name, mod_no+1); -> } -> if (stat2 & 0x08) { -> DEBUG_EVENT("%s: Module %d: Power Alarm Q2!\n", -> fe->name, mod_no+1); -> } -> if (stat2 & 0x04) { -> DEBUG_EVENT("%s: Module %d: Power Alarm Q1!\n", -> fe->name, mod_no+1); -> } -3088c3419 -< fe->name, mod_no, ---- -> fe->name, mod_no+1, -3130c3461 -< }else{ ---- -> } else { -3137c3468 -< }else{ ---- -> } else { -3143a3475,3479 -> #ifdef AUDIO_RINGCHECK -> /* If audio ringcheck is enabled, we use this code -> * if disabled we use the check_hook code. -> * Right now we use the check_hook code because -> * this code does not have debounce */ -3146,3150c3482,3487 -< } -< }else if (status){ -< DEBUG_RM( -< "%s: Module %d: Receive interrupt %02X!\n", -< fe->name, mod_no+1, status); ---- -> } -> #endif -> } -> if (status & 0x01){ -> DEBUG_RM("%s: Module %d: Polarity reversed!\n", -> fe->name, mod_no+1); diff --git a/patches/kdrivers/src/net/sdla_56k.c b/patches/kdrivers/src/net/sdla_56k.c index 90454e3..e76dc3b 100644 --- a/patches/kdrivers/src/net/sdla_56k.c +++ b/patches/kdrivers/src/net/sdla_56k.c @@ -37,25 +37,46 @@ # include # include # include -# include /* for aft_56k_write_cpld() declaration */ #elif defined(__WINDOWS__) # include # include /* WANPIPE common user API definitions */ -# include /* for aft_56k_write_cpld() declaration */ #else # include # include # include # include # include /* WANPIPE common user API definitions */ -# include /* for aft_56k_write_cpld() declaration */ #endif /****************************************************************************** DEFINES AND MACROS ******************************************************************************/ -#define WRITE_REG(reg,val) fe->write_fe_reg(fe->card, 0, (int)(reg),(int)(val)) -#define READ_REG(reg) fe->read_fe_reg(fe->card, 0, (int)(reg)) +#if defined(__WINDOWS__) +#define WRITE_REG(reg,val) \ + fe->write_fe_reg( \ + ((sdla_t*)fe->card)->hw, \ + 0, \ + (int)(reg),(int)(val)) +#define READ_REG(reg) \ + fe->read_fe_reg( \ + ((sdla_t*)fe->card)->hw, \ + 0, \ + (int)(reg)) + +#else + +#define WRITE_REG(reg,val) \ + fe->write_fe_reg( \ + ((sdla_t*)fe->card)->hw, \ + (int)(((sdla_t*)fe->card)->wandev.state==WAN_CONNECTED),\ + 0, \ + (int)(reg),(int)(val)) +#define READ_REG(reg) \ + fe->read_fe_reg( \ + ((sdla_t*)fe->card)->hw, \ + (int)(((sdla_t*)fe->card)->wandev.state==WAN_CONNECTED),\ + 0, \ + (int)(reg)) #if 1 #define AFT_FUNC_DEBUG() @@ -63,6 +84,8 @@ #define AFT_FUNC_DEBUG() DEBUG_EVENT("%s:%d\n",__FUNCTION__,__LINE__) #endif +#endif + /****************************************************************************** STRUCTURES AND TYPEDEFS ******************************************************************************/ @@ -80,7 +103,7 @@ static int sdla_56k_global_config(void* pfe); static int sdla_56k_global_unconfig(void* pfe); static int sdla_56k_config(void* pfe); -static unsigned int sdla_56k_alarm(sdla_fe_t *fe, int manual_read); +static u_int32_t sdla_56k_alarm(sdla_fe_t *fe, int manual_read); static int sdla_56k_udp(sdla_fe_t*, void*, unsigned char*); static void display_Rx_code_condition(sdla_fe_t* fe); static int sdla_56k_print_alarm(sdla_fe_t* fe, unsigned int); @@ -90,11 +113,6 @@ static int sdla_56k_unconfig(void* pfe); static int sdla_56k_intr(sdla_fe_t *fe); static int sdla_56k_check_intr(sdla_fe_t *fe); -/* enable 56k chip reset state */ -static unsigned int reset_on_LXT441PE(sdla_t *card); -/* disable 56k chip reset state */ -static unsigned int reset_off_LXT441PE(sdla_t *card); - /****************************************************************************** FUNCTION DEFINITIONS ******************************************************************************/ @@ -143,7 +161,7 @@ static int sdla_56k_get_fe_status(sdla_fe_t *fe, unsigned char *status) return 0; } -unsigned int sdla_56k_alarm(sdla_fe_t *fe, int manual_read) +u_int32_t sdla_56k_alarm(sdla_fe_t *fe, int manual_read) { unsigned short status = 0x00; @@ -242,8 +260,9 @@ int sdla_56k_default_cfg(void* pcard, void* p56k_cfg) } -int sdla_56k_iface_init(void* pfe_iface) +int sdla_56k_iface_init(void *p_fe, void* pfe_iface) { + sdla_fe_t *fe = (sdla_fe_t*)p_fe; sdla_fe_iface_t *fe_iface = (sdla_fe_iface_t*)pfe_iface; AFT_FUNC_DEBUG(); @@ -251,8 +270,8 @@ int sdla_56k_iface_init(void* pfe_iface) fe_iface->global_config = &sdla_56k_global_config; fe_iface->global_unconfig = &sdla_56k_global_unconfig; - fe_iface->config = &sdla_56k_config; - fe_iface->unconfig = &sdla_56k_unconfig; + fe_iface->config = &sdla_56k_config; + fe_iface->unconfig = &sdla_56k_unconfig; fe_iface->get_fe_status = &sdla_56k_get_fe_status; fe_iface->get_fe_media = &sdla_56k_get_fe_media; @@ -262,9 +281,12 @@ int sdla_56k_iface_init(void* pfe_iface) fe_iface->update_alarm_info = &sdla_56k_update_alarm_info; fe_iface->process_udp = &sdla_56k_udp; - fe_iface->isr = &sdla_56k_intr; - fe_iface->check_isr = &sdla_56k_check_intr; + fe_iface->isr = &sdla_56k_intr; + fe_iface->check_isr = &sdla_56k_check_intr; + /* The 56k CSU/DSU front end status has not been initialized */ + fe->fe_status = FE_UNITIALIZED; + return 0; } @@ -297,14 +319,18 @@ static int sdla_56k_check_intr(sdla_fe_t *fe) static int sdla_56k_global_config(void* pfe) { - DEBUG_56K("%s: %s Global Front End configuration\n", + sdla_fe_t *fe = (sdla_fe_t*)pfe; + + DEBUG_EVENT("%s: %s Global Front End configuration\n", fe->name, FE_MEDIA_DECODE(fe)); return 0; } static int sdla_56k_global_unconfig(void* pfe) { - DEBUG_56K("%s: %s Global unconfiguration!\n", + sdla_fe_t *fe = (sdla_fe_t*)pfe; + + DEBUG_EVENT("%s: %s Global unconfiguration!\n", fe->name, FE_MEDIA_DECODE(fe)); return 0; @@ -315,15 +341,12 @@ static int sdla_56k_config(void* pfe) { sdla_fe_t *fe = (sdla_fe_t*)pfe; sdla_t *card = (sdla_t *)fe->card; - u16 adapter_type; AFT_FUNC_DEBUG(); WAN_ASSERT(fe->write_fe_reg == NULL); WAN_ASSERT(fe->read_fe_reg == NULL); - card->hw_iface.getcfg(card->hw, SDLA_ADAPTERTYPE, &adapter_type); - /* The 56k CSU/DSU front end status has not been initialized */ fe->fe_status = FE_UNITIALIZED; @@ -333,11 +356,6 @@ static int sdla_56k_config(void* pfe) /* Zero the RRC register changes */ fe->fe_param.k56_param.delta_RRC_reg_56k = 0; - if(adapter_type == AFT_ADPTR_56K){ - reset_on_LXT441PE(card); - reset_off_LXT441PE(card); - } - if(WRITE_REG(REG_INT_EN_STAT, (BIT_INT_EN_STAT_IDEL | BIT_INT_EN_STAT_RX_CODE | BIT_INT_EN_STAT_ACTIVE))) { return 1; @@ -384,41 +402,19 @@ static int sdla_56k_config(void* pfe) return 1; } + fe->fe_status = FE_CONNECTED; return 0; } static int sdla_56k_unconfig(void* pfe) { sdla_fe_t *fe = (sdla_fe_t*)pfe; - sdla_t *card = (sdla_t *)fe->card; - u16 adapter_type; AFT_FUNC_DEBUG(); WAN_ASSERT(fe->write_fe_reg == NULL); WAN_ASSERT(fe->read_fe_reg == NULL); - - card->hw_iface.getcfg(card->hw, SDLA_ADAPTERTYPE, &adapter_type); - - if(adapter_type == AFT_ADPTR_56K){ - reset_on_LXT441PE(card); - } - return 0; -} - -static unsigned int reset_on_LXT441PE(sdla_t *card) -{ - AFT_FUNC_DEBUG(); - aft_56k_write_cpld(card, 0x00,0x00); - WP_DELAY(1000); - return 0; -} - -static unsigned int reset_off_LXT441PE(sdla_t *card) -{ - AFT_FUNC_DEBUG(); - aft_56k_write_cpld(card, 0x00, 0x03); - WP_DELAY(1000); + fe->fe_status = FE_UNITIALIZED; return 0; } @@ -517,8 +513,14 @@ sdla_56k_set_lbmode(sdla_fe_t *fe, unsigned char type, unsigned char mode) //unsigned char loop=BIT_RX_CTRL_DSU_LOOP|BIT_RX_CTRL_CSU_LOOP; //unsigned char loop=BIT_RX_CTRL_DSU_LOOP; //unsigned char loop=BIT_RX_CTRL_CSU_LOOP; - unsigned char loop=0x40; - + unsigned char loop=0x00; + + if(type==WAN_TE1_PAYLB_MODE){ + loop=BIT_RX_CTRL_DSU_LOOP; + }else{ + loop=BIT_RX_CTRL_CSU_LOOP; + } + WAN_ASSERT(fe->write_fe_reg == NULL); WAN_ASSERT(fe->read_fe_reg == NULL); @@ -601,9 +603,9 @@ static int sdla_56k_udp(sdla_fe_t *fe, void* pudp_cmd, unsigned char* data) ** Arguments: ** Returns: */ -static int sdla_56k_print_alarm(sdla_fe_t* fe, unsigned int status) +static int sdla_56k_print_alarm(sdla_fe_t* fe, u_int32_t status) { - unsigned int alarms = (unsigned int)status; + u_int32_t alarms = status; AFT_FUNC_DEBUG(); diff --git a/patches/kdrivers/src/net/sdla_8te1.c b/patches/kdrivers/src/net/sdla_8te1.c index ae95a13..762c844 100644 --- a/patches/kdrivers/src/net/sdla_8te1.c +++ b/patches/kdrivers/src/net/sdla_8te1.c @@ -29,20 +29,25 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: sdla_8te1.c,v 1.66 2007/04/10 16:28:49 sangoma Exp $ + * $Id: sdla_8te1.c,v 1.117 2008/03/06 18:17:59 sangoma Exp $ */ -/* - ****************************************************************************** - * sdla_8te1.c WANPIPE(tm) Multiprotocol WAN Link Driver. - * 8 ports T1/E1 board configuration. - * - * Author: Alex Feldman - * - * ============================================================================ - * Feb 18, 2006 Alex Feldma Initial version. - ****************************************************************************** - */ +/****************************************************************************** +** sdla_8te1.c WANPIPE(tm) Multiprotocol WAN Link Driver. +** 8 ports T1/E1 board configuration. +** +** Author: Alex Feldman +** +** ============================================================================ +** Date Name Label Description +** ============================================================================ +** 02-18-06 Alex Feldman Initial version. +** 07-10-07 Alex Feldman EBIT Enable auto E-bit support. +** Nov 23, 2007 Alex Feldman UNFRM Add support E1 Unframe mode for E1 +** interface. +** Nov 23, 2007 Alex Feldman TXTRI Add support for TX Tri-state. +** Feb 06, 2008 Alex Feldman E1_120 Adjust waveform for E1, 120 ohm. +******************************************************************************/ /****************************************************************************** * INCLUDE FILES @@ -81,10 +86,8 @@ /****************************************************************************** * DEFINES AND MACROS ******************************************************************************/ -#undef WANPIPE_IGNORE_T1_YELLOW -/* Dec 14, 2007 -** Disable all FE interrupt if Short Circuit condition detected! */ -#undef WAN_FE_SC_DISABLE_INTR + +#define WAN_TE1_DEVICE_ID DEVICE_ID_DS(READ_REG_LINE(0, REG_IDR)) #define CLEAR_REG(sreg,ereg) { \ unsigned short reg; \ @@ -104,72 +107,46 @@ IS_LIUREG(reg) ? 0x020 : \ IS_BERTREG(reg) ? 0x010 : 0x001 -#if 1 /* Read/Write to front-end register */ #define WRITE_REG(reg,val) \ fe->write_fe_reg( \ - fe->card, \ - fe->fe_cfg.line_no, \ + ((sdla_t*)fe->card)->hw, \ + (int)(((sdla_t*)fe->card)->wandev.state==WAN_CONNECTED), \ + (int)fe->fe_cfg.line_no, \ (int)sdla_ds_te1_address(fe,fe->fe_cfg.line_no,(reg)), \ (int)(val)) #define WRITE_REG_LINE(fe_line_no, reg,val) \ fe->write_fe_reg( \ - fe->card, \ - fe_line_no, \ + ((sdla_t*)fe->card)->hw, \ + (int)(((sdla_t*)fe->card)->wandev.state==WAN_CONNECTED), \ + (int)fe_line_no, \ (int)sdla_ds_te1_address(fe,fe_line_no,(reg)), \ (int)(val)) #define READ_REG(reg) \ fe->read_fe_reg( \ - fe->card, \ - fe->fe_cfg.line_no, \ + ((sdla_t*)fe->card)->hw, \ + (int)(((sdla_t*)fe->card)->wandev.state==WAN_CONNECTED), \ + (int)fe->fe_cfg.line_no, \ (int)sdla_ds_te1_address(fe,fe->fe_cfg.line_no,(reg))) #define __READ_REG(reg) \ fe->__read_fe_reg( \ - fe->card, \ - fe->fe_cfg.line_no, \ + ((sdla_t*)fe->card)->hw, \ + (int)(((sdla_t*)fe->card)->wandev.state==WAN_CONNECTED), \ + (int)fe->fe_cfg.line_no, \ (int)sdla_ds_te1_address(fe,fe->fe_cfg.line_no,(reg))) #define READ_REG_LINE(fe_line_no, reg) \ fe->read_fe_reg( \ - fe->card, \ - fe_line_no, \ + ((sdla_t*)fe->card)->hw, \ + (int)(((sdla_t*)fe->card)->wandev.state==WAN_CONNECTED), \ + (int)fe_line_no, \ (int)sdla_ds_te1_address(fe,fe_line_no,(reg))) -#else -/* Read/Write to front-end register */ -#define WRITE_REG(reg,val) \ - fe->write_fe_reg( \ - fe->card, \ - (int)((reg) + ((fe->fe_cfg.line_no)*(DLS_PORT_DELTA(reg)))),\ - (int)(val)) - -#define WRITE_REG_LINE(fe_line_no, reg,val) \ - fe->write_fe_reg( \ - fe->card, \ - (int)((reg) + (fe_line_no)*(DLS_PORT_DELTA(reg))), \ - (int)(val)) - -#define READ_REG(reg) \ - fe->read_fe_reg( \ - fe->card, \ - (int)((reg) + ((fe->fe_cfg.line_no)*(DLS_PORT_DELTA(reg))))) - -#define __READ_REG(reg) \ - fe->__read_fe_reg( \ - fe->card, \ - (int)((reg) + ((fe->fe_cfg.line_no)*(DLS_PORT_DELTA(reg))))) - -#define READ_REG_LINE(fe_line_no, reg) \ - fe->read_fe_reg( \ - fe->card, \ - (int)((reg) + (fe_line_no)*(DLS_PORT_DELTA(reg)))) -#endif - - #define WAN_TE1_FRAMED_ALARMS (WAN_TE_BIT_RED_ALARM | WAN_TE_BIT_OOF_ALARM) +/*Nov 23, 2007 UNFRM */ #define WAN_TE1_UNFRAMED_ALARMS (WAN_TE_BIT_RED_ALARM | WAN_TE_BIT_LOS_ALARM) #define IS_T1_ALARM(alarm) \ @@ -249,6 +226,7 @@ static int sdla_ds_te1_reset(void* pfe, int port_no, int reset); static int sdla_ds_te1_global_config(void* pfe); /* Change to static */ static int sdla_ds_te1_global_unconfig(void* pfe); /* Change to static */ static int sdla_ds_te1_chip_config(void* pfe); +/*static int sdla_ds_te1_chip_config_verify(sdla_fe_t* pfe);*/ static int sdla_ds_te1_config(void* pfe); /* Change to static */ static int sdla_ds_te1_reconfig(sdla_fe_t* fe); static int sdla_ds_te1_post_init(void *pfe); @@ -266,11 +244,11 @@ static int sdla_ds_te1_pmon(sdla_fe_t *fe, int action); static int sdla_ds_te1_rxlevel(sdla_fe_t* fe); static int sdla_ds_te1_polling(sdla_fe_t* fe); static unsigned int sdla_ds_te1_read_alarms(sdla_fe_t *fe, int read); -static int sdla_ds_te1_set_alarms(sdla_fe_t* fe, unsigned long alarms); -static int sdla_ds_te1_clear_alarms(sdla_fe_t* fe, unsigned long alarms); -static void sdla_ds_te1_set_status(sdla_fe_t* fe, unsigned long alarms); +static int sdla_ds_te1_set_alarms(sdla_fe_t* fe, u_int32_t alarms); +static int sdla_ds_te1_clear_alarms(sdla_fe_t* fe, u_int32_t alarms); +static void sdla_ds_te1_set_status(sdla_fe_t* fe, u_int32_t alarms); static int sdla_ds_te1_print_alarms(sdla_fe_t*, unsigned int); -static int sdla_ds_te1_set_lbmode(sdla_fe_t*, unsigned char, unsigned char); +static int sdla_ds_te1_set_lb(sdla_fe_t*, unsigned char, unsigned char); static int sdla_ds_te1_rbs_update(sdla_fe_t* fe, int, unsigned char); static int sdla_ds_te1_set_rbsbits(sdla_fe_t *fe, int, unsigned char); static int sdla_ds_te1_rbs_report(sdla_fe_t* fe); @@ -405,8 +383,9 @@ static int sdla_ds_te1_RxChanCtrl(sdla_fe_t* fe, int channel, int enable) } -int sdla_ds_te1_iface_init(void *p_fe_iface) +int sdla_ds_te1_iface_init(void *p_fe, void *p_fe_iface) { + sdla_fe_t *fe = (sdla_fe_t*)p_fe; sdla_fe_iface_t *fe_iface = (sdla_fe_iface_t*)p_fe_iface; fe_iface->reset = &sdla_ds_te1_reset; @@ -423,6 +402,7 @@ int sdla_ds_te1_iface_init(void *p_fe_iface) fe_iface->check_isr = &sdla_ds_te1_check_intr; fe_iface->intr_ctrl = &sdla_ds_te1_intr_ctrl; fe_iface->polling = &sdla_ds_te1_polling; + fe_iface->add_timer = &sdla_ds_te1_add_timer; fe_iface->process_udp = &sdla_ds_te1_udp; fe_iface->print_fe_alarm = &sdla_ds_te1_print_alarms; @@ -436,16 +416,20 @@ int sdla_ds_te1_iface_init(void *p_fe_iface) fe_iface->get_fe_media_string = &sdla_ds_te1_get_fe_media_string; fe_iface->update_alarm_info = &sdla_ds_te1_update_alarm_info; fe_iface->update_pmon_info = &sdla_ds_te1_update_pmon_info; - fe_iface->set_fe_lbmode = &sdla_ds_te1_set_lbmode; + fe_iface->set_fe_lbmode = &sdla_ds_te1_set_lb; fe_iface->read_rbsbits = &sdla_ds_te1_read_rbsbits; fe_iface->check_rbsbits = &sdla_ds_te1_check_rbsbits; fe_iface->report_rbsbits = &sdla_ds_te1_rbs_report; fe_iface->set_rbsbits = &sdla_ds_te1_set_rbsbits; fe_iface->set_fe_sigctrl = &sdla_ds_te1_sigctrl; - #if 0 fe_iface->led_ctrl = &sdla_te_led_ctrl; #endif + + /* Initial FE state */ + fe->fe_status = FE_UNITIALIZED; //FE_DISCONNECTED; + WAN_LIST_INIT(&fe->event); + wan_spin_lock_irq_init(&fe->lockirq, "wan_8te1_lock"); return 0; } @@ -458,11 +442,12 @@ int sdla_ds_te1_iface_init(void *p_fe_iface) ******************************************************************************/ static int sdla_ds_te1_device_id(sdla_fe_t* fe) { - u_int8_t value; +// u_int8_t value; /* Revision/Chip ID (Reg. 0x0D) */ - value = READ_REG_LINE(0, REG_IDR); - fe->fe_chip_id = DEVICE_ID_DS(value); +// value = READ_REG_LINE(0, REG_IDR); +// fe->fe_chip_id = DEVICE_ID_DS(value); + fe->fe_chip_id = WAN_TE1_DEVICE_ID; switch(fe->fe_chip_id){ case DEVICE_ID_DS26528: fe->fe_max_ports = 8; @@ -481,7 +466,7 @@ static int sdla_ds_te1_device_id(sdla_fe_t* fe) fe->name, FE_MEDIA_DECODE(fe), fe->fe_chip_id, - value); + READ_REG_LINE(0, REG_IDR)); return -EINVAL; } return 0; @@ -579,7 +564,7 @@ static int sdla_ds_e1_set_sig_mode(sdla_fe_t *fe, int verbose) /* CAS signalling mode */ if (verbose){ - DEBUG_EVENT("%s: Enabling CAS Signalling mode!\n", + DEBUG_EVENT("%s: Enable E1 CAS Signalling mode!\n", fe->name); } value = READ_REG(REG_RCR1); @@ -592,12 +577,16 @@ static int sdla_ds_e1_set_sig_mode(sdla_fe_t *fe, int verbose) /* CCS signalling mode */ if (verbose){ - DEBUG_TEST("%s: Enabling CCS Signalling mode!\n", + DEBUG_EVENT("%s: Enable E1 CCS Signalling mode!\n", fe->name); } WAN_TE1_SIG_MODE(fe) = WAN_TE1_SIG_CCS; value = READ_REG(REG_RCR1); WRITE_REG(REG_RCR1, value | BIT_RCR1_E1_RSIGM); + + value = READ_REG(REG_TCR1); + WRITE_REG(REG_TCR1, value & ~BIT_TCR1_E1_T16S); + } return 0; } @@ -655,6 +644,7 @@ static int sdla_ds_te1_global_unconfig(void* pfe) WRITE_REG_LINE(0, REG_GFIMR, 0x00); WRITE_REG_LINE(0, REG_GLIMR, 0x00); WRITE_REG_LINE(0, REG_GBIMR, 0x00); + WP_DELAY(1000); WRITE_REG_LINE(0, REG_GLSRR, 0xFF); WRITE_REG_LINE(0, REG_GFSRR, 0xFF); @@ -664,237 +654,233 @@ static int sdla_ds_te1_global_unconfig(void* pfe) } /****************************************************************************** -** sdla_ds_te1_cfg_verify() +** sdla_ds_t1_cfg_verify() ** -** Description: Verify T1/E1 Front-End configuration -** Arguments: -** Returns: 0 - successfully, otherwise -EINVAL. +** Description: Verify T1 Front-End configuration +** Arguments: +** Returns: 0 - successfully, otherwise -EINVAL. *******************************************************************************/ -static int sdla_ds_te1_cfg_verify(void* pfe) +static int sdla_ds_t1_cfg_verify(void* pfe) { - sdla_fe_t *fe = (sdla_fe_t*)pfe; + sdla_fe_t *fe = (sdla_fe_t*)pfe; - - if (IS_T1_FEMEDIA(fe) || IS_J1_FEMEDIA(fe)){ - - /* Verify FE framing type */ - switch(WAN_FE_FRAME(fe)){ - case WAN_FR_D4: case WAN_FR_ESF: case WAN_FR_UNFRAMED: - break; - case WAN_FR_NONE: - DEBUG_EVENT("%s: Defaulting T1 Frame = ESF\n", + /* Verify FE framing type */ + switch(WAN_FE_FRAME(fe)){ + case WAN_FR_D4: case WAN_FR_ESF: case WAN_FR_UNFRAMED: + break; + case WAN_FR_NONE: + DEBUG_EVENT("%s: Defaulting T1 Frame = ESF\n", fe->name); - WAN_FE_FRAME(fe) = WAN_FR_ESF; - break; - default: - DEBUG_EVENT("%s: Error: Invalid %s FE Framing type (%X)\n", + WAN_FE_FRAME(fe) = WAN_FR_ESF; + break; + default: + DEBUG_EVENT("%s: Error: Invalid %s FE Framing type (%X)\n", fe->name, FE_MEDIA_DECODE(fe), WAN_FE_FRAME(fe)); - return -EINVAL; - break; - } - - /* Verify FE line code type */ - switch(WAN_FE_LCODE(fe)){ - case WAN_LCODE_B8ZS: case WAN_LCODE_AMI: - break; - case WAN_LCODE_NONE: - DEBUG_EVENT("%s: Defaulting T1 Line Code = B8ZS\n", - fe->name); - WAN_FE_LCODE(fe) = WAN_LCODE_B8ZS; - break; - default: - DEBUG_EVENT("%s: Error: Invalid %s FE Line code type (%X)\n", - fe->name, - FE_MEDIA_DECODE(fe), - WAN_FE_LCODE(fe)); - return -EINVAL; - break; - } - - /* Verify LBO */ - switch(WAN_TE1_LBO(fe)) { - case WAN_T1_LBO_0_DB: case WAN_T1_LBO_75_DB: - case WAN_T1_LBO_15_DB: case WAN_T1_LBO_225_DB: - case WAN_T1_0_133: case WAN_T1_0_110: - case WAN_T1_133_266: case WAN_T1_110_220: - case WAN_T1_266_399: case WAN_T1_220_330: - case WAN_T1_399_533: case WAN_T1_330_440: case WAN_T1_440_550: - case WAN_T1_533_655: case WAN_T1_550_660: - break; - case WAN_T1_LBO_NONE: - DEBUG_EVENT("%s: Defaulting T1 LBO = 0 db\n", - fe->name); - WAN_TE1_LBO(fe) = WAN_T1_LBO_0_DB; - break; - default: - DEBUG_EVENT("%s: Error: Invalid %s LBO value (%X)\n", - fe->name, - FE_MEDIA_DECODE(fe), - WAN_TE1_LBO(fe)); - return -EINVAL; - break; - } - - - if (WAN_TE1_HI_MODE(fe)){ - switch(fe->fe_cfg.cfg.te_cfg.rx_slevel){ - case WAN_TE1_RX_SLEVEL_30_DB: case WAN_TE1_RX_SLEVEL_225_DB: - case WAN_TE1_RX_SLEVEL_175_DB: case WAN_TE1_RX_SLEVEL_12_DB: - break; - case WAN_TE1_RX_SLEVEL_NONE: - DEBUG_EVENT("%s: Defaulting T1 Rx Sens. Gain= 30 db\n", - fe->name); - fe->fe_cfg.cfg.te_cfg.rx_slevel = WAN_TE1_RX_SLEVEL_30_DB; - break; - default: - DEBUG_EVENT( - "%s: Error: Invalid T1 Rx Sensitivity Gain (%d).\n", - fe->name, - fe->fe_cfg.cfg.te_cfg.rx_slevel); - return -EINVAL; - } - }else{ - switch(fe->fe_cfg.cfg.te_cfg.rx_slevel){ - case WAN_TE1_RX_SLEVEL_36_DB: case WAN_TE1_RX_SLEVEL_30_DB: - case WAN_TE1_RX_SLEVEL_18_DB: case WAN_TE1_RX_SLEVEL_12_DB: - break; - case WAN_TE1_RX_SLEVEL_NONE: - DEBUG_EVENT("%s: Defaulting T1 Rx Sens. Gain= 36 db\n", - fe->name); - fe->fe_cfg.cfg.te_cfg.rx_slevel = WAN_TE1_RX_SLEVEL_36_DB; - break; - default: - DEBUG_EVENT( - "%s: Error: Invalid T1 Rx Sensitivity Gain (%d).\n", - fe->name, - fe->fe_cfg.cfg.te_cfg.rx_slevel); - return -EINVAL; - } - } - - - }else if (IS_E1_FEMEDIA(fe)){ - - /* Verify FE framing type */ - switch(WAN_FE_FRAME(fe)){ - case WAN_FR_NCRC4: case WAN_FR_CRC4: case WAN_FR_UNFRAMED: - break; - case WAN_FR_NONE: - DEBUG_EVENT("%s: Defaulting E1 Frame = CRC4\n", - fe->name); - WAN_FE_FRAME(fe) = WAN_FR_CRC4; - break; - default: - DEBUG_EVENT("%s: Error: Invalid %s FE Framing type (%X)\n", - fe->name, - FE_MEDIA_DECODE(fe), - WAN_FE_FRAME(fe)); - return -EINVAL; - break; - } - - /* Verify FE line code type */ - switch(WAN_FE_LCODE(fe)){ - case WAN_LCODE_HDB3: case WAN_LCODE_AMI: - break; - case WAN_LCODE_NONE: - DEBUG_EVENT("%s: Defaulting E1 Line Code = HDB3\n", - fe->name); - WAN_FE_LCODE(fe) = WAN_LCODE_HDB3; - break; - default: - DEBUG_EVENT("%s: Error: Invalid %s FE Line code type (%X)\n", - fe->name, - FE_MEDIA_DECODE(fe), - WAN_FE_LCODE(fe)); - return -EINVAL; - break; - } - - /* Verify LBO */ - switch(WAN_TE1_LBO(fe)) { - case WAN_E1_120: case WAN_E1_75: - break; - case WAN_T1_LBO_NONE: - DEBUG_EVENT("%s: Defaulting E1 LBO = 120 OH\n", - fe->name); - WAN_TE1_LBO(fe) = WAN_E1_120; - break; - default: - DEBUG_EVENT("%s: Error: Invalid %s LBO value (%X)\n", - fe->name, - FE_MEDIA_DECODE(fe), - WAN_TE1_LBO(fe)); - return -EINVAL; - break; - } - - switch(WAN_TE1_SIG_MODE(fe)){ - case WAN_TE1_SIG_CAS: case WAN_TE1_SIG_CCS: - break; - case WAN_TE1_SIG_NONE: - DEBUG_EVENT("%s: Defaulting E1 Signalling = CCS\n", - fe->name); - WAN_TE1_SIG_MODE(fe) = WAN_TE1_SIG_CCS; - break; - default: - DEBUG_EVENT("%s: Error: Invalid E1 Signalling type (%X)\n", - fe->name, - WAN_TE1_SIG_MODE(fe)); - return -EINVAL; - break; - } - - - - if (WAN_TE1_HI_MODE(fe)){ - switch(fe->fe_cfg.cfg.te_cfg.rx_slevel){ - case WAN_TE1_RX_SLEVEL_30_DB: case WAN_TE1_RX_SLEVEL_225_DB: - case WAN_TE1_RX_SLEVEL_175_DB: case WAN_TE1_RX_SLEVEL_12_DB: - break; - case WAN_TE1_RX_SLEVEL_NONE: - DEBUG_EVENT("%s: Defaulting E1 Rx Sens. Gain= 30 db\n", - fe->name); - fe->fe_cfg.cfg.te_cfg.rx_slevel = WAN_TE1_RX_SLEVEL_30_DB; - break; - default: - DEBUG_EVENT( - "%s: Error: Invalid E1 Rx Sensitivity Gain (%d).\n", - fe->name, - fe->fe_cfg.cfg.te_cfg.rx_slevel); - return -EINVAL; - } - }else{ - switch(fe->fe_cfg.cfg.te_cfg.rx_slevel){ - case WAN_TE1_RX_SLEVEL_43_DB: case WAN_TE1_RX_SLEVEL_30_DB: - case WAN_TE1_RX_SLEVEL_18_DB: case WAN_TE1_RX_SLEVEL_12_DB: - break; - case WAN_TE1_RX_SLEVEL_NONE: - DEBUG_EVENT("%s: Defaulting E1 Rx Sens. Gain= 43 db\n", - fe->name); - fe->fe_cfg.cfg.te_cfg.rx_slevel = WAN_TE1_RX_SLEVEL_43_DB; - break; - default: - DEBUG_EVENT( - "%s: Error: Invalid E1 Rx Sensitivity Gain (%d).\n", - fe->name, - fe->fe_cfg.cfg.te_cfg.rx_slevel); - return -EINVAL; - } - - } - - }else{ - DEBUG_EVENT("%s: Error: Invalid FE Media type (%X)\n", - fe->name, - WAN_FE_MEDIA(fe)); return -EINVAL; + break; } + + /* Verify FE line code type */ + switch(WAN_FE_LCODE(fe)){ + case WAN_LCODE_B8ZS: case WAN_LCODE_AMI: + break; + case WAN_LCODE_NONE: + DEBUG_EVENT("%s: Defaulting T1 Line Code = B8ZS\n", + fe->name); + WAN_FE_LCODE(fe) = WAN_LCODE_B8ZS; + break; + default: + DEBUG_EVENT("%s: Error: Invalid %s FE Line code type (%X)\n", + fe->name, + FE_MEDIA_DECODE(fe), + WAN_FE_LCODE(fe)); + return -EINVAL; + break; + } + + /* Verify LBO */ + switch(WAN_TE1_LBO(fe)) { + case WAN_T1_LBO_0_DB: case WAN_T1_LBO_75_DB: + case WAN_T1_LBO_15_DB: case WAN_T1_LBO_225_DB: + case WAN_T1_0_133: case WAN_T1_133_266: case WAN_T1_110_220: + case WAN_T1_266_399: case WAN_T1_220_330: + case WAN_T1_399_533: case WAN_T1_330_440: case WAN_T1_440_550: + case WAN_T1_533_655: case WAN_T1_550_660: + break; + case WAN_T1_LBO_NONE: + DEBUG_EVENT("%s: Defaulting T1 LBO = 0 db\n", + fe->name); + WAN_TE1_LBO(fe) = WAN_T1_LBO_0_DB; + break; + default: + DEBUG_EVENT("%s: Error: Invalid %s LBO value (%X)\n", + fe->name, + FE_MEDIA_DECODE(fe), + WAN_TE1_LBO(fe)); + return -EINVAL; + break; + } + + if (WAN_TE1_HI_MODE(fe)){ + switch(fe->fe_cfg.cfg.te_cfg.rx_slevel){ + case WAN_TE1_RX_SLEVEL_30_DB: case WAN_TE1_RX_SLEVEL_225_DB: + case WAN_TE1_RX_SLEVEL_175_DB: case WAN_TE1_RX_SLEVEL_12_DB: + break; + case WAN_TE1_RX_SLEVEL_NONE: + DEBUG_EVENT("%s: Defaulting T1 Rx Sens. Gain= 12 db\n", + fe->name); + fe->fe_cfg.cfg.te_cfg.rx_slevel = WAN_TE1_RX_SLEVEL_12_DB; + break; + default: + DEBUG_EVENT( + "%s: Error: Invalid T1 Rx Sensitivity Gain (%d).\n", + fe->name, + fe->fe_cfg.cfg.te_cfg.rx_slevel); + return -EINVAL; + } + }else{ + switch(fe->fe_cfg.cfg.te_cfg.rx_slevel){ + case WAN_TE1_RX_SLEVEL_36_DB: case WAN_TE1_RX_SLEVEL_30_DB: + case WAN_TE1_RX_SLEVEL_18_DB: case WAN_TE1_RX_SLEVEL_12_DB: + break; + case WAN_TE1_RX_SLEVEL_NONE: + DEBUG_EVENT("%s: Defaulting T1 Rx Sens. Gain= 36 db\n", + fe->name); + fe->fe_cfg.cfg.te_cfg.rx_slevel = WAN_TE1_RX_SLEVEL_36_DB; + break; + default: + DEBUG_EVENT( + "%s: Error: Invalid T1 Rx Sensitivity Gain (%d).\n", + fe->name, + fe->fe_cfg.cfg.te_cfg.rx_slevel); + return -EINVAL; + } + } + return 0; } +/****************************************************************************** +** sdla_ds_e1_cfg_verify() +** +** Description: Verify E1 Front-End configuration +** Arguments: +** Returns: 0 - successfully, otherwise -EINVAL. +*******************************************************************************/ +static int sdla_ds_e1_cfg_verify(void* pfe) +{ + sdla_fe_t *fe = (sdla_fe_t*)pfe; + + /* Verify FE framing type */ + switch(WAN_FE_FRAME(fe)){ + case WAN_FR_NCRC4: case WAN_FR_CRC4: case WAN_FR_UNFRAMED: + break; + case WAN_FR_NONE: + DEBUG_EVENT("%s: Defaulting E1 Frame = CRC4\n", + fe->name); + WAN_FE_FRAME(fe) = WAN_FR_CRC4; + break; + default: + DEBUG_EVENT("%s: Error: Invalid %s FE Framing type (%X)\n", + fe->name, + FE_MEDIA_DECODE(fe), + WAN_FE_FRAME(fe)); + return -EINVAL; + break; + } + /* Verify FE line code type */ + switch(WAN_FE_LCODE(fe)){ + case WAN_LCODE_HDB3: case WAN_LCODE_AMI: + break; + case WAN_LCODE_NONE: + DEBUG_EVENT("%s: Defaulting E1 Line Code = HDB3\n", + fe->name); + WAN_FE_LCODE(fe) = WAN_LCODE_HDB3; + break; + default: + DEBUG_EVENT("%s: Error: Invalid %s FE Line code type (%X)\n", + fe->name, + FE_MEDIA_DECODE(fe), + WAN_FE_LCODE(fe)); + return -EINVAL; + break; + } + + /* Verify LBO */ + switch(WAN_TE1_LBO(fe)) { + case WAN_E1_120: case WAN_E1_75: + break; + case WAN_T1_LBO_NONE: + DEBUG_EVENT("%s: Defaulting E1 LBO = 120 OH\n", + fe->name); + WAN_TE1_LBO(fe) = WAN_E1_120; + break; + default: + DEBUG_EVENT("%s: Error: Invalid %s LBO value (%X)\n", + fe->name, + FE_MEDIA_DECODE(fe), + WAN_TE1_LBO(fe)); + return -EINVAL; + break; + } + + switch(WAN_TE1_SIG_MODE(fe)){ + case WAN_TE1_SIG_CAS: case WAN_TE1_SIG_CCS: + break; + case WAN_TE1_SIG_NONE: + DEBUG_EVENT("%s: Defaulting E1 Signalling = CCS\n", + fe->name); + WAN_TE1_SIG_MODE(fe) = WAN_TE1_SIG_CCS; + break; + default: + DEBUG_EVENT("%s: Error: Invalid E1 Signalling type (%X)\n", + fe->name, + WAN_TE1_SIG_MODE(fe)); + return -EINVAL; + break; + } + + if (WAN_TE1_HI_MODE(fe)){ + switch(fe->fe_cfg.cfg.te_cfg.rx_slevel){ + case WAN_TE1_RX_SLEVEL_30_DB: case WAN_TE1_RX_SLEVEL_225_DB: + case WAN_TE1_RX_SLEVEL_175_DB: case WAN_TE1_RX_SLEVEL_12_DB: + break; + case WAN_TE1_RX_SLEVEL_NONE: + DEBUG_EVENT("%s: Defaulting E1 Rx Sens. Gain= 12 db\n", + fe->name); + fe->fe_cfg.cfg.te_cfg.rx_slevel = WAN_TE1_RX_SLEVEL_12_DB; + break; + default: + DEBUG_EVENT( + "%s: Error: Invalid T1 Rx Sensitivity Gain (%d).\n", + fe->name, + fe->fe_cfg.cfg.te_cfg.rx_slevel); + return -EINVAL; + } + }else{ + switch(fe->fe_cfg.cfg.te_cfg.rx_slevel){ + case WAN_TE1_RX_SLEVEL_43_DB: case WAN_TE1_RX_SLEVEL_30_DB: + case WAN_TE1_RX_SLEVEL_18_DB: case WAN_TE1_RX_SLEVEL_12_DB: + break; + case WAN_TE1_RX_SLEVEL_NONE: + DEBUG_EVENT("%s: Defaulting E1 Rx Sens. Gain= 43 db\n", + fe->name); + fe->fe_cfg.cfg.te_cfg.rx_slevel = WAN_TE1_RX_SLEVEL_43_DB; + break; + default: + DEBUG_EVENT( + "%s: Error: Invalid T1 Rx Sensitivity Gain (%d).\n", + fe->name, + fe->fe_cfg.cfg.te_cfg.rx_slevel); + return -EINVAL; + } + + } + + return 0; +} /****************************************************************************** ** sdla_ds_te1_chip_config() @@ -932,7 +918,7 @@ static int sdla_ds_te1_chip_config(void* pfe) /* Enable Rx Framer */ WRITE_REG(REG_RMMR, BIT_RMMR_FRM_EN); if (IS_FE_TXTRISTATE(fe)){ - DEBUG_EVENT("%s: Tx Disabled (tri-state mode)\n", + DEBUG_EVENT("%s: Disable TX (tri-state mode)\n", fe->name); }else{ /* Enable Tx Framer */ @@ -946,7 +932,7 @@ static int sdla_ds_te1_chip_config(void* pfe) /* Enable Rx Framer */ WRITE_REG(REG_RMMR, (BIT_RMMR_FRM_EN | BIT_RMMR_T1E1)); if (IS_FE_TXTRISTATE(fe)){ - DEBUG_EVENT("%s: Tx Disabled (tri-state mode)\n", + DEBUG_EVENT("%s: Disable TX (tri-state mode)\n", fe->name); }else{ /* Enable Tx Framer */ @@ -964,10 +950,10 @@ static int sdla_ds_te1_chip_config(void* pfe) value = READ_REG(REG_TCR2); WRITE_REG(REG_TCR2, value & ~BIT_TCR2_T1_TFDLS); - + value = READ_REG(REG_TCR3); WRITE_REG(REG_TCR3, value | BIT_TCR3_TFM); - + WRITE_REG(REG_T1TFDL, 0x1c); break; @@ -976,11 +962,33 @@ static int sdla_ds_te1_chip_config(void* pfe) value |= BIT_RCR1_T1_SYNCC; value &= ~BIT_RCR1_T1_RFM; WRITE_REG(REG_RCR1, value); - + value = READ_REG(REG_TCR3); value &= ~BIT_TCR3_TFM; WRITE_REG(REG_TCR3, value); break; + + case WAN_FR_SLC96: + value = READ_REG(REG_RCR1); + value |= (BIT_RCR1_T1_RFM|BIT_RCR1_T1_SYNCC); + value &= ~BIT_RCR1_T1_SYNCT; + WRITE_REG(REG_RCR1, value); + + value = READ_REG(REG_T1RCR2); + WRITE_REG(REG_T1RCR2, value | BIT_T1RCR2_RSLC96); + + value = READ_REG(REG_TCR1); + value &= ~BIT_TCR1_T1_TFPT; + WRITE_REG(REG_TCR1, value); + + value = READ_REG(REG_TCR2); + value |= BIT_TCR2_T1_TSLC96; + value &= ~BIT_TCR2_T1_TFDLS; + WRITE_REG(REG_TCR2, value); + + value = READ_REG(REG_TCR3); + WRITE_REG(REG_TCR3, value | BIT_TCR3_TFM); + break; case WAN_FR_NCRC4: break; case WAN_FR_CRC4: @@ -988,6 +996,7 @@ static int sdla_ds_te1_chip_config(void* pfe) WRITE_REG(REG_RCR1, value | BIT_RCR1_E1_RCRC4); value = READ_REG(REG_TCR1); WRITE_REG(REG_TCR1, value | BIT_TCR1_E1_TCRC4); + /* EBIT: Enable auto E-bit support */ value = READ_REG(REG_TCR2); WRITE_REG(REG_TCR2, value | BIT_TCR2_E1_AEBE); break; @@ -999,10 +1008,8 @@ static int sdla_ds_te1_chip_config(void* pfe) WRITE_REG(REG_RCR1, value | BIT_RCR1_E1_SYNCE); break; default: - DEBUG_EVENT("%s: Error: Invalid %s Frame mode (%X:%s)\n", - fe->name, - FE_MEDIA_DECODE(fe), - WAN_FE_FRAME(fe), FE_FRAME_DECODE(fe)); + DEBUG_EVENT("%s: Unsupported DS Frame mode (%X)\n", + fe->name, WAN_FE_FRAME(fe)); return -EINVAL; } @@ -1040,10 +1047,8 @@ static int sdla_ds_te1_chip_config(void* pfe) break; default: - DEBUG_EVENT("%s: Error: Invalid %s Line code value (%X:%s)\n", - fe->name, - FE_MEDIA_DECODE(fe), - WAN_FE_LCODE(fe), FE_LCODE_DECODE(fe)); + DEBUG_EVENT("%s: Unsupported DS Line code mode (%X)\n", + fe->name, WAN_FE_LCODE(fe)); return -EINVAL; } @@ -1072,9 +1077,11 @@ static int sdla_ds_te1_chip_config(void* pfe) WRITE_REG(REG_TIOCR, value); } #endif + if (IS_E1_FEMEDIA(fe)){ //WRITE_REG(REG_E1TAF, 0x1B); //WRITE_REG(REG_E1TNAF, 0x40); + WRITE_REG(REG_E1TAF, 0x1B); WRITE_REG(REG_E1TNAF, 0x5F); WRITE_REG(REG_E1TSa4, 0x00); @@ -1093,8 +1100,9 @@ static int sdla_ds_te1_chip_config(void* pfe) } } + if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ - /* Set INIT_DONE (not unframed mode) */ + /* Set INIT_DONE (for not unframed mode) */ value = READ_REG(REG_RMMR); WRITE_REG(REG_RMMR, value | BIT_RMMR_INIT_DONE); value = READ_REG(REG_TMMR); @@ -1110,7 +1118,6 @@ static int sdla_ds_te1_chip_config(void* pfe) } value = 0x00; - switch(WAN_TE1_LBO(fe)) { case WAN_T1_LBO_0_DB: value = 0x00; @@ -1124,25 +1131,19 @@ static int sdla_ds_te1_chip_config(void* pfe) case WAN_T1_LBO_225_DB: value = BIT_LTITSR_L2 | BIT_LTITSR_L1 | BIT_LTITSR_L0; break; - case WAN_T1_0_133: - case WAN_T1_0_110: + case WAN_T1_0_133: case WAN_T1_0_110: value = 0x00; break; - case WAN_T1_133_266: - case WAN_T1_110_220: + case WAN_T1_133_266: case WAN_T1_110_220: value = BIT_LTITSR_L0; break; - case WAN_T1_266_399: - case WAN_T1_220_330: + case WAN_T1_266_399: case WAN_T1_220_330: value = BIT_LTITSR_L1; break; - case WAN_T1_399_533: - case WAN_T1_330_440: - case WAN_T1_440_550: + case WAN_T1_399_533: case WAN_T1_330_440: value = BIT_LTITSR_L1 | BIT_LTITSR_L0; break; - case WAN_T1_533_655: - case WAN_T1_550_660: + case WAN_T1_533_655: case WAN_T1_440_550: case WAN_T1_550_660: value = BIT_LTITSR_L2; break; case WAN_E1_120: @@ -1152,11 +1153,10 @@ static int sdla_ds_te1_chip_config(void* pfe) value = 0x00; break; default: - DEBUG_EVENT("%s: Error: Invalid %s LBO value (%X)\n", - fe->name, - FE_MEDIA_DECODE(fe), - WAN_TE1_LBO(fe)); - return -EINVAL; + if (IS_E1_FEMEDIA(fe)){ + value = BIT_LTITSR_L0; + } + break; } if (IS_T1_FEMEDIA(fe)){ WRITE_REG(REG_LTITSR, value | BIT_LTITSR_TIMPL0); @@ -1189,9 +1189,12 @@ static int sdla_ds_te1_chip_config(void* pfe) fe->fe_cfg.cfg.te_cfg.rx_slevel = WAN_TE1_RX_SLEVEL_30_DB; break; } - DEBUG_EVENT("%s: Rx Sensitivity Gain %s (High Impedence mode).\n", - fe->name, - WAN_TE1_RX_SLEVEL_DECODE(fe->fe_cfg.cfg.te_cfg.rx_slevel)); + DEBUG_EVENT( + "%s: Rx Sensitivity Gain %s%s (High Impedence mode).\n", + fe->name, + WAN_TE1_RX_SLEVEL_DECODE(fe->fe_cfg.cfg.te_cfg.rx_slevel), + (fe->fe_cfg.cfg.te_cfg.rx_slevel==WAN_TE1_RX_SLEVEL_30_DB)? + " (default)":""); }else{ switch(fe->fe_cfg.cfg.te_cfg.rx_slevel){ case WAN_TE1_RX_SLEVEL_12_DB: @@ -1204,20 +1207,18 @@ static int sdla_ds_te1_chip_config(void* pfe) break; case WAN_TE1_RX_SLEVEL_36_DB: case WAN_TE1_RX_SLEVEL_43_DB: + value |= (BIT_LRISMR_RSMS1 | BIT_LRISMR_RSMS0); + break; default: /* set default value */ - value |= (BIT_LRISMR_RSMS1 | BIT_LRISMR_RSMS0); + fe->fe_cfg.cfg.te_cfg.rx_slevel = WAN_TE1_RX_SLEVEL_12_DB; break; } - DEBUG_EVENT("%s: Rx Sensitivity Gain %s%s.\n", fe->name, WAN_TE1_RX_SLEVEL_DECODE(fe->fe_cfg.cfg.te_cfg.rx_slevel), - ((IS_T1_FEMEDIA(fe) && (fe->fe_cfg.cfg.te_cfg.rx_slevel==WAN_TE1_RX_SLEVEL_36_DB)) || - (IS_E1_FEMEDIA(fe) && (fe->fe_cfg.cfg.te_cfg.rx_slevel==WAN_TE1_RX_SLEVEL_43_DB))) ? - " (default)": ""); + (fe->fe_cfg.cfg.te_cfg.rx_slevel==WAN_TE1_RX_SLEVEL_12_DB)? + " (default)":""); } - - if (IS_T1_FEMEDIA(fe)){ value |= BIT_LRISMR_RIMPM0; }else{ @@ -1226,7 +1227,6 @@ static int sdla_ds_te1_chip_config(void* pfe) value |= BIT_LRISMR_RIMPM1 | BIT_LRISMR_RIMPM0; } } - WRITE_REG(REG_LRISMR, value); if (IS_E1_FEMEDIA(fe) && WAN_TE1_LBO(fe) == WAN_E1_120){ @@ -1234,7 +1234,7 @@ static int sdla_ds_te1_chip_config(void* pfe) ** Adjust DAC gain (-4.88%) */ WRITE_REG(REG_LTXLAE, 0x09); } - + /* Additional front-end settings */ value = READ_REG(REG_ERCNT); if (WAN_FE_LCODE(fe) == WAN_LCODE_AMI){ @@ -1279,6 +1279,74 @@ static int sdla_ds_te1_chip_config(void* pfe) return 0; } +#if 0 +/* + ****************************************************************************** + * sdla_ds_te1_chip_config_verify() + * + * Description: Configure Sangoma 8 ports T1/E1 board + * Arguments: + * Returns: WANTRUE - TE1 configred successfully, otherwise WAN_FALSE. + ****************************************************************************** + */ +static int sdla_ds_te1_chip_config_verify(sdla_fe_t *fe) +{ + int e1_mode = 0; + u_int8_t rmmr, tmmr, value = 0x00; + + WAN_ASSERT(fe->write_fe_reg == NULL); + WAN_ASSERT(fe->read_fe_reg == NULL); + + rmmr = READ_REG(REG_RMMR); + DEBUG_EVENT("%s: RX: %s mode\n", + fe->name, (rmmr & BIT_RMMR_T1E1) ? "E1" : "T1"); + e1_mode = (value & BIT_RMMR_T1E1) ? 1 : 0; + + tmmr = READ_REG(REG_TMMR); + DEBUG_EVENT("%s: TX: %s mode\n", + fe->name, (tmmr & BIT_TMMR_T1E1) ? "E1" : "T1"); + if ((rmmr & BIT_RMMR_T1E1) && (tmmr & BIT_RMMR_T1E1)){ + e1_mode = 1; + } else if ((rmmr & BIT_RMMR_T1E1) || (tmmr & BIT_RMMR_T1E1)){ + DEBUG_EVENT( + "%s: ERROR: RX/TX has different mode configuration (%02X:%02X)!\n", + fe->name, rmmr, tmmr); + return -EINVAL; + } + + if (e1_mode){ + value = READ_REG(REG_RCR1); + DEBUG_EVENT("%s: RX Ctrl Reg: %s %s %s\n", + fe->name, + (value & BIT_RCR1_E1_RCRC4) ? "CRC4" : "NCRC4", + (value & BIT_RCR1_E1_RHDB3) ? "HDB3": "AMI", + (value & BIT_RCR1_E1_RSIGM) ? "CCS" : "CAS"); + value = READ_REG(REG_TCR1); + DEBUG_EVENT("%s: TX Ctrl Reg: %s %s %s\n", + fe->name, + (value & BIT_TCR1_E1_TCRC4) ? "CRC4" : "NCRC4", + (value & BIT_TCR1_E1_THDB3) ? "HDB3": "AMI", + (value & BIT_TCR1_E1_T16S) ? "CAS" : "CCS"); + }else{ + value = READ_REG(REG_RCR1); + DEBUG_EVENT("%s: RX Ctrl Reg: %s %s\n", + fe->name, + (value & BIT_RCR1_T1_RFM) ? "D4" : "ESF", + (value & BIT_RCR1_T1_RB8ZS) ? "B8ZS": "AMI"); + value = READ_REG(REG_TCR1); + DEBUG_EVENT("%s: TX Ctrl Reg: %s\n", + fe->name, + (value & BIT_TCR1_T1_TB8ZS) ? "B8ZS": "AMI"); + value = READ_REG(REG_TCR3); + DEBUG_EVENT("%s: TX Ctrl Reg: %s\n", + fe->name, + (value & BIT_TCR3_TFM) ? "D4" : "ESF"); + } + + return 0; +} +#endif + /* ****************************************************************************** * sdla_ds_te1_config() @@ -1290,17 +1358,12 @@ static int sdla_ds_te1_chip_config(void* pfe) */ static int sdla_ds_te1_config(void* pfe) { - sdla_fe_t *fe = (sdla_fe_t*)pfe; + int err = 0; WAN_ASSERT(fe->write_fe_reg == NULL); WAN_ASSERT(fe->read_fe_reg == NULL); - /* Initial FE state */ - fe->fe_status = FE_UNITIALIZED; //FE_DISCONNECTED; - WAN_LIST_INIT(&fe->event); - wan_spin_lock_init(&fe->lock); - /* Revision/Chip ID (Reg. 0x0D) */ if (sdla_ds_te1_device_id(fe)) return -EINVAL; switch(fe->fe_chip_id){ @@ -1334,7 +1397,17 @@ static int sdla_ds_te1_config(void* pfe) break; } - if (sdla_ds_te1_cfg_verify(fe)) return -EINVAL; + if (IS_T1_FEMEDIA(fe) || IS_J1_FEMEDIA(fe)){ + err = sdla_ds_t1_cfg_verify(fe); + }else if (IS_E1_FEMEDIA(fe)){ + err = sdla_ds_e1_cfg_verify(fe); + }else{ + DEBUG_EVENT("%s: Error: Invalid FE Media type (%X)\n", + fe->name, + WAN_FE_MEDIA(fe)); + err =-EINVAL; + } + if (err) return -EINVAL; DEBUG_EVENT("%s: Configuring DS %s %s FE\n", fe->name, @@ -1346,7 +1419,7 @@ static int sdla_ds_te1_config(void* pfe) FE_LCODE_DECODE(fe), FE_FRAME_DECODE(fe), TE_LBO_DECODE(fe)); - DEBUG_EVENT("%s: Clk %s:%d, Ch %X\n", + DEBUG_EVENT("%s: Clk %s:%d, Channels: %X\n", fe->name, TE_CLK_DECODE(fe), WAN_TE1_REFCLK(fe), @@ -1360,8 +1433,12 @@ static int sdla_ds_te1_config(void* pfe) if (fe->fe_cfg.poll_mode == WANOPT_YES){ sdla_t *card = (sdla_t*)fe->card; DEBUG_EVENT("%s: FE Poll driven\n", - fe->name); - card->fe_no_intr = 1; + fe->name); + card->fe_no_intr = 1; /* disable global front interrupt */ + } + if (fe->fe_cfg.cfg.te_cfg.ignore_yel_alarm == WANOPT_YES){ + DEBUG_EVENT("%s: YEL alarm ignored\n", + fe->name); } if (sdla_ds_te1_chip_config(fe)){ return -EINVAL; @@ -1372,18 +1449,15 @@ static int sdla_ds_te1_config(void* pfe) sdla_ds_te1_flush_pmon(fe); - /* LIU alarms are available in A108 */ - fe->fe_stats.liu_alarms = WAN_TE_BIT_LIU_ALARM; + fe->fe_alarm = WAN_TE_BIT_LIU_ALARM; wan_set_bit(TE_CONFIGURED,(void*)&fe->te_param.critical); #if 0 -/* Do not enable it here */ +/* FIXME: Enable all interrupt only when link is connected (event global) */ /* Enable interrupts */ - sdla_ds_te1_intr_ctrl(fe, 0, WAN_TE_INTR_GLOBAL, WAN_FE_INTR_ENABLE, 0x00); - /* Enable manual update pmon counter */ - sdla_ds_te1_intr_ctrl(fe, 0, WAN_TE_INTR_PMON, WAN_FE_INTR_MASK, 0x00); -#endif + sdla_ds_te1_intr_ctrl(fe, 0, WAN_TE_INTR_GLOBAL, WAN_FE_INTR_ENABLE, 0x00); +#endif return 0; } @@ -1433,8 +1507,9 @@ static int sdla_ds_te1_post_init(void* pfe) static int sdla_ds_te1_pre_release(void* pfe) { sdla_fe_t *fe = (sdla_fe_t*)pfe; - sdla_fe_timer_event_t *fe_event; + sdla_fe_timer_event_t *fe_event = NULL; wan_smp_flag_t smp_flags; + int empty = 0; /* Kill TE timer poll command */ wan_set_bit(TE_TIMER_KILL,(void*)&fe->te_param.critical); @@ -1442,14 +1517,19 @@ static int sdla_ds_te1_pre_release(void* pfe) wan_del_timer(&fe->timer); } wan_clear_bit(TE_TIMER_RUNNING,(void*)&fe->te_param.critical); - wan_spin_lock_irq(&fe->lock,&smp_flags); - while(!WAN_LIST_EMPTY(&fe->event)){ - fe_event = WAN_LIST_FIRST(&fe->event); - WAN_LIST_REMOVE(fe_event, next); + do{ + wan_spin_lock_irq(&fe->lockirq,&smp_flags); + if (!WAN_LIST_EMPTY(&fe->event)){ + fe_event = WAN_LIST_FIRST(&fe->event); + WAN_LIST_REMOVE(fe_event, next); + }else{ + empty = 1; + } + wan_spin_unlock_irq(&fe->lockirq,&smp_flags); + /* Free should be called not from spin_lock_irq (windows) !!!! */ if (fe_event) wan_free(fe_event); - } - fe->event_map = 0; - wan_spin_unlock_irq(&fe->lock,&smp_flags); + fe_event = NULL; + }while(!empty); return 0; } @@ -1468,8 +1548,8 @@ static int sdla_ds_te1_unconfig(void* pfe) /* Verify if FE timer is stopped */ if (!wan_test_bit(TE_TIMER_KILL,(void*)&fe->te_param.critical)){ - DEBUG_EVENT("%s: Front-End timer is not stopped!\n", - fe->name); + DEBUG_EVENT("%s: %s(): Front-End timer is not stopped!\n", + fe->name, __FUNCTION__); return -EINVAL; } @@ -1479,7 +1559,7 @@ static int sdla_ds_te1_unconfig(void* pfe) /* FIXME: Alex to disable interrupts here */ sdla_ds_te1_disable_irq(fe); - + /* Set Rx Framer soft reset */ WRITE_REG(REG_RMMR, BIT_RMMR_SFTRST); /* Set Tx Framer soft reset */ @@ -1511,10 +1591,10 @@ static int sdla_ds_te1_disable_irq(void* pfe) sdla_fe_t *fe = (sdla_fe_t*)pfe; if (fe->fe_cfg.poll_mode == WANOPT_NO){ - /* Disable interrupts here */ + /* Disable all interrupts */ sdla_ds_te1_intr_ctrl( fe, 0, - (WAN_TE_INTR_GLOBAL|WAN_TE_INTR_BASIC|WAN_TE_INTR_PMON), + (WAN_TE_INTR_GLOBAL|WAN_TE_INTR_BASIC|WAN_TE_INTR_PMON), WAN_FE_INTR_MASK, 0x00); } return 0; @@ -1568,14 +1648,19 @@ sdla_ds_te1_sigctrl(sdla_fe_t *fe, int sig_mode, unsigned long ch_map, int mode) ** Returns: 1 - the port is connected ** 0 - the port is disconnected ******************************************************************************/ -static int sdla_ds_t1_is_alarm(sdla_fe_t *fe, unsigned long alarms) +static u_int32_t sdla_ds_t1_is_alarm(sdla_fe_t *fe, u_int32_t alarms) { - /* NC: Bring the link down if we re in SC mode */ - if (fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_SC){ - return 1; + u_int32_t alarm_mask = WAN_TE1_FRAMED_ALARMS; + + /* Alex Feb 27, 2008 + ** Special case for customer that uses + ** YEL alarm for protocol control */ + if (fe->fe_cfg.cfg.te_cfg.ignore_yel_alarm == WANOPT_NO){ + alarm_mask |= WAN_TE_BIT_RAI_ALARM; } - return (alarms & WAN_TE1_FRAMED_ALARMS); + return (alarms & alarm_mask); } + /****************************************************************************** ** sdla_ds_e1_is_alarm() ** @@ -1584,89 +1669,78 @@ static int sdla_ds_t1_is_alarm(sdla_fe_t *fe, unsigned long alarms) ** Returns: 1 - the port is connected ** 0 - the port is disconnected ******************************************************************************/ -static int sdla_ds_e1_is_alarm(sdla_fe_t *fe, unsigned long alarms) +static u_int32_t sdla_ds_e1_is_alarm(sdla_fe_t *fe, u_int32_t alarms) { - if (WAN_FE_FRAME(fe) == WAN_FR_UNFRAMED){ - if (!fe->te_param.lb_mode && - (fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_OC || - fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_SC || - fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_LOS)){ - return 1; - } - return (alarms & WAN_TE1_UNFRAMED_ALARMS); - } + u_int32_t alarm_mask = 0x00; - /* NC: Bring the link down if we re in SC mode */ - if (fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_SC){ - return 1; + if (WAN_FE_FRAME(fe) == WAN_FR_UNFRAMED){ + alarm_mask = WAN_TE1_UNFRAMED_ALARMS; + if (!fe->te_param.lb_mode){ + alarm_mask |= ( WAN_TE_BIT_LIU_ALARM_OC | + WAN_TE_BIT_LIU_ALARM_SC | + WAN_TE_BIT_LIU_ALARM_LOS); + } + }else{ + alarm_mask = WAN_TE1_FRAMED_ALARMS; } - return (alarms & WAN_TE1_FRAMED_ALARMS); + return (alarms & alarm_mask); } -/* - ****************************************************************************** - * sdla_ds_te1_set_status() - * - * Description: Set T1/E1 status. Enable OOF and LCV interrupt (if status - * changed to disconnected. - * Arguments: - * Returns: - ****************************************************************************** - */ -static void sdla_ds_te1_set_status(sdla_fe_t* fe, unsigned long alarms) +/****************************************************************************** +** sdla_ds_te1_set_status() +** +** Description: Set T1/E1 status. Enable OOF and LCV interrupt (if status +** changed to disconnected. +** Arguments: +** Returns: +******************************************************************************/ +static void sdla_ds_te1_set_status(sdla_fe_t* fe, u_int32_t alarms) { sdla_t *card = (sdla_t*)fe->card; unsigned char curr_fe_status = fe->fe_status; + u_int32_t valid_rx_alarms = 0x00; if (IS_T1_FEMEDIA(fe)){ + valid_rx_alarms = sdla_ds_t1_is_alarm(fe, alarms); + }else if (IS_E1_FEMEDIA(fe)){ + valid_rx_alarms = sdla_ds_e1_is_alarm(fe, alarms); + } - if (sdla_ds_t1_is_alarm(fe, alarms)){ - if (fe->fe_status != FE_DISCONNECTED){ - fe->fe_status = FE_DISCONNECTED; + if (valid_rx_alarms){ + if (fe->fe_status != FE_DISCONNECTED){ + if (!(valid_rx_alarms & WAN_TE_BIT_RAI_ALARM)){ + sdla_ds_te1_set_alarms(fe, WAN_TE_BIT_YEL_ALARM); } - }else{ - -#ifdef WANPIPE_IGNORE_T1_YELLOW -#warning "AFT IGNORING YELLOW ALARM!" -/* If we ignore yellow alarm, we will pass it up - to zaptel. We will be in connected state where - zaptel will be in alarm. Its a deadlock - condition - - This option can be compiled using Setup - script in case of some users that - have yellow alarm issues. - - Should never be used in ZAPTEL mode! -*/ - if (fe->fe_status != FE_CONNECTED){ + fe->fe_status = FE_DISCONNECTED; + }else if (fe->te_param.tx_yel_alarm && valid_rx_alarms & WAN_TE_BIT_RAI_ALARM){ + /* Special case for loopback */ + sdla_ds_te1_clear_alarms(fe, WAN_TE_BIT_YEL_ALARM); + } + }else{ + if (fe->fe_status != FE_CONNECTED){ + if (fe->te_param.tx_yel_alarm){ sdla_ds_te1_clear_alarms(fe, WAN_TE_BIT_YEL_ALARM); - fe->fe_status = FE_CONNECTED; } -#else - //sdla_ds_te1_clear_alarms(fe, WAN_TE_BIT_YEL_ALARM); - if (!(fe->fe_alarm & WAN_TE_BIT_YEL_ALARM)){ - if (fe->fe_status != FE_CONNECTED){ - fe->fe_status = FE_CONNECTED; - } - }else{ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: T1 Waiting for Yellow Alarm to clear...\n", - fe->name); - } - fe->fe_status = FE_DISCONNECTED; - } -#endif + fe->fe_status = FE_CONNECTED; } - } else { - if (sdla_ds_e1_is_alarm(fe, alarms)){ - if (fe->fe_status != FE_DISCONNECTED){ - fe->fe_status = FE_DISCONNECTED; + } + + if ((IS_T1_FEMEDIA(fe) && sdla_ds_t1_is_alarm(fe, alarms)) || + (IS_E1_FEMEDIA(fe) && sdla_ds_e1_is_alarm(fe, alarms))){ + if (fe->fe_status != FE_DISCONNECTED){ + if (!(alarms & WAN_TE_BIT_RAI_ALARM)){ + /* Send YEL alarm only if our state is not + ** connected*/ + sdla_ds_te1_set_alarms(fe, WAN_TE_BIT_YEL_ALARM); } - }else{ - if (fe->fe_status != FE_CONNECTED){ - fe->fe_status = FE_CONNECTED; + fe->fe_status = FE_DISCONNECTED; + } + }else{ + if (fe->fe_status != FE_CONNECTED){ + if (fe->te_param.tx_yel_alarm){ + sdla_ds_te1_clear_alarms(fe, WAN_TE_BIT_YEL_ALARM); } + fe->fe_status = FE_CONNECTED; } } @@ -1714,14 +1788,6 @@ static void sdla_ds_te1_set_status(sdla_fe_t* fe, unsigned long alarms) fe->te_param.status_cnt); } -#if defined(WAN_FE_SC_DISABLE_INTR) - if (fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_SC){ - if (card->wandev.critical_event){ - card->wandev.critical_event(card, 0); - } - } -#endif - return; } @@ -1751,30 +1817,30 @@ static int sdla_ds_te1_print_alarms(sdla_fe_t* fe, unsigned int alarms) FE_MEDIA_DECODE(fe), alarms); if (alarms & WAN_TE_BIT_RAI_ALARM){ - DEBUG_EVENT("%s: RAI is ON\n", fe->name); + DEBUG_EVENT("%s: RAI : ON\n", fe->name); } if (alarms & WAN_TE_BIT_LOS_ALARM){ - DEBUG_EVENT("%s: LOS is ON\n", fe->name); + DEBUG_EVENT("%s: LOS : ON\n", fe->name); } if (alarms & WAN_TE_BIT_OOF_ALARM){ - DEBUG_EVENT("%s: OOF is ON\n", fe->name); + DEBUG_EVENT("%s: OOF : ON\n", fe->name); } if (alarms & WAN_TE_BIT_RED_ALARM){ - DEBUG_EVENT("%s: RED is ON\n", fe->name); + DEBUG_EVENT("%s: RED : ON\n", fe->name); } DEBUG_EVENT("%s: %s LIU Alarms status (%X):\n", fe->name, FE_MEDIA_DECODE(fe), - fe->liu_alarm); - if (fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_OC){ + alarms); + if (alarms & WAN_TE_BIT_LIU_ALARM_OC){ DEBUG_EVENT("%s: Open Circuit is detected!\n", fe->name); } - if (fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_SC){ - DEBUG_EVENT("%s: Short Circuit is detected!\n", - fe->name); + if (alarms & WAN_TE_BIT_LIU_ALARM_SC){ + DEBUG_EVENT("%s: Short Circuit is detected!(%i)\n", + fe->name, __LINE__); } - if (fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_LOS){ + if (alarms & WAN_TE_BIT_LIU_ALARM_LOS){ DEBUG_EVENT("%s: Lost of Signal is detected!\n", fe->name); } @@ -1790,96 +1856,98 @@ static int sdla_ds_te1_print_alarms(sdla_fe_t* fe, unsigned int alarms) ** Arguments: ** Returns: */ -static unsigned int sdla_ds_te1_read_frame_alarms(sdla_fe_t *fe) +static u_int32_t sdla_ds_te1_read_frame_alarms(sdla_fe_t *fe) { - unsigned int fr_alarm = fe->fe_alarm; + u_int32_t alarm = fe->fe_alarm; unsigned char rrts1 = READ_REG(REG_RRTS1); + alarm &= WAN_TE_BIT_FRAMER_ALARM_MASK; DEBUG_TE1("%s: Framer Alarm status = %02X (%X)\n", - fe->name, rrts1, fr_alarm); + fe->name, rrts1, alarm); /* Framer alarms */ //if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ if (rrts1 & BIT_RRTS1_RRAI){ - if (!(fr_alarm & WAN_TE_BIT_RAI_ALARM)){ - DEBUG_EVENT("%s: RAI alarm is ON\n", + if (!(alarm & WAN_TE_BIT_RAI_ALARM)){ + DEBUG_EVENT("%s: RAI : ON\n", fe->name); } - fr_alarm |= WAN_TE_BIT_RAI_ALARM; + alarm |= WAN_TE_BIT_RAI_ALARM; }else{ - if (fr_alarm & WAN_TE_BIT_RAI_ALARM){ - DEBUG_EVENT("%s: RAI alarm is OFF\n", + if (alarm & WAN_TE_BIT_RAI_ALARM){ + DEBUG_EVENT("%s: RAI : OFF\n", fe->name); } - fr_alarm &= ~WAN_TE_BIT_RAI_ALARM; + alarm &= ~WAN_TE_BIT_RAI_ALARM; } //} if (rrts1 & BIT_RRTS1_RAIS){ - if (!(fr_alarm & WAN_TE_BIT_AIS_ALARM)){ - DEBUG_EVENT("%s: AIS alarm is ON\n", + if (!(alarm & WAN_TE_BIT_AIS_ALARM)){ + DEBUG_EVENT("%s: AIS : ON\n", fe->name); } - fr_alarm |= WAN_TE_BIT_AIS_ALARM; + alarm |= WAN_TE_BIT_AIS_ALARM; }else{ - if (fr_alarm & WAN_TE_BIT_AIS_ALARM){ - DEBUG_EVENT("%s: AIS alarm is OFF\n", + if (alarm & WAN_TE_BIT_AIS_ALARM){ + DEBUG_EVENT("%s: AIS : OFF\n", fe->name); } - fr_alarm &= ~WAN_TE_BIT_AIS_ALARM; + alarm &= ~WAN_TE_BIT_AIS_ALARM; } if (rrts1 & BIT_RRTS1_RLOS){ - if (!(fr_alarm & WAN_TE_BIT_LOS_ALARM)){ - DEBUG_EVENT("%s: LOS alarm is ON\n", + if (!(alarm & WAN_TE_BIT_LOS_ALARM)){ + DEBUG_EVENT("%s: LOS : ON\n", fe->name); } - fr_alarm |= WAN_TE_BIT_LOS_ALARM; + alarm |= WAN_TE_BIT_LOS_ALARM; }else{ - if (fr_alarm & WAN_TE_BIT_LOS_ALARM){ - DEBUG_EVENT("%s: LOS alarm is OFF\n", + if (alarm & WAN_TE_BIT_LOS_ALARM){ + DEBUG_EVENT("%s: LOS : OFF\n", fe->name); } - fr_alarm &= ~WAN_TE_BIT_LOS_ALARM; + alarm &= ~WAN_TE_BIT_LOS_ALARM; } if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ if (rrts1 & BIT_RRTS1_RLOF){ - if (!(fr_alarm & WAN_TE_BIT_OOF_ALARM)){ - DEBUG_EVENT("%s: OOF alarm is ON\n", + if (!(alarm & WAN_TE_BIT_OOF_ALARM)){ + DEBUG_EVENT("%s: OOF : ON\n", fe->name); } - fr_alarm |= WAN_TE_BIT_OOF_ALARM; + alarm |= WAN_TE_BIT_OOF_ALARM; }else{ - if (fr_alarm & WAN_TE_BIT_OOF_ALARM){ - DEBUG_EVENT("%s: OOF alarm is OFF\n", + if (alarm & WAN_TE_BIT_OOF_ALARM){ + DEBUG_EVENT("%s: OOF : OFF\n", fe->name); } - fr_alarm &= ~WAN_TE_BIT_OOF_ALARM; + alarm &= ~WAN_TE_BIT_OOF_ALARM; } } /* Aug 30, 2006 ** Red alarm is either LOS or OOF alarms */ - if (IS_TE_OOF_ALARM(fr_alarm) || - IS_TE_LOS_ALARM(fr_alarm)){ - if (!(fr_alarm & WAN_TE_BIT_RED_ALARM)){ - DEBUG_EVENT("%s: RED alarm is ON\n", + if (IS_TE_OOF_ALARM(alarm) || + IS_TE_LOS_ALARM(alarm)){ + if (!(alarm & WAN_TE_BIT_RED_ALARM)){ + DEBUG_EVENT("%s: RED : ON\n", fe->name); } - fr_alarm |= WAN_TE_BIT_RED_ALARM; + alarm |= WAN_TE_BIT_RED_ALARM; }else{ - if (fr_alarm & WAN_TE_BIT_RED_ALARM){ - DEBUG_EVENT("%s: RED alarm is OFF\n", + if (alarm & WAN_TE_BIT_RED_ALARM){ + DEBUG_EVENT("%s: RED : OFF\n", fe->name); } - fr_alarm &= ~WAN_TE_BIT_RED_ALARM; + alarm &= ~WAN_TE_BIT_RED_ALARM; } - return fr_alarm; + return alarm; } static unsigned int sdla_ds_te1_read_liu_alarms(sdla_fe_t *fe) { - unsigned int alarm = fe->liu_alarm; + unsigned int alarm = fe->fe_alarm; unsigned char lrsr = READ_REG(REG_LRSR); + alarm &= WAN_TE_BIT_LIU_ALARM_MASK; DEBUG_TE1("%s: LIU Alarm status = %02X (%X)\n", - fe->name, lrsr1, alarm); + fe->name, lrsr, alarm); /* LIU alarms */ if (lrsr & BIT_LRSR_OCS){ @@ -1897,14 +1965,14 @@ static unsigned int sdla_ds_te1_read_liu_alarms(sdla_fe_t *fe) } if (lrsr & BIT_LRSR_SCS){ if (!(alarm & WAN_TE_BIT_LIU_ALARM_SC)){ - DEBUG_EVENT("%s: Short Circuit is detected!\n", - fe->name); + DEBUG_EVENT("%s: Short Circuit is detected!(%i)\n", + fe->name, __LINE__); } alarm |= WAN_TE_BIT_LIU_ALARM_SC; }else{ if (alarm & WAN_TE_BIT_LIU_ALARM_SC){ - DEBUG_EVENT("%s: Short Circuit is cleared!\n", - fe->name); + DEBUG_EVENT("%s: Short Circuit is cleared!(%i)\n", + fe->name, __LINE__); } alarm &= ~WAN_TE_BIT_LIU_ALARM_SC; } @@ -1925,35 +1993,35 @@ static unsigned int sdla_ds_te1_read_liu_alarms(sdla_fe_t *fe) return alarm; } -static unsigned int sdla_ds_te1_read_alarms(sdla_fe_t *fe, int action) +static u_int32_t sdla_ds_te1_read_alarms(sdla_fe_t *fe, int action) { - unsigned int fr_alarm = fe->fe_alarm; - unsigned int alarm = fe->liu_alarm; + u_int32_t alarm = fe->fe_alarm; if (IS_FE_ALARM_READ(action)){ - fr_alarm = sdla_ds_te1_read_frame_alarms(fe); - alarm = sdla_ds_te1_read_liu_alarms(fe); + alarm = sdla_ds_te1_read_frame_alarms(fe); + alarm |= sdla_ds_te1_read_liu_alarms(fe); } if (IS_FE_ALARM_PRINT(action)){ - sdla_ds_te1_print_alarms(fe, fr_alarm); + sdla_ds_te1_print_alarms(fe, alarm); } if (IS_FE_ALARM_UPDATE(action)){ - fe->fe_alarm = fr_alarm; - fe->liu_alarm = alarm; + fe->fe_alarm = alarm; } return fe->fe_alarm; } -#define WAN_TE_CRIT_ALARM_TIMEOUT 30000 /* 30 sec */ + +#define WAN_TE_CRIT_ALARM_TIMEOUT 30 /* 30 sec */ static int sdla_ds_te1_read_crit_alarms(sdla_fe_t *fe) { + u_int32_t liu_alarms = 0x00; - fe->liu_alarm = sdla_ds_te1_read_liu_alarms(fe); - if (fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_SC){ + liu_alarms = sdla_ds_te1_read_liu_alarms(fe); + if (liu_alarms & WAN_TE_BIT_LIU_ALARM_SC){ fe->te_param.crit_alarm_start = SYSTEM_TICKS; }else{ - if((SYSTEM_TICKS - fe->te_param.crit_alarm_start) > ((WAN_TE_CRIT_ALARM_TIMEOUT * HZ)/1000)) { + if (WAN_STIMEOUT(fe->te_param.crit_alarm_start, WAN_TE_CRIT_ALARM_TIMEOUT)){ /* The link was stable for 30 sec, let try to go back */ return 0; } @@ -1962,36 +2030,54 @@ static int sdla_ds_te1_read_crit_alarms(sdla_fe_t *fe) return 1; } -/* -******************************************************************************* +/****************************************************************************** ** sdla_ds_te1_set_alarms() ** -** Description: +** Description: ** Arguments: ** Returns: */ -static int sdla_ds_te1_set_alarms(sdla_fe_t* fe, unsigned long alarms) +static int sdla_ds_te1_set_alarms(sdla_fe_t* fe, u_int32_t alarms) { + u8 value; + if (alarms & WAN_TE_BIT_YEL_ALARM){ - DEBUG_TEST("%s: Setting YELLOW alarm (not supported)!\n", - fe->name); + if (IS_T1_FEMEDIA(fe) && + fe->fe_cfg.cfg.te_cfg.ignore_yel_alarm == WANOPT_NO){ + value = READ_REG(REG_TCR1); + if (!(value & BIT_TCR1_T1_TRAI)){ + DEBUG_TE1("%s: Set YEL alarm!\n", + fe->name); + WRITE_REG(REG_TCR1, value | BIT_TCR1_T1_TRAI); + fe->te_param.tx_yel_alarm = 1; + } + } } return 0; } -/* -******************************************************************************* +/****************************************************************************** ** sdla_ds_te1_clear_alarms() ** -** Description: +** Description: ** Arguments: ** Returns: */ -static int sdla_ds_te1_clear_alarms(sdla_fe_t* fe, unsigned long alarms) +static int sdla_ds_te1_clear_alarms(sdla_fe_t* fe, u_int32_t alarms) { + u8 value; + if (alarms & WAN_TE_BIT_YEL_ALARM){ - DEBUG_TEST("%s: Clearing YELLOW alarm (not supported)!\n", - fe->name); + if (IS_T1_FEMEDIA(fe) && + fe->fe_cfg.cfg.te_cfg.ignore_yel_alarm == WANOPT_NO){ + value = READ_REG(REG_TCR1); + if (value & BIT_TCR1_T1_TRAI){ + DEBUG_TE1("%s: Clear YEL alarm!\n", + fe->name); + WRITE_REG(REG_TCR1, value & ~BIT_TCR1_T1_TRAI); + fe->te_param.tx_yel_alarm = 0; + } + } } return 0; } @@ -2460,10 +2546,8 @@ sdla_ds_te1_intr_ctrl(sdla_fe_t *fe, int dummy, u_int8_t type, u_int8_t mode, un if (type & WAN_TE_INTR_GLOBAL){ mask = READ_REG(REG_GFIMR); if (mode == WAN_FE_INTR_ENABLE){ - //mask |= (1<name, rls1); //if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ if (rls1 & (BIT_RLS1_RRAIC|BIT_RLS1_RRAID)){ if (rrts1 & BIT_RRTS1_RRAI){ fe->fe_alarm |= WAN_TE_BIT_RAI_ALARM; - DEBUG_EVENT("%s: RAI alarm is ON\n", + if (!silent) DEBUG_EVENT("%s: RAI alarm is ON\n", fe->name); }else{ fe->fe_alarm &= ~WAN_TE_BIT_RAI_ALARM; - DEBUG_EVENT("%s: RAI alarm is OFF\n", + if (!silent) DEBUG_EVENT("%s: RAI alarm is OFF\n", fe->name); } } @@ -2597,22 +2676,22 @@ static int sdla_ds_te1_framer_rx_intr(sdla_fe_t *fe) if (rls1 & (BIT_RLS1_RAISC|BIT_RLS1_RAISD)){ if (rrts1 & BIT_RRTS1_RAIS){ fe->fe_alarm |= WAN_TE_BIT_AIS_ALARM; - DEBUG_EVENT("%s: AIS alarm is ON\n", + if (!silent) DEBUG_EVENT("%s: AIS alarm is ON\n", fe->name); }else{ fe->fe_alarm &= ~WAN_TE_BIT_AIS_ALARM; - DEBUG_EVENT("%s: AIS alarm is OFF\n", + if (!silent) DEBUG_EVENT("%s: AIS alarm is OFF\n", fe->name); } } if (rls1 & (BIT_RLS1_RLOSC|BIT_RLS1_RLOSD)){ if (rrts1 & BIT_RRTS1_RLOS){ fe->fe_alarm |= WAN_TE_BIT_LOS_ALARM; - DEBUG_EVENT("%s: LOS alarm is ON\n", + if (!silent) DEBUG_EVENT("%s: LOS alarm is ON\n", fe->name); }else{ fe->fe_alarm &= ~WAN_TE_BIT_LOS_ALARM; - DEBUG_EVENT("%s: LOS alarm is OFF\n", + if (!silent) DEBUG_EVENT("%s: LOS alarm is OFF\n", fe->name); } } @@ -2620,11 +2699,11 @@ static int sdla_ds_te1_framer_rx_intr(sdla_fe_t *fe) if (rls1 & (BIT_RLS1_RLOFC|BIT_RLS1_RLOFD)){ if (rrts1 & BIT_RRTS1_RLOF){ fe->fe_alarm |= WAN_TE_BIT_OOF_ALARM; - DEBUG_EVENT("%s: OOF alarm is ON\n", + if (!silent) DEBUG_EVENT("%s: OOF alarm is ON\n", fe->name); }else{ fe->fe_alarm &= ~WAN_TE_BIT_OOF_ALARM; - DEBUG_EVENT("%s: OOF alarm is OFF\n", + if (!silent) DEBUG_EVENT("%s: OOF alarm is OFF\n", fe->name); } } @@ -2633,38 +2712,42 @@ static int sdla_ds_te1_framer_rx_intr(sdla_fe_t *fe) if (IS_T1_FEMEDIA(fe)){ if (IS_TE_OOF_ALARM(fe->fe_alarm) && IS_TE_LOS_ALARM(fe->fe_alarm)){ - DEBUG_EVENT("%s: RED alarm is ON\n", + if (!(fe->fe_alarm & WAN_TE_BIT_RED_ALARM)){ + if (!silent) DEBUG_EVENT("%s: RED alarm is ON\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_RED_ALARM; + fe->fe_alarm |= WAN_TE_BIT_RED_ALARM; + } }else{ - DEBUG_EVENT("%s: RED alarm is OFF\n", - fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_RED_ALARM; + if (fe->fe_alarm & WAN_TE_BIT_RED_ALARM){ + if (!silent) DEBUG_EVENT("%s: RED alarm is OFF\n", + fe->name); + fe->fe_alarm &= ~WAN_TE_BIT_RED_ALARM; + } } } } if (istatus & BIT_RIIR_RLS2){ unsigned char rls2 = READ_REG(REG_RLS2); if (IS_E1_FEMEDIA(fe)){ - DEBUG_TE1("%s: E1 RX Latched Status Register 2 %02X\n", + if (!silent) DEBUG_TE1("%s: E1 RX Latched Status Register 2 %02X\n", fe->name, rls2); if (rls2 & BIT_RLS2_E1_RSA1){ - DEBUG_EVENT( + if (!silent) DEBUG_EVENT( "%s: Receive Signalling All Ones Event!\n", fe->name); } if (rls2 & BIT_RLS2_E1_RSA0){ - DEBUG_EVENT( + if (!silent) DEBUG_EVENT( "%s: Receive Signalling All Ones Event!\n", fe->name); } if (rls2 & BIT_RLS2_E1_RCMF){ - DEBUG_EVENT( + if (!silent) DEBUG_EVENT( "%s: Receive CRC4 Multiframe Event!\n", fe->name); } if (rls2 & BIT_RLS2_E1_RAF){ - DEBUG_EVENT( + if (!silent) DEBUG_EVENT( "%s: Receive Align Frame Event!\n", fe->name); } @@ -2673,27 +2756,27 @@ static int sdla_ds_te1_framer_rx_intr(sdla_fe_t *fe) } if (istatus & BIT_RIIR_RLS3){ unsigned char rls3 = READ_REG(REG_RLS3); - DEBUG_TE1("%s: RX Latched Status Register 3 %02X\n", + if (!silent) DEBUG_TE1("%s: RX Latched Status Register 3 %02X\n", fe->name, rls3); if (IS_T1_FEMEDIA(fe)){ if (rls3 & BIT_RLS3_T1_LORCC){ - DEBUG_EVENT( + if (!silent) DEBUG_EVENT( "%s: Loss of Receive Clock Condition Clear!\n", fe->name); } if (rls3 & BIT_RLS3_T1_LORCD){ - DEBUG_EVENT( + if (!silent) DEBUG_EVENT( "%s: Loss of Receive Clock Condition Detect!\n", fe->name); } }else{ if (rls3 & BIT_RLS3_E1_LORCC){ - DEBUG_EVENT( + if (!silent) DEBUG_EVENT( "%s: Loss of Receive Clock Condition Clear!\n", fe->name); } if (rls3 & BIT_RLS3_E1_LORCD){ - DEBUG_EVENT( + if (!silent) DEBUG_EVENT( "%s: Loss of Receive Clock Condition Detect!\n", fe->name); } @@ -2702,10 +2785,10 @@ static int sdla_ds_te1_framer_rx_intr(sdla_fe_t *fe) } if (istatus & BIT_RIIR_RLS4){ unsigned char rls4 = READ_REG(REG_RLS4); - DEBUG_TE1("%s: RX Latched Status Register 4 %02X\n", + if (!silent) DEBUG_TE1("%s: RX Latched Status Register 4 %02X\n", fe->name, rls4); if (rls4 & BIT_RLS4_RSCOS){ - DEBUG_EVENT( + if (!silent) DEBUG_EVENT( "%s: Receive Signalling status changed!\n", fe->name); sdla_ds_te1_check_rbsbits(fe, 1, ENABLE_ALL_CHANNELS, 1); @@ -2716,7 +2799,7 @@ static int sdla_ds_te1_framer_rx_intr(sdla_fe_t *fe) } } if (rls4 & BIT_RLS4_TIMER){ - DEBUG_ISR( + if (!silent) DEBUG_ISR( "%s: Performance monitor counters have been updated!\n", fe->name); sdla_ds_te1_pmon(fe, WAN_FE_PMON_READ); @@ -2725,30 +2808,30 @@ static int sdla_ds_te1_framer_rx_intr(sdla_fe_t *fe) } if (istatus & BIT_RIIR_RLS5){ unsigned char rls5 = READ_REG(REG_RLS5); - DEBUG_TE1("%s: RX Latched Status Register 5 %02X\n", + if (!silent) DEBUG_TE1("%s: RX Latched Status Register 5 %02X\n", fe->name, rls5); if (rls5 & BIT_RLS5_ROVR){ - DEBUG_EVENT("%s: Receive FIFO overrun (HDLC)!\n", + if (!silent) DEBUG_EVENT("%s: Receive FIFO overrun (HDLC)!\n", fe->name); } if (rls5 & BIT_RLS5_RHOBT){ - DEBUG_EVENT("%s: Receive HDLC Opening Byte Event (HDLC)!\n", + if (!silent) DEBUG_EVENT("%s: Receive HDLC Opening Byte Event (HDLC)!\n", fe->name); } if (rls5 & BIT_RLS5_RPE){ - DEBUG_EVENT("%s: Receive Packet End Event (HDLC)!\n", + if (!silent) DEBUG_EVENT("%s: Receive Packet End Event (HDLC)!\n", fe->name); } if (rls5 & BIT_RLS5_RPS){ - DEBUG_EVENT("%s: Receive Packet Start Event (HDLC)!\n", + if (!silent) DEBUG_EVENT("%s: Receive Packet Start Event (HDLC)!\n", fe->name); } if (rls5 & BIT_RLS5_RHWMS){ - DEBUG_EVENT("%s: Receive FIFO Above High Watermark Set Event (HDLC)!\n", + if (!silent) DEBUG_EVENT("%s: Receive FIFO Above High Watermark Set Event (HDLC)!\n", fe->name); } if (rls5 & BIT_RLS5_RNES){ - DEBUG_EVENT("%s: Receive FIFO Not Empty Set Event (HDLC)!\n", + if (!silent) DEBUG_EVENT("%s: Receive FIFO Not Empty Set Event (HDLC)!\n", fe->name); } WRITE_REG(REG_RLS5, rls5); @@ -2759,30 +2842,30 @@ static int sdla_ds_te1_framer_rx_intr(sdla_fe_t *fe) #endif if (istatus & BIT_RIIR_RLS7){ unsigned char rls7 = READ_REG(REG_RLS7); - DEBUG_TE1("%s: RX Latched Status Register 7 %02X\n", + if (!silent) DEBUG_TE1("%s: RX Latched Status Register 7 %02X\n", fe->name, rls7); if (rls7 & BIT_RLS7_RRAI_CI){ - DEBUG_EVENT("%s: Receive RAI-CI Detect!\n", + if (!silent) DEBUG_EVENT("%s: Receive RAI-CI Detect!\n", fe->name); } if (rls7 & BIT_RLS7_RAIS_CI){ - DEBUG_EVENT("%s: Receive RAI-CI Detect!\n", + if (!silent) DEBUG_EVENT("%s: Receive RAI-CI Detect!\n", fe->name); } if (rls7 & BIT_RLS7_RSLC96){ - DEBUG_EVENT("%s: Receive SLC-96 Alignment Event!\n", + if (!silent) DEBUG_EVENT("%s: Receive SLC-96 Alignment Event!\n", fe->name); } if (rls7 & BIT_RLS7_RFDLF){ - DEBUG_EVENT("%s: Receive FDL Register Full Event!\n", + if (!silent) DEBUG_EVENT("%s: Receive FDL Register Full Event!\n", fe->name); } if (rls7 & BIT_RLS7_BC){ - DEBUG_EVENT("%s: BOC Clear Event!\n", + if (!silent) DEBUG_EVENT("%s: BOC Clear Event!\n", fe->name); } if (rls7 & BIT_RLS7_BD){ - DEBUG_EVENT("%s: BOC Detect Event!\n", + if (!silent) DEBUG_EVENT("%s: BOC Detect Event!\n", fe->name); } WRITE_REG(REG_RLS7, rls7); @@ -2791,7 +2874,7 @@ static int sdla_ds_te1_framer_rx_intr(sdla_fe_t *fe) return 0; } -static int sdla_ds_te1_framer_tx_intr(sdla_fe_t *fe) +static int sdla_ds_te1_framer_tx_intr(sdla_fe_t *fe, int silent) { unsigned char istatus; unsigned char status; @@ -2800,12 +2883,12 @@ static int sdla_ds_te1_framer_tx_intr(sdla_fe_t *fe) if (istatus & BIT_TIIR_TLS1){ status = READ_REG(REG_TLS1); if (status & BIT_TLS1_TPDV){ - DEBUG_EVENT( + if (!silent) DEBUG_EVENT( "%s: Transmit Pulse Density Violation Event!\n", fe->name); } if (status & BIT_TLS1_LOTCC){ - DEBUG_EVENT( + if (!silent) DEBUG_EVENT( "%s: Loss of Transmit Clock condition Clear!\n", fe->name); } @@ -2822,36 +2905,36 @@ static int sdla_ds_te1_framer_tx_intr(sdla_fe_t *fe) return 0; } -static int sdla_ds_te1_bert_intr(sdla_fe_t *fe) +static int sdla_ds_te1_bert_intr(sdla_fe_t *fe, int silent) { unsigned char blsr = READ_REG(REG_BLSR); if (blsr & BIT_BLSR_BBED){ - DEBUG_EVENT("%s: BERT bit error detected!\n", + if (!silent) DEBUG_EVENT("%s: BERT bit error detected!\n", fe->name); } if (blsr & BIT_BLSR_BBCO){ - DEBUG_EVENT("%s: BERT Bit Counter overflows!\n", + if (!silent) DEBUG_EVENT("%s: BERT Bit Counter overflows!\n", fe->name); } if (blsr & BIT_BLSR_BECO){ - DEBUG_EVENT("%s: BERT Error Counter overflows!\n", + if (!silent) DEBUG_EVENT("%s: BERT Error Counter overflows!\n", fe->name); } if (blsr & BIT_BLSR_BRA1){ - DEBUG_EVENT("%s: BERT Receive All-Ones Condition!\n", + if (!silent) DEBUG_EVENT("%s: BERT Receive All-Ones Condition!\n", fe->name); } if (blsr & BIT_BLSR_BRA0){ - DEBUG_EVENT("%s: BERT Receive All-Zeros Condition!\n", + if (!silent) DEBUG_EVENT("%s: BERT Receive All-Zeros Condition!\n", fe->name); } if (blsr & BIT_BLSR_BRLOS){ - DEBUG_EVENT("%s: BERT Receive Loss of Synchronization Condition!\n", + if (!silent) DEBUG_EVENT("%s: BERT Receive Loss of Synchronization Condition!\n", fe->name); } if (blsr & BIT_BLSR_BSYNC){ - DEBUG_EVENT("%s: BERT in synchronization Condition!\n", + if (!silent) DEBUG_EVENT("%s: BERT in synchronization Condition!\n", fe->name); } @@ -2859,17 +2942,17 @@ static int sdla_ds_te1_bert_intr(sdla_fe_t *fe) return 0; } -static int sdla_ds_te1_liu_intr(sdla_fe_t *fe) +static int sdla_ds_te1_liu_intr(sdla_fe_t *fe, int silent) { unsigned char llsr = READ_REG(REG_LLSR); unsigned char lrsr = READ_REG(REG_LRSR); if (llsr & BIT_LLSR_JALTC){ - DEBUG_TE1("%s: Jitter Attenuator Limit Trip Clear!\n", + if (!silent) DEBUG_TE1("%s: Jitter Attenuator Limit Trip Clear!\n", fe->name); } if (llsr & BIT_LLSR_JALTS){ - DEBUG_TE1("%s: Jitter Attenuator Limit Trip Set!\n", + if (!silent) DEBUG_TE1("%s: Jitter Attenuator Limit Trip Set!\n", fe->name); } if (llsr & (BIT_LLSR_OCC | BIT_LLSR_OCD)){ @@ -2880,46 +2963,46 @@ static int sdla_ds_te1_liu_intr(sdla_fe_t *fe) } #endif if (lrsr & BIT_LRSR_OCS){ - if (!(fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_OC)){ - DEBUG_TE1("%s: Open Circuit is detected!\n", + if (!(fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_OC)){ + if (!silent) DEBUG_TE1("%s: Open Circuit is detected!\n", fe->name); - fe->liu_alarm |= WAN_TE_BIT_LIU_ALARM_OC; + fe->fe_alarm |= WAN_TE_BIT_LIU_ALARM_OC; } }else{ - if (fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_OC){ - DEBUG_TE1("%s: Open Circuit is cleared!\n", + if (fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_OC){ + if (!silent) DEBUG_TE1("%s: Open Circuit is cleared!\n", fe->name); - fe->liu_alarm &= ~WAN_TE_BIT_LIU_ALARM_OC; + fe->fe_alarm &= ~WAN_TE_BIT_LIU_ALARM_OC; } } } if (llsr & (BIT_LLSR_SCC | BIT_LLSR_SCD)){ if (lrsr & BIT_LRSR_SCS){ - if (!(fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_SC)){ - DEBUG_EVENT("%s: Short Circuit is detected!\n", - fe->name); - fe->liu_alarm |= WAN_TE_BIT_LIU_ALARM_SC; + if (!(fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_SC)){ + if (!silent) DEBUG_EVENT("%s: Short Circuit is detected!(%i)\n", + fe->name, __LINE__); + fe->fe_alarm |= WAN_TE_BIT_LIU_ALARM_SC; } }else{ - if (fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_SC){ - DEBUG_EVENT("%s: Short Circuit is cleared!\n", - fe->name); - fe->liu_alarm &= ~WAN_TE_BIT_LIU_ALARM_SC; + if (fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_SC){ + if (!silent) DEBUG_EVENT("%s: Short Circuit is cleared!(%i)\n", + fe->name, __LINE__); + fe->fe_alarm &= ~WAN_TE_BIT_LIU_ALARM_SC; } } } if (llsr & (BIT_LLSR_LOSC | BIT_LLSR_LOSD)){ if (lrsr & BIT_LRSR_LOSS){ - if (!(fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_LOS)){ - DEBUG_EVENT("%s: Lost of Signal is detected!\n", + if (!(fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_LOS)){ + if (!silent) DEBUG_EVENT("%s: Lost of Signal is detected!\n", fe->name); - fe->liu_alarm |= WAN_TE_BIT_LIU_ALARM_LOS; + fe->fe_alarm |= WAN_TE_BIT_LIU_ALARM_LOS; } }else{ - if (fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_LOS){ - DEBUG_EVENT("%s: Lost of Signal is cleared!\n", + if (fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_LOS){ + if (!silent) DEBUG_EVENT("%s: Lost of Signal is cleared!\n", fe->name); - fe->liu_alarm &= ~WAN_TE_BIT_LIU_ALARM_LOS; + fe->fe_alarm &= ~WAN_TE_BIT_LIU_ALARM_LOS; } } } @@ -2946,12 +3029,6 @@ static int sdla_ds_te1_check_intr(sdla_fe_t *fe) bert_imask = __READ_REG(REG_GBIMR); //if (framer_istatus & (1 << WAN_FE_LINENO(fe))){ - if (framer_istatus & (1 << WAN_DS_REGBITMAP(fe))){ - DEBUG_ISR("%s: Interrupt for line %d (framer)\n", - fe->name, WAN_FE_LINENO(fe)); - return 1; - } - //if (liu_istatus & (1 << WAN_FE_LINENO(fe))){ if ((framer_istatus & (1 << WAN_DS_REGBITMAP(fe))) && (framer_imask & (1 << WAN_DS_REGBITMAP(fe)))) { DEBUG_ISR("%s: Interrupt for line %d (FRAMER)\n", @@ -2972,7 +3049,6 @@ static int sdla_ds_te1_check_intr(sdla_fe_t *fe) fe->name, WAN_FE_LINENO(fe)); return 1; } - DEBUG_ISR("%s: This interrupt not for this port %d\n", fe->name, WAN_FE_LINENO(fe)+1); @@ -2981,34 +3057,41 @@ static int sdla_ds_te1_check_intr(sdla_fe_t *fe) static int sdla_ds_te1_intr(sdla_fe_t *fe) { - unsigned char status = fe->fe_status; - unsigned char framer_istatus; - unsigned char liu_istatus; - unsigned char bert_istatus; + u_int8_t status = fe->fe_status; + u_int8_t framer_istatus, liu_istatus, bert_istatus; + u_int8_t device_id; + int silent = 0; WAN_ASSERT(fe->write_fe_reg == NULL); WAN_ASSERT(fe->read_fe_reg == NULL); + device_id = WAN_TE1_DEVICE_ID; + if (device_id == DEVICE_ID_BAD){ + DEBUG_EVENT( + "%s: ERROR: Failed to verify Device id (silent mode)!\n", + fe->name); + silent = 1; + } framer_istatus = READ_REG(REG_GFISR); liu_istatus = READ_REG(REG_GLISR); bert_istatus = READ_REG(REG_GBISR); //if (framer_istatus & (1 << WAN_FE_LINENO(fe))){ if (framer_istatus & (1 << WAN_DS_REGBITMAP(fe))){ - sdla_ds_te1_framer_rx_intr(fe); - sdla_ds_te1_framer_tx_intr(fe); + sdla_ds_te1_framer_rx_intr(fe, silent); + sdla_ds_te1_framer_tx_intr(fe, silent); //WRITE_REG(REG_GFISR, (1<name,fe->fe_alarm); #if 1 - if (fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_SC){ + if (fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_SC){ sdla_fe_timer_event_t event; /* AL: March 1, 2006 - ** Mask global FE intr - ** Disable automatic update */ + ** 1. Mask global FE intr + ** 2. Disable automatic update */ sdla_ds_te1_intr_ctrl( - fe, 0, + fe, 0, (WAN_TE_INTR_GLOBAL|WAN_TE_INTR_BASIC|WAN_TE_INTR_PMON), - WAN_FE_INTR_MASK, 0x00); + WAN_FE_INTR_MASK, + 0x00); /* Start LINKDOWN poll */ event.type = TE_LINKCRIT_TIMER; event.delay = POLLING_TE1_TIMER*5; sdla_ds_te1_add_event(fe, &event); - //if (card->wandev.critical_event){ - // card->wandev.critical_event(card, 0); - //} return 0; } #endif @@ -3043,12 +3124,13 @@ static int sdla_ds_te1_intr(sdla_fe_t *fe) if (fe->fe_status != FE_CONNECTED){ sdla_fe_timer_event_t event; /* AL: March 1, 2006 - ** Mask global FE intr - ** Disable automatic update */ + ** 1. Mask global FE intr + ** 2. Disable automatic update */ sdla_ds_te1_intr_ctrl( - fe, 0, + fe, 0, (WAN_TE_INTR_GLOBAL|WAN_TE_INTR_BASIC|WAN_TE_INTR_PMON), - WAN_FE_INTR_MASK, 0x00); + WAN_FE_INTR_MASK, + 0x00); /* Start LINKDOWN poll */ event.type = TE_LINKDOWN_TIMER; event.delay = POLLING_TE1_TIMER*5; @@ -3095,9 +3177,9 @@ static void sdla_ds_te1_timer(unsigned long pfe) wan_clear_bit(TE_TIMER_RUNNING,(void*)&fe->te_param.critical); /* Enable hardware interrupt for TE1 */ - wan_spin_lock_irq(&fe->lock,&smp_flags); + wan_spin_lock_irq(&fe->lockirq,&smp_flags); empty = WAN_LIST_EMPTY(&fe->event); - wan_spin_unlock_irq(&fe->lock,&smp_flags); + wan_spin_unlock_irq(&fe->lockirq,&smp_flags); if (!empty){ if (wan_test_and_set_bit(TE_TIMER_EVENT_PENDING,(void*)&fe->te_param.critical)){ @@ -3128,21 +3210,23 @@ static int sdla_ds_te1_add_timer(sdla_fe_t* fe, unsigned long delay) { int err=0; - if (wan_test_bit(TE_TIMER_KILL,(void*)&fe->te_param.critical)){ + if (wan_test_bit(TE_TIMER_KILL,(void*)&fe->te_param.critical) || + wan_test_bit(TE_TIMER_RUNNING,(void*)&fe->te_param.critical)) { return 0; } - if (wan_test_bit(TE_TIMER_RUNNING,(void*)&fe->te_param.critical)) { - return 0; - } - - wan_set_bit(TE_TIMER_RUNNING,(void*)&fe->te_param.critical); - +#if defined(__WINDOWS__) + /* delay is in MS, so it can be used directly by wan_add_timer() */ + err = wan_add_timer(&fe->timer, delay); +#else err = wan_add_timer(&fe->timer, delay * HZ / 1000); +#endif + if (err){ /* Failed to add timer */ return -EINVAL; } + wan_set_bit(TE_TIMER_RUNNING,(void*)&fe->te_param.critical); return 0; } @@ -3185,12 +3269,12 @@ sdla_ds_te1_add_event(sdla_fe_t *fe, sdla_fe_timer_event_t *event) DEBUG_EVENT("%s: %s:%d: ---------------STOP ----------------------\n", fe->name, __FUNCTION__,__LINE__); #endif - wan_spin_lock_irq(&fe->lock,&smp_flags); + wan_spin_lock_irq(&fe->lockirq,&smp_flags); /* Set event from pending event map */ if (wan_test_and_set_bit(event->type,(void*)&fe->event_map)){ DEBUG_EVENT("%s: WARNING: Event type %d is already pending!\n", fe->name, event->type); - wan_spin_unlock_irq(&fe->lock, &smp_flags); + wan_spin_unlock_irq(&fe->lockirq, &smp_flags); wan_free(tevent); return -EINVAL; } @@ -3204,9 +3288,9 @@ sdla_ds_te1_add_event(sdla_fe_t *fe, sdla_fe_timer_event_t *event) cnt ++; } if (tmp == NULL){ - DEBUG_EVENT("%s: Internal Error!!!\n", fe->name); + DEBUG_EVENT("%s: ERROR: Internal Error!!!\n", fe->name); wan_clear_bit(event->type,(void*)&fe->event_map); - wan_spin_unlock_irq(&fe->lock, &smp_flags); + wan_spin_unlock_irq(&fe->lockirq, &smp_flags); return -EINVAL; } if (cnt > WAN_FE_MAX_QEVENT_LEN){ @@ -3215,26 +3299,25 @@ sdla_ds_te1_add_event(sdla_fe_t *fe, sdla_fe_timer_event_t *event) DEBUG_EVENT("%s: ERROR: Dropping new event type %d!\n", fe->name, event->type); wan_clear_bit(event->type,(void*)&fe->event_map); - wan_spin_unlock_irq(&fe->lock, &smp_flags); + wan_spin_unlock_irq(&fe->lockirq, &smp_flags); wan_free(tevent); return -EINVAL; } WAN_LIST_INSERT_AFTER(tmp, tevent, next); } - wan_spin_unlock_irq(&fe->lock, &smp_flags); + wan_spin_unlock_irq(&fe->lockirq, &smp_flags); return 0; } -/* - ****************************************************************************** - * sdla_ds_te1_polling() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ +/****************************************************************************** +** sdla_ds_te1_polling() +** +** Description: +** Arguments: +** Returns: 0 - There are no more event. Do not need to schedule sw timer +** number - delay to schedule next event. +******************************************************************************/ static int sdla_ds_te1_polling(sdla_fe_t* fe) { sdla_t *card = (sdla_t*)fe->card; @@ -3243,9 +3326,12 @@ static int sdla_ds_te1_polling(sdla_fe_t* fe) u_int8_t pending = 0; unsigned char value; unsigned int ch, bit, off; +#if 0 + unsigned int reg; +#endif - WAN_ASSERT(fe->write_fe_reg == NULL); - WAN_ASSERT(fe->read_fe_reg == NULL); + WAN_ASSERT_RC(fe->write_fe_reg == NULL, 0); + WAN_ASSERT_RC(fe->read_fe_reg == NULL, 0); #if 0 DEBUG_EVENT("%s: %s:%d: ---------------START ----------------------\n", @@ -3254,20 +3340,19 @@ static int sdla_ds_te1_polling(sdla_fe_t* fe) DEBUG_EVENT("%s: %s:%d: ---------------STOP ----------------------\n", fe->name, __FUNCTION__,__LINE__); #endif - wan_spin_lock_irq(&fe->lock,&smp_flags); + wan_spin_lock_irq(&fe->lockirq,&smp_flags); if (WAN_LIST_EMPTY(&fe->event)){ wan_clear_bit(TE_TIMER_EVENT_PENDING,(void*)&fe->te_param.critical); - wan_spin_unlock_irq(&fe->lock,&smp_flags); + wan_spin_unlock_irq(&fe->lockirq,&smp_flags); DEBUG_EVENT("%s: WARNING: No FE events in a queue!\n", fe->name); - sdla_ds_te1_add_timer(fe, HZ); - return 0; + return HZ; } event = WAN_LIST_FIRST(&fe->event); WAN_LIST_REMOVE(event, next); /* Clear event from pending event map */ wan_clear_bit(event->type,(void*)&fe->event_map); - wan_spin_unlock_irq(&fe->lock,&smp_flags); + wan_spin_unlock_irq(&fe->lockirq,&smp_flags); DEBUG_TE1("%s: TE1 Polling State=%s Event=%X!\n", fe->name, WAN_FE_STATUS_DECODE(fe), event->type); @@ -3284,7 +3369,7 @@ static int sdla_ds_te1_polling(sdla_fe_t* fe) case TE_LINKDOWN_TIMER: sdla_ds_te1_read_alarms(fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE); - if (fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_SC){ + if (fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_SC){ /* Short circuit detected, go to LINKCRIT state */ event->type = TE_LINKCRIT_TIMER; event->delay = POLLING_TE1_TIMER; @@ -3310,22 +3395,22 @@ static int sdla_ds_te1_polling(sdla_fe_t* fe) ** because it cause to stay longer in interrupt handler ** (critical for XILINX code) */ if (fe->fe_status == FE_CONNECTED){ + if (card->wandev.te_link_state){ + card->wandev.te_link_state(card); + } if (fe->fe_cfg.poll_mode == WANOPT_YES){ event->type = WAN_TE_POLL_LINKREADY; event->delay = POLLING_TE1_TIMER; pending = 1; }else{ - /* Enable Basic Interrupt */ - /* Enable automatic update pmon counters */ + /* Enable Basic Interrupt + ** Enable automatic update pmon counters */ sdla_ds_te1_intr_ctrl( fe, 0, (WAN_TE_INTR_GLOBAL|WAN_TE_INTR_BASIC|WAN_TE_INTR_PMON), WAN_FE_INTR_ENABLE, 0x00); } - if (card->wandev.te_link_state){ - card->wandev.te_link_state(card); - } }else{ event->type = TE_LINKDOWN_TIMER; event->delay = POLLING_TE1_TIMER; @@ -3333,11 +3418,10 @@ static int sdla_ds_te1_polling(sdla_fe_t* fe) } break; - case WAN_TE_POLL_LINKREADY: /* Only used in no interrupt driven front-end mode */ sdla_ds_te1_read_alarms(fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE); - if (fe->liu_alarm & WAN_TE_BIT_LIU_ALARM_SC){ + if (fe->fe_alarm & WAN_TE_BIT_LIU_ALARM_SC){ /* Short circuit detected, go to LINKCRIT state */ event->type = TE_LINKCRIT_TIMER; event->delay = POLLING_TE1_TIMER; @@ -3414,7 +3498,7 @@ static int sdla_ds_te1_polling(sdla_fe_t* fe) break; case TE_SET_LB_MODE: - sdla_ds_te1_set_lbmode(fe, event->te_event.lb_type, event->mode); + sdla_ds_te1_set_lb(fe, event->te_event.lb_type, event->mode); break; case TE_POLL_CONFIG: @@ -3423,20 +3507,50 @@ static int sdla_ds_te1_polling(sdla_fe_t* fe) if (sdla_ds_te1_chip_config(fe)){ DEBUG_EVENT("%s: Failed to re-configuring Front-End chip!\n", fe->name); - return -EINVAL; + break; } + /* Do not enable interrupts here */ event->type = TE_LINKDOWN_TIMER; event->delay = POLLING_TE1_TIMER; pending = 1; break; - +#if 0 + case TE_POLL_CONFIG_VERIFY: + DEBUG_EVENT("%s: Verifing %s Front-End chip configuration...\n", + fe->name, FE_MEDIA_DECODE(fe)); + if (sdla_ds_te1_chip_config_verify(fe)){ + DEBUG_EVENT("%s: Failed to verify Front-End chip configuration!\n", + fe->name); + } + break; +#endif case TE_POLL_READ: fe->te_param.reg_dbg_value = READ_REG(event->te_event.reg); DEBUG_TE1("%s: Read %s Front-End Reg:%04X=%02X\n", fe->name, FE_MEDIA_DECODE(fe), event->te_event.reg, fe->te_param.reg_dbg_value); - fe->te_param.reg_dbg_ready = 1; + fe->te_param.reg_dbg_ready = 1; +#if 0 + DEBUG_EVENT("%s: Reading %s Front-End Registers:\n", + fe->name, FE_MEDIA_DECODE(fe)); + for(reg=0x0;reg<=0x1ff;reg++){ + DEBUG_EVENT("%s: REG[%04X]=%02X\n", + fe->name, reg, READ_REG(reg)); + } + DEBUG_EVENT("%s: Reading %s Front-End LIU Registers:\n", + fe->name, FE_MEDIA_DECODE(fe)); + for(reg=0x1000;reg<=0x1007;reg++){ + DEBUG_EVENT("%s: REG[%04X]=%02X\n", + fe->name, reg, READ_REG(reg)); + } + DEBUG_EVENT("%s: Reading %s Front-End BERT Registers:\n", + fe->name, FE_MEDIA_DECODE(fe)); + for(reg=0x1100;reg<=0x110F;reg++){ + DEBUG_EVENT("%s: REG[%04X]=%02X\n", + fe->name, reg, READ_REG(reg)); + } +#endif break; case TE_POLL_WRITE: @@ -3462,11 +3576,9 @@ static int sdla_ds_te1_polling(sdla_fe_t* fe) /* Add fe timer */ event = WAN_LIST_FIRST(&fe->event); if (event){ - sdla_ds_te1_add_timer(fe, event->delay); - }else{ - sdla_ds_te1_add_timer(fe, HZ); + return event->delay; } - return 0; + return HZ; } /* @@ -3526,7 +3638,7 @@ static int sdla_ds_te1_pmon(sdla_fe_t *fe, int action) /* OOF Error for T1/E1 */ pmon3 = READ_REG(REG_FOSCR1) << 8 | READ_REG(REG_FOSCR2); if (IS_E1_FEMEDIA(fe) && WAN_FE_FRAME(fe) == WAN_FR_CRC4){ - /* E-bit counter (Far End Block Errors) */ + /* E-bit counter (Far End Block Errors) for CRC4 */ pmon4 = READ_REG(REG_E1EBCR1) << 8 | READ_REG(REG_E1EBCR2); } @@ -3706,7 +3818,7 @@ static int sdla_ds_te1_fr_flb(sdla_fe_t* fe, unsigned char mode) }else{ value &= ~BIT_RCR3_FLB; } - WRITE_REG(REG_LMCR, value); + WRITE_REG(REG_RCR3, value); return 0; } @@ -3732,13 +3844,13 @@ static int sdla_ds_te1_fr_plb(sdla_fe_t* fe, unsigned char mode) }else{ value &= ~BIT_RCR3_PLB; } - WRITE_REG(REG_LMCR, value); + WRITE_REG(REG_RCR3, value); return 0; } /* ****************************************************************************** - * sdla_ds_te1_set_lbmode() + * sdla_ds_te1_set_lb() * * Description: * Arguments: @@ -3746,7 +3858,7 @@ static int sdla_ds_te1_fr_plb(sdla_fe_t* fe, unsigned char mode) ****************************************************************************** */ static int -sdla_ds_te1_set_lbmode(sdla_fe_t *fe, unsigned char type, unsigned char mode) +sdla_ds_te1_set_lb(sdla_fe_t *fe, unsigned char mode, unsigned char action) { int err = 0; @@ -3754,33 +3866,33 @@ sdla_ds_te1_set_lbmode(sdla_fe_t *fe, unsigned char type, unsigned char mode) WAN_ASSERT(fe->read_fe_reg == NULL); DEBUG_EVENT("%s: %s %s mode...\n", fe->name, - WAN_TE1_LB_MODE_DECODE(mode), - WAN_TE1_LB_TYPE_DECODE(type)); - switch(type){ - case WAN_TE1_DDLB_MODE: + WAN_TE1_LB_ACTION_DECODE(action), + WAN_TE1_LB_MODE_DECODE(mode)); + switch(mode){ case WAN_TE1_LIU_ALB_MODE: - err = sdla_ds_te1_liu_alb(fe, mode); + err = sdla_ds_te1_liu_alb(fe, action); break; case WAN_TE1_LIU_LLB_MODE: - err = sdla_ds_te1_liu_llb(fe, mode); + err = sdla_ds_te1_liu_llb(fe, action); break; - case WAN_TE1_LINELB_MODE: case WAN_TE1_LIU_RLB_MODE: - err = sdla_ds_te1_liu_rlb(fe, mode); + err = sdla_ds_te1_liu_rlb(fe, action); break; case WAN_TE1_LIU_DLB_MODE: - if (!sdla_ds_te1_liu_llb(fe, mode)){ - err = sdla_ds_te1_liu_rlb(fe, mode); + if (!sdla_ds_te1_liu_llb(fe, action)){ + err = sdla_ds_te1_liu_rlb(fe, action); } break; + case WAN_TE1_DDLB_MODE: case WAN_TE1_FR_FLB_MODE: - err = sdla_ds_te1_fr_flb(fe, mode); + err = sdla_ds_te1_fr_flb(fe, action); break; case WAN_TE1_PAYLB_MODE: case WAN_TE1_FR_PLB_MODE: - err = sdla_ds_te1_fr_plb(fe, mode); + err = sdla_ds_te1_fr_plb(fe, action); break; case WAN_TE1_FR_RLB_MODE: + case WAN_TE1_LINELB_MODE: default: DEBUG_EVENT("%s: Unsupport loopback mode (%s)!\n", fe->name, @@ -3788,13 +3900,13 @@ sdla_ds_te1_set_lbmode(sdla_fe_t *fe, unsigned char type, unsigned char mode) return -EINVAL; } if (!err){ - if (mode == WAN_TE1_ACTIVATE_LB){ - wan_set_bit(type, &fe->te_param.lb_mode); + if (action == WAN_TE1_ACTIVATE_LB){ + wan_set_bit(mode, &fe->te_param.lb_mode); }else{ - wan_clear_bit(type, &fe->te_param.lb_mode); + wan_clear_bit(mode, &fe->te_param.lb_mode); } } - return 0; + return err; } /* @@ -3827,11 +3939,11 @@ static int sdla_ds_te1_udp(sdla_fe_t *fe, void* p_udp_cmd, unsigned char* data) #if 1 event.type = TE_SET_LB_MODE; event.te_event.lb_type = data[0]; /* LB type */ - event.mode = data[1]; /* LB mode (activate/deactivate) */ + event.mode = data[1]; /* LB action (activate/deactivate) */ event.delay = POLLING_TE1_TIMER; err = sdla_ds_te1_add_event(fe, &event); #else - err = sdla_ds_te1_set_lbmode(fe, data[0], data[1]); + err = sdla_ds_te1_set_lb(fe, data[0], data[1]); #endif udp_cmd->wan_cmd_return_code = (!err) ? WAN_CMD_OK : WAN_UDP_FAILED_CMD; @@ -3841,15 +3953,16 @@ static int sdla_ds_te1_udp(sdla_fe_t *fe, void* p_udp_cmd, unsigned char* data) case WAN_FE_GET_STAT: /* TE1 Update T1/E1 perfomance counters */ sdla_ds_te1_pmon(fe, WAN_FE_PMON_UPDATE|WAN_FE_PMON_READ); + sdla_ds_te1_rxlevel(fe); + memcpy(&data[0], &fe->fe_stats, sizeof(sdla_fe_stats_t)); if (udp_cmd->wan_cmd_fe_force){ + sdla_fe_stats_t *fe_stats = (sdla_fe_stats_t*)&data[0]; /* force to read FE alarms */ DEBUG_EVENT("%s: Force to read Front-End alarms\n", fe->name); - fe->fe_stats.alarms = - sdla_ds_te1_read_alarms(fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE); + fe_stats->alarms = + sdla_ds_te1_read_alarms(fe, WAN_FE_ALARM_READ); } - sdla_ds_te1_rxlevel(fe); - memcpy(&data[0], &fe->fe_stats, sizeof(sdla_fe_stats_t)); udp_cmd->wan_cmd_return_code = WAN_CMD_OK; udp_cmd->wan_cmd_data_len = sizeof(sdla_fe_stats_t); break; @@ -3948,6 +4061,16 @@ static int sdla_ds_te1_udp(sdla_fe_t *fe, void* p_udp_cmd, unsigned char* data) sdla_ds_te1_add_event(fe, &event); udp_cmd->wan_cmd_return_code = WAN_CMD_OK; break; + +#if 0 + case WAN_FE_DEBUG_CONFIG_VERIFY: + event.type = TE_POLL_CONFIG_VERIFY; + event.delay = POLLING_TE1_TIMER; + sdla_ds_te1_add_event(fe, &event); + udp_cmd->wan_cmd_return_code = WAN_CMD_OK; + break; +#endif + case WAN_FE_DEBUG_REG: if (fe->te_param.reg_dbg_busy){ if (fe_debug->fe_debug_reg.read == 2 && fe->te_param.reg_dbg_ready){ @@ -4023,14 +4146,14 @@ sdla_ds_te1_update_alarm_info(sdla_fe_t* fe, struct seq_file* m, int* stop_cnt) "AIS", WAN_TE_AIS_ALARM(fe->fe_alarm)); if (IS_T1_FEMEDIA(fe)){ PROC_ADD_LINE(m, - PROC_STATS_ALARM_FORMAT, - "YEL", WAN_TE_YEL_ALARM(fe->fe_alarm), - "OOF", WAN_TE_OOF_ALARM(fe->fe_alarm)); + PROC_STATS_ALARM_FORMAT, + "RAI", WAN_TE_RAI_ALARM(fe->fe_alarm), + "OOF", WAN_TE_OOF_ALARM(fe->fe_alarm)); }else{ PROC_ADD_LINE(m, PROC_STATS_ALARM_FORMAT, "OOF", WAN_TE_OOF_ALARM(fe->fe_alarm), - "", ""); + "RAI", WAN_TE_RAI_ALARM(fe->fe_alarm)); } return m->count; #endif diff --git a/patches/kdrivers/src/net/sdla_adccp.c b/patches/kdrivers/src/net/sdla_adccp.c index 3752670..68bd213 100644 --- a/patches/kdrivers/src/net/sdla_adccp.c +++ b/patches/kdrivers/src/net/sdla_adccp.c @@ -238,6 +238,8 @@ typedef struct x25_channel } x25_channel_t; /* FIXME Take this out */ + + #pragma pack(1) #ifdef NEX_OLD_CALL_INFO typedef struct x25_call_info @@ -320,11 +322,7 @@ static void timer_intr (sdla_t *); /*================================================= * Background polling routines */ -# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -static void wpx_poll (void * card_ptr); -# else -static void wpx_poll (struct work_struct *work); -#endif +static void wpx_poll (void*); #if 0 static void poll_disconnected (sdla_t* card); #endif @@ -530,7 +528,7 @@ int wp_adccp_init (sdla_t* card, wandev_conf_t* conf) u.cfg.station = 0; /* DCE mode */ } - if (conf->interface != WANOPT_RS232 ){ + if (conf->electrical_interface != WANOPT_RS232 ){ u.cfg.hdlcOptions |= 0x80; /* V35 mode */ } @@ -596,7 +594,7 @@ int wp_adccp_init (sdla_t* card, wandev_conf_t* conf) /* Initialize protocol-specific fields of adapter data space */ card->wandev.bps = conf->bps; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; card->wandev.clocking = conf->clocking; card->wandev.station = conf->u.x25.station; card->isr = &wpx_isr; @@ -661,6 +659,7 @@ int wp_adccp_init (sdla_t* card, wandev_conf_t* conf) WAN_TASKQ_INIT((&card->u.x.x25_poll_task),0,wpx_poll,card); + init_timer(&card->u.x.x25_timer); card->u.x.x25_timer.data = (unsigned long)card; card->u.x.x25_timer.function = x25_timer_routine; @@ -713,7 +712,7 @@ static int update (wan_device_t* wandev) unsigned long smp_flags; /* sanity checks */ - if ((wandev == NULL) || (wandev->private == NULL)) + if ((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if (wandev->state == WAN_UNCONFIGURED) @@ -726,7 +725,7 @@ static int update (wan_device_t* wandev) if (!dev) return -ENODEV; - card = wandev->private; + card = wandev->priv; DEBUG_EVENT("%s: UPDATE\n",card->devname); @@ -775,7 +774,7 @@ static int update (wan_device_t* wandev) */ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; x25_channel_t* chan; int err = 0; @@ -882,7 +881,7 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) static int del_if (wan_device_t* wandev, netdevice_t* dev) { - sdla_t *card=wandev->private; + sdla_t *card=wandev->priv; x25_channel_t* chan = dev->priv; set_chan_state(dev, WAN_DISCONNECTED); @@ -949,6 +948,8 @@ static int if_init (netdevice_t* dev) /* Initialize device driver entry points */ dev->open = &if_open; dev->stop = &if_close; + dev->hard_header = NULL; + dev->rebuild_header = NULL; dev->hard_start_xmit = &if_send; dev->get_stats = &if_stats; dev->do_ioctl = &if_ioctl; @@ -2064,18 +2065,10 @@ static void spur_intr (sdla_t* card) * enabled. Beware! *====================================================================*/ -# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -static void wpx_poll (void * card_ptr) -# else -static void wpx_poll (struct work_struct *work) -#endif +static void wpx_poll (void *card_ptr) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) - sdla_t *card = (sdla_t *)container_of(work, sdla_t, u.aft.port_task); -#else - sdla_t *card = (sdla_t *)card_ptr; -#endif netdevice_t *dev; + sdla_t *card=card_ptr; ++card->statistics.poll_processed; dev = WAN_DEVLE2DEV(WAN_LIST_FIRST(&card->wandev.dev_head)); @@ -4239,11 +4232,11 @@ static int x25_get_dev_config_info(char* buf, char** start, off_t offs, int len, int size = 0; PROC_ADD_DECL(stop_cnt); - if (wandev == NULL || wandev->private == NULL) + if (wandev == NULL || wandev->priv == NULL) return cnt; PROC_ADD_INIT(offs, stop_cnt); - card = (sdla_t*)wandev->private; + card = (sdla_t*)wandev->priv; x25_conf = &card->u.x.x25_conf; PROC_ADD_LINE(cnt, @@ -4337,7 +4330,7 @@ static int x25_set_dev_config(struct file *file, if (wandev == NULL) return cnt; - card = (sdla_t*)wandev->private; + card = (sdla_t*)wandev->priv; printk(KERN_INFO "%s: New device config (%s)\n", wandev->name, buffer); diff --git a/patches/kdrivers/src/net/sdla_adsl.c b/patches/kdrivers/src/net/sdla_adsl.c index efa9d84..f0e02c9 100644 --- a/patches/kdrivers/src/net/sdla_adsl.c +++ b/patches/kdrivers/src/net/sdla_adsl.c @@ -10,8 +10,11 @@ * Feb 25, 2002 Nenad Corbic Initial version * Based on GlobeSpan ADSL device driver. * http://www.globespan.net +* * July 1, 2002 Alex Feldman Porting ADSL driver to FreeBSD/OpenBSD * +* March 9, 2006 David Rokhvarg Ported ADSL driver to MS Windows XP/2003 +* * ============================================================================ * History: * 2/5/01 PG: Modified to add the support for EOC handling @@ -75,6 +78,15 @@ # include # include # include +#elif defined(__WINDOWS__) + +# include +# include +# include +# include +# include +# include + #elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) # include # include @@ -94,11 +106,11 @@ */ #define MAX_TRACE_QUEUE 100 #define MAX_TRACE_BUFFER (MAX_LGTH_UDP_MGNT_PKT - \ - sizeof(iphdr_t) - \ - sizeof(udphdr_t) - \ - sizeof(wan_mgmt_t) - \ - sizeof(wan_trace_info_t) - \ - sizeof(wan_cmd_t)) + sizeof(iphdr_t) - \ + sizeof(udphdr_t) - \ + sizeof(wan_mgmt_t) - \ + sizeof(wan_trace_info_t) - \ + sizeof(wan_cmd_t)) /* ************************************************************************** @@ -115,6 +127,9 @@ #if defined(__LINUX__) # define LIST_FIRST_MCLIST(dev) dev->mc_list # define LIST_NEXT_MCLIST(mclist) mclist->next +#elif defined(__WINDOWS__) +# define LIST_FIRST_MCLIST(dev) dev->mc_list +# define LIST_NEXT_MCLIST(mclist) mclist->next #elif defined(__FreeBSD__) # define LIST_FIRST_MCLIST(dev) LIST_FIRST(&dev->if_multiaddrs) # define LIST_NEXT_MCLIST(mclist) mclist->ifma_link.le_next @@ -156,6 +171,26 @@ static void adsl_tx_timeout (netdevice_t *dev); static void adsl_multicast(netdevice_t* dev); static struct net_device_stats* adsl_stats(netdevice_t* dev); static int wanpipe_attach_sppp(sdla_t *card, netdevice_t *dev, wanif_conf_t *conf); +#elif defined(__WINDOWS__) +static int adsl_open(netdevice_t*); +static int adsl_close(netdevice_t*); +static int adsl_output(struct sk_buff *skb, netdevice_t *dev); +static int adsl_ioctl(netdevice_t* ifp, struct ifreq *ifr, int command); +static void adsl_tx_timeout (netdevice_t *dev); +static void adsl_multicast(netdevice_t* dev); +static struct net_device_stats* adsl_stats(netdevice_t* dev); +static int wanpipe_attach_sppp(sdla_t *card, netdevice_t *dev, wanif_conf_t *conf); + +static int netif_rx(netdevice_t *sdla_net_dev, netskb_t *rx_skb); +static int adsl_if_send(void *not_used, netdevice_t *sdla_net_dev); + +static int +adsl_insert_packet_in_to_rx_queue( + netdevice_t *sdla_net_dev, + RX_DATA_STRUCT *rx_data_struct + ); + +extern DRIVER_VERSION drv_version; #else static void adsl_watchdog (netdevice_t*); static void adsl_tx (netdevice_t *); @@ -171,17 +206,43 @@ static int adsl_init(netdevice_t* dev); static WAN_IRQ_RETVAL wpa_isr (sdla_t*); static void disable_comm(sdla_t* card); -static int process_udp_mgmt_pkt(sdla_t*, netdevice_t*, adsl_private_area_t*, int); static int new_if (wan_device_t*, netdevice_t*, wanif_conf_t*); static int del_if (wan_device_t*, netdevice_t*); static int process_udp_cmd(netdevice_t*,wan_udp_hdr_t*); + +#if defined(__WINDOWS__) +static void process_bh( + IN PKDPC Dpc, + IN PVOID arg, + IN PVOID not_used1, + IN PVOID not_used2 + ); + +static void adsl_if_send_task_func( + IN PKDPC Dpc, + IN PVOID arg, + IN PVOID not_used1, + IN PVOID not_used2 + ); + +static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* netdev, adsl_private_area_t* chan); +static int adsl_init(void* priv); + +#else + +#if defined(__LINUX__) # if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) static void process_bh (void *); -#else +# else static void process_bh (struct work_struct *work); -#endif -int adsl_trace_queue_len(void *trace_ptr); +# endif +#endif +static int process_udp_mgmt_pkt(sdla_t*, netdevice_t*, adsl_private_area_t*, int); + +#endif + +unsigned int adsl_trace_queue_len(void *trace_ptr); /* @@ -191,32 +252,32 @@ int adsl_trace_queue_len(void *trace_ptr); */ /*============================================================================ - * DSL Hardware initialization routine. - * - * This routine is called by the main WANPIPE module during setup. At this - * point adapter is completely initialized and firmware is running. - * - * Return: 0 o.k. - * < 0 failure. - */ +* DSL Hardware initialization routine. +* +* This routine is called by the main WANPIPE module during setup. At this +* point adapter is completely initialized and firmware is running. +* +* Return: 0 o.k. +* < 0 failure. +*/ int wp_adsl_init (sdla_t* card, wandev_conf_t* conf) { DEBUG_EVENT("%s: Initializing S518 ADSL card...\n", - card->devname); - + card->devname); + card->isr = &wpa_isr; card->poll = NULL; card->exec = NULL; card->wandev.update = NULL; /*&update; */ - card->wandev.new_if = &new_if; + card->wandev.new_if = &new_if; card->wandev.del_if = &del_if; card->wandev.udp_port = conf->udp_port; card->wandev.new_if_cnt = 0; card->wandev.ttl = conf->ttl; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; - conf->u.adsl.tty_minor = conf->tty_minor; + conf->u.adsl.tty_minor = (unsigned char)conf->tty_minor; switch (conf->u.adsl.EncapMode){ case RFC_MODE_ROUTED_IP_LLC: @@ -232,16 +293,16 @@ int wp_adsl_init (sdla_t* card, wandev_conf_t* conf) } break; } - conf->u.adsl.mtu = conf->mtu; + conf->u.adsl.mtu = (unsigned short)conf->mtu; card->wandev.mtu = conf->mtu; - + card->u.adsl.adapter = adsl_create(&conf->u.adsl, - card, - card->devname); + card, + card->devname); if (card->u.adsl.adapter == NULL){ return -EINVAL; } - + card->u.adsl.EncapMode = conf->u.adsl.EncapMode; card->wandev.station = conf->u.adsl.EncapMode; @@ -257,34 +318,34 @@ int wp_adsl_init (sdla_t* card, wandev_conf_t* conf) #endif } #endif - + #if defined(__LINUX__) - card->disable_comm = &disable_comm; + card->disable_comm = &disable_comm; #else - if (adsl_wan_interface_type(card->u.adsl.adapter)){ - card->disable_comm = &disable_comm; - } + if (adsl_wan_interface_type(card->u.adsl.adapter)){ + card->disable_comm = &disable_comm; + } #endif card->wandev.state = WAN_CONNECTING; - return 0; + return 0; } /*============================================================================ - * Handle transmit timeout event from netif watchdog - */ +* Handle transmit timeout event from netif watchdog +*/ #if defined(__NetBSD__) || defined (__FreeBSD__) || defined (__OpenBSD__) static void adsl_watchdog(netdevice_t* dev) { adsl_private_area_t* dsl = NULL; - sdla_t* card = NULL; + sdla_t* card = NULL; WAN_ASSERT1(dev == NULL); dsl = wan_netif_priv(dev); WAN_ASSERT1(dsl == NULL); - card = dsl->common.card; + card = dsl->common.card; DEBUG_TIMER("%s: Watchdog function called\n", - wan_netif_name(dev)); + wan_netif_name(dev)); process_udp_mgmt_pkt(card, dev, dsl,0); @@ -293,23 +354,27 @@ static void adsl_watchdog(netdevice_t* dev) /*============================================================================ - * Create new logical channel. - * This routine is called by the router when ROUTER_IFNEW IOCTL is being - * handled. - * o parse media- and hardware-specific configuration - * o make sure that a new channel can be created - * o allocate resources, if necessary - * o prepare network device structure for registaration. - * - * Return: 0 o.k. - * < 0 Failure (channel will not be created) - */ +* Create new logical channel. +* This routine is called by the router when ROUTER_IFNEW IOCTL is being +* handled. +* o parse media- and hardware-specific configuration +* o make sure that a new channel can be created +* o allocate resources, if necessary +* o prepare network device structure for registaration. +* +* Return: 0 o.k. +* < 0 Failure (channel will not be created) +*/ static int new_if (wan_device_t* wandev, netdevice_t* ifp, wanif_conf_t* conf) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; adsl_private_area_t* adsl = NULL; - + +#if defined(__WINDOWS__) + if ((ifp->name[0] == '\0') || (strlen(ifp->name) > WAN_IFNAME_SZ)) { +#else if ((conf->name[0] == '\0') || (strlen(conf->name) > WAN_IFNAME_SZ)) { +#endif DEBUG_EVENT("%s: Invalid interface name!\n", card->devname); return -EINVAL; @@ -320,113 +385,155 @@ static int new_if (wan_device_t* wandev, netdevice_t* ifp, wanif_conf_t* conf) } /* (FreeBSD/OpenBSD only) - * Verify that SPPP is enabled in the kernel. - */ + * Verify that SPPP is enabled in the kernel. + */ +#if !defined(__WINDOWS__) if (!WAN_SPPP_ENABLED){ if (card->u.adsl.EncapMode == RFC_MODE_PPP_VC || - card->u.adsl.EncapMode == RFC_MODE_PPP_LLC){ - DEBUG_EVENT("%s: Please verify that SPPP is enabled in your kernel!\n", - card->devname); - return -EINVAL; + card->u.adsl.EncapMode == RFC_MODE_PPP_LLC){ + DEBUG_EVENT("%s: Please verify that SPPP is enabled in your kernel!\n", + card->devname); + return -EINVAL; } } +#endif /* allocate and initialize private data */ adsl = wan_malloc(sizeof(adsl_private_area_t)); if (adsl == NULL){ DEBUG_EVENT("%s: Failed allocating private data...\n", - card->devname); + card->devname); return -ENOMEM; } memset(adsl,0,sizeof(adsl_private_area_t)); DEBUG_EVENT("%s: Configuring Interface: %s\n", - card->devname, conf->name); + card->devname, conf->name); /* prepare network device data space for registration */ - memcpy(adsl->if_name, conf->name, strlen(conf->name)); + memcpy(adsl->if_name, conf->name, strlen(conf->name)); if (wan_netif_init(ifp, adsl->if_name)){ DEBUG_EVENT("%s: Failed to initialize network interface!\n", - conf->name); + conf->name); wan_free(adsl); return -ENOMEM; } #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) ifp->if_softc = adsl; - ifp->if_output = adsl_output; - ifp->if_start = adsl_tx; - ifp->if_watchdog = adsl_watchdog; - ifp->if_ioctl = adsl_ioctl; + ifp->if_output = adsl_output; + ifp->if_start = adsl_tx; + ifp->if_watchdog = adsl_watchdog; + ifp->if_ioctl = adsl_ioctl; # if defined(__NetBSD__) || defined (__FreeBSD__) - ifp->if_init = adsl_init; + ifp->if_init = adsl_init; # endif - ifp->if_snd.ifq_len = 0; -#elif defined(__LINUX__) + ifp->if_snd.ifq_len = 0; +#elif defined(__LINUX__) || defined(__WINDOWS__) + +#if defined(__LINUX__) + WAN_TASKQ_INIT((&adsl->common.wanpipe_task), 0, process_bh, ifp); +#elif defined(__WINDOWS__) + /* # define WAN_TASKQ_INIT(task, priority, func, arg) */ + WAN_TASKQ_INIT((&adsl->common.wanpipe_task), 0, process_bh, ifp); + WAN_TASKQ_INIT((&adsl->adsl_if_send_task), 0, adsl_if_send_task_func, ifp); +#endif - WAN_TASKQ_INIT((&adsl->common.wanpipe_task),0,process_bh,ifp); - ifp->priv = adsl; ifp->irq = card->wandev.irq; - card->hw_iface.getcfg(card->hw, SDLA_MEMBASE, &ifp->mem_start); - card->hw_iface.getcfg(card->hw, SDLA_MEMEND, &ifp->mem_end); - - ifp->open = &adsl_open; - ifp->stop = &adsl_close; - ifp->hard_start_xmit = &adsl_output; - ifp->get_stats = &adsl_stats; - ifp->set_multicast_list = &adsl_multicast; + card->hw_iface.getcfg(card->hw, SDLA_MEMBASE, &ifp->mem_start); + card->hw_iface.getcfg(card->hw, SDLA_MEMEND, &ifp->mem_end); + + ifp->open = &adsl_open; + ifp->stop = &adsl_close; + +#if defined(__WINDOWS__) + ifp->hard_start_xmit = &adsl_if_send;/* will call adsl_output() */ + ifp->udp_mgmt = &process_udp_mgmt_pkt; + ifp->init = &adsl_init; + + adsl->common.card = card; + adsl->card = card; + + wpabs_trace_info_init(&adsl->trace_info, MAX_TRACE_QUEUE); + ifp->trace_info = &adsl->trace_info; + adsl->sdla_net_dev = ifp; + +#else + ifp->hard_start_xmit = &adsl_output; +#endif + + ifp->get_stats = &adsl_stats; + +#if !defined(__WINDOWS__) + ifp->set_multicast_list = &adsl_multicast; +#endif ifp->tx_timeout = &adsl_tx_timeout; ifp->watchdog_timeo = (1*HZ); - + ifp->do_ioctl = adsl_ioctl; -#endif +#endif/*#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)*/ adsl->common.card = card; adsl->pAdapter = adsl_new_if(card->u.adsl.adapter, adsl->macAddr, ifp); if (adsl->pAdapter == NULL){ DEBUG_EVENT("%s: Failed ADSL interface initialization\n", - card->devname); + card->devname); del_if(wandev, ifp); return -EINVAL; } +#if defined(__WINDOWS__) + //connect to the Interrupt Line + if(connect_to_interrupt_line(card)){ + return 1; + }else{ + //at this point we can handle front end interrupts + card->init_flag = 0; + } +#endif - +#if !defined(__WINDOWS__) if(strcmp(conf->usedby, "STACK") == 0) { adsl->common.usedby = STACK; DEBUG_EVENT( "%s:%s: Running in Stack mode.\n", - card->devname,adsl->if_name); + card->devname,adsl->if_name); card->u.adsl.EncapMode=RFC_MODE_STACK_VC; }else{ +#endif + adsl->common.usedby = WANPIPE; DEBUG_EVENT( "%s:%s: Running in Wanpipe mode.\n", - card->devname,adsl->if_name); + card->devname,adsl->if_name); +#if !defined(__WINDOWS__) } +#endif - /*TASK_INIT(&adsl->tq_atm_task, 0, &adsl_atm_tasklet, adsl->pAdapter); - */ - switch (card->u.adsl.EncapMode){ - + /*TASK_INIT(&adsl->tq_atm_task, 0, &adsl_atm_tasklet, adsl->pAdapter);*/ + switch (card->u.adsl.EncapMode) + { case RFC_MODE_BRIDGED_ETH_LLC: case RFC_MODE_BRIDGED_ETH_VC: DEBUG_EVENT("%s: Configuring %s as Ethernet\n", - card->devname, wan_netif_name(ifp)); + card->devname, wan_netif_name(ifp)); #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) - ifp->if_flags |= (IFF_DRV_RUNNING|IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST); + ifp->if_flags |= (IFF_DRV_RUNNING|IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST); /* if_type,if_addrlen, if_hdrlen, if_mtu inialize - * in ether_ifattach - */ + * in ether_ifattach + */ # if !defined(__NetBSD__) bcopy(adsl->macAddr, - WAN_IFP2ENADDR(ifp)/*(WAN_IFP2AC(ifp))->ac_enaddr*/, - 6); + WAN_IFP2ENADDR(ifp)/*(WAN_IFP2AC(ifp))->ac_enaddr*/, + 6); # endif bcopy(adsl->macAddr, wandev->macAddr, ETHER_ADDR_LEN); #else + +#if !defined(__WINDOWS__) ether_setup(ifp); +#endif memcpy(ifp->dev_addr, adsl->macAddr, 6); #endif break; @@ -434,19 +541,19 @@ static int new_if (wan_device_t* wandev, netdevice_t* ifp, wanif_conf_t* conf) case RFC_MODE_ROUTED_IP_LLC: case RFC_MODE_ROUTED_IP_VC: DEBUG_EVENT("%s: Configuring %s as Raw IP\n", - card->devname, wan_netif_name(ifp)); - + card->devname, wan_netif_name(ifp)); +#if !defined(__WINDOWS__) /* Drop down to STACK_VC: Standard if config */ - case RFC_MODE_STACK_VC: - +#endif + #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) - ifp->if_mtu = card->wandev.mtu; /* ETHERMTU */ - ifp->if_type = IFT_OTHER; - ifp->if_flags |= (IFF_POINTOPOINT|IFF_DRV_RUNNING); - /*ifp->if_flags |= IFF_NOARP;*/ - ifp->if_hdrlen = 0; -#else + ifp->if_mtu = card->wandev.mtu; /* ETHERMTU */ + ifp->if_type = IFT_OTHER; + ifp->if_flags |= (IFF_POINTOPOINT|IFF_DRV_RUNNING); + /*ifp->if_flags |= IFF_NOARP;*/ + ifp->if_hdrlen = 0; +#elif defined(__LINUX__) ifp->type = ARPHRD_PPP; ifp->flags |= IFF_POINTOPOINT; ifp->flags |= IFF_NOARP; @@ -457,12 +564,13 @@ static int new_if (wan_device_t* wandev, netdevice_t* ifp, wanif_conf_t* conf) #endif break; +#if !defined(__WINDOWS__) case RFC_MODE_PPP_VC: case RFC_MODE_PPP_LLC: DEBUG_EVENT("%s: Attaching SPPP protocol \n", card->devname); #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) WAN_SPPP_ATTACH(ifp); - ifp->if_start = adsl_sppp_tx; + ifp->if_start = adsl_sppp_tx; #else ifp->type = ARPHRD_PPP; ifp->flags |= IFF_POINTOPOINT; @@ -489,28 +597,29 @@ static int new_if (wan_device_t* wandev, netdevice_t* ifp, wanif_conf_t* conf) ifp->do_ioctl = adsl_ioctl; #endif break; +#endif /* #if !defined(__WINDOWS__) */ default: DEBUG_EVENT("%s: Error invalid EncapMode %i\n", - card->devname,card->u.adsl.EncapMode); + card->devname,card->u.adsl.EncapMode); del_if(wandev,ifp); return -EINVAL; } - + wan_getcurrenttime(&adsl->router_start_time, NULL); - return 0; + return 0; } static int del_if (wan_device_t* wandev, netdevice_t* ifp) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; adsl_private_area_t* adsl = wan_netif_priv(ifp); WAN_ASSERT(adsl == NULL); - + DEBUG_EVENT("%s: Deleting Interface %s\n", - card->devname, wan_netif_name(ifp)); + card->devname, wan_netif_name(ifp)); if (adsl->pAdapter != NULL){ adsl_del_if(adsl->pAdapter); @@ -522,50 +631,55 @@ static int del_if (wan_device_t* wandev, netdevice_t* ifp) } card->u.adsl.adapter = NULL; adsl->pAdapter = NULL; - - /* Initialize interrupt handler pointer */ - card->isr = NULL; + /* Initialize interrupt handler pointer */ + card->isr = NULL; +#if defined(__WINDOWS__) + disconnect_from_interrupt_line(card); +#else /* Initialize network interface */ if (card->u.adsl.EncapMode == RFC_MODE_PPP_VC || - card->u.adsl.EncapMode == RFC_MODE_PPP_LLC){ + card->u.adsl.EncapMode == RFC_MODE_PPP_LLC){ - DEBUG_EVENT("%s: Detaching SPPP protocol \n", card->devname); + DEBUG_EVENT("%s: Detaching SPPP protocol \n", card->devname); #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) - WAN_SPPP_FLUSH(ifp); - WAN_SPPP_DETACH(ifp); + WAN_SPPP_FLUSH(ifp); + WAN_SPPP_DETACH(ifp); #else - if (adsl->common.prot_ptr){ - wp_sppp_detach(ifp); + if (adsl->common.prot_ptr){ + wp_sppp_detach(ifp); - ifp->do_ioctl = NULL; + ifp->do_ioctl = NULL; + ifp->hard_header = NULL; + ifp->rebuild_header = NULL; - kfree(adsl->common.prot_ptr); - adsl->common.prot_ptr= NULL; - } + wan_free(adsl->common.prot_ptr); + adsl->common.prot_ptr= NULL; + } #endif } +#endif/* #if !defined(__WINDOWS__)*/ #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) #if 0 - ifp->if_output = NULL; - ifp->if_start = NULL; - ifp->if_ioctl = NULL; - ifp->if_watchdog= NULL; + ifp->if_output = NULL; + ifp->if_start = NULL; + ifp->if_ioctl = NULL; + ifp->if_watchdog= NULL; # if defined(__NetBSD__) || defined(__FreeBSD__) - ifp->if_init = NULL; + ifp->if_init = NULL; # endif - ifp->if_flags &= ~(IFF_UP | IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - if (ifp->if_softc){ - wan_free(ifp->if_softc); - ifp->if_softc = NULL; - } + ifp->if_flags &= ~(IFF_UP | IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + if (ifp->if_softc){ + wan_free(ifp->if_softc); + ifp->if_softc = NULL; + } #endif #else ifp->irq = 0; - ifp->mem_start = 0; - ifp->mem_end = 0; + ifp->mem_start = 0; + ifp->mem_end = 0; /* Private structure will be free later */ wan_netif_del(ifp); #endif @@ -574,23 +688,25 @@ static int del_if (wan_device_t* wandev, netdevice_t* ifp) } /*+F************************************************************************* - * Function: - * adsl_init - * - * Description: - *-F*************************************************************************/ +* Function: +* adsl_init +* +* Description: +*-F*************************************************************************/ #if defined(__FreeBSD__) static void adsl_init(void* priv){ return; } #elif defined(__NetBSD__) static int adsl_init(netdevice_t* dev){return 0; } +#elif defined(__WINDOWS__) +static int adsl_init(netdevice_t* dev){return 0; } #endif /*+F************************************************************************* - * Function: - * adsl_vcivpi_update - * - * Description: - *-F*************************************************************************/ +* Function: +* adsl_vcivpi_update +* +* Description: +*-F*************************************************************************/ void adsl_vcivpi_update(sdla_t* card, wandev_conf_t* conf) { wan_adsl_conf_t* adsl_conf = &conf->u.adsl; @@ -601,54 +717,56 @@ void adsl_vcivpi_update(sdla_t* card, wandev_conf_t* conf) adsl_conf->vcivpi_list[x].vpi = adsl_vcivpi_list[x].vpi; } - adsl_conf->vcivpi_num = adsl_vcivpi_num; + adsl_conf->vcivpi_num = (unsigned short)adsl_vcivpi_num; } /*+F************************************************************************* - * Function: - * disable_comm - * - * Description: - * Called by the LAN subsystem when the ethernet interface is - * configured make ready to accept data (ifconfig up). - *-F*************************************************************************/ +* Function: +* disable_comm +* +* Description: +* Called by the LAN subsystem when the ethernet interface is +* configured make ready to accept data (ifconfig up). +*-F*************************************************************************/ static void disable_comm(sdla_t* card) { char wan; if (!card->u.adsl.adapter) return; - - wan = adsl_wan_interface_type(card->u.adsl.adapter); - + + wan = (char)adsl_wan_interface_type(card->u.adsl.adapter); + adsl_disable_comm(card->u.adsl.adapter); card->u.adsl.adapter = NULL; if (wan){ +#if !defined(__WINDOWS__) #if !defined(LINUX_2_6) MOD_DEC_USE_COUNT; +#endif #endif } } #if defined(__LINUX__) /*+F************************************************************************* - * Function: - * adsl_tx_timeout - * - * Description: - * Handle transmit timeout event from netif watchdog - *-F*************************************************************************/ +* Function: +* adsl_tx_timeout +* +* Description: +* Handle transmit timeout event from netif watchdog +*-F*************************************************************************/ static void adsl_tx_timeout (netdevice_t *dev) { - adsl_private_area_t* adsl = wan_netif_priv(dev); + adsl_private_area_t* adsl = wan_netif_priv(dev); sdla_t* card = adsl->common.card; /* If our device stays busy for at least 5 seconds then we will - * kick start the device by making dev->tbusy = 0. We expect - * that our device never stays busy more than 5 seconds. So this - * is only used as a last resort. - */ + * kick start the device by making dev->tbusy = 0. We expect + * that our device never stays busy more than 5 seconds. So this + * is only used as a last resort. + */ #if defined(__LINUX__) dev->trans_start = SYSTEM_TICKS; #endif @@ -660,19 +778,18 @@ static void adsl_tx_timeout (netdevice_t *dev) } /*+F************************************************************************* - * Function: - * adsl_open - * - * Description: - * Called by the LAN subsystem when the ethernet interface is configured - * make ready to accept data (ifconfig up). - *-F*************************************************************************/ +* Function: +* adsl_open +* +* Description: +* Called by the LAN subsystem when the ethernet interface is configured +* make ready to accept data (ifconfig up). +*-F*************************************************************************/ static int adsl_open(netdevice_t* ifp) { int status = 0; -#if defined (__LINUX__) adsl_private_area_t* adsl = wan_netif_priv(ifp); -#endif + sdla_t* card = adsl->common.card; #if defined (__LINUX__) if (adsl->common.prot_ptr){ @@ -681,19 +798,25 @@ static int adsl_open(netdevice_t* ifp) } } #endif - + /* Start Tx queuing */ WAN_NETDEVICE_START(ifp); - WAN_NETIF_START_QUEUE(ifp); + if (card->wandev.state == WAN_CONNECTED) { + WAN_NETIF_CARRIER_ON(ifp); + WAN_NETIF_START_QUEUE(ifp); + } else { + WAN_NETIF_CARRIER_OFF(ifp); + WAN_NETIF_STOP_QUEUE(ifp); + } if (adsl->common.usedby == STACK){ /* Force the lip to connect state - * since there is no state change - * mechanism for an interface - * FIXME: This is temporary */ + * since there is no state change + * mechanism for an interface + * FIXME: This is temporary */ wanpipe_lip_connect(adsl,0); } - + #if !defined(LINUX_2_6) MOD_INC_USE_COUNT; #endif @@ -701,13 +824,13 @@ static int adsl_open(netdevice_t* ifp) } /*+F************************************************************************* - * Function: - * adsl_close - * - * Description: - * Called by the LAN subsystem when the ethernet interface is disabled - * (ifconfig down). - *-F*************************************************************************/ +* Function: +* adsl_close +* +* Description: +* Called by the LAN subsystem when the ethernet interface is disabled +* (ifconfig down). +*-F*************************************************************************/ int adsl_close(netdevice_t* ifp) { int status = 0; @@ -731,47 +854,117 @@ int adsl_close(netdevice_t* ifp) #endif return status; } +#elif defined(__WINDOWS__) +/*+F************************************************************************* +* Function: +* adsl_tx_timeout +* +* Description: +* Handle transmit timeout event from netif watchdog +*-F*************************************************************************/ +static void adsl_tx_timeout (netdevice_t *dev) +{ + adsl_private_area_t* adsl = wan_netif_priv(dev); + sdla_t* card = adsl->common.card; + + DBG_DSL_NOT_IMPLD + + /* If our device stays busy for at least 5 seconds then we will + * kick start the device by making dev->tbusy = 0. We expect + * that our device never stays busy more than 5 seconds. So this + * is only used as a last resort. + */ + /* + dev->trans_start = SYSTEM_TICKS; + card->wandev.stats.collisions++; + + adsl_timeout(card->u.adsl.adapter); + WAN_NETIF_WAKE_QUEUE(dev); + */ +} + +/*+F************************************************************************* +* Function: +* adsl_open +* +* Description: +* Called by the LAN subsystem when the ethernet interface is configured +* make ready to accept data (ifconfig up). +*-F*************************************************************************/ +static int adsl_open(netdevice_t* ifp) +{ + int status = 0; + + DBG_DSL_NOT_IMPLD +#if defined (__LINUX__) + adsl_private_area_t* adsl = wan_netif_priv(ifp); +#endif + return status; +} + +/*+F************************************************************************* +* Function: +* adsl_close +* +* Description: +* Called by the LAN subsystem when the ethernet interface is disabled +* (ifconfig down). +*-F*************************************************************************/ +int adsl_close(netdevice_t* ifp) +{ + int status = 0; +#if defined (__LINUX__) + adsl_private_area_t* adsl = wan_netif_priv(ifp); +#endif + DBG_DSL_NOT_IMPLD + + return status; +} #endif /*+F************************************************************************* - * Function: - * wpa_isr - * - * Description: - *-F*************************************************************************/ +* Function: +* wpa_isr +* +* Description: +*-F*************************************************************************/ static WAN_IRQ_RETVAL wpa_isr (sdla_t* card) { int ret; + + DEBUG_ISR("%s()\n", __FUNCTION__); + if (!card->u.adsl.adapter){ DEBUG_CFG("wpa_isr: No adapter ptr!\n"); WAN_IRQ_RETURN(WAN_IRQ_NONE); } /*WAN_ASSERT1(card->u.adsl.adapter == NULL);*/ ret=adsl_isr((void*)card->u.adsl.adapter); + DEBUG_ISR("%s(): ret: %d\n", __FUNCTION__, ret); if (ret) { - WAN_IRQ_RETURN(WAN_IRQ_HANDLED); + WAN_IRQ_RETURN(WAN_IRQ_HANDLED); } - + WAN_IRQ_RETURN(WAN_IRQ_NONE); } /*+F************************************************************************* - * Function: - * adsl_lan_rx - * - * Description: - * A new LAN receive packet is available. Create a SKB for the data, and - * give it to the operating system. - *-F*************************************************************************/ +* Function: +* adsl_lan_rx +* +* Description: +* A new LAN receive packet is available. Create a SKB for the data, and +* give it to the operating system. +*-F*************************************************************************/ void adsl_lan_rx( - void* dev_id, - void* pHeader, - unsigned long headerSize, - unsigned char* rx_data, - int rx_len - ) + void* dev_id, + void* pHeader, + unsigned long headerSize, + unsigned char* rx_data, + int rx_len + ) { netdevice_t* dev = (netdevice_t*)dev_id; sdla_t* card = NULL; @@ -791,44 +984,76 @@ adsl_lan_rx( WAN_ASSERT1(dev == NULL); WAN_ASSERT1(adsl == NULL); card = (sdla_t*)adsl->common.card; - DEBUG_RX("(RX INTR) pHeader, (%p)\n", pHeader); - DEBUG_RX("(RX INTR) headerSize, %ld\n", headerSize); - DEBUG_RX("(RX INTR) rx_len, %d\n", rx_len); + DEBUG_RX("(RX INTR) pHeader, (%p)\n", pHeader); + DEBUG_RX("(RX INTR) headerSize, %ld\n", headerSize); + DEBUG_RX("(RX INTR) rx_len, %d\n", rx_len); - len = headerSize + rx_len; +#if defined(__WINDOWS__) + //DBG_ADSL_RX("(RX INTR) pHeader, (%p)\n", pHeader); //for rfc 1483 always zero + //DBG_ADSL_RX("(RX INTR) headerSize, %ld\n", headerSize); //for rfc 1483 always zero + DBG_ADSL_RX("(RX INTR) rx_len, %d\n", rx_len); + + len = rx_len; +#else + len = headerSize + rx_len; +#endif if (len == 0) return; +#if defined(__WINDOWS__) + rx_skb = wan_skb_alloc(len); +#else rx_skb = wan_skb_alloc(len+4); +#endif if (rx_skb == NULL){ DEBUG_EVENT("%s: Failed allocate memory for RX packet!\n", - wan_netif_name(dev)); + wan_netif_name(dev)); return; } - wan_skb_reserve(rx_skb, 2); - wan_skb_set_dev(rx_skb, dev); + +#if !defined(__WINDOWS__) + wpabs_skb_reserve(rx_skb, 2); + wpabs_skb_set_dev(rx_skb, dev); +#endif #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) eh = (struct ether_header*)wan_skb_data(rx_skb); #endif - if (card->u.adsl.EncapMode == RFC_MODE_PPP_VC || - card->u.adsl.EncapMode == RFC_MODE_PPP_LLC || - card->u.adsl.EncapMode == RFC_MODE_STACK_VC){ - if (rx_data[0] != hdr[0] || rx_data[1] != hdr[1]){ - wan_skb_copyback(rx_skb, - wan_skb_len(rx_skb), - 2, - (caddr_t)hdr); - } - } - - if (pHeader && headerSize){ - wan_skb_copyback(rx_skb, - wan_skb_len(rx_skb), - headerSize, - (caddr_t)pHeader); - } - wan_skb_copyback(rx_skb, wan_skb_len(rx_skb), len, (caddr_t)rx_data); +#if !defined(__WINDOWS__) + if (card->u.adsl.EncapMode == RFC_MODE_PPP_VC || + card->u.adsl.EncapMode == RFC_MODE_PPP_LLC || + card->u.adsl.EncapMode == RFC_MODE_STACK_VC ){ + + if (rx_data[0] != hdr[0] || rx_data[1] != hdr[1]){ + wpabs_skb_copyback(rx_skb, + wan_skb_len(rx_skb), + 2, +# if defined(__LINUX__) + (unsigned long)hdr); +# else + (caddr_t)hdr); +# endif + } + } +#endif + + if (pHeader && headerSize){ + wpabs_skb_copyback(rx_skb, + wan_skb_len(rx_skb), + headerSize, +#if defined(__LINUX__) + (unsigned long)pHeader); +#else + (caddr_t)pHeader); +#endif + } + +#if defined(__LINUX__) + wpabs_skb_copyback(rx_skb, wan_skb_len(rx_skb), len, (unsigned long)rx_data); +#else + wpabs_skb_copyback(rx_skb, wan_skb_len(rx_skb), len, (caddr_t)rx_data); +#endif + #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) # if defined(__FreeBSD__) && (__FreeBSD_version < 500000) @@ -841,7 +1066,6 @@ adsl_lan_rx( card->wandev.stats.rx_bytes += wan_skb_len(rx_skb); switch(card->u.adsl.EncapMode){ - case RFC_MODE_STACK_VC: if (wanpipe_lip_rx(adsl,rx_skb) != 0){ card->wandev.stats.rx_packets--; @@ -849,7 +1073,7 @@ adsl_lan_rx( wan_skb_free(rx_skb); } break; - + case RFC_MODE_PPP_VC: case RFC_MODE_PPP_LLC: wan_skb_clear_mark(rx_skb); @@ -866,13 +1090,13 @@ adsl_lan_rx( schednetisr(NETISR_IP); if (IF_QFULL(&ipintrq)){ DEBUG_RX("%s: IP queue is full, drop packet!\n", - card->devname); + card->devname); /* oh, no - IP queue is full - well - we'll ** try again later */ card->wandev.stats.rx_packets--; card->wandev.stats.rx_bytes -= wan_skb_len(rx_skb); - + IF_DROP(&ipintrq); wan_skb_free(rx_skb); wan_spin_unlock_irq(NULL, &s); @@ -895,14 +1119,15 @@ adsl_lan_rx( # endif break; } - -#else /* LINUX */ + +#else /* LINUX, WINDOWS */ card->wandev.stats.rx_packets ++; card->wandev.stats.rx_bytes += wan_skb_len(rx_skb); switch (card->u.adsl.EncapMode){ +#if !defined(__WINDOWS__) case RFC_MODE_STACK_VC: if (wanpipe_lip_rx(adsl,rx_skb) != 0){ card->wandev.stats.rx_packets--; @@ -910,29 +1135,41 @@ adsl_lan_rx( wan_skb_free(rx_skb); } break; - +#endif + case RFC_MODE_BRIDGED_ETH_LLC: case RFC_MODE_BRIDGED_ETH_VC: +#if defined(__WINDOWS__) + netif_rx(dev, rx_skb); +#else rx_skb->protocol = eth_type_trans(rx_skb, rx_skb->dev); netif_rx(rx_skb); +#endif break; + case RFC_MODE_ROUTED_IP_LLC: case RFC_MODE_ROUTED_IP_VC: +#if defined(__WINDOWS__) + netif_rx(dev, rx_skb); +#else rx_skb->protocol = htons(ETH_P_IP); - wan_skb_reset_mac_header(rx_skb); + __wan_skb_reset_mac_header(rx_skb); netif_rx(rx_skb); +#endif break; - + +#if !defined(__WINDOWS__) case RFC_MODE_PPP_VC: case RFC_MODE_PPP_LLC: rx_skb->protocol = htons(ETH_P_WAN_PPP); - rx_skb->dev = dev; - wan_skb_reset_mac_header(rx_skb); + rx_skb->dev = dev; + __wan_skb_reset_mac_header(rx_skb); wp_sppp_input(rx_skb->dev,rx_skb); break; +#endif } - + #endif @@ -940,14 +1177,14 @@ adsl_lan_rx( } /*+F************************************************************************* - * Function: - * adsl_output - * - * Description: - * Handle a LAN interface buffer (SKB) transmit request. Allocate an NDIS - * buffer, copy the data into the NDIS packet, and give it to the RFC layer. - *-F*************************************************************************/ -#if defined(__LINUX__) +* Function: +* adsl_output +* +* Description: +* Handle a LAN interface buffer (SKB) transmit request. Allocate an NDIS +* buffer, copy the data into the NDIS packet, and give it to the RFC layer. +*-F*************************************************************************/ +#if defined(__LINUX__) || defined(__WINDOWS__) int adsl_output(netskb_t* skb, netdevice_t* dev) #else static int @@ -955,41 +1192,42 @@ adsl_output(netdevice_t* dev, netskb_t* skb, struct sockaddr* dst, struct rtentr #endif { sdla_t* card = NULL; - adsl_private_area_t* adsl = wan_netif_priv(dev); - int status = 0; -#if defined(__LINUX__) + adsl_private_area_t* adsl = wan_netif_priv(dev); + int status = 0; +#if defined(__LINUX__) || defined(__WINDOWS__) unsigned long smp_flags; #endif #if defined(ALTQ) WAN_PKTATTR_DECL(pktattr); #endif - - if (!skb){ + + if (!skb){ WAN_NETIF_START_QUEUE(dev); return 0; - } + } - if (!adsl){ + if (!adsl){ DEBUG_EVENT("%s: Error: TxLan: No private adapter !\n", wan_netif_name(dev)); -#if defined(__LINUX__) +#if defined(__LINUX__) || defined(__WINDOWS__) wan_skb_free(skb); #endif WAN_NETIF_START_QUEUE(dev); return 0; - } + } card = (sdla_t*)adsl->common.card; - switch (card->u.adsl.EncapMode){ - +#if !defined(__WINDOWS__) + switch (card->u.adsl.EncapMode) + { case RFC_MODE_PPP_VC: case RFC_MODE_PPP_LLC: case RFC_MODE_STACK_VC: - if (wan_skb_len(skb) <= 2){ DEBUG_EVENT("%s: Error: TxLan: PPP pkt len <= 2! (len=%i)\n", wan_netif_name(dev),wan_skb_len(skb)); + wan_skb_print(skb); wan_skb_free(skb); WAN_NETIF_START_QUEUE(dev); @@ -998,24 +1236,25 @@ adsl_output(netdevice_t* dev, netskb_t* skb, struct sockaddr* dst, struct rtentr } wan_skb_pull(skb,2); break; - } - - if (adsl_can_tx(adsl->pAdapter)){ - wan_skb_free(skb); + }/* switch() */ +#endif + + if (adsl_can_tx(adsl->pAdapter)){ + wpabs_skb_free(skb); WAN_NETIF_START_QUEUE(dev); card->wandev.stats.tx_carrier_errors++; -#if defined(__LINUX__) +#if defined(__LINUX__) || defined(__WINDOWS__) dev->trans_start = SYSTEM_TICKS; return 0; #else return -EINVAL; #endif } - + DEBUG_TX("%s: TxLan %d bytes...\n", - card->devname, wan_skb_len(skb)); - - + card->devname, wan_skb_len(skb)); + + #if 0 DBG_ASSERT(skb->len < GSI_LAN_NDIS_BUFFER_SIZE); @@ -1029,12 +1268,12 @@ adsl_output(netdevice_t* dev, netskb_t* skb, struct sockaddr* dst, struct rtentr printk("\n"); } #endif - + #if defined(__LINUX__) dev->trans_start = SYSTEM_TICKS; status = adsl_send(adsl->pAdapter, skb, 0); wan_spin_lock_irq(&card->wandev.lock,&smp_flags); - if (status == 1){ + if (status == 1){ WAN_NETIF_STOP_QUEUE(dev); wan_set_bit(TX_BUSY_SET,&card->wandev.critical); status = 1; @@ -1047,10 +1286,31 @@ adsl_output(netdevice_t* dev, netskb_t* skb, struct sockaddr* dst, struct rtentr status = 0; } wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); +#elif defined(__WINDOWS__) + dev->trans_start = SYSTEM_TICKS; + status = adsl_send(adsl->pAdapter, skb, 0); + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); + if (status == 1){ + WAN_NETIF_STOP_QUEUE(dev); + wan_set_bit(TX_BUSY_SET,&card->wandev.critical); + status = 1; + }else{ + if (status == 2){ + card->wandev.stats.rx_dropped++; + } +// wpabs_skb_free(skb);//can NOT deallocate memory inside IRQ Lock!!! + WAN_NETIF_START_QUEUE(dev); + status = 0; + } + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + + if(status == 0){ + wpabs_skb_free(skb); + } #else if (dst->sa_family != AF_INET){ DEBUG_EVENT("%s: Protocol family is not supported!\n", - card->devname); + card->devname); wan_skb_free(skb); return -EAFNOSUPPORT; } @@ -1069,7 +1329,7 @@ adsl_output(netdevice_t* dev, netskb_t* skb, struct sockaddr* dst, struct rtentr WAN_IFQ_ENQUEUE(&dev->if_snd, skb, &pktattr, status); if (status){ DEBUG_TX("%s: Send queue is full!\n", - card->devname); + card->devname); wan_skb_free(skb); break; } @@ -1088,30 +1348,30 @@ adsl_output(netdevice_t* dev, netskb_t* skb, struct sockaddr* dst, struct rtentr break; } #endif - return status; + return status; } - + #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) /*+F************************************************************************* - * Function: - * adsl_sppp_tx - * - * Description: - * Handle a LAN interface buffer (SKB) transmit request. Allocate an NDIS - * buffer, copy the data into the NDIS packet, and give it to the RFC layer. - *-F*************************************************************************/ +* Function: +* adsl_sppp_tx +* +* Description: +* Handle a LAN interface buffer (SKB) transmit request. Allocate an NDIS +* buffer, copy the data into the NDIS packet, and give it to the RFC layer. +*-F*************************************************************************/ void adsl_sppp_tx (netdevice_t *ifp) { netskb_t* tx_mbuf = NULL; - adsl_private_area_t* adsl = wan_netif_priv(ifp); - + adsl_private_area_t* adsl = wan_netif_priv(ifp); + WAN_ASSERT1(ifp == NULL); WAN_ASSERT1(adsl == NULL); - if (adsl_can_tx(adsl->pAdapter)){ + if (adsl_can_tx(adsl->pAdapter)){ return; } - - while((tx_mbuf = WAN_SPPP_DEQUEUE(ifp)) != NULL){ + + while((tx_mbuf = WAN_SPPP_DEQUEUE(ifp)) != NULL){ #if 0 if (wan_skb_check(tx_mbuf)){ #endif @@ -1125,14 +1385,14 @@ void adsl_sppp_tx (netdevice_t *ifp) } #endif DEBUG_TX("%s: TxLan %d bytes...\n", - wan_netif_name(ifp), - wan_skb_len(tx_mbuf)); + wan_netif_name(ifp), + wan_skb_len(tx_mbuf)); wan_bpf_report(ifp, tx_mbuf, 0, WAN_BPF_DIR_OUT); wan_skb_pull(tx_mbuf, 2); if (adsl_send(adsl->pAdapter, tx_mbuf, 0)){ DEBUG_TX("%s: TX failed to send %d bytes!\n", - wan_netif_name(ifp), - wan_skb_len(tx_mbuf)); + wan_netif_name(ifp), + wan_skb_len(tx_mbuf)); ifp->if_iqdrops++; } @@ -1141,25 +1401,25 @@ void adsl_sppp_tx (netdevice_t *ifp) } } - return; + return; } /*+F************************************************************************* - * Function: - * adsl_tx - * - * Description: - * Handle a LAN interface buffer (SKB) transmit request. Allocate an NDIS - * buffer, copy the data into the NDIS packet, and give it to the RFC layer. - *-F*************************************************************************/ +* Function: +* adsl_tx +* +* Description: +* Handle a LAN interface buffer (SKB) transmit request. Allocate an NDIS +* buffer, copy the data into the NDIS packet, and give it to the RFC layer. +*-F*************************************************************************/ void adsl_tx (netdevice_t *ifp) { netskb_t* tx_mbuf = NULL; - adsl_private_area_t* adsl = wan_netif_priv(ifp); + adsl_private_area_t* adsl = wan_netif_priv(ifp); #if 0 sdla_t* card = NULL; #endif - + WAN_ASSERT1(ifp == NULL); WAN_ASSERT1(adsl == NULL); WAN_ASSERT1(adsl->common.card == NULL); @@ -1167,15 +1427,15 @@ void adsl_tx (netdevice_t *ifp) #if defined(NETGRAPH) #if 0 card = adsl->card; - while(!WAN_IFQ_IS_EMPTY(&card->xmitq_hipri)){ + while(!WAN_IFQ_IS_EMPTY(&card->xmitq_hipri)){ WAN_IFQ_POLL(&card->xmitq_hipri, tx_mbuf); if (tx_mbuf == NULL) break; DEBUG_TX("%s: TxLan %d bytes...\n", - wan_netif_name(ifp), wan_skb_len(tx_mbuf)); + wan_netif_name(ifp), wan_skb_len(tx_mbuf)); if (adsl_send(adsl->pAdapter, tx_mbuf, 0)){ DEBUG_TX("%s: TX failed to send %d bytes!\n", wan_netif_name(ifp), wan_skb_len(tx_mbuf)); - } + } WAN_IFQ_DEQUEUE(&card->xmitq_hipri, tx_mbuf); if (tx_mbuf){ @@ -1184,7 +1444,7 @@ void adsl_tx (netdevice_t *ifp) } #endif #endif - while(!WAN_IFQ_IS_EMPTY(&ifp->if_snd)){ + while(!WAN_IFQ_IS_EMPTY(&ifp->if_snd)){ WAN_IFQ_DEQUEUE(&ifp->if_snd, tx_mbuf); if (tx_mbuf == NULL) break; @@ -1203,31 +1463,31 @@ void adsl_tx (netdevice_t *ifp) #endif DEBUG_TX("%s: TxLan %d bytes...\n", - wan_netif_name(ifp), - wan_skb_len(tx_mbuf)); - if (adsl_send(adsl->pAdapter, tx_mbuf, 0)){ + wan_netif_name(ifp), + wan_skb_len(tx_mbuf)); + if (adsl_send(adsl->pAdapter, tx_mbuf, 0)){ DEBUG_TX("%s: TX failed to send %d bytes!\n", - wan_netif_name(ifp), - wan_skb_len(tx_mbuf)); + wan_netif_name(ifp), + wan_skb_len(tx_mbuf)); ifp->if_iqdrops++; } - + wan_bpf_report(ifp, tx_mbuf, 0, WAN_BPF_DIR_OUT); if (tx_mbuf){ wan_skb_free(tx_mbuf); } } - return; + return; } #endif /*+F************************************************************************* - * Function: - * aadsl_tx_complete - * - * Description: - *-F*************************************************************************/ +* Function: +* aadsl_tx_complete +* +* Description: +*-F*************************************************************************/ void adsl_tx_complete(void* dev_id, int length, int txStatus) { netdevice_t* ifp = (netdevice_t*)dev_id; @@ -1238,119 +1498,123 @@ void adsl_tx_complete(void* dev_id, int length, int txStatus) adsl = wan_netif_priv(ifp); WAN_ASSERT1(adsl == NULL); - + card = (sdla_t*)adsl->common.card; WAN_ASSERT1(card == NULL); - - if (txStatus == 0){ + + if (txStatus == 0){ DEBUG_TX("%s: TxLan tx successful.\n", - wan_netif_name(ifp)); + wan_netif_name(ifp)); #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) - ifp->if_opackets++; - ifp->if_obytes += length; + ifp->if_opackets++; + ifp->if_obytes += length; #endif card->wandev.stats.tx_packets ++; card->wandev.stats.tx_bytes += length; - }else{ + }else{ DEBUG_TX("%s: TxLan tx failure.\n", - wan_netif_name(ifp)); + wan_netif_name(ifp)); #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) - ifp->if_oerrors++; + ifp->if_oerrors++; #endif - } + } -#if defined(__LINUX__) +#if defined(__LINUX__) || defined(__WINDOWS__) ifp->trans_start = SYSTEM_TICKS; #endif +#if defined(__WINDOWS__) + wan_clear_bit(TX_BUSY_SET,&card->wandev.critical); + WAN_NETIF_WAKE_QUEUE(ifp); +#else if (WAN_NETIF_QUEUE_STOPPED(ifp) || - wan_test_bit(TX_BUSY_SET,&card->wandev.critical)){ - - wan_clear_bit(TX_BUSY_SET,&card->wandev.critical); - DEBUG_TX("%s: adsl_tx_complete, waking dev %s\n", - card->devname, wan_netif_name(ifp)); - WAN_NETIF_WAKE_QUEUE(ifp); + wan_test_bit(TX_BUSY_SET,&card->wandev.critical)){ - if (adsl->common.usedby == STACK){ - wanpipe_lip_kick(adsl,0); - } + wan_clear_bit(TX_BUSY_SET,&card->wandev.critical); + DEBUG_TX("%s: adsl_tx_complete, waking dev %s\n", + card->devname, wan_netif_name(ifp)); + WAN_NETIF_WAKE_QUEUE(ifp); + if (adsl->common.usedby == STACK){ + wanpipe_lip_kick(adsl,0); + } } - return ; +#endif + return ; } #if defined(__LINUX__) /*+F************************************************************************* - * Function: - * adsl_multicast - * - * Description: - * Handle the LAN subsystem multicast, broadcast, and promiscous updates. - * These values can be modified by using the ifconfig command or other - * applications like network sniffers. - *-F*************************************************************************/ +* Function: +* adsl_multicast +* +* Description: +* Handle the LAN subsystem multicast, broadcast, and promiscous updates. +* These values can be modified by using the ifconfig command or other +* applications like network sniffers. +*-F*************************************************************************/ static void adsl_multicast(netdevice_t* dev) { - adsl_private_area_t* adsl = wan_netif_priv(dev); + adsl_private_area_t* adsl = wan_netif_priv(dev); short flags = wan_netif_flags(dev); int mcount = wan_netif_mcount(dev); char* mcaddrs = NULL; WAN_ASSERT1(adsl == NULL); - - DEBUG_TX("%s: IF Flags: %s%s%s%s!\n", + + DEBUG_TX("%s: IF Flags: %s%s%s%s!\n", adsl->if_name, (flags & IFF_BROADCAST) ? "Broadcast " : "", - (flags & IFF_PROMISC) ? "Promiscous " : "", - (flags & IFF_MULTICAST) ? "Multicast " : "", - (flags & IFF_ALLMULTI) ? "All-Multicast" : ""); - - DEBUG_TX("%s: HwAddr: %02x:%02x:%02x:%02x:%02x:%02x\n", - adsl->if_name, + (flags & IFF_PROMISC) ? "Promiscous " : "", + (flags & IFF_MULTICAST) ? "Multicast " : "", + (flags & IFF_ALLMULTI) ? "All-Multicast" : ""); + + DEBUG_TX("%s: HwAddr: %02x:%02x:%02x:%02x:%02x:%02x\n", + adsl->if_name, adsl->macAddr[0], adsl->macAddr[1], adsl->macAddr[2], adsl->macAddr[3], adsl->macAddr[4], adsl->macAddr[5]); - - if ((flags & IFF_MULTICAST) && mcount != 0){ + + if ((flags & IFF_MULTICAST) && mcount != 0){ #if !defined(__OpenBSD__) # if defined(__FreeBSD__) struct ifmultiaddr* mclist = NULL; # else struct dev_mc_list* mclist = NULL; # endif - int x = 0; + int x = 0; mcaddrs = wan_malloc(mcount * 6); - for (mclist = LIST_FIRST_MCLIST(dev); + for (mclist = LIST_FIRST_MCLIST(dev); mclist != NULL; - x++, mclist = LIST_NEXT_MCLIST(mclist)){ + x++, mclist = LIST_NEXT_MCLIST(mclist)){ # if defined(__FreeBSD__) - memcpy(&(mcaddrs[x * 6]), (void*)mclist->ifma_addr, 6); + memcpy(&(mcaddrs[x * 6]), (void*)mclist->ifma_addr, 6); # else - memcpy(&(mcaddrs[x * 6]), mclist->dmi_addr, 6); + memcpy(&(mcaddrs[x * 6]), mclist->dmi_addr, 6); # endif - } + } #endif - } + } /*adsl_lan_multicast(adsl->pAdapter, flags, mcaddrs, mcount); */ - + if (mcaddrs){ wan_free(mcaddrs); } - return; + return; } /*+F************************************************************************* - * Function: - * GpLanStats - * - * Description: - * Return the current LAN device statistics. - * - * Note: For 2.6 kernels we are not allowed to return NULL - *-F*************************************************************************/ +* Function: +* GpLanStats +* +* Description: +* Return the current LAN device statistics. +* +* Note: For 2.6 kernels we are not allowed to return NULL +*-F*************************************************************************/ static struct net_device_stats gstats; static struct net_device_stats* adsl_stats(netdevice_t* dev) { @@ -1360,32 +1624,52 @@ static struct net_device_stats* adsl_stats(netdevice_t* dev) if (adsl == NULL){ return &gstats; } - + card = (sdla_t*)adsl->common.card; - + if (card == NULL){ return &gstats; } return &card->wandev.stats; } +#elif defined(__WINDOWS__) +static struct net_device_stats gstats; +static struct net_device_stats* adsl_stats(netdevice_t* dev) +{ + sdla_t* card = NULL; + adsl_private_area_t* adsl = wan_netif_priv(dev); + + if (adsl == NULL){ + return &gstats; + } + + card = (sdla_t*)adsl->common.card; + + if (card == NULL){ + return &gstats; + } + + return &card->wandev.stats; +} + #endif /*+F************************************************************************* - * Function: - * adsl_tracing_enabled - * - * Description: - * - * - *-F*************************************************************************/ +* Function: +* adsl_tracing_enabled +* +* Description: +* +* +*-F*************************************************************************/ int adsl_tracing_enabled(void *trace_ptr) { adsl_trace_info_t *trace_info = (adsl_trace_info_t*)trace_ptr; WAN_ASSERT(trace_info == NULL); if (wan_test_bit(0,&trace_info->tracing_enabled)){ - + if ((SYSTEM_TICKS - trace_info->trace_timeout) > MAX_TRACE_TIMEOUT){ DEBUG_EVENT("wanpipe: Disabling trace, timeout!\n"); wan_clear_bit(0,&trace_info->tracing_enabled); @@ -1404,8 +1688,8 @@ int adsl_tracing_enabled(void *trace_ptr) } DEBUG_UDP("wanpipe: Too many packet in trace queue %d (max=%d)!\n", - adsl_trace_queue_len(trace_info), - trace_info->max_trace_queue); + adsl_trace_queue_len(trace_info), + trace_info->max_trace_queue); return -ENOBUFS; } return -EINVAL; @@ -1452,7 +1736,7 @@ int adsl_trace_enqueue(void *trace_ptr, void *skb_ptr) return err; } -int adsl_trace_queue_len(void *trace_ptr) +unsigned int adsl_trace_queue_len(void *trace_ptr) { adsl_trace_info_t* trace = (adsl_trace_info_t *)trace_ptr; wan_skb_queue_t* trace_queue = NULL; @@ -1463,13 +1747,13 @@ int adsl_trace_queue_len(void *trace_ptr) } /*+F************************************************************************* - * Function: - * adsl_ioctl - * - * Description: - * - * - *-F*************************************************************************/ +* Function: +* adsl_ioctl +* +* Description: +* +* +*-F*************************************************************************/ #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) static int adsl_ioctl(netdevice_t* ifp, u_long command, caddr_t data) #else @@ -1480,76 +1764,77 @@ static int adsl_ioctl(netdevice_t* ifp, struct ifreq *ifr, int command) struct ifreq* ifr = (struct ifreq*)data; struct ifmediareq* ifmr = (struct ifmediareq*)data; struct ifaddr* ifa = (struct ifaddr *)data; - # if defined(__FreeBSD__) +# if defined(__FreeBSD__) struct ifstat* ifs = (struct ifstat *)data; # endif #endif adsl_private_area_t* adsl = wan_netif_priv(ifp); sdla_t* card = (sdla_t*)adsl->common.card; wan_udp_pkt_t* wan_udp_pkt = NULL; - int error = 0; + int error = 0; #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) wan_smp_flag_t s; - wan_spin_lock_irq(NULL, &s); + wan_spin_lock_irq(NULL, &s); #endif - switch (command){ + switch (command){ +#if !defined(__WINDOWS__) + case SIOC_WANPIPE_PIPEMON: + DEBUG_IOCTL("%s - ioctl(WANPIPE_PIPEMON) called.\n", card->devname); + if (wan_atomic_read(&adsl->udp_pkt_len) != 0){ + error = -EBUSY; + goto adsl_ioctl_done; + } - case SIOC_WANPIPE_PIPEMON: - DEBUG_IOCTL("%s - ioctl(WANPIPE_PIPEMON) called.\n", card->devname); - if (wan_atomic_read(&adsl->udp_pkt_len) != 0){ - error = -EBUSY; - goto adsl_ioctl_done; - } - - wan_atomic_set(&adsl->udp_pkt_len,sizeof(wan_udp_hdr_t)); - - /* For performance reasons test the critical - * here before spin lock */ - if (wan_test_bit(0,&card->in_isr)){ - wan_atomic_set(&adsl->udp_pkt_len,0); - error = -EBUSY; - goto adsl_ioctl_done; - } - - wan_udp_pkt=(wan_udp_pkt_t*)&adsl->udp_pkt_data[0]; - if (WAN_COPY_FROM_USER(&wan_udp_pkt->wan_udp_hdr,ifr->ifr_data,sizeof(wan_udp_hdr_t))){ - DEBUG_EVENT("%s: Error: Failed to copy memory from USER space!\n", - card->devname); - wan_atomic_set(&adsl->udp_pkt_len,0); - error = -EFAULT; - goto adsl_ioctl_done; - } + wan_atomic_set(&adsl->udp_pkt_len,sizeof(wan_udp_hdr_t)); - error = process_udp_cmd(ifp, &wan_udp_pkt->wan_udp_hdr); + /* For performance reasons test the critical + * here before spin lock */ + if (wan_test_bit(0,&card->in_isr)){ + wan_atomic_set(&adsl->udp_pkt_len,0); + error = -EBUSY; + goto adsl_ioctl_done; + } - /* This area will still be critical to other - * PIPEMON commands due to udp_pkt_len - * thus we can release the irq */ - - if (wan_atomic_read(&adsl->udp_pkt_len) > sizeof(wan_udp_pkt_t)){ - DEBUG_EVENT("%s: Error: Pipemon buf too big on the way up! %i\n", + wan_udp_pkt=(wan_udp_pkt_t*)&adsl->udp_pkt_data[0]; + if (WAN_COPY_FROM_USER(&wan_udp_pkt->wan_udp_hdr,ifr->ifr_data,sizeof(wan_udp_hdr_t))){ + DEBUG_EVENT("%s: Error: Failed to copy memory from USER space!\n", + card->devname); + wan_atomic_set(&adsl->udp_pkt_len,0); + error = -EFAULT; + goto adsl_ioctl_done; + } + + error = process_udp_cmd(ifp, &wan_udp_pkt->wan_udp_hdr); + + /* This area will still be critical to other + * PIPEMON commands due to udp_pkt_len + * thus we can release the irq */ + + if (wan_atomic_read(&adsl->udp_pkt_len) > sizeof(wan_udp_pkt_t)){ + DEBUG_EVENT("%s: Error: Pipemon buf too big on the way up! %i\n", card->devname,wan_atomic_read(&adsl->udp_pkt_len)); - wan_atomic_set(&adsl->udp_pkt_len,0); - error = -EINVAL; - goto adsl_ioctl_done; - } + wan_atomic_set(&adsl->udp_pkt_len,0); + error = -EINVAL; + goto adsl_ioctl_done; + } + + if (WAN_COPY_TO_USER(ifr->ifr_data,&wan_udp_pkt->wan_udp_hdr,sizeof(wan_udp_hdr_t))){ + DEBUG_EVENT("%s: Error: Failed to copy memory to USER space!\n", + card->devname); + wan_atomic_set(&adsl->udp_pkt_len,0); + error = -EFAULT; + goto adsl_ioctl_done; + } - if (WAN_COPY_TO_USER(ifr->ifr_data,&wan_udp_pkt->wan_udp_hdr,sizeof(wan_udp_hdr_t))){ - DEBUG_EVENT("%s: Error: Failed to copy memory to USER space!\n", - card->devname); wan_atomic_set(&adsl->udp_pkt_len,0); - error = -EFAULT; - goto adsl_ioctl_done; - } - - wan_atomic_set(&adsl->udp_pkt_len,0); - break; + break; +#endif #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) - case SIOCGIFMEDIA: - switch (card->u.adsl.EncapMode){ + case SIOCGIFMEDIA: + switch (card->u.adsl.EncapMode){ case RFC_MODE_BRIDGED_ETH_LLC: case RFC_MODE_BRIDGED_ETH_VC: ifmr->ifm_current = IFM_ETHER; @@ -1557,73 +1842,79 @@ static int adsl_ioctl(netdevice_t* ifp, struct ifreq *ifr, int command) default: error = -EOPNOTSUPP; goto adsl_ioctl_done; - } - ifmr->ifm_active = ifmr->ifm_current; - ifmr->ifm_mask = 0; - ifmr->ifm_status = 0; - ifmr->ifm_count = 1; - break; + } + ifmr->ifm_active = ifmr->ifm_current; + ifmr->ifm_mask = 0; + ifmr->ifm_status = 0; + ifmr->ifm_count = 1; + break; # if defined(__FreeBSD__) - case SIOCGIFSTATUS: - sprintf(ifs->ascii + strlen(ifs->ascii), - "\tstatus: %s\n", wanpipe_get_state_string(card)); - break; -# endif - case SIOCSIFMTU: - ifp->if_mtu = ifr->ifr_mtu; - break; - - case SIOCSIFADDR: - case SIOCGIFADDR: - if (card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_LLC || - card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_VC){ - error = ETHER_IOCTL(ifp, command, data); + case SIOCGIFSTATUS: + sprintf(ifs->ascii + strlen(ifs->ascii), + "\tstatus: %s\n", wanpipe_get_state_string(card)); break; - } else if (card->u.adsl.EncapMode == RFC_MODE_ROUTED_IP_LLC || - card->u.adsl.EncapMode == RFC_MODE_ROUTED_IP_VC){ - if (ifa->ifa_addr->sa_family == AF_INET){ +# endif + case SIOCSIFMTU: + ifp->if_mtu = ifr->ifr_mtu; + break; + + case SIOCSIFADDR: + case SIOCGIFADDR: + if (card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_LLC || + card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_VC){ + error = ETHER_IOCTL(ifp, command, data); break; - } - } - /* For all other modes fall through */ + } else if (card->u.adsl.EncapMode == RFC_MODE_ROUTED_IP_LLC || + card->u.adsl.EncapMode == RFC_MODE_ROUTED_IP_VC){ + if (ifa->ifa_addr->sa_family == AF_INET){ + break; + } + } + /* For all other modes fall through */ #endif - default: - if (card->u.adsl.EncapMode == RFC_MODE_PPP_VC || - card->u.adsl.EncapMode == RFC_MODE_PPP_LLC){ + default: + if (card->u.adsl.EncapMode == RFC_MODE_PPP_VC || + card->u.adsl.EncapMode == RFC_MODE_PPP_LLC){ #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) - error = WAN_SPPP_IOCTL(ifp, command, data); -#else - error = wp_sppp_do_ioctl(ifp,ifr,command); + error = WAN_SPPP_IOCTL(ifp, command, data); +#elif defined(__LINUX__) + error = wp_sppp_do_ioctl(ifp,ifr,command); +#elif defined(__WINDOWS__) + error = -EOPNOTSUPP; #endif - }else if (card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_LLC || - card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_VC){ + }else if (card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_LLC || + card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_VC){ #if defined(__LINUX__) - error = ETHER_IOCTL(ifp, command, data); + error = ETHER_IOCTL(ifp, command, data); #else - error = -EOPNOTSUPP; + error = -EOPNOTSUPP; #endif - }else{ - error = EINVAL; - } - break; /* NEW */ - } + }else{ + error = EINVAL; + } + break; /* NEW */ + } + +#if !defined(__WINDOWS__) adsl_ioctl_done: -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) - wan_spin_unlock_irq(NULL, &s); #endif - /* done */ - return error; + +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) + wan_spin_unlock_irq(NULL, &s); +#endif + /* done */ + return error; } #if defined(__LINUX__) /* FIXME update for BSD */ -# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -static void process_bh (void *dev_ptr) -#else +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) static void process_bh (struct work_struct *work) +#else +static void process_bh (void *dev_ptr) #endif { netdevice_t *dev; @@ -1646,10 +1937,145 @@ static void process_bh (struct work_struct *work) process_udp_mgmt_pkt(card, dev, adsl,0); } +#elif defined(__WINDOWS__) +VOID process_bh( + IN PKDPC Dpc, + IN PVOID arg, + IN PVOID not_used1, + IN PVOID not_used2 + ) +{ + DBG_DSL_NOT_IMPLD +} #endif +#if defined(__WINDOWS__) +static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* netdev, adsl_private_area_t* chan) +{ + unsigned short buffer_length; + wan_udp_pkt_t *wan_udp_pkt; +// struct timeval tv; + unsigned long tv; + wan_trace_t *trace_info=NULL; + unsigned long smp_flags; + struct sk_buff* skb; + DATA_QUEUE_ELEMENT* tmp_trace_q_el; + int rc = SANG_STATUS_SUCCESS; + wanif_conf_t *wanif_conf; + + wan_udp_pkt = (wan_udp_pkt_t*)chan->udp_pkt_data; + //trace_info = &chan->trace_info; + wanif_conf = netdev->wanif_conf; + + //copy from the user buffer + wpabs_memcpy(&wan_udp_pkt->wan_udp_hdr, netdev->mgmt_userbfr, + netdev->mgmt_userbfr_len); + + wan_udp_pkt->wan_udp_opp_flag = 0; + + switch(wan_udp_pkt->wan_udp_command) { + + case READ_CONFIGURATION: + DEBUG_UDP("READ_CONFIGURATION\n"); + { + if_cfg_t *if_cfg = (if_cfg_t*)wan_udp_pkt->wan_udp_data; + + DEBUG_UDP("usedby: %s\n", wanif_conf->usedby); + DEBUG_UDP("active_ch: 0x%08X\n", wanif_conf->active_ch); + + DEBUG_UDP("sizeof(wan_udp_hdr_t): %d, sizeof(wanif_conf_t): %d\n", + sizeof(wan_udp_hdr_t), sizeof(wanif_conf_t)); + + //DO NOT do this!! because "sizeof(wan_udp_hdr_t) < sizeof(wanif_conf_t)" + //so it will crash the system. Use "if_cfg_t" instead!! + //wpabs_memcpy(wan_udp_pkt->wan_udp_data, wanif_conf, sizeof(wanif_conf_t));//WRONG!!! + + _snprintf(if_cfg->usedby, USED_BY_FIELD, "%s", wanif_conf->usedby); + if_cfg->active_ch = wanif_conf->active_ch; + if_cfg->media = WAN_FE_MEDIA(&card->fe); + if_cfg->interface_number = netdev->interface_number; + } + + wan_udp_pkt->wan_udp_return_code = WAN_CMD_OK; + wan_udp_pkt->wan_udp_data_len = sizeof(wanif_conf_t); + break; + + case READ_CODE_VERSION: + wpabs_memcpy(wan_udp_pkt->wan_udp_data, &drv_version, sizeof(DRIVER_VERSION)); + wan_udp_pkt->wan_udp_return_code = WAN_CMD_OK; + wan_udp_pkt->wan_udp_data_len = sizeof(DRIVER_VERSION); + break; + + case GET_OPEN_HANDLES_COUNTER: + *(int*)&wan_udp_pkt->wan_udp_data[0] = netdev->open_handle_counter; + wan_udp_pkt->wan_udp_return_code = WAN_CMD_OK; + wan_udp_pkt->wan_udp_data_len = sizeof(int); + break; + + case ROUTER_UP_TIME: + wan_getcurrenttime( &tv, NULL ); + + chan->router_up_time = tv - chan->router_start_time; + *(unsigned long *)&wan_udp_pkt->wan_udp_data = + chan->router_up_time; + wan_udp_pkt->wan_udp_data_len = sizeof(unsigned long); + wan_udp_pkt->wan_udp_return_code = 0; + break; + + case READ_OPERATIONAL_STATS: + DEBUG_UDP("%s: READ_OPERATIONAL_STATS\n", netdev->name); + + wpabs_memcpy(wan_udp_pkt->wan_udp_data, &chan->if_stats, sizeof(net_device_stats_t)); + wan_udp_pkt->wan_udp_return_code = WAN_CMD_OK; + wan_udp_pkt->wan_udp_data_len = sizeof(net_device_stats_t); + break; + + case FLUSH_OPERATIONAL_STATS: + DEBUG_UDP("%s: FLUSH_OPERATIONAL_STATS\n", netdev->name); + + memset(&chan->if_stats, 0x00, sizeof(net_device_stats_t)); + wan_udp_pkt->wan_udp_return_code = WAN_CMD_OK; + wan_udp_pkt->wan_udp_data_len = sizeof(net_device_stats_t); + break; + + case WAN_GET_MEDIA_TYPE: + wan_udp_pkt->wan_udp_data[0] = WAN_MEDIA_NONE; + wan_udp_pkt->wan_udp_return_code = WAN_CMD_OK; + wan_udp_pkt->wan_udp_data_len = sizeof(unsigned char); + break; + + case WAN_GET_PROTOCOL: + DEBUG_UDP("%s: WAN_GET_PROTOCOL\n", netdev->name); + + wan_udp_pkt->wan_udp_data[0] = (unsigned char)card->wandev.config_id; + wan_udp_pkt->wan_udp_return_code = WAN_CMD_OK; + wan_udp_pkt->wan_udp_data_len = 1; + break; + + case WAN_GET_PLATFORM: + wan_udp_pkt->wan_udp_data[0] = WAN_WIN2K_PLATFORM; + wan_udp_pkt->wan_udp_return_code = WAN_CMD_OK; + wan_udp_pkt->wan_udp_data_len = 1; + break; + + default: + wan_udp_pkt->wan_udp_data_len = 0; + wan_udp_pkt->wan_udp_return_code = 0xCD; + DEBUG_EVENT( + "%s: Warning: Unknowd Management command: 0x%X\n", + netdev->name, wan_udp_pkt->wan_udp_command); + break; + }//end of switch + + //copy back to the user buffer + wpabs_memcpy(netdev->mgmt_userbfr, &wan_udp_pkt->wan_udp_hdr, + netdev->mgmt_userbfr_len); + return rc; +} + +#else static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, - adsl_private_area_t* adsl, int local_dev) + adsl_private_area_t* adsl, int local_dev) { wan_udp_pkt_t* wan_udp_pkt = NULL; netskb_t* new_skb = NULL; @@ -1665,61 +2091,61 @@ static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, if (local_dev){ return 0; } - + len = wan_reply_udp(card, adsl->udp_pkt_data, wan_udp_pkt->wan_udp_data_len); if (card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_LLC || - card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_VC){ - len += sizeof(ethhdr_t); + card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_VC){ + len += sizeof(ethhdr_t); } - + new_skb = wan_skb_alloc(len); if (new_skb != NULL){ wan_skb_set_dev(new_skb, dev); if (card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_LLC || - card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_VC){ - unsigned short ether_type = 0x0008; + card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_VC){ + unsigned short ether_type = 0x0008; - if (adsl->udp_pkt_src == UDP_PKT_FRM_NETWORK){ + if (adsl->udp_pkt_src == UDP_PKT_FRM_NETWORK){ + wan_skb_copyback(new_skb, + wan_skb_len(new_skb), + ETHER_ADDR_LEN, + &adsl->macAddr[0]); + wan_skb_copyback(new_skb, + wan_skb_len(new_skb), + ETHER_ADDR_LEN, + &adsl->remote_eth_addr[0]); + }else{ + wan_skb_copyback(new_skb, + wan_skb_len(new_skb), + ETHER_ADDR_LEN, + &adsl->remote_eth_addr[0]); + wan_skb_copyback(new_skb, + wan_skb_len(new_skb), + ETHER_ADDR_LEN, + &adsl->macAddr[0]); + } wan_skb_copyback(new_skb, - wan_skb_len(new_skb), - ETHER_ADDR_LEN, - &adsl->macAddr[0]); - wan_skb_copyback(new_skb, - wan_skb_len(new_skb), - ETHER_ADDR_LEN, - &adsl->remote_eth_addr[0]); - }else{ - wan_skb_copyback(new_skb, - wan_skb_len(new_skb), - ETHER_ADDR_LEN, - &adsl->remote_eth_addr[0]); - wan_skb_copyback(new_skb, - wan_skb_len(new_skb), - ETHER_ADDR_LEN, - &adsl->macAddr[0]); - } - wan_skb_copyback(new_skb, - wan_skb_len(new_skb), - sizeof(ether_type), - (caddr_t)ðer_type); - len -= sizeof(ethhdr_t); + wan_skb_len(new_skb), + sizeof(ether_type), + (caddr_t)ðer_type); + len -= sizeof(ethhdr_t); } - + /* copy data into new_skb */ wan_skb_copyback(new_skb, - wan_skb_len(new_skb), - len, - adsl->udp_pkt_data); + wan_skb_len(new_skb), + len, + adsl->udp_pkt_data); #if defined(__LINUX__) if (card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_LLC || - card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_VC){ - new_skb->protocol = eth_type_trans(new_skb, new_skb->dev); + card->u.adsl.EncapMode == RFC_MODE_BRIDGED_ETH_VC){ + new_skb->protocol = eth_type_trans(new_skb, new_skb->dev); }else{ /* Decapsulate pkt and pass it up the protocol stack */ new_skb->protocol = htons(ETH_P_IP); - wan_skb_reset_mac_header(new_skb); + __wan_skb_reset_mac_header(new_skb); } if (adsl->udp_pkt_src == UDP_PKT_FRM_NETWORK){ dev_queue_xmit(new_skb); @@ -1731,8 +2157,8 @@ static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, #if defined(__FreeBSD__) ether_output_frame(dev, new_skb); #else - wan_spinlock_t s; - wan_spin_lock_irq(NULL, &s); + wan_smp_flag_t s; + wan_spin_lock_irq(&card->wandev.lock, &s); WAN_IFQ_ENQUEUE(&dev->if_snd, new_skb, NULL, error); if (!error){ dev->if_obytes += wan_skb_len(new_skb) + sizeof(ethhdr_t); @@ -1740,7 +2166,7 @@ static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, (*dev->if_start)(dev); } } - wan_spin_unlock_irq(NULL, &s); + wan_spin_unlock_irq(&card->wandev.lock, &s); #endif }else{ # if defined(__OpenBSD__) || defined(__FreeBSD__) && (__FreeBSD_version <= 500000) @@ -1760,11 +2186,11 @@ static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, # endif } #endif - + }else{ - + DEBUG_EVENT("%s: no socket buffers available!\n", - card->devname); + card->devname); } wan_atomic_set(&adsl->udp_pkt_len,0); @@ -1772,34 +2198,33 @@ static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, } /* - * - * - */ - +* +* +*/ static int process_udp_cmd(netdevice_t* ifp, wan_udp_hdr_t* udp_hdr) { netskb_t* skb = NULL; - adsl_private_area_t* adsl = wan_netif_priv(ifp); - sdla_t* card = adsl->common.card; + adsl_private_area_t* adsl = wan_netif_priv(ifp); + sdla_t* card = adsl->common.card; int buffer_length=0; adsl_trace_info_t *trace_info = adsl_get_trace_ptr(adsl->pAdapter); - + udp_hdr->wan_udphdr_return_code=0; if (card->u.adsl.adapter == NULL){ return 0; } switch(udp_hdr->wan_udphdr_command){ - case WAN_GET_PROTOCOL: - udp_hdr->wan_udphdr_adsl_num_frames = WANCONFIG_ADSL; - udp_hdr->wan_udphdr_return_code = WAN_CMD_OK; - udp_hdr->wan_udphdr_data_len = 2; - break; + case WAN_GET_PROTOCOL: + udp_hdr->wan_udphdr_adsl_num_frames = WANCONFIG_ADSL; + udp_hdr->wan_udphdr_return_code = WAN_CMD_OK; + udp_hdr->wan_udphdr_data_len = 2; + break; - case WAN_GET_PLATFORM: - udp_hdr->wan_udphdr_data[0] = WAN_FREEBSD_PLATFORM; - udp_hdr->wan_udphdr_return_code = WAN_CMD_OK; - udp_hdr->wan_udphdr_data_len = 1; - break; + case WAN_GET_PLATFORM: + udp_hdr->wan_udphdr_data[0] = WAN_FREEBSD_PLATFORM; + udp_hdr->wan_udphdr_return_code = WAN_CMD_OK; + udp_hdr->wan_udphdr_data_len = 1; + break; case ADSL_TEST_DRIVER_RESPONSE: udp_hdr->wan_udphdr_return_code = WAN_CMD_OK; @@ -1808,29 +2233,29 @@ static int process_udp_cmd(netdevice_t* ifp, wan_udp_hdr_t* udp_hdr) case ADSL_READ_DRIVER_VERSION: udp_hdr->wan_udphdr_return_code = WAN_CMD_OK; sprintf(udp_hdr->wan_udphdr_data, "%s", WANPIPE_VERSION); - udp_hdr->wan_udphdr_data_len = strlen(udp_hdr->wan_udphdr_data); + udp_hdr->wan_udphdr_data_len = (unsigned short)strlen(udp_hdr->wan_udphdr_data); break; - + case ADSL_ROUTER_UP_TIME: wan_getcurrenttime(&adsl->router_up_time, NULL); adsl->router_up_time -= adsl->router_start_time; *(unsigned long *)&udp_hdr->wan_udphdr_data = - adsl->router_up_time; + adsl->router_up_time; udp_hdr->wan_udphdr_data_len = sizeof(unsigned long); udp_hdr->wan_udphdr_return_code = WAN_CMD_OK; break; - + case ADSL_ENABLE_TRACING: - + udp_hdr->wan_udphdr_return_code = WAN_CMD_OK; udp_hdr->wan_udphdr_data_len = 0; - + if (!wan_test_bit(0,&trace_info->tracing_enabled)){ - + trace_info->trace_timeout = SYSTEM_TICKS; - - adsl_trace_purge(trace_info); - + + adsl_trace_purge(trace_info); + if (udp_hdr->wan_udphdr_data[0] == 0){ wan_clear_bit(1,&trace_info->tracing_enabled); DEBUG_UDP("%s: ADSL L3 trace enabled!\n", @@ -1839,119 +2264,119 @@ static int process_udp_cmd(netdevice_t* ifp, wan_udp_hdr_t* udp_hdr) wan_clear_bit(2,&trace_info->tracing_enabled); wan_set_bit(1,&trace_info->tracing_enabled); DEBUG_UDP("%s: ADSL L2 trace enabled!\n", - card->devname); + card->devname); }else{ wan_clear_bit(1,&trace_info->tracing_enabled); wan_set_bit(2,&trace_info->tracing_enabled); DEBUG_UDP("%s: ADSL L1 trace enabled!\n", - card->devname); + card->devname); } wan_set_bit (0,&trace_info->tracing_enabled); }else{ DEBUG_EVENT("%s: Error: ADSL trace running!\n", - card->devname); + card->devname); udp_hdr->wan_udphdr_return_code = 2; } - + break; case ADSL_DISABLE_TRACING: - + udp_hdr->wan_udphdr_return_code = WAN_CMD_OK; - + if(wan_test_bit(0,&trace_info->tracing_enabled)) { - + wan_clear_bit(0,&trace_info->tracing_enabled); wan_clear_bit(1,&trace_info->tracing_enabled); wan_clear_bit(2,&trace_info->tracing_enabled); - adsl_trace_purge(trace_info); + adsl_trace_purge(trace_info); DEBUG_UDP("%s: Disabling ADSL trace\n", - card->devname); - + card->devname); + }else{ /* set return code to line trace already - disabled */ + disabled */ udp_hdr->wan_udphdr_return_code = 1; } break; - case ADSL_GET_TRACE_INFO: + case ADSL_GET_TRACE_INFO: - if(wan_test_bit(0,&trace_info->tracing_enabled)){ + if(wan_test_bit(0,&trace_info->tracing_enabled)){ trace_info->trace_timeout = SYSTEM_TICKS; }else{ DEBUG_EVENT("%s: Error ADSL trace not enabled\n", - card->devname); - /* set return code */ - udp_hdr->wan_udphdr_return_code = 1; - break; - } + card->devname); + /* set return code */ + udp_hdr->wan_udphdr_return_code = 1; + break; + } - buffer_length = 0; + buffer_length = 0; udp_hdr->wan_udphdr_adsl_num_frames = 0; udp_hdr->wan_udphdr_adsl_ismoredata = 0; - + #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) while (adsl_trace_queue_len(trace_info)){ WAN_IFQ_POLL(&trace_info->trace_queue, skb); if (skb == NULL){ DEBUG_EVENT("%s: No more trace packets in trace queue!\n", - card->devname); + card->devname); break; } if ((WAN_MAX_DATA_SIZE - buffer_length) < skb->m_pkthdr.len){ - /* indicate there are more frames on board & exit */ + /* indicate there are more frames on board & exit */ udp_hdr->wan_udphdr_adsl_ismoredata = 0x01; - break; - } + break; + } m_copydata(skb, - 0, - skb->m_pkthdr.len, - &udp_hdr->wan_udphdr_data[buffer_length]); + 0, + skb->m_pkthdr.len, + &udp_hdr->wan_udphdr_data[buffer_length]); buffer_length += skb->m_pkthdr.len; WAN_IFQ_DEQUEUE(&trace_info->trace_queue, skb); if (skb){ wan_skb_free(skb); } udp_hdr->wan_udphdr_adsl_num_frames++; - } + } #elif defined(__LINUX__) while ((skb=skb_dequeue(&trace_info->trace_queue)) != NULL){ - if((MAX_TRACE_BUFFER - buffer_length) < wan_skb_len(skb)){ - /* indicate there are more frames on board & exit */ - udp_hdr->wan_udphdr_adsl_ismoredata = 0x01; - if (buffer_length != 0){ - skb_queue_head(&trace_info->trace_queue, skb); - }else{ - memcpy(&udp_hdr->wan_udphdr_adsl_data[buffer_length], - wan_skb_data(skb), - sizeof(wan_trace_pkt_t)); + if((MAX_TRACE_BUFFER - buffer_length) < wan_skb_len(skb)){ + /* indicate there are more frames on board & exit */ + udp_hdr->wan_udphdr_adsl_ismoredata = 0x01; + if (buffer_length != 0){ + skb_queue_head(&trace_info->trace_queue, skb); + }else{ + memcpy(&udp_hdr->wan_udphdr_adsl_data[buffer_length], + wan_skb_data(skb), + sizeof(wan_trace_pkt_t)); - buffer_length = sizeof(wan_trace_pkt_t); - udp_hdr->wan_udphdr_adsl_num_frames++; - wan_skb_free(skb); - } - break; - } + buffer_length = sizeof(wan_trace_pkt_t); + udp_hdr->wan_udphdr_adsl_num_frames++; + wan_skb_free(skb); + } + break; + } - memcpy(&udp_hdr->wan_udphdr_adsl_data[buffer_length], - wan_skb_data(skb), - wan_skb_len(skb)); + memcpy(&udp_hdr->wan_udphdr_adsl_data[buffer_length], + wan_skb_data(skb), + wan_skb_len(skb)); - buffer_length += wan_skb_len(skb); - wan_skb_free(skb); - udp_hdr->wan_udphdr_adsl_num_frames++; - } + buffer_length += wan_skb_len(skb); + wan_skb_free(skb); + udp_hdr->wan_udphdr_adsl_num_frames++; + } #endif - /* set the data length and return code */ - udp_hdr->wan_udphdr_data_len = buffer_length; - udp_hdr->wan_udphdr_return_code = WAN_CMD_OK; - break; - + /* set the data length and return code */ + udp_hdr->wan_udphdr_data_len = (unsigned short)buffer_length; + udp_hdr->wan_udphdr_return_code = WAN_CMD_OK; + break; + default: adsl_udp_cmd( card->u.adsl.adapter, @@ -1963,12 +2388,13 @@ static int process_udp_cmd(netdevice_t* ifp, wan_udp_hdr_t* udp_hdr) } wan_atomic_set(&adsl->udp_pkt_len, - sizeof(wan_mgmt_t) + sizeof(wan_trace_info_t) + - sizeof(wan_cmd_t) + udp_hdr->wan_udphdr_data_len); + sizeof(wan_mgmt_t) + sizeof(wan_trace_info_t) + + sizeof(wan_cmd_t) + udp_hdr->wan_udphdr_data_len); udp_hdr->wan_udphdr_request_reply = UDPMGMT_REPLY; return 0; } +#endif #if defined (__LINUX__) static int wanpipe_attach_sppp(sdla_t *card, netdevice_t *dev, wanif_conf_t *conf) @@ -1976,7 +2402,7 @@ static int wanpipe_attach_sppp(sdla_t *card, netdevice_t *dev, wanif_conf_t *con adsl_private_area_t *adsl=dev->priv; struct ppp_device *pppdev=NULL; struct sppp *sp=NULL; - + pppdev=kmalloc(sizeof(struct ppp_device),GFP_KERNEL); if (!pppdev){ return -ENOMEM; @@ -1986,11 +2412,11 @@ static int wanpipe_attach_sppp(sdla_t *card, netdevice_t *dev, wanif_conf_t *con adsl->common.prot_ptr=(void*)pppdev; /* Attach PPP protocol layer to pppdev - * The wp_sppp_attach() will initilize the dev structure - * and setup ppp layer protocols. - * All we have to do is to bind in: - * if_open(), if_close(), if_send() and get_stats() functions. - */ + * The wp_sppp_attach() will initilize the dev structure + * and setup ppp layer protocols. + * All we have to do is to bind in: + * if_open(), if_close(), if_send() and get_stats() functions. + */ pppdev->dev=dev; @@ -1998,15 +2424,15 @@ static int wanpipe_attach_sppp(sdla_t *card, netdevice_t *dev, wanif_conf_t *con if(conf->pap == WANOPT_YES){ pppdev->sppp.myauth.proto = PPP_PAP; DEBUG_EVENT("%s: Enableing PAP Protocol\n", - card->devname); + card->devname); }else if(conf->chap == WANOPT_YES){ pppdev->sppp.myauth.proto = PPP_CHAP; DEBUG_EVENT("%s: Enableing CHAP Protocol\n", - card->devname); + card->devname); }else{ pppdev->sppp.myauth.proto = 0; DEBUG_EVENT("%s: Authentication protocols disabled\n", - card->devname); + card->devname); } if(pppdev->sppp.myauth.proto){ @@ -2014,9 +2440,9 @@ static int wanpipe_attach_sppp(sdla_t *card, netdevice_t *dev, wanif_conf_t *con memcpy(pppdev->sppp.myauth.secret, conf->passwd, AUTHNAMELEN); DEBUG_TX("%s: %s Username=%s Passwd=*****\n", - card->devname, - (pppdev->sppp.myauth.proto==PPP_PAP)?"PAP":"CHAP", - conf->userid); + card->devname, + (pppdev->sppp.myauth.proto==PPP_PAP)?"PAP":"CHAP", + conf->userid); } pppdev->sppp.gateway = conf->gateway; @@ -2029,17 +2455,17 @@ static int wanpipe_attach_sppp(sdla_t *card, netdevice_t *dev, wanif_conf_t *con wp_sppp_attach(pppdev); sp = &pppdev->sppp; - + /* Enable PPP Debugging */ if (conf->protocol == WANCONFIG_CHDLC){ printk(KERN_INFO "%s: Starting Kernel CISCO HDLC protocol\n", - card->devname); + card->devname); sp->pp_flags |= PP_CISCO; conf->ignore_dcd = WANOPT_YES; conf->ignore_cts = WANOPT_YES; }else{ printk(KERN_INFO "%s: Starting Kernel Sync PPP protocol\n", - card->devname); + card->devname); sp->pp_flags &= ~PP_CISCO; dev->type = ARPHRD_PPP; } @@ -2048,3 +2474,227 @@ static int wanpipe_attach_sppp(sdla_t *card, netdevice_t *dev, wanif_conf_t *con } #endif + +#if defined(__WINDOWS__) +////////////////////////////////////////////////////////////////////////// +//////////// RX +static int netif_rx(netdevice_t *sdla_net_dev, netskb_t *rx_skb) +{ + TX_RX_DATA_STRUCT *tx_rx_struct; + int rc; + unsigned long smp_flags; + adsl_private_area_t *chan = (adsl_private_area_t*)wan_netif_priv(sdla_net_dev); + sdla_t *card = (sdla_t*)chan->common.card; + + DBG_ADSL_RX("%s()\n", __FUNCTION__); + + if((tx_rx_struct = convert_skb_to_TX_RX_DATA_STRUCT(rx_skb)) == NULL){ + return 1; + } + + wan_skb_print(rx_skb); + + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); + rc = adsl_insert_packet_in_to_rx_queue(sdla_net_dev, tx_rx_struct); + if(rc == SANG_STATUS_SUCCESS){ + //At this point all the data in per-Logic Channel RX queue. + //Queue the DPC, where data will be passed up to the user. + if(KeInsertQueueDpc(&card->rx_dpc_obj, NULL, NULL) == FALSE){ + //may happen when there is a lot of data. Not critical. + DBG_ADSL_RX("ADSL:Failed to 'queue rx_dpc_obj' - Not critical.\n"); + } + } + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + + //deallocate temporary buffer + wpabs_free(tx_rx_struct); + //deallocate the original rx skb buffer + wpabs_skb_free(rx_skb); + return rc; +} + +////////////////////////////////////////////////////////////////////////// +//must be called with IRQ Lock or from ISR. +static int +adsl_insert_packet_in_to_rx_queue( + netdevice_t *sdla_net_dev, + RX_DATA_STRUCT *rx_data_struct + ) +{ + DATA_QUEUE_ELEMENT tmp_rx_q_el; + int rc = 0, i; + adsl_private_area_t *chan = (adsl_private_area_t*)wan_netif_priv(sdla_net_dev); + sdla_t *card = (sdla_t*)chan->common.card; + api_header_t *api_header = &rx_data_struct->api_header; + unsigned char *rx_data = rx_data_struct->data; + + DBG_ADSL_RX("%s: api_header->data_length: %d\n", + chan->if_name, api_header->data_length); +/* + //this will print the RX data into debugger: + for(i = 0; i < api_header->data_length; i++){ + DBG_ADSL_RX("rx_data[%d]: 0x%02X\n", i, rx_data[i]); + if(i > 30){ + DBG_ADSL_RX("...\n"); + break; + } + } +*/ + if(sdla_net_dev->open_handle_counter == 0){ + DBG_ADSL_RX("%s: open_handle_counter == 0. discarding data\n", + chan->if_name); + return 1; + } + + //check data length + if(api_header->data_length > ((DATA_QUEUE*)sdla_net_dev->rx_user_info.queue)->max_data_length){ + + //won't fit into rx queue buffer + DBG_ADSL_RX("api_header->data_length > DATA_BUFFER_LEN!!\n"); + chan->if_stats.rx_packets_discarded_excessive_length++; + return 2; + } + + if(api_header->data_length < 1){ + DBG_ADSL_RX("api_header->data_length < 1!!\n"); + chan->if_stats.rx_packets_discarded_too_short++; + return 3; + } + + //now copy header in to the element + RtlCopyMemory(&tmp_rx_q_el.api_header, api_header, sizeof(api_header_t)); + //initialize data pointer + tmp_rx_q_el.data = rx_data; + + tmp_rx_q_el.api_header.operation_status = SANG_STATUS_RX_DATA_AVAILABLE; + + // + //Code inside enqueue() will copy from 'tmp_rx_q_el' to a real queue element. + //Insert element at the tail of the rx queue. + // + rc = enqueue(sdla_net_dev->rx_user_info.queue, &tmp_rx_q_el); + if(rc){ + if(((DATA_QUEUE*)sdla_net_dev->rx_user_info.queue)->q_full_message_printed == 0){ + ((DATA_QUEUE*)sdla_net_dev->rx_user_info.queue)->q_full_message_printed = 1; + switch(rc) + { + default: + DEBUG_EVENT("%s: Warning: Discarding Rx data - rx queue is full!!\n", + sdla_net_dev->name); + break; + case 2: + DEBUG_EVENT("%s: Warning: Discarding Rx data - data too long!!\n", + sdla_net_dev->name); + break; + } + } + + //DbgPrint("rx q full!!\n"); + //DbgBreakPoint(); + chan->if_stats.rx_packets_discarded_rx_q_full++; + }else{ + ((DATA_QUEUE*)sdla_net_dev->rx_user_info.queue)->q_full_message_printed = 0; + } + + //even if data was discarded because rx q was full, increment + //statistics to indicate that rx is happening + chan->if_stats.rx_packets++; + chan->if_stats.rx_bytes += tmp_rx_q_el.api_header.data_length; + + //arr_q_size(sdla_net_dev->rx_queue); + + return rc; +} + +////////////////////////////////////////////////////////////////////////// +//////////// TX +//must be called with IRQ Lock or from ISR. +static int adsl_if_send(void *not_used, netdevice_t *sdla_net_dev) +{ + DATA_QUEUE_ELEMENT *tmp_tx_q_el; + int len; + adsl_private_area_t *chan = (adsl_private_area_t*)wan_netif_priv(sdla_net_dev); + sdla_t *card = (sdla_t*)chan->common.card; + api_header_t *tx_header; + + DBG_ADSL_TX("%s()\n", __FUNCTION__); + + if(wan_test_bit(TX_BUSY_SET,&card->wandev.critical)){ + DBG_ADSL_FAST_TX("%s: return 'SANG_STATUS_DEVICE_BUSY'\n", sdla_net_dev->name); + return SANG_STATUS_DEVICE_BUSY; + } + + if(sdla_net_dev->open_handle_counter == 0){ + //nobody is using this device, drop the data?? + DBG_ADSL_TX("%s: open_handle_counter == 0. return 'SANG_STATUS_INVALID_PARAMETER'\n", + sdla_net_dev->name); + return SANG_STATUS_INVALID_PARAMETER; + } + + DBG_ADSL_TX("%s():line:%d: current_num_of_elements_in_q: %d\n", __FUNCTION__, __LINE__, + ((DATA_QUEUE*)sdla_net_dev->tx_queue)->current_num_of_elements_in_q); + + //Reasons to queue DPC: + //1. can NOT allocate memory while holding irq spinlock, do it in adsl_if_send_task_func() + // + //2. IMPORTANT: first queue DPC, AFTER that return, becase otherwise there can be an infinite busy loop, + // since there will be always something in transmit queue. The problem is easyly reproduced by + // printing lots of messages to WinDebug over the Serial port, because it slows down the code. + wpabs_tasklet_schedule(&chan->adsl_if_send_task); + return SANG_STATUS_SUCCESS; +} + +static void adsl_if_send_task_func( + IN PKDPC Dpc, + IN PVOID arg, + IN PVOID not_used1, + IN PVOID not_used2 + ) +{ + netdevice_t *sdla_net_dev = (netdevice_t *)arg; + adsl_private_area_t *chan = (adsl_private_area_t*)wan_netif_priv(sdla_net_dev); + sdla_t *card = (sdla_t*)chan->common.card; + unsigned long smp_flags; + netskb_t *skb; + DATA_QUEUE_ELEMENT *tmp_tx_q_el; + unsigned int tx_retry_counter; + + DBG_ADSL_TX("%s()\n", __FUNCTION__); + + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); + //check there is something in tx queue + tmp_tx_q_el = dequeue(sdla_net_dev->tx_queue); + if(tmp_tx_q_el == NULL){ + DBG_ADSL_TX("%s():%s: tx queue is empty!\n", __FUNCTION__, sdla_net_dev->name); + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + return; + } + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + + skb = convert_DATA_QUEUE_ELEMENT_to_skb(tmp_tx_q_el); + if(skb == NULL){ + DEBUG_EVENT("%s():Warning: %s: skb is NULL!\n", __FUNCTION__, sdla_net_dev->name); + return; + } + tx_retry_counter = 0; +retry: + if(adsl_output(skb, sdla_net_dev)){ + tx_retry_counter++; + if(tx_retry_counter < 100){ + DBG_ADSL_FAST_TX("retry tx\n"); + KeStallExecutionProcessor(50UL); + goto retry; + }else{ + wpabs_skb_free(skb); + DEBUG_EVENT("%s():%s:Warning: adsl_output() failed. Dropping TX data!\n", + __FUNCTION__, sdla_net_dev->name); + + WAN_NETIF_START_QUEUE(sdla_net_dev); + } + }else{ + chan->if_stats.tx_packets++; + chan->if_stats.tx_bytes += tmp_tx_q_el->api_header.data_length; + } +} + +#endif /* #if defined(__WINDOWS__) */ diff --git a/patches/kdrivers/src/net/sdla_aft_te1.c b/patches/kdrivers/src/net/sdla_aft_te1.c index 0087b8b..c1d4979 100644 --- a/patches/kdrivers/src/net/sdla_aft_te1.c +++ b/patches/kdrivers/src/net/sdla_aft_te1.c @@ -5,15 +5,17 @@ * * Authors: Nenad Corbic * -* Copyright: (c) 2003-2006 Sangoma Technologies Inc. +* Copyright: (c) 2003-2008 Sangoma Technologies 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. * ============================================================================ -* Jan 07, 2003 Nenad Corbic Initial version. -* Oct 25, 2004 Nenad Corbic Support for QuadPort TE1 +* Feb 04,2008 Nenad Corbic Support for RTP TAP, Fixed 56K +* Mar 16,2007 David Rokhvarg Support for ISDN BRI card. +* Oct 25,2004 Nenad Corbic Support for QuadPort TE1 +* Jan 07,2003 Nenad Corbic Initial version. *****************************************************************************/ #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) @@ -39,13 +41,13 @@ # include #endif + #if defined(CONFIG_WANPIPE_HWEC) # include #endif #define INIT_FE_ONLY 0 -#undef DEBUG_REG #if 1 #define AFT_FUNC_DEBUG() @@ -54,7 +56,6 @@ #endif - #if 0 # define AFT_XTEST_UPDATE 1 #else @@ -114,8 +115,6 @@ #if 0 # warning "IRQ STAT DEBUGGIN ON" # define AFT_IRQ_STAT_DEBUG 1 -# define AFT_IRQ_STAT_TIMEOUT 5 -static unsigned long stat_timeout; #else # undef AFT_IRQ_STAT_DEBUG #endif @@ -140,12 +139,18 @@ static unsigned long stat_timeout; # undef AFT_CLOCK_SYNC #endif +#if 0 +# warning "AFT_SERIAL_DEBUGGING is enabled" +# define AFT_SINGLE_DMA_CHAIN 1 +# define AFT_SERIAL_DEBUG +#else +# undef AFT_SERIAL_DEBUG +#endif + #if defined(__LINUX__) #define AFT_TDM_API_SUPPORT 1 -#define AFT_RTP_SUPPORT 1 #else #undef AFT_TDM_API_SUPPORT -#undef AFT_RTP_SUPPORT #endif #if defined(__LINUX__) @@ -154,8 +159,17 @@ static unsigned long stat_timeout; #undef AFT_API_SUPPORT #endif +#if defined(__LINUX__) +# define AFT_RTP_SUPPORT 1 +#else +# undef AFT_RTP_SUPPORT +#endif +#if defined(WANPIPE_64BIT_4G_DMA) +#warning "Wanpipe compiled for 64bit 4G DMA" +#endif + /* Trigger on Number of transactions * 1= 1x8 byte transactions @@ -198,6 +212,7 @@ enum { DEVICE_DOWN }; + enum { TX_DMA_BUSY, TX_HANDLER_BUSY, @@ -271,8 +286,6 @@ extern wan_iface_t wan_iface; extern void disable_irq(unsigned int); extern void enable_irq(unsigned int); -extern sdla_t* card_list; - /**SECTOIN************************************************** * * Function Prototypes @@ -292,18 +305,15 @@ static int if_init (netdevice_t* dev); #endif static int if_open (netdevice_t* dev); static int if_close (netdevice_t* dev); -static int if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd); - -static struct net_device_stats* if_stats (netdevice_t* dev); +static int if_do_ioctl(netdevice_t*, struct ifreq*, wan_ioctl_cmd_t); #if defined(__LINUX__) static int if_send (netskb_t* skb, netdevice_t* dev); -static int if_change_mtu(netdevice_t *dev, int new_mtu); +static struct net_device_stats* if_stats (netdevice_t* dev); #else static int if_send(netdevice_t*, netskb_t*, struct sockaddr*,struct rtentry*); #endif -static void callback_front_end_state(void *card_id); static void handle_front_end_state(void* card_id); static void enable_timer(void* card_id); static void enable_ec_timer(void* card_id); @@ -319,7 +329,8 @@ static WAN_IRQ_RETVAL wp_aft_global_isr (sdla_t* card); static void wp_aft_dma_per_port_isr(sdla_t *card); static void wp_aft_tdmv_per_port_isr(sdla_t *card); static void wp_aft_fifo_per_port_isr(sdla_t *card); -static void wp_aft_wdt_per_port_isr(sdla_t *card, int wdt_intr); +static void wp_aft_wdt_per_port_isr(sdla_t *card, int wdt_intr); +static void wp_aft_serial_status_isr(sdla_t *card, u32 status); /* Bottom half handlers */ #if defined(__LINUX__) @@ -381,14 +392,12 @@ static void aft_port_task (struct work_struct *work); static void aft_port_task (void * card_ptr, int arg); #endif - #if defined(AFT_RTP_SUPPORT) static int aft_rtp_config(sdla_t *card); static void aft_rtp_unconfig(sdla_t *card); static void aft_rtp_tap(void *card_ptr, u8 chan, u8* rx, u8* tx, u32 len); #endif - static int aft_devel_ioctl(sdla_t *card,struct ifreq *ifr); static int aft_write_bios(sdla_t *card, wan_cmd_api_t *api_cmd); static int aft_write(sdla_t *card, wan_cmd_api_t *api_cmd); @@ -420,8 +429,8 @@ static int aft_init_requeue_free_skb(private_area_t *chan, netskb_t *skb); static int aft_dma_tx (sdla_t *card,private_area_t *chan); static void aft_tx_dma_chain_handler(unsigned long data, int wdt, int reset); static void aft_tx_dma_voice_handler(unsigned long data, int wdt, int reset); -static void aft_tx_dma_chain_init(private_area_t *chan, aft_dma_chain_t *); -static void aft_rx_dma_chain_init(private_area_t *chan, aft_dma_chain_t *); +static void aft_tx_dma_chain_init(private_area_t *chan, wan_dma_descr_t *); +static void aft_rx_dma_chain_init(private_area_t *chan, wan_dma_descr_t *); static void aft_index_tx_rx_dma_chains(private_area_t *chan); static void aft_init_tx_rx_dma_descr(private_area_t *chan); static void aft_free_rx_complete_list(private_area_t *chan); @@ -438,6 +447,7 @@ static void aft_data_mux_cfg(sdla_t *card); static void aft_data_mux_get_cfg(sdla_t *card); static int aft_ss7_tx_mangle(sdla_t *card,private_area_t *chan, netskb_t *skb); +static int aft_hdlc_repeat_mangle(sdla_t *card,private_area_t *chan, netskb_t *skb, netskb_t **rkb); static int aft_tdmv_init(sdla_t *card, wandev_conf_t *conf); #if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) @@ -474,7 +484,6 @@ static int aft_write_hdlc_frame(void *chan_ptr, netskb_t *skb); #endif static int aft_tdm_ring_rsync(sdla_t *card); static void aft_critical_shutdown(sdla_t *card); -static void aft_critical_event(void *arg, int type); /* API VoIP event */ #if defined(AFT_API_SUPPORT) @@ -522,6 +531,9 @@ static unsigned char aft_read_ec (void*, unsigned short); static int aft_hwec_config(sdla_t *card, private_area_t *chan, wanif_conf_t *conf, int ctrl); static int aft_find_master_if_and_dchan(sdla_t *card, int *master_if,u32 active_ch); +#if defined(NETGRAPH) +extern void wan_ng_link_state(wanpipe_common_t *common, int state); +#endif /**SECTION********************************************************* * @@ -569,6 +581,7 @@ int aft_global_hw_device_init(void) { memset(aft_hwdev,0,sizeof(aft_hwdev)); +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_TE1) aft_hwdev[WANOPT_AFT104].init = 1; aft_hwdev[WANOPT_AFT104].aft_global_chip_config = a104_global_chip_config; aft_hwdev[WANOPT_AFT104].aft_global_chip_unconfig = a104_global_chip_unconfig; @@ -582,7 +595,25 @@ int aft_global_hw_device_init(void) aft_hwdev[WANOPT_AFT104].aft_write_cpld = aft_te1_write_cpld; aft_hwdev[WANOPT_AFT104].aft_fifo_adjust = a104_fifo_adjust; aft_hwdev[WANOPT_AFT104].aft_check_ec_security = a104_check_ec_security; +#endif +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_SERIAL) + aft_hwdev[WANOPT_AFT_SERIAL].init = 1; + aft_hwdev[WANOPT_AFT_SERIAL].aft_global_chip_config = a104_global_chip_config; + aft_hwdev[WANOPT_AFT_SERIAL].aft_global_chip_unconfig = a104_global_chip_unconfig; + aft_hwdev[WANOPT_AFT_SERIAL].aft_chip_config = a104_chip_config; + aft_hwdev[WANOPT_AFT_SERIAL].aft_chip_unconfig = a104_chip_unconfig; + aft_hwdev[WANOPT_AFT_SERIAL].aft_chan_config = a104_chan_dev_config; + aft_hwdev[WANOPT_AFT_SERIAL].aft_chan_unconfig = a104_chan_dev_unconfig; + aft_hwdev[WANOPT_AFT_SERIAL].aft_led_ctrl = a104_led_ctrl; + aft_hwdev[WANOPT_AFT_SERIAL].aft_test_sync = a104_test_sync; + aft_hwdev[WANOPT_AFT_SERIAL].aft_read_cpld = aft_te1_read_cpld; + aft_hwdev[WANOPT_AFT_SERIAL].aft_write_cpld = aft_te1_write_cpld; + aft_hwdev[WANOPT_AFT_SERIAL].aft_fifo_adjust = a104_fifo_adjust; + aft_hwdev[WANOPT_AFT_SERIAL].aft_check_ec_security = a104_check_ec_security; +#endif + +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_RM) aft_hwdev[WANOPT_AFT_ANALOG].init = 1; aft_hwdev[WANOPT_AFT_ANALOG].aft_global_chip_config = aft_analog_global_chip_config; aft_hwdev[WANOPT_AFT_ANALOG].aft_global_chip_unconfig = aft_analog_global_chip_unconfig; @@ -595,8 +626,26 @@ int aft_global_hw_device_init(void) aft_hwdev[WANOPT_AFT_ANALOG].aft_read_cpld = aft_analog_read_cpld; aft_hwdev[WANOPT_AFT_ANALOG].aft_write_cpld = aft_analog_write_cpld; aft_hwdev[WANOPT_AFT_ANALOG].aft_fifo_adjust = aft_analog_fifo_adjust; - aft_hwdev[WANOPT_AFT_ANALOG].aft_check_ec_security = a200_check_ec_security; + aft_hwdev[WANOPT_AFT_ANALOG].aft_check_ec_security = a200_check_ec_security; +#endif +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_BRI) + aft_hwdev[WANOPT_AFT_ISDN].init = 1; + aft_hwdev[WANOPT_AFT_ISDN].aft_global_chip_config = aft_bri_global_chip_config; + aft_hwdev[WANOPT_AFT_ISDN].aft_global_chip_unconfig = aft_bri_global_chip_unconfig; + aft_hwdev[WANOPT_AFT_ISDN].aft_chip_config = aft_bri_chip_config; + aft_hwdev[WANOPT_AFT_ISDN].aft_chip_unconfig = aft_bri_chip_unconfig; + aft_hwdev[WANOPT_AFT_ISDN].aft_chan_config = aft_bri_chan_dev_config; + aft_hwdev[WANOPT_AFT_ISDN].aft_chan_unconfig = aft_bri_chan_dev_unconfig; + aft_hwdev[WANOPT_AFT_ISDN].aft_led_ctrl = aft_bri_led_ctrl; + aft_hwdev[WANOPT_AFT_ISDN].aft_test_sync = aft_bri_test_sync; + aft_hwdev[WANOPT_AFT_ISDN].aft_read_cpld = aft_bri_read_cpld; + aft_hwdev[WANOPT_AFT_ISDN].aft_write_cpld = aft_bri_write_cpld; + aft_hwdev[WANOPT_AFT_ISDN].aft_fifo_adjust = aft_bri_fifo_adjust; + aft_hwdev[WANOPT_AFT_ISDN].aft_check_ec_security = bri_check_ec_security; +#endif + +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_56K) aft_hwdev[WANOPT_AFT_56K].init = 1; aft_hwdev[WANOPT_AFT_56K].aft_global_chip_config = a104_global_chip_config; aft_hwdev[WANOPT_AFT_56K].aft_global_chip_unconfig = a104_global_chip_unconfig; @@ -605,11 +654,12 @@ int aft_global_hw_device_init(void) aft_hwdev[WANOPT_AFT_56K].aft_chan_config = a104_chan_dev_config; aft_hwdev[WANOPT_AFT_56K].aft_chan_unconfig = a104_chan_dev_unconfig; aft_hwdev[WANOPT_AFT_56K].aft_led_ctrl = a104_led_ctrl; - aft_hwdev[WANOPT_AFT_56K].aft_test_sync = a104_test_sync; + aft_hwdev[WANOPT_AFT_56K].aft_test_sync = a104_test_sync; aft_hwdev[WANOPT_AFT_56K].aft_read_cpld = aft_56k_read_cpld; - aft_hwdev[WANOPT_AFT_56K].aft_write_cpld = aft_56k_write_cpld; + aft_hwdev[WANOPT_AFT_56K].aft_write_cpld = aft_56k_write_cpld; aft_hwdev[WANOPT_AFT_56K].aft_fifo_adjust = a104_fifo_adjust; - aft_hwdev[WANOPT_AFT_56K].aft_check_ec_security = a104_check_ec_security; + aft_hwdev[WANOPT_AFT_56K].aft_check_ec_security = a104_check_ec_security; +#endif return 0; } @@ -635,6 +685,7 @@ int aft_global_hw_device_init(void) * < 0 failure. */ +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_RM) int wp_aft_analog_init (sdla_t *card, wandev_conf_t* conf) { /* Verify configuration ID */ @@ -644,7 +695,6 @@ int wp_aft_analog_init (sdla_t *card, wandev_conf_t* conf) return -EINVAL; } - card->u.aft.chip_cfg_status=0; ASSERT_AFT_HWDEV(card->wandev.card_type); card->hw_iface.getcfg(card->hw, SDLA_COREREV, &card->u.aft.firm_ver); @@ -667,24 +717,21 @@ int wp_aft_analog_init (sdla_t *card, wandev_conf_t* conf) /* Make special hardware initialization for Analog board */ memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - wp_remora_iface_init(&card->wandev.fe_iface); + wp_remora_iface_init(&card->fe, &card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; - card->fe.write_fe_reg = aft_analog_write_fe; - card->fe.read_fe_reg = aft_analog_read_fe; - card->fe.__read_fe_reg = __aft_analog_read_fe; + card->fe.write_fe_reg = card->hw_iface.fe_write; /* aft_analog_write_fe; */ + card->fe.read_fe_reg = card->hw_iface.fe_read; /* aft_analog_read_fe; */ + card->fe.__read_fe_reg = card->hw_iface.__fe_read; /* __aft_analog_read_fe; */ card->wandev.fe_enable_timer = enable_timer; card->wandev.ec_enable_timer = enable_ec_timer; - card->wandev.te_link_state = callback_front_end_state; + card->wandev.te_link_state = handle_front_end_state; if (card->wandev.comm_port == WANOPT_PRI){ conf->clocking = WANOPT_EXTERNAL; } - /* Use software RING buffer by default on Analog */ - wan_set_bit(AFT_TDM_SW_RING_BUF,&card->u.aft.chip_cfg_status); - card->wandev.comm_port=card->fe.fe_cfg.line_no; if (card->wandev.comm_port != 0){ DEBUG_EVENT("%s: Error: Invalid port selected %d (Port 1)\n", @@ -694,17 +741,145 @@ int wp_aft_analog_init (sdla_t *card, wandev_conf_t* conf) card->u.aft.num_of_time_slots=MAX_REMORA_MODULES; + return wan_aft_init(card,conf); } +#endif + +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_BRI) +int wp_aft_bri_init (sdla_t *card, wandev_conf_t* conf) +{ + /* Verify configuration ID */ + if (card->wandev.config_id != WANCONFIG_AFT_ISDN_BRI) { + DEBUG_EVENT( "%s: invalid configuration ID %u!\n", + card->devname, card->wandev.config_id); + return -EINVAL; + } + + ASSERT_AFT_HWDEV(card->wandev.card_type); + + card->hw_iface.getcfg(card->hw, SDLA_COREREV, &card->u.aft.firm_ver); + card->hw_iface.getcfg(card->hw, SDLA_COREID, &card->u.aft.firm_id); + + /* FIXME:hardcoded!! */ + card->u.aft.firm_id = AFT_DS_FE_CORE_ID; + + if (conf == NULL){ + DEBUG_EVENT("%s: Bad configuration structre!\n", + card->devname); + return -EINVAL; + } + + /* Make special hardware initialization for ISDN BRI board */ + memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); + wp_bri_iface_init(&card->wandev.fe_iface); + card->fe.name = card->devname; + card->fe.card = card; + card->fe.write_fe_reg = aft_bri_write_fe; + card->fe.read_fe_reg = aft_bri_read_fe; + card->fe.__read_fe_reg = __aft_bri_read_fe; + + card->wandev.fe_enable_timer = enable_timer; + card->wandev.ec_enable_timer = enable_ec_timer; + card->wandev.te_link_state = handle_front_end_state; + + if (card->wandev.comm_port == WANOPT_PRI){ + conf->clocking = WANOPT_EXTERNAL; + } + +#if 1 + card->wandev.comm_port=0; + if (card->fe.fe_cfg.line_no >= MAX_BRI_MODULES) { + card->wandev.comm_port=1; + } +#else + card->wandev.comm_port=card->fe.fe_cfg.line_no; +#endif + + DEBUG_EVENT("%s: BRI CARD Line=%i Port=%i\n", + card->devname, card->wandev.comm_port, card->fe.fe_cfg.line_no); + + /* Set 'num_of_time_slots' to 31. This is needed for the d-chan, + which is always at the otherwise unused timeslot 31. + */ + card->u.aft.num_of_time_slots = MAX_TIMESLOTS; + + return wan_aft_init(card,conf); +} +#endif + +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_SERIAL) + +int wp_aft_serial_init (sdla_t *card, wandev_conf_t* conf) +{ + /* Verify configuration ID */ + if (card->wandev.config_id != WANCONFIG_AFT_SERIAL) { + DEBUG_EVENT( "%s: invalid configuration ID %u!\n", + card->devname, card->wandev.config_id); + return -EINVAL; + } + + ASSERT_AFT_HWDEV(card->wandev.card_type); + + card->hw_iface.getcfg(card->hw, SDLA_COREREV, &card->u.aft.firm_ver); + card->hw_iface.getcfg(card->hw, SDLA_COREID, &card->u.aft.firm_id); + + + if (card->u.aft.firm_ver < AFT_SERIAL_MIN_FRMW_VER){ + DEBUG_EVENT( "%s: Invalid/Obselete AFT firmware version %X (not >= %X)!\n", + card->devname, card->u.aft.firm_ver,AFT_SERIAL_MIN_FRMW_VER); + DEBUG_EVENT( "%s You seem to be running BETA hardware that is not supported any more.\n", + card->devname); + DEBUG_EVENT( "%s: Please contact Sangoma Technologies for more info.\n", + card->devname); + return -EINVAL; + } + + + if (conf == NULL){ + DEBUG_EVENT("%s: Bad configuration structre!\n", + card->devname); + return -EINVAL; + } + + /* Make special hardware initialization for Serial board */ + memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); + + FE_MEDIA(&(card->fe.fe_cfg)) = WAN_MEDIA_SERIAL; + + wp_serial_iface_init(&card->wandev.fe_iface); + card->fe.name = card->devname; + card->fe.card = card; + card->fe.write_fe_reg = card->hw_iface.fe_write; /*aft_serial_write_fe;*/ + card->fe.read_fe_reg = card->hw_iface.fe_read; /*aft_serial_read_fe;*/ + card->fe.__read_fe_reg = card->hw_iface.__fe_read; /*__aft_serial_read_fe;*/ + + card->wandev.fe_enable_timer = enable_timer; + card->wandev.ec_enable_timer = enable_ec_timer; + card->wandev.te_link_state = handle_front_end_state; + + card->wandev.comm_port=card->fe.fe_cfg.line_no; + + DEBUG_EVENT("%s: Serial A140 CARD Line=%i Port=%i Firm=0x%02X ID=0x%X\n", + card->devname, card->wandev.comm_port, card->fe.fe_cfg.line_no, + card->u.aft.firm_ver,card->u.aft.firm_id); + + card->u.aft.num_of_time_slots = 1; + + return wan_aft_init(card,conf); +} +#endif + + +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_TE1) int wp_aft_te1_init (sdla_t* card, wandev_conf_t* conf) { AFT_FUNC_DEBUG(); - wan_set_bit(CARD_DOWN,&card->wandev.critical); /* Verify configuration ID */ @@ -713,7 +888,7 @@ int wp_aft_te1_init (sdla_t* card, wandev_conf_t* conf) card->devname, card->wandev.config_id); return -EINVAL; } - card->u.aft.chip_cfg_status=0; + card->hw_iface.getcfg(card->hw, SDLA_COREREV, &card->u.aft.firm_ver); card->hw_iface.getcfg(card->hw, SDLA_COREID, &card->u.aft.firm_id); @@ -736,10 +911,6 @@ int wp_aft_te1_init (sdla_t* card, wandev_conf_t* conf) return -EINVAL; } -#if defined(WAN_DEBUG_MEM) - DEBUG_EVENT("%s: Total Mem %d\n",__FUNCTION__,wan_atomic_read(&wan_debug_mem)); -#endif - /* TE1 Make special hardware initialization for T1/E1 board */ if (IS_TE1_MEDIA(&conf->fe_cfg)){ int max_ports = 4; @@ -748,40 +919,30 @@ int wp_aft_te1_init (sdla_t* card, wandev_conf_t* conf) conf->fe_cfg.cfg.te_cfg.active_ch = -1; } - memset(&card->fe, 0, sizeof(sdla_fe_t)); memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); if (card->u.aft.firm_id == AFT_DS_FE_CORE_ID) { max_ports = 8; - sdla_ds_te1_iface_init(&card->wandev.fe_iface); + sdla_ds_te1_iface_init(&card->fe, &card->wandev.fe_iface); }else{ - sdla_te_iface_init(&card->wandev.fe_iface); + sdla_te_iface_init(&card->fe, &card->wandev.fe_iface); } card->fe.name = card->devname; card->fe.card = card; - card->fe.write_fe_reg = a104_write_fe; - card->fe.read_fe_reg = a104_read_fe; - card->fe.__read_fe_reg = __a104_read_fe; + card->fe.write_fe_reg = card->hw_iface.fe_write; /*a104_write_fe;*/ + card->fe.read_fe_reg = card->hw_iface.fe_read; /*a104_read_fe;*/ + card->fe.__read_fe_reg = card->hw_iface.__fe_read; /*__a104_read_fe;*/ card->wandev.fe_enable_timer = enable_timer; card->wandev.ec_enable_timer = enable_ec_timer; - card->wandev.te_link_state = callback_front_end_state; - conf->interface = + card->wandev.te_link_state = handle_front_end_state; + conf->electrical_interface = IS_T1_CARD(card) ? WANOPT_V35 : WANOPT_RS232; - card->wandev.critical_event = aft_critical_event; if (card->wandev.comm_port == WANOPT_PRI){ conf->clocking = WANOPT_EXTERNAL; } card->wandev.comm_port=card->fe.fe_cfg.line_no; -#if 0 -/* ALEX: This will check during t1/e1 configuration */ - if (card->wandev.comm_port < 0 || card->wandev.comm_port > max_ports-1){ - DEBUG_EVENT("%s: Error: Invalid port selected %d (Min=1 Max=%d)\n", - card->devname,card->wandev.comm_port, max_ports); - return -EINVAL; - } -#endif if (IS_T1_CARD(card)){ card->u.aft.num_of_time_slots=NUM_OF_T1_CHANNELS; @@ -798,13 +959,14 @@ int wp_aft_te1_init (sdla_t* card, wandev_conf_t* conf) return wan_aft_init(card,conf); } +#endif +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_56K) int wp_aft_56k_init (sdla_t* card, wandev_conf_t* conf) { AFT_FUNC_DEBUG(); - wan_set_bit(CARD_DOWN,&card->wandev.critical); /* Verify configuration ID */ @@ -814,7 +976,6 @@ int wp_aft_56k_init (sdla_t* card, wandev_conf_t* conf) return -EINVAL; } - card->u.aft.chip_cfg_status=0; card->hw_iface.getcfg(card->hw, SDLA_COREREV, &card->u.aft.firm_ver); card->hw_iface.getcfg(card->hw, SDLA_COREID, &card->u.aft.firm_id); @@ -836,11 +997,7 @@ int wp_aft_56k_init (sdla_t* card, wandev_conf_t* conf) card->devname); return -EINVAL; } - -#if defined(WAN_DEBUG_MEM) - DEBUG_EVENT("%s: Total Mem %d\n",__FUNCTION__,wan_atomic_read(&wan_debug_mem)); -#endif - + if (IS_56K_MEDIA(&conf->fe_cfg)){ conf->fe_cfg.cfg.te_cfg.active_ch = 1; @@ -855,22 +1012,18 @@ int wp_aft_56k_init (sdla_t* card, wandev_conf_t* conf) return -EINVAL; } */ - sdla_56k_iface_init(&card->wandev.fe_iface); + sdla_56k_iface_init(&card->fe, &card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; -#if 1 - card->fe.write_fe_reg = a56k_write_fe; - card->fe.read_fe_reg = a56k_read_fe; - card->fe.__read_fe_reg = __a56k_read_fe; -#else - card->fe.write_fe_reg = a104_write_fe; - card->fe.read_fe_reg = a104_read_fe; - card->fe.__read_fe_reg = __a104_read_fe; -#endif + + card->fe.write_fe_reg = card->hw_iface.fe_write; /* a56k_write_fe;*/ + card->fe.read_fe_reg = card->hw_iface.fe_read; /* a56k_read_fe; */ + card->fe.__read_fe_reg = card->hw_iface.__fe_read; /* __a56k_read_fe; */ + card->wandev.fe_enable_timer = enable_timer; card->wandev.ec_enable_timer = enable_ec_timer; - card->wandev.te_link_state = callback_front_end_state; + card->wandev.te_link_state = handle_front_end_state; card->wandev.comm_port=0; @@ -885,6 +1038,7 @@ int wp_aft_56k_init (sdla_t* card, wandev_conf_t* conf) return wan_aft_init(card,conf); } +#endif static int wan_aft_init (sdla_t *card, wandev_conf_t* conf) { @@ -895,28 +1049,17 @@ static int wan_aft_init (sdla_t *card, wandev_conf_t* conf) card->wandev.clocking = conf->clocking; card->wandev.ignore_front_end_status = conf->ignore_front_end_status; card->wandev.ttl = conf->ttl; - card->wandev.interface = conf->interface; - card->wandev.comm_port = conf->comm_port; + card->wandev.electrical_interface = conf->electrical_interface; card->wandev.udp_port = conf->udp_port; card->wandev.new_if_cnt = 0; wan_atomic_set(&card->wandev.if_cnt,0); card->u.aft.chip_security_cnt=0; memcpy(&card->u.aft.cfg,&conf->u.aft,sizeof(wan_xilinx_conf_t)); + memcpy(&card->rtp_conf,&conf->rtp_conf,sizeof(conf->rtp_conf)); memset(card->u.aft.dev_to_ch_map,0,sizeof(card->u.aft.dev_to_ch_map)); memcpy(&card->tdmv_conf,&conf->tdmv_conf,sizeof(wan_tdmv_conf_t)); memcpy(&card->hwec_conf,&conf->hwec_conf,sizeof(wan_hwec_conf_t)); - memcpy(&card->rtp_conf,&conf->rtp_conf,sizeof(conf->rtp_conf)); - - if (card->u.aft.cfg.err_throttle_period == 0) { - card->u.aft.cfg.err_throttle_period=1; - } - - if (card->u.aft.cfg.err_throttle_timeout == 0) { - card->u.aft.cfg.err_throttle_timeout=10; - } - - card->u.aft.cfg.dma_per_ch = MAX_RX_BUF; card->u.aft.tdmv_api_rx = NULL; @@ -987,7 +1130,6 @@ static int wan_aft_init (sdla_t *card, wandev_conf_t* conf) card->u.aft.cfg.mru = card->wandev.mtu; } - if (card->u.aft.cfg.mru > MAX_WP_PRI_MTU || card->u.aft.cfg.mru < MIN_WP_PRI_MTU){ @@ -1003,16 +1145,18 @@ static int wan_aft_init (sdla_t *card, wandev_conf_t* conf) port_set_state(card,WAN_CONNECTING); - AFT_FUNC_DEBUG(); - WAN_TASKQ_INIT((&card->u.aft.port_task),0,aft_port_task,card); + + card->u.aft.chip_cfg_status=0; + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &used_cnt); - - card->hw_iface.getcfg(card->hw, SDLA_USEDCNT, &used_cnt); + /* ====================================================================== + * After this point we must call disable_comm() if we fail to configure + * =====================================================================*/ wan_clear_bit(CARD_DOWN,&card->wandev.critical); - __sdla_push_ptr_isr_array(card->hw,card,card->wandev.comm_port); + __sdla_push_ptr_isr_array(card->hw,card,WAN_FE_LINENO(&card->fe)); card->isr = &wp_aft_global_isr; @@ -1023,6 +1167,8 @@ static int wan_aft_init (sdla_t *card, wandev_conf_t* conf) err=aft_global_chip_configuration(card, conf); if (err){ aft_global_chip_disable(card); + disable_comm(card); + wan_set_bit(CARD_DOWN,&card->wandev.critical); return err; } @@ -1034,6 +1180,8 @@ static int wan_aft_init (sdla_t *card, wandev_conf_t* conf) err=aft_front_end_mismatch_check(card); if (err){ + disable_comm(card); + wan_set_bit(CARD_DOWN,&card->wandev.critical); return err; } @@ -1044,6 +1192,7 @@ static int wan_aft_init (sdla_t *card, wandev_conf_t* conf) aft_read_security(card); + err=aft_chip_configure(card,conf); if (err){ AFT_FUNC_DEBUG(); @@ -1052,6 +1201,8 @@ static int wan_aft_init (sdla_t *card, wandev_conf_t* conf) if (used_cnt==1){ aft_global_chip_disable(card); } + disable_comm(card); + wan_set_bit(CARD_DOWN,&card->wandev.critical); return err; } wan_set_bit(AFT_CHIP_CONFIGURED,&card->u.aft.chip_cfg_status); @@ -1071,7 +1222,6 @@ static int wan_aft_init (sdla_t *card, wandev_conf_t* conf) aft_read_security(card); - DEBUG_EVENT("%s: Configuring Device :%s FrmVr=%02X\n", card->devname,card->devname,card->u.aft.firm_ver); DEBUG_EVENT("%s: Global MTU = %d\n", @@ -1111,6 +1261,16 @@ static int wan_aft_init (sdla_t *card, wandev_conf_t* conf) } } + if(IS_BRI_CARD(card)){ + wan_set_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status); + wan_set_bit(AFT_TDM_RING_BUF,&card->u.aft.chip_cfg_status); + } + + if (card->wandev.config_id == WANCONFIG_AFT_ANALOG) { + wan_set_bit(AFT_TDM_SW_RING_BUF,&card->u.aft.chip_cfg_status); + } + + DEBUG_EVENT("%s: Global TDM Int = %s\n", card->devname, wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status) ? @@ -1126,20 +1286,15 @@ static int wan_aft_init (sdla_t *card, wandev_conf_t* conf) }else{ card->u.aft.tdmv_hw_dtmf = WANOPT_NO; } - DEBUG_EVENT("%s: Global TDM HW DTMF = %s\n", + DEBUG_EVENT("%s: TDM HW DTMF = %s\n", card->devname, (card->u.aft.tdmv_hw_dtmf == WANOPT_YES) ? "Enabled" : "Disabled"); - - DEBUG_EVENT("%s: IRQ Throttle Period=%i Timeout=%i\n", - card->devname, - card->u.aft.cfg.err_throttle_period, - card->u.aft.cfg.err_throttle_timeout); - err=aft_tdmv_init(card,conf); if (err){ disable_comm(card); + wan_set_bit(CARD_DOWN,&card->wandev.critical); return err; } @@ -1152,7 +1307,6 @@ static int wan_aft_init (sdla_t *card, wandev_conf_t* conf) err == 0 ? "Enabled" : "Disabled"); #endif - card->wandev.read_ec = aft_read_ec; card->wandev.write_ec = aft_write_ec; return 0; @@ -1194,12 +1348,12 @@ static int wan_aft_init (sdla_t *card, wandev_conf_t* conf) */ static int update (wan_device_t* wandev) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; netdevice_t* dev; volatile private_area_t* chan; /* sanity checks */ - if((wandev == NULL) || (wandev->private == NULL)) + if((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if(wandev->state == WAN_UNCONFIGURED) @@ -1219,17 +1373,6 @@ static int update (wan_device_t* wandev) return -EAGAIN; } -#if 0 -#warning "NENAD RTP TAP DEBUGGING" - if (card->wandev.rtp_tap_call_map) { - DEBUG_EVENT("%s: DISABLING RTP TAP\n",card->devname); - card->wandev.rtp_tap_call_map=0; - } else { - DEBUG_EVENT("%s: ENABLING RTP TAP\n",card->devname); - card->wandev.rtp_tap_call_map=0xFFFFFFFF; - } -#endif - DEBUG_TEST("%s: Chain Dma Status=0x%lX, TxCur=%d, TxPend=%d RxCur=%d RxPend=%d\n", chan->if_name, chan->dma_chain_status, @@ -1283,19 +1426,17 @@ static int update (wan_device_t* wandev) * < 0 failure (channel will not be created) */ +#ifdef AFT_TDM_API_SUPPORT static int aft_tdm_api_init(sdla_t *card, private_area_t *chan, wanif_conf_t *conf) { -#ifdef AFT_TDM_API_SUPPORT int err=0; -#endif if (chan->common.usedby != TDM_VOICE_API && chan->common.usedby != TDM_VOICE_DCHAN) { return 0; } -#ifdef AFT_TDM_API_SUPPORT if (chan->tdmv_zaptel_cfg) { return 0; } @@ -1303,7 +1444,7 @@ aft_tdm_api_init(sdla_t *card, private_area_t *chan, wanif_conf_t *conf) /* Initilaize TDM API Parameters */ chan->wp_tdm_api_dev.chan = chan; chan->wp_tdm_api_dev.card = card; - wan_spin_lock_init(&chan->wp_tdm_api_dev.lock); + wan_spin_lock_init(&chan->wp_tdm_api_dev.lock,"wp_aft_tdmapi_lock"); strncpy(chan->wp_tdm_api_dev.name,chan->if_name,WAN_IFNAME_SZ); if (conf->hdlc_streaming) { @@ -1317,6 +1458,7 @@ aft_tdm_api_init(sdla_t *card, private_area_t *chan, wanif_conf_t *conf) chan->wp_tdm_api_dev.cfg.rx_disable = 0; chan->wp_tdm_api_dev.cfg.tx_disable = 0; + chan->wp_tdm_api_dev.tx_q_len = MAX_AFT_DMA_CHAINS; if (IS_TE1_CARD(card)) { if (IS_T1_CARD(card)){ @@ -1326,6 +1468,22 @@ aft_tdm_api_init(sdla_t *card, private_area_t *chan, wanif_conf_t *conf) chan->wp_tdm_api_dev.cfg.hw_tdm_coding=WP_ALAW; chan->wp_tdm_api_dev.tdm_chan = chan->first_time_slot; } + + } else if (IS_BRI_CARD(card)) { + + if (chan->dchan_time_slot >= 0) { + chan->wp_tdm_api_dev.tdm_chan = 3; + } else { + chan->wp_tdm_api_dev.tdm_chan = (chan->first_time_slot % 2)+1; + } + + if (card->fe.fe_cfg.tdmv_law == WAN_TDMV_MULAW){ + chan->wp_tdm_api_dev.cfg.hw_tdm_coding=WP_MULAW; + } else { + chan->wp_tdm_api_dev.cfg.hw_tdm_coding=WP_ALAW; + } + chan->wp_tdm_api_dev.tx_q_len = 0; + } else { if (card->fe.fe_cfg.tdmv_law == WAN_TDMV_MULAW){ chan->wp_tdm_api_dev.cfg.hw_tdm_coding=WP_MULAW; @@ -1333,21 +1491,28 @@ aft_tdm_api_init(sdla_t *card, private_area_t *chan, wanif_conf_t *conf) } else { chan->wp_tdm_api_dev.cfg.hw_tdm_coding=WP_ALAW; chan->wp_tdm_api_dev.tdm_chan = chan->first_time_slot+1; - } + } + + } - if (IS_T1_CARD(card) || IS_FXOFXS_CARD(card)){ - /* Convert active_ch bit map to user */ - chan->wp_tdm_api_dev.active_ch = conf->active_ch << 1; - }else{ + if (IS_E1_CARD(card)){ chan->wp_tdm_api_dev.active_ch = conf->active_ch; - } + }else{ + chan->wp_tdm_api_dev.active_ch = conf->active_ch << 1; + } + + DEBUG_TEST("%s: TDM API ACTIVE CH 0x%08X CHAN=%i\n", + chan->if_name, chan->wp_tdm_api_dev.active_ch,chan->wp_tdm_api_dev.tdm_chan); chan->wp_tdm_api_dev.cfg.idle_flag = conf->u.aft.idle_flag; chan->wp_tdm_api_dev.cfg.rbs_tx_bits = conf->u.aft.rbs_cas_idle; chan->wp_tdm_api_dev.tdm_span = card->tdmv_conf.span_no; + chan->wp_tdm_api_dev.dtmfsupport = card->u.aft.tdmv_hw_dtmf; + + err=wanpipe_tdm_api_reg(&chan->wp_tdm_api_dev); if (err){ return err; @@ -1355,13 +1520,8 @@ aft_tdm_api_init(sdla_t *card, private_area_t *chan, wanif_conf_t *conf) wan_set_bit(0,&chan->wp_tdm_api_dev.init); return err; -#else - DEBUG_EVENT("%s: TDM API support not compiled in\n", - card->devname); - return -EINVAL; -#endif - } +#endif static int aft_tdm_api_free(sdla_t *card, private_area_t *chan) { @@ -1402,12 +1562,15 @@ static int aft_chan_if_init(sdla_t *card, netdevice_t *dev, private_area_t *chan WAN_IFQ_INIT(&chan->wp_tx_pending_list,0); WAN_IFQ_INIT(&chan->wp_tx_complete_list,0); - + WAN_IFQ_INIT(&chan->wp_tx_hdlc_rpt_list,0); + WAN_IFQ_INIT(&chan->wp_rx_free_list,0); WAN_IFQ_INIT(&chan->wp_rx_complete_list,0); WAN_IFQ_INIT(&chan->wp_rx_stack_complete_list, 0); + WAN_IFQ_INIT(&chan->wp_rx_bri_dchan_complete_list, 0); + wan_trace_info_init(&chan->trace_info,MAX_TRACE_QUEUE); /* Initiaize Tx/Rx DMA Chains */ @@ -1451,8 +1614,7 @@ static int aft_ss7_if_init(sdla_t *card, private_area_t *chan, wanif_conf_t *con chan->cfg.ss7_lssu_size); wan_spin_lock_irq(&card->wandev.lock,&smp_flags); - card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG), - &lcfg_reg); + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG),&lcfg_reg); if (chan->cfg.ss7_mode){ aft_lcfg_ss7_mode4096_cfg(&lcfg_reg,chan->cfg.ss7_lssu_size); }else{ @@ -1511,7 +1673,14 @@ static int aft_transp_if_init(sdla_t *card, private_area_t *chan, wanif_conf_t * card->devname,chan->if_name, chan->idle_flag,chan->max_idle_size); - chan->idle_flag=0x7E; + + if(conf->u.aft.idle_flag){ + chan->idle_flag=conf->u.aft.idle_flag; + DEBUG_EVENT("%s: Idle flag :0x%02x\n", card->devname, chan->idle_flag); + } else { + chan->idle_flag=0x7E; + } + if (chan->tdmv_zaptel_cfg){ #if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) @@ -1555,11 +1724,11 @@ static int aft_transp_if_init(sdla_t *card, private_area_t *chan, wanif_conf_t * static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf, int channelized, int dchan) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; private_area_t* chan; int dma_per_ch=card->u.aft.cfg.dma_per_ch; - int err = 0; - + int err = 0, dma_alignment = 4, i =0; + DEBUG_EVENT( "%s: Configuring Interface: %s\n", card->devname, wan_netif_name(dev)); @@ -1569,7 +1738,6 @@ static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* return -EINVAL; } - if (card->adptr_subtype != AFT_SUBTYPE_SHARK){ if (card->u.aft.security_id != 0x01 && card->u.aft.security_cnt >= 2){ @@ -1594,7 +1762,6 @@ static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* memset(chan, 0, sizeof(private_area_t)); memcpy(&chan->cfg,&conf->u.aft,sizeof(chan->cfg)); - chan->true_if_encoding=conf->true_if_encoding; aft_chan_if_init(card,dev,chan); @@ -1604,14 +1771,37 @@ static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf->hdlc_streaming=0; } + if (card->wandev.config_id == WANCONFIG_AFT_ISDN_BRI) { + chan->single_dma_chain = 1; + } + + /* If 'dchan_time_slot' is less than zero, it is NOT a dchan. + If 'dchan_time_slot' is greater or equal to zero it is a dchan. + NOTE: 'dchan' is NOT the same as 'hdlc_eng'. The 'hdlc_eng' is + a flag for AFT hardware to use it's HDLC core. + */ + chan->dchan_time_slot = dchan; + + if(IS_56K_CARD(card)){ chan->single_dma_chain = 1; conf->hdlc_streaming=1; } + + if (chan->cfg.hdlc_repeat) { + if (!conf->hdlc_streaming) { + DEBUG_EVENT("%s: HDLC Repeat configured for non hdlc channel!\n", + chan->if_name); + err= -EINVAL; + goto new_if_error; + } + chan->single_dma_chain = 1; + conf->hdlc_streaming=1; + } - if (channelized){ + if (channelized) { chan->channelized_cfg=1; - if (wan_netif_priv(dev)){ + if (wan_netif_priv(dev)) { #if 1 private_area_t *cptr; for (cptr=wan_netif_priv(dev);cptr->next!=NULL;cptr=cptr->next); @@ -1622,10 +1812,10 @@ static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* chan->next = wan_netif_priv(dev); wan_netif_set_priv(dev, chan); #endif - }else{ + } else { wan_netif_set_priv(dev, chan); } - }else{ + } else { chan->channelized_cfg=0; wan_netif_set_priv(dev, chan); } @@ -1799,6 +1989,11 @@ static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* DEBUG_EVENT( "%s:%s: Running in Stack mode.\n", card->devname,chan->if_name); + }else if (strcmp(conf->usedby, "NETGRAPH") == 0) { + chan->common.usedby = WP_NETGRAPH; + DEBUG_EVENT( "%s:%s: Running in Netgraph mode.\n", + card->devname,chan->if_name); + }else{ DEBUG_EVENT( "%s:%s: Error: Invalid IF operation mode %s\n", card->devname,chan->if_name,conf->usedby); @@ -1812,7 +2007,11 @@ static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* *==============================================*/ if (conf->hwec.enable){ - card->wandev.ec_enable_map |= conf->active_ch; + if (card->wandev.config_id == WANCONFIG_AFT_ISDN_BRI) { + card->wandev.ec_enable_map = 0x3; + }else{ + card->wandev.ec_enable_map |= conf->active_ch; + } } /* Read user specified active_ch, we must do it @@ -1824,14 +2023,14 @@ static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* chan->time_slot_map); if (!chan->num_of_time_slots){ - DEBUG_EVENT("%s: Error: Invalid number of timeslots in map 0x%08lX!\n", + DEBUG_EVENT("%s: Error: Invalid number of timeslots in map 0x%08X!\n", chan->if_name,chan->time_slot_map); return -EINVAL; } if (card->wandev.config_id == WANCONFIG_AFT_ANALOG && chan->num_of_time_slots > 1) { DEBUG_EVENT( - "%s: Error: Invalid Analog number of timeslots in map 0x%08lX: (Valid=1)\n", + "%s: Error: Invalid Analog number of timeslots in map 0x%08X: (Valid=1)\n", chan->if_name,chan->time_slot_map); return -EINVAL; } @@ -1875,9 +2074,10 @@ static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* chan->hdlc_eng = conf->hdlc_streaming; - DEBUG_EVENT("%s: HDLC Eng :%s\n", + DEBUG_EVENT("%s: HDLC Eng :%s | %s\n", card->devname, - chan->hdlc_eng?"On":"Off (Transparent)"); + chan->hdlc_eng?"On":"Off (Transparent)", + chan->cfg.hdlc_repeat?"Repeat":"N/A"); /* Obtain the DMA MRU size based on user confgured @@ -1885,11 +2085,7 @@ static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* chan->dma_mru = chan->mtu; -#if defined(__LINUX__) chan->dma_mru = aft_valid_mtu(chan->dma_mru); -#else - chan->dma_mru = aft_valid_mtu(chan->dma_mru); -#endif if (!chan->dma_mru){ DEBUG_EVENT("%s:%s: Error invalid MTU %d MRU %d\n", card->devname, @@ -1899,13 +2095,11 @@ static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* goto new_if_error; } - if ((chan->dma_mru/2) > aft_rx_copyback) { - aft_rx_copyback=chan->dma_mru/2; - } - if (conf->single_tx_buf || - ((card->adptr_type == A101_ADPTR_2TE1 || card->adptr_type == A101_ADPTR_1TE1) && - card->u.aft.firm_id == AFT_DS_FE_CORE_ID)){ + IS_BRI_CARD(card) || + ((card->adptr_type == A101_ADPTR_2TE1 || + card->adptr_type == A101_ADPTR_1TE1) && + card->u.aft.firm_id == AFT_DS_FE_CORE_ID)){ chan->single_dma_chain=1; chan->max_tx_bufs=MAX_AFT_DMA_CHAINS; dma_per_ch=MAX_AFT_DMA_CHAINS; @@ -1995,10 +2189,12 @@ static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* } +#ifdef AFT_TDM_API_SUPPORT err=aft_tdm_api_init(card,chan,conf); if (err){ goto new_if_error; } +#endif err=aft_hwec_config(card,chan,conf,1); if (err){ @@ -2017,7 +2213,94 @@ static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* chan->single_dma_chain?"Off":"On", card->wandev.ec_enable_map?"On":"Off"); - + /* New DMA support A-DMA */ + dma_alignment = 4; + if (chan->channelized_cfg && !chan->hdlc_eng){ + dma_alignment = 0x200; + } + + err = card->hw_iface.busdma_tag_create( card->hw, + &chan->rx_dma_chain_table[0], + dma_alignment, + chan->dma_mru, + MAX_AFT_DMA_CHAINS); + if (err) { + DEBUG_EVENT("%s: Failed to allocate DMA Rx mtag!\n", + card->devname); + err = -EINVAL; + goto new_if_error; + } + err = card->hw_iface.busdma_tag_create( card->hw, + &chan->tx_dma_chain_table[0], + dma_alignment, + chan->dma_mru, + MAX_AFT_DMA_CHAINS); + if (err) { + DEBUG_EVENT("%s: Failed to allocate DMA Tx mtag!\n", + card->devname); + err = card->hw_iface.busdma_tag_destroy( + card->hw, + &chan->rx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS); + err = -EINVAL; + goto new_if_error; + } + + for (i=0;ihw_iface.busdma_alloc( + card->hw, + &chan->tx_dma_chain_table[i]); + if (err){ + DEBUG_EVENT( + "%s:%s: Unable to load TX DMA buffer %d (%d)!\n", + card->devname, chan->if_name, i, err); + err = -EINVAL; + break; + } + DEBUG_DMA("%s:%s: Alloc DMA TX buffer %d virt=%p len=%d\n", + card->devname, chan->if_name, i, + chan->tx_dma_chain_table[i].dma_virt, + chan->dma_mru); + + err = card->hw_iface.busdma_alloc( + card->hw, + &chan->rx_dma_chain_table[i]); + if (err){ + DEBUG_EVENT( + "%s:%s: Unable to load RX DMA buffer %d (%d)!\n", + card->devname, chan->if_name, i, err); + err = -EINVAL; + break; + } + DEBUG_DMA("%s:%s: Alloc DMA RX buffer %d virt=%p len=%d\n", + card->devname, chan->if_name, i, + chan->rx_dma_chain_table[i].dma_virt, + chan->dma_mru); + } + if (err){ + + for (i=0;ihw_iface.busdma_free( + card->hw, + &chan->rx_dma_chain_table[i]); + card->hw_iface.busdma_free( + card->hw, + &chan->tx_dma_chain_table[i]); + } + err = card->hw_iface.busdma_tag_destroy( + card->hw, + &chan->rx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS); + err = card->hw_iface.busdma_tag_destroy( + card->hw, + &chan->tx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS); + err = -EINVAL; + goto new_if_error; + } + err=aft_alloc_rx_dma_buff(card, chan, dma_per_ch,0); if (err){ @@ -2086,12 +2369,14 @@ static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* if_init(dev); # endif #else - chan->common.is_netdev = 1; + if (chan->common.usedby != TDM_VOICE && + chan->common.usedby != TDM_VOICE_API){ + chan->common.is_netdev = 1; + } chan->common.iface.open = &if_open; chan->common.iface.close = &if_close; chan->common.iface.output = &if_send; chan->common.iface.ioctl = &if_do_ioctl; - chan->common.iface.get_stats = &if_stats; chan->common.iface.tx_timeout= &if_tx_timeout; if (wan_iface.attach){ if (!ifunit(wan_netif_name(dev))){ @@ -2122,7 +2407,7 @@ static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* we have to go back to it */ chan->max_tx_bufs_orig = chan->max_tx_bufs; - chan->common.state = WAN_CONNECTING; + set_chan_state(card, dev, WAN_CONNECTING); //chan->common.state = WAN_CONNECTING; DEBUG_EVENT( "\n"); @@ -2136,10 +2421,11 @@ new_if_error: static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) { int err=-EINVAL; - sdla_t *card=wandev->private; + sdla_t *card=wandev->priv; wan_netif_set_priv(dev, NULL); + if (IS_E1_CARD(card) && !(WAN_FE_FRAME(&card->fe) == WAN_FR_UNFRAMED)) { conf->active_ch = conf->active_ch << 1; wan_clear_bit(0,&conf->active_ch); @@ -2156,6 +2442,11 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) case WANCONFIG_AFT_ANALOG: err = wp_tdmv_remora_init(&card->tdmv_iface); break; +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_BRI) + case WANCONFIG_AFT_ISDN_BRI: + err = wp_tdmv_bri_init(&card->tdmv_iface); + break; +#endif default: err = wp_tdmv_te1_init(&card->tdmv_iface); break; @@ -2185,14 +2476,23 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) err=-EINVAL; - if (strcmp(conf->usedby, "TDM_VOICE") == 0 || - strcmp(conf->usedby, "TDM_VOICE_API") == 0){ + if (strcmp(conf->usedby, "TDM_VOICE") == 0 || strcmp(conf->usedby, "TDM_VOICE_API") == 0){ int i=0,master_if=-1; u32 active_ch=conf->active_ch; + if(IS_BRI_CARD(card)) { + wan_set_bit(BRI_DCHAN_LOGIC_CHAN,&card->u.aft.tdmv_dchan); + } + if (card->wandev.fe_iface.active_map){ - conf->active_ch = card->wandev.fe_iface.active_map(&card->fe); + conf->active_ch = card->wandev.fe_iface.active_map(&card->fe, 0); + + if(IS_BRI_CARD(card)) { + wan_set_bit(BRI_DCHAN_LOGIC_CHAN,&conf->active_ch); + wan_set_bit(BRI_DCHAN_LOGIC_CHAN,&card->tdmv_conf.dchan); + } + active_ch=conf->active_ch; } @@ -2201,12 +2501,12 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) return err; } - DEBUG_TEST("%s: TDM VOICE: TESTING FOR DCHAN CHAN in 0x%08X Timeslots=%i CFG DCHAN=0x%08X MasterIF=%i\n", + DEBUG_TEST("%s: TDM VOICE: DCHAN CHAN in 0x%08X Timeslots=%i CFG DCHAN=0x%08X MasterIF=%i\n", card->devname, active_ch, card->u.aft.num_of_time_slots, card->tdmv_conf.dchan,master_if); - for (i=0;iu.aft.num_of_time_slots;i++){ + if (wan_test_bit(i,&active_ch)){ int dchan=-1; conf->active_ch=0; @@ -2231,15 +2531,45 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) WAN_TDMV_CALL(software_init, (&card->wan_tdmv), err); } #endif - }else{ - card->tdmv_conf.dchan=0; - err=new_if_private(wandev,dev,conf,0,-1); + + if(IS_BRI_CARD(card)) { + + if (conf->active_ch & ~(0x07)) { + DEBUG_EVENT("%s: Error: BRI Active Channels range 1 to 3: Range 0x%08X invalid\n", + card->devname,conf->active_ch); + err=-EINVAL; + goto new_if_cfg_skip; + } + + if (wan_test_bit(BRI_DCHAN_ACTIVE_CFG_CHAN, &conf->active_ch)) { + /* if bit 2 is set, user wants to run on the bri dchan */ + wan_set_bit(BRI_DCHAN_LOGIC_CHAN, &card->u.aft.tdmv_dchan); + card->u.aft.tdmv_dchan = BRI_DCHAN_LOGIC_CHAN; + err=new_if_private(wandev,dev,conf,0, BRI_DCHAN_LOGIC_CHAN); + } else { + /* BRI B-Channels */ + card->u.aft.tdmv_dchan = 0; + conf->active_ch = conf->active_ch << (2*WAN_FE_LINENO(&card->fe)); + DEBUG_EVENT("%s: Configure BRI Active CH 0x%08X\n", + card->devname,conf->active_ch); + err=new_if_private(wandev,dev,conf,0,-1); + } + + } else { + + card->tdmv_conf.dchan=0; + err=new_if_private(wandev,dev,conf,0,-1); + } } - +new_if_cfg_skip: + if (err == 0 && wan_netif_priv(dev)) { wan_smp_flag_t flags; + int card_use_counter; + + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &card_use_counter); /* If FRONT End is down, it means that the DMA * is disabled. In this case don't try to @@ -2247,20 +2577,28 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) * function do this, after front end has come up */ wan_spin_lock_irq(&card->wandev.lock,&flags); - + aft_dev_open(card, wan_netif_priv(dev)); - + if (card->wandev.state == WAN_CONNECTED){ set_chan_state(card, dev, WAN_CONNECTED); } wan_spin_unlock_irq(&card->wandev.lock,&flags); - if (card->wandev.config_id == WANCONFIG_AFT_ANALOG) { + if (card->wandev.config_id == WANCONFIG_AFT_ANALOG || + card->wandev.config_id == WANCONFIG_AFT_SERIAL) { + wan_spin_lock_irq(&card->wandev.lock,&flags); card->fe.fe_status = FE_CONNECTED; handle_front_end_state(card); set_chan_state(card, dev, WAN_CONNECTED); wan_spin_unlock_irq(&card->wandev.lock,&flags); + + } else if (card->wandev.config_id == WANCONFIG_AFT_ISDN_BRI) { + + wan_spin_lock_irq(&card->wandev.lock,&flags); + enable_data_error_intr(card); + wan_spin_unlock_irq(&card->wandev.lock,&flags); } } else if (err && wan_netif_priv(dev)){ @@ -2270,7 +2608,7 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) wan_netif_set_priv(dev, NULL); } } - + return err; } @@ -2296,8 +2634,8 @@ static int del_if_private (wan_device_t* wandev, netdevice_t* dev) { private_area_t* chan = wan_netif_priv(dev); sdla_t* card; - netskb_t *skb; wan_smp_flag_t flags; + int i; if (!chan){ DEBUG_EVENT("%s: Critical Error del_if_private() chan=NULL!\n", @@ -2359,36 +2697,47 @@ static int del_if_private (wan_device_t* wandev, netdevice_t* dev) aft_free_tx_descriptors(chan); aft_free_rx_descriptors(chan); - - while ((skb=wan_skb_dequeue(&chan->wp_rx_free_list)) != NULL) { -#ifdef __LINUX__ - if (skb_shinfo(skb)->frag_list || - skb_shinfo(skb)->nr_frags) { - DEBUG_EVENT("%s: Warning: SKB Corruption ch=%li!\n", - chan->if_name,chan->logic_ch_num); - continue; - } -#endif - wan_skb_free(skb); - } - while ((skb=wan_skb_dequeue(&chan->wp_rx_complete_list)) != NULL){ - wan_skb_free(skb); - } - - while ((skb=wan_skb_dequeue(&chan->wp_rx_stack_complete_list)) != NULL){ - wan_skb_free(skb); - } + wan_spin_unlock_irq(&card->wandev.lock,&flags); - while ((skb=wan_skb_dequeue(&chan->wp_tx_pending_list)) != NULL){ - wan_skb_free(skb); - } + for (i=0;iwp_tx_complete_list)) != NULL){ - wan_skb_free(skb); + card->hw_iface.busdma_free( + card->hw, + &chan->rx_dma_chain_table[i]); + card->hw_iface.busdma_free( + card->hw, + &chan->tx_dma_chain_table[i]); } + card->hw_iface.busdma_tag_destroy( + card->hw, + &chan->rx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS); + card->hw_iface.busdma_tag_destroy( + card->hw, + &chan->tx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS); + + wan_spin_lock_irq(&card->wandev.lock,&flags); + + WAN_IFQ_DMA_PURGE(&chan->wp_rx_free_list); + WAN_IFQ_DESTROY(&chan->wp_rx_free_list); + + WAN_IFQ_PURGE(&chan->wp_rx_complete_list); + WAN_IFQ_DESTROY(&chan->wp_rx_complete_list); + WAN_IFQ_PURGE(&chan->wp_rx_stack_complete_list); + WAN_IFQ_DESTROY(&chan->wp_rx_stack_complete_list); + + WAN_IFQ_PURGE(&chan->wp_tx_pending_list); + WAN_IFQ_DESTROY(&chan->wp_tx_pending_list); + WAN_IFQ_PURGE(&chan->wp_rx_bri_dchan_complete_list); + WAN_IFQ_DESTROY(&chan->wp_rx_bri_dchan_complete_list); + + WAN_IFQ_PURGE(&chan->wp_tx_complete_list); + WAN_IFQ_DESTROY(&chan->wp_tx_complete_list); + if (chan->tx_idle_skb){ wan_skb_free(chan->tx_idle_skb); chan->tx_idle_skb=NULL; @@ -2432,8 +2781,10 @@ static int del_if (wan_device_t* wandev, netdevice_t* dev) { private_area_t* chan=wan_netif_priv(dev); wan_smp_flag_t flags; - sdla_t *card; - + sdla_t *card; + int card_use_cnt=0; + int err=0; + if (!chan){ DEBUG_EVENT("%s: Critical Error del_if() chan=NULL!\n", wan_netif_name(dev)); @@ -2445,7 +2796,10 @@ static int del_if (wan_device_t* wandev, netdevice_t* dev) wan_netif_name(dev)); return 0; } + + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &card_use_cnt); + wan_spin_lock_irq(&card->wandev.lock,&flags); aft_dev_close(card,chan); wan_spin_unlock_irq(&card->wandev.lock,&flags); @@ -2469,9 +2823,34 @@ static int del_if (wan_device_t* wandev, netdevice_t* dev) * shutting down all TDMV channels */ wan_spin_lock_irq(&card->wandev.lock,&flags); - aft_tdm_intr_ctrl(card,0); - aft_fifo_intr_ctrl(card, 0); - + if (IS_BRI_CARD(card)) { + int card_use_cnt; + + card->wandev.state=WAN_DISCONNECTED; + + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &card_use_cnt); + if (card_use_cnt == 1) { + DEBUG_TEST("%s: BRI Disabling TDMV INTR\n", + card->devname); + aft_tdm_intr_ctrl(card,0); + aft_fifo_intr_ctrl(card, 0); + } else { + u32 dmareg; + /* By removing timeslot out of the global + interrupt we can disable the tdm global isr. + This code re-triggers it just in case */ + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_DMA_CTRL_REG),&dmareg); + wan_set_bit(AFT_DMACTRL_TDMV_RX_TOGGLE,&dmareg); + wan_set_bit(AFT_DMACTRL_TDMV_TX_TOGGLE,&dmareg); + card->hw_iface.bus_write_4(card->hw, + AFT_PORT_REG(card,AFT_DMA_CTRL_REG),dmareg); + } + } else { + aft_tdm_intr_ctrl(card,0); + aft_fifo_intr_ctrl(card, 0); + } + /* Disable RTP Tap */ card->wandev.rtp_len=0; @@ -2505,10 +2884,14 @@ static int del_if (wan_device_t* wandev, netdevice_t* dev) aft_tdmv_free(card); } #endif - return 0; + + err=0; } else { - return del_if_private(wandev,dev); + err=del_if_private(wandev,dev); } + + return err; + } @@ -2556,7 +2939,12 @@ static int if_init (netdevice_t* dev) #endif dev->get_stats = &if_stats; +#if 0 + dev->tx_timeout = &if_tx_timeout; + dev->watchdog_timeo = 2*HZ; +#else if (chan->common.usedby == TDM_VOICE || + chan->common.usedby == TDM_VOICE_DCHAN || chan->common.usedby == TDM_VOICE_API){ dev->tx_timeout = NULL; }else{ @@ -2564,8 +2952,8 @@ static int if_init (netdevice_t* dev) } dev->watchdog_timeo = 2*HZ; +#endif dev->do_ioctl = if_do_ioctl; - dev->change_mtu = if_change_mtu; if (chan->common.usedby == BRIDGE || chan->common.usedby == BRIDGE_NODE){ @@ -2586,6 +2974,8 @@ static int if_init (netdevice_t* dev) dev->type = ARPHRD_PPP; dev->mtu = chan->mtu; dev->hard_header_len = 0; + dev->hard_header = NULL; + dev->rebuild_header = NULL; if (chan->common.usedby == API || chan->common.usedby == STACK){ if (chan->hdlc_eng) { @@ -2670,7 +3060,9 @@ static int if_open (netdevice_t* dev) * how long has the interface been up */ wan_getcurrenttime(&chan->router_start_time, NULL); +#if !defined(WANPIPE_IFNET_QUEUE_POLICY_INIT_OFF) WAN_NETIF_START_QUEUE(dev); +#endif if (card->wandev.state == WAN_CONNECTED){ set_chan_state(card, dev, WAN_CONNECTED); @@ -2749,7 +3141,7 @@ static int if_close (netdevice_t* dev) static void disable_comm (sdla_t *card) { - wan_smp_flag_t flags,flags1; + wan_smp_flag_t smp_flags,smp_flags1; int used_cnt; AFT_FUNC_DEBUG(); @@ -2758,69 +3150,64 @@ static void disable_comm (sdla_t *card) #else /* Unconfiging, only on shutdown */ - if (IS_TE1_CARD(card) || IS_56K_CARD(card)) { - wan_smp_flag_t smp_flags,smp_flags1; - if (card->wandev.fe_iface.pre_release){ - card->wandev.fe_iface.pre_release(&card->fe); - } - card->hw_iface.hw_lock(card->hw,&smp_flags1); - wan_spin_lock_irq(&card->wandev.lock, &smp_flags); - __aft_fe_intr_ctrl(card, 0); - if (card->wandev.fe_iface.unconfig){ - card->wandev.fe_iface.unconfig(&card->fe); - } - __aft_fe_intr_ctrl(card, 1); - wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); - card->hw_iface.hw_unlock(card->hw,&smp_flags1); - + if (card->wandev.fe_iface.pre_release){ + card->wandev.fe_iface.pre_release(&card->fe); } - - wan_spin_lock_irq(&card->wandev.lock,&flags); - - wan_set_bit(CARD_DOWN,&card->wandev.critical); + card->hw_iface.hw_lock(card->hw,&smp_flags1); + wan_spin_lock_irq(&card->wandev.lock, &smp_flags); + __aft_fe_intr_ctrl(card, 0); + if (card->wandev.fe_iface.unconfig){ + card->wandev.fe_iface.unconfig(&card->fe); + } + __aft_fe_intr_ctrl(card, 1); + wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + card->hw_iface.hw_unlock(card->hw,&smp_flags1); /* Disable DMA ENGINE before we perform * core reset. Otherwise, we will receive * rx fifo errors on subsequent resetart. */ - disable_data_error_intr(card,DEVICE_DOWN); - + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); + disable_data_error_intr(card,LINK_DOWN); #if defined(AFT_RTP_SUPPORT) aft_rtp_unconfig(card); #endif - - wan_spin_unlock_irq(&card->wandev.lock,&flags); - + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + aft_chip_unconfigure(card); + /* Only disable the irq completely once the + chip unconfigure is executed */ + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); + disable_data_error_intr(card,DEVICE_DOWN); + wan_set_bit(CARD_DOWN,&card->wandev.critical); + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + WP_DELAY(10); - card->hw_iface.getcfg(card->hw, SDLA_USEDCNT, &used_cnt); + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &used_cnt); - card->hw_iface.hw_lock(card->hw,&flags1); - wan_spin_lock_irq(&card->wandev.lock,&flags); + card->hw_iface.hw_lock(card->hw,&smp_flags1); + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); __aft_fe_intr_ctrl(card, 0); aft_hwdev[card->wandev.card_type].aft_led_ctrl(card, WAN_AFT_RED, 0,WAN_AFT_ON); aft_hwdev[card->wandev.card_type].aft_led_ctrl(card, WAN_AFT_GREEN, 0, WAN_AFT_ON); __aft_fe_intr_ctrl(card, 1); - wan_spin_unlock_irq(&card->wandev.lock,&flags); - card->hw_iface.hw_unlock(card->hw,&flags1); + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + card->hw_iface.hw_unlock(card->hw,&smp_flags1); - __sdla_pull_ptr_isr_array(card->hw,card,card->wandev.comm_port); + __sdla_pull_ptr_isr_array(card->hw,card,WAN_FE_LINENO(&card->fe)); if (used_cnt<=1){ DEBUG_EVENT("%s: Global Chip Shutdown Usage=%d\n", card->devname,used_cnt); - wan_spin_lock_irq(&card->wandev.lock,&flags); + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); aft_global_chip_disable(card); - wan_spin_unlock_irq(&card->wandev.lock,&flags); + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); } -#if defined(WAN_DEBUG_MEM) - DEBUG_EVENT("%s: Total Mem %d\n",__FUNCTION__,wan_atomic_read(&wan_debug_mem)); -#endif #endif return; } @@ -2853,7 +3240,7 @@ static void if_tx_timeout (netdevice_t *dev) * is only used as a last resort. */ - ++chan->if_stats.collisions; + WAN_NETIF_STATS_INC_COLLISIONS(&chan->common); //++chan->if_stats.collisions; DEBUG_EVENT( "%s: Transmit timed out on %s\n", card->devname, @@ -2870,7 +3257,7 @@ static void if_tx_timeout (netdevice_t *dev) chan->tx_pending_chain_indx, cur_dma_ptr, chan->tx_attempts, - chan->if_stats.tx_packets); + WAN_NETIF_STATS_TX_PACKETS(&chan->common)); if (wan_test_bit(TX_DMA_BUSY,&chan->dma_status)){ wan_clear_bit(TX_DMA_BUSY,&chan->dma_status); @@ -2896,18 +3283,8 @@ static void if_tx_timeout (netdevice_t *dev) aft_list_tx_descriptors(chan); #endif - WAN_NETIF_WAKE_QUEUE(dev); - if (chan->common.usedby == API){ - wan_wakeup_api(chan); - }else if (chan->common.usedby == STACK){ - wanpipe_lip_kick(chan,0); - }else if (chan->common.usedby == TDM_VOICE_DCHAN){ -#ifdef AFT_TDM_API_SUPPORT - if (is_tdm_api(chan,&chan->wp_tdm_api_dev)){ - wanpipe_tdm_api_kick(&chan->wp_tdm_api_dev); - } -#endif - } + wanpipe_wake_stack(chan); + } @@ -2944,6 +3321,7 @@ static void if_tx_timeout (netdevice_t *dev) * non-0 packet may be re-transmitted * */ + #if defined(__LINUX__) static int if_send (netskb_t* skb, netdevice_t* dev) #else @@ -2953,6 +3331,7 @@ static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct private_area_t *chan = wan_netif_priv(dev); sdla_t *card = chan->card; int err; + netskb_t *rskb=NULL; wan_smp_flag_t smp_flags; /* Mark interface as busy. The kernel will not @@ -2970,6 +3349,7 @@ static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct return 0; } + DEBUG_TX("%s: Sending %d bytes\n", wan_netif_name(dev), wan_skb_len(skb)); /* Non 2.4 kernels used to call if_send() * after TX_TIMEOUT seconds have passed of interface * being busy. Same as if_tx_timeout() in 2.4 kernels */ @@ -2981,7 +3361,7 @@ static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct * that our device never stays busy more than 5 seconds. So this * is only used as a last resort. */ - ++chan->if_stats.collisions; + WAN_NETIF_STATS_COLLISIONS(&chan->common); //++chan->if_stats.collisions; if((SYSTEM_TICKS - chan->tick_counter) < (5 * HZ)) { return 1; } @@ -2992,13 +3372,14 @@ static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct err=0; if (chan->common.state != WAN_CONNECTED){ + #if 1 WAN_NETIF_STOP_QUEUE(dev); wan_netif_set_ticks(dev, SYSTEM_TICKS); - ++chan->if_stats.tx_carrier_errors; + WAN_NETIF_STATS_INC_TX_CARRIER_ERRORS(&chan->common); //++chan->if_stats.tx_carrier_errors; return 1; #else - ++chan->if_stats.tx_carrier_errors; + WAN_NETIF_STATS_INC_TX_CARRIER_ERRORS(&chan->common); //++chan->if_stats.tx_carrier_errors; wan_skb_free(skb); WAN_NETIF_START_QUEUE(dev); err=0; @@ -3006,6 +3387,7 @@ static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct #endif } + if (chan->channelized_cfg) { private_area_t *top_chan=wan_netif_priv(chan->common.dev); @@ -3024,10 +3406,15 @@ static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct err=0; goto if_send_exit_crit; } - - chan=(private_area_t*)card->u.aft.dev_to_ch_map[card->u.aft.tdmv_dchan-1]; + + if(IS_BRI_CARD(card)) { + chan=(private_area_t*)card->u.aft.dev_to_ch_map[BRI_DCHAN_LOGIC_CHAN]; + }else{ + chan=(private_area_t*)card->u.aft.dev_to_ch_map[card->u.aft.tdmv_dchan-1]; + } + if (!chan){ - DEBUG_EVENT("%s: DCHAN TX No DCHAN Configured by not preset!\n", + DEBUG_EVENT("%s: Warning: DCHAN TX: No DCHAN Configured (not preset)! Discarding data.\n", card->devname); wan_skb_free(skb); WAN_NETIF_START_QUEUE(dev); @@ -3035,7 +3422,7 @@ static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct goto if_send_exit_crit; } - if (!chan->hdlc_eng){ + if (!chan->hdlc_eng || (IS_BRI_CARD(card) && chan->dchan_time_slot < 0)){ wan_skb_free(skb); WAN_NETIF_START_QUEUE(dev); err=0; @@ -3052,32 +3439,43 @@ static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct /* For TDM_VOICE_API no tx is supported in if_send */ if (chan->common.usedby == TDM_VOICE_API){ - ++chan->if_stats.tx_errors; + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); WAN_NETIF_START_QUEUE(dev); + err=0; goto if_send_exit_crit; } if (chan->common.usedby == API){ - + if (sizeof(api_tx_hdr_t) >= wan_skb_len(skb)){ + wan_skb_free(skb); - ++chan->if_stats.tx_errors; + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); WAN_NETIF_START_QUEUE(dev); err=0; goto if_send_exit_crit; } - if (chan->cfg.ss7_enable){ + if (chan->cfg.ss7_enable) { err=aft_ss7_tx_mangle(card,chan,skb); if (err){ wan_skb_free(skb); - ++chan->if_stats.tx_errors; + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); WAN_NETIF_START_QUEUE(dev); err=0; goto if_send_exit_crit; } - }else{ + } else if (chan->cfg.hdlc_repeat) { + err=aft_hdlc_repeat_mangle(card,chan,skb,&rskb); + if (err){ + wan_skb_free(skb); + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); + WAN_NETIF_START_QUEUE(dev); + err=0; + goto if_send_exit_crit; + } + } else { wan_skb_pull(skb,sizeof(api_tx_hdr_t)); } } @@ -3092,7 +3490,7 @@ static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct chan->num_of_time_slots); } wan_skb_free(skb); - ++chan->if_stats.tx_errors; + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //++chan->if_stats.tx_errors; WAN_NETIF_START_QUEUE(dev); err=0; goto if_send_exit_crit; @@ -3105,11 +3503,43 @@ static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct chan->if_name,wan_skb_len(skb)); } wan_skb_free(skb); - ++chan->if_stats.tx_errors; + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //++chan->if_stats.tx_errors; WAN_NETIF_START_QUEUE(dev); err=0; goto if_send_exit_crit; } + +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_BRI) + if(IS_BRI_CARD(card)){ + if(chan->dchan_time_slot >= 0){ + + /* NOTE: BRI dchan tx has to be done inside hw lock. + It allows to synchronize access to SPI on the card. + */ + card->hw_iface.hw_lock(card->hw,&smp_flags); + + err=aft_bri_dchan_transmit(card, chan, + wan_skb_data(skb), + wan_skb_len(skb)); + + card->hw_iface.hw_unlock(card->hw,&smp_flags); + + if (err == 0 ) { + WAN_NETIF_START_QUEUE(dev); + wan_skb_free(skb); + err=0; + goto if_send_exit_crit; + }else{ + err=1; + WAN_NETIF_STOP_QUEUE(dev); + goto if_send_exit_crit; + } + } else { + /* On b-channel data is transmitted using AFT DMA. + Drop down to code below */ + } + } +#endif wan_spin_lock_irq(&card->wandev.lock, &smp_flags); @@ -3118,7 +3548,6 @@ static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct aft_dma_tx(card,chan); wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); return 1; - } wan_skb_unlink(skb); @@ -3128,7 +3557,10 @@ static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct if(!chan->lip_atm){ aft_dma_tx(card,chan); /*not needed for LIP_ATM!!*/ } - + + if (rskb) { + wan_skb_queue_tail(&chan->wp_tx_hdlc_rpt_list,rskb); + } wan_netif_set_ticks(dev, SYSTEM_TICKS); WAN_NETIF_START_QUEUE(dev); @@ -3156,7 +3588,6 @@ if_send_exit_crit: return err; } - /*============================================================================ * if_stats * @@ -3165,6 +3596,7 @@ if_send_exit_crit: * * Return a pointer to struct net_device_stats. */ +#if defined(__LINUX__) static struct net_device_stats gstats; static struct net_device_stats* if_stats (netdevice_t* dev) { @@ -3179,53 +3611,22 @@ static struct net_device_stats* if_stats (netdevice_t* dev) #if !defined(AFT_IRQ_DEBUG) if (card) { #if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) - if (card->wan_tdmv.sc && + if (card->wan_tdmv.sc && card->wandev.state == WAN_CONNECTED && card->wandev.config_id != WANCONFIG_AFT_ANALOG && chan->common.usedby == TDM_VOICE) { - chan->if_stats.rx_packets = card->wandev.stats.rx_packets; - chan->if_stats.tx_packets = card->wandev.stats.tx_packets; + chan->common.if_stats.rx_packets = card->wandev.stats.rx_packets; + chan->common.if_stats.tx_packets = card->wandev.stats.tx_packets; } #endif } #endif - return &chan->if_stats; + return &chan->common.if_stats; } - - - -#if defined(__LINUX__) -static int if_change_mtu(netdevice_t *dev, int new_mtu) -{ - private_area_t* chan= (private_area_t*)wan_netif_priv(dev); - - if (!chan || wan_test_bit(0,&chan->interface_down)) { - return -ENODEV; - } - - if (!chan->hdlc_eng) { - return -EINVAL; - } - - if (chan->common.usedby == API){ - new_mtu+=sizeof(api_tx_hdr_t); - }else if (chan->common.usedby == STACK){ - new_mtu+=32; - } - - if (new_mtu > chan->dma_mru) { - return -EINVAL; - } - - dev->mtu = new_mtu; - - return 0; -} #endif - /*======================================================================== * * if_do_ioctl - Ioctl handler for fr @@ -3245,13 +3646,12 @@ static int if_change_mtu(netdevice_t *dev, int new_mtu) * wanpipemon debugger * */ -static int if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) +static int +if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, wan_ioctl_cmd_t cmd) { private_area_t* chan= (private_area_t*)wan_netif_priv(dev); sdla_t *card; -#if defined(__LINUX__) wan_smp_flag_t smp_flags; -#endif wan_udp_pkt_t *wan_udp_pkt; int err=-EOPNOTSUPP; @@ -3279,9 +3679,9 @@ static int if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) wan_spin_lock_irq(&card->wandev.lock, &smp_flags); err=wan_bind_api_to_svc(chan,ifr->ifr_data); - chan->if_stats.rx_dropped=0; + WAN_NETIF_STATS_RX_DROPPED(&chan->common)=0; //chan->if_stats.rx_dropped=0; if (!chan->hdlc_eng){ - chan->if_stats.tx_carrier_errors=0; + WAN_NETIF_STATS_TX_CARRIER_ERRORS(&chan->common)=0; //chan->if_stats.tx_carrier_errors=0; } wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); break; @@ -3461,7 +3861,7 @@ static int if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) *******************************************************************/ -#define FIFO_RESET_TIMEOUT_CNT 500 +#define FIFO_RESET_TIMEOUT_CNT 1000 #define FIFO_RESET_TIMEOUT_US 10 static int aft_init_rx_dev_fifo(sdla_t *card, private_area_t *chan, unsigned char wait) { @@ -3494,9 +3894,9 @@ static int aft_init_rx_dev_fifo(sdla_t *card, private_area_t *chan, unsigned cha reg=0; wan_set_bit(AFT_RXDMA_HI_DMA_CMD_BIT,®); - DEBUG_TEST("%s: Clearing RX Fifo %s Ch=%ld DmaDescr=(0x%X) Reg=(0x%X)\n", + DEBUG_TEST("%s: Clearing RX Fifo %s Ch=%ld DmaDescr=(0x%X) Reg=(0x%X) WAIT=%s\n", __FUNCTION__,chan->if_name,chan->logic_ch_num, - dma_descr,reg); + dma_descr,reg,wait == WP_WAIT?"YES":"NO"); card->hw_iface.bus_write_4(card->hw,dma_descr,reg); @@ -3512,8 +3912,11 @@ static int aft_init_rx_dev_fifo(sdla_t *card, private_area_t *chan, unsigned cha } if (timeout){ - DEBUG_EVENT("%s:%s: Error: Rx fifo reset timedout %u us\n", - card->devname,chan->if_name,i*FIFO_RESET_TIMEOUT_US); + DEBUG_EVENT("%s:%s: Error: Rx fifo reset timedout %u us (ch=%d)\n", + card->devname, + chan->if_name, + i*FIFO_RESET_TIMEOUT_US, + chan->logic_ch_num); }else{ DEBUG_TEST("%s:%s: Rx Fifo Reset Successful\n", card->devname,chan->if_name); @@ -3553,9 +3956,10 @@ static int aft_init_tx_dev_fifo(sdla_t *card, private_area_t *chan, unsigned cha reg=0; wan_set_bit(AFT_TXDMA_HI_DMA_CMD_BIT,®); - DEBUG_TEST("%s: Clearing TX Fifo %s DmaDescr=(0x%X) Reg=(0x%X)\n", - __FUNCTION__,chan->if_name, - dma_descr,reg); + + DEBUG_TEST("%s: Clearing TX Fifo %s Ch=%ld DmaDescr=(0x%X) Reg=(0x%X) WAIT=%s\n", + __FUNCTION__,chan->if_name,chan->logic_ch_num, + dma_descr,reg,wait == WP_WAIT?"YES":"NO"); card->hw_iface.bus_write_4(card->hw,dma_descr,reg); @@ -3571,8 +3975,11 @@ static int aft_init_tx_dev_fifo(sdla_t *card, private_area_t *chan, unsigned cha } if (timeout){ - DEBUG_EVENT("%s:%s: Error: Tx fifo reset timedout %u us\n", - card->devname,chan->if_name,i*FIFO_RESET_TIMEOUT_US); + DEBUG_EVENT("%s:%s: Error: Tx fifo reset timedout %u us (ch=%d)\n", + card->devname, + chan->if_name, + i*FIFO_RESET_TIMEOUT_US, + chan->logic_ch_num); }else{ DEBUG_TEST("%s:%s: Tx Fifo Reset Successful\n", card->devname,chan->if_name); @@ -3654,7 +4061,8 @@ static void aft_channel_rxintr_ctrl(sdla_t *card, private_area_t *chan, int on) static void aft_dev_enable(sdla_t *card, private_area_t *chan) { - DEBUG_TEST("%s: Enabling Global Inter Mask !\n",chan->if_name); + + DEBUG_CFG("%s: Enabling Global Inter Mask !\n",chan->if_name); /* Enable TX DMA for Logic Channel */ aft_channel_txdma_ctrl(card,chan,1); @@ -3668,20 +4076,33 @@ static void aft_dev_enable(sdla_t *card, private_area_t *chan) aft_channel_rxintr_ctrl(card,chan,0); chan->tdmv_irq_cfg=1; }else{ + + DEBUG_CFG("%s: Enabling FOR NON CHANNELIZED !\n",chan->if_name); + aft_channel_txintr_ctrl(card,chan,1); aft_channel_rxintr_ctrl(card,chan,1); } wan_set_bit(chan->logic_ch_num,&card->u.aft.active_ch_map); + + + DEBUG_CFG("%s: ACTIVE CH MAP !\n",chan->if_name); } static void aft_dev_open_private(sdla_t *card, private_area_t *chan) { + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + /* BRI dchan does not use DMA thus + skip the dma config code below */ + return; + } + if (card->wandev.state == WAN_CONNECTED && wan_test_bit(0,&card->u.aft.comm_enabled)){ - DEBUG_TEST("%s: OPEN reseting fifo\n", - chan->if_name); + DEBUG_TEST("%s: OPEN reseting fifo Channel = %li\n", + chan->if_name,chan->logic_ch_num); aft_tslot_sync_ctrl(card,chan,0); @@ -3735,7 +4156,7 @@ static void aft_dev_open(sdla_t *card, private_area_t *gchan) } wan_set_bit(0,&card->u.aft.tdmv_master_if_up); - + if (card->wandev.state == WAN_CONNECTED && !wan_test_bit(0,&card->u.aft.comm_enabled)){ DEBUG_EVENT("%s: Master IF Starting %s Communications\n", @@ -3761,7 +4182,15 @@ static void aft_dev_close_private(sdla_t *card, private_area_t *chan) if (chan->logic_ch_num < 0){ return; } - + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + /* BRI dchan does not use DMA thus + skip the dma config code below */ + return; + } + + DEBUG_TEST("%s: Chan=%i\n",__FUNCTION__,chan->logic_ch_num); + /* Disable Logic Channel TX Interrupts */ aft_channel_txintr_ctrl(card,chan,0); @@ -3786,9 +4215,20 @@ static void aft_dev_close(sdla_t *card, private_area_t *gchan) if (chan->channelized_cfg){ - aft_tdm_intr_ctrl(card,0); - aft_fifo_intr_ctrl(card, 0); - + if (IS_BRI_CARD(card)) { + int card_use_cnt; + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &card_use_cnt); + if (card_use_cnt == 1) { + DEBUG_TEST("%s: BRI Disabling TDMV INTR\n", + card->devname); + aft_tdm_intr_ctrl(card,0); + aft_fifo_intr_ctrl(card, 0); + } + } else { + aft_tdm_intr_ctrl(card,0); + aft_fifo_intr_ctrl(card, 0); + } + for (chan=gchan; chan != NULL; chan=chan->next){ aft_dev_close_private(card,chan); @@ -3801,6 +4241,10 @@ static void aft_dev_close(sdla_t *card, private_area_t *gchan) if (chan->cfg.tdmv_master_if){ wan_clear_bit(0,&card->u.aft.tdmv_master_if_up); } + + DEBUG_TEST("%s: Closing Ch=%ld MasterUP=%i\n", + chan->if_name,chan->logic_ch_num, + wan_test_bit(0,&card->u.aft.tdmv_master_if_up)); } }else{ wan_set_bit(0,&chan->interface_down); @@ -3846,7 +4290,11 @@ static void aft_dma_tx_complete (sdla_t *card, private_area_t *chan, int wdt, in aft_dma_tx(card,chan); if (WAN_NETIF_QUEUE_STOPPED(chan->common.dev)){ - WAN_NETIF_WAKE_QUEUE(chan->common.dev); + /* Wakeup stack also wakes up DCHAN, + however, for DCHAN we must always + call the upper layer and let it decide + what to do */ + wanpipe_wake_stack(chan); #ifndef CONFIG_PRODUCT_WANPIPE_GENERIC if (chan->common.usedby == API){ wan_wakeup_api(chan); @@ -3854,8 +4302,8 @@ static void aft_dma_tx_complete (sdla_t *card, private_area_t *chan, int wdt, in wanpipe_lip_kick(chan,0); } #endif - } - + } + if (chan->common.usedby == TDM_VOICE_DCHAN){ #ifdef AFT_TDM_API_SUPPORT if (is_tdm_api(chan,&chan->wp_tdm_api_dev)){ @@ -3871,7 +4319,8 @@ static void aft_dma_tx_complete (sdla_t *card, private_area_t *chan, int wdt, in * aft_tx_post_complete * */ -static void aft_tx_post_complete (sdla_t *card, private_area_t *chan, netskb_t *skb) +static void +aft_tx_post_complete (sdla_t *card, private_area_t *chan, netskb_t *skb) { unsigned int reg = wan_skb_csum(skb); u32 dma_status = aft_txdma_hi_get_dma_status(reg); @@ -3897,10 +4346,8 @@ static void aft_tx_post_complete (sdla_t *card, private_area_t *chan, netskb_t * } if (reg & AFT_TXDMA_HI_DMA_LENGTH_MASK){ - if (WAN_NET_RATELIMIT()){ DEBUG_EVENT("%s:%s: Error: TxDMA Length not equal 0 (reg=0x%08X)\n", card->devname,chan->if_name,reg); - } chan->errstats.Tx_dma_errors++; } @@ -3934,7 +4381,7 @@ static void aft_tx_post_complete (sdla_t *card, private_area_t *chan, netskb_t * } } } - chan->if_stats.tx_errors++; + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //chan->if_stats.tx_errors++; goto tx_post_exit; } @@ -3942,8 +4389,8 @@ tx_post_ok: chan->opstats.Data_frames_Tx_count++; chan->opstats.Data_bytes_Tx_count+=wan_skb_len(skb); - chan->if_stats.tx_packets++; - chan->if_stats.tx_bytes+=wan_skb_len(skb); + WAN_NETIF_STATS_INC_TX_PACKETS(&chan->common); //chan->if_stats.tx_packets++; + WAN_NETIF_STATS_INC_TX_BYTES(&chan->common, wan_skb_len(skb)); //chan->if_stats.tx_bytes+=wan_skb_len(skb); #if 0 if (chan->common.usedby != TDM_VOICE){ @@ -3975,12 +4422,13 @@ static void aft_rx_post_complete (sdla_t *card, private_area_t *chan, unsigned char *pkt_error) { - unsigned int len; + unsigned int len,data_error = 0; unsigned char *buf; wp_rx_element_t *rx_el; + u32 dma_status; rx_el=(wp_rx_element_t *)wan_skb_data(skb); - DEBUG_RX("%s:%s: RX HI=0x%X LO=0x%X\n DMA=0x%X", + DEBUG_RX("%s:%s: RX HI=0x%X LO=0x%X DMA=0x%X", __FUNCTION__, chan->if_name, rx_el->reg, @@ -3989,27 +4437,115 @@ static void aft_rx_post_complete (sdla_t *card, private_area_t *chan, #if 0 /* debugging */ - chan->if_stats.rx_errors++; + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //chan->if_stats.rx_errors++; #endif rx_el->align&=AFT_RXDMA_LO_ALIGN_MASK; *pkt_error=0; *new_skb=NULL; + dma_status=aft_rxdma_hi_get_dma_status(rx_el->reg); + /* Checking Rx DMA Go bit. Has to be '0' */ if (wan_test_bit(AFT_RXDMA_HI_GO_BIT,&rx_el->reg)){ DEBUG_TEST("%s:%s: Error: RxDMA Intr: GO bit set on Rx intr\n", card->devname,chan->if_name); - chan->if_stats.rx_errors++; + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //chan->if_stats.rx_errors++; chan->errstats.Rx_dma_descr_err++; goto rx_comp_error; } + + /* Checking Rx DMA PCI error status. Has to be '0's */ + if (dma_status){ - /* This is just a sanity check, it should have been caught by isr */ - if (aft_decode_dma_status(card,chan,rx_el->reg)) { + if (wan_test_bit(AFT_RXDMA_HIDMASTATUS_PCI_M_ABRT,&dma_status)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s: Rx Error: Abort from Master: pci fatal error 0x%X!\n", + card->devname,chan->if_name,rx_el->reg); + } + } + if (wan_test_bit(AFT_RXDMA_HIDMASTATUS_PCI_T_ABRT,&dma_status)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s: Rx Error: Abort from Target: pci fatal error 0x%X!\n", + card->devname,chan->if_name,rx_el->reg); + } + } + if (wan_test_bit(AFT_RXDMA_HIDMASTATUS_PCI_DS_TOUT,&dma_status)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s: Rx Error: No 'DeviceSelect' from target: pci fatal error 0x%X!\n", + card->devname,chan->if_name,rx_el->reg); + } + } + if (wan_test_bit(AFT_RXDMA_HIDMASTATUS_PCI_RETRY,&dma_status)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s: Rx Error: 'Retry' exceeds maximum (64k): pci fatal error 0x%X!\n", + card->devname,chan->if_name,rx_el->reg); + } + } + + chan->errstats.Rx_pci_errors++; + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //chan->if_stats.rx_errors++; + card->wandev.stats.rx_errors++; goto rx_comp_error; } + + if (chan->hdlc_eng){ + + /* Checking Rx DMA Frame start bit. (information for api) */ + if (!wan_test_bit(AFT_RXDMA_HI_START_BIT,&rx_el->reg)){ + DEBUG_TEST("%s:%s RxDMA Intr: Start flag missing: MTU Mismatch! Reg=0x%X\n", + card->devname,chan->if_name,rx_el->reg); + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; + chan->opstats.Rx_Data_discard_long_count++; + chan->errstats.Rx_hdlc_corrupiton++; + card->wandev.stats.rx_errors++; + goto rx_comp_error; + } + /* Checking Rx DMA Frame end bit. (information for api) */ + if (!wan_test_bit(AFT_RXDMA_HI_EOF_BIT,&rx_el->reg)){ + DEBUG_TEST("%s:%s: RxDMA Intr: End flag missing: MTU Mismatch! Reg=0x%X\n", + card->devname,chan->if_name,rx_el->reg); + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; + chan->opstats.Rx_Data_discard_long_count++; + chan->errstats.Rx_hdlc_corrupiton++; + card->wandev.stats.rx_errors++; + goto rx_comp_error; + + } else { /* Check CRC error flag only if this is the end of Frame */ + + if (wan_test_bit(AFT_RXDMA_HI_FCS_ERR_BIT,&rx_el->reg)){ + DEBUG_TEST("%s:%s: RxDMA Intr: CRC Error! Reg=0x%X Len=%d\n", + card->devname,chan->if_name,rx_el->reg, + (rx_el->reg&AFT_RXDMA_HI_DMA_LENGTH_MASK)>>2); + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; + chan->errstats.Rx_crc_err_count++; + card->wandev.stats.rx_crc_errors++; + wan_set_bit(WP_CRC_ERROR_BIT,&rx_el->pkt_error); + data_error = 1; + } + + /* Check if this frame is an abort, if it is + * drop it and continue receiving */ + if (wan_test_bit(AFT_RXDMA_HI_FRM_ABORT_BIT,&rx_el->reg)){ + DEBUG_TEST("%s:%s: RxDMA Intr: Abort! Reg=0x%X\n", + card->devname,chan->if_name,rx_el->reg); + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; + chan->errstats.Rx_hdlc_corrupiton++; + card->wandev.stats.rx_frame_errors++; + wan_set_bit(WP_ABORT_ERROR_BIT,&rx_el->pkt_error); + data_error = 1; + } + + if (chan->common.usedby != API && data_error){ + goto rx_comp_error; + } + } + } + + len = rx_el->len; +#if 0 + /* FIXME: Remove this later!!! */ len=rx_el->reg&AFT_RXDMA_HI_DMA_LENGTH_MASK; if (chan->hdlc_eng){ @@ -4018,7 +4554,7 @@ static void aft_rx_post_complete (sdla_t *card, private_area_t *chan, len=((((chan->dma_mru>>2)-1)-len)<<2) - (~(rx_el->align)&AFT_RXDMA_LO_ALIGN_MASK); if (len < 3 || len > chan->dma_mru){ - chan->if_stats.rx_frame_errors++; + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; chan->errstats.Rx_hdlc_corrupiton++; card->wandev.stats.rx_frame_errors++; goto rx_comp_error; @@ -4030,13 +4566,12 @@ static void aft_rx_post_complete (sdla_t *card, private_area_t *chan, len=(((chan->mru>>2)-len)<<2) - (~(0x03)&AFT_RXDMA_LO_ALIGN_MASK); if (len < 1 || len > chan->mru){ - chan->if_stats.rx_frame_errors++; + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; card->wandev.stats.rx_frame_errors++; goto rx_comp_error; } } - - +#endif *pkt_error=rx_el->pkt_error; @@ -4062,12 +4597,14 @@ static void aft_rx_post_complete (sdla_t *card, private_area_t *chan, } } - if (len > aft_rx_copyback){ /* The rx size is big enough, thus * send this buffer up the stack * and allocate another one */ memset(wan_skb_data(skb),0,sizeof(wp_rx_element_t)); +#if defined(__FreeBSD__) + wan_skb_trim(skb,sizeof(wp_rx_element_t)); +#endif wan_skb_put(skb,len); wan_skb_pull(skb, sizeof(wp_rx_element_t)); *new_skb=skb; @@ -4080,13 +4617,17 @@ static void aft_rx_post_complete (sdla_t *card, private_area_t *chan, * buffer and pass it up */ *new_skb=wan_skb_alloc(len + 20); if (!*new_skb){ - DEBUG_EVENT("%s:%s: Failed to allocate rx skb pkt (len=%d)!\n", - card->devname,chan->if_name,(len+20)); - chan->if_stats.rx_dropped++; + DEBUG_EVENT( + "%s:%s: Failed to allocate rx skb pkt (len=%d)!\n", + card->devname,chan->if_name,(len+20)); + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); //chan->if_stats.rx_dropped++; goto rx_comp_error; } buf=wan_skb_put((*new_skb),len); +#if defined(__FreeBSD__) + wan_skb_trim(skb,sizeof(wp_rx_element_t)); +#endif memcpy(buf,wan_skb_tail(skb),len); aft_init_requeue_free_skb(chan, skb); @@ -4137,7 +4678,8 @@ static int aft_init_requeue_free_skb(private_area_t *chan, netskb_t *skb) return 0; } -static int aft_alloc_rx_dma_buff(sdla_t *card, private_area_t *chan, int num, int irq) +static int +aft_alloc_rx_dma_buff(sdla_t *card, private_area_t *chan, int num, int irq) { int i; netskb_t *skb; @@ -4145,7 +4687,6 @@ static int aft_alloc_rx_dma_buff(sdla_t *card, private_area_t *chan, int num, in for (i=0;ichannelized_cfg && !chan->hdlc_eng){ #if defined(WANPIPE_64BIT_4G_DMA) -#warning "Wanpipe compiled for 64bit 4G DMA" /* On 64bit Systems greater than 4GB we must * allocated our DMA buffers using GFP_DMA * flag */ @@ -4176,8 +4717,6 @@ static int aft_alloc_rx_dma_buff(sdla_t *card, private_area_t *chan, int num, in wan_skb_queue_tail(&chan->wp_rx_free_list,skb); } - - return 0; } @@ -4191,7 +4730,7 @@ static void enable_timer (void* card_id) #if !defined(WAN_IS_TASKQ_SCHEDULE) wan_smp_flag_t smp_flags; wan_smp_flag_t smp_flags1; - int err = 0; + int delay = 0; #endif if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ @@ -4200,7 +4739,7 @@ static void enable_timer (void* card_id) return; } - DEBUG_TEST("%s: %s Sdla Polling %p!\n",__FUNCTION__, + DEBUG_56K("%s: %s Sdla Polling %p!\n",__FUNCTION__, card->devname, card->wandev.fe_iface.polling); @@ -4211,9 +4750,12 @@ static void enable_timer (void* card_id) card->hw_iface.hw_lock(card->hw,&smp_flags1); wan_spin_lock_irq(&card->wandev.lock, &smp_flags); if (card->wandev.fe_iface.polling){ - err = card->wandev.fe_iface.polling(&card->fe); + delay = card->wandev.fe_iface.polling(&card->fe); } wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + if (delay){ + card->wandev.fe_iface.add_timer(&card->fe, delay); + } card->hw_iface.hw_unlock(card->hw,&smp_flags1); #endif @@ -4301,6 +4843,7 @@ static void wp_tdm_bh (void *data, int pending) } wan_set_bit(card->tdmv_conf.span_no,&tdm_check); #endif + WAN_TDMV_CALL(rx_tx_span, (card), err); WAN_TASKLET_END((&chan->common.bh_task)); @@ -4327,19 +4870,175 @@ wp_tdm_bh_exit: } +static void wp_bh_rx(private_area_t* chan, netskb_t *new_skb, u8 pkt_error, int len) +{ + sdla_t *card = chan->card; + + if (chan->common.usedby == API){ + + if (chan->hdlc_eng){ + if (card->u.aft.cfg.rx_crc_bytes == 3){ + wan_skb_put(new_skb,3); + }else if (card->u.aft.cfg.rx_crc_bytes == 2){ + wan_skb_put(new_skb,2); + } + } + + if (chan->common.sk == NULL){ + DEBUG_TEST("%s: No sock bound to channel rx dropping!\n", + chan->if_name); + + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); /* ++chan->if_stats.rx_dropped; */ + wan_skb_free(new_skb); + return; + } + +#if defined(__LINUX__) +# ifndef CONFIG_PRODUCT_WANPIPE_GENERIC + + + /* Only for API, we insert packet status + * byte to indicate a packet error. Take + * this byte and put it in the api header */ + + if (wan_skb_headroom(new_skb) >= sizeof(api_rx_hdr_t)){ + api_rx_hdr_t *rx_hdr= + (api_rx_hdr_t*)skb_push(new_skb,sizeof(api_rx_hdr_t)); + memset(rx_hdr,0,sizeof(api_rx_hdr_t)); + rx_hdr->error_flag=pkt_error; + }else{ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: Error Rx pkt headroom %u < %u\n", + chan->if_name, + (u32)wan_skb_headroom(new_skb), + (u32)sizeof(api_rx_hdr_t)); + } + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); /* ++chan->if_stats.rx_dropped; */ + wan_skb_free(new_skb); + return; + } + + new_skb->protocol = htons(PVC_PROT); + wan_skb_reset_mac_header(new_skb); + new_skb->dev = chan->common.dev; + new_skb->pkt_type = WAN_PACKET_DATA; + +#if 0 + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); /* chan->if_stats.rx_frame_errors++; */ +#endif + + if (wan_api_rx(chan,new_skb) != 0){ + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); /* ++chan->if_stats.rx_dropped; */ + wan_skb_free(new_skb); + return; + } + +# endif +#endif + + }else if (chan->common.usedby == TDM_VOICE_DCHAN){ + +#ifdef AFT_TDM_API_SUPPORT + if (is_tdm_api(chan,&chan->wp_tdm_api_dev)) { + int err; + + DEBUG_RX("%s: RX TDM API DCHAN %d\n",chan->if_name, wan_skb_len(new_skb)); + + if (wan_skb_headroom(new_skb) >= sizeof(api_rx_hdr_t)){ + api_rx_hdr_t *rx_hdr = + (api_rx_hdr_t*)skb_push(new_skb,sizeof(api_rx_hdr_t)); + memset(rx_hdr,0,sizeof(api_rx_hdr_t)); + //rx_hdr->error_flag=pkt_error; + }else{ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: Error Rx pkt headroom %u < %u\n", + chan->if_name, + (u32)wan_skb_headroom(new_skb), + (u32)sizeof(api_rx_hdr_t)); + } + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); /* ++chan->if_stats.rx_dropped; */ + wan_skb_free(new_skb); + return; + } + err=wanpipe_tdm_api_rx_hdlc(&chan->wp_tdm_api_dev,new_skb); + if (err){ + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); /* ++chan->if_stats.rx_dropped; */ + wan_skb_free(new_skb); + return; + } + + }else +#endif + if (chan->tdmv_zaptel_cfg){ + +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN) && defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) + int err; + + + /* ADEBUG */ + WAN_TDMV_CALL(rx_dchan, + (&card->wan_tdmv,chan->tdmv_chan, + wan_skb_data(new_skb),wan_skb_len(new_skb)), + err); + DEBUG_RX("%s TDM DCHAN VOICE Rx Pkt Len=%i Chan=%i\n", + card->devname,wan_skb_len(new_skb), + chan->tdmv_chan); +#else + DEBUG_EVENT("%s: DCHAN Rx Packet critical error TDMV not compiled!\n",card->devname); +#endif + + wan_skb_free(new_skb); + /* Continue through since the above + * function returns void */ + + } else { + DEBUG_EVENT("%s: DCHAN Rx Packet critical error op not supported\n",card->devname); + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); /* ++chan->if_stats.rx_dropped; */ + wan_skb_free(new_skb); + return; + } + + }else if (chan->common.usedby == TDM_VOICE){ + + DEBUG_EVENT("%s: TDM VOICE CRITICAL: IN BH!!!!\n",card->devname); + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); /* ++chan->if_stats.rx_dropped; */ + wan_skb_free(new_skb); + return; + + }else if (chan->common.usedby == STACK){ + + wan_skb_set_csum(new_skb,0); + + if (wanpipe_lip_rx(chan,new_skb) != 0){ + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); /* ++chan->if_stats.rx_dropped; */ + wan_skb_free(new_skb); + return; + } + + }else{ + protocol_recv(chan->card,chan,new_skb); + } + + chan->opstats.Data_frames_Rx_count++; + chan->opstats.Data_bytes_Rx_count+=len; + WAN_NETIF_STATS_INC_RX_PACKETS(&chan->common); /* chan->if_stats.rx_packets++; */ + WAN_NETIF_STATS_INC_RX_BYTES(&chan->common, len); /* chan->if_stats.rx_bytes+=len; */ + return; +} + #if defined(__LINUX__) static void wp_bh (unsigned long data) #else static void wp_bh (void *data, int pending) #endif { - private_area_t* chan = (private_area_t *)data; - sdla_t *card=chan->card; - netskb_t *new_skb,*skb; - unsigned char pkt_error; - unsigned long timeout=SYSTEM_TICKS; - private_area_t *top_chan; - int len; + private_area_t *chan = (private_area_t *)data; + sdla_t *card=chan->card; + netskb_t *new_skb,*skb; + unsigned char pkt_error; + wan_ticks_t timeout=SYSTEM_TICKS; + private_area_t *top_chan; + int len; #ifdef AFT_IRQ_STAT_DEBUG card->wandev.stats.collisions++; @@ -4356,8 +5055,8 @@ static void wp_bh (void *data, int pending) top_chan=chan; } - DEBUG_TEST("%s: ------------ BEGIN --------------: %u\n", - __FUNCTION__,SYSTEM_TICKS); + DEBUG_TEST("%s: ------------ BEGIN --------------: %ld\n", + __FUNCTION__,(u_int64_t)SYSTEM_TICKS); if (!wan_test_bit(0,&chan->up)){ if (WAN_NET_RATELIMIT()){ @@ -4369,20 +5068,16 @@ static void wp_bh (void *data, int pending) } while((skb=wan_skb_dequeue(&chan->wp_rx_complete_list)) != NULL){ - #if 0 - chan->if_stats.rx_errors++; + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //chan->if_stats.rx_errors++; #endif - if (SYSTEM_TICKS-timeout > 1){ wan_skb_queue_head(&chan->wp_rx_complete_list,skb); break; } - + new_skb=NULL; pkt_error=0; - - /* The post function will take care * of the skb and new_skb buffer. @@ -4402,7 +5097,7 @@ static void wp_bh (void *data, int pending) * we have a 0 length frame. Thus discard * (only if HDLC engine enabled) */ if (len <= 3){ - ++chan->if_stats.rx_errors; + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //++chan->if_stats.rx_errors; wan_skb_free(new_skb); continue; } @@ -4414,199 +5109,53 @@ static void wp_bh (void *data, int pending) wan_capture_trace_packet(chan->card, &top_chan->trace_info, new_skb,TRC_INCOMING_FRM); - - if (chan->common.usedby == API){ - - if (chan->common.sk == NULL){ - DEBUG_TEST("%s: No sock bound to channel rx dropping!\n", - chan->if_name); - chan->if_stats.rx_dropped++; - wan_skb_free(new_skb); - continue; - } - - if (chan->hdlc_eng){ - if (card->u.aft.cfg.rx_crc_bytes == 3){ - wan_skb_put(new_skb,3); - }else if (card->u.aft.cfg.rx_crc_bytes == 2){ - wan_skb_put(new_skb,2); - } - } - -#if defined(__LINUX__) -# ifndef CONFIG_PRODUCT_WANPIPE_GENERIC - - - /* Only for API, we insert packet status - * byte to indicate a packet error. Take - * this byte and put it in the api header */ - - if (wan_skb_headroom(new_skb) >= sizeof(api_rx_hdr_t)){ - api_rx_hdr_t *rx_hdr= - (api_rx_hdr_t*)skb_push(new_skb,sizeof(api_rx_hdr_t)); - memset(rx_hdr,0,sizeof(api_rx_hdr_t)); - rx_hdr->error_flag=pkt_error; - }else{ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: Error Rx pkt headroom %u < %u\n", - chan->if_name, - (u32)wan_skb_headroom(new_skb), - (u32)sizeof(api_rx_hdr_t)); - } - ++chan->if_stats.rx_dropped; - wan_skb_free(new_skb); - continue; - } - - new_skb->protocol = htons(PVC_PROT); - wan_skb_reset_mac_header(new_skb); - new_skb->dev = chan->common.dev; - new_skb->pkt_type = WAN_PACKET_DATA; - -#if 0 - chan->if_stats.rx_frame_errors++; -#endif - - if (wan_api_rx(chan,new_skb) != 0){ - ++chan->if_stats.rx_dropped; - wan_skb_free(new_skb); - continue; - } - -# endif -#endif - - }else if (chan->common.usedby == TDM_VOICE_DCHAN){ - -#ifdef AFT_TDM_API_SUPPORT - if (is_tdm_api(chan,&chan->wp_tdm_api_dev)) { - int err; - - if (wan_skb_headroom(new_skb) >= sizeof(api_rx_hdr_t)){ - api_rx_hdr_t *rx_hdr = - (api_rx_hdr_t*)skb_push(new_skb,sizeof(api_rx_hdr_t)); - memset(rx_hdr,0,sizeof(api_rx_hdr_t)); - //rx_hdr->error_flag=pkt_error; - }else{ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: Error Rx pkt headroom %u < %u\n", - chan->if_name, - (u32)wan_skb_headroom(new_skb), - (u32)sizeof(api_rx_hdr_t)); - } - ++chan->if_stats.rx_dropped; - wan_skb_free(new_skb); - continue; - } - err=wanpipe_tdm_api_rx_hdlc(&chan->wp_tdm_api_dev,new_skb); - if (err){ - ++chan->if_stats.rx_dropped; - wan_skb_free(new_skb); - continue; - } - - }else -#endif - if (chan->tdmv_zaptel_cfg){ - -#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) && defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN) - int err; -/* ADEBUG */ - WAN_TDMV_CALL(rx_dchan, - (&card->wan_tdmv,chan->tdmv_chan, - wan_skb_data(new_skb),wan_skb_len(new_skb)), - err); - - DEBUG_TEST("%s TDM DCHAN VOICE Rx Pkt Len=%i Chan=%i\n", - card->devname,wan_skb_len(new_skb), - chan->tdmv_chan); -#else - DEBUG_EVENT("%s: DCHAN Rx Packet critical error TDMV not compiled!\n",card->devname); -#endif - - wan_skb_free(new_skb); - /* Continue through since the above - * function returns void */ - - } else { - DEBUG_EVENT("%s: DCHAN Rx Packet critical error op not supported\n",card->devname); - ++chan->if_stats.rx_dropped; - wan_skb_free(new_skb); - continue; - } - - }else if (chan->common.usedby == TDM_VOICE){ - - DEBUG_EVENT("%s: TDM VOICE CRITICAL: IN BH!!!!\n",card->devname); - ++chan->if_stats.rx_dropped; - wan_skb_free(new_skb); - continue; - - }else if (chan->common.usedby == STACK){ - - wan_skb_set_csum(new_skb,0); - - if (wanpipe_lip_rx(chan,new_skb) != 0){ - ++chan->if_stats.rx_dropped; - wan_skb_free(new_skb); - continue; - } - - }else{ - protocol_recv(chan->card,chan,new_skb); - } - - chan->opstats.Data_frames_Rx_count++; - chan->opstats.Data_bytes_Rx_count+=len; - chan->if_stats.rx_packets++; - chan->if_stats.rx_bytes+=len; + wp_bh_rx(chan, new_skb, pkt_error, len); } - } while((skb=wan_skb_dequeue(&chan->wp_rx_stack_complete_list)) != NULL){ len=wan_skb_len(skb); if (wanpipe_lip_rx(chan,skb) != 0){ - ++chan->if_stats.rx_dropped; + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); //++chan->if_stats.rx_dropped; wan_skb_free(skb); }else{ chan->opstats.Data_frames_Rx_count++; chan->opstats.Data_bytes_Rx_count+=len; - chan->if_stats.rx_packets++; - chan->if_stats.rx_bytes+=len; + WAN_NETIF_STATS_INC_RX_PACKETS(&chan->common); //chan->if_stats.rx_packets++; + WAN_NETIF_STATS_INC_RX_BYTES(&chan->common,len); //chan->if_stats.rx_bytes+=len; } } + while((skb=wan_skb_dequeue(&chan->wp_rx_bri_dchan_complete_list)) != NULL){ + /* for BRI the rx data on D-chan is in 'wp_rx_bri_dchan_complete_list'. */ + wp_bh_rx(chan, skb, 0, wan_skb_len(skb)); + } + while((skb=wan_skb_dequeue(&chan->wp_tx_complete_list)) != NULL){ aft_tx_post_complete (chan->card,chan,skb); wan_skb_free(skb); } - WAN_TASKLET_END((&chan->common.bh_task)); - + /* FIXME: If wanpipe goes down, do not schedule again */ if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ - WAN_TASKLET_END((&chan->common.bh_task)); return; } #if 1 - { - if ((len=wan_skb_queue_len(&chan->wp_rx_complete_list))){ WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); }else if ((len=wan_skb_queue_len(&chan->wp_tx_complete_list))){ WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); }else if ((len=wan_skb_queue_len(&chan->wp_rx_stack_complete_list))){ WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); - } - + }else if ((len=wan_skb_queue_len(&chan->wp_rx_bri_dchan_complete_list))){ + WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); } #endif - DEBUG_TEST("%s: ------------ END -----------------: %u\n", - __FUNCTION__,SYSTEM_TICKS); - + DEBUG_TEST("%s: ------------ END -----------------: %ld\n", + __FUNCTION__,(u_int64_t)SYSTEM_TICKS); return; } @@ -4615,17 +5164,15 @@ static void wp_bh (void *data, int pending) * Interrupt Support Functions * **********************************************************/ -static void wp_aft_fifo_per_port_isr(sdla_t *card) + + + +static void __wp_aft_fifo_per_port_isr(sdla_t *card, u32 rx_status, u32 tx_status) { - u32 rx_status, tx_status; - u32 i; - private_area_t *chan; int num_of_logic_ch; u32 tmp_fifo_reg; - - /* Clear HDLC pending registers */ - __sdla_bus_read_4(card->hw, AFT_PORT_REG(card,AFT_TX_FIFO_INTR_PENDING_REG),&tx_status); - __sdla_bus_read_4(card->hw, AFT_PORT_REG(card,AFT_RX_FIFO_INTR_PENDING_REG),&rx_status); + private_area_t *chan; + int i; tx_status&=card->u.aft.active_ch_map; rx_status&=card->u.aft.active_ch_map; @@ -4662,6 +5209,10 @@ static void wp_aft_fifo_per_port_isr(sdla_t *card) continue; } #endif + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } + DEBUG_TEST("%s:%s: Warning TX Fifo Error on LogicCh=%ld Slot=%d!\n", card->devname,chan->if_name,chan->logic_ch_num,i); @@ -4688,7 +5239,7 @@ static void wp_aft_fifo_per_port_isr(sdla_t *card) #endif aft_tx_fifo_under_recover(card,chan); - ++chan->if_stats.tx_fifo_errors; + WAN_NETIF_STATS_INC_TX_FIFO_ERRORS(&chan->common); //++chan->if_stats.tx_fifo_errors; card->wandev.stats.tx_aborted_errors++; __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_TX_FIFO_INTR_PENDING_REG),&tmp_fifo_reg); } @@ -4708,6 +5259,10 @@ static void wp_aft_fifo_per_port_isr(sdla_t *card) continue; } + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } + #ifdef AFT_RX_FIFO_DEBUG { u32 dma_descr,tmp1_reg,tmp_reg,cur_dma_ptr; @@ -4730,8 +5285,8 @@ static void wp_aft_fifo_per_port_isr(sdla_t *card) cur_dma_ptr, dma_descr, tmp_reg,tmp1_reg, -chan->rx_dma_chain_table[chan->rx_chain_indx].dma_addr, -0); + chan->rx_dma_chain_table[chan->rx_chain_indx].dma_addr, + 0); } DEBUG_EVENT("%s:%s: Warning RX Fifo Error on Ch=%ld End=%d Cur=%d: Reg=0x%X Addr=0x%X!\n", @@ -4744,8 +5299,8 @@ chan->rx_dma_chain_table[chan->rx_chain_indx].dma_addr, aft_list_descriptors(chan); #endif #endif - ++chan->if_stats.rx_fifo_errors; - ++chan->if_stats.rx_over_errors; + WAN_NETIF_STATS_INC_RX_FIFO_ERRORS(&chan->common); //++chan->if_stats.rx_fifo_errors; + WAN_NETIF_STATS_INC_RX_OVER_ERRORS(&chan->common); //++chan->if_stats.rx_over_errors; chan->errstats.Rx_overrun_err_count++; card->wandev.stats.rx_over_errors++; @@ -4767,34 +5322,59 @@ chan->rx_dma_chain_table[chan->rx_chain_indx].dma_addr, return; } -#if 1 +static void wp_aft_fifo_per_port_isr(sdla_t *card) +{ + u32 rx_status=0, tx_status=0; + u32 i; + + /* Clear HDLC pending registers */ + __sdla_bus_read_4(card->hw, AFT_PORT_REG(card,AFT_TX_FIFO_INTR_PENDING_REG),&tx_status); + __sdla_bus_read_4(card->hw, AFT_PORT_REG(card,AFT_RX_FIFO_INTR_PENDING_REG),&rx_status); + + + if (IS_BRI_CARD(card)) { + void **card_list=__sdla_get_ptr_isr_array(card->hw); + sdla_t *tmp_card; + for (i=0;iwandev.state == WAN_CONNECTED) { + __wp_aft_fifo_per_port_isr(tmp_card,rx_status,tx_status); + } + } + } else { + __wp_aft_fifo_per_port_isr(card,rx_status,tx_status); + } + + return; +} static void front_end_interrupt(sdla_t *card, unsigned long reg, int lock) { - void **card_list; - u32 max_number_of_ports, i; - sdla_t *tmp_card; - - max_number_of_ports = 8; /* 24 */ - card_list=__sdla_get_ptr_isr_array(card->hw); + if(IS_BRI_CARD(card)){ + + void **card_list; + u32 max_number_of_ports, i; + sdla_t *tmp_card; - DEBUG_TEST("%s(): card_list ptr: 0x%p\n", __FUNCTION__, card_list); + max_number_of_ports = MAX_BRI_LINES; /* 24 */ - for (i=0; ihw); - tmp_card=(sdla_t*)card_list[i]; - if (tmp_card == NULL || wan_test_bit(CARD_DOWN,&tmp_card->wandev.critical)) { - continue; - } - - DEBUG_TEST("%s(): card ptr: %s, tmp_card ptr: %s\n", __FUNCTION__, card->devname, tmp_card->devname); + DEBUG_TEST("%s(): card_list ptr: 0x%p\n", __FUNCTION__, card_list); - if (tmp_card->wandev.fe_iface.check_isr && - tmp_card->wandev.fe_iface.check_isr(&tmp_card->fe)) { + for (i=0; iwandev.fe_iface.isr && - tmp_card->wandev.fe_iface.isr(&tmp_card->fe)) { + tmp_card=(sdla_t*)card_list[i]; + if (tmp_card == NULL){ + continue; + } + + DEBUG_TEST("%s(): card ptr: 0x%p, tmp_card ptr: 0x%p\n", __FUNCTION__, card, tmp_card); + + if (tmp_card->wandev.fe_iface.isr) { + tmp_card->wandev.fe_iface.isr(&tmp_card->fe); if (lock) { wan_smp_flag_t smp_flags; @@ -4806,31 +5386,24 @@ static void front_end_interrupt(sdla_t *card, unsigned long reg, int lock) } } } - } + } else { + if (card->wandev.fe_iface.isr){ + card->wandev.fe_iface.isr(&card->fe); - return; -} - -#else - -static void front_end_interrupt(sdla_t *card, unsigned long reg, int lock) -{ - if (card->wandev.fe_iface.isr){ - card->wandev.fe_iface.isr(&card->fe); - - if (lock){ - wan_smp_flag_t smp_flags; - wan_spin_lock_irq(&card->wandev.lock,&smp_flags); - handle_front_end_state(card); - wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); - }else{ - handle_front_end_state(card); + if (lock){ + wan_smp_flag_t smp_flags; + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); + handle_front_end_state(card); + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + }else{ + handle_front_end_state(card); + } } } return; } -#endif + /**SECTION*************************************************************** * * HARDWARE Interrupt Handlers @@ -4853,23 +5426,25 @@ static u32 aft_master_dev=0xF; static int gdma_cnt=0; #endif -#define EC_IRQ_TIMEOUT (HZ) +#define EC_IRQ_TIMEOUT (HZ/32) static WAN_IRQ_RETVAL wp_aft_global_isr (sdla_t* card) { u32 reg_sec=0,reg=0; - u32 a108_reg=0, a56k_reg=0; + u32 a108_reg=0, a56k_reg=0, serial_reg=0; u32 fifo_port_intr=0; u32 dma_port_intr=0; u32 wdt_port_intr=0; u32 tdmv_port_intr=0; + u32 status_port_intr=0; u32 fe_intr=0; + u32 max_ports=IS_BRI_CARD(card)?MAX_BRI_LINES:8; WAN_IRQ_RETVAL_DECL(irq_ret); if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ DEBUG_TEST("%s: Card down, ignoring interrupt!!!!!!!\n", - card->devname); + card->devname); WAN_IRQ_RETURN(irq_ret); } @@ -4890,25 +5465,27 @@ static WAN_IRQ_RETVAL wp_aft_global_isr (sdla_t* card) } #endif - wan_set_bit(0,&card->in_isr); + wan_set_bit(0,&card->in_isr); - /* -----------------2/6/2003 9:02AM------------------ - * Disable all chip Interrupts (offset 0x040) - * -- "Transmit/Receive DMA Engine" interrupt disable - * -- "FiFo/Line Abort Error" interrupt disable + /* -----------------2/6/2003 9:02AM------------------ + * Disable all chip Interrupts (offset 0x040) + * -- "Transmit/Receive DMA Engine" interrupt disable + * -- "FiFo/Line Abort Error" interrupt disable * --------------------------------------------------*/ - __sdla_bus_read_4(card->hw,AFT_CHIP_CFG_REG, ®); + __sdla_bus_read_4(card->hw,AFT_CHIP_CFG_REG, ®); reg_sec=reg; - if (wan_test_bit(AFT_CHIPCFG_FE_INTR_STAT_BIT,®)){ + DEBUG_ISR("%s:ISR = 0x%X\n",card->devname,reg); + + if (wan_test_bit(AFT_CHIPCFG_FE_INTR_STAT_BIT,®)){ #ifdef AFT_IRQ_STAT_DEBUG card->wandev.stats.rx_dropped++; -#endif +#endif if (wan_test_bit(AFT_CHIPCFG_FE_INTR_CFG_BIT,®)) { - DEBUG_TEST("%s: Got Front End Interrupt 0x%08X\n", + DEBUG_ISR("%s: Got Front End Interrupt 0x%08X\n", card->devname,reg); WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); @@ -4916,23 +5493,26 @@ static WAN_IRQ_RETVAL wp_aft_global_isr (sdla_t* card) #ifdef AFT_IRQ_STAT_DEBUG card->wandev.stats.tx_dropped++; #endif - fe_intr=1; + + if (card->wandev.fe_iface.check_isr && + card->wandev.fe_iface.check_isr(&card->fe)){ #if defined(__LINUX__) - wan_set_bit(AFT_FE_INTR,&card->u.aft.port_task_cmd); - WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); - __aft_fe_intr_ctrl(card,0); + wan_set_bit(AFT_FE_INTR,&card->u.aft.port_task_cmd); + WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); + __aft_fe_intr_ctrl(card,0); #else - front_end_interrupt(card,reg,0); + front_end_interrupt(card,reg,0); #endif - } - } + } + + }/* if (wan_test_bit(AFT_CHIPCFG_FE_INTR_CFG_BIT,®)) */ + + }/* if (wan_test_bit(AFT_CHIPCFG_FE_INTR_STAT_BIT,®)) */ /* New Octasic implementarion May 16 2006 */ #if defined(CONFIG_WANPIPE_HWEC) - if (card->wandev.ec_dev && - SYSTEM_TICKS-card->wandev.ec_intmask > EC_IRQ_TIMEOUT) { - card->wandev.ec_intmask=SYSTEM_TICKS; + if (card->wandev.ec_dev && wanpipe_ec_isr(card->wandev.ec_dev)){ if (!wan_test_bit(AFT_FE_EC_POLL,&card->u.aft.port_task_cmd)){ /* All work is done from ec_poll routine!!! */ wan_set_bit(AFT_FE_EC_POLL,&card->u.aft.port_task_cmd); @@ -4941,54 +5521,78 @@ static WAN_IRQ_RETVAL wp_aft_global_isr (sdla_t* card) } #endif - if (card->u.aft.firm_id == AFT_DS_FE_CORE_ID) { + if (card->u.aft.firm_id == AFT_DS_FE_CORE_ID || IS_BRI_CARD(card)) { - __sdla_bus_read_4(card->hw,AFT_CHIP_STAT_REG, &a108_reg); + __sdla_bus_read_4(card->hw,AFT_CHIP_STAT_REG, &a108_reg); + fifo_port_intr = aft_chipcfg_a108_get_fifo_intr_stats(a108_reg); dma_port_intr = aft_chipcfg_a108_get_dma_intr_stats(a108_reg); wdt_port_intr = aft_chipcfg_a108_get_wdt_intr_stats(a108_reg); tdmv_port_intr = aft_chipcfg_a108_get_tdmv_intr_stats(a108_reg); - }else if(IS_56K_CARD(card)){ - __sdla_bus_read_4(card->hw,AFT_CHIP_STAT_REG, &a56k_reg); + } else if (IS_SERIAL_CARD(card)) { + __sdla_bus_read_4(card->hw,AFT_CHIP_STAT_REG, &serial_reg); + +#ifdef AFT_SERIAL_DEBUG +if (serial_reg) { + DEBUG_EVENT("%s: SERIAL ISR = 0x%08X\n", + card->devname,serial_reg); +} +#endif + + fifo_port_intr = aft_chipcfg_a108_get_fifo_intr_stats(serial_reg); + dma_port_intr = aft_chipcfg_a108_get_dma_intr_stats(serial_reg); + wdt_port_intr = aft_chipcfg_serial_get_wdt_intr_stats(serial_reg); + status_port_intr = aft_chipcfg_serial_get_status_intr_stats(serial_reg, card->wandev.comm_port); + + } else if(IS_56K_CARD(card)) { + __sdla_bus_read_4(card->hw,AFT_CHIP_STAT_REG, &a56k_reg); fifo_port_intr = wan_test_bit(AFT_CHIPCFG_A56K_FIFO_INTR_BIT,&a56k_reg); dma_port_intr = wan_test_bit(AFT_CHIPCFG_A56K_DMA_INTR_BIT,&a56k_reg); wdt_port_intr = wan_test_bit(AFT_CHIPCFG_A56K_WDT_INTR_BIT,&a56k_reg); - }else{ + } else { fifo_port_intr = aft_chipcfg_get_hdlc_intr_stats(reg); dma_port_intr = aft_chipcfg_get_dma_intr_stats(reg); wdt_port_intr = aft_chipcfg_get_wdt_intr_stats(reg); tdmv_port_intr = aft_chipcfg_get_tdmv_intr_stats(reg); - if (wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { + if (wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { tdmv_port_intr&=0x01; } } + DEBUG_ISR("%s: ISR: TDM=0x%08X DMA=0x%08X FIFO=0x%08X STAT=0x%08X WDT=0x%08X\n", + card->devname,tdmv_port_intr,dma_port_intr,fifo_port_intr, + status_port_intr,wdt_port_intr); + + if (tdmv_port_intr || - dma_port_intr || - fifo_port_intr || - dma_port_intr || - wdt_port_intr) { + dma_port_intr || + fifo_port_intr || + status_port_intr || + wdt_port_intr) { /* Pass Through */ } else { /* No more interrupts for us */ - goto aft_global_isr_exit; + goto aft_global_isr_exit; } - + + if (wan_test_bit(AFT_LCFG_FIFO_INTR_BIT,&card->u.aft.lcfg_reg) && wan_test_bit(card->wandev.comm_port,&fifo_port_intr)){ #ifdef AFT_IRQ_STAT_DEBUG card->wandev.stats.multicast++; #endif + wp_aft_fifo_per_port_isr(card); + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); } #if 1 if (wan_test_bit(AFT_LCFG_DMA_INTR_BIT,&card->u.aft.lcfg_reg) && wan_test_bit(card->wandev.comm_port,&dma_port_intr)){ - + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); wp_aft_dma_per_port_isr(card); @@ -5001,21 +5605,27 @@ static WAN_IRQ_RETVAL wp_aft_global_isr (sdla_t* card) #if 1 if (wan_test_bit(0,&card->u.aft.comm_enabled) && - !wan_test_bit(AFT_LCFG_FIFO_INTR_BIT,&card->u.aft.lcfg_reg)){ + !wan_test_bit(AFT_LCFG_FIFO_INTR_BIT,&card->u.aft.lcfg_reg)){ aft_fifo_intr_ctrl(card, 1); } #else #warning "FIFO Interrupt Disabled" #endif } + + + #else #warning "NCDEBUG DMA IGNORED" #endif - if (wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { - - if (tdmv_port_intr && - !wan_test_bit(AFT_CHIPCFG_A108_A104_TDM_FIFO_SYNC_BIT,®)) { + + + + if (wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { + + if (tdmv_port_intr && + !wan_test_bit(AFT_CHIPCFG_A108_A104_TDM_FIFO_SYNC_BIT,®)) { int ring_buf_enabled=wan_test_bit(AFT_CHIPCFG_A108_A104_TDM_DMA_RINGBUF_BIT,®); sdla_t *tmp_card; @@ -5023,7 +5633,6 @@ static WAN_IRQ_RETVAL wp_aft_global_isr (sdla_t* card) void **card_list; int i; - WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); #ifdef AFT_IRQ_STAT_DEBUG @@ -5032,26 +5641,27 @@ static WAN_IRQ_RETVAL wp_aft_global_isr (sdla_t* card) if (ring_buf_enabled) { if (card->adptr_type == A104_ADPTR_4TE1 && - card->u.aft.firm_id == AFT_PMC_FE_CORE_ID) { - wan_set_bit(AFT_CHIPCFG_A104_TDM_ACK_BIT,®); + card->u.aft.firm_id == AFT_PMC_FE_CORE_ID) { + wan_set_bit(AFT_CHIPCFG_A104_TDM_ACK_BIT,®); } else { wan_set_bit(AFT_CHIPCFG_A108_TDM_GLOBAL_RX_INTR_ACK,®); - wan_set_bit(AFT_CHIPCFG_A108_TDM_GLOBAL_TX_INTR_ACK,®); + wan_set_bit(AFT_CHIPCFG_A108_TDM_GLOBAL_TX_INTR_ACK,®); } - __sdla_bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); + __sdla_bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); if (card->hw_iface.fe_test_bit(card->hw,1)) { - DEBUG_EVENT("%s: Global TDM Ring Resync\n",card->devname); - ring_rsync=1; - card->hw_iface.fe_clear_bit(card->hw,1); + DEBUG_EVENT("%s: Global TDM Ring Resync\n",card->devname); + ring_rsync=1; + card->hw_iface.fe_clear_bit(card->hw,1); } } card_list=__sdla_get_ptr_isr_array(card->hw); - for (i=0;i<8;i++){ + + //FIXME: Use value pre card type + for (i=0;iwandev.state == WAN_CONNECTED && wan_test_bit(AFT_LCFG_TDMV_INTR_BIT,&tmp_card->u.aft.lcfg_reg)) { #ifdef AFT_IRQ_STAT_DEBUG tmp_card->wandev.stats.rx_crc_errors++; @@ -5066,70 +5676,77 @@ static WAN_IRQ_RETVAL wp_aft_global_isr (sdla_t* card) tmp_card->u.aft.tdm_rx_dma_toggle=0; } - tmp_card->u.aft.tdm_tx_dma_toggle++; + tmp_card->u.aft.tdm_tx_dma_toggle++; if (tmp_card->u.aft.tdm_tx_dma_toggle >= AFT_TDMV_CIRC_BUF_LEN) { tmp_card->u.aft.tdm_tx_dma_toggle=0; - } + } } } #if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) - if (tmp_card->wan_tdmv.sc) { + if (tmp_card->wan_tdmv.sc) { + aft_voice_span_rx_tx(tmp_card, - ring_buf_enabled); + ring_buf_enabled); }else #endif { - wp_aft_tdmv_per_port_isr(tmp_card); + wp_aft_tdmv_per_port_isr(tmp_card); } } } if (!ring_buf_enabled) { if (card->adptr_type == A104_ADPTR_4TE1 && - card->u.aft.firm_id == AFT_PMC_FE_CORE_ID) { - wan_set_bit(AFT_CHIPCFG_A104_TDM_ACK_BIT,®); + card->u.aft.firm_id == AFT_PMC_FE_CORE_ID) { + wan_set_bit(AFT_CHIPCFG_A104_TDM_ACK_BIT,®); } else { wan_set_bit(AFT_CHIPCFG_A108_TDM_GLOBAL_RX_INTR_ACK,®); - wan_set_bit(AFT_CHIPCFG_A108_TDM_GLOBAL_TX_INTR_ACK,®); + wan_set_bit(AFT_CHIPCFG_A108_TDM_GLOBAL_TX_INTR_ACK,®); } - __sdla_bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); + __sdla_bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); + } + } - } } else { - if (wan_test_bit(AFT_LCFG_TDMV_INTR_BIT,&card->u.aft.lcfg_reg) && - wan_test_bit(card->wandev.comm_port,&tdmv_port_intr)){ + if (wan_test_bit(AFT_LCFG_TDMV_INTR_BIT,&card->u.aft.lcfg_reg) && + wan_test_bit(card->wandev.comm_port,&tdmv_port_intr)){ - WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); #ifdef AFT_IRQ_STAT_DEBUG - card->wandev.stats.rx_crc_errors++; + card->wandev.stats.rx_crc_errors++; #endif #if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) - if (card->wan_tdmv.sc && - !card->wandev.rtp_len && - card->wandev.config_id != WANCONFIG_AFT_ANALOG) { - u32 dmareg; - aft_voice_span_rx_tx(card, 0); - card->hw_iface.bus_read_4(card->hw, - AFT_PORT_REG(card,AFT_DMA_CTRL_REG),&dmareg); - wan_set_bit(AFT_DMACTRL_TDMV_RX_TOGGLE,&dmareg); - wan_set_bit(AFT_DMACTRL_TDMV_TX_TOGGLE,&dmareg); - card->hw_iface.bus_write_4(card->hw, - AFT_PORT_REG(card,AFT_DMA_CTRL_REG),dmareg); - } else + + if (card->wan_tdmv.sc && + !card->wandev.rtp_len && + card->wandev.config_id != WANCONFIG_AFT_ANALOG) { + u32 dmareg; + aft_voice_span_rx_tx(card, 0); + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_DMA_CTRL_REG),&dmareg); + wan_set_bit(AFT_DMACTRL_TDMV_RX_TOGGLE,&dmareg); + wan_set_bit(AFT_DMACTRL_TDMV_TX_TOGGLE,&dmareg); + card->hw_iface.bus_write_4(card->hw, + AFT_PORT_REG(card,AFT_DMA_CTRL_REG),dmareg); + } else #endif - { - wp_aft_tdmv_per_port_isr(card); + { + wp_aft_tdmv_per_port_isr(card); + } } - } + } + + if (status_port_intr) { + wp_aft_serial_status_isr(card, status_port_intr); } if (wan_test_bit(card->wandev.comm_port,&wdt_port_intr)){ WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); - wp_aft_wdt_per_port_isr(card,1); + wp_aft_wdt_per_port_isr(card,1); card->u.aft.wdt_tx_cnt=SYSTEM_TICKS; #ifdef AFT_IRQ_STAT_DEBUG card->wandev.stats.rx_fifo_errors++; @@ -5148,7 +5765,7 @@ static WAN_IRQ_RETVAL wp_aft_global_isr (sdla_t* card) #endif /* -----------------2/6/2003 10:36AM----------------- - * Finish of the interupt handler + * Finish of the interupt handler * --------------------------------------------------*/ @@ -5170,7 +5787,7 @@ static WAN_IRQ_RETVAL wp_aft_global_isr (sdla_t* card) WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); if (++card->u.aft.chip_security_cnt > AFT_MAX_CHIP_SECURITY_CNT){ - DEBUG_EVENT("%s: Critical: Echo Canceller Chip Security Compromised: Disabling Driver!\n", + DEBUG_EVENT("%s: Critical: Echo Canceller Chip Security Compromised: Disabling Driver!\n", card->devname); DEBUG_EVENT("%s: Please call Sangoma Tech Support (www.sangoma.com)!\n", card->devname); @@ -5189,155 +5806,77 @@ static WAN_IRQ_RETVAL wp_aft_global_isr (sdla_t* card) __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG), &lcfg_reg); card->u.aft.lcfg_reg=lcfg_reg; if (wan_test_bit(AFT_LCFG_TX_FE_SYNC_STAT_BIT,&lcfg_reg) || - wan_test_bit(AFT_LCFG_RX_FE_SYNC_STAT_BIT,&lcfg_reg)){ - if (++card->u.aft.chip_security_cnt > AFT_MAX_CHIP_SECURITY_CNT){ - DEBUG_EVENT("%s: Critical: A108 Lost Sync with Front End: Disabling Driver (0x%08X : A108S=0x%08X)!\n", + wan_test_bit(AFT_LCFG_RX_FE_SYNC_STAT_BIT,&lcfg_reg)){ + if (++card->u.aft.chip_security_cnt > AFT_MAX_CHIP_SECURITY_CNT){ + DEBUG_EVENT("%s: Critical: A108 Lost Sync with Front End: Disabling Driver (0x%08X : A108S=0x%08X)!\n", card->devname, lcfg_reg,a108_reg); DEBUG_EVENT("%s: Please call Sangoma Tech Support (www.sangoma.com)!\n", card->devname); aft_critical_shutdown(card); - } + } } else { card->u.aft.chip_security_cnt=0; } - } else { - card->u.aft.chip_security_cnt=0; - } + } else { + card->u.aft.chip_security_cnt=0; + } #endif - DEBUG_TEST("---- ISR end.-------------------\n"); + DEBUG_TEST("---- ISR end.-------------------\n"); aft_global_isr_exit: - - -#ifdef AFT_IRQ_STAT_DEBUG - if (SYSTEM_TICKS - stat_timeout > (AFT_IRQ_STAT_TIMEOUT*HZ) ) { - stat_timeout=SYSTEM_TICKS; - DEBUG_EVENT("%s: T=%is ISR=%li FE=%li DMA=%li TDM=%li FIFO=%li WDTi=%li WDTp=%li BH=%li TASK=%li\n", - card->devname, - AFT_IRQ_STAT_TIMEOUT, - card->wandev.stats.rx_errors, /*ISR*/ - card->wandev.stats.tx_dropped, /*FE*/ - card->wandev.stats.rx_length_errors, /*DMA*/ - card->wandev.stats.rx_crc_errors, /* TDM */ - card->wandev.stats.multicast, /*FIFO*/ - card->wandev.stats.rx_fifo_errors, /* WDTi */ - card->wandev.stats.tx_aborted_errors, /* WDTp */ - card->wandev.stats.collisions, /* BH */ - card->wandev.stats.rx_missed_errors /* TASK */ - ); - card->wandev.stats.rx_errors=0; - card->wandev.stats.tx_dropped=0; - card->wandev.stats.rx_length_errors=0; - card->wandev.stats.rx_crc_errors=0; - card->wandev.stats.multicast=0; - card->wandev.stats.rx_fifo_errors=0; - card->wandev.stats.tx_aborted_errors=0; - card->wandev.stats.collisions=0; - card->wandev.stats.rx_missed_errors=0; - } -#endif - - if ((SYSTEM_TICKS - card->u.aft.rx_errors_timeout) > card->u.aft.cfg.err_throttle_period*HZ) { - - if (card->u.aft.rx_errors_down_timeout) { - if (SYSTEM_TICKS - card->u.aft.rx_errors_down_timeout > card->u.aft.cfg.err_throttle_timeout*HZ) { - card->u.aft.rx_errors_down_timeout=0; - DEBUG_EVENT("%s: Restarting Device after excessive rx errors!\n", - card->devname); - wan_set_bit(AFT_FE_RESTART,&card->u.aft.port_task_cmd); - WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); - } - } else { - if (card->u.aft.rx_errors_hist > 5000) { - card->u.aft.rx_errors_over_cnt++; - DEBUG_EVENT("%s: Excessive Rx Errors ... %i (errs/s=%i)!\n", - card->devname,card->u.aft.rx_errors_over_cnt,card->u.aft.rx_errors_hist); -#if 0 - -/* NC: This is very dangrous. We have seen on some lines that it takes up to - 9 rx_errors_over_cnt for the line to stabilize. I will continue to print the - warning but will not disable the line. This way a customer would know that there - is something wrong with his system. Ericsson uses this feature in their systems - The driver stop on excess errors should be configurable. */ - - if (card->u.aft.rx_errors_over_cnt >= 2) { - DEBUG_EVENT("%s: Excessive Rx Errors ... stopping device!\n",card->devname); - card->u.aft.rx_errors_over_cnt=0; - disable_data_error_intr(card,LINK_DOWN); - aft_wdt_reset(card); - aft_wdt_set(card,AFT_WDTCTRL_TIMEOUT); - card->u.aft.rx_errors_down_timeout = SYSTEM_TICKS; - } -#endif - } else { - card->u.aft.rx_errors_over_cnt=0; - card->u.aft.rx_errors_down_timeout=0; - } - } - card->u.aft.rx_errors_hist=0; - card->u.aft.rx_errors_timeout=SYSTEM_TICKS; - } - - - wan_clear_bit(0,&card->in_isr); + wan_clear_bit(0,&card->in_isr); WAN_IRQ_RETURN(irq_ret); } -static void wp_aft_dma_per_port_isr(sdla_t *card) + +static void wp_aft_serial_status_isr(sdla_t *card, u32 serial_intr_status) +{ + u32 reg; + + __sdla_bus_read_4(card->hw, AFT_PORT_REG(card,AFT_SERIAL_LINE_CFG_REG), ®); + card->u.aft.serial_status=reg; + + if (wan_test_bit(AFT_CHIPCFG_SERIAL_CTS_STATUS_INTR_BIT,&serial_intr_status)) { + DEBUG_EVENT("%s: CTS ISR Status 0x%02X\n", + card->devname, + wan_test_bit(AFT_SERIAL_LCFG_CTS_BIT,®)); + } + + if (wan_test_bit(AFT_CHIPCFG_SERIAL_DCD_STATUS_INTR_BIT,&serial_intr_status)) { + DEBUG_EVENT("%s: DCS ISR Status 0x%02X\n", + card->devname, + wan_test_bit(AFT_SERIAL_LCFG_DCD_BIT,®)); + } + + if (wan_test_bit(AFT_CHIPCFG_SERIAL_RTS_STATUS_INTR_BIT,&serial_intr_status)) { + DEBUG_EVENT("%s: RTS ISR Status 0x%02X\n", + card->devname, + wan_test_bit(AFT_SERIAL_LCFG_RTS_BIT,®)); + } +} + + +static void __wp_aft_per_per_port_isr(sdla_t *card, u32 dma_rx_reg, u32 dma_tx_reg) { - int i; - u32 dma_tx_reg,dma_rx_reg; private_area_t *chan; u32 dma_tx_voice=0; - - /* -----------------2/6/2003 9:37AM------------------ - * Checking for Interrupt source: - * 1. Receive DMA Engine - * 2. Transmit DMA Engine - * 3. Error conditions. - * --------------------------------------------------*/ - - int num_of_logic_ch; - num_of_logic_ch=card->u.aft.num_of_time_slots; - - /* Zaptel optimization. Dont waist time looking at - channels, when we know that only a single DCHAN - will use this code */ -#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) - if (card->wan_tdmv.sc) { - __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_RX_DMA_INTR_PENDING_REG),&dma_rx_reg); - __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_TX_DMA_INTR_PENDING_REG),&dma_tx_reg); - if (card->u.aft.tdmv_dchan) { - chan=(private_area_t*)card->u.aft.dev_to_ch_map[card->u.aft.tdmv_dchan-1]; - if (chan && wan_test_bit(0,&chan->up)) { - aft_dma_rx_complete(card,chan,0); - aft_dma_tx_complete(card,chan,0,0); - } - } - goto isr_skb_rx; - } -#endif - - /* Receive DMA Engine */ - __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_RX_DMA_INTR_PENDING_REG),&dma_rx_reg); - + int i; + dma_rx_reg&=card->u.aft.active_ch_map; - - if (dma_rx_reg == 0){ - goto isr_skb_rx; + if (!dma_rx_reg) { + goto isr_skb_rx; } dma_rx_reg &= card->u.aft.logic_ch_map; dma_rx_reg &= ~(card->u.aft.tdm_logic_ch_map); + for (i=0; iu.aft.num_of_time_slots;i++){ - for (i=0; iu.aft.dev_to_ch_map[i]; if (!chan){ DEBUG_EVENT("%s: Error: No Dev for Rx logical ch=%d\n", @@ -5354,13 +5893,16 @@ static void wp_aft_dma_per_port_isr(sdla_t *card) continue; } + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } + #if 0 - chan->if_stats.rx_frame_errors++; + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; #endif - DEBUG_ISR("%s: RX Interrupt pend. \n", - card->devname); - + DEBUG_TEST("%s: RX Interrupt pend. \n", card->devname); + aft_dma_rx_complete(card,chan,0); @@ -5378,11 +5920,7 @@ static void wp_aft_dma_per_port_isr(sdla_t *card) isr_skb_rx: - /* Transmit DMA Engine */ - __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_TX_DMA_INTR_PENDING_REG),&dma_tx_reg); - dma_tx_reg&=card->u.aft.active_ch_map; - dma_tx_reg&=~dma_tx_voice; if (dma_tx_reg == 0){ @@ -5393,7 +5931,7 @@ isr_skb_rx: dma_tx_reg &= ~(card->u.aft.tdm_logic_ch_map); - for (i=0; iu.aft.num_of_time_slots ;i++){ if (wan_test_bit(i,&dma_tx_reg)) { chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; @@ -5407,6 +5945,10 @@ isr_skb_rx: continue; } + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } + DEBUG_ISR("---- TX Interrupt pend. --\n"); aft_dma_tx_complete(card,chan,0,0); } @@ -5415,6 +5957,63 @@ isr_skb_rx: isr_skb_tx: DEBUG_ISR("---- ISR SKB TX end.-------------------\n"); + return; +} + + +static void wp_aft_dma_per_port_isr(sdla_t *card) +{ + int i; + u32 dma_tx_reg=0,dma_rx_reg=0; + private_area_t *chan; + + /* -----------------2/6/2003 9:37AM------------------ + * Checking for Interrupt source: + * 1. Receive DMA Engine + * 2. Transmit DMA Engine + * 3. Error conditions. + * --------------------------------------------------*/ + + /* Zaptel optimization. Dont waist time looking at + channels, when we know that only a single DCHAN + will use this code */ +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) + if (card->wan_tdmv.sc) { + __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_RX_DMA_INTR_PENDING_REG),&dma_rx_reg); + __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_TX_DMA_INTR_PENDING_REG),&dma_tx_reg); + if (card->u.aft.tdmv_dchan) { + chan=(private_area_t*)card->u.aft.dev_to_ch_map[card->u.aft.tdmv_dchan-1]; + if (chan && wan_test_bit(0,&chan->up)) { + aft_dma_rx_complete(card,chan,0); + aft_dma_tx_complete(card,chan,0,0); + } + } + return; + } +#endif + + /* Receive DMA Engine */ + __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_RX_DMA_INTR_PENDING_REG),&dma_rx_reg); + __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_TX_DMA_INTR_PENDING_REG),&dma_tx_reg); + + DEBUG_TEST("Line: %d: dma_rx_reg: 0x%X\n", __LINE__, dma_rx_reg); + + if (IS_BRI_CARD(card)) { + void **card_list=__sdla_get_ptr_isr_array(card->hw); + sdla_t *tmp_card; + for (i=0;iwandev.state == WAN_CONNECTED && + !wan_test_bit(AFT_LCFG_TDMV_INTR_BIT,&tmp_card->u.aft.lcfg_reg)) { + + __wp_aft_per_per_port_isr(tmp_card,dma_rx_reg,dma_tx_reg); + } + } + } else { + __wp_aft_per_per_port_isr(card,dma_rx_reg,dma_tx_reg); + } + } @@ -5452,13 +6051,16 @@ static void wp_aft_tdmv_per_port_isr(sdla_t *card) continue; } + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } if (chan->channelized_cfg && !chan->hdlc_eng){ aft_dma_rx_tdmv(card,chan); } #if 0 - chan->if_stats.rx_frame_errors++; + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; #endif DEBUG_ISR("%s: RX Interrupt pend. \n", @@ -5469,33 +6071,51 @@ static void wp_aft_tdmv_per_port_isr(sdla_t *card) - - -static void wp_aft_wdt_per_port_isr(sdla_t *card, int wdt_intr) +static void __wp_aft_wdt_per_port_isr (sdla_t *card, int wdt_intr, int *wdt_disable, int *timeout) { - int i,wdt_disable = 0; - int timeout=AFT_WDTCTRL_TIMEOUT; - - aft_wdt_reset(card); - + int i; + + /* If TDM interrupt does not start in time + * we have to re-start it */ if (card->rsync_timeout){ - if (SYSTEM_TICKS - card->rsync_timeout > 3*HZ) { - card->rsync_timeout=0; - if (card->fe.fe_status == FE_CONNECTED) { - DEBUG_EVENT("%s: WAN IRQ Timeout \n", - card->devname); - wan_set_bit(AFT_FE_RESTART,&card->u.aft.port_task_cmd); - WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); + if (!IS_BRI_CARD(card)) { + if (SYSTEM_TICKS - card->rsync_timeout > 2*HZ) { + card->rsync_timeout=0; + if (card->fe.fe_status == FE_CONNECTED) { + DEBUG_EVENT("%s: TDM IRQ Timeout \n", + card->devname); + wan_set_bit(AFT_FE_RESTART,&card->u.aft.port_task_cmd); + WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); + } } - } - aft_wdt_set(card,timeout); - return; + } else { + if (SYSTEM_TICKS - card->rsync_timeout > 1*HZ) { + int x; + void **card_list=__sdla_get_ptr_isr_array(card->hw); + sdla_t *first_card=NULL; + card->rsync_timeout=0; + + for (x=0;xu.aft.lcfg_reg)) { + break; + } + first_card=NULL; + } + + if (first_card) { + DEBUG_EVENT("%s: BRI TDM IRQ Timeout \n", + first_card->devname); + if (!wan_test_bit(AFT_FE_RESTART,&first_card->u.aft.port_task_cmd)) { + wan_set_bit(AFT_FE_RESTART,&first_card->u.aft.port_task_cmd); + WAN_TASKQ_SCHEDULE((&first_card->u.aft.port_task)); + } + } + } + } + return; } - if (card->u.aft.rx_errors_down_timeout) { - aft_wdt_set(card,timeout); - return; - } for (i=0; iu.aft.num_of_time_slots;i++){ @@ -5514,23 +6134,27 @@ static void wp_aft_wdt_per_port_isr(sdla_t *card, int wdt_intr) wan_test_bit(0,&chan->interface_down)){ continue; } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } #if 0 if (wdt_intr){ - ++chan->if_stats.tx_dropped; + WAN_NETIF_STATS_INC_TX_DROPPED(&chan->common); //++chan->if_stats.tx_dropped; }else{ - ++chan->if_stats.tx_errors; + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //++chan->if_stats.tx_errors; } #endif if (card->wandev.state == WAN_CONNECTED){ if (chan->single_dma_chain){ - wdt_disable=1; + *wdt_disable=1; continue; } #if 0 - ++chan->if_stats.tx_errors; + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //++chan->if_stats.tx_errors; #endif aft_dma_tx_complete (card,chan,1,0); @@ -5563,12 +6187,11 @@ static void wp_aft_wdt_per_port_isr(sdla_t *card, int wdt_intr) } } #if 0 - ++chan->if_stats.tx_dropped; + WAN_NETIF_STATS_INC_TX_DROPPED(&chan->common); //++chan->if_stats.tx_dropped; #endif #if 1 - timeout=1; - aft_wdt_set(card,timeout); + *timeout=1; WAN_TDMV_CALL(rx_tx_span, (card), err); #else #warning "NCDEBUG: rx_tx_span disabled poll" @@ -5580,6 +6203,34 @@ static void wp_aft_wdt_per_port_isr(sdla_t *card, int wdt_intr) #endif } + return; + +} + +static void wp_aft_wdt_per_port_isr(sdla_t *card, int wdt_intr) +{ + int wdt_disable = 0; + int timeout=AFT_WDTCTRL_TIMEOUT; + + aft_wdt_reset(card); + + if (IS_BRI_CARD(card)) { + int x; + void **card_list=__sdla_get_ptr_isr_array(card->hw); + sdla_t *first_card; + for (x=0;xwandev.critical)) { + __wp_aft_wdt_per_port_isr(first_card,wdt_intr,&wdt_disable,&timeout); + } + } + + } else { + __wp_aft_wdt_per_port_isr(card,wdt_intr,&wdt_disable,&timeout); + } + + + #ifdef AFT_WDT_ENABLE /* Since this fucntion can be called via interrupt or * via interrupt poll, only re-enable wdt interrupt @@ -5664,10 +6315,21 @@ static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, case AFT_MODEM_STATUS: wan_udp_pkt->wan_udp_return_code = 0; - if (card->wandev.state == WAN_CONNECTED){ - wan_udp_pkt->wan_udp_data[0]=0x28; - }else{ - wan_udp_pkt->wan_udp_data[0]=0; + wan_udp_pkt->wan_udp_data[0]=0; + + if (IS_SERIAL_CARD(card)) { + if (wan_test_bit(AFT_SERIAL_LCFG_DCD_BIT,&card->u.aft.serial_status)) { + wan_udp_pkt->wan_udp_data[0]|=0x08; + } + if (wan_test_bit(AFT_SERIAL_LCFG_CTS_BIT,&card->u.aft.serial_status)) { + wan_udp_pkt->wan_udp_data[0]|=0x20; + } + } else { + if (card->wandev.state == WAN_CONNECTED){ + wan_udp_pkt->wan_udp_data[0]=0x28; + }else{ + wan_udp_pkt->wan_udp_data[0]=0; + } } wan_udp_pkt->wan_udp_data_len=1; break; @@ -5900,8 +6562,7 @@ static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, case AFT_HWEC_STATUS: *(unsigned long *)&wan_udp_pkt->wan_udp_data[0] = - IS_E1_CARD(card) ? card->wandev.ec_map: - card->wandev.ec_map << 1; + card->wandev.fe_ec_map; wan_udp_pkt->wan_udp_data_len = sizeof(unsigned long); wan_udp_pkt->wan_udp_return_code = 0; break; @@ -5993,31 +6654,6 @@ static void port_set_state (sdla_t *card, int state) } } - -/*============================================================ - * callback_front_end_state - * - * Called by front end code to indicate that state has - * changed. We will call the poll task to update the state. - */ - -static void callback_front_end_state(void *card_id) -{ - sdla_t *card = (sdla_t*)card_id; - - if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ - return; - } - - /* Call the poll task to update the state */ - wan_set_bit(AFT_FE_POLL,&card->u.aft.port_task_cmd); - WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); - - return; -} - - - /*============================================================ * handle_front_end_state * @@ -6089,7 +6725,9 @@ static void handle_front_end_state(void *card_id) return; } - enable_data_error_intr(card); + if (!IS_BRI_CARD(card) || !wan_test_bit(0,&card->u.aft.comm_enabled)) { + enable_data_error_intr(card); + } port_set_state(card,WAN_CONNECTED); wan_set_bit(AFT_FE_LED,&card->u.aft.port_task_cmd); @@ -6097,7 +6735,12 @@ static void handle_front_end_state(void *card_id) }else{ if (card->wandev.state == WAN_CONNECTED){ port_set_state(card,WAN_DISCONNECTED); - disable_data_error_intr(card,LINK_DOWN); + + if (!IS_BRI_CARD(card)) { + /* Never disable interrupts for BRI since + all cards are on same timslot map */ + disable_data_error_intr(card,LINK_DOWN); + } wan_set_bit(AFT_FE_LED,&card->u.aft.port_task_cmd); /* We are already in the poll task here so @@ -6232,7 +6875,7 @@ static int aft_read(sdla_t *card, wan_cmd_api_t *api_cmd) api_cmd->len); } -#if defined(DEBUG_REG) +#if defined(WAN_DEBUG_REG) DEBUG_EVENT("%s: Reading Bar%d Offset=0x%X Data=%08X Len=%d\n", card->devname, api_cmd->bar, @@ -6268,7 +6911,7 @@ static int aft_write(sdla_t *card, wan_cmd_api_t *api_cmd) card->hw, api_cmd->offset, *(u8*)&api_cmd->data[0]); -#if defined(DEBUG_REG) +#if defined(WAN_DEBUG_REG) DEBUG_EVENT("%s: Write Offset=0x%08X Data=0x%02X\n", card->devname,api_cmd->offset, *(u8*)&api_cmd->data[0]); @@ -6278,7 +6921,7 @@ static int aft_write(sdla_t *card, wan_cmd_api_t *api_cmd) card->hw, api_cmd->offset, *(u16*)&api_cmd->data[0]); -#if defined(DEBUG_REG) +#if defined(WAN_DEBUG_REG) DEBUG_EVENT("%s: Write Offset=0x%08X Data=0x%04X\n", card->devname,api_cmd->offset, *(unsigned short*)&api_cmd->data[0]); @@ -6288,7 +6931,7 @@ static int aft_write(sdla_t *card, wan_cmd_api_t *api_cmd) card->hw, api_cmd->offset, *(unsigned int*)&api_cmd->data[0]); -#if defined(DEBUG_REG) +#if defined(WAN_DEBUG_REG) DEBUG_EVENT("ADEBUG: %s: Write Offset=0x%08X Data=0x%08X\n", card->devname,api_cmd->offset, *(u32*)&api_cmd->data[0]); @@ -6456,8 +7099,14 @@ static void enable_data_error_intr(sdla_t *card) { u32 reg; int i,err; + int card_use_cnt; - DEBUG_TEST("%s: %s()\n",card->devname,__FUNCTION__); + + + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &card_use_cnt); + + DEBUG_TEST("%s: %s() Card Port =%i Use Cnt = %i \n", + card->devname,__FUNCTION__,card->wandev.comm_port,card_use_cnt); card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG), ®); @@ -6483,16 +7132,16 @@ static void enable_data_error_intr(sdla_t *card) aft_wdt_reset(card); - /* Clean Tx/Rx DMA interrupts */ - card->hw_iface.bus_read_4(card->hw, - AFT_PORT_REG(card,AFT_TX_DMA_INTR_PENDING_REG), - ®); - - card->hw_iface.bus_read_4(card->hw, - AFT_PORT_REG(card,AFT_RX_DMA_INTR_PENDING_REG), - ®); - - + if (!IS_BRI_CARD(card) || (IS_BRI_CARD(card) && card_use_cnt == 1)) { + /* Clean Tx/Rx DMA interrupts */ + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_TX_DMA_INTR_PENDING_REG), + ®); + + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_RX_DMA_INTR_PENDING_REG), + ®); + } err=aft_hwdev[card->wandev.card_type].aft_test_sync(card,0); if (err){ @@ -6503,13 +7152,13 @@ static void enable_data_error_intr(sdla_t *card) /*FIXME: How to recover from here, should never happen */ } - if (card->tdmv_conf.span_no){ card->hw_iface.bus_read_4(card->hw, AFT_PORT_REG(card,AFT_LINE_CFG_REG), ®); wan_set_bit(AFT_LCFG_TDMV_INTR_BIT,®); card->hw_iface.bus_write_4(card->hw, - AFT_PORT_REG(card,AFT_LINE_CFG_REG), reg); + AFT_PORT_REG(card,AFT_LINE_CFG_REG), reg); + } for (i=0; iu.aft.num_of_time_slots;i++){ @@ -6528,6 +7177,9 @@ static void enable_data_error_intr(sdla_t *card) continue; } + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } DEBUG_TEST("%s: 1) Free Used DMA CHAINS %s\n", card->devname,chan->if_name); @@ -6566,7 +7218,6 @@ static void enable_data_error_intr(sdla_t *card) card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),reg); /* For all channels clean Tx/Rx fifos */ - for (i=0; iu.aft.num_of_time_slots;i++){ private_area_t *chan; @@ -6583,6 +7234,9 @@ static void enable_data_error_intr(sdla_t *card) continue; } + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } DEBUG_TEST("%s: 3) Init interface fifo %s\n", card->devname,chan->if_name); @@ -6617,6 +7271,10 @@ static void enable_data_error_intr(sdla_t *card) continue; } + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } + DEBUG_TEST("%s: 4) Init interface %s\n", card->devname,chan->if_name); @@ -6658,12 +7316,14 @@ static void enable_data_error_intr(sdla_t *card) continue; } + memset(&chan->swring,0,sizeof(chan->swring)); + if (!wan_test_bit(0,&chan->up)){ continue; } - if (wan_test_bit(AFT_TDM_SW_RING_BUF,&card->u.aft.chip_cfg_status)) { - memset(&chan->swring,0,sizeof(chan->swring)); + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; } if (!chan->hdlc_eng){ @@ -6693,10 +7353,12 @@ static void enable_data_error_intr(sdla_t *card) AFT_PORT_REG(card,AFT_LINE_CFG_REG), ®); wan_set_bit(AFT_LCFG_DMA_INTR_BIT,®); + wan_clear_bit(AFT_LCFG_FIFO_INTR_BIT,®); if (card->tdmv_conf.span_no){ wan_set_bit(AFT_LCFG_TDMV_INTR_BIT,®); } + card->hw_iface.bus_write_4(card->hw, AFT_PORT_REG(card,AFT_LINE_CFG_REG), reg); @@ -6709,38 +7371,36 @@ static void enable_data_error_intr(sdla_t *card) /* Enable Channelized Driver if configured */ if (card->tdmv_conf.span_no) { - + card->hw_iface.bus_read_4(card->hw, - AFT_PORT_REG(card,AFT_RX_FIFO_INTR_PENDING_REG), - ®); + AFT_PORT_REG(card,AFT_RX_FIFO_INTR_PENDING_REG), + ®); card->hw_iface.bus_read_4(card->hw, - AFT_PORT_REG(card,AFT_TX_FIFO_INTR_PENDING_REG), - ®); - -#if 1 - + AFT_PORT_REG(card,AFT_TX_FIFO_INTR_PENDING_REG), + ®); - if (wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { +#if 1 + + if (wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { + + card->hw_iface.bus_read_4(card->hw,AFT_CHIP_CFG_REG,®); /* Reset Global Fifo for the whole card */ - card->hw_iface.bus_read_4(card->hw,AFT_CHIP_CFG_REG,®); wan_set_bit(AFT_CHIPCFG_A108_A104_TDM_FIFO_SYNC_BIT,®); - card->hw_iface.bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); - - /* Wait for Global Fifo Reset 1ms */ + card->hw_iface.bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); WP_DELAY(1000); - + /* Clear Global Card Fifo reset */ wan_clear_bit(AFT_CHIPCFG_A108_A104_TDM_FIFO_SYNC_BIT,®); - + /* Enable TDM Quad DMA Ring buffer */ - if (wan_test_bit(AFT_TDM_RING_BUF,&card->u.aft.chip_cfg_status)) { + if (wan_test_bit(AFT_TDM_RING_BUF,&card->u.aft.chip_cfg_status)) { wan_set_bit(AFT_CHIPCFG_A108_A104_TDM_DMA_RINGBUF_BIT,®); card->hw_iface.fe_set_bit(card->hw,1); }else{ wan_clear_bit(AFT_CHIPCFG_A108_A104_TDM_DMA_RINGBUF_BIT,®); } - + #if 1 /* Global Acknowledge TDM Interrupt (Kickstart) */ if (card->adptr_type == A104_ADPTR_4TE1 && @@ -6753,6 +7413,7 @@ static void enable_data_error_intr(sdla_t *card) #endif card->hw_iface.bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); + card->rsync_timeout=SYSTEM_TICKS; DEBUG_EVENT("%s: AFT Global TDM Intr\n", @@ -6766,18 +7427,17 @@ static void enable_data_error_intr(sdla_t *card) wan_set_bit(AFT_DMACTRL_TDMV_TX_TOGGLE,®); card->hw_iface.bus_write_4(card->hw, AFT_PORT_REG(card,AFT_DMA_CTRL_REG),reg); - if (wan_test_bit(AFT_TDM_SW_RING_BUF,&card->u.aft.chip_cfg_status)) { DEBUG_EVENT("%s: AFT Per Port TDM Intr (swring)\n",card->devname); } else { DEBUG_EVENT("%s: AFT Per Port TDM Intr\n",card->devname); } + } #endif - } + }/* if (card->u.aft.cfg.tdmv_span_no) */ - #ifdef AFT_WDT_ENABLE aft_wdt_set(card,AFT_WDTCTRL_TIMEOUT); #endif @@ -6791,12 +7451,19 @@ static void enable_data_error_intr(sdla_t *card) static void disable_data_error_intr(sdla_t *card, unsigned char event) { u32 reg; - + int card_use_cnt; + + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &card_use_cnt); + + if(IS_BRI_CARD(card) && card_use_cnt > 1){ + return; + } + DEBUG_TEST("%s: Event = %s\n",__FUNCTION__, event==DEVICE_DOWN?"Device Down": "Link Down"); - DEBUG_EVENT("%s: AFT communications disabled!\n", - card->devname); + DEBUG_EVENT("%s: AFT communications disabled! %d\n", + card->devname, card_use_cnt); aft_wdt_reset(card); @@ -6806,9 +7473,17 @@ static void disable_data_error_intr(sdla_t *card, unsigned char event) wan_clear_bit(AFT_LCFG_FIFO_INTR_BIT,®); wan_clear_bit(AFT_LCFG_TDMV_INTR_BIT,®); - if (event==DEVICE_DOWN){ - /* Disable Front End Interface */ - wan_set_bit(AFT_LCFG_FE_IFACE_RESET_BIT,®); + + if (IS_BRI_CARD(card)) { + if (card_use_cnt == 1 && event==DEVICE_DOWN){ + /* Disable Front End Interface */ + wan_set_bit(AFT_LCFG_FE_IFACE_RESET_BIT,®); + } + }else{ + if (event==DEVICE_DOWN){ + /* Disable Front End Interface */ + wan_set_bit(AFT_LCFG_FE_IFACE_RESET_BIT,®); + } } card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG), reg); card->u.aft.lcfg_reg=reg; @@ -6850,12 +7525,19 @@ static int update_comms_stats(sdla_t* card) card->hw_iface.hw_lock(card->hw,&smp_flags); if (card->wandev.fe_iface.read_alarm) { - card->wandev.fe_iface.read_alarm(&card->fe, 0); + card->wandev.fe_iface.read_alarm(&card->fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE); } /* TE1 Update T1/E1 perfomance counters */ +#if 0 +#warning "PMON DISABLED DUE TO ERROR" +#else if (card->wandev.fe_iface.read_pmon) { + wan_smp_flag_t flags; + wan_spin_lock_irq(&card->wandev.lock,&flags); card->wandev.fe_iface.read_pmon(&card->fe, 0); + wan_spin_unlock_irq(&card->wandev.lock,&flags); } +#endif card->hw_iface.hw_unlock(card->hw,&smp_flags); } @@ -6898,6 +7580,7 @@ static void aft_rx_fifo_over_recover(sdla_t *card, private_area_t *chan) aft_tslot_sync_ctrl(card,chan,1); + wanpipe_wake_stack(chan); } static void aft_tx_fifo_under_recover (sdla_t *card, private_area_t *chan) @@ -6933,6 +7616,7 @@ static void aft_tx_fifo_under_recover (sdla_t *card, private_area_t *chan) aft_reset_tx_chain_cnt(chan); aft_dma_tx(card,chan); + wanpipe_wake_stack(chan); } static int set_chan_state(sdla_t* card, netdevice_t* dev, int state) @@ -6993,6 +7677,12 @@ static int set_chan_state(sdla_t* card, netdevice_t* dev, int state) wanpipe_lip_disconnect(chan,0); } } + +#if defined(NETGRAPH) + if (chan->common.usedby == WP_NETGRAPH){ + wan_ng_link_state(&chan->common, state); + } +#endif return 0; } @@ -7122,10 +7812,22 @@ void protocol_recv(sdla_t *card, private_area_t *chan, netskb_t *skb) #endif #if defined(__LINUX__) + skb->protocol = htons(ETH_P_IP); skb->dev = chan->common.dev; wan_skb_reset_mac_header(skb); netif_rx(skb); + +#elif defined(__FreeBSD__) + + wan_skb_set_csum(skb,0); + + if (wan_iface.input && wan_iface.input(chan->common.dev, skb) != 0){ + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); //++chan->if_stats.rx_dropped; + wan_skb_free(skb); + return; + } + #else DEBUG_EVENT("%s: Action not supported (IP)!\n", card->devname); @@ -7165,7 +7867,7 @@ static int aft_global_chip_disable(sdla_t *card) static int aft_chip_configure(sdla_t *card, wandev_conf_t* conf) { - return aft_hwdev[card->wandev.card_type].aft_chip_config(card); + return aft_hwdev[card->wandev.card_type].aft_chip_config(card, conf); } static int aft_chip_unconfigure(sdla_t *card) @@ -7191,13 +7893,13 @@ static int aft_dev_configure(sdla_t *card, private_area_t *chan, wanif_conf_t* c /* Channel definition section. If not channels defined * return error */ if (chan->time_slot_map == 0){ - DEBUG_EVENT("%s: Invalid Channel Selection 0x%lX\n", + DEBUG_EVENT("%s: Invalid Channel Selection 0x%X\n", card->devname,chan->time_slot_map); return -EINVAL; } - DEBUG_EVENT("%s: Active Ch Map :0x%08lX\n", + DEBUG_EVENT("%s: Active Ch Map :0x%08X\n", card->devname,chan->time_slot_map); @@ -7237,7 +7939,7 @@ static void aft_tx_dma_voice_handler(unsigned long data, int wdt, int reset) private_area_t *chan = (private_area_t *)data; sdla_t *card = chan->card; u32 reg,dma_descr,dma_status; - aft_dma_chain_t *dma_chain; + wan_dma_descr_t *dma_chain; if (wan_test_and_set_bit(TX_HANDLER_BUSY,&chan->dma_status)){ DEBUG_EVENT("%s: SMP Critical in %s\n", @@ -7313,14 +8015,14 @@ static void aft_tx_dma_voice_handler(unsigned long data, int wdt, int reset) } } } - chan->if_stats.tx_errors++; + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //chan->if_stats.tx_errors++; } chan->opstats.Data_frames_Tx_count++; chan->opstats.Data_bytes_Tx_count+=wan_skb_len(dma_chain->skb); - chan->if_stats.tx_packets++; - chan->if_stats.tx_bytes+=wan_skb_len(dma_chain->skb); + WAN_NETIF_STATS_INC_TX_PACKETS(&chan->common); //chan->if_stats.tx_packets++; + WAN_NETIF_STATS_INC_TX_BYTES(&chan->common,wan_skb_len(dma_chain->skb)); //chan->if_stats.tx_bytes+=wan_skb_len(dma_chain->skb); wan_clear_bit(0,&dma_chain->init); @@ -7341,7 +8043,7 @@ static void aft_tx_dma_chain_handler(unsigned long data, int wdt, int reset) private_area_t *chan = (private_area_t *)data; sdla_t *card = chan->card; u32 reg,dma_descr; - aft_dma_chain_t *dma_chain; + wan_dma_descr_t *dma_chain; if (wan_test_and_set_bit(TX_HANDLER_BUSY,&chan->dma_status)){ DEBUG_EVENT("%s: SMP Critical in %s\n", @@ -7383,12 +8085,22 @@ static void aft_tx_dma_chain_handler(unsigned long data, int wdt, int reset) DEBUG_TEST("%s: TX DMA Handler Chain %d\n",chan->if_name,dma_chain->index); if (chan->hdlc_eng){ - if (dma_chain->skb){ + + if (dma_chain->skb == chan->tx_hdlc_rpt_skb) { + if (wan_skb_queue_len(&chan->wp_tx_hdlc_rpt_list) == 0) { + wan_skb_queue_tail(&chan->wp_tx_hdlc_rpt_list,dma_chain->skb); + dma_chain->skb=NULL; + } else { + /* Drop down to init where packet will freed */ + } + chan->tx_hdlc_rpt_skb=NULL; + + } else if (dma_chain->skb){ wan_skb_set_csum(dma_chain->skb, reg); wan_skb_queue_tail(&chan->wp_tx_complete_list,dma_chain->skb); dma_chain->skb=NULL; } - }else{ + } else { if (dma_chain->skb != chan->tx_idle_skb){ wan_skb_set_csum(dma_chain->skb, reg); @@ -7434,7 +8146,7 @@ static void aft_tx_dma_chain_handler(unsigned long data, int wdt, int reset) * aft_dma_chain_tx * */ -static int aft_dma_chain_tx(aft_dma_chain_t *dma_chain,private_area_t *chan, int intr,int fifo) +static int aft_dma_chain_tx(wan_dma_descr_t *dma_chain,private_area_t *chan, int intr,int fifo) { #define dma_descr dma_chain->dma_descr @@ -7449,8 +8161,9 @@ static int aft_dma_chain_tx(aft_dma_chain_t *dma_chain,private_area_t *chan, int dma_descr=(chan->logic_ch_num<<4) + (dma_ch_indx*AFT_DMA_INDEX_OFFSET) + AFT_PORT_REG(card,AFT_TX_DMA_HI_DESCR_BASE_REG); - DEBUG_DMA("%s:%d: chan logic ch=%ld chain=%d dma_descr=0x%x set!\n", - __FUNCTION__,__LINE__,chan->logic_ch_num,dma_ch_indx,dma_descr); + DEBUG_DMA("%s: %s:%s: LogicCh=%ld ChIndex=%d DmaDesc=0x%x set\n", + __FUNCTION__, card->devname, chan->if_name, + chan->logic_ch_num,dma_ch_indx,dma_descr); card->hw_iface.bus_read_4(card->hw,dma_descr,®); @@ -7501,8 +8214,9 @@ static int aft_dma_chain_tx(aft_dma_chain_t *dma_chain,private_area_t *chan, int len_align=1; } - DEBUG_DMA("%s: TXDMA_LO=0x%X PhyAddr=0x%X DmaDescr=0x%X Len=%i\n", - __FUNCTION__,reg,(int)dma_chain->dma_addr,dma_descr,len); + DEBUG_DMA("%s: %s:%s: TXDMA_LO=0x%X PhyAddr=0x%X DmaDescr=0x%X Len=%d\n", + __FUNCTION__,card->devname,chan->if_name, + reg,dma_chain->dma_addr,dma_descr,len); card->hw_iface.bus_write_4(card->hw,dma_descr,reg); @@ -7565,8 +8279,9 @@ static int aft_dma_chain_tx(aft_dma_chain_t *dma_chain,private_area_t *chan, int wan_set_bit(AFT_TXDMA_HI_DMA_CMD_BIT,®); } - DEBUG_DMA("%s: TXDMA_HI=0x%X DmaDescr=0x%X Len=%d Intr=%d\n", - __FUNCTION__,reg,dma_descr,len,intr); + DEBUG_DMA("%s:: %s:%s: TXDMA_HI=0x%X DmaDescr=0x%X Len=%d Intr=%d\n", + __FUNCTION__,card->devname,chan->if_name, + reg,dma_descr,len,intr); card->hw_iface.bus_write_4(card->hw,dma_descr,reg); @@ -7587,15 +8302,18 @@ static int aft_dma_chain_tx(aft_dma_chain_t *dma_chain,private_area_t *chan, int * aft_dma_chain_init * */ -static void aft_tx_dma_chain_init(private_area_t *chan, aft_dma_chain_t *dma_chain) +static void +aft_tx_dma_chain_init(private_area_t *chan, wan_dma_descr_t *dma_chain) { +#define card chan->card - if (dma_chain->dma_addr){ - chan->card->hw_iface.pci_unmap_dma(chan->card->hw, - dma_chain->dma_addr-dma_chain->dma_offset, - dma_chain->dma_map_len, - PCI_DMA_TODEVICE); - } + card->hw_iface.busdma_sync( card->hw, + dma_chain, + 1, 1, + SDLA_DMA_POSTWRITE); + card->hw_iface.busdma_unmap( card->hw, + dma_chain, + SDLA_DMA_POSTWRITE); if (dma_chain->skb){ if (!chan->hdlc_eng){ @@ -7612,34 +8330,29 @@ static void aft_tx_dma_chain_init(private_area_t *chan, aft_dma_chain_t *dma_cha dma_chain->skb=NULL; } } - - dma_chain->dma_addr=0; - dma_chain->dma_len=0; - dma_chain->dma_map_len=dma_chain->dma_len; - wan_clear_bit(0,&dma_chain->init); +#undef card } -static void aft_rx_dma_chain_init(private_area_t *chan, aft_dma_chain_t *dma_chain) +static void +aft_rx_dma_chain_init(private_area_t *chan, wan_dma_descr_t *dma_chain) { +#define card chan->card - if (dma_chain->dma_addr){ - chan->card->hw_iface.pci_unmap_dma(chan->card->hw, - dma_chain->dma_addr-dma_chain->dma_offset, - dma_chain->dma_map_len, - PCI_DMA_FROMDEVICE); - } + card->hw_iface.busdma_sync( card->hw, + dma_chain, + 1, 1, + SDLA_DMA_POSTREAD); + card->hw_iface.busdma_unmap( card->hw, + dma_chain, + SDLA_DMA_POSTREAD); if (dma_chain->skb){ aft_init_requeue_free_skb(chan,dma_chain->skb); - dma_chain->skb=NULL; + dma_chain->skb = NULL; } - - dma_chain->dma_addr=0; - dma_chain->dma_len=0; - dma_chain->dma_map_len=0; - wan_clear_bit(0,&dma_chain->init); +#undef card } @@ -7647,7 +8360,7 @@ static void aft_rx_dma_chain_init(private_area_t *chan, aft_dma_chain_t *dma_cha static int aft_dma_voice_tx(sdla_t *card, private_area_t *chan) { int err=0; - aft_dma_chain_t *dma_chain; + wan_dma_descr_t *dma_chain; u32 reg, dma_ram_desc; if (wan_test_and_set_bit(TX_DMA_BUSY,&chan->dma_status)){ @@ -7659,6 +8372,10 @@ static int aft_dma_voice_tx(sdla_t *card, private_area_t *chan) dma_chain = &chan->tx_dma_chain_table[0]; + DEBUG_DMA("%s: %s:%s:: Chain %d Used %ld\n", + __FUNCTION__,card->devname,chan->if_name, + dma_chain->index,dma_chain->init); + /* If the current DMA chain is in use,then * all chains are busy */ if (wan_test_and_set_bit(0,&dma_chain->init)){ @@ -7694,29 +8411,19 @@ static int aft_dma_voice_tx(sdla_t *card, private_area_t *chan) buf=wan_skb_put(dma_chain->skb,chan->mtu*2); memset(buf,chan->idle_flag,chan->mtu*2); - dma_chain->dma_addr = card->hw_iface.pci_map_dma(card->hw, - wan_skb_data(dma_chain->skb), - chan->dma_mru, - PCI_DMA_TODEVICE); - - if (dma_chain->dma_addr & AFT_TDMV_BUF_MASK) { - dma_chain->dma_offset = - AFT_TDMV_BUF_MASK - (dma_chain->dma_addr & AFT_TDMV_BUF_MASK) + 1; - - dma_chain->dma_virt = wan_skb_data(dma_chain->skb) + dma_chain->dma_offset; - dma_chain->dma_addr += dma_chain->dma_offset; - - } else { - dma_chain->dma_offset=0; - dma_chain->dma_virt = wan_skb_data(dma_chain->skb); - } - - dma_chain->dma_len = wan_skb_len(dma_chain->skb); - dma_chain->dma_map_len=chan->dma_mru; - + /* A-DMA */ + card->hw_iface.busdma_map( card->hw, + dma_chain, + wan_skb_data(dma_chain->skb), + wan_skb_len(dma_chain->skb), + chan->dma_mru, + SDLA_DMA_PREWRITE); + card->hw_iface.busdma_sync( card->hw, + dma_chain, + 1, 1, + SDLA_DMA_PREWRITE); } - dma_ram_desc=chan->logic_ch_num*4 + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); @@ -7733,7 +8440,7 @@ static int aft_dma_voice_tx(sdla_t *card, private_area_t *chan) /* Drop the tx packet here */ aft_tx_dma_chain_init(chan,dma_chain); - chan->if_stats.tx_errors++; + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //chan->if_stats.tx_errors++; err=-EINVAL; goto aft_dma_voice_tx_exit; } @@ -7751,7 +8458,7 @@ aft_dma_voice_tx_exit: static int aft_dma_tx (sdla_t *card,private_area_t *chan) { int err=0, intr=0, cnt=0; - aft_dma_chain_t *dma_chain; + wan_dma_descr_t *dma_chain; netskb_t *skb=NULL; if (chan->channelized_cfg && !chan->hdlc_eng){ @@ -7807,11 +8514,37 @@ static int aft_dma_tx (sdla_t *card,private_area_t *chan) break; } - ++chan->if_stats.tx_carrier_errors; - }else{ - wan_clear_bit(0,&dma_chain->init); - wan_clear_bit(TX_DMA_BUSY,&chan->dma_status); - break; + WAN_NETIF_STATS_INC_TX_CARRIER_ERRORS(&chan->common); + + } else { + if (chan->cfg.hdlc_repeat) { + /* Pull the latest repeat frame out of the + repeat queue */ + for (;;) { + skb=wan_skb_dequeue(&chan->wp_tx_hdlc_rpt_list); + if (!skb) { + break; + } + if (wan_skb_queue_len(&chan->wp_tx_hdlc_rpt_list)){ + wan_skb_free(skb); + } else { + break; + } + } + + if (skb) { + chan->tx_hdlc_rpt_skb=skb; + } else { + WAN_NETIF_STATS_INC_TX_CARRIER_ERRORS(&chan->common); + /* Pass throught to no skb condition */ + } + } + + if (!skb) { + wan_clear_bit(0,&dma_chain->init); + wan_clear_bit(TX_DMA_BUSY,&chan->dma_status); + break; + } } } @@ -7825,7 +8558,7 @@ static int aft_dma_tx (sdla_t *card,private_area_t *chan) } wan_skb_free(skb); aft_tx_dma_chain_init(chan,dma_chain); - chan->if_stats.tx_errors++; + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //chan->if_stats.tx_errors++; chan->opstats.Tx_Data_discard_lgth_err_count++; continue; } @@ -7840,23 +8573,25 @@ static int aft_dma_tx (sdla_t *card,private_area_t *chan) } wan_skb_free(skb); aft_tx_dma_chain_init(chan,dma_chain); - chan->if_stats.tx_errors++; + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //chan->if_stats.tx_errors++; chan->opstats.Tx_Data_discard_lgth_err_count++; continue; } dma_chain->skb=skb; - - dma_chain->dma_addr = card->hw_iface.pci_map_dma(card->hw, + + /* A-DMA */ + card->hw_iface.busdma_map( card->hw, + dma_chain, wan_skb_data(dma_chain->skb), wan_skb_len(dma_chain->skb), - PCI_DMA_TODEVICE); + wan_skb_len(dma_chain->skb), + SDLA_DMA_PREWRITE); + card->hw_iface.busdma_sync( card->hw, + dma_chain, + 1, chan->single_dma_chain, + SDLA_DMA_PREWRITE); - dma_chain->dma_len = wan_skb_len(dma_chain->skb); - dma_chain->dma_map_len=dma_chain->dma_len; - dma_chain->dma_offset=0; - - DEBUG_TEST("%s: DMA Chain %d: Cur=%d Pend=%d\n", chan->if_name,dma_chain->index, chan->tx_chain_indx,chan->tx_pending_chain_indx); @@ -7893,7 +8628,7 @@ static int aft_dma_tx (sdla_t *card,private_area_t *chan) /* Drop the tx packet here */ aft_tx_dma_chain_init(chan,dma_chain); - chan->if_stats.tx_errors++; + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //chan->if_stats.tx_errors++; break; } @@ -7924,7 +8659,7 @@ static int aft_dma_tx (sdla_t *card,private_area_t *chan) * **********************************************************************/ -static int aft_dma_chain_rx(aft_dma_chain_t *dma_chain, private_area_t *chan, int intr, int fifo) +static int aft_dma_chain_rx(wan_dma_descr_t *dma_chain, private_area_t *chan, int intr, int fifo) { #define dma_descr dma_chain->dma_descr #define reg dma_chain->reg @@ -7945,8 +8680,10 @@ static int aft_dma_chain_rx(aft_dma_chain_t *dma_chain, private_area_t *chan, in dma_descr=(chan->logic_ch_num<<4) + (dma_ch_indx*AFT_DMA_INDEX_OFFSET) + AFT_PORT_REG(card,AFT_RX_DMA_LO_DESCR_BASE_REG); - DEBUG_DMA("%s: RxDMA_LO(%ld) = 0x%X, DmaDescr=0x%X\n", - __FUNCTION__,chan->logic_ch_num,reg,dma_descr); + DEBUG_DMA("%s: %s:%s: RxDMA_LO(%ld) = 0x%X, PhyAddr:%X DmaDescr=0x%X (%p)\n", + __FUNCTION__,card->devname,chan->if_name, + chan->logic_ch_num,reg, + dma_chain->dma_addr, dma_descr,dma_chain); card->hw_iface.bus_write_4(card->hw,dma_descr,reg); @@ -7992,8 +8729,9 @@ static int aft_dma_chain_rx(aft_dma_chain_t *dma_chain, private_area_t *chan, in wan_set_bit(AFT_RXDMA_HI_DMA_CMD_BIT,®); } - DEBUG_DMA("%s: RXDMA_HI(%ld) = 0x%X, DmaDescr=0x%X\n", - __FUNCTION__,chan->logic_ch_num,reg,dma_descr); + DEBUG_DMA("%s: %s:%s: RXDMA_HI(%ld) = 0x%X, DmaDescr=0x%X\n", + __FUNCTION__,card->devname,chan->if_name, + chan->logic_ch_num,reg,dma_descr); card->hw_iface.bus_write_4(card->hw,dma_descr,reg); @@ -8010,7 +8748,7 @@ static int aft_dma_chain_rx(aft_dma_chain_t *dma_chain, private_area_t *chan, in static int aft_dma_voice_rx(sdla_t *card, private_area_t *chan) { int err=0; - aft_dma_chain_t *dma_chain; + wan_dma_descr_t *dma_chain; u32 reg, dma_ram_desc; if (wan_test_and_set_bit(RX_DMA_BUSY,&chan->dma_status)){ @@ -8021,6 +8759,9 @@ static int aft_dma_voice_rx(sdla_t *card, private_area_t *chan) dma_chain = &chan->rx_dma_chain_table[0]; + DEBUG_DMA("%s: %s:%s: Chain %d Used %ld\n", + __FUNCTION__,card->devname,chan->if_name, + dma_chain->index,dma_chain->init); /* If the current DMA chain is in use,then * all chains are busy */ @@ -8047,50 +8788,23 @@ static int aft_dma_voice_rx(sdla_t *card, private_area_t *chan) wan_skb_init(dma_chain->skb,16); wan_skb_trim(dma_chain->skb,0); - -#if defined(__LINUX__) - dma_chain->dma_addr = card->hw_iface.pci_map_dma(card->hw, - wan_skb_tail(dma_chain->skb), - chan->dma_mru, - PCI_DMA_FROMDEVICE); - - if (dma_chain->dma_addr & AFT_TDMV_BUF_MASK) { - dma_chain->dma_offset = - AFT_TDMV_BUF_MASK - (dma_chain->dma_addr & AFT_TDMV_BUF_MASK) + 1; - - dma_chain->dma_virt = wan_skb_tail(dma_chain->skb) + dma_chain->dma_offset; - dma_chain->dma_addr += dma_chain->dma_offset; - - } else { - dma_chain->dma_offset=0; - dma_chain->dma_virt = wan_skb_tail(dma_chain->skb); - } - - dma_chain->dma_len = chan->dma_mru-dma_chain->dma_offset; - dma_chain->dma_map_len=dma_chain->dma_len; - - DEBUG_TEST("%s: RXDMA PHY = 0x%08X VIRT = %p \n", + + /* A-DMA */ + card->hw_iface.busdma_map( + card->hw, + dma_chain, + wan_skb_tail(dma_chain->skb), + chan->dma_mru, + chan->dma_mru, + SDLA_DMA_PREREAD); + card->hw_iface.busdma_sync( + card->hw, + dma_chain, + MAX_AFT_DMA_CHAINS, chan->single_dma_chain, + SDLA_DMA_PREREAD); + DEBUG_DMA("%s: RXDMA PHY = 0x%08X VIRT = %p \n", chan->if_name, dma_chain->dma_addr,wan_skb_tail(dma_chain->skb)+dma_chain->dma_offset); -#else - dma_chain->dma_addr = - virt_to_phys(wan_skb_tail(dma_chain->skb)); - - if (dma_chain->dma_addr & AFT_TDMV_BUF_MASK) { - dma_chain->dma_offset = - AFT_TDMV_BUF_MASK - - (dma_chain->dma_addr & AFT_TDMV_BUF_MASK) + 1; - dma_chain->dma_virt = wan_skb_tail(dma_chain->skb) + dma_chain->dma_offset; - dma_chain->dma_addr = virt_to_phys(wan_skb_tail(dma_chain->dma_virt)); - } else { - dma_chain->dma_offset=0; - dma_chain->dma_virt = wan_skb_tail(dma_chain->skb); - } - - dma_chain->dma_len = chan->dma_mru; - dma_chain->dma_map_len=dma_chain->dma_len; - -#endif }else{ wan_skb_init(dma_chain->skb,16); wan_skb_trim(dma_chain->skb,0); @@ -8107,7 +8821,7 @@ static int aft_dma_voice_rx(sdla_t *card, private_area_t *chan) DEBUG_EVENT("%s: Rx dma chain %d overrun error: should never happen!\n", chan->if_name,dma_chain->index); aft_rx_dma_chain_init(chan,dma_chain); - chan->if_stats.rx_errors++; + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //chan->if_stats.rx_errors++; } aft_dma_single_chain_rx_exit: @@ -8120,11 +8834,10 @@ aft_dma_single_chain_rx_exit: static int aft_dma_rx(sdla_t *card, private_area_t *chan) { int err=0, intr=0; - aft_dma_chain_t *dma_chain; + wan_dma_descr_t *dma_chain; int cur_dma_ptr, i,max_dma_cnt,free_queue_len; u32 reg, dma_ram_desc; - if (chan->channelized_cfg && !chan->hdlc_eng){ return aft_dma_voice_rx(card,chan); } @@ -8161,9 +8874,8 @@ static int aft_dma_rx(sdla_t *card, private_area_t *chan) max_dma_cnt = free_queue_len; } - - DEBUG_TEST("%s: DMA RX: CBoardPtr=%d Driver=%d MaxDMA=%d\n", - card->devname,cur_dma_ptr,chan->rx_chain_indx,max_dma_cnt); + DEBUG_RX("%s: (line: %d) DMA RX: CBoardPtr=%d Driver=%d MaxDMA=%d\n", + card->devname, __LINE__, cur_dma_ptr,chan->rx_chain_indx,max_dma_cnt); for (i=0;iskb=wan_skb_dequeue(&chan->wp_rx_complete_list); if (dma_chain->skb) { - chan->if_stats.rx_dropped++; + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); //chan->if_stats.rx_dropped++; wan_skb_init(dma_chain->skb,16); wan_skb_trim(dma_chain->skb,0); }else{ @@ -8203,16 +8915,19 @@ static int aft_dma_rx(sdla_t *card, private_area_t *chan) } } - - dma_chain->dma_addr = card->hw_iface.pci_map_dma(card->hw, - wan_skb_tail(dma_chain->skb), - chan->dma_mru, - PCI_DMA_FROMDEVICE); - - dma_chain->dma_len = chan->dma_mru; - dma_chain->dma_map_len=dma_chain->dma_len; - dma_chain->dma_offset=0; + card->hw_iface.busdma_map( + card->hw, + dma_chain, + wan_skb_tail(dma_chain->skb), + chan->dma_mru, + chan->dma_mru, + SDLA_DMA_PREREAD); + card->hw_iface.busdma_sync( + card->hw, + dma_chain, + 1, chan->single_dma_chain, + SDLA_DMA_PREREAD); intr=0; if (!wan_test_bit(RX_INTR_PENDING,&chan->dma_chain_status)){ @@ -8246,7 +8961,7 @@ static int aft_dma_rx(sdla_t *card, private_area_t *chan) DEBUG_EVENT("%s: Rx dma chain %d overrun error: should never happen!\n", chan->if_name,dma_chain->index); aft_rx_dma_chain_init(chan,dma_chain); - chan->if_stats.rx_errors++; + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //chan->if_stats.rx_errors++; break; } @@ -8289,7 +9004,7 @@ static int aft_rx_dma_chain_handler(private_area_t *chan, int reset) sdla_t *card = chan->card; u32 reg,dma_descr; wp_rx_element_t *rx_el; - aft_dma_chain_t *dma_chain; + wan_dma_descr_t *dma_chain; int i,max_dma_cnt, cur_dma_ptr; int rx_data_available=0; u32 dma_ram_desc; @@ -8307,8 +9022,8 @@ static int aft_rx_dma_chain_handler(private_area_t *chan, int reset) max_dma_cnt = MAX_AFT_DMA_CHAINS; - DEBUG_TEST("%s: DMA RX: CBoardPtr=%d Driver=%d MaxDMA=%d\n", - card->devname, + DEBUG_RX("%s: (line: %d) DMA RX: CBoardPtr=%d Driver=%d MaxDMA=%d\n", + card->devname, __LINE__, cur_dma_ptr, chan->rx_chain_indx,max_dma_cnt); @@ -8318,7 +9033,7 @@ static int aft_rx_dma_chain_handler(private_area_t *chan, int reset) for (i=0;irx_dma_chain_table[chan->rx_pending_chain_indx]; if (i>0 && chan->rx_pending_chain_indx == cur_dma_ptr){ @@ -8349,19 +9064,18 @@ static int aft_rx_dma_chain_handler(private_area_t *chan, int reset) * is in process of being transmitted, thus * all are busy */ if (wan_test_bit(AFT_RXDMA_HI_GO_BIT,®)){ - if (wan_test_bit(WP_FIFO_ERROR_BIT, &chan->pkt_error)){ break; } #if 0 if (chan->single_dma_chain){ - DEBUG_EVENT("%s: CRITICAL (%s) Pending chain %d Go bit still set!\n", - chan->if_name,__FUNCTION__,dma_chain->index); - ++chan->if_stats.rx_errors; + DEBUG_EVENT("%s: CRITICAL (%s) Pending chain %d Go bit still set!\n", + chan->if_name,__FUNCTION__,dma_chain->index); + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //++chan->if_stats.rx_errors; }else{ - DEBUG_TEST("%s: Warning (%s) Pending chain %d Go bit still set!\n", - chan->if_name,__FUNCTION__,dma_chain->index); + DEBUG_TEST("%s: Warning (%s) Pending chain %d Go bit still set!\n", + chan->if_name,__FUNCTION__,dma_chain->index); } #endif break; @@ -8371,11 +9085,6 @@ static int aft_rx_dma_chain_handler(private_area_t *chan, int reset) wan_clear_bit(RX_INTR_PENDING,&chan->dma_chain_status); } - card->hw_iface.pci_unmap_dma(card->hw, - dma_chain->dma_addr-dma_chain->dma_offset, - dma_chain->dma_map_len, - PCI_DMA_FROMDEVICE); - if (sizeof(wp_rx_element_t) > wan_skb_headroom(dma_chain->skb)){ if (WAN_NET_RATELIMIT()){ DEBUG_EVENT("%s: Rx error: rx_el=%u > max head room=%u\n", @@ -8385,7 +9094,7 @@ static int aft_rx_dma_chain_handler(private_area_t *chan, int reset) } aft_init_requeue_free_skb(chan, dma_chain->skb); - ++chan->if_stats.rx_errors; + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //++chan->if_stats.rx_errors; goto rx_hndlr_skip_rx; }else{ rx_el=(wp_rx_element_t *)wan_skb_push(dma_chain->skb, @@ -8393,7 +9102,7 @@ static int aft_rx_dma_chain_handler(private_area_t *chan, int reset) memset(rx_el,0,sizeof(wp_rx_element_t)); } #if 0 - chan->if_stats.rx_frame_errors++; + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; #endif /* Reading Rx DMA descriptor information */ @@ -8408,32 +9117,45 @@ static int aft_rx_dma_chain_handler(private_area_t *chan, int reset) card->hw_iface.bus_read_4(card->hw,dma_descr, &rx_el->reg); + /* New for FreeBSD/Solaris */ + rx_el->len=rx_el->reg&AFT_RXDMA_HI_DMA_LENGTH_MASK; + if (chan->hdlc_eng){ + /* In HDLC mode, calculate rx length based + * on alignment value, received from DMA */ + rx_el->len=((((chan->dma_mru>>2)-1)-rx_el->len)<<2) - (~(rx_el->align)&AFT_RXDMA_LO_ALIGN_MASK); + }else{ + /* In Transparent mode, our RX buffer will always be + * aligned to the 32bit (word) boundary, because + * the RX buffers are all of equal length */ + rx_el->len=(((chan->mru>>2)-rx_el->len)<<2) - (~(0x03)&AFT_RXDMA_LO_ALIGN_MASK); + } + rx_el->pkt_error= dma_chain->pkt_error; rx_el->dma_addr = dma_chain->dma_addr; - /* Check for crc/abort here to prevent crc/abort storm */ - if (aft_decode_dma_status(card,chan,rx_el->reg)) { - aft_init_requeue_free_skb(chan, dma_chain->skb); - ++chan->if_stats.rx_errors; - card->u.aft.rx_errors_hist++; - goto rx_hndlr_skip_rx; - } + /* A-DMA */ + card->hw_iface.busdma_sync( card->hw, + dma_chain, + 1, chan->single_dma_chain, + SDLA_DMA_POSTREAD); + dma_chain->dma_len = rx_el->len; /* update real dma len*/ + card->hw_iface.busdma_unmap( card->hw, + dma_chain, + SDLA_DMA_POSTREAD); +#if defined(__FreeBSD__) + wan_skb_put(dma_chain->skb, rx_el->len); +#endif wan_skb_queue_tail(&chan->wp_rx_complete_list,dma_chain->skb); rx_data_available=1; - DEBUG_TEST("%s: RxInt Pending chain %d Rxlist=%d LO:0x%X HI:0x%X Data=0x%X Len=%d!\n", + DEBUG_TEST("%s: RxInt Pending chain %d Rxlist=%d LO:0x%X HI:0x%X Len=%i!\n", chan->if_name,dma_chain->index, wan_skb_queue_len(&chan->wp_rx_complete_list), - rx_el->align,rx_el->reg, - (*(unsigned char*)wan_skb_data(dma_chain->skb)), - wan_skb_len(dma_chain->skb)); + rx_el->align,rx_el->reg, rx_el->len); rx_hndlr_skip_rx: dma_chain->skb=NULL; - dma_chain->dma_addr=0; - dma_chain->dma_len=0; - dma_chain->dma_map_len=dma_chain->dma_len; dma_chain->pkt_error=0; wan_clear_bit(0,&dma_chain->init); @@ -8452,7 +9174,6 @@ rx_hndlr_skip_rx: aft_dma_rx(card,chan); - if (wan_skb_queue_len(&chan->wp_rx_complete_list)){ DEBUG_TEST("%s: Rx Queued list triggering\n",chan->if_name); WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); @@ -8503,6 +9224,10 @@ static void aft_init_tx_rx_dma_descr(private_area_t *chan) dma_cnt=1; } + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + return; + } + for (i=0;ilogic_ch_num<<4) + @@ -8528,7 +9253,7 @@ static void aft_free_rx_complete_list(private_area_t *chan) while((skb=wan_skb_dequeue(&chan->wp_rx_complete_list)) != NULL){ DEBUG_TEST("%s: aft_free_rx_complete_list dropped\n", chan->if_name); - chan->if_stats.rx_dropped++; + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); //chan->if_stats.rx_dropped++; aft_init_requeue_free_skb(chan, skb); } } @@ -8538,7 +9263,7 @@ static void aft_rx_cur_go_test(private_area_t *chan) #if 0 u32 reg,cur_dma_ptr; sdla_t *card=chan->card; - aft_dma_chain_t *dma_chain; + wan_dma_descr_t *dma_chain; u32 dma_descr; int i; u32 dma_ram_desc; @@ -8570,7 +9295,7 @@ static void aft_list_descriptors(private_area_t *chan) { u32 reg,cur_dma_ptr,lo_reg; sdla_t *card=chan->card; - aft_dma_chain_t *dma_chain; + wan_dma_descr_t *dma_chain; u32 dma_descr; int i; u32 dma_ram_desc; @@ -8624,7 +9349,7 @@ static void aft_list_tx_descriptors(private_area_t *chan) { u32 reg,cur_dma_ptr,lo_reg; sdla_t *card=chan->card; - aft_dma_chain_t *dma_chain; + wan_dma_descr_t *dma_chain; u32 dma_descr; int i; u32 dma_ram_desc; @@ -8718,7 +9443,7 @@ static void aft_free_rx_descriptors(private_area_t *chan) { u32 reg; sdla_t *card=chan->card; - aft_dma_chain_t *dma_chain; + wan_dma_descr_t *dma_chain; u32 dma_descr; int i; unsigned int dma_cnt=MAX_AFT_DMA_CHAINS; @@ -8726,6 +9451,10 @@ static void aft_free_rx_descriptors(private_area_t *chan) if (chan->single_dma_chain){ dma_cnt=1; } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + return; + } for (i=0;ihw_iface.bus_write_4(card->hw,dma_descr,reg); - card->hw_iface.pci_unmap_dma(card->hw, - dma_chain->dma_addr-dma_chain->dma_offset, - dma_chain->dma_map_len, - PCI_DMA_FROMDEVICE); + card->hw_iface.busdma_sync( card->hw, + dma_chain, + 1, chan->single_dma_chain, + SDLA_DMA_POSTREAD); + card->hw_iface.busdma_unmap( card->hw, + dma_chain, + SDLA_DMA_POSTREAD); if (dma_chain->skb){ aft_init_requeue_free_skb(chan, dma_chain->skb); } dma_chain->skb=NULL; - dma_chain->dma_addr=0; - dma_chain->dma_len=0; - dma_chain->dma_map_len=dma_chain->dma_len; dma_chain->pkt_error=0; wan_clear_bit(0,&dma_chain->init); } @@ -8806,7 +9535,7 @@ static void aft_free_tx_descriptors(private_area_t *chan) { u32 reg,dma_descr; sdla_t *card=chan->card; - aft_dma_chain_t *dma_chain; + wan_dma_descr_t *dma_chain; int i; void *skb; unsigned int dma_cnt=MAX_AFT_DMA_CHAINS; @@ -8815,6 +9544,10 @@ static void aft_free_tx_descriptors(private_area_t *chan) dma_cnt=1; } + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + return; + } + DEBUG_TEST("%s:%s: Tx: Freeing Descripors\n",card->devname,chan->if_name); for (i=0;idevname,card->u.aft.top_logic_ch); - + reg=0; card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),®); - aft_dmactrl_set_max_logic_ch(®,card->u.aft.top_logic_ch); - card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),reg); + max_logic_ch = aft_dmactrl_get_max_logic_ch(reg); + + DEBUG_TEST("%s: Maximum Logic Ch (current %i) set to %d \n", + card->devname, + max_logic_ch, + card->u.aft.top_logic_ch); + + if (card->u.aft.top_logic_ch > max_logic_ch) { + aft_dmactrl_set_max_logic_ch(®,card->u.aft.top_logic_ch); + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),reg); + } } static int aft_tslot_sync_ctrl(sdla_t *card, private_area_t *chan, int mode) @@ -9062,8 +9803,12 @@ static void aft_port_task (struct work_struct *work) static void aft_port_task (void * card_ptr, int arg) #endif { -#if defined(__LINUX__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +#if defined(__LINUX__) +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) sdla_t *card = (sdla_t *)container_of(work, sdla_t, u.aft.port_task); +# else + sdla_t *card = (sdla_t *)card_ptr; +# endif #else sdla_t *card = (sdla_t *)card_ptr; #endif @@ -9073,7 +9818,7 @@ static void aft_port_task (void * card_ptr, int arg) return; } - DEBUG_TEST("%s: PORT TASK: 0x%X\n", card->devname,card->u.aft.port_task_cmd); + DEBUG_56K("%s: PORT TASK: 0x%X\n", card->devname,card->u.aft.port_task_cmd); #ifdef AFT_IRQ_STAT_DEBUG card->wandev.stats.rx_missed_errors++; @@ -9099,12 +9844,15 @@ static void aft_port_task (void * card_ptr, int arg) aft_fe_intr_ctrl(card, 0); if (card->wandev.fe_iface.polling){ wan_smp_flag_t smp_irq_flags; - int err = 0; - err = card->wandev.fe_iface.polling(&card->fe); - + int delay; + wan_spin_lock_irq(&card->wandev.lock,&smp_irq_flags); + delay = card->wandev.fe_iface.polling(&card->fe); handle_front_end_state(card); wan_spin_unlock_irq(&card->wandev.lock,&smp_irq_flags); + if (delay){ + card->wandev.fe_iface.add_timer(&card->fe, delay); + } } wan_clear_bit(AFT_FE_POLL,&card->u.aft.port_task_cmd); aft_fe_intr_ctrl(card, 1); @@ -9144,40 +9892,66 @@ static void aft_port_task (void * card_ptr, int arg) if (wan_test_bit(AFT_FE_EC_POLL,&card->u.aft.port_task_cmd)){ DEBUG_TEST("%s: PORT TASK: FE EC INTR\n", card->devname); - if (card->wandev.ec_dev){ - card->hw_iface.hw_ec_lock(card->hw,&smp_flags); - wanpipe_ec_poll(card->wandev.ec_dev, card); - wan_clear_bit(AFT_FE_EC_POLL,&card->u.aft.port_task_cmd); - card->hw_iface.hw_ec_unlock(card->hw,&smp_flags); + int pending = 0; + pending = wanpipe_ec_poll(card->wandev.ec_dev, card); + /* Aug 10, 2007 + ** If EC poll return 1 (pending), re-schedule port_task again + ** (more dtmf events are available) */ + if (pending == 1){ + WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); + }else{ + wan_clear_bit(AFT_FE_EC_POLL,&card->u.aft.port_task_cmd); + } } } #endif - if (wan_test_bit(AFT_FE_RESTART,&card->u.aft.port_task_cmd)){ - wan_clear_bit(AFT_FE_RESTART,&card->u.aft.port_task_cmd); - if (card->fe.fe_status == FE_CONNECTED) { - DEBUG_EVENT("%s: WAN IRQ Restart\n", - card->devname); + wan_clear_bit(AFT_FE_RESTART,&card->u.aft.port_task_cmd); + + if (IS_BRI_CARD(card)) { + + DEBUG_EVENT("%s: BRI IRQ Restart\n", + card->devname); + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); - card->fe.fe_status = FE_DISCONNECTED; - handle_front_end_state(card); - card->fe.fe_status = FE_CONNECTED; - handle_front_end_state(card); + wan_clear_bit(0,&card->u.aft.comm_enabled); + enable_data_error_intr(card); wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); - } - } + + } else if (card->fe.fe_status == FE_CONNECTED) { + + DEBUG_EVENT("%s: TDM IRQ Restart\n", + card->devname); + + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); + card->fe.fe_status = FE_DISCONNECTED; + handle_front_end_state(card); + + /* BRI has special behaviour, we need to make sure + * that restart will trigger interrupts */ + wan_clear_bit(0,&card->u.aft.comm_enabled); + + card->fe.fe_status = FE_CONNECTED; + handle_front_end_state(card); + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + } + } + #if defined(AFT_RTP_SUPPORT) if (wan_test_bit(AFT_RTP_TAP_Q,&card->u.aft.port_task_cmd)){ netskb_t *skb; wan_clear_bit(AFT_FE_RESTART,&card->u.aft.port_task_cmd); while ((skb=wan_skb_dequeue(&card->u.aft.rtp_tap_list))) { - dev_queue_xmit(skb); + dev_queue_xmit(skb); } } #endif + + + return; } void __aft_fe_intr_ctrl(sdla_t *card, int status) @@ -9225,6 +9999,26 @@ static void aft_data_mux_get_cfg(sdla_t *card) } +static int aft_hdlc_repeat_mangle(sdla_t *card,private_area_t *chan, netskb_t *skb, netskb_t **rskb) +{ + unsigned char *buf; + api_tx_hdr_t *tx_hdr = (api_tx_hdr_t *)wan_skb_data(skb); + + if (tx_hdr->wp_api_tx_hdr_hdlc_rpt_len == 0 || tx_hdr->wp_api_tx_hdr_hdlc_rpt_len > 8) { + return -1; + } + + *rskb=wan_skb_alloc(128); + if (!rskb) { + return -1; + } + + buf=wan_skb_put(*rskb,tx_hdr->wp_api_tx_hdr_hdlc_rpt_len); + memcpy(buf,tx_hdr->wp_api_tx_hdr_hdlc_rpt_data,tx_hdr->wp_api_tx_hdr_hdlc_rpt_len); + wan_skb_pull(skb,sizeof(api_tx_hdr_t)); + + return 0; +} static int aft_ss7_tx_mangle(sdla_t *card,private_area_t *chan, netskb_t *skb) { @@ -9259,7 +10053,7 @@ static int aft_ss7_tx_mangle(sdla_t *card,private_area_t *chan, netskb_t *skb) len+=4; } - if (tx_hdr->u.ss7.type == WANOPT_SS7_FISU){ + if (tx_hdr->hdr_u.ss7.type == WANOPT_SS7_FISU){ if (chan->cfg.ss7_mode == WANOPT_SS7_MODE_4096){ ss7_len=WANOPT_SS7_FISU_4096_SZ; }else{ @@ -9271,7 +10065,7 @@ static int aft_ss7_tx_mangle(sdla_t *card,private_area_t *chan, netskb_t *skb) wan_set_bit(AFT_SS7_CTRL_TYPE_BIT,&ss7_ctrl); } - if (tx_hdr->u.ss7.force_tx){ + if (tx_hdr->hdr_u.ss7.force_tx){ wan_set_bit(AFT_SS7_CTRL_FORCE_BIT,&ss7_ctrl); }else{ wan_clear_bit(AFT_SS7_CTRL_FORCE_BIT,&ss7_ctrl); @@ -9279,11 +10073,11 @@ static int aft_ss7_tx_mangle(sdla_t *card,private_area_t *chan, netskb_t *skb) DEBUG_TEST("%s: SS7 DATA = 0x%X 0x%X 0x%X\n", chan->if_name, - tx_hdr->u.ss7.data[0], - tx_hdr->u.ss7.data[1], - tx_hdr->u.ss7.data[2]); + tx_hdr->hdr_u.ss7.data[0], + tx_hdr->hdr_u.ss7.data[1], + tx_hdr->hdr_u.ss7.data[2]); - memcpy(&chan->tx_ss7_realign_buf[len],tx_hdr->u.ss7.data,ss7_len); + memcpy(&chan->tx_ss7_realign_buf[len],tx_hdr->hdr_u.ss7.data,ss7_len); len+=ss7_len; @@ -9451,7 +10245,7 @@ static int aft_tdmv_free(sdla_t *card) static int aft_tdmv_if_init(sdla_t *card, private_area_t *chan, wanif_conf_t *conf) { - + if (!chan->channelized_cfg){ return 0; } @@ -9479,7 +10273,7 @@ static int aft_tdmv_if_init(sdla_t *card, private_area_t *chan, wanif_conf_t *co aft_hwdev[card->wandev.card_type].aft_fifo_adjust(card,AFT_TDMV_FIFO_LEVEL); - if (chan->common.usedby == TDM_VOICE) { + if (chan->common.usedby == TDM_VOICE) { #ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE WAN_TDMV_CALL(check_mtu, (card, conf->active_ch, &chan->mtu), err); if (err){ @@ -9488,7 +10282,7 @@ static int aft_tdmv_if_init(sdla_t *card, private_area_t *chan, wanif_conf_t *co } #endif } - + if (chan->common.usedby == TDM_VOICE_API) { switch (chan->mtu) { case 8: @@ -9496,14 +10290,14 @@ static int aft_tdmv_if_init(sdla_t *card, private_area_t *chan, wanif_conf_t *co break; case 40: case 80: - if (!wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { + if (!wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { /* If Global TDM Feature is not enable then 40 and 80 bytes TDM are not available */ - chan->mtu=16; + chan->mtu=16; } - break; + break; default: - chan->mtu=16; + chan->mtu=16; break; } } @@ -9526,6 +10320,7 @@ static int aft_tdmv_if_init(sdla_t *card, private_area_t *chan, wanif_conf_t *co chan->cfg.data_mux=0; } + #ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE if (chan->tdmv_zaptel_cfg){ int channel; @@ -9538,12 +10333,20 @@ static int aft_tdmv_if_init(sdla_t *card, private_area_t *chan, wanif_conf_t *co conf->active_ch=conf->active_ch>>1; } + if(IS_BRI_CARD(card)){ + if(chan->dchan_time_slot >= 0){ + conf->active_ch = 0x4<<(WAN_FE_LINENO(&card->fe)*2); + /* For the d-chan MUST set ONLY bit 2!! */ + } + } + WAN_TDMV_CALL(reg, (card, &conf->tdmv, conf->active_ch, conf->hwec.enable, chan->common.dev), channel); + if (channel < 0){ DEBUG_EVENT("%s: Error: Failed to register TDMV channel!\n", chan->if_name); @@ -9577,9 +10380,7 @@ static int aft_tdmv_if_init(sdla_t *card, private_area_t *chan, wanif_conf_t *co } } #endif - return 0; - } @@ -9609,7 +10410,7 @@ static int aft_tdmv_if_free(sdla_t *card, private_area_t *chan) static int gtmp_cnt=0; static void aft_set_channel(sdla_t *card, int ch) { - aft_dma_chain_t *tx_dma_chain; + wan_dma_descr_t *tx_dma_chain; u8 *buf; private_area_t *chan=(private_area_t*)card->u.aft.dev_to_ch_map[ch]; @@ -9644,7 +10445,7 @@ static int aft_voice_span_rx_tx(sdla_t *card, int rotate) if (rotate) { WAN_TDMV_CALL(buf_rotate, (card,AFT_TDMV_CIRC_BUF,AFT_TDMV_BUF_MASK), err); - } + } if (!card->wandev.ec_enable || card->wandev.ec_enable_map == 0){ WAN_TDMV_CALL(ec_span, (card), err); @@ -9668,18 +10469,22 @@ static int aft_voice_span_rx_tx(sdla_t *card, int rotate) } #endif + static int aft_dma_rx_tdmv(sdla_t *card, private_area_t *chan) { int err; u32 rx_offset=0; u32 tx_offset=0; + + wan_dma_descr_t *tx_dma_chain; + wan_dma_descr_t *rx_dma_chain; + u8 *txbuf, *rxbuf; - aft_dma_chain_t *tx_dma_chain; - aft_dma_chain_t *rx_dma_chain; - tx_dma_chain = &chan->tx_dma_chain_table[0]; - rx_dma_chain = &chan->rx_dma_chain_table[0]; + rx_dma_chain = &chan->rx_dma_chain_table[0]; + + if (!tx_dma_chain || !rx_dma_chain){ DEBUG_EVENT("%s: %s:%d ASSERT ERROR TxDma=%p RxDma=%p\n", @@ -9695,19 +10500,20 @@ static int aft_dma_rx_tdmv(sdla_t *card, private_area_t *chan) return -EINVAL; } + rxbuf = (unsigned char*)rx_dma_chain->dma_virt+rx_offset; txbuf = (unsigned char*)tx_dma_chain->dma_virt+tx_offset; - if (wan_test_bit(AFT_TDM_RING_BUF,&card->u.aft.chip_cfg_status)) { + rx_offset= AFT_TDMV_CIRC_BUF * card->u.aft.tdm_rx_dma_toggle; tx_offset= AFT_TDMV_CIRC_BUF * card->u.aft.tdm_tx_dma_toggle; - + rxbuf = (unsigned char*)rx_dma_chain->dma_virt+rx_offset; txbuf = (unsigned char*)tx_dma_chain->dma_virt+tx_offset; } else if (wan_test_bit(AFT_TDM_SW_RING_BUF,&card->u.aft.chip_cfg_status)) { - + chan->swring.rx_toggle = (chan->swring.rx_toggle + 1) % AFT_DMA_RING_MAX; memcpy(chan->swring.rbuf[chan->swring.rx_toggle].rxdata, rxbuf, @@ -9719,11 +10525,12 @@ static int aft_dma_rx_tdmv(sdla_t *card, private_area_t *chan) chan->mtu); chan->swring.tx_toggle = (chan->swring.tx_toggle + 1) % AFT_DMA_RING_MAX; txbuf = chan->swring.rbuf[chan->swring.tx_toggle].txdata; - } + + } + err=0; - #if 0 /*Measure the round trip delay*/ @@ -9748,26 +10555,88 @@ static int aft_dma_rx_tdmv(sdla_t *card, private_area_t *chan) #ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE if (card->wan_tdmv.sc){ +#if 0 +defined(AFT_TDMV_BH_ENABLE) + wan_dma_descr_t *tx_bh_dma_chain = &chan->tx_dma_chain_table[1]; + wan_dma_descr_t *rx_bh_dma_chain = &chan->rx_dma_chain_table[1]; + + if (!rx_bh_dma_chain->skb){ + rx_bh_dma_chain->skb=wan_skb_dequeue(&chan->wp_rx_free_list); + if (!rx_bh_dma_chain->skb){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: Critical TDM BH no free skb\n", + chan->if_name); + goto aft_tdm_bh_skip; + } + } + wan_skb_init(rx_bh_dma_chain->skb,16); + wan_skb_trim(rx_bh_dma_chain->skb,0); + } + + if (!tx_bh_dma_chain->skb){ + tx_bh_dma_chain->skb=wan_skb_dequeue(&chan->wp_rx_free_list); + if (!tx_bh_dma_chain->skb){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: Critical TDM BH no free skb\n", + chan->if_name); + goto aft_tdm_bh_skip; + } + } + wan_skb_init(tx_bh_dma_chain->skb,16); + wan_skb_trim(tx_bh_dma_chain->skb,0); + } + + memcpy(wan_skb_data(rx_bh_dma_chain->skb), + wan_skb_data(rx_dma_chain->skb),8); + + memcpy(wan_skb_data(tx_dma_chain->skb), + wan_skb_data(tx_bh_dma_chain->skb),8); + + rx_dma_chain=rx_bh_dma_chain; + tx_dma_chain=tx_bh_dma_chain; +aft_tdm_bh_skip: +#endif + DEBUG_TEST ("%s: Calling Rx Chan=%i TdmvChan=%i\n", card->devname,chan->logic_ch_num, chan->tdmv_chan); - if (card->wandev.rtp_len && card->wandev.rtp_tap) { card->wandev.rtp_tap(card, - IS_E1_CARD(card) ? chan->first_time_slot-1 : - chan->first_time_slot, + IS_T1_CARD(card) ? chan->first_time_slot : + chan->first_time_slot-1, rxbuf, txbuf, chan->mtu); } +#if 1 WAN_TDMV_CALL(rx_chan, (&card->wan_tdmv,chan->tdmv_chan, rxbuf, txbuf), err); - +#else +#warning "NCDEBUG rx_chan disabled irq" +#endif + +#if 0 + if (((u8*)(rx_dma_chain->dma_virt+offset))[0] != 0xFF && + ((u8*)(rx_dma_chain->dma_virt+offset))[0] != 0x7F && + tx_debug_cnt < 100){ + DEBUG_EVENT("%s: %02X %02X %02X %02X %02X %02X %02X %02X\n", + card->devname, + ((u8*)(rx_dma_chain->dma_virt+offset))[0], + ((u8*)(rx_dma_chain->dma_virt+offset))[1], + ((u8*)(rx_dma_chain->dma_virt+offset))[2], + ((u8*)(rx_dma_chain->dma_virt+offset))[3], + ((u8*)(rx_dma_chain->dma_virt+offset))[4], + ((u8*)(rx_dma_chain->dma_virt+offset))[5], + ((u8*)(rx_dma_chain->dma_virt+offset))[6], + ((u8*)(rx_dma_chain->dma_virt+offset))[7]); + tx_debug_cnt++; + } +#endif }else{ return 1; } @@ -9779,12 +10648,11 @@ static int aft_dma_rx_tdmv(sdla_t *card, private_area_t *chan) if (card->wandev.fe_iface.watchdog){ err = card->wandev.fe_iface.watchdog(&card->fe); } - + wanpipe_tdm_api_rx_tx(&chan->wp_tdm_api_dev, rxbuf, txbuf, chan->mtu); - #endif } @@ -9796,7 +10664,26 @@ static int aft_dma_rx_tdmv(sdla_t *card, private_area_t *chan) if (chan->tdmv_zaptel_cfg){ DEBUG_TEST ("%s: Calling Master Rx Tx Chan=%i\n", card->devname,chan->logic_ch_num); +#if 0 +defined(AFT_TDMV_BH_ENABLE) +#warning "AFT A104: TDM Driver compiled in BH mode!" + + if (WAN_TASKLET_RUNNING((&chan->common.bh_task))){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: Critical Error: TDMV BH Overrun!\n", + card->devname); + } + } + + WAN_WP_TASKLET_SCHEDULE_PER_CPU((&chan->common.bh_task), + card->tdmv_conf.span_no); + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),®); + wan_set_bit(AFT_DMACTRL_TDMV_RX_TOGGLE,®); + wan_set_bit(AFT_DMACTRL_TDMV_TX_TOGGLE,®); + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),reg); + +#else if (wan_test_bit(AFT_TDM_SW_RING_BUF,&card->u.aft.chip_cfg_status)) { if (!wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { @@ -9807,9 +10694,33 @@ static int aft_dma_rx_tdmv(sdla_t *card, private_area_t *chan) } } +#if 1 + card->hw_iface.busdma_sync( + card->hw, + &chan->tx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS, + chan->single_dma_chain, + SDLA_DMA_POSTREAD); + WAN_TDMV_CALL(rx_tx_span, (card), err); - + card->hw_iface.busdma_sync( + card->hw, + &chan->tx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS, + chan->single_dma_chain, + SDLA_DMA_PREWRITE); + card->hw_iface.busdma_sync( + card->hw, + &chan->rx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS, + chan->single_dma_chain, + SDLA_DMA_PREREAD); + +#else +#warning "NCDEBUG: rx_tx_span disabled irq" +#endif + if (!wan_test_bit(AFT_TDM_SW_RING_BUF,&card->u.aft.chip_cfg_status) && !wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),®); @@ -9817,7 +10728,7 @@ static int aft_dma_rx_tdmv(sdla_t *card, private_area_t *chan) wan_set_bit(AFT_DMACTRL_TDMV_TX_TOGGLE,®); card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),reg); } - + if (card->wan_tdmv.sc){ WAN_TDMV_CALL(is_rbsbits, (&card->wan_tdmv), err); if (err == 1){ @@ -9825,11 +10736,16 @@ static int aft_dma_rx_tdmv(sdla_t *card, private_area_t *chan) WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); } } - } else { +#endif + }else{ #else if (!chan->tdmv_zaptel_cfg){ #endif + if (card->wandev.fe_iface.watchdog) { + err = card->wandev.fe_iface.watchdog(&card->fe); + } + if (!wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),®); wan_set_bit(AFT_DMACTRL_TDMV_RX_TOGGLE,®); @@ -9842,15 +10758,17 @@ static int aft_dma_rx_tdmv(sdla_t *card, private_area_t *chan) card->devname,chan->logic_ch_num); } - chan->opstats.Data_frames_Rx_count++; - chan->opstats.Data_bytes_Rx_count+=chan->mru; - chan->opstats.Data_frames_Tx_count++; - chan->opstats.Data_bytes_Tx_count+=chan->mtu; - chan->if_stats.rx_packets++; - chan->if_stats.rx_bytes += chan->mru; - chan->if_stats.tx_packets++; - chan->if_stats.tx_bytes += chan->mtu; - + if (card->wandev.state == WAN_CONNECTED) { + chan->opstats.Data_frames_Rx_count++; + chan->opstats.Data_bytes_Rx_count+=chan->mru; + chan->opstats.Data_frames_Tx_count++; + chan->opstats.Data_bytes_Tx_count+=chan->mtu; + WAN_NETIF_STATS_INC_RX_PACKETS(&chan->common); //chan->if_stats.rx_packets++; + WAN_NETIF_STATS_INC_RX_BYTES(&chan->common,chan->mru); //chan->if_stats.rx_bytes += chan->mru; + WAN_NETIF_STATS_INC_TX_PACKETS(&chan->common); //chan->if_stats.tx_packets++; + WAN_NETIF_STATS_INC_TX_BYTES(&chan->common,chan->mtu); //chan->if_stats.tx_bytes += chan->mtu; + } + return 0; } @@ -10353,7 +11271,7 @@ static void wp_tdmv_api_chan_rx_tx(sdla_t *card, if (!card->u.aft.tdmv_api_rx){ card->u.aft.tdmv_api_rx=wan_skb_alloc(card->u.aft.tdmv_mtu); if (!card->u.aft.tdmv_api_rx){ - ++chan->if_stats.rx_errors; + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //++chan->if_stats.rx_errors; goto wp_tdmv_api_rx_tx_chan_skip_rx; } } @@ -10361,13 +11279,13 @@ static void wp_tdmv_api_chan_rx_tx(sdla_t *card, if (wan_skb_len(card->u.aft.tdmv_api_rx) > (card->u.aft.tdmv_mtu-chan->mru)){ /* CRITICAL ERROR: We cannot fit the all timeslots into this * packet */ - ++chan->if_stats.rx_errors; + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //++chan->if_stats.rx_errors; goto wp_tdmv_api_rx_tx_chan_skip_rx; } buf=wan_skb_put(card->u.aft.tdmv_api_rx, chan->mru); memcpy(buf,rxdata,chan->mru); - ++chan->if_stats.rx_dropped; + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); //++chan->if_stats.rx_dropped; wp_tdmv_api_rx_tx_chan_skip_rx: @@ -10375,7 +11293,7 @@ wp_tdmv_api_rx_tx_chan_skip_rx: card->u.aft.tdmv_api_tx=wan_skb_dequeue(&card->u.aft.tdmv_api_tx_list); if (!card->u.aft.tdmv_api_tx){ /* No tx packet, send idle frames */ - ++chan->if_stats.tx_carrier_errors; + WAN_NETIF_STATS_INC_TX_CARRIER_ERRORS(&chan->common); //++chan->if_stats.tx_carrier_errors; memset(txdata,chan->idle_flag,chan->mtu); return; } @@ -10386,14 +11304,14 @@ wp_tdmv_api_rx_tx_chan_skip_rx: * The tx api packet must have info for all * timeslots */ memset(txdata,chan->idle_flag,chan->mtu); - ++chan->if_stats.tx_errors; + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //++chan->if_stats.tx_errors; return; } buf=wan_skb_data(card->u.aft.tdmv_api_tx); memcpy(txdata,buf,chan->mtu); wan_skb_pull(card->u.aft.tdmv_api_tx,chan->mtu); - ++chan->if_stats.tx_dropped; + WAN_NETIF_STATS_INC_TX_DROPPED(&chan->common); //++chan->if_stats.tx_dropped; #endif return; @@ -10434,7 +11352,7 @@ static void wp_tdmv_api_rx_tx (sdla_t *card, private_area_t *chan) } card->u.aft.tdmv_api_rx->protocol = htons(PVC_PROT); - wan_skb_reset_mac_header(card->u.aft.tdmv_api_rx); + card->u.aft.tdmv_api_rx->mac.raw = card->u.aft.tdmv_api_rx->data; card->u.aft.tdmv_api_rx->dev = chan->common.dev; card->u.aft.tdmv_api_rx->pkt_type = WAN_PACKET_DATA; @@ -10610,13 +11528,48 @@ static int aft_write_hdlc_frame(void *chan_ptr, netskb_t *skb) return -EINVAL; } + +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_BRI) + if(IS_BRI_CARD(card)){ + if(chan->dchan_time_slot >= 0){ +#if 0 + err=aft_bri_dchan_transmit(card, chan, NULL, 0); + if(err){ + /* still busy transmitting */ + return -EBUSY; + } +#endif + /* NOTE: BRI dchan tx has to be done inside IRQ lock. + It allows to synchronize access to SPI on the card. + */ + card->hw_iface.hw_lock(card->hw,&smp_flags); + err=aft_bri_dchan_transmit(card, chan, + wan_skb_data(skb), + wan_skb_len(skb)); + card->hw_iface.hw_unlock(card->hw,&smp_flags); + if (err == 0) { + wan_skb_free(skb); + err = 0; + } else { + err = -EBUSY; + } + } else { + /* On b-channel data is transmitted using AFT DMA. */ + DEBUG_EVENT("%s: Error: BRI TX on non-D-channel!!\n", card->devname); + wan_skb_free(skb); + err = 0; + } + + return err; + } +#endif + wan_spin_lock_irq(&card->wandev.lock, &smp_flags); if (wan_skb_queue_len(&chan->wp_tx_pending_list) > chan->max_tx_bufs){ aft_dma_tx(card,chan); wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); return -EBUSY; - } wan_skb_unlink(skb); @@ -10693,15 +11646,6 @@ static int aft_tdm_ring_rsync(sdla_t *card) return 0; } -static void aft_critical_event (void *arg, int type) -{ - sdla_t *card = (sdla_t*)arg; - DEBUG_EVENT("%s: Error: Card Critically Shutdown: Short Circuit Detected!\n", - card->devname); - aft_critical_shutdown(card); - return; -} - static void aft_critical_shutdown (sdla_t *card) { DEBUG_EVENT("%s: Error: Card Critically Shutdown!\n", @@ -10721,11 +11665,10 @@ static void aft_critical_shutdown (sdla_t *card) aft_hwdev[card->wandev.card_type].aft_led_ctrl(card, WAN_AFT_GREEN, 0, WAN_AFT_OFF); } - static int aft_hwec_config (sdla_t *card, private_area_t *chan, wanif_conf_t *conf, int ctrl) { int err = 0; - unsigned int channel=0; + int fe_chan = 0; unsigned int tdmv_hwec_option=0; if (conf) { @@ -10735,28 +11678,41 @@ static int aft_hwec_config (sdla_t *card, private_area_t *chan, wanif_conf_t *co if (chan->common.usedby == TDM_VOICE_API || chan->common.usedby == TDM_VOICE){ + /* Nov 6, 2007 Calling EC function with FE channel number. */ if (IS_TE1_CARD(card)) { if (IS_T1_CARD(card)){ - channel = chan->first_time_slot; + fe_chan = chan->first_time_slot+1; }else{ - channel = chan->first_time_slot; + fe_chan = chan->first_time_slot; } + } else if (IS_FXOFXS_CARD(card)) { + fe_chan = chan->first_time_slot+1; } else { - channel = chan->first_time_slot; + fe_chan = chan->first_time_slot+1; } #if defined(CONFIG_WANPIPE_HWEC) if (ctrl == 0 && card->wandev.ec_enable){ - card->wandev.ec_enable(card, 0, channel); + card->wandev.ec_enable(card, 0, fe_chan); } else if (tdmv_hwec_option && card->wandev.ec_enable){ - DEBUG_HWEC("%s: HW echo canceller Enabled on channel %d\n", + + if(IS_BRI_CARD(card)){ + DEBUG_HWEC("%s(): original fe_chan: %d\n", __FUNCTION__, fe_chan); + + /* translate channel to be 0 or 1, nothing else!! */ + fe_chan = (fe_chan % 2); + DEBUG_HWEC("%s(): new fe_chan: %d\n", __FUNCTION__, fe_chan); + } + + DEBUG_HWEC("[HWEC] %s: Enable Echo Canceller on fe_chan %d\n", chan->if_name, - channel); - err = card->wandev.ec_enable(card, 1, channel); + fe_chan); + + err = card->wandev.ec_enable(card, 1, fe_chan); if (err) { - DEBUG_EVENT("%s: Failed to enable HWEC on channel %d\n", - chan->if_name,channel); + DEBUG_EVENT("%s: Failed to enable HWEC on fe chan %d\n", + chan->if_name,fe_chan); return err; } } @@ -10764,11 +11720,9 @@ static int aft_hwec_config (sdla_t *card, private_area_t *chan, wanif_conf_t *co } return err; - } - #if defined(AFT_RTP_SUPPORT) enum { WAN_TDM_RTP_NO_CHANGE, @@ -10779,8 +11733,8 @@ enum { static void aft_rtp_unconfig(sdla_t *card) { wan_rtp_chan_t *rtp_chan; - netskb_t *skb; int i; + netskb_t *skb; card->wandev.rtp_len=0; @@ -10843,7 +11797,7 @@ static int aft_rtp_config(sdla_t *card) card->wandev.rtp_len = (card->rtp_conf.rtp_sample * 8) + sizeof(wan_rtp_pkt_t); - if ((card->wandev.rtp_dev=wan_dev_get_by_name(card->rtp_conf.rtp_devname)) == NULL){ + if ((card->wandev.rtp_dev=dev_get_by_name(card->rtp_conf.rtp_devname)) == NULL){ DEBUG_EVENT("%s: Failed to open rtp tx device %s\n", card->devname, card->rtp_conf.rtp_devname); @@ -10866,7 +11820,7 @@ static int aft_rtp_config(sdla_t *card) aft_rtp_init_exit: - + aft_rtp_unconfig(card); DEBUG_EVENT("%s: Failed to configure rtp tap!\n",card->devname); @@ -10964,8 +11918,6 @@ static __inline void aft_rtp_tap_chan(sdla_t *card, u8 *data, u32 len, } } - - static void aft_rtp_tap(void *card_ptr, u8 chan, u8* rx, u8* tx, u32 len) { sdla_t *card = (sdla_t *)card_ptr; @@ -11030,7 +11982,6 @@ static void aft_rtp_tap(void *card_ptr, u8 chan, u8* rx, u8* tx, u32 len) } #endif - static int aft_find_master_if_and_dchan(sdla_t *card, int *master_if, u32 active_ch) { int dchan_found=0; @@ -11147,18 +12098,35 @@ static int digital_loop_test(sdla_t* card,wan_udp_pkt_t* wan_udp_pkt) buf = wan_skb_put(skb, wan_udp_pkt->wan_udp_data_len); memcpy(buf, wan_udp_pkt->wan_udp_data, wan_udp_pkt->wan_udp_data_len); - +#if defined(__LINUX__) skb->next = skb->prev = NULL; skb->dev = dev; skb->protocol = htons(ETH_P_IP); - wan_skb_reset_mac_header(skb); + wan_skb_reset_mac_header(skb); dev_queue_xmit(skb); - +#elif defined(__FreeBSD__) || defined(__OpenBSD__) + DEBUG_EVENT("%s: WARNING: Digital loop test mode is not supported!\n", + card->devname); +#endif return 0; } - +void wanpipe_wake_stack(private_area_t* chan) +{ + WAN_NETIF_WAKE_QUEUE(chan->common.dev); + if (chan->common.usedby == API){ + wan_wakeup_api(chan); + }else if (chan->common.usedby == STACK){ + wanpipe_lip_kick(chan,0); + }else if (chan->common.usedby == TDM_VOICE_DCHAN){ +#ifdef AFT_TDM_API_SUPPORT + if (is_tdm_api(chan,&chan->wp_tdm_api_dev)){ + wanpipe_tdm_api_kick(&chan->wp_tdm_api_dev); + } +#endif + } +} /****** End ****************************************************************/ diff --git a/patches/kdrivers/src/net/sdla_aft_te1.c~ b/patches/kdrivers/src/net/sdla_aft_te1.c~ new file mode 100644 index 0000000..65057f3 --- /dev/null +++ b/patches/kdrivers/src/net/sdla_aft_te1.c~ @@ -0,0 +1,11637 @@ +/***************************************************************************** +* sdla_aft_te1.c +* +* WANPIPE(tm) AFT TE1 Hardware Support +* +* Authors: Nenad Corbic +* +* Copyright: (c) 2003-2007 Sangoma Technologies 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. +* ============================================================================ +* Jan 07, 2003 Nenad Corbic Initial version. +* Oct 25, 2004 Nenad Corbic Support for QuadPort TE1 +* March 16, 2007 David Rokhvarg Support for ISDN BRI card. +*****************************************************************************/ + +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) +# include +# include +# include +# include +# include /* Socket Driver common area */ +# include +# include +# include +#else +# include +# include +# include +# include +# include +# include /* Socket Driver common area */ +# include +# include +# include +# include +# include +#endif + +#if defined(CONFIG_WANPIPE_HWEC) +# include +#endif + +#define INIT_FE_ONLY 0 + +#undef DEBUG_REG + +#define BRI_INIT_FUNC() if(0)DEBUG_EVENT("%s(): line:%d\n", __FUNCTION__, __LINE__) +#define DEBUG_BRI_DCHAN if(0)DEBUG_EVENT + +#if 1 +#define AFT_FUNC_DEBUG() +#else +#define AFT_FUNC_DEBUG() DEBUG_EVENT("%s:%d\n",__FUNCTION__,__LINE__) +#endif + + +#if 0 +# define AFT_XTEST_UPDATE 1 +#else +# undef AFT_XTEST_UPDATE +#endif + + +#if 1 +# define AFT_SECURITY_CHECK 1 +#else +# undef AFT_SECURITY_CHECK +# warning "AFT_SECURITY_CHECK disabled" +#endif + +#if 1 +# define AFT_WDT_ENABLE 1 +#else +# warning "DISABLED WDT" +# undef AFT_WDT_ENABLE +#endif + +#if 0 +# define AFT_RX_FIFO_DEBUG 1 +# warning "AFT_RX_FIFO_DEBUG Flag used" +#else +# undef AFT_RX_FIFO_DEBUG +#endif + +#if 0 +# define AFT_TX_FIFO_DEBUG 1 +# warning "AFT_TX_FIFO_DEBUG Flag used" +#else +# undef AFT_TX_FIFO_DEBUG +#endif + +#if 0 +# define AFT_SINGLE_DMA_CHAIN 1 +# warning "AFT_SINGLE_DMA_CHAIN: SET" +#else +# undef AFT_SINGLE_DMA_CHAIN +#endif + +#if 1 +# define AFT_IFT_INTR_ENABLE 1 +#else +# warning "AFT_IFT_INTR_ENABLE NOT ENABLED" +# undef AFT_IFT_INTR_ENABLE +#endif + +#if 0 +# warning "IRQ INTR DEBUGGIN ON" +# define AFT_IRQ_DEBUG 1 +#else +# undef AFT_IRQ_DEBUG +#endif + +#if 0 +# warning "IRQ STAT DEBUGGIN ON" +# define AFT_IRQ_STAT_DEBUG 1 +#else +# undef AFT_IRQ_STAT_DEBUG +#endif + + +#if 0 +# define AFT_TDMV_BH_ENABLE 1 +# error "AFT_TDMV_BH_ENABLE flag used" +#else +# undef AFT_TDMV_BH_ENABLE +#endif + +#if 1 +# define AFT_TDMV_CHANNELIZATION 1 +#else +# undef AFT_TDMV_CHANNELIZATION +#endif + +#if 1 +# define AFT_CLOCK_SYNC 1 +#else +# undef AFT_CLOCK_SYNC +#endif + +#if defined(__LINUX__) +#define AFT_TDM_API_SUPPORT 1 +#else +#undef AFT_TDM_API_SUPPORT +#endif + +#if defined(__LINUX__) +#define AFT_API_SUPPORT 1 +#else +#undef AFT_API_SUPPORT +#endif + +#if defined(__LINUX__) +# define AFT_RTP_SUPPORT 1 +#else +# undef AFT_RTP_SUPPORT +#endif + +#if defined(WANPIPE_64BIT_4G_DMA) +#warning "Wanpipe compiled for 64bit 4G DMA" +#endif + + +/* Trigger on Number of transactions + * 1= 1x8 byte transactions + * 2= 2x8 byte transactions + * 3= 3x8 byte transactions + * 4= 4x8 byte transactions + */ +#define AFT_TDMV_FIFO_LEVEL 1 +#define AFT_TDMV_CIRC_BUF 128 +#define AFT_TDMV_CIRC_BUF_LEN 4 +#define AFT_TDMV_BUF_MASK 0x1FF + +#define AFT_SS7_CTRL_LEN_MASK 0x0F +#define AFT_SS7_CTRL_TYPE_BIT 4 +#define AFT_SS7_CTRL_FORCE_BIT 5 + +#define AFT_MAX_CHIP_SECURITY_CNT 100 + +#define AFT_FE_FIX_FIRM_VER 100 + +aft_hw_dev_t aft_hwdev[MAX_AFT_HW_DEV]; + +enum { + TDM_RUNNING, + TDM_PENDING, +}; + +/****** Defines & Macros ****************************************************/ + +/* Private critical flags */ +enum { + POLL_CRIT = PRIV_CRIT, + CARD_DOWN, + TE_CFG, + CARD_HW_EC +}; + +enum { + LINK_DOWN, + DEVICE_DOWN +}; + +enum { + AFT_CHIP_CONFIGURED, + AFT_FRONT_END_UP, + AFT_TDM_GLOBAL_ISR, + AFT_TDM_RING_BUF, + AFT_TDM_FAST_ISR +}; + +enum { + TX_DMA_BUSY, + TX_HANDLER_BUSY, + TX_INTR_PENDING, + + RX_HANDLER_BUSY, + RX_DMA_BUSY, + RX_INTR_PENDING +}; + +enum { + AFT_FE_CFG_ERR, + AFT_FE_CFG, + AFT_FE_INTR, + AFT_FE_POLL, + AFT_FE_TDM_RBS, + AFT_FE_LED, + AFT_FE_EC_POLL +}; + +#define MAX_IP_ERRORS 10 + +#define PORT(x) (x == 0 ? "PRIMARY" : "SECONDARY" ) + + +#if 1 +# define TRUE_FIFO_SIZE 1 +#else +# undef TRUE_FIFO_SIZE +# define HARD_FIFO_CODE 0x1F +#endif + + +/* Remove HDLC Address + * 1=Remove Enabled + * 0=Remove Disabled + */ + +#if 0 +#define WANPIPE_CODEC_CONVERTER 1 +#else +#undef WANPIPE_CODEC_CONVERTER +#endif + +static int aft_rx_copyback=500; +/******Data Structures*****************************************************/ + +/* This structure is placed in the private data area of the device structure. + * The card structure used to occupy the private area but now the following + * structure will incorporate the card structure along with Protocol specific data + */ + + +/* Route Status options */ +#define NO_ROUTE 0x00 +#define ADD_ROUTE 0x01 +#define ROUTE_ADDED 0x02 +#define REMOVE_ROUTE 0x03 + +#define WP_WAIT 0 +#define WP_NO_WAIT 1 + +/* variable for keeping track of enabling/disabling FT1 monitor status */ +/* static int rCount; */ + +/* Function interface between WANPIPE layer and kernel */ +extern wan_iface_t wan_iface; + +extern void disable_irq(unsigned int); +extern void enable_irq(unsigned int); + +extern sdla_t* card_list; + +/**SECTOIN************************************************** + * + * Function Prototypes + * + ***********************************************************/ +int wp_aft_te1default_devcfg(sdla_t* card, wandev_conf_t* conf); +int wp_aft_te1default_ifcfg(sdla_t* card, wanif_conf_t* conf); + +/* WAN link driver entry points. These are called by the WAN router module. */ +static int update (wan_device_t* wandev); +static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf); +static int del_if(wan_device_t *wandev, netdevice_t *dev); + +/* Network device interface */ +#if defined(__LINUX__) +static int if_init (netdevice_t* dev); +#endif +static int if_open (netdevice_t* dev); +static int if_close (netdevice_t* dev); +static int if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd); + +#if defined(__LINUX__) +static int if_send (netskb_t* skb, netdevice_t* dev); +static struct net_device_stats* if_stats (netdevice_t* dev); +#else +static int if_send(netdevice_t*, netskb_t*, struct sockaddr*,struct rtentry*); +#endif + +static void handle_front_end_state(void* card_id); +static void enable_timer(void* card_id); +static void enable_ec_timer(void* card_id); +static void if_tx_timeout (netdevice_t *dev); + +/* Miscellaneous Functions */ +static void port_set_state (sdla_t *card, int); + +static void disable_comm (sdla_t *card); + +/* Interrupt handlers */ +static WAN_IRQ_RETVAL wp_aft_global_isr (sdla_t* card); +static void wp_aft_dma_per_port_isr(sdla_t *card); +static void wp_aft_tdmv_per_port_isr(sdla_t *card); +static void wp_aft_fifo_per_port_isr(sdla_t *card); +static void wp_aft_wdt_per_port_isr(sdla_t *card, int wdt_intr); + +/* Bottom half handlers */ +#if defined(__LINUX__) +static void wp_bh (unsigned long); +static void wp_tdm_bh (unsigned long); +#else +static void wp_bh (void*,int); +static void wp_tdm_bh (void*,int); +#endif + +/* Miscellaneous functions */ +static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, + private_area_t*, + int local_dev); + +static int aft_global_chip_configuration(sdla_t *card, wandev_conf_t* conf); +static int aft_global_chip_disable(sdla_t *card); + +static int aft_chip_configure(sdla_t *card, wandev_conf_t* conf); +static int aft_chip_unconfigure(sdla_t *card); +static int aft_dev_configure(sdla_t *card, private_area_t *chan, wanif_conf_t* conf); +static void aft_dev_unconfigure(sdla_t *card, private_area_t *chan); + +static int aft_dma_rx(sdla_t *card, private_area_t *chan); +static void aft_dev_enable(sdla_t *card, private_area_t *chan); +static void aft_dev_close(sdla_t *card, private_area_t *chan); +static void aft_dev_open(sdla_t *card, private_area_t *gchan); +static void aft_dma_tx_complete (sdla_t *card, private_area_t *chan,int wdt, int reset); + +static int aft_dma_rx_complete(sdla_t *card, private_area_t *chan, int reset); +static int aft_init_rx_dev_fifo(sdla_t *card, private_area_t *chan, unsigned char); +static int aft_init_tx_dev_fifo(sdla_t *card, private_area_t *chan, unsigned char); +static void aft_tx_post_complete (sdla_t *card, private_area_t *chan, netskb_t *skb); +static void aft_rx_post_complete (sdla_t *card, private_area_t *chan, + netskb_t *skb, + netskb_t **new_skb, + unsigned char *pkt_error); +static int aft_dma_rx_tdmv(sdla_t *card, private_area_t *chan); +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) +static int aft_voice_span_rx_tx(sdla_t *card, int rotate); +#endif + +static void aft_channel_txdma_ctrl(sdla_t *card, private_area_t *chan, int on); +static void aft_channel_rxdma_ctrl(sdla_t *card, private_area_t *chan, int on); +static void aft_channel_txintr_ctrl(sdla_t *card, private_area_t *chan, int on); +static void aft_channel_rxintr_ctrl(sdla_t *card, private_area_t *chan, int on); + +static int aft_read_security(sdla_t *card); +static int aft_front_end_mismatch_check(sdla_t * card); +static int aft_tslot_sync_ctrl(sdla_t *card, private_area_t *chan, int mode); + +#if defined(__LINUX__) +# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) +static void aft_port_task (void * card_ptr); +# else +static void aft_port_task (struct work_struct *work); +# endif +#else +static void aft_port_task (void * card_ptr, int arg); +#endif + +#if defined(AFT_RTP_SUPPORT) +static int aft_rtp_config(sdla_t *card); +static void aft_rtp_unconfig(sdla_t *card); +static void aft_rtp_tap(void *card_ptr, u8 chan, u8* rx, u8* tx, u32 len); +#endif + +static int aft_devel_ioctl(sdla_t *card,struct ifreq *ifr); +static int aft_write_bios(sdla_t *card, wan_cmd_api_t *api_cmd); +static int aft_write(sdla_t *card, wan_cmd_api_t *api_cmd); +static int aft_read(sdla_t *card, wan_cmd_api_t *api_cmd); +static int aft_fe_write(sdla_t *card, wan_cmd_api_t *api_cmd); +static int aft_fe_read(sdla_t *card, wan_cmd_api_t *api_cmd); + +static void front_end_interrupt(sdla_t *card, unsigned long reg, int lock); +static void enable_data_error_intr(sdla_t *card); +static void disable_data_error_intr(sdla_t *card, unsigned char); + +static void aft_tx_fifo_under_recover (sdla_t *card, private_area_t *chan); +static void aft_rx_fifo_over_recover(sdla_t *card, private_area_t *chan); + +static int set_chan_state(sdla_t* card, netdevice_t* dev, int state); + +static int update_comms_stats(sdla_t* card); + +static int protocol_init (sdla_t*card,netdevice_t *dev, + private_area_t *chan, wanif_conf_t* conf); +static int protocol_stop (sdla_t *card, netdevice_t *dev); +static int protocol_shutdown (sdla_t *card, netdevice_t *dev); +static void protocol_recv(sdla_t *card, private_area_t *chan, netskb_t *skb); + +static int aft_alloc_rx_dma_buff(sdla_t *card, private_area_t *chan, int num, int irq); +static int aft_init_requeue_free_skb(private_area_t *chan, netskb_t *skb); + + +static int aft_dma_tx (sdla_t *card,private_area_t *chan); +static void aft_tx_dma_chain_handler(unsigned long data, int wdt, int reset); +static void aft_tx_dma_voice_handler(unsigned long data, int wdt, int reset); +static void aft_tx_dma_chain_init(private_area_t *chan, wan_dma_descr_t *); +static void aft_rx_dma_chain_init(private_area_t *chan, wan_dma_descr_t *); +static void aft_index_tx_rx_dma_chains(private_area_t *chan); +static void aft_init_tx_rx_dma_descr(private_area_t *chan); +static void aft_free_rx_complete_list(private_area_t *chan); +static void aft_rx_cur_go_test(private_area_t *chan); +static void aft_free_rx_descriptors(private_area_t *chan); +static void aft_reset_rx_chain_cnt(private_area_t *chan); +static void aft_reset_tx_chain_cnt(private_area_t *chan); +static void aft_free_tx_descriptors(private_area_t *chan); + + +static int aft_realign_skb_pkt(private_area_t *chan, netskb_t *skb); + +static void aft_data_mux_cfg(sdla_t *card); +static void aft_data_mux_get_cfg(sdla_t *card); + +static int aft_ss7_tx_mangle(sdla_t *card,private_area_t *chan, netskb_t *skb); +static int aft_hdlc_repeat_mangle(sdla_t *card,private_area_t *chan, netskb_t *skb, netskb_t **rkb); + +static int aft_tdmv_init(sdla_t *card, wandev_conf_t *conf); +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) +static int aft_tdmv_free(sdla_t *card); +#endif +static int aft_tdmv_if_init(sdla_t *card, private_area_t *chan, wanif_conf_t *conf); +static int aft_tdmv_if_free(sdla_t *card, private_area_t *chan); + +static int digital_loop_test(sdla_t* card,wan_udp_pkt_t* wan_udp_pkt); + +#if 0 +static void wp_tdmv_api_chan_rx_tx(sdla_t *card, + private_area_t *chan, + unsigned char *rxdata, unsigned char *tx_data); +static void wp_tdmv_api_rx_tx (sdla_t *card, private_area_t *chan); +#endif + +static int aft_fifo_intr_ctrl(sdla_t *card, int ctrl); +static int aft_tdm_intr_ctrl(sdla_t *card, int ctrl); + +#if defined(__LINUX__) +static void aft_set_ss7_force_rx(sdla_t *card, private_area_t *chan); +#endif +static void aft_clear_ss7_force_rx(sdla_t *card, private_area_t *chan); + +#if defined(AFT_API_SUPPORT) || defined(AFT_TDM_API_SUPPORT) +static int aft_event_ctrl(void *chan_ptr, wan_event_ctrl_t *ctrl); +#endif + +#ifdef AFT_TDM_API_SUPPORT +static int aft_read_rbs_bits(void *chan_ptr, u32 ch, u8 *rbs_bits); +static int aft_write_rbs_bits(void *chan_ptr, u32 ch, u8 rbs_bits); +static int aft_write_hdlc_frame(void *chan_ptr, netskb_t *skb); +#endif +static int aft_tdm_ring_rsync(sdla_t *card); +static void aft_critical_shutdown(sdla_t *card); +void wanpipe_wake_stack(private_area_t* chan); + +/* API VoIP event */ +#if defined(AFT_API_SUPPORT) +static int wan_aft_api_ioctl(sdla_t *card, private_area_t *chan, char *user_data); +static void wan_aft_api_dtmf (void* card_id, wan_event_t *event); +static void wan_aft_api_hook (void* card_id, wan_event_t *event); +static void wan_aft_api_ringtrip (void* card_id, wan_event_t *event); +static void wan_aft_api_ringdetect (void* card_id, wan_event_t *event); +#endif + +#if 0 +static void aft_list_descriptors(private_area_t *chan); +#endif +#if 0 +static void aft_list_dma_chain_regs(sdla_t *card); +#endif + +#if 0 +static void aft_list_tx_descriptors(private_area_t *chan); +#endif +#if 0 +static void aft_display_chain_history(private_area_t *chan); +static void aft_chain_history(private_area_t *chan,u8 end, u8 cur, u8 begin, u8 loc); +#endif + + +/* TE1 Control registers */ +#if 0 +static WRITE_FRONT_END_REG_T write_front_end_reg; +static READ_FRONT_END_REG_T read_front_end_reg; +#endif + +unsigned char aft_read_cpld(sdla_t *card, unsigned short cpld_off); +int aft_write_cpld(void *pcard, unsigned short off,unsigned char data); + +/* Procfs functions */ +static int wan_aft_get_info(void* pcard, struct seq_file* m, int* stop_cnt); + +static int wan_aft_init (sdla_t *card, wandev_conf_t* conf); + + +static unsigned char aft_write_ec (void*, unsigned short, unsigned char); +static unsigned char aft_read_ec (void*, unsigned short); + +static int aft_hwec_config(sdla_t *card, private_area_t *chan, wanif_conf_t *conf, int ctrl); +static int aft_find_master_if_and_dchan(sdla_t *card, int *master_if,u32 active_ch); + +#if defined(NETGRAPH) +extern void wan_ng_link_state(wanpipe_common_t *common, int state); +#endif + +/**SECTION********************************************************* + * + * Public Functions + * + ******************************************************************/ + +int wp_aft_te1default_devcfg(sdla_t* card, wandev_conf_t* conf) +{ + conf->config_id = WANCONFIG_AFT_TE1; + conf->u.aft.dma_per_ch = MAX_RX_BUF; + conf->u.aft.mru = 1500; + return 0; +} + +int wp_aft_te1default_ifcfg(sdla_t* card, wanif_conf_t* conf) +{ + conf->protocol = WANCONFIG_HDLC; + memcpy(conf->usedby, "WANPIPE", 7); + conf->if_down = 0; + conf->ignore_dcd = WANOPT_NO; + conf->ignore_cts = WANOPT_NO; + conf->hdlc_streaming = WANOPT_NO; + conf->mc = 0; + conf->gateway = 0; + conf->active_ch = ENABLE_ALL_CHANNELS; + + return 0; +} + +#if 0 +static void aft_delay(int sec) +{ +#if 1 + unsigned long timeout=SYSTEM_TICKS; + while ((SYSTEM_TICKS-timeout)<(sec*HZ)){ + schedule(); + } +#endif +} +#endif + + +int aft_global_hw_device_init(void) +{ + memset(aft_hwdev,0,sizeof(aft_hwdev)); + + aft_hwdev[WANOPT_AFT104].init = 1; + aft_hwdev[WANOPT_AFT104].aft_global_chip_config = a104_global_chip_config; + aft_hwdev[WANOPT_AFT104].aft_global_chip_unconfig = a104_global_chip_unconfig; + aft_hwdev[WANOPT_AFT104].aft_chip_config = a104_chip_config; + aft_hwdev[WANOPT_AFT104].aft_chip_unconfig = a104_chip_unconfig; + aft_hwdev[WANOPT_AFT104].aft_chan_config = a104_chan_dev_config; + aft_hwdev[WANOPT_AFT104].aft_chan_unconfig = a104_chan_dev_unconfig; + aft_hwdev[WANOPT_AFT104].aft_led_ctrl = a104_led_ctrl; + aft_hwdev[WANOPT_AFT104].aft_test_sync = a104_test_sync; + aft_hwdev[WANOPT_AFT104].aft_read_cpld = aft_te1_read_cpld; + aft_hwdev[WANOPT_AFT104].aft_write_cpld = aft_te1_write_cpld; + aft_hwdev[WANOPT_AFT104].aft_fifo_adjust = a104_fifo_adjust; + aft_hwdev[WANOPT_AFT104].aft_check_ec_security = a104_check_ec_security; + + aft_hwdev[WANOPT_AFT_ANALOG].init = 1; + aft_hwdev[WANOPT_AFT_ANALOG].aft_global_chip_config = aft_analog_global_chip_config; + aft_hwdev[WANOPT_AFT_ANALOG].aft_global_chip_unconfig = aft_analog_global_chip_unconfig; + aft_hwdev[WANOPT_AFT_ANALOG].aft_chip_config = aft_analog_chip_config; + aft_hwdev[WANOPT_AFT_ANALOG].aft_chip_unconfig = aft_analog_chip_unconfig; + aft_hwdev[WANOPT_AFT_ANALOG].aft_chan_config = aft_analog_chan_dev_config; + aft_hwdev[WANOPT_AFT_ANALOG].aft_chan_unconfig = aft_analog_chan_dev_unconfig; + aft_hwdev[WANOPT_AFT_ANALOG].aft_led_ctrl = aft_analog_led_ctrl; + aft_hwdev[WANOPT_AFT_ANALOG].aft_test_sync = aft_analog_test_sync; + aft_hwdev[WANOPT_AFT_ANALOG].aft_read_cpld = aft_analog_read_cpld; + aft_hwdev[WANOPT_AFT_ANALOG].aft_write_cpld = aft_analog_write_cpld; + aft_hwdev[WANOPT_AFT_ANALOG].aft_fifo_adjust = aft_analog_fifo_adjust; + aft_hwdev[WANOPT_AFT_ANALOG].aft_check_ec_security = a200_check_ec_security; + +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_BRI) + aft_hwdev[WANOPT_AFT_ISDN].init = 1; + aft_hwdev[WANOPT_AFT_ISDN].aft_global_chip_config = aft_bri_global_chip_config; + aft_hwdev[WANOPT_AFT_ISDN].aft_global_chip_unconfig = aft_bri_global_chip_unconfig; + aft_hwdev[WANOPT_AFT_ISDN].aft_chip_config = aft_bri_chip_config; + aft_hwdev[WANOPT_AFT_ISDN].aft_chip_unconfig = aft_bri_chip_unconfig; + aft_hwdev[WANOPT_AFT_ISDN].aft_chan_config = aft_bri_chan_dev_config; + aft_hwdev[WANOPT_AFT_ISDN].aft_chan_unconfig = aft_bri_chan_dev_unconfig; + aft_hwdev[WANOPT_AFT_ISDN].aft_led_ctrl = aft_bri_led_ctrl; + aft_hwdev[WANOPT_AFT_ISDN].aft_test_sync = aft_bri_test_sync; + aft_hwdev[WANOPT_AFT_ISDN].aft_read_cpld = aft_bri_read_cpld; + aft_hwdev[WANOPT_AFT_ISDN].aft_write_cpld = aft_bri_write_cpld; + aft_hwdev[WANOPT_AFT_ISDN].aft_fifo_adjust = aft_bri_fifo_adjust; + aft_hwdev[WANOPT_AFT_ISDN].aft_check_ec_security = bri_check_ec_security; +#endif + + aft_hwdev[WANOPT_AFT_56K].init = 1; + aft_hwdev[WANOPT_AFT_56K].aft_global_chip_config = a104_global_chip_config; + aft_hwdev[WANOPT_AFT_56K].aft_global_chip_unconfig = a104_global_chip_unconfig; + aft_hwdev[WANOPT_AFT_56K].aft_chip_config = a104_chip_config; + aft_hwdev[WANOPT_AFT_56K].aft_chip_unconfig = a104_chip_unconfig; + aft_hwdev[WANOPT_AFT_56K].aft_chan_config = a104_chan_dev_config; + aft_hwdev[WANOPT_AFT_56K].aft_chan_unconfig = a104_chan_dev_unconfig; + aft_hwdev[WANOPT_AFT_56K].aft_led_ctrl = a104_led_ctrl; + aft_hwdev[WANOPT_AFT_56K].aft_test_sync = a104_test_sync; + aft_hwdev[WANOPT_AFT_56K].aft_read_cpld = aft_56k_read_cpld; + aft_hwdev[WANOPT_AFT_56K].aft_write_cpld = aft_56k_write_cpld; + aft_hwdev[WANOPT_AFT_56K].aft_fifo_adjust = a104_fifo_adjust; + aft_hwdev[WANOPT_AFT_56K].aft_check_ec_security = a104_check_ec_security; + + return 0; +} + + +/*============================================================================ + * wp_aft_te1_init - Cisco HDLC protocol initialization routine. + * + * @card: Wanpipe card pointer + * @conf: User hardware/firmware/general protocol configuration + * pointer. + * + * This routine is called by the main WANPIPE module + * during setup: ROUTER_SETUP ioctl(). + * + * At this point adapter is completely initialized + * and firmware is running. + * o read firmware version (to make sure it's alive) + * o configure adapter + * o initialize protocol-specific fields of the adapter data space. + * + * Return: 0 o.k. + * < 0 failure. + */ + +int wp_aft_analog_init (sdla_t *card, wandev_conf_t* conf) +{ + /* Verify configuration ID */ + if (card->wandev.config_id != WANCONFIG_AFT_ANALOG) { + DEBUG_EVENT( "%s: invalid configuration ID %u!\n", + card->devname, card->wandev.config_id); + return -EINVAL; + } + + ASSERT_AFT_HWDEV(card->wandev.card_type); + + card->hw_iface.getcfg(card->hw, SDLA_COREREV, &card->u.aft.firm_ver); + card->hw_iface.getcfg(card->hw, SDLA_COREID, &card->u.aft.firm_id); + if (card->u.aft.firm_ver < AFT_MIN_ANALOG_FRMW_VER){ + DEBUG_EVENT( "%s: Invalid/Obselete AFT ANALOG firmware version %X (not >= %X)!\n", + card->devname, card->u.aft.firm_ver,AFT_MIN_ANALOG_FRMW_VER); + DEBUG_EVENT( "%s Refer to /usr/share/doc/wanpipe/README.aft_firm_update\n", + card->devname); + DEBUG_EVENT( "%s: Please contact Sangoma Technologies for more info.\n", + card->devname); + return -EINVAL; + } + + if (conf == NULL){ + DEBUG_EVENT("%s: Bad configuration structre!\n", + card->devname); + return -EINVAL; + } + + /* Make special hardware initialization for Analog board */ + memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); + wp_remora_iface_init(&card->fe, &card->wandev.fe_iface); + card->fe.name = card->devname; + card->fe.card = card; + card->fe.write_fe_reg = aft_analog_write_fe; + card->fe.read_fe_reg = aft_analog_read_fe; + card->fe.__read_fe_reg = __aft_analog_read_fe; + + card->wandev.fe_enable_timer = enable_timer; + card->wandev.ec_enable_timer = enable_ec_timer; + card->wandev.te_link_state = handle_front_end_state; + + if (card->wandev.comm_port == WANOPT_PRI){ + conf->clocking = WANOPT_EXTERNAL; + } + + card->wandev.comm_port=card->fe.fe_cfg.line_no; + if (card->wandev.comm_port != 0){ + DEBUG_EVENT("%s: Error: Invalid port selected %d (Port 1)\n", + card->devname,card->wandev.comm_port); + return -EINVAL; + } + + card->u.aft.num_of_time_slots=MAX_REMORA_MODULES; + + return wan_aft_init(card,conf); + +} + +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_BRI) + +int wp_aft_bri_init (sdla_t *card, wandev_conf_t* conf) +{ + /* Verify configuration ID */ + if (card->wandev.config_id != WANCONFIG_AFT_ISDN_BRI) { + DEBUG_EVENT( "%s: invalid configuration ID %u!\n", + card->devname, card->wandev.config_id); + return -EINVAL; + } + + ASSERT_AFT_HWDEV(card->wandev.card_type); + + card->hw_iface.getcfg(card->hw, SDLA_COREREV, &card->u.aft.firm_ver); + card->hw_iface.getcfg(card->hw, SDLA_COREID, &card->u.aft.firm_id); + + /* FIXME:hardcoded!! */ + card->u.aft.firm_id = AFT_DS_FE_CORE_ID; + +#if 0 + FIXME: check firmware version + if (card->u.aft.firm_ver < AFT_MIN_ANALOG_FRMW_VER){ + DEBUG_EVENT( "%s: Invalid/Obselete AFT BRI firmware version %X (not >= %X)!\n", + card->devname, card->u.aft.firm_ver,AFT_MIN_ANALOG_FRMW_VER); + DEBUG_EVENT( "%s Refer to /usr/share/doc/wanpipe/README.aft_firm_update\n", + card->devname); + DEBUG_EVENT( "%s: Please contact Sangoma Technologies for more info.\n", + card->devname); + return -EINVAL; + } +#endif + + + if (conf == NULL){ + DEBUG_EVENT("%s: Bad configuration structre!\n", + card->devname); + return -EINVAL; + } + + /* Make special hardware initialization for Analog board */ + memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); + wp_bri_iface_init(&card->wandev.fe_iface); + card->fe.name = card->devname; + card->fe.card = card; + card->fe.write_fe_reg = aft_bri_write_fe; + card->fe.read_fe_reg = aft_bri_read_fe; + card->fe.__read_fe_reg = __aft_bri_read_fe; + + card->wandev.fe_enable_timer = enable_timer; + card->wandev.ec_enable_timer = enable_ec_timer; + card->wandev.te_link_state = handle_front_end_state; + + if (card->wandev.comm_port == WANOPT_PRI){ + conf->clocking = WANOPT_EXTERNAL; + } + + card->wandev.comm_port=card->fe.fe_cfg.line_no; + + /* Set 'num_of_time_slots' to 31. This is needed for the d-chan, + which is always at the otherwise unused timeslot 31. + */ + card->u.aft.num_of_time_slots = MAX_TIMESLOTS; + + return wan_aft_init(card,conf); +} +#endif + +int wp_aft_te1_init (sdla_t* card, wandev_conf_t* conf) +{ + + AFT_FUNC_DEBUG(); + + wan_set_bit(CARD_DOWN,&card->wandev.critical); + + /* Verify configuration ID */ + if (card->wandev.config_id != WANCONFIG_AFT_TE1) { + DEBUG_EVENT( "%s: invalid configuration ID %u!\n", + card->devname, card->wandev.config_id); + return -EINVAL; + } + + + card->hw_iface.getcfg(card->hw, SDLA_COREREV, &card->u.aft.firm_ver); + card->hw_iface.getcfg(card->hw, SDLA_COREID, &card->u.aft.firm_id); + + if (card->u.aft.firm_ver < AFT_MIN_FRMW_VER){ + DEBUG_EVENT( "%s: Invalid/Obselete AFT firmware version %X (not >= %X)!\n", + card->devname, card->u.aft.firm_ver,AFT_MIN_FRMW_VER); + DEBUG_EVENT( "%s Refer to /usr/share/doc/wanpipe/README.aft_firm_update\n", + card->devname); + DEBUG_EVENT( "%s: Please contact Sangoma Technologies for more info.\n", + card->devname); + return -EINVAL; + } + + ASSERT_AFT_HWDEV(card->wandev.card_type); + + if (conf == NULL){ + DEBUG_EVENT("%s: Bad configuration structre!\n", + card->devname); + return -EINVAL; + } + +#if defined(WAN_DEBUG_MEM) + DEBUG_EVENT("%s: Total Mem %d\n",__FUNCTION__,wan_atomic_read(&wan_debug_mem)); +#endif + + /* TE1 Make special hardware initialization for T1/E1 board */ + if (IS_TE1_MEDIA(&conf->fe_cfg)){ + int max_ports = 4; + + if (conf->fe_cfg.cfg.te_cfg.active_ch == 0){ + conf->fe_cfg.cfg.te_cfg.active_ch = -1; + } + + memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); + if (card->u.aft.firm_id == AFT_DS_FE_CORE_ID) { + max_ports = 8; + sdla_ds_te1_iface_init(&card->fe, &card->wandev.fe_iface); + }else{ + sdla_te_iface_init(&card->fe, &card->wandev.fe_iface); + } + card->fe.name = card->devname; + card->fe.card = card; + card->fe.write_fe_reg = a104_write_fe; + card->fe.read_fe_reg = a104_read_fe; + card->fe.__read_fe_reg = __a104_read_fe; + + card->wandev.fe_enable_timer = enable_timer; + card->wandev.ec_enable_timer = enable_ec_timer; + card->wandev.te_link_state = handle_front_end_state; + conf->electrical_interface = + IS_T1_CARD(card) ? WANOPT_V35 : WANOPT_RS232; + + if (card->wandev.comm_port == WANOPT_PRI){ + conf->clocking = WANOPT_EXTERNAL; + } + + card->wandev.comm_port=card->fe.fe_cfg.line_no; +#if 0 +/* ALEX: This will check during t1/e1 configuration */ + if (card->wandev.comm_port < 0 || card->wandev.comm_port > max_ports-1){ + DEBUG_EVENT("%s: Error: Invalid port selected %d (Min=1 Max=%d)\n", + card->devname,card->wandev.comm_port, max_ports); + return -EINVAL; + } +#endif + + if (IS_T1_CARD(card)){ + card->u.aft.num_of_time_slots=NUM_OF_T1_CHANNELS; + }else{ + card->u.aft.num_of_time_slots=NUM_OF_E1_CHANNELS; + } + + }else{ + DEBUG_EVENT("%s: Invalid Front-End media type!!\n", + card->devname); + return -EINVAL; + } + + return wan_aft_init(card,conf); + +} + +int wp_aft_56k_init (sdla_t* card, wandev_conf_t* conf) +{ + + AFT_FUNC_DEBUG(); + + wan_set_bit(CARD_DOWN,&card->wandev.critical); + + /* Verify configuration ID */ + if (card->wandev.config_id != WANCONFIG_AFT_56K) { + DEBUG_EVENT( "%s: invalid configuration ID %u!\n", + card->devname, card->wandev.config_id); + return -EINVAL; + } + + + card->hw_iface.getcfg(card->hw, SDLA_COREREV, &card->u.aft.firm_ver); + card->hw_iface.getcfg(card->hw, SDLA_COREID, &card->u.aft.firm_id); +#if 0 + if (card->u.aft.firm_ver < AFT_56K_MIN_FRMW_VER){ + DEBUG_EVENT( "%s: Invalid/Obselete AFT firmware version %X (not >= %X)!\n", + card->devname, card->u.aft.firm_ver,AFT_56K_MIN_FRMW_VER); + DEBUG_EVENT( "%s Refer to /usr/share/doc/wanpipe/README.aft_firm_update\n", + card->devname); + DEBUG_EVENT( "%s: Please contact Sangoma Technologies for more info.\n", + card->devname); + return -EINVAL; + } +#endif + ASSERT_AFT_HWDEV(card->wandev.card_type); + + if (conf == NULL){ + DEBUG_EVENT("%s: Bad configuration structre!\n", + card->devname); + return -EINVAL; + } + +#if defined(WAN_DEBUG_MEM) + DEBUG_EVENT("%s: Total Mem %d\n",__FUNCTION__,wan_atomic_read(&wan_debug_mem)); +#endif + + if (IS_56K_MEDIA(&conf->fe_cfg)){ + + conf->fe_cfg.cfg.te_cfg.active_ch = 1; + + memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); + + DEBUG_56K("card->u.aft.firm_id: 0x%X\n", card->u.aft.firm_id); +/* + if(card->u.aft.firm_id != AFT_56K_FE_CORE_ID){ + DEBUG_EVENT("%s: Invalid (56K) Firmware ID: 0x%X!\n", + card->devname, card->u.aft.firm_id); + return -EINVAL; + } +*/ + sdla_56k_iface_init(&card->fe, &card->wandev.fe_iface); + + card->fe.name = card->devname; + card->fe.card = card; +#if 1 + card->fe.write_fe_reg = a56k_write_fe; + card->fe.read_fe_reg = a56k_read_fe; + card->fe.__read_fe_reg = __a56k_read_fe; +#else + card->fe.write_fe_reg = a104_write_fe; + card->fe.read_fe_reg = a104_read_fe; + card->fe.__read_fe_reg = __a104_read_fe; +#endif + card->wandev.fe_enable_timer = enable_timer; + card->wandev.ec_enable_timer = enable_ec_timer; + card->wandev.te_link_state = handle_front_end_state; + + card->wandev.comm_port=1; + + card->u.aft.num_of_time_slots=1; + + }else{ + DEBUG_EVENT("%s: Invalid Front-End media type!!\n", + card->devname); + return -EINVAL; + } + + return wan_aft_init(card,conf); + +} + +static int wan_aft_init (sdla_t *card, wandev_conf_t* conf) +{ + int err; + int used_cnt; + + /* Obtain hardware configuration parameters */ + card->wandev.clocking = conf->clocking; + card->wandev.ignore_front_end_status = conf->ignore_front_end_status; + card->wandev.ttl = conf->ttl; + card->wandev.electrical_interface = conf->electrical_interface; + card->wandev.udp_port = conf->udp_port; + card->wandev.new_if_cnt = 0; + wan_atomic_set(&card->wandev.if_cnt,0); + card->u.aft.chip_security_cnt=0; + + memcpy(&card->u.aft.cfg,&conf->u.aft,sizeof(wan_xilinx_conf_t)); + memcpy(&card->rtp_conf,&conf->rtp_conf,sizeof(conf->rtp_conf)); + memset(card->u.aft.dev_to_ch_map,0,sizeof(card->u.aft.dev_to_ch_map)); + memcpy(&card->tdmv_conf,&conf->tdmv_conf,sizeof(wan_tdmv_conf_t)); + memcpy(&card->hwec_conf,&conf->hwec_conf,sizeof(wan_hwec_conf_t)); + + card->u.aft.cfg.dma_per_ch = MAX_RX_BUF; + card->u.aft.tdmv_api_rx = NULL; + card->u.aft.tdmv_api_tx = NULL; + card->u.aft.tdmv_dchan=0; + wan_skb_queue_init(&card->u.aft.tdmv_api_tx_list); + + if (card->wandev.ignore_front_end_status == WANOPT_NO){ + DEBUG_EVENT( + "%s: Enabling front end link monitor\n", + card->devname); + }else{ + DEBUG_EVENT( + "%s: Disabling front end link monitor\n", + card->devname); + } + + AFT_FUNC_DEBUG(); + + /* WARNING: After this point the init function + * must return with 0. The following bind + * functions will cause problems if structures + * below are not initialized */ + + card->wandev.update = &update; + card->wandev.new_if = &new_if; + card->wandev.del_if = &del_if; + card->disable_comm = NULL; + + +#ifdef WANPIPE_ENABLE_PROC_FILE_HOOKS + /* Proc fs functions hooks */ + card->wandev.get_config_info = &get_config_info; + card->wandev.get_status_info = &get_status_info; + card->wandev.get_dev_config_info= &get_dev_config_info; + card->wandev.get_if_info = &get_if_info; + card->wandev.set_dev_config = &set_dev_config; + card->wandev.set_if_info = &set_if_info; +#endif + card->wandev.get_info = &wan_aft_get_info; + + /* Setup Port Bps */ + if(card->wandev.clocking) { + card->wandev.bps = conf->bps; + }else{ + card->wandev.bps = 0; + } + + /* For Primary Port 0 */ +#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE + card->wandev.mtu = conf->mtu; + card->wan_tdmv.sc = NULL; +#else + card->wandev.mtu=conf->mtu; + if (card->wandev.mtu > MAX_WP_PRI_MTU || + card->wandev.mtu < MIN_WP_PRI_MTU){ + DEBUG_EVENT("%s: Error Invalid Global MTU %d (Min=%d, Max=%d)\n", + card->devname,card->wandev.mtu, + MIN_WP_PRI_MTU,MAX_WP_PRI_MTU); + + return -EINVAL; + } +#endif + + + if (!card->u.aft.cfg.mru){ + card->u.aft.cfg.mru = card->wandev.mtu; + } + + + if (card->u.aft.cfg.mru > MAX_WP_PRI_MTU || + card->u.aft.cfg.mru < MIN_WP_PRI_MTU){ + DEBUG_EVENT("%s: Error Invalid Global MRU %d (Min=%d, Max=%d)\n", + card->devname,card->u.aft.cfg.mru, + MIN_WP_PRI_MTU,MAX_WP_PRI_MTU); + + return -EINVAL; + } + + card->hw_iface.getcfg(card->hw, SDLA_BASEADDR, &card->u.aft.bar); + card->hw_iface.getcfg(card->hw, SDLA_MEMBASE, &card->u.aft.bar_virt); + + port_set_state(card,WAN_CONNECTING); + + WAN_TASKQ_INIT((&card->u.aft.port_task),0,aft_port_task,card); + + card->u.aft.chip_cfg_status=0; + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &used_cnt); + + wan_clear_bit(CARD_DOWN,&card->wandev.critical); + + __sdla_push_ptr_isr_array(card->hw,card,card->wandev.comm_port); + + card->isr = &wp_aft_global_isr; + + if (used_cnt==1){ + DEBUG_EVENT("%s: Global Chip Configuration: used=%d\n", + card->devname,used_cnt); + + err=aft_global_chip_configuration(card, conf); + if (err){ + aft_global_chip_disable(card); + return err; + } + + aft_data_mux_cfg(card); + + }else{ + + aft_data_mux_get_cfg(card); + + err=aft_front_end_mismatch_check(card); + if (err){ + return err; + } + + DEBUG_EVENT("%s: Global Chip Configuration skiped: used=%d\n", + card->devname,used_cnt); + } + card->wandev.ec_intmask=SYSTEM_TICKS; + + aft_read_security(card); + + err=aft_chip_configure(card,conf); + if (err){ + AFT_FUNC_DEBUG(); + + aft_chip_unconfigure(card); + if (used_cnt==1){ + aft_global_chip_disable(card); + } + return err; + } + wan_set_bit(AFT_CHIP_CONFIGURED,&card->u.aft.chip_cfg_status); + + if (wan_test_bit(AFT_FRONT_END_UP,&card->u.aft.chip_cfg_status)){ + wan_smp_flag_t smp_flags; + DEBUG_TEST("%s: Front end up, retrying enable front end!\n", + card->devname); + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); + handle_front_end_state(card); + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + + wan_clear_bit(AFT_FRONT_END_UP,&card->u.aft.chip_cfg_status); + } + + AFT_FUNC_DEBUG(); + + aft_read_security(card); + + + DEBUG_EVENT("%s: Configuring Device :%s FrmVr=%02X\n", + card->devname,card->devname,card->u.aft.firm_ver); + DEBUG_EVENT("%s: Global MTU = %d\n", + card->devname, + card->wandev.mtu); + DEBUG_EVENT("%s: Global MRU = %d\n", + card->devname, + card->u.aft.cfg.mru); + DEBUG_EVENT("%s: Data Mux Map = 0x%08X\n", + card->devname, + card->u.aft.cfg.data_mux_map); + DEBUG_EVENT("%s: Rx CRC Bytes = %i\n", + card->devname, + card->u.aft.cfg.rx_crc_bytes); + + wan_clear_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status); + wan_clear_bit(AFT_TDM_RING_BUF,&card->u.aft.chip_cfg_status); + + if (card->u.aft.firm_id == AFT_DS_FE_CORE_ID) { + if ((card->adptr_type == A108_ADPTR_8TE1 && + card->u.aft.firm_ver >= 0x27) || + (card->adptr_type == A104_ADPTR_4TE1 && + card->u.aft.firm_ver >= 0x26) || + (card->adptr_type == A101_ADPTR_2TE1 && + card->u.aft.firm_ver >= 0x26) || + (card->adptr_type == A101_ADPTR_1TE1 && + card->u.aft.firm_ver >= 0x26)) { + wan_set_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status); + wan_set_bit(AFT_TDM_RING_BUF,&card->u.aft.chip_cfg_status); + } + } else { + if ((card->adptr_type == A104_ADPTR_4TE1 && + card->adptr_subtype == AFT_SUBTYPE_SHARK && + card->u.aft.firm_ver >= 0x23)) { + wan_set_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status); + wan_set_bit(AFT_TDM_RING_BUF,&card->u.aft.chip_cfg_status); + } + } + + if(IS_BRI_CARD(card)){ + wan_set_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status); + wan_set_bit(AFT_TDM_RING_BUF,&card->u.aft.chip_cfg_status); + } + + DEBUG_EVENT("%s: Global TDM Int = %s\n", + card->devname, + wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status) ? + "Enabled" : "Disabled"); + + DEBUG_EVENT("%s: Global TDM Ring= %s\n", + card->devname, + wan_test_bit(AFT_TDM_RING_BUF,&card->u.aft.chip_cfg_status) ? + "Enabled" : "Disabled"); + + if (card->wandev.ec_dev){ + card->u.aft.tdmv_hw_dtmf = conf->tdmv_conf.hw_dtmf; + }else{ + card->u.aft.tdmv_hw_dtmf = WANOPT_NO; + } + DEBUG_EVENT("%s: TDM HW DTMF = %s\n", + card->devname, + (card->u.aft.tdmv_hw_dtmf == WANOPT_YES) ? + "Enabled" : "Disabled"); + + err=aft_tdmv_init(card,conf); + if (err){ + disable_comm(card); + return err; + } + + card->disable_comm = &disable_comm; + +#if defined(AFT_RTP_SUPPORT) + err=aft_rtp_config(card); + DEBUG_EVENT("%s: RTP TAP = %s\n", + card->devname, + err == 0 ? "Enabled" : "Disabled"); +#endif + + card->wandev.read_ec = aft_read_ec; + card->wandev.write_ec = aft_write_ec; + return 0; + +} + + + + +/**SECTION************************************************************** + * + * WANPIPE Device Driver Entry Points + * + * *********************************************************************/ + + + +/*============================================================================ + * update - Update wanpipe device status & statistics + * + * @wandev: Wanpipe device pointer + * + * This procedure is called when updating the PROC file system. + * It returns various communications statistics. + * + * cat /proc/net/wanrouter/wanpipe# (where #=1,2,3...) + * + * These statistics are accumulated from 3 + * different locations: + * 1) The 'if_stats' recorded for the device. + * 2) Communication error statistics on the adapter. + * 3) Operational statistics on the adapter. + * + * The board level statistics are read during a timer interrupt. + * Note that we read the error and operational statistics + * during consecitive timer ticks so as to minimize the time + * that we are inside the interrupt handler. + * + */ +static int update (wan_device_t* wandev) +{ + sdla_t* card = wandev->priv; + netdevice_t* dev; + volatile private_area_t* chan; + + /* sanity checks */ + if((wandev == NULL) || (wandev->priv == NULL)) + return -EFAULT; + + if(wandev->state == WAN_UNCONFIGURED) + return -ENODEV; + + if(wan_test_bit(PERI_CRIT, (void*)&card->wandev.critical)) + return -EAGAIN; + + dev = WAN_DEVLE2DEV(WAN_LIST_FIRST(&card->wandev.dev_head)); + if(dev == NULL) + return -ENODEV; + + if((chan=wan_netif_priv(dev)) == NULL) + return -ENODEV; + + if(card->update_comms_stats){ + return -EAGAIN; + } + + DEBUG_TEST("%s: Chain Dma Status=0x%lX, TxCur=%d, TxPend=%d RxCur=%d RxPend=%d\n", + chan->if_name, + chan->dma_chain_status, + chan->tx_chain_indx, + chan->tx_pending_chain_indx, + chan->rx_chain_indx, + chan->rx_pending_chain_indx); + +#if 1 + update_comms_stats(card); +#else + #warning "COMM STATS DISABLED" +#endif + return 0; +} + + + +/*============================================================================ + * new_if - Create new logical channel. + * + * &wandev: Wanpipe device pointer + * &dev: Network device pointer + * &conf: User configuration options pointer + * + * This routine is called by the ROUTER_IFNEW ioctl, + * in wanmain.c. The ioctl passes us the user configuration + * options which we use to configure the driver and + * firmware. + * + * This functions main purpose is to allocate the + * private structure for protocol and bind it + * to dev->priv pointer. + * + * Also the dev->init pointer should also be initialized + * to the if_init() function. + * + * Any allocation necessary for the private strucutre + * should be done here, as well as proc/ file initializetion + * for the network interface. + * + * o parse media- and hardware-specific configuration + * o make sure that a new channel can be created + * o allocate resources, if necessary + * o prepare network device structure for registaration. + * o add network interface to the /proc/net/wanrouter + * + * The opposite of this function is del_if() + * + * Return: 0 o.k. + * < 0 failure (channel will not be created) + */ + +static int +aft_tdm_api_init(sdla_t *card, private_area_t *chan, wanif_conf_t *conf) +{ +#ifdef AFT_TDM_API_SUPPORT + int err=0; +#endif + + if (chan->common.usedby != TDM_VOICE_API && + chan->common.usedby != TDM_VOICE_DCHAN) { + return 0; + } + +#ifdef AFT_TDM_API_SUPPORT + if (chan->tdmv_zaptel_cfg) { + return 0; + } + + /* Initilaize TDM API Parameters */ + chan->wp_tdm_api_dev.chan = chan; + chan->wp_tdm_api_dev.card = card; + wan_spin_lock_init(&chan->wp_tdm_api_dev.lock); + strncpy(chan->wp_tdm_api_dev.name,chan->if_name,WAN_IFNAME_SZ); + + if (conf->hdlc_streaming) { + chan->wp_tdm_api_dev.hdlc_framing=1; + } + + chan->wp_tdm_api_dev.event_ctrl = aft_event_ctrl; + chan->wp_tdm_api_dev.read_rbs_bits = aft_read_rbs_bits; + chan->wp_tdm_api_dev.write_rbs_bits = aft_write_rbs_bits; + chan->wp_tdm_api_dev.write_hdlc_frame = aft_write_hdlc_frame; + + chan->wp_tdm_api_dev.cfg.rx_disable = 0; + chan->wp_tdm_api_dev.cfg.tx_disable = 0; + + if (IS_TE1_CARD(card)) { + if (IS_T1_CARD(card)){ + chan->wp_tdm_api_dev.cfg.hw_tdm_coding=WP_MULAW; + chan->wp_tdm_api_dev.tdm_chan = chan->first_time_slot+1; + }else{ + chan->wp_tdm_api_dev.cfg.hw_tdm_coding=WP_ALAW; + chan->wp_tdm_api_dev.tdm_chan = chan->first_time_slot; + } + + } else if (IS_BRI_CARD(card)) { + + if (chan->dchan_time_slot >= 0) { + chan->wp_tdm_api_dev.tdm_chan = 3; + } else { + chan->wp_tdm_api_dev.tdm_chan = (chan->first_time_slot % 2) + 1; + } + + if (card->fe.fe_cfg.tdmv_law == WAN_TDMV_MULAW){ + chan->wp_tdm_api_dev.cfg.hw_tdm_coding=WP_MULAW; + } else { + chan->wp_tdm_api_dev.cfg.hw_tdm_coding=WP_ALAW; + } + + } else { + if (card->fe.fe_cfg.tdmv_law == WAN_TDMV_MULAW){ + chan->wp_tdm_api_dev.cfg.hw_tdm_coding=WP_MULAW; + chan->wp_tdm_api_dev.tdm_chan = chan->first_time_slot+1; + } else { + chan->wp_tdm_api_dev.cfg.hw_tdm_coding=WP_ALAW; + chan->wp_tdm_api_dev.tdm_chan = chan->first_time_slot+1; + } + + + } + + if (IS_T1_CARD(card) || IS_FXOFXS_CARD(card)){ + /* Convert active_ch bit map to user */ + chan->wp_tdm_api_dev.active_ch = conf->active_ch << 1; + }else{ + chan->wp_tdm_api_dev.active_ch = conf->active_ch; + } + + DEBUG_TEST("%s: TDM API ACTIVE CH 0x%08X CHAN=%i\n", + chan->if_name, chan->wp_tdm_api_dev.active_ch,chan->wp_tdm_api_dev.tdm_chan); + + chan->wp_tdm_api_dev.cfg.idle_flag = conf->u.aft.idle_flag; + chan->wp_tdm_api_dev.cfg.rbs_tx_bits = conf->u.aft.rbs_cas_idle; + + chan->wp_tdm_api_dev.tdm_span = card->tdmv_conf.span_no; + + chan->wp_tdm_api_dev.dtmfsupport = card->u.aft.tdmv_hw_dtmf; + + err=wanpipe_tdm_api_reg(&chan->wp_tdm_api_dev); + if (err){ + return err; + } + + wan_set_bit(0,&chan->wp_tdm_api_dev.init); + return err; +#else + DEBUG_EVENT("%s: TDM API support not compiled in\n", + card->devname); + return -EINVAL; +#endif + +} + +static int aft_tdm_api_free(sdla_t *card, private_area_t *chan) +{ +#ifdef AFT_TDM_API_SUPPORT + int err=0; + if (wan_test_bit(0,&chan->wp_tdm_api_dev.init)){ + wan_clear_bit(0,&chan->wp_tdm_api_dev.init); + err=wanpipe_tdm_api_unreg(&chan->wp_tdm_api_dev); + if (err){ + wan_set_bit(0,&chan->wp_tdm_api_dev.init); + return err; + } + } +#endif + return 0; +} + + + +static int aft_chan_if_init(sdla_t *card, netdevice_t *dev, private_area_t *chan) +{ + chan->first_time_slot=-1; + chan->last_time_slot=-1; + chan->logic_ch_num=-1; +#if defined(AFT_SINGLE_DMA_CHAIN) + chan->single_dma_chain=1; + chan->max_tx_bufs=MAX_AFT_DMA_CHAINS; +#else + chan->single_dma_chain=0; + chan->max_tx_bufs=MAX_TX_BUF; +#endif + chan->tslot_sync=0; + + strncpy(chan->if_name, wan_netif_name(dev), WAN_IFNAME_SZ); + + chan->card = card; + chan->common.card = card; + + WAN_IFQ_INIT(&chan->wp_tx_pending_list,0); + WAN_IFQ_INIT(&chan->wp_tx_complete_list,0); + WAN_IFQ_INIT(&chan->wp_tx_hdlc_rpt_list,0); + + WAN_IFQ_INIT(&chan->wp_rx_free_list,0); + WAN_IFQ_INIT(&chan->wp_rx_complete_list,0); + + WAN_IFQ_INIT(&chan->wp_rx_stack_complete_list, 0); + + WAN_IFQ_INIT(&chan->wp_rx_bri_dchan_complete_list, 0); + + wan_trace_info_init(&chan->trace_info,MAX_TRACE_QUEUE); + + /* Initiaize Tx/Rx DMA Chains */ + aft_index_tx_rx_dma_chains(chan); + + /* Initialize the socket binding information + * These hooks are used by the API sockets to + * bind into the network interface */ + WAN_TASKLET_INIT((&chan->common.bh_task),0,wp_bh,chan); + chan->common.dev = dev; + chan->tracing_enabled = 0; + + return 0; +} + + + +static int aft_ss7_if_init(sdla_t *card, private_area_t *chan, wanif_conf_t *conf) +{ + if (chan->common.usedby != API){ + /* SS7 Support not supported in non API mode */ + chan->cfg.ss7_enable = 0; + return 0; + } + + DEBUG_EVENT("%s: SS7 Support :%s\n", + card->devname, + chan->cfg.ss7_enable?"On":"Off"); + + if (chan->cfg.ss7_enable){ + + wan_smp_flag_t smp_flags; + u32 lcfg_reg; + + DEBUG_EVENT("%s: SS7 Mode :%s\n", + card->devname, + chan->cfg.ss7_mode?"4096":"128"); + + DEBUG_EVENT("%s: SS7 LSSU Size :%d\n", + card->devname, + chan->cfg.ss7_lssu_size); + + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG),&lcfg_reg); + if (chan->cfg.ss7_mode){ + aft_lcfg_ss7_mode4096_cfg(&lcfg_reg,chan->cfg.ss7_lssu_size); + }else{ + aft_lcfg_ss7_mode128_cfg(&lcfg_reg,chan->cfg.ss7_lssu_size); + } + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG), + lcfg_reg); + card->u.aft.lcfg_reg=lcfg_reg; + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + + aft_hwdev[card->wandev.card_type].aft_fifo_adjust(card,AFT_TDMV_FIFO_LEVEL); + chan->single_dma_chain=1; + } + + return 0; +} + +static int aft_transp_if_init(sdla_t *card, private_area_t *chan, wanif_conf_t *conf) +{ + unsigned char *buf; + + if (chan->mtu&0x03){ + DEBUG_EVENT("%s:%s: Error, Transparent MTU must be word aligned!\n", + card->devname,chan->if_name); + return -EINVAL; + } + + chan->max_idle_size=chan->mtu; + + if (chan->tslot_sync && chan->mtu%chan->num_of_time_slots){ + DEBUG_EVENT("%s:%s: Error, Sync Transparent MTU must be timeslot aligned!\n", + card->devname,chan->if_name); + + DEBUG_EVENT("%s:%s: Error, MTU=%d not multiple of %d timeslots!\n", + card->devname,chan->if_name, + chan->mtu,chan->num_of_time_slots); + + return -EINVAL; + } + + if (conf->protocol != WANCONFIG_LIP_ATM && + conf->protocol != WANCONFIG_LIP_KATM && + chan->mru%chan->num_of_time_slots){ + DEBUG_EVENT("%s:%s: Error, Transparent MRU must be timeslot aligned!\n", + card->devname,chan->if_name); + + DEBUG_EVENT("%s:%s: Error, MRU=%d not multiple of %d timeslots!\n", + card->devname,chan->if_name, + chan->mru,chan->num_of_time_slots); + + return -EINVAL; + } + + + DEBUG_TEST("%s:%s: Config for Transparent mode: Idle=%X Len=%u\n", + card->devname,chan->if_name, + chan->idle_flag,chan->max_idle_size); + + chan->idle_flag=0x7E; + + if (chan->tdmv_zaptel_cfg){ +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) + chan->idle_flag = WAN_TDMV_IDLE_FLAG; +#endif + } + + /* We use the dma_mru value here, just because it will + * be easier to change the idle tx size on the fly */ + chan->tx_idle_skb = wan_skb_alloc(chan->dma_mru); + if (!chan->tx_idle_skb){ + return -EINVAL; + } + buf = wan_skb_put(chan->tx_idle_skb,chan->dma_mru); + + if(conf->protocol != WANCONFIG_LIP_ATM && + conf->protocol != WANCONFIG_LIP_KATM){ + memset(buf,chan->idle_flag,chan->dma_mru); + }else{ + chan->lip_atm = 1; + /* if running below LIP ATM, transmit idle cells */ + if(init_atm_idle_buffer((unsigned char*)buf, + wan_skb_len(chan->tx_idle_skb), + chan->if_name, + chan->cfg.data_mux )){ + + wan_skb_free(chan->tx_idle_skb); + chan->tx_idle_skb = NULL; + return -EINVAL; + } + } + + /* reset the tx idle buffer to the actual mtu size */ + wan_skb_init(chan->tx_idle_skb,16); + wan_skb_trim(chan->tx_idle_skb,0); + wan_skb_put(chan->tx_idle_skb,chan->max_idle_size); + + return 0; +} + + +static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf, int channelized, int dchan) +{ + sdla_t* card = wandev->priv; + private_area_t* chan; + int dma_per_ch=card->u.aft.cfg.dma_per_ch; + int err = 0, dma_alignment = 4, i =0; + + DEBUG_EVENT( "%s: Configuring Interface: %s\n", + card->devname, wan_netif_name(dev)); + + if ((conf->name[0] == '\0') || (strlen(conf->name) > WAN_IFNAME_SZ)){ + DEBUG_EVENT( "%s: Invalid interface name!\n", + card->devname); + return -EINVAL; + } + + if (card->adptr_subtype != AFT_SUBTYPE_SHARK){ + if (card->u.aft.security_id != 0x01 && + card->u.aft.security_cnt >= 2){ + DEBUG_EVENT("%s: Error: Security: Max HDLC channels(2) exceeded!\n", + card->devname); + DEBUG_EVENT("%s: Un-Channelised AFT supports 2 HDLC ifaces!\n", + card->devname); + return -EINVAL; + } + } + + /* ====================================== + * Allocate and initialize private data + * =====================================*/ + + chan = wan_kmalloc(sizeof(private_area_t)); + if(chan == NULL){ + WAN_MEM_ASSERT(card->devname); + return -ENOMEM; + } + + memset(chan, 0, sizeof(private_area_t)); + memcpy(&chan->cfg,&conf->u.aft,sizeof(chan->cfg)); + + chan->true_if_encoding=conf->true_if_encoding; + + aft_chan_if_init(card,dev,chan); + + if (card->wandev.config_id == WANCONFIG_AFT_ANALOG) { + chan->single_dma_chain = 1; + conf->hdlc_streaming=0; + } + + if (card->wandev.config_id == WANCONFIG_AFT_ISDN_BRI) { + chan->single_dma_chain = 1; + } + + /* If 'dchan_time_slot' is less than zero, it is NOT a dchan. + If 'dchan_time_slot' is greater or equal to zero it is a dchan. + NOTE: 'dchan' is NOT the same as 'hdlc_eng'. The 'hdlc_eng' is + a flag for AFT hardware to use it's HDLC core. + */ + chan->dchan_time_slot = dchan; + + DEBUG_BRI_DCHAN("%s(): chan->dchan_time_slot: 0x%X\n", __FUNCTION__, chan->dchan_time_slot); + + if(IS_56K_CARD(card)){ + chan->single_dma_chain = 1; + conf->hdlc_streaming=1; + } + + if (chan->cfg.hdlc_repeat) { + if (!conf->hdlc_streaming) { + DEBUG_EVENT("%s: HDLC Repeat configured for non hdlc channel!\n", + chan->if_name); + err= -EINVAL; + goto new_if_error; + } + chan->single_dma_chain = 1; + conf->hdlc_streaming=1; + } + + if (channelized) { + chan->channelized_cfg=1; + if (wan_netif_priv(dev)) { +#if 1 + private_area_t *cptr; + for (cptr=wan_netif_priv(dev);cptr->next!=NULL;cptr=cptr->next); + cptr->next=chan; + chan->next=NULL; +#else +#warning "DEBUG: Chan list backwards!" + chan->next = wan_netif_priv(dev); + wan_netif_set_priv(dev, chan); +#endif + } else { + wan_netif_set_priv(dev, chan); + } + } else { + chan->channelized_cfg=0; + wan_netif_set_priv(dev, chan); + } + + /* ====================================== + * Configure chan MTU and MRU Values + * And setup E1 timeslots + * =====================================*/ + chan->mtu = card->wandev.mtu; + if (conf->u.aft.mtu){ + chan->mtu=conf->u.aft.mtu; + if (chan->mtu > MAX_WP_PRI_MTU || + chan->mtu < MIN_WP_PRI_MTU){ + DEBUG_EVENT("%s: Error Invalid %s MTU %d (Min=%d, Max=%d)\n", + card->devname,chan->if_name,chan->mtu, + MIN_WP_PRI_MTU,MAX_WP_PRI_MTU); + + err= -EINVAL; + goto new_if_error; + } + + } + + chan->mru = card->u.aft.cfg.mru; + if (conf->u.aft.mru){ + chan->mru = conf->u.aft.mru; + if (chan->mru > MAX_WP_PRI_MTU || + chan->mru < MIN_WP_PRI_MTU){ + DEBUG_EVENT("%s: Error Invalid %s MRU %d (Min=%d, Max=%d)\n", + card->devname,chan->if_name,chan->mru, + MIN_WP_PRI_MTU,MAX_WP_PRI_MTU); + + err= -EINVAL; + goto new_if_error; + } + } + + /*==================================================== + * Interface connects top services to driver + * Interface can be used by the following services: + * WANPIPE = TCP/IP -> Driver + * API = Raw Socket Access -> Driver + * BRIDGE = Bridge to Ethernet -> Driver + * BRIDGE_NODE = TCP/IP to Ethernet -> Driver + * STACK = LIP -> Driver + * TDM_VOICE = Zaptel -> Trans Ch Driver + * TDM_VOICE_DCHAN = Zaptel -> Hdlc Driver (PRIVATE) + * TDM_VOICE_API = Raw Socket -> Transp Ch Driver + * TMD_API = Raw Socket -> Transp Channelized API + *===================================================*/ + + if(strcmp(conf->usedby, "WANPIPE") == 0) { + + DEBUG_EVENT( "%s: Running in WANPIPE mode\n", + wandev->name); + chan->common.usedby = WANPIPE; + + /* Used by GENERIC driver only otherwise protocols + * are in LIP layer */ + if (conf->protocol != WANOPT_NO){ + wan_netif_set_priv(dev, chan); + if ((err=protocol_init(card,dev,chan,conf)) != 0){ + wan_netif_set_priv(dev, NULL); + goto new_if_error; + } + } + +#if defined(__LINUX__) + + } else if( strcmp(conf->usedby, "TDM_API") == 0) { + + DEBUG_EVENT("%s:%s: Error: TDM API mode is not supported!\n", + card->devname,chan->if_name); + err=-EINVAL; + goto new_if_error; +#endif + +#if defined(AFT_API_SUPPORT) + } else if( strcmp(conf->usedby, "API") == 0) { + chan->common.usedby = API; + DEBUG_EVENT( "%s:%s: Running in API mode\n", + wandev->name,chan->if_name); + wan_reg_api(chan, dev, card->devname); + card->wandev.event_callback.dtmf = wan_aft_api_dtmf; + card->wandev.event_callback.hook = wan_aft_api_hook; + card->wandev.event_callback.ringtrip = wan_aft_api_ringtrip; + card->wandev.event_callback.ringdetect = wan_aft_api_ringdetect; +#endif + +#if defined(__LINUX__) + }else if (strcmp(conf->usedby, "BRIDGE") == 0) { + chan->common.usedby = BRIDGE; + DEBUG_EVENT( "%s:%s: Running in WANPIPE (BRIDGE) mode.\n", + card->devname,chan->if_name); +#endif + +#if defined(__LINUX__) + }else if (strcmp(conf->usedby, "BRIDGE_N") == 0) { + chan->common.usedby = BRIDGE_NODE; + DEBUG_EVENT( "%s:%s: Running in WANPIPE (BRIDGE_NODE) mode.\n", + card->devname,chan->if_name); +#endif + + }else if (strcmp(conf->usedby, "TDM_VOICE") == 0) { + +#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE + chan->common.usedby = TDM_VOICE; + + chan->tdmv_zaptel_cfg=1; + card->u.aft.tdmv_zaptel_cfg=1; + conf->hdlc_streaming=0; + chan->single_dma_chain=1; + chan->max_tx_bufs=MAX_AFT_DMA_CHAINS; + + if (dchan >= 0){ +# ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN + chan->common.usedby = TDM_VOICE_DCHAN; + conf->hdlc_streaming=1; + chan->single_dma_chain=0; + chan->mru=chan->mtu=1500; +# else + DEBUG_EVENT("%s: Error: TDMV_DCHAN Option not compiled into the driver!\n", + card->devname); + err=-EINVAL; + goto new_if_error; +# endif + } + + DEBUG_EVENT( "%s:%s: Running in TDM %sVoice Zaptel Mode.\n", + card->devname,chan->if_name, + chan->common.usedby == TDM_VOICE_DCHAN?"DCHAN ":""); +#else + DEBUG_EVENT("\n"); + DEBUG_EVENT("%s:%s: Error: TDM VOICE prot not compiled\n", + card->devname,chan->if_name); + DEBUG_EVENT("%s:%s: during installation process!\n", + card->devname,chan->if_name); + err=-EINVAL; + goto new_if_error; +#endif + +#if defined(__LINUX__) + }else if (strcmp(conf->usedby, "TDM_VOICE_API") == 0) { + + chan->common.usedby = TDM_VOICE_API; + chan->cfg.data_mux=1; + conf->hdlc_streaming=0; + chan->single_dma_chain=1; + chan->tdmv_zaptel_cfg=0; + + if (dchan >= 0){ + chan->common.usedby = TDM_VOICE_DCHAN; + chan->cfg.data_mux=0; + chan->single_dma_chain=0; + conf->hdlc_streaming=1; + chan->mru=chan->mtu=1500; + } + + + if (chan->common.usedby == TDM_VOICE_DCHAN) { + DEBUG_EVENT( "%s:%s: Running in TDM Voice DCHAN API Mode.\n", + card->devname,chan->if_name); + } else { + DEBUG_EVENT( "%s:%s: Running in TDM Voice API Mode.\n", + card->devname,chan->if_name); + } +#endif + + }else if (strcmp(conf->usedby, "STACK") == 0) { + chan->common.usedby = STACK; + DEBUG_EVENT( "%s:%s: Running in Stack mode.\n", + card->devname,chan->if_name); + + }else if (strcmp(conf->usedby, "NETGRAPH") == 0) { + chan->common.usedby = WP_NETGRAPH; + DEBUG_EVENT( "%s:%s: Running in Netgraph mode.\n", + card->devname,chan->if_name); + + }else{ + DEBUG_EVENT( "%s:%s: Error: Invalid IF operation mode %s\n", + card->devname,chan->if_name,conf->usedby); + err=-EINVAL; + goto new_if_error; + } + + + /*=============================================== + * Interface Operation Setup + *==============================================*/ + + if (conf->hwec.enable){ + card->wandev.ec_enable_map |= conf->active_ch; + } + + /* Read user specified active_ch, we must do it + * here because the active_ch value might change + * for different user modes*/ + chan->time_slot_map=conf->active_ch; + chan->num_of_time_slots= + aft_get_num_of_slots(card->u.aft.num_of_time_slots, + chan->time_slot_map); + + if (!chan->num_of_time_slots){ + DEBUG_EVENT("%s: Error: Invalid number of timeslots in map 0x%08lX!\n", + chan->if_name,chan->time_slot_map); + return -EINVAL; + } + + if (card->wandev.config_id == WANCONFIG_AFT_ANALOG && chan->num_of_time_slots > 1) { + DEBUG_EVENT( + "%s: Error: Invalid Analog number of timeslots in map 0x%08lX: (Valid=1)\n", + chan->if_name,chan->time_slot_map); + return -EINVAL; + } + + + /* ===================== + * Interaface TDMV Setup + * + * Initialize the interface for TDMV + * operation, if TDMV is not used this + * function will just return */ + err=aft_tdmv_if_init(card,chan,conf); + if (err){ + err=-EINVAL; + goto new_if_error; + } + + + /* ===================== + * Interaface SS7 Setup + * + * Initialize the interface for TDMV + * operation, if TDMV is not used this + * function will just return */ + err=aft_ss7_if_init(card,chan,conf); + if (err){ + err=-EINVAL; + goto new_if_error; + } + + + /* Print out the current configuration */ + DEBUG_EVENT("%s: MRU :%d\n", + card->devname, + chan->mru); + + DEBUG_EVENT("%s: MTU :%d\n", + card->devname, + chan->mtu); + + + chan->hdlc_eng = conf->hdlc_streaming; + + DEBUG_EVENT("%s: HDLC Eng :%s | %s\n", + card->devname, + chan->hdlc_eng?"On":"Off (Transparent)", + chan->cfg.hdlc_repeat?"Repeat":"N/A"); + + + /* Obtain the DMA MRU size based on user confgured + * MRU. The DMA MRU must be of size 2^x */ + + chan->dma_mru = chan->mtu; + + chan->dma_mru = aft_valid_mtu(chan->dma_mru); + if (!chan->dma_mru){ + DEBUG_EVENT("%s:%s: Error invalid MTU %d MRU %d\n", + card->devname, + chan->if_name, + chan->mtu,chan->mru); + err= -EINVAL; + goto new_if_error; + } + + if (conf->single_tx_buf || + IS_BRI_CARD(card) || + ((card->adptr_type == A101_ADPTR_2TE1 || + card->adptr_type == A101_ADPTR_1TE1) && + card->u.aft.firm_id == AFT_DS_FE_CORE_ID)){ + chan->single_dma_chain=1; + chan->max_tx_bufs=MAX_AFT_DMA_CHAINS; + dma_per_ch=MAX_AFT_DMA_CHAINS; + } + + + if (!chan->hdlc_eng){ + /* If hardware HDLC engine is disabled: + * 1. Configure DMA chains for SINGLE DMA + * 2. Enable Timeslot Synchronization + * 3. Configure Interface for Transparent Operation */ + chan->single_dma_chain=1; + chan->max_tx_bufs=MAX_AFT_DMA_CHAINS; + + if (chan->channelized_cfg) { + dma_per_ch=MAX_AFT_DMA_CHAINS; + }else{ + dma_per_ch= (MAX_AFT_DMA_CHAINS*1500) / chan->mtu; + if (dma_per_ch < MAX_AFT_DMA_CHAINS) { + dma_per_ch=MAX_AFT_DMA_CHAINS; + } + } + + chan->tslot_sync=1; + + if(conf->protocol == WANCONFIG_LIP_ATM || + conf->protocol == WANCONFIG_LIP_KATM){ + chan->tslot_sync=0; + } + + err=aft_transp_if_init(card,chan,conf); + if (err){ + goto new_if_error; + } + + }else{ + /* If hardware HDLC engine is enabled: + * 1. Force Disable DATA MUX option + * just in case user made a mistake + */ + chan->cfg.data_mux=0; + } + DEBUG_EVENT("%s: Data Mux Ctrl :%s\n", + card->devname, + chan->cfg.data_mux?"On":"Off"); + + + + + /*================================================= + * AFT CHANNEL Configuration + * + * Configure the AFT Hardware for this + * logic channel. Enable the above selected + * operation modes. + *================================================*/ + + err=aft_dev_configure(card,chan,conf); + if (err){ + goto new_if_error; + } + + /*Set the actual logic ch number of this chan + *as the dchan. Due to HDLC security issue, the + *HDLC channels are mapped on first TWO logic channels */ + if (chan->common.usedby == TDM_VOICE_DCHAN){ + card->u.aft.tdmv_dchan=chan->logic_ch_num+1; + } + + /* Configure the DCHAN on LAST Master interface. + * We will use the master interface information, until + * the next interface with the current DCHAN info is + * configured. This must be done in order to register + * the DCHAN in zaptel. */ + if (card->u.aft.tdmv_dchan_cfg_on_master && + card->u.aft.tdmv_dchan){ + int dchan=card->u.aft.tdmv_dchan; + if (IS_T1_CARD(card)){ + dchan--; + } + if (wan_test_bit(dchan,&conf->active_ch)){ + DEBUG_EVENT("%s: TDMV DCHAN :%d\n", + card->devname,dchan); + card->u.aft.tdmv_chan_ptr=chan; + card->u.aft.tdmv_dchan=chan->logic_ch_num+1; + } + } + + + err=aft_tdm_api_init(card,chan,conf); + if (err){ + goto new_if_error; + } + + err=aft_hwec_config(card,chan,conf,1); + if (err){ + goto new_if_error; + } + + if (chan->channelized_cfg && !chan->hdlc_eng) { + chan->dma_mru = 1024; + dma_per_ch = 4; + } + + DEBUG_EVENT("%s: DMA/Len/Chain/EC :%d/%d/%s/%s\n", + card->devname, + dma_per_ch, + chan->dma_mru, + chan->single_dma_chain?"Off":"On", + card->wandev.ec_enable_map?"On":"Off"); + + /* New DMA support A-DMA */ + dma_alignment = 4; + if (chan->channelized_cfg && !chan->hdlc_eng){ + dma_alignment = 0x200; + } + + err = card->hw_iface.busdma_tag_create( card->hw, + &chan->rx_dma_chain_table[0], + dma_alignment, + chan->dma_mru, + MAX_AFT_DMA_CHAINS); + if (err) { + DEBUG_EVENT("%s: Failed to allocate DMA Rx mtag!\n", + card->devname); + err = -EINVAL; + goto new_if_error; + } + err = card->hw_iface.busdma_tag_create( card->hw, + &chan->tx_dma_chain_table[0], + dma_alignment, + chan->dma_mru, + MAX_AFT_DMA_CHAINS); + if (err) { + DEBUG_EVENT("%s: Failed to allocate DMA Tx mtag!\n", + card->devname); + err = card->hw_iface.busdma_tag_destroy( + card->hw, + &chan->rx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS); + err = -EINVAL; + goto new_if_error; + } + + for (i=0;ihw_iface.busdma_alloc(card->hw,&chan->tx_dma_chain_table[i]); + if (err){ + DEBUG_EVENT("%s:%s: Unable to load TX DMA buffer %d (%d)!\n", + card->devname, chan->if_name, i, err); + err = -EINVAL; + break; + } + DEBUG_DMA("%s:%s: Alloc DMA TX buffer %d virt=%p len=%d\n", + card->devname, chan->if_name, i, + chan->tx_dma_chain_table[i].dma_virt, + chan->dma_mru); + + err = card->hw_iface.busdma_alloc(card->hw,&chan->rx_dma_chain_table[i]); + if (err){ + DEBUG_EVENT("%s:%s: Unable to load RX DMA buffer %d (%d)!\n", + card->devname, chan->if_name, i, err); + err = -EINVAL; + break; + } + DEBUG_DMA("%s:%s: Alloc DMA RX buffer %d virt=%p len=%d\n", + card->devname, chan->if_name, i, + chan->rx_dma_chain_table[i].dma_virt, + chan->dma_mru); + } + if (err){ + + for (i=0;ihw_iface.busdma_free(card->hw,&chan->rx_dma_chain_table[i]); + card->hw_iface.busdma_free(card->hw,&chan->tx_dma_chain_table[i]); + } + err = card->hw_iface.busdma_tag_destroy( + card->hw, + &chan->rx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS); + err = card->hw_iface.busdma_tag_destroy( + card->hw, + &chan->tx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS); + err = -EINVAL; + goto new_if_error; + } + + + err=aft_alloc_rx_dma_buff(card, chan, dma_per_ch,0); + if (err){ + goto new_if_error; + } + + /*======================================================= + * Interface OS Specific Configuration + *======================================================*/ + + + /* If gateway option is set, then this interface is the + * default gateway on this system. We must know that information + * in case DYNAMIC interface configuration is enabled. + * + * I.E. If the interface is brought down by the driver, the + * default route will also be removed. Once the interface + * is brought back up, we must know to re-astablish the + * default route. + */ + if ((chan->gateway = conf->gateway) == WANOPT_YES){ + DEBUG_EVENT( "%s: Interface %s is set as a gateway.\n", + card->devname,chan->if_name); + } + + /* Get Multicast Information from the user + * FIXME: This is IP relevant, since this is now + * a hardware interface this option should't + * be here */ + chan->mc = conf->mc; + + + /* The network interface "dev" has been passed as + * an argument from the above layer. We must initialize + * it so it can be registered into the kernel. + * + * The "dev" structure is the link between the kernel + * stack and the wanpipe driver. It contains all + * access hooks that kernel uses to communicate to + * the our driver. + * + * For now, just set the "dev" name to the user + * defined name and initialize: + * dev->if_init : function that will be called + * to further initialize + * dev structure on "ifconfig up" + * + * dev->priv : private structure allocated above + * + */ + + + /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * + * DO NOT PLACE ANY CODE BELOW THAT COULD RETURN ERROR + * + *!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ + + + /* Only setup the dev pointer once the new_if function has + * finished successfully. DO NOT place any code below that + * can return an error */ +#if defined(__LINUX__) + dev->init = &if_init; +# if defined(CONFIG_PRODUCT_WANPIPE_GENERIC) + if_init(dev); +# endif +#else + chan->common.is_netdev = 1; + chan->common.iface.open = &if_open; + chan->common.iface.close = &if_close; + chan->common.iface.output = &if_send; + chan->common.iface.ioctl = &if_do_ioctl; + chan->common.iface.tx_timeout= &if_tx_timeout; + if (wan_iface.attach){ + if (!ifunit(wan_netif_name(dev))){ + wan_iface.attach(dev, NULL, chan->common.is_netdev); + } + }else{ + DEBUG_EVENT("%s: Failed to attach interface %s!\n", + card->devname, wan_netif_name(dev)); + wan_netif_set_priv(dev, NULL); + err = -EINVAL; + goto new_if_error; + } + wan_netif_set_mtu(dev, chan->mtu); +#endif + + /* + * Increment the number of network interfaces + * configured on this card. + */ + wan_atomic_inc(&card->wandev.if_cnt); + if (chan->hdlc_eng){ + ++card->u.aft.security_cnt; + } + + + + /* Keep the original tx queue len in case + we have to go back to it */ + chan->max_tx_bufs_orig = chan->max_tx_bufs; + + set_chan_state(card, dev, WAN_CONNECTING); //chan->common.state = WAN_CONNECTING; + + DEBUG_EVENT( "\n"); + + return 0; + +new_if_error: + + return err; +} + +static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) +{ + int err=-EINVAL; + sdla_t *card=wandev->priv; + + wan_netif_set_priv(dev, NULL); + + if (IS_E1_CARD(card) && !(WAN_FE_FRAME(&card->fe) == WAN_FR_UNFRAMED)) { + conf->active_ch = conf->active_ch << 1; + wan_clear_bit(0,&conf->active_ch); + }else if (IS_56K_CARD(card)) { + conf->active_ch = 1; + } + + + if (strcmp(conf->usedby, "TDM_VOICE") == 0) { +#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE + if (card->tdmv_conf.span_no){ + + switch(card->wandev.config_id){ + case WANCONFIG_AFT_ANALOG: + err = wp_tdmv_remora_init(&card->tdmv_iface); + break; + case WANCONFIG_AFT_ISDN_BRI: + err = wp_tdmv_bri_init(&card->tdmv_iface); + break; + default: + err = wp_tdmv_te1_init(&card->tdmv_iface); + break; + } + if (err){ + DEBUG_EVENT("%s: Error: Failed to initialize tdmv functions!\n", + card->devname); + return -EINVAL; + } + + WAN_TDMV_CALL(create, (card, &card->tdmv_conf), err); + if (err){ + DEBUG_EVENT("%s: Error: Failed to create tdmv span!\n", + card->devname); + return err; + } + } +#else + DEBUG_EVENT("\n"); + DEBUG_EVENT("%s: Error: TDM VOICE prot not compiled\n", + card->devname); + DEBUG_EVENT("%s: during installation process!\n", + card->devname); + return -EINVAL; +#endif + } + + err=-EINVAL; + + if (strcmp(conf->usedby, "TDM_VOICE") == 0 || strcmp(conf->usedby, "TDM_VOICE_API") == 0){ + + int i=0,master_if=-1; + u32 active_ch=conf->active_ch; + + if(IS_BRI_CARD(card)) { + wan_set_bit(BRI_DCHAN_LOGIC_CHAN,&card->u.aft.tdmv_dchan); + } + + if (card->wandev.fe_iface.active_map){ + conf->active_ch = card->wandev.fe_iface.active_map(&card->fe, 0); + + if(IS_BRI_CARD(card)) { + wan_set_bit(BRI_DCHAN_LOGIC_CHAN,&conf->active_ch); + wan_set_bit(BRI_DCHAN_LOGIC_CHAN,&card->tdmv_conf.dchan); + } + + active_ch=conf->active_ch; + } + + err=aft_find_master_if_and_dchan(card,&master_if,active_ch); + if (err < 0) { + return err; + } + + DEBUG_TEST("%s: TDM VOICE: TESTING FOR DCHAN CHAN in 0x%08X Timeslots=%i CFG DCHAN=0x%08X MasterIF=%i\n", + card->devname, active_ch, card->u.aft.num_of_time_slots, + card->tdmv_conf.dchan,master_if); + + for (i=0;iu.aft.num_of_time_slots;i++){ + + if (wan_test_bit(i,&active_ch)){ + int dchan=-1; + conf->active_ch=0; + conf->u.aft.tdmv_master_if=0; + wan_set_bit(i,&conf->active_ch); + if (wan_test_bit(i,&card->tdmv_conf.dchan)){ + dchan=i; + } + if (i==master_if){ + conf->u.aft.tdmv_master_if=1; + } + + err=new_if_private(wandev,dev,conf,1,dchan); + if (err){ + break; + } + } + } + +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) + if (!err && card->u.aft.tdmv_zaptel_cfg){ + WAN_TDMV_CALL(software_init, (&card->wan_tdmv), err); + } +#endif + }else{ + + if(IS_BRI_CARD(card) && wan_test_bit(BRI_DCHAN_ACTIVE_CFG_CHAN, &conf->active_ch)) { + + /* if bit 2 is set, user wants to run on the bri dchan */ + wan_set_bit(BRI_DCHAN_LOGIC_CHAN, &card->u.aft.tdmv_dchan); + card->u.aft.tdmv_dchan = BRI_DCHAN_LOGIC_CHAN; + err=new_if_private(wandev,dev,conf,0, BRI_DCHAN_LOGIC_CHAN); + + } else { + + card->tdmv_conf.dchan=0; + err=new_if_private(wandev,dev,conf,0,-1); + } + } + + if (err == 0 && wan_netif_priv(dev)) { + wan_smp_flag_t flags; + int card_use_counter; + + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &card_use_counter); + + /* If FRONT End is down, it means that the DMA + * is disabled. In this case don't try to + * reset fifo. Let the enable_data_error_intr() + * function do this, after front end has come up */ + + wan_spin_lock_irq(&card->wandev.lock,&flags); + + aft_dev_open(card, wan_netif_priv(dev)); + + if (card->wandev.state == WAN_CONNECTED){ + set_chan_state(card, dev, WAN_CONNECTED); + } + wan_spin_unlock_irq(&card->wandev.lock,&flags); + + if (card->wandev.config_id == WANCONFIG_AFT_ANALOG || + card->wandev.config_id == WANCONFIG_AFT_ISDN_BRI) { + wan_spin_lock_irq(&card->wandev.lock,&flags); + card->fe.fe_status = FE_CONNECTED; + handle_front_end_state(card); + set_chan_state(card, dev, WAN_CONNECTED); + wan_spin_unlock_irq(&card->wandev.lock,&flags); + } + + } else if (err && wan_netif_priv(dev)){ + del_if(wandev,dev); + if (wan_netif_priv(dev)){ + wan_free(wan_netif_priv(dev)); + wan_netif_set_priv(dev, NULL); + } + } + + return err; +} + + +/*============================================================================ + * del_if - Delete logical channel. + * + * @wandev: Wanpipe private device pointer + * @dev: Netowrk interface pointer + * + * This function is called by ROUTER_DELIF ioctl call + * to deallocate the network interface. + * + * The network interface and the private structure are + * about to be deallocated by the upper layer. + * We have to clean and deallocate any allocated memory. + * + * NOTE: DO NOT deallocate dev->priv here! It will be + * done by the upper layer. + * + */ +static int del_if_private (wan_device_t* wandev, netdevice_t* dev) +{ + private_area_t* chan = wan_netif_priv(dev); + sdla_t* card; + wan_smp_flag_t flags; + int i; + + if (!chan){ + DEBUG_EVENT("%s: Critical Error del_if_private() chan=NULL!\n", + wan_netif_name(dev)); + return 0; + } + + card = chan->card; + if (!card){ + DEBUG_EVENT("%s: Critical Error del_if_private() chan=NULL!\n", + wan_netif_name(dev)); + return 0; + } + + aft_hwec_config(card,chan,NULL,0); + + wan_spin_lock_irq(&card->wandev.lock,&flags); + aft_dev_unconfigure(card,chan); + wan_spin_unlock_irq(&card->wandev.lock,&flags); + + AFT_FUNC_DEBUG(); +#if INIT_FE_ONLY + return 0; +#endif + + WAN_TASKLET_KILL(&chan->common.bh_task); + + if (chan->common.usedby == API){ + wan_unreg_api(chan, card->devname); + + } + + if (aft_tdm_api_free(card,chan)) { + DEBUG_EVENT("%s: Error: Failed to del iface: TDM API Device in use!\n", + chan->if_name); + return -EBUSY; + } + + wan_spin_lock_irq(&card->wandev.lock,&flags); + aft_tdmv_if_free(card,chan); + wan_spin_unlock_irq(&card->wandev.lock,&flags); + + protocol_shutdown(card,dev); + +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) + if (wan_iface.detach){ + wan_iface.detach(dev, chan->common.is_netdev); + } +#endif + + /* We must set used by to API because + * the free_tx and free_rx are not allowed + * for TDM_VOICE mode in regular operation */ + + + wan_spin_lock_irq(&card->wandev.lock,&flags); + + chan->common.usedby = API; + + aft_free_tx_descriptors(chan); + aft_free_rx_descriptors(chan); + + for (i=0;ihw_iface.busdma_free(card->hw,&chan->rx_dma_chain_table[i]); + card->hw_iface.busdma_free(card->hw,&chan->tx_dma_chain_table[i]); + } + card->hw_iface.busdma_tag_destroy( + card->hw, + &chan->rx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS); + card->hw_iface.busdma_tag_destroy( + card->hw, + &chan->tx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS); + + WAN_IFQ_DMA_PURGE(&chan->wp_rx_free_list); + WAN_IFQ_DESTROY(&chan->wp_rx_free_list); + + WAN_IFQ_PURGE(&chan->wp_rx_complete_list); + WAN_IFQ_DESTROY(&chan->wp_rx_complete_list); + + WAN_IFQ_PURGE(&chan->wp_rx_stack_complete_list); + WAN_IFQ_DESTROY(&chan->wp_rx_stack_complete_list); + + WAN_IFQ_PURGE(&chan->wp_tx_pending_list); + WAN_IFQ_DESTROY(&chan->wp_tx_pending_list); + + WAN_IFQ_PURGE(&chan->wp_rx_bri_dchan_complete_list); + WAN_IFQ_DESTROY(&chan->wp_rx_bri_dchan_complete_list); + + WAN_IFQ_PURGE(&chan->wp_tx_complete_list); + WAN_IFQ_DESTROY(&chan->wp_tx_complete_list); + + if (chan->tx_idle_skb){ + wan_skb_free(chan->tx_idle_skb); + chan->tx_idle_skb=NULL; + } + + if (chan->tx_realign_buf){ + wan_free(chan->tx_realign_buf); + chan->tx_realign_buf=NULL; + } + + if (chan->tx_ss7_realign_buf){ + wan_free(chan->tx_ss7_realign_buf); + chan->tx_ss7_realign_buf=NULL; + } + + if (card->u.aft.tdmv_chan_ptr == chan){ + card->u.aft.tdmv_chan_ptr=NULL; + } + + chan->logic_ch_num=-1; + wan_spin_unlock_irq(&card->wandev.lock,&flags); + + /* Delete interface name from proc fs. */ +#if 0 + wanrouter_proc_delete_interface(wandev, chan->if_name); +#endif + + /* Decrement the number of network interfaces + * configured on this card. + */ + wan_atomic_dec(&card->wandev.if_cnt); + if (chan->hdlc_eng){ + --card->u.aft.security_cnt; + } + + DEBUG_SUB_MEM(sizeof(private_area_t)); + return 0; +} + +static int del_if (wan_device_t* wandev, netdevice_t* dev) +{ + private_area_t* chan=wan_netif_priv(dev); + wan_smp_flag_t flags; + sdla_t *card; + int card_use_cnt=0; + + + if (!chan){ + DEBUG_EVENT("%s: Critical Error del_if() chan=NULL!\n", + wan_netif_name(dev)); + return 0; + } + + if (!(card=chan->card)){ + DEBUG_EVENT("%s: Critical Error del_if() chan=NULL!\n", + wan_netif_name(dev)); + return 0; + } + + + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &card_use_cnt); + + wan_spin_lock_irq(&card->wandev.lock,&flags); + aft_dev_close(card,chan); + wan_spin_unlock_irq(&card->wandev.lock,&flags); + + if (chan->channelized_cfg) { + + sdla_t *card=chan->card; + +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) + if (chan->tdmv_zaptel_cfg) { + sdla_t *card=chan->card; + int err; + WAN_TDMV_CALL(running, (card), err); + if (err){ + return -EBUSY; + } + } +#endif + + /* Disable the TDMV Interrupt first, before + * shutting down all TDMV channels */ + wan_spin_lock_irq(&card->wandev.lock,&flags); + + if (IS_BRI_CARD(card)) { + int card_use_cnt; + + card->wandev.state=WAN_DISCONNECTED; + + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &card_use_cnt); + if (card_use_cnt == 1) { + DEBUG_BRI("%s: BRI Disabling TDMV INTR\n", + card->devname); + aft_tdm_intr_ctrl(card,0); + aft_fifo_intr_ctrl(card, 0); + } else { + u32 dmareg; + /* By removing timeslot out of the global + interrupt we can disable the tdm global isr. + This code re-triggers it just in case */ + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_DMA_CTRL_REG),&dmareg); + wan_set_bit(AFT_DMACTRL_TDMV_RX_TOGGLE,&dmareg); + wan_set_bit(AFT_DMACTRL_TDMV_TX_TOGGLE,&dmareg); + card->hw_iface.bus_write_4(card->hw, + AFT_PORT_REG(card,AFT_DMA_CTRL_REG),dmareg); + } + } else { + aft_tdm_intr_ctrl(card,0); + aft_fifo_intr_ctrl(card, 0); + } + + /* Disable RTP Tap */ + card->wandev.rtp_len=0; + +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) + if (card->wan_tdmv.sc) { + int err; + WAN_TDMV_CALL(state, (card, WAN_DISCONNECTED), err); + } +#endif + wan_spin_unlock_irq(&card->wandev.lock,&flags); + + while(chan){ + int err=del_if_private(wandev,dev); + if (err) { + return err; + } + if (chan->next) { + wan_netif_set_priv(dev, chan->next); + wan_free(chan); + chan = wan_netif_priv(dev); + } else { + /* Leave the last chan dev + * in dev->priv. It will get + * deallocated normally */ + break; + } + } + +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) + if (card->wan_tdmv.sc) { + aft_tdmv_free(card); + } +#endif + + return 0; + } else { + return del_if_private(wandev,dev); + } +} + + +/**SECTION*********************************************************** + * + * KERNEL Device Entry Interfaces + * + ********************************************************************/ + + + +/*============================================================================ + * if_init - Initialize Linux network interface. + * + * @dev: Network interface pointer + * + * During "ifconfig up" the upper layer calls this function + * to initialize dev access pointers. Such as transmit, + * stats and header. + * + * It is called only once for each interface, + * during Linux network interface registration. + * + * Returning anything but zero will fail interface + * registration. + */ +#if defined(__LINUX__) +static int if_init (netdevice_t* dev) +{ + private_area_t* chan = wan_netif_priv(dev); + sdla_t* card = chan->card; + wan_device_t* wandev = &card->wandev; +#if defined(CONFIG_PRODUCT_WANPIPE_GENERIC) + hdlc_device* hdlc; +#endif + + /* Initialize device driver entry points */ + dev->open = &if_open; + dev->stop = &if_close; +#if defined(CONFIG_PRODUCT_WANPIPE_GENERIC) + hdlc = dev_to_hdlc(dev); + hdlc->xmit = if_send; +#else + dev->hard_start_xmit = &if_send; +#endif + dev->get_stats = &if_stats; + +#if 0 + dev->tx_timeout = &if_tx_timeout; + dev->watchdog_timeo = 2*HZ; +#else + if (chan->common.usedby == TDM_VOICE || + chan->common.usedby == TDM_VOICE_DCHAN || + chan->common.usedby == TDM_VOICE_API){ + dev->tx_timeout = NULL; + }else{ + dev->tx_timeout = &if_tx_timeout; + } + dev->watchdog_timeo = 2*HZ; + +#endif + dev->do_ioctl = if_do_ioctl; + + if (chan->common.usedby == BRIDGE || + chan->common.usedby == BRIDGE_NODE){ + + /* Setup the interface for Bridging */ + int hw_addr=0; + ether_setup(dev); + + /* Use a random number to generate the MAC address */ + memcpy(dev->dev_addr, "\xFE\xFC\x00\x00\x00\x00", 6); + get_random_bytes(&hw_addr, sizeof(hw_addr)); + *(int *)(dev->dev_addr + 2) += hw_addr; + + }else{ + + dev->flags |= IFF_POINTOPOINT; + dev->flags |= IFF_NOARP; + dev->type = ARPHRD_PPP; + dev->mtu = chan->mtu; + dev->hard_header_len = 0; + dev->hard_header = NULL; + dev->rebuild_header = NULL; + + if (chan->common.usedby == API || chan->common.usedby == STACK){ + if (chan->hdlc_eng) { + dev->mtu = chan->dma_mru+sizeof(api_tx_hdr_t); + }else{ + dev->mtu = chan->mtu+sizeof(api_tx_hdr_t); + } + } + + /* Enable Mulitcasting if user selected */ + if (chan->mc == WANOPT_YES){ + dev->flags |= IFF_MULTICAST; + } + + if (chan->true_if_encoding){ + DEBUG_EVENT("%s: Setting IF Type to Broadcast\n",chan->if_name); + dev->type = ARPHRD_PPP; /* This breaks the tcpdump */ + dev->flags &= ~IFF_POINTOPOINT; + dev->flags |= IFF_BROADCAST; + }else{ + dev->type = ARPHRD_PPP; + } + } + + /* Initialize hardware parameters */ + dev->irq = wandev->irq; + dev->dma = wandev->dma; + dev->base_addr = wandev->ioport; + card->hw_iface.getcfg(card->hw, SDLA_MEMBASE, &dev->mem_start); + card->hw_iface.getcfg(card->hw, SDLA_MEMEND, &dev->mem_end); + + /* Set transmit buffer queue length + * If too low packets will not be retransmitted + * by stack. + */ + dev->tx_queue_len = 100; + return 0; +} +#endif + +/*============================================================================ + * if_open - Open network interface. + * + * @dev: Network device pointer + * + * On ifconfig up, this function gets called in order + * to initialize and configure the private area. + * Driver should be configured to send and receive data. + * + * This functions starts a timer that will call + * frmw_config() function. This function must be called + * because the IP addresses could have been changed + * for this interface. + * + * Return 0 if O.k. or errno. + */ +static int if_open (netdevice_t* dev) +{ + private_area_t* chan = wan_netif_priv(dev); + sdla_t* card = chan->card; + + + +#if defined(__LINUX__) + /* Only one open per interface is allowed */ + if (open_dev_check(dev)){ + DEBUG_EVENT("%s: Open dev check failed!\n", + wan_netif_name(dev)); + return -EBUSY; + } +#endif + + if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ + DEBUG_EVENT("%s:%s: Card down: Failed to open interface!\n", + card->devname,chan->if_name); + return -EINVAL; + } + + + /* Initialize the router start time. + * Used by wanpipemon debugger to indicate + * how long has the interface been up */ + wan_getcurrenttime(&chan->router_start_time, NULL); + +#if !defined(WANPIPE_IFNET_QUEUE_POLICY_INIT_OFF) + WAN_NETIF_START_QUEUE(dev); +#endif + + if (card->wandev.state == WAN_CONNECTED){ + set_chan_state(card, dev, WAN_CONNECTED); + WAN_NETIF_CARRIER_ON(dev); + } else { + WAN_NETIF_CARRIER_OFF(dev); + } + + /* Increment the module usage count */ + wanpipe_open(card); + + + /* Wait for the front end interrupt + * before enabling the card */ + return 0; +} + +/*============================================================================ + * if_close - Close network interface. + * + * @dev: Network device pointer + * + * On ifconfig down, this function gets called in order + * to cleanup interace private area. + * + * IMPORTANT: + * + * No deallocation or unconfiguration should ever occur in this + * function, because the interface can come back up + * (via ifconfig up). + * + * Furthermore, in dynamic interfacace configuration mode, the + * interface will come up and down to reflect the protocol state. + * + * Any deallocation and cleanup can occur in del_if() + * function. That function is called before the dev interface + * itself is deallocated. + * + * Thus, we should only stop the net queue and decrement + * the wanpipe usage counter via wanpipe_close() function. + */ + +static int if_close (netdevice_t* dev) +{ + private_area_t* chan = wan_netif_priv(dev); + sdla_t* card = chan->card; + + WAN_NETIF_STOP_QUEUE(dev); + +#if defined(LINUX_2_1) + dev->start=0; +#endif + protocol_stop(card,dev); + + wanpipe_close(card); + + return 0; +} + + +/*============================================================= + * disable_comm - Main shutdown function + * + * @card: Wanpipe device pointer + * + * The command 'wanrouter stop' has been called + * and the whole wanpipe device is going down. + * This is the last function called to disable + * all comunications and deallocate any memory + * that is still allocated. + * + * o Disable communications, turn off interrupts + * o Deallocate memory used, if any + * o Unconfigure TE1 card + */ + +static void disable_comm (sdla_t *card) +{ + wan_smp_flag_t smp_flags,smp_flags1; + int used_cnt; + + AFT_FUNC_DEBUG(); +#if INIT_FE_ONLY + aft_chip_unconfigure(card); +#else + + /* Unconfiging, only on shutdown */ + if (card->wandev.fe_iface.pre_release){ + card->wandev.fe_iface.pre_release(&card->fe); + } + card->hw_iface.hw_lock(card->hw,&smp_flags1); + wan_spin_lock_irq(&card->wandev.lock, &smp_flags); + __aft_fe_intr_ctrl(card, 0); + if (card->wandev.fe_iface.unconfig){ + card->wandev.fe_iface.unconfig(&card->fe); + } + __aft_fe_intr_ctrl(card, 1); + wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + card->hw_iface.hw_unlock(card->hw,&smp_flags1); + + /* Disable DMA ENGINE before we perform + * core reset. Otherwise, we will receive + * rx fifo errors on subsequent resetart. */ + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); + disable_data_error_intr(card,LINK_DOWN); +#if defined(AFT_RTP_SUPPORT) + aft_rtp_unconfig(card); +#endif + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + + aft_chip_unconfigure(card); + + /* Only disable the irq completely once the + chip unconfigure is executed */ + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); + disable_data_error_intr(card,DEVICE_DOWN); + wan_set_bit(CARD_DOWN,&card->wandev.critical); + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + + WP_DELAY(10); + + + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &used_cnt); + + card->hw_iface.hw_lock(card->hw,&smp_flags1); + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); + __aft_fe_intr_ctrl(card, 0); + aft_hwdev[card->wandev.card_type].aft_led_ctrl(card, WAN_AFT_RED, 0,WAN_AFT_ON); + aft_hwdev[card->wandev.card_type].aft_led_ctrl(card, WAN_AFT_GREEN, 0, WAN_AFT_ON); + __aft_fe_intr_ctrl(card, 1); + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + card->hw_iface.hw_unlock(card->hw,&smp_flags1); + + __sdla_pull_ptr_isr_array(card->hw,card,card->wandev.comm_port); + + if (used_cnt<=1){ + DEBUG_EVENT("%s: Global Chip Shutdown Usage=%d\n", + card->devname,used_cnt); + + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); + aft_global_chip_disable(card); + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + } + + +#if defined(WAN_DEBUG_MEM) + DEBUG_EVENT("%s: Total Mem %d\n",__FUNCTION__,wan_atomic_read(&wan_debug_mem)); +#endif +#endif + return; +} + + + +/*============================================================================ + * if_tx_timeout + * + * Kernel networking stack calls this function in case + * the interface has been stopped for TX_TIMEOUT seconds. + * + * This would occur if we lost TX interrupts or the + * card has stopped working for some reason. + * + * Handle transmit timeout event from netif watchdog + */ +static void if_tx_timeout (netdevice_t *dev) +{ + private_area_t* chan = wan_netif_priv(dev); + private_area_t* ch_ptr; + sdla_t *card = chan->card; + unsigned int cur_dma_ptr; + u32 reg,dma_ram_desc; + wan_smp_flag_t smp_flags; + + /* If our device stays busy for at least 5 seconds then we will + * kick start the device by making dev->tbusy = 0. We expect + * that our device never stays busy more than 5 seconds. So this + * is only used as a last resort. + */ + + WAN_NETIF_STATS_INC_COLLISIONS(&chan->common); //++chan->if_stats.collisions; + + DEBUG_EVENT( "%s: Transmit timed out on %s\n", + card->devname, + wan_netif_name(dev)); + + dma_ram_desc=chan->logic_ch_num*4+AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); + cur_dma_ptr=aft_dmachain_get_tx_dma_addr(reg); + + DEBUG_EVENT("%s: Chain TxPend=%d, TxCur=%d, TxPend=%d HwCur=%d TxA=%d TxC=%ld\n", + chan->if_name, + wan_test_bit(TX_INTR_PENDING,&chan->dma_chain_status), + chan->tx_chain_indx, + chan->tx_pending_chain_indx, + cur_dma_ptr, + chan->tx_attempts, + WAN_NETIF_STATS_TX_PACKETS(&chan->common)); + + if (wan_test_bit(TX_DMA_BUSY,&chan->dma_status)){ + wan_clear_bit(TX_DMA_BUSY,&chan->dma_status); + } + + wan_netif_set_ticks(dev, SYSTEM_TICKS); + +#ifdef AFT_TX_FIFO_DEBUG + aft_list_tx_descriptors(chan); +#endif + + wan_spin_lock_irq(&card->wandev.lock, &smp_flags); + if (chan->channelized_cfg){ + for (ch_ptr=chan;ch_ptr;ch_ptr=ch_ptr->next){ + aft_tx_fifo_under_recover(card,chan); + } + }else{ + aft_tx_fifo_under_recover(card,chan); + } + wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + +#ifdef AFT_TX_FIFO_DEBUG + aft_list_tx_descriptors(chan); +#endif + + wanpipe_wake_stack(chan); + +} + + +/*============================================================================ + * if_send - Send a packet on a network interface. + * + * @dev: Network interface pointer + * @skb: Packet obtained from the stack or API + * that should be sent out the port. + * + * o Mark interface as stopped + * (marks start of the transmission) to indicate + * to the stack that the interface is busy. + * + * o Check link state. + * If link is not up, then drop the packet. + * + * o Copy the tx packet into the protocol tx buffers on + * the adapter. + * + * o If tx successful: + * Free the skb buffer and mark interface as running + * and return 0. + * + * o If tx failed, busy: + * Keep interface marked as busy + * Do not free skb buffer + * Enable Tx interrupt (which will tell the stack + * that interace is not busy) + * Return a non-zero value to tell the stack + * that the tx should be retried. + * + * Return: 0 complete (socket buffer must be freed) + * non-0 packet may be re-transmitted + * + */ + +#if defined(__LINUX__) +static int if_send (netskb_t* skb, netdevice_t* dev) +#else +static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct rtentry *rt) +#endif +{ + private_area_t *chan = wan_netif_priv(dev); + sdla_t *card = chan->card; + int err; + netskb_t *rskb=NULL; + wan_smp_flag_t smp_flags; + + /* Mark interface as busy. The kernel will not + * attempt to send any more packets until we clear + * this condition */ + + if (skb == NULL){ + /* This should never happen. Just a sanity check. + */ + DEBUG_EVENT( "%s: interface %s got kicked!\n", + card->devname, + wan_netif_name(dev)); + + WAN_NETIF_WAKE_QUEUE(dev); + return 0; + } + + DEBUG_TX("%s: Sending %d bytes\n", wan_netif_name(dev), wan_skb_len(skb)); + /* Non 2.4 kernels used to call if_send() + * after TX_TIMEOUT seconds have passed of interface + * being busy. Same as if_tx_timeout() in 2.4 kernels */ +#if defined(LINUX_2_1) + if (dev->tbusy){ + + /* If our device stays busy for at least 5 seconds then we will + * kick start the device by making dev->tbusy = 0. We expect + * that our device never stays busy more than 5 seconds. So this + * is only used as a last resort. + */ + WAN_NETIF_STATS_COLLISIONS(&chan->common); //++chan->if_stats.collisions; + if((SYSTEM_TICKS - chan->tick_counter) < (5 * HZ)) { + return 1; + } + + if_tx_timeout(dev); + } +#endif + err=0; + + if (chan->common.state != WAN_CONNECTED){ + +#if 1 + WAN_NETIF_STOP_QUEUE(dev); + wan_netif_set_ticks(dev, SYSTEM_TICKS); + WAN_NETIF_STATS_INC_TX_CARRIER_ERRORS(&chan->common); //++chan->if_stats.tx_carrier_errors; + return 1; +#else + WAN_NETIF_STATS_INC_TX_CARRIER_ERRORS(&chan->common); //++chan->if_stats.tx_carrier_errors; + wan_skb_free(skb); + WAN_NETIF_START_QUEUE(dev); + err=0; + goto if_send_exit_crit; +#endif + } + + DEBUG_BRI_DCHAN("chan->channelized_cfg: %d\n", chan->channelized_cfg); + + if (chan->channelized_cfg) { + + private_area_t *top_chan=wan_netif_priv(chan->common.dev); + + DEBUG_TEST("%s:%ld Prev: Zaptel HDLC Tt TDMV_DCHAN=%i\n", + chan->if_name,chan->logic_ch_num, + card->u.aft.tdmv_dchan-1); + + if (!card->u.aft.tdmv_dchan || card->u.aft.tdmv_dchan>32){ + + DEBUG_EVENT("%s: DCHAN TX No DCHAN Configured!\n", + card->devname); + + wan_skb_free(skb); + WAN_NETIF_START_QUEUE(dev); + err=0; + goto if_send_exit_crit; + } + + if(IS_BRI_CARD(card)) { + chan=(private_area_t*)card->u.aft.dev_to_ch_map[BRI_DCHAN_LOGIC_CHAN]; + }else{ + chan=(private_area_t*)card->u.aft.dev_to_ch_map[card->u.aft.tdmv_dchan-1]; + } + + if (!chan){ + DEBUG_EVENT("%s: Warning: DCHAN TX: No DCHAN Configured (not preset)! Discarding data.\n", + card->devname); + wan_skb_free(skb); + WAN_NETIF_START_QUEUE(dev); + err=0; + goto if_send_exit_crit; + } + + DEBUG_BRI_DCHAN("chan->dchan_time_slot: %d\n", chan->dchan_time_slot); + + if (!chan->hdlc_eng || (IS_BRI_CARD(card) && chan->dchan_time_slot < 0)){ + wan_skb_free(skb); + WAN_NETIF_START_QUEUE(dev); + err=0; + goto if_send_exit_crit; + } + + wan_capture_trace_packet(chan->card, &top_chan->trace_info, + skb,TRC_OUTGOING_FRM); + + DEBUG_TEST("%s:%ld Zaptel HDLC Tt TDMV_DCHAN=%i\n", + chan->if_name,chan->logic_ch_num, + card->u.aft.tdmv_dchan-1); + } + + /* For TDM_VOICE_API no tx is supported in if_send */ + if (chan->common.usedby == TDM_VOICE_API){ + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); + WAN_NETIF_START_QUEUE(dev); + + err=0; + goto if_send_exit_crit; + } + + if (chan->common.usedby == API){ + + if (sizeof(api_tx_hdr_t) >= wan_skb_len(skb)){ + + wan_skb_free(skb); + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); + WAN_NETIF_START_QUEUE(dev); + err=0; + goto if_send_exit_crit; + } + + if (chan->cfg.ss7_enable) { + err=aft_ss7_tx_mangle(card,chan,skb); + if (err){ + wan_skb_free(skb); + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); + WAN_NETIF_START_QUEUE(dev); + err=0; + goto if_send_exit_crit; + } + } else if (chan->cfg.hdlc_repeat) { + err=aft_hdlc_repeat_mangle(card,chan,skb,&rskb); + if (err){ + wan_skb_free(skb); + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); + WAN_NETIF_START_QUEUE(dev); + err=0; + goto if_send_exit_crit; + } + } else { + wan_skb_pull(skb,sizeof(api_tx_hdr_t)); + } + } + + if (!chan->hdlc_eng && chan->tslot_sync){ + if (wan_skb_len(skb)%chan->num_of_time_slots){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s: Tx Error pkt len(%d) not multiple of timeslots(%d)\n", + card->devname, + chan->if_name, + wan_skb_len(skb), + chan->num_of_time_slots); + } + wan_skb_free(skb); + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //++chan->if_stats.tx_errors; + WAN_NETIF_START_QUEUE(dev); + err=0; + goto if_send_exit_crit; + } + } + + if (!chan->hdlc_eng && !chan->lip_atm && (wan_skb_len(skb)%4)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: Tx Error: Tx Length %i is not 32bit divisible\n", + chan->if_name,wan_skb_len(skb)); + } + wan_skb_free(skb); + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //++chan->if_stats.tx_errors; + WAN_NETIF_START_QUEUE(dev); + err=0; + goto if_send_exit_crit; + } + + if(IS_BRI_CARD(card)){ + if(chan->dchan_time_slot >= 0){ + + /* NOTE: BRI dchan tx has to be done inside hw lock. + It allows to synchronize access to SPI on the card. + */ + card->hw_iface.hw_lock(card->hw,&smp_flags); + + err=aft_bri_dchan_transmit(card, chan, + wan_skb_data(skb), + wan_skb_len(skb)); + + card->hw_iface.hw_unlock(card->hw,&smp_flags); + + if (err == 0 ) { + WAN_NETIF_START_QUEUE(dev); + wan_skb_free(skb); + err=0; + goto if_send_exit_crit; + }else{ + err=1; + WAN_NETIF_STOP_QUEUE(dev); + goto if_send_exit_crit; + } + } else { + /* On b-channel data is transmitted using AFT DMA. + Drop down to code below */ + } + } + + wan_spin_lock_irq(&card->wandev.lock, &smp_flags); + + if (wan_skb_queue_len(&chan->wp_tx_pending_list) > chan->max_tx_bufs){ + WAN_NETIF_STOP_QUEUE(dev); + aft_dma_tx(card,chan); + wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + return 1; + } + + wan_skb_unlink(skb); + + wan_skb_queue_tail(&chan->wp_tx_pending_list,skb); + + if(!chan->lip_atm){ + aft_dma_tx(card,chan); /*not needed for LIP_ATM!!*/ + } + + if (rskb) { + wan_skb_queue_tail(&chan->wp_tx_hdlc_rpt_list,rskb); + } + + wan_netif_set_ticks(dev, SYSTEM_TICKS); + WAN_NETIF_START_QUEUE(dev); + err=0; + wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + +#if defined(__LINUX__) + if (dev->tx_queue_len < chan->max_tx_bufs && + dev->tx_queue_len > 0) { + DEBUG_EVENT("%s: Resizing Tx Queue Len to %li\n", + chan->if_name,dev->tx_queue_len); + chan->max_tx_bufs = dev->tx_queue_len; + } + + if (dev->tx_queue_len > chan->max_tx_bufs && + chan->max_tx_bufs != chan->max_tx_bufs_orig) { + DEBUG_EVENT("%s: Resizing Tx Queue Len to %i\n", + chan->if_name,chan->max_tx_bufs_orig); + chan->max_tx_bufs = chan->max_tx_bufs_orig; + } +#endif + +if_send_exit_crit: + + return err; +} + +/*============================================================================ + * if_stats + * + * Used by /proc/net/dev and ifconfig to obtain interface + * statistics. + * + * Return a pointer to struct net_device_stats. + */ +#if defined(__LINUX__) +static struct net_device_stats gstats; +static struct net_device_stats* if_stats (netdevice_t* dev) +{ + private_area_t* chan; + sdla_t *card; + + if ((chan=wan_netif_priv(dev)) == NULL) + return &gstats; + + card=chan->card; + +#if !defined(AFT_IRQ_DEBUG) + if (card) { +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) + if (card->wan_tdmv.sc && + card->wandev.state == WAN_CONNECTED && + card->wandev.config_id != WANCONFIG_AFT_ANALOG && + chan->common.usedby == TDM_VOICE) { + chan->common.if_stats.rx_packets = card->wandev.stats.rx_packets; + chan->common.if_stats.tx_packets = card->wandev.stats.tx_packets; + } +#endif + } +#endif + + return &chan->common.if_stats; + +} +#endif + +/*======================================================================== + * + * if_do_ioctl - Ioctl handler for fr + * + * @dev: Device subject to ioctl + * @ifr: Interface request block from the user + * @cmd: Command that is being issued + * + * This function handles the ioctls that may be issued by the user + * to control or debug the protocol or hardware . + * + * It does both busy and security checks. + * This function is intended to be wrapped by callers who wish to + * add additional ioctl calls of their own. + * + * Used by: SNMP Mibs + * wanpipemon debugger + * + */ +static int if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) +{ + private_area_t* chan= (private_area_t*)wan_netif_priv(dev); + sdla_t *card; + wan_smp_flag_t smp_flags; + wan_udp_pkt_t *wan_udp_pkt; + int err=-EOPNOTSUPP; + + if (!chan || !chan->card){ + DEBUG_EVENT("%s:%d: No Chan of card ptr\n", + __FUNCTION__,__LINE__); + return -ENODEV; + } + card=chan->card; + + if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ + DEBUG_EVENT("%s: Card down: Ignoring Ioctl call!\n", + card->devname); + return -ENODEV; + } + + switch(cmd) + { +#if defined(__LINUX__) + case SIOC_WANPIPE_BIND_SK: + if (!ifr){ + err= -EINVAL; + break; + } + + wan_spin_lock_irq(&card->wandev.lock, &smp_flags); + err=wan_bind_api_to_svc(chan,ifr->ifr_data); + WAN_NETIF_STATS_RX_DROPPED(&chan->common)=0; //chan->if_stats.rx_dropped=0; + if (!chan->hdlc_eng){ + WAN_NETIF_STATS_TX_CARRIER_ERRORS(&chan->common)=0; //chan->if_stats.tx_carrier_errors=0; + } + wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + break; + + case SIOC_WANPIPE_UNBIND_SK: + if (!ifr){ + err= -EINVAL; + break; + } + + wan_spin_lock_irq(&card->wandev.lock, &smp_flags); + err=wan_unbind_api_from_svc(chan,ifr->ifr_data); + wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + + break; + + case SIOC_WANPIPE_CHECK_TX: + case SIOC_ANNEXG_CHECK_TX: + err=0; + break; + + case SIOC_WANPIPE_DEV_STATE: + err = chan->common.state; + break; + + case SIOC_ANNEXG_KICK: + err=0; + break; + + case SIOC_AFT_SS7_FORCE_RX: + wan_spin_lock_irq(&card->wandev.lock, &smp_flags); + aft_set_ss7_force_rx(card,chan); + wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + break; +#endif + +#if defined(AFT_API_SUPPORT) + case SIOC_WANPIPE_API: + DEBUG_TEST("%s: WANPIPE API IOCTL!\n", card->devname); + err = wan_aft_api_ioctl(card,chan,ifr->ifr_data); + break; +#endif + + case SIOC_WAN_DEVEL_IOCTL: + err = aft_devel_ioctl(card, ifr); + break; + + case SIOC_AFT_CUSTOMER_ID: + if (!ifr){ + return -EINVAL; + } else { + unsigned char cid=0; + wan_smp_flag_t smp_flags1; + card->hw_iface.hw_lock(card->hw,&smp_flags1); + wan_spin_lock_irq(&card->wandev.lock, &smp_flags); + cid=aft_read_cpld(card,CUSTOMER_CPLD_ID_REG); + wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + card->hw_iface.hw_unlock(card->hw,&smp_flags1); + return WAN_COPY_TO_USER(ifr->ifr_data,&cid,sizeof(unsigned char)); + } + err=0; + break; + +#if defined(__LINUX__) + case SIOC_WANPIPE_GET_DEVICE_CONFIG_ID: + err=card->wandev.config_id; + break; +#endif + case SIOC_WANPIPE_SNMP: + case SIOC_WANPIPE_SNMP_IFSPEED: + return wan_snmp_data(card, dev, cmd, ifr); + + case SIOC_WANPIPE_PIPEMON: + + NET_ADMIN_CHECK(); + + if (wan_atomic_read(&chan->udp_pkt_len) != 0){ + return -EBUSY; + } + + wan_atomic_set(&chan->udp_pkt_len,MAX_LGTH_UDP_MGNT_PKT); + + /* For performance reasons test the critical + * here before spin lock */ + if (wan_test_bit(0,&card->in_isr)){ + wan_atomic_set(&chan->udp_pkt_len,0); + return -EBUSY; + } + + + wan_udp_pkt=(wan_udp_pkt_t*)chan->udp_pkt_data; + if (WAN_COPY_FROM_USER( + &wan_udp_pkt->wan_udp_hdr, + ifr->ifr_data, + sizeof(wan_udp_hdr_t))){ + wan_atomic_set(&chan->udp_pkt_len,0); + return -EFAULT; + } + + /* We have to check here again because we don't know + * what happened during spin_lock */ + if (wan_test_bit(0,&card->in_isr)) { + DEBUG_EVENT( "%s:%s Pipemon command failed, Driver busy: try again.\n", + card->devname, + wan_netif_name(dev)); + wan_atomic_set(&chan->udp_pkt_len,0); + return -EBUSY; + } + + process_udp_mgmt_pkt(card,dev,chan,1); + + /* This area will still be critical to other + * PIPEMON commands due to udp_pkt_len + * thus we can release the irq */ + + if (wan_atomic_read(&chan->udp_pkt_len) > sizeof(wan_udp_pkt_t)){ + DEBUG_EVENT( "%s: Error: Pipemon buf too bit on the way up! %d\n", + card->devname,wan_atomic_read(&chan->udp_pkt_len)); + wan_atomic_set(&chan->udp_pkt_len,0); + return -EINVAL; + } + + if (WAN_COPY_TO_USER( + ifr->ifr_data, + &wan_udp_pkt->wan_udp_hdr, + sizeof(wan_udp_hdr_t))){ + wan_atomic_set(&chan->udp_pkt_len,0); + return -EFAULT; + } + + wan_atomic_set(&chan->udp_pkt_len,0); + return 0; + +#if 0 + case SIOC_WAN_EC_IOCTL: + if (wan_test_and_set_bit(CARD_HW_EC,&card->wandev.critical)){ + DEBUG_EVENT("%s: Error: EC IOCTL Reentrant!\n", + card->devname); + return -EBUSY; + } + if (card->wandev.ec){ + err = wan_ec_ioctl(card->wandev.ec, ifr, card); + }else{ + err = -EINVAL; + } + wan_clear_bit(CARD_HW_EC,&card->wandev.critical); + break; +#endif + +/* + case SIOC_WAN_FE_IOCTL: + DEBUG_TEST("%s: Command %x not supported!\n", + card->devname,cmd); + return -EOPNOTSUPP; + break; +*/ + default: +#ifndef WANPIPE_GENERIC + DEBUG_TEST("%s: Command %x not supported!\n", + card->devname,cmd); + return -EOPNOTSUPP; +#else + if (card->wandev.ioctl){ + err = card->wandev.hdlc_ioctl(card, dev, ifr, cmd); + } +#endif + } + + return err; +} + + +/**SECTION********************************************************** + * + * FIRMWARE Specific Interface Functions + * + *******************************************************************/ + + +#define FIFO_RESET_TIMEOUT_CNT 1000 +#define FIFO_RESET_TIMEOUT_US 10 +static int aft_init_rx_dev_fifo(sdla_t *card, private_area_t *chan, unsigned char wait) +{ + + u32 reg; + u32 dma_descr; + u8 timeout=1; + u16 i; + unsigned int cur_dma_ptr; + u32 dma_ram_desc; + + /* Clean RX DMA fifo */ + + if (chan->single_dma_chain){ + dma_descr=(chan->logic_ch_num<<4) + AFT_PORT_REG(card,AFT_RX_DMA_HI_DESCR_BASE_REG); + + dma_ram_desc=chan->logic_ch_num*4 + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); + aft_dmachain_set_rx_dma_addr(®,0); + card->hw_iface.bus_write_4(card->hw,dma_ram_desc,reg); + }else{ + dma_ram_desc=chan->logic_ch_num*4 + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); + cur_dma_ptr=aft_dmachain_get_rx_dma_addr(reg); + + dma_descr=(chan->logic_ch_num<<4) + (cur_dma_ptr*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_RX_DMA_HI_DESCR_BASE_REG); + } + + reg=0; + wan_set_bit(AFT_RXDMA_HI_DMA_CMD_BIT,®); + + DEBUG_TEST("%s: Clearing RX Fifo %s Ch=%ld DmaDescr=(0x%X) Reg=(0x%X) WAIT=%s\n", + __FUNCTION__,chan->if_name,chan->logic_ch_num, + dma_descr,reg,wait == WP_WAIT?"YES":"NO"); + + card->hw_iface.bus_write_4(card->hw,dma_descr,reg); + + if (wait == WP_WAIT){ + for(i=0;ihw_iface.bus_read_4(card->hw,dma_descr,®); + if (wan_test_bit(AFT_RXDMA_HI_DMA_CMD_BIT,®)){ + WP_DELAY(FIFO_RESET_TIMEOUT_US); + continue; + } + timeout=0; + break; + } + + if (timeout){ + DEBUG_EVENT("%s:%s: Error: Rx fifo reset timedout %u us (ch=%ld)\n", + card->devname,chan->if_name,i*FIFO_RESET_TIMEOUT_US, + chan->logic_ch_num); + }else{ + DEBUG_TEST("%s:%s: Rx Fifo Reset Successful\n", + card->devname,chan->if_name); + } + }else{ + timeout=0; + } + + return timeout; +} + +static int aft_init_tx_dev_fifo(sdla_t *card, private_area_t *chan, unsigned char wait) +{ + u32 reg; + u32 dma_descr,dma_ram_desc; + u8 timeout=1; + u16 i; + unsigned int cur_dma_ptr; + + if (chan->single_dma_chain){ + dma_descr=(chan->logic_ch_num<<4) + AFT_PORT_REG(card,AFT_TX_DMA_HI_DESCR_BASE_REG); + + dma_ram_desc=chan->logic_ch_num*4 + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); + aft_dmachain_set_tx_dma_addr(®,0); + card->hw_iface.bus_write_4(card->hw,dma_ram_desc,reg); + }else{ + dma_ram_desc=chan->logic_ch_num*4 + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); + cur_dma_ptr=aft_dmachain_get_tx_dma_addr(reg); + + /* Clean TX DMA fifo */ + dma_descr=(chan->logic_ch_num<<4) + (cur_dma_ptr*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_TX_DMA_HI_DESCR_BASE_REG); + } + + reg=0; + wan_set_bit(AFT_TXDMA_HI_DMA_CMD_BIT,®); + + + DEBUG_TEST("%s: Clearing TX Fifo %s Ch=%ld DmaDescr=(0x%X) Reg=(0x%X) WAIT=%s\n", + __FUNCTION__,chan->if_name,chan->logic_ch_num, + dma_descr,reg,wait == WP_WAIT?"YES":"NO"); + + card->hw_iface.bus_write_4(card->hw,dma_descr,reg); + + if (wait == WP_WAIT){ + for(i=0;ihw_iface.bus_read_4(card->hw,dma_descr,®); + if (wan_test_bit(AFT_TXDMA_HI_DMA_CMD_BIT,®)){ + WP_DELAY(FIFO_RESET_TIMEOUT_US); + continue; + } + timeout=0; + break; + } + + if (timeout){ + DEBUG_EVENT("%s:%s: Error: Tx fifo reset timedout %u us (ch=%ld)\n", + card->devname,chan->if_name,i*FIFO_RESET_TIMEOUT_US, + chan->logic_ch_num); + }else{ + DEBUG_TEST("%s:%s: Tx Fifo Reset Successful\n", + card->devname,chan->if_name); + } + }else{ + timeout=0; + } + + return timeout; +} + +static void aft_channel_txdma_ctrl(sdla_t *card, private_area_t *chan, int on) +{ + u32 reg; + /* Enable TX DMA for Logic Channel */ + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_TX_DMA_CTRL_REG), ®); + if (on){ + wan_set_bit(chan->logic_ch_num,®); + }else{ + wan_clear_bit(chan->logic_ch_num,®); + } + + card->hw_iface.bus_write_4(card->hw, + AFT_PORT_REG(card,AFT_TX_DMA_CTRL_REG), reg); + +} +static void aft_channel_rxdma_ctrl(sdla_t *card, private_area_t *chan, int on) +{ + u32 reg; + /* Enable TX DMA for Logic Channel */ + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_RX_DMA_CTRL_REG), ®); + if (on){ + wan_set_bit(chan->logic_ch_num,®); + }else{ + wan_clear_bit(chan->logic_ch_num,®); + } + + card->hw_iface.bus_write_4(card->hw, + AFT_PORT_REG(card,AFT_RX_DMA_CTRL_REG), reg); + +} + +static void aft_channel_txintr_ctrl(sdla_t *card, private_area_t *chan, int on) +{ + u32 reg; + + /* Enable Logic Channel TX Interrupts */ + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_TX_DMA_INTR_MASK_REG), ®); + if (on){ + wan_set_bit(chan->logic_ch_num,®); + }else{ + wan_clear_bit(chan->logic_ch_num,®); + + } + card->hw_iface.bus_write_4(card->hw, + AFT_PORT_REG(card,AFT_TX_DMA_INTR_MASK_REG), reg); +} + +static void aft_channel_rxintr_ctrl(sdla_t *card, private_area_t *chan, int on) +{ + u32 reg; + + /* Enable Logic Channel TX Interrupts */ + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_RX_DMA_INTR_MASK_REG), ®); + if (on){ + wan_set_bit(chan->logic_ch_num,®); + }else{ + wan_clear_bit(chan->logic_ch_num,®); + + } + card->hw_iface.bus_write_4(card->hw, + AFT_PORT_REG(card,AFT_RX_DMA_INTR_MASK_REG), reg); +} + + +static void aft_dev_enable(sdla_t *card, private_area_t *chan) +{ + DEBUG_TEST("%s: Enabling Global Inter Mask !\n",chan->if_name); + + /* Enable TX DMA for Logic Channel */ + aft_channel_txdma_ctrl(card,chan,1); + + /* Enable RX DMA for Logic Channel */ + aft_channel_rxdma_ctrl(card,chan,1); + + /* Enable Logic Channel TX Interrupts */ + if (chan->channelized_cfg && !chan->hdlc_eng){ + aft_channel_txintr_ctrl(card,chan,0); + aft_channel_rxintr_ctrl(card,chan,0); + chan->tdmv_irq_cfg=1; + }else{ + aft_channel_txintr_ctrl(card,chan,1); + aft_channel_rxintr_ctrl(card,chan,1); + } + + wan_set_bit(chan->logic_ch_num,&card->u.aft.active_ch_map); +} + +static void aft_dev_open_private(sdla_t *card, private_area_t *chan) +{ + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + /* BRI dchan does not use DMA thus + skip the dma config code below */ + return; + } + + if (card->wandev.state == WAN_CONNECTED && + wan_test_bit(0,&card->u.aft.comm_enabled)){ + + DEBUG_TEST("%s: OPEN reseting fifo Channel = %li\n", + chan->if_name,chan->logic_ch_num); + + aft_tslot_sync_ctrl(card,chan,0); + + aft_init_rx_dev_fifo(card,chan,WP_NO_WAIT); + aft_init_tx_dev_fifo(card,chan,WP_NO_WAIT); + + aft_dev_enable(card,chan); + + aft_init_rx_dev_fifo(card,chan,WP_WAIT); + aft_init_tx_dev_fifo(card,chan,WP_WAIT); + + chan->dma_index=0; + memset(chan->dma_history,0,sizeof(chan->dma_history)); + + aft_reset_rx_chain_cnt(chan); + aft_dma_rx(card,chan); + + aft_tslot_sync_ctrl(card,chan,1); + + if (!chan->hdlc_eng){ + aft_reset_tx_chain_cnt(chan); + aft_dma_tx(card,chan); + } + }else{ + aft_dev_enable(card,chan); + } + +} + +static void aft_dev_open(sdla_t *card, private_area_t *gchan) +{ + private_area_t *chan=gchan; + + if (chan->channelized_cfg){ + + for (chan=gchan; chan != NULL; chan=chan->next){ + + aft_dev_open_private(card,chan); + + wan_set_bit(0,&chan->up); + + } + + if (gchan->common.usedby == TDM_VOICE_API){ + /* Set the global mtu value which is + * the sum of all timeslots mtus */ + wan_netif_set_mtu( + gchan->common.dev, + card->u.aft.tdmv_mtu+sizeof(api_tx_hdr_t)); + + } + + wan_set_bit(0,&card->u.aft.tdmv_master_if_up); + + if (card->wandev.state == WAN_CONNECTED && + !wan_test_bit(0,&card->u.aft.comm_enabled)){ + DEBUG_EVENT("%s: Master IF Starting %s Communications\n", + gchan->if_name,card->devname); + enable_data_error_intr(card); + } + }else{ + aft_dev_open_private(card,chan); + wan_set_bit(0,&chan->up); + } + + + if (gchan->cfg.ss7_enable){ + aft_clear_ss7_force_rx(card,gchan); + } + + return; +} + +static void aft_dev_close_private(sdla_t *card, private_area_t *chan) +{ + + if (chan->logic_ch_num < 0){ + return; + } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + /* BRI dchan does not use DMA thus + skip the dma config code below */ + return; + } + + DEBUG_TEST("%s: Chan=%i\n",__FUNCTION__,chan->logic_ch_num); + + /* Disable Logic Channel TX Interrupts */ + aft_channel_txintr_ctrl(card,chan,0); + + /* Disable Logic Channel RX Interrupts */ + aft_channel_rxintr_ctrl(card,chan,0); + + /* Disable TX DMA for Logic Channel */ + aft_channel_txdma_ctrl(card,chan,0); + + /* Disable RX DMA for Logic Channel */ + aft_channel_rxdma_ctrl(card,chan,0); + + /* Initialize DMA descriptors and DMA Chains */ + aft_init_tx_rx_dma_descr(chan); + +} + + +static void aft_dev_close(sdla_t *card, private_area_t *gchan) +{ + private_area_t *chan=gchan; + + if (chan->channelized_cfg){ + + if (IS_BRI_CARD(card)) { + int card_use_cnt; + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &card_use_cnt); + if (card_use_cnt == 1) { + DEBUG_TEST("%s: BRI Disabling TDMV INTR\n", + card->devname); + aft_tdm_intr_ctrl(card,0); + aft_fifo_intr_ctrl(card, 0); + } + } else { + aft_tdm_intr_ctrl(card,0); + aft_fifo_intr_ctrl(card, 0); + } + + for (chan=gchan; chan != NULL; chan=chan->next){ + + aft_dev_close_private(card,chan); + + DEBUG_TEST("%s: Closing Ch=%ld\n", + chan->if_name,chan->logic_ch_num); + + wan_clear_bit(0,&chan->up); + wan_set_bit(0,&chan->interface_down); + if (chan->cfg.tdmv_master_if){ + wan_clear_bit(0,&card->u.aft.tdmv_master_if_up); + } + + DEBUG_TEST("%s: Closing Ch=%ld MasterUP=%i\n", + chan->if_name,chan->logic_ch_num, + wan_test_bit(0,&card->u.aft.tdmv_master_if_up)); + } + }else{ + wan_set_bit(0,&chan->interface_down); + wan_clear_bit(0,&chan->up); + aft_dev_close_private(card,chan); + + + } + return; +} + +/**SECTION************************************************************* + * + * TX Handlers + * + **********************************************************************/ + + +/*=============================================== + * aft_dma_tx_complete + * + */ +static void aft_dma_tx_complete (sdla_t *card, private_area_t *chan, int wdt, int reset) +{ + DEBUG_TEST("%s: Tx interrupt wdt=%d\n",chan->if_name,wdt); + + if (!wdt){ + wan_clear_bit(TX_INTR_PENDING,&chan->dma_chain_status); + } + + if (chan->channelized_cfg && !chan->hdlc_eng){ + aft_tx_dma_voice_handler((unsigned long)chan,wdt,reset); + }else{ + aft_tx_dma_chain_handler((unsigned long)chan,wdt,reset); + } + + wan_set_bit(0,&chan->idle_start); + + if (reset){ + return; + } + + aft_dma_tx(card,chan); + + if (WAN_NETIF_QUEUE_STOPPED(chan->common.dev)){ + /* Wakeup stack also wakes up DCHAN, + however, for DCHAN we must always + call the upper layer and let it decide + what to do */ + wanpipe_wake_stack(chan); + } else if (chan->common.usedby == TDM_VOICE_DCHAN){ +#ifdef AFT_TDM_API_SUPPORT + if (is_tdm_api(chan,&chan->wp_tdm_api_dev)){ + wanpipe_tdm_api_kick(&chan->wp_tdm_api_dev); + } +#endif + } + + return; +} + +/*=============================================== + * aft_tx_post_complete + * + */ +static void +aft_tx_post_complete (sdla_t *card, private_area_t *chan, netskb_t *skb) +{ + unsigned int reg = wan_skb_csum(skb); + u32 dma_status = aft_txdma_hi_get_dma_status(reg); + + wan_skb_set_csum(skb,0); + + if (reg & AFT_TXDMA_HI_DMA_LENGTH_MASK){ + chan->errstats.Tx_dma_len_nonzero++; + } + + if ((wan_test_bit(AFT_TXDMA_HI_GO_BIT,®)) || + (reg & AFT_TXDMA_HI_DMA_LENGTH_MASK) || + dma_status){ + + DEBUG_TEST("%s:%s: Tx DMA Descriptor=0x%X\n", + card->devname,chan->if_name,reg); + + /* Checking Tx DMA Go bit. Has to be '0' */ + if (wan_test_bit(AFT_TXDMA_HI_GO_BIT,®)){ + DEBUG_TEST("%s:%s: Error: TxDMA Intr: GO bit set on Tx intr\n", + card->devname,chan->if_name); + chan->errstats.Tx_dma_errors++; + } + + if (reg & AFT_TXDMA_HI_DMA_LENGTH_MASK){ + DEBUG_EVENT("%s:%s: Error: TxDMA Length not equal 0 (reg=0x%08X)\n", + card->devname,chan->if_name,reg); + chan->errstats.Tx_dma_errors++; + } + + /* Checking Tx DMA PCI error status. Has to be '0's */ + if (dma_status){ + + chan->errstats.Tx_pci_errors++; + if (wan_test_bit(AFT_TXDMA_HIDMASTATUS_PCI_M_ABRT,&dma_status)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s: Tx Error: Abort from Master: pci fatal error!\n", + card->devname,chan->if_name); + } + + } + if (wan_test_bit(AFT_TXDMA_HIDMASTATUS_PCI_T_ABRT,&dma_status)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s: Tx Error: Abort from Target: pci fatal error!\n", + card->devname,chan->if_name); + } + } + if (wan_test_bit(AFT_TXDMA_HIDMASTATUS_PCI_DS_TOUT,&dma_status)){ + DEBUG_TEST("%s:%s: Tx Warning: PCI Latency Timeout!\n", + card->devname,chan->if_name); + chan->errstats.Tx_pci_latency++; + goto tx_post_ok; + } + if (wan_test_bit(AFT_TXDMA_HIDMASTATUS_PCI_RETRY,&dma_status)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s: Tx Error: 'Retry' exceeds maximum (64k): pci fatal error!\n", + card->devname,chan->if_name); + } + } + } + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //chan->if_stats.tx_errors++; + goto tx_post_exit; + } + +tx_post_ok: + + chan->opstats.Data_frames_Tx_count++; + chan->opstats.Data_bytes_Tx_count+=wan_skb_len(skb); + WAN_NETIF_STATS_INC_TX_PACKETS(&chan->common); //chan->if_stats.tx_packets++; + WAN_NETIF_STATS_INC_TX_BYTES(&chan->common, wan_skb_len(skb)); //chan->if_stats.tx_bytes+=wan_skb_len(skb); + +#if 0 + if (chan->common.usedby != TDM_VOICE){ + wan_capture_trace_packet(card, &chan->trace_info, skb, TRC_OUTGOING_FRM); + } +#endif + +tx_post_exit: + + return; +} + + + +/**SECTION************************************************************* + * + * RX Handlers + * + **********************************************************************/ + + +/*=============================================== + * aft_rx_post_complete + * + */ +static void aft_rx_post_complete (sdla_t *card, private_area_t *chan, + netskb_t *skb, + netskb_t **new_skb, + unsigned char *pkt_error) +{ + + unsigned int len,data_error = 0; + unsigned char *buf; + wp_rx_element_t *rx_el; + u32 dma_status; + rx_el=(wp_rx_element_t *)wan_skb_data(skb); + + DEBUG_RX("%s:%s: RX HI=0x%X LO=0x%X DMA=0x%X", + __FUNCTION__, + chan->if_name, + rx_el->reg, + rx_el->align, + rx_el->dma_addr); + +#if 0 + /* debugging */ + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //chan->if_stats.rx_errors++; +#endif + + rx_el->align&=AFT_RXDMA_LO_ALIGN_MASK; + *pkt_error=0; + *new_skb=NULL; + + dma_status=aft_rxdma_hi_get_dma_status(rx_el->reg); + + /* Checking Rx DMA Go bit. Has to be '0' */ + if (wan_test_bit(AFT_RXDMA_HI_GO_BIT,&rx_el->reg)){ + DEBUG_TEST("%s:%s: Error: RxDMA Intr: GO bit set on Rx intr\n", + card->devname,chan->if_name); + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //chan->if_stats.rx_errors++; + chan->errstats.Rx_dma_descr_err++; + goto rx_comp_error; + } + + /* Checking Rx DMA PCI error status. Has to be '0's */ + if (dma_status){ + + if (wan_test_bit(AFT_RXDMA_HIDMASTATUS_PCI_M_ABRT,&dma_status)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s: Rx Error: Abort from Master: pci fatal error 0x%X!\n", + card->devname,chan->if_name,rx_el->reg); + } + } + if (wan_test_bit(AFT_RXDMA_HIDMASTATUS_PCI_T_ABRT,&dma_status)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s: Rx Error: Abort from Target: pci fatal error 0x%X!\n", + card->devname,chan->if_name,rx_el->reg); + } + } + if (wan_test_bit(AFT_RXDMA_HIDMASTATUS_PCI_DS_TOUT,&dma_status)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s: Rx Error: No 'DeviceSelect' from target: pci fatal error 0x%X!\n", + card->devname,chan->if_name,rx_el->reg); + } + } + if (wan_test_bit(AFT_RXDMA_HIDMASTATUS_PCI_RETRY,&dma_status)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s: Rx Error: 'Retry' exceeds maximum (64k): pci fatal error 0x%X!\n", + card->devname,chan->if_name,rx_el->reg); + } + } + + chan->errstats.Rx_pci_errors++; + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //chan->if_stats.rx_errors++; + card->wandev.stats.rx_errors++; + goto rx_comp_error; + } + + if (chan->hdlc_eng){ + + /* Checking Rx DMA Frame start bit. (information for api) */ + if (!wan_test_bit(AFT_RXDMA_HI_START_BIT,&rx_el->reg)){ + DEBUG_TEST("%s:%s RxDMA Intr: Start flag missing: MTU Mismatch! Reg=0x%X\n", + card->devname,chan->if_name,rx_el->reg); + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; + chan->opstats.Rx_Data_discard_long_count++; + chan->errstats.Rx_hdlc_corrupiton++; + card->wandev.stats.rx_errors++; + goto rx_comp_error; + } + + /* Checking Rx DMA Frame end bit. (information for api) */ + if (!wan_test_bit(AFT_RXDMA_HI_EOF_BIT,&rx_el->reg)){ + DEBUG_TEST("%s:%s: RxDMA Intr: End flag missing: MTU Mismatch! Reg=0x%X\n", + card->devname,chan->if_name,rx_el->reg); + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; + chan->opstats.Rx_Data_discard_long_count++; + chan->errstats.Rx_hdlc_corrupiton++; + card->wandev.stats.rx_errors++; + goto rx_comp_error; + + } else { /* Check CRC error flag only if this is the end of Frame */ + + if (wan_test_bit(AFT_RXDMA_HI_FCS_ERR_BIT,&rx_el->reg)){ + DEBUG_TEST("%s:%s: RxDMA Intr: CRC Error! Reg=0x%X Len=%d\n", + card->devname,chan->if_name,rx_el->reg, + (rx_el->reg&AFT_RXDMA_HI_DMA_LENGTH_MASK)>>2); + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; + chan->errstats.Rx_crc_err_count++; + card->wandev.stats.rx_crc_errors++; + wan_set_bit(WP_CRC_ERROR_BIT,&rx_el->pkt_error); + data_error = 1; + } + + /* Check if this frame is an abort, if it is + * drop it and continue receiving */ + if (wan_test_bit(AFT_RXDMA_HI_FRM_ABORT_BIT,&rx_el->reg)){ + DEBUG_TEST("%s:%s: RxDMA Intr: Abort! Reg=0x%X\n", + card->devname,chan->if_name,rx_el->reg); + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; + chan->errstats.Rx_hdlc_corrupiton++; + card->wandev.stats.rx_frame_errors++; + wan_set_bit(WP_ABORT_ERROR_BIT,&rx_el->pkt_error); + data_error = 1; + } + + if (chan->common.usedby != API && data_error){ + goto rx_comp_error; + } + } + } + + len = rx_el->len; +#if 0 + /* FIXME: Remove this later!!! */ + len=rx_el->reg&AFT_RXDMA_HI_DMA_LENGTH_MASK; + + if (chan->hdlc_eng){ + /* In HDLC mode, calculate rx length based + * on alignment value, received from DMA */ + len=((((chan->dma_mru>>2)-1)-len)<<2) - (~(rx_el->align)&AFT_RXDMA_LO_ALIGN_MASK); + + if (len < 3 || len > chan->dma_mru){ + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; + chan->errstats.Rx_hdlc_corrupiton++; + card->wandev.stats.rx_frame_errors++; + goto rx_comp_error; + } + }else{ + /* In Transparent mode, our RX buffer will always be + * aligned to the 32bit (word) boundary, because + * the RX buffers are all of equal length */ + len=(((chan->mru>>2)-len)<<2) - (~(0x03)&AFT_RXDMA_LO_ALIGN_MASK); + + if (len < 1 || len > chan->mru){ + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; + card->wandev.stats.rx_frame_errors++; + goto rx_comp_error; + } + } +#endif + + *pkt_error=rx_el->pkt_error; + + /* After a RX FIFO overflow, we must mark max 7 + * subsequent frames since firmware, cannot + * guarantee the contents of the fifo */ + + if (wan_test_bit(WP_FIFO_ERROR_BIT,&rx_el->pkt_error)){ + if (chan->hdlc_eng){ + if (++chan->rx_fifo_err_cnt >= WP_MAX_FIFO_FRAMES){ + chan->rx_fifo_err_cnt=0; + } + }else{ + chan->rx_fifo_err_cnt=0; + } + wan_set_bit(WP_FIFO_ERROR_BIT,pkt_error); + }else{ + if (chan->rx_fifo_err_cnt){ + if (++chan->rx_fifo_err_cnt >= WP_MAX_FIFO_FRAMES){ + chan->rx_fifo_err_cnt=0; + } + wan_set_bit(WP_FIFO_ERROR_BIT,pkt_error); + } + } + + if (len > aft_rx_copyback){ + /* The rx size is big enough, thus + * send this buffer up the stack + * and allocate another one */ + memset(wan_skb_data(skb),0,sizeof(wp_rx_element_t)); +#if defined(__FreeBSD__) + wan_skb_trim(skb,sizeof(wp_rx_element_t)); +#endif + wan_skb_put(skb,len); + wan_skb_pull(skb, sizeof(wp_rx_element_t)); + *new_skb=skb; + + aft_alloc_rx_dma_buff(card,chan,1,1); + }else{ + + /* The rx packet is very + * small thus, allocate a new + * buffer and pass it up */ + *new_skb=wan_skb_alloc(len + 20); + if (!*new_skb){ + DEBUG_EVENT("%s:%s: Failed to allocate rx skb pkt (len=%d)!\n", + card->devname,chan->if_name,(len+20)); + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); //chan->if_stats.rx_dropped++; + goto rx_comp_error; + } + + buf=wan_skb_put((*new_skb),len); +#if defined(__FreeBSD__) + wan_skb_trim(skb,sizeof(wp_rx_element_t)); +#endif + memcpy(buf,wan_skb_tail(skb),len); + + aft_init_requeue_free_skb(chan, skb); + } + +#if 0 + if (chan->hdlc_eng){ + buf=wan_skb_data(*new_skb); + if (buf[wan_skb_len(*new_skb)-1] != 0x7E && + buf[wan_skb_len(*new_skb)-1] != 0x7F){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: Rx: Invalid packet len=%d: 0x%X 0x%X 0x%X\n", + card->devname, + wan_skb_len(*new_skb), + buf[wan_skb_len(*new_skb)-3], + buf[wan_skb_len(*new_skb)-2], + buf[wan_skb_len(*new_skb)-1]); + } + } + } +#endif + + return; + +rx_comp_error: + + aft_init_requeue_free_skb(chan, skb); + return; +} + + + +/**SECTION************************************************** + * + * Logic Channel Registration Support and + * Utility funcitons + * + **********************************************************/ + +static int aft_init_requeue_free_skb(private_area_t *chan, netskb_t *skb) +{ + WAN_ASSERT(skb == NULL); + + wan_skb_init(skb,16); + wan_skb_trim(skb,0); + wan_skb_queue_tail(&chan->wp_rx_free_list,skb); + + return 0; +} + +static int +aft_alloc_rx_dma_buff(sdla_t *card, private_area_t *chan, int num, int irq) +{ + int i; + netskb_t *skb; + + for (i=0;ichannelized_cfg && !chan->hdlc_eng){ +#if defined(WANPIPE_64BIT_4G_DMA) + /* On 64bit Systems greater than 4GB we must + * allocated our DMA buffers using GFP_DMA + * flag */ + if (irq) { + skb=__dev_alloc_skb(chan->dma_mru,GFP_DMA|GFP_ATOMIC); + } else { + skb=__dev_alloc_skb(chan->dma_mru,GFP_DMA|GFP_KERNEL); + } +#else + if (irq) { + skb=wan_skb_alloc(chan->dma_mru); + } else { + skb=wan_skb_kalloc(chan->dma_mru); + } +#endif + } else { + if (irq) { + skb=wan_skb_alloc(chan->dma_mru); + } else { + skb=wan_skb_kalloc(chan->dma_mru); + } + } + if (!skb){ + DEBUG_EVENT("%s: %s no rx memory\n", + chan->if_name,__FUNCTION__); + return -ENOMEM; + } + wan_skb_queue_tail(&chan->wp_rx_free_list,skb); + } + + return 0; +} + + +/*============================================================================ + * Enable timer interrupt + */ +static void enable_timer (void* card_id) +{ + sdla_t* card = (sdla_t*)card_id; +#if !defined(WAN_IS_TASKQ_SCHEDULE) + wan_smp_flag_t smp_flags; + wan_smp_flag_t smp_flags1; + int err = 0; +#endif + + if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ + DEBUG_EVENT("%s: Card down: Ignoring enable_timer!\n", + card->devname); + return; + } + + DEBUG_56K("%s: %s Sdla Polling %p!\n",__FUNCTION__, + card->devname, + card->wandev.fe_iface.polling); + +#if defined(WAN_IS_TASKQ_SCHEDULE) + wan_set_bit(AFT_FE_POLL,&card->u.aft.port_task_cmd); + WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); +#else + card->hw_iface.hw_lock(card->hw,&smp_flags1); + wan_spin_lock_irq(&card->wandev.lock, &smp_flags); + if (card->wandev.fe_iface.polling){ + err = card->wandev.fe_iface.polling(&card->fe); + } + wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + card->hw_iface.hw_unlock(card->hw,&smp_flags1); +#endif + + return; +} + +static void enable_ec_timer (void* card_id) +{ +#if defined(CONFIG_WANPIPE_HWEC) + sdla_t* card = (sdla_t*)card_id; +# if !defined(WAN_IS_TASKQ_SCHEDULE) + wan_smp_flag_t smp_flags; + wan_smp_flag_t smp_flags1; +# endif + + if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ + DEBUG_EVENT("%s: Card down: Ignoring enable_timer!\n", + card->devname); + return; + } + + DEBUG_TEST("%s: %s Sdla EC Polling !\n",__FUNCTION__, + card->devname); + +# if defined(WAN_IS_TASKQ_SCHEDULE) + wan_set_bit(AFT_FE_EC_POLL,&card->u.aft.port_task_cmd); + WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); +# else +# error "TASK Q Not defined" + card->hw_iface.hw_lock(card->hw,&smp_flags1); + wan_spin_lock_irq(&card->wandev.lock, &smp_flags); + + wanpipe_ec_poll(card->wandev.ec_dev, card); + + wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + card->hw_iface.hw_unlock(card->hw,&smp_flags1); +# endif +#endif + return; +} +/**SECTION************************************************** + * + * API Bottom Half Handlers + * + **********************************************************/ + +static int tdm_check=0; + +#if defined(__LINUX__) +static void wp_tdm_bh (unsigned long data) +#else +static void wp_tdm_bh (void *data, int pending) +#endif +{ +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) + private_area_t* chan = (private_area_t *)data; + sdla_t *card=chan->card; + int err; + +#if 0 + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: TDM BH Running !\n", + chan->if_name); + } +#endif + + if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ + goto wp_tdm_bh_exit; + } + + if (!wan_test_bit(0,&chan->up)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: wp_tdm_bh() chan not up!\n", + chan->if_name); + } + goto wp_tdm_bh_exit; + } + +#if 0 + if (tdm_check){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: TDM BH Already Running 0x%02X... cool!\n", + chan->if_name,tdm_check); + } + } + wan_set_bit(card->tdmv_conf.span_no,&tdm_check); +#endif + + WAN_TDMV_CALL(rx_tx_span, (card), err); + + WAN_TASKLET_END((&chan->common.bh_task)); + + if (card->wan_tdmv.sc){ + WAN_TDMV_CALL(is_rbsbits, (&card->wan_tdmv), err); + if (err == 1){ + wan_set_bit(AFT_FE_TDM_RBS,&card->u.aft.port_task_cmd); + WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); + } + } + +#if 0 + wan_clear_bit(card->tdmv_conf.span_no,&tdm_check); +#endif + tdm_check++; + + return; + +wp_tdm_bh_exit: + WAN_TASKLET_END((&chan->common.bh_task)); +#endif + return; +} + + +static void wp_bh_rx(private_area_t* chan, netskb_t *new_skb, u8 pkt_error, int len) +{ + sdla_t *card = chan->card; + + if (chan->common.usedby == API){ + + if (chan->hdlc_eng){ + if (card->u.aft.cfg.rx_crc_bytes == 3){ + wan_skb_put(new_skb,3); + }else if (card->u.aft.cfg.rx_crc_bytes == 2){ + wan_skb_put(new_skb,2); + } + } + + if (chan->common.sk == NULL){ + DEBUG_BRI("%s: No sock bound to channel rx dropping!\n", + chan->if_name); + + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); /* ++chan->if_stats.rx_dropped; */ + wan_skb_free(new_skb); + return; + } + +#if defined(__LINUX__) +# ifndef CONFIG_PRODUCT_WANPIPE_GENERIC + + + /* Only for API, we insert packet status + * byte to indicate a packet error. Take + * this byte and put it in the api header */ + + if (wan_skb_headroom(new_skb) >= sizeof(api_rx_hdr_t)){ + api_rx_hdr_t *rx_hdr= + (api_rx_hdr_t*)skb_push(new_skb,sizeof(api_rx_hdr_t)); + memset(rx_hdr,0,sizeof(api_rx_hdr_t)); + rx_hdr->error_flag=pkt_error; + }else{ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: Error Rx pkt headroom %u < %u\n", + chan->if_name, + (u32)wan_skb_headroom(new_skb), + (u32)sizeof(api_rx_hdr_t)); + } + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); /* ++chan->if_stats.rx_dropped; */ + wan_skb_free(new_skb); + return; + } + + new_skb->protocol = htons(PVC_PROT); + new_skb->mac.raw = new_skb->data; + new_skb->dev = chan->common.dev; + new_skb->pkt_type = WAN_PACKET_DATA; + +#if 0 + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); /* chan->if_stats.rx_frame_errors++; */ +#endif + + if (wan_api_rx(chan,new_skb) != 0){ + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); /* ++chan->if_stats.rx_dropped; */ + wan_skb_free(new_skb); + return; + } + +# endif +#endif + + }else if (chan->common.usedby == TDM_VOICE_DCHAN){ + +#ifdef AFT_TDM_API_SUPPORT + if (is_tdm_api(chan,&chan->wp_tdm_api_dev)) { + int err; + + DEBUG_RX("%s: RX TDM API DCHAN %d\n",chan->if_name, wan_skb_len(new_skb)); + + if (wan_skb_headroom(new_skb) >= sizeof(api_rx_hdr_t)){ + api_rx_hdr_t *rx_hdr = + (api_rx_hdr_t*)skb_push(new_skb,sizeof(api_rx_hdr_t)); + memset(rx_hdr,0,sizeof(api_rx_hdr_t)); + //rx_hdr->error_flag=pkt_error; + }else{ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: Error Rx pkt headroom %u < %u\n", + chan->if_name, + (u32)wan_skb_headroom(new_skb), + (u32)sizeof(api_rx_hdr_t)); + } + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); /* ++chan->if_stats.rx_dropped; */ + wan_skb_free(new_skb); + return; + } + err=wanpipe_tdm_api_rx_hdlc(&chan->wp_tdm_api_dev,new_skb); + if (err){ + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); /* ++chan->if_stats.rx_dropped; */ + wan_skb_free(new_skb); + return; + } + + }else +#endif + if (chan->tdmv_zaptel_cfg){ + +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN) + int err; + + BRI_INIT_FUNC(); + + /* ADEBUG */ + WAN_TDMV_CALL(rx_dchan, + (&card->wan_tdmv,chan->tdmv_chan, + wan_skb_data(new_skb),wan_skb_len(new_skb)), + err); + DEBUG_RX("%s TDM DCHAN VOICE Rx Pkt Len=%i Chan=%i\n", + card->devname,wan_skb_len(new_skb), + chan->tdmv_chan); +#else + DEBUG_EVENT("%s: DCHAN Rx Packet critical error TDMV not compiled!\n",card->devname); +#endif + + wan_skb_free(new_skb); + /* Continue through since the above + * function returns void */ + + } else { + DEBUG_EVENT("%s: DCHAN Rx Packet critical error op not supported\n",card->devname); + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); /* ++chan->if_stats.rx_dropped; */ + wan_skb_free(new_skb); + return; + } + + }else if (chan->common.usedby == TDM_VOICE){ + + DEBUG_EVENT("%s: TDM VOICE CRITICAL: IN BH!!!!\n",card->devname); + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); /* ++chan->if_stats.rx_dropped; */ + wan_skb_free(new_skb); + return; + + }else if (chan->common.usedby == STACK){ + + wan_skb_set_csum(new_skb,0); + + if (wanpipe_lip_rx(chan,new_skb) != 0){ + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); /* ++chan->if_stats.rx_dropped; */ + wan_skb_free(new_skb); + return; + } + + }else{ + protocol_recv(chan->card,chan,new_skb); + } + + chan->opstats.Data_frames_Rx_count++; + chan->opstats.Data_bytes_Rx_count+=len; + WAN_NETIF_STATS_INC_RX_PACKETS(&chan->common); /* chan->if_stats.rx_packets++; */ + WAN_NETIF_STATS_INC_RX_BYTES(&chan->common, len); /* chan->if_stats.rx_bytes+=len; */ + return; +} + +#if defined(__LINUX__) +static void wp_bh (unsigned long data) +#else +static void wp_bh (void *data, int pending) +#endif +{ + private_area_t* chan = (private_area_t *)data; + sdla_t *card=chan->card; + netskb_t *new_skb,*skb; + unsigned char pkt_error; + unsigned long timeout=SYSTEM_TICKS; + private_area_t *top_chan; + int len; + +#ifdef AFT_IRQ_STAT_DEBUG + card->wandev.stats.collisions++; +#endif + + if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ + WAN_TASKLET_END((&chan->common.bh_task)); + return; + } + + if (card->u.aft.tdmv_dchan){ + top_chan=wan_netif_priv(chan->common.dev); + }else{ + top_chan=chan; + } + + DEBUG_TEST("%s: ------------ BEGIN --------------: %u\n", + __FUNCTION__,SYSTEM_TICKS); + + if (!wan_test_bit(0,&chan->up)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: wp_bh() chan not up!\n", + chan->if_name); + } + WAN_TASKLET_END((&chan->common.bh_task)); + return; + } + + while((skb=wan_skb_dequeue(&chan->wp_rx_complete_list)) != NULL){ +#if 0 + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //chan->if_stats.rx_errors++; +#endif + if (SYSTEM_TICKS-timeout > 1){ + wan_skb_queue_head(&chan->wp_rx_complete_list,skb); + break; + } + + new_skb=NULL; + pkt_error=0; + + /* The post function will take care + * of the skb and new_skb buffer. + * If new_skb buffer exists, driver + * must pass it up the stack, or free it */ + aft_rx_post_complete (chan->card, chan, + skb, + &new_skb, + &pkt_error); + if (new_skb){ + + len=wan_skb_len(new_skb); + + if (chan->hdlc_eng){ + /* HDLC packets contain 2 byte crc and 1 byte + * flag. If data is not greater than 3, then + * we have a 0 length frame. Thus discard + * (only if HDLC engine enabled) */ + if (len <= 3){ + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //++chan->if_stats.rx_errors; + wan_skb_free(new_skb); + continue; + } + + wan_skb_trim(new_skb,wan_skb_len(new_skb)-3); + len-=3; + } + + wan_capture_trace_packet(chan->card, &top_chan->trace_info, + new_skb,TRC_INCOMING_FRM); + + wp_bh_rx(chan, new_skb, pkt_error, len); + } + } + + while((skb=wan_skb_dequeue(&chan->wp_rx_stack_complete_list)) != NULL){ + len=wan_skb_len(skb); + if (wanpipe_lip_rx(chan,skb) != 0){ + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); //++chan->if_stats.rx_dropped; + wan_skb_free(skb); + }else{ + chan->opstats.Data_frames_Rx_count++; + chan->opstats.Data_bytes_Rx_count+=len; + WAN_NETIF_STATS_INC_RX_PACKETS(&chan->common); //chan->if_stats.rx_packets++; + WAN_NETIF_STATS_INC_RX_BYTES(&chan->common,len); //chan->if_stats.rx_bytes+=len; + } + } + + while((skb=wan_skb_dequeue(&chan->wp_rx_bri_dchan_complete_list)) != NULL){ + /* for BRI the rx data on D-chan is in 'wp_rx_bri_dchan_complete_list'. */ + wp_bh_rx(chan, skb, 0, wan_skb_len(skb)); + } + + while((skb=wan_skb_dequeue(&chan->wp_tx_complete_list)) != NULL){ + aft_tx_post_complete (chan->card,chan,skb); + wan_skb_free(skb); + } + + WAN_TASKLET_END((&chan->common.bh_task)); + /* FIXME: If wanpipe goes down, do not schedule again */ + if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ + return; + } + +#if 1 + if ((len=wan_skb_queue_len(&chan->wp_rx_complete_list))){ + WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); + }else if ((len=wan_skb_queue_len(&chan->wp_tx_complete_list))){ + WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); + }else if ((len=wan_skb_queue_len(&chan->wp_rx_stack_complete_list))){ + WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); + }else if ((len=wan_skb_queue_len(&chan->wp_rx_bri_dchan_complete_list))){ + WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); + } +#endif + + DEBUG_TEST("%s: ------------ END -----------------: %u\n", + __FUNCTION__,SYSTEM_TICKS); + return; +} + +/**SECTION************************************************** + * + * Interrupt Support Functions + * + **********************************************************/ +static void wp_aft_fifo_per_port_isr(sdla_t *card) +{ + u32 rx_status, tx_status; + u32 i; + private_area_t *chan; + int num_of_logic_ch; + u32 tmp_fifo_reg; + + /* Clear HDLC pending registers */ + __sdla_bus_read_4(card->hw, AFT_PORT_REG(card,AFT_TX_FIFO_INTR_PENDING_REG),&tx_status); + __sdla_bus_read_4(card->hw, AFT_PORT_REG(card,AFT_RX_FIFO_INTR_PENDING_REG),&rx_status); + + tx_status&=card->u.aft.active_ch_map; + rx_status&=card->u.aft.active_ch_map; + + num_of_logic_ch=card->u.aft.num_of_time_slots; + + if (!wan_test_bit(0,&card->u.aft.comm_enabled)){ + if (tx_status){ + card->wandev.stats.tx_aborted_errors++; + } + if (rx_status){ + card->wandev.stats.rx_over_errors++; + } + return; + } + + if (tx_status != 0){ + for (i=0;iu.aft.logic_ch_map)){ + + chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; + if (!chan){ + DEBUG_EVENT("Warning: ignoring tx fifo intr: no dev!\n"); + continue; + } + + if (wan_test_bit(0,&chan->interface_down)){ + continue; + } +#if 1 + if (!chan->hdlc_eng && !wan_test_bit(0,&chan->idle_start)){ + DEBUG_TEST("%s: Warning: ignoring tx fifo: dev idle start!\n", + chan->if_name); + continue; + } +#endif + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } + + DEBUG_TEST("%s:%s: Warning TX Fifo Error on LogicCh=%ld Slot=%d!\n", + card->devname,chan->if_name,chan->logic_ch_num,i); + +#if 0 +{ + u32 dma_descr,tmp_reg; + dma_descr=(chan->logic_ch_num<<4) + + AFT_PORT_REG(card,AFT_TX_DMA_HI_DESCR_BASE_REG); + + + card->hw_iface.bus_read_4(card->hw,dma_descr, &tmp_reg); + + DEBUG_EVENT("%s:%s: Warning TX Fifo Error on LogicCh=%ld Slot=%d Reg=0x%X!\n", + card->devname,chan->if_name,chan->logic_ch_num,i,tmp_reg); + +#if 1 + aft_list_tx_descriptors(chan); + aft_critical_shutdown(card); + break; + +#endif + +} +#endif + + aft_tx_fifo_under_recover(card,chan); + WAN_NETIF_STATS_INC_TX_FIFO_ERRORS(&chan->common); //++chan->if_stats.tx_fifo_errors; + card->wandev.stats.tx_aborted_errors++; + __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_TX_FIFO_INTR_PENDING_REG),&tmp_fifo_reg); + } + } + } + + + if (rx_status != 0){ + for (i=0;iu.aft.logic_ch_map)){ + chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; + if (!chan){ + continue; + } + + if (wan_test_bit(0,&chan->interface_down)){ + continue; + } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } + +#ifdef AFT_RX_FIFO_DEBUG +{ + u32 dma_descr,tmp1_reg,tmp_reg,cur_dma_ptr; + u32 dma_ram_desc=chan->logic_ch_num*4 + + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,&tmp_reg); + cur_dma_ptr=aft_dmachain_get_rx_dma_addr(tmp_reg); + + dma_descr=(chan->logic_ch_num<<4) + cur_dma_ptr*AFT_DMA_INDEX_OFFSET + + AFT_PORT_REG(card,AFT_RX_DMA_HI_DESCR_BASE_REG); + + card->hw_iface.bus_read_4(card->hw,dma_descr, &tmp_reg); + card->hw_iface.bus_read_4(card->hw,(dma_descr-4), &tmp1_reg); + + + if (wan_test_bit(AFT_RXDMA_HI_GO_BIT,&tmp_reg)){ + DEBUG_EVENT("%s: Rx Fifo Go Bit Set DMA=%d Addr=0x%X : HI=0x%08X LO=0x%08X OLO=0x%08X Cfg=0x%08X!\n", + card->devname, + cur_dma_ptr, + dma_descr, + tmp_reg,tmp1_reg, +chan->rx_dma_chain_table[chan->rx_chain_indx].dma_addr, +0); + } + + DEBUG_EVENT("%s:%s: Warning RX Fifo Error on Ch=%ld End=%d Cur=%d: Reg=0x%X Addr=0x%X!\n", + card->devname,chan->if_name,chan->logic_ch_num, + chan->rx_chain_indx,cur_dma_ptr,tmp_reg,dma_descr); + +} +#if 0 + aft_display_chain_history(chan); + aft_list_descriptors(chan); +#endif +#endif + WAN_NETIF_STATS_INC_RX_FIFO_ERRORS(&chan->common); //++chan->if_stats.rx_fifo_errors; + WAN_NETIF_STATS_INC_RX_OVER_ERRORS(&chan->common); //++chan->if_stats.rx_over_errors; + chan->errstats.Rx_overrun_err_count++; + card->wandev.stats.rx_over_errors++; + + aft_rx_fifo_over_recover(card,chan); + wan_set_bit(WP_FIFO_ERROR_BIT, &chan->pkt_error); + + __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_RX_FIFO_INTR_PENDING_REG),&tmp_fifo_reg); +#if 0 + /* Debuging Code used to stop the line in + * case of fifo errors */ + aft_list_descriptors(chan); + + aft_critical_shutdown(card); +#endif + } + } + } + + return; +} + +static void front_end_interrupt(sdla_t *card, unsigned long reg, int lock) +{ + + if(IS_BRI_CARD(card)){ + + void **card_list; + u32 max_number_of_ports, i; + sdla_t *tmp_card; + + max_number_of_ports = MAX_BRI_LINES; /* 24 */ + + card_list=__sdla_get_ptr_isr_array(card->hw); + + DEBUG_BRI("%s(): card_list ptr: 0x%p\n", __FUNCTION__, card_list); + + for (i=0; iwandev.fe_iface.isr) { + tmp_card->wandev.fe_iface.isr(&tmp_card->fe); + + if (lock) { + wan_smp_flag_t smp_flags; + wan_spin_lock_irq(&tmp_card->wandev.lock,&smp_flags); + handle_front_end_state(tmp_card); + wan_spin_unlock_irq(&tmp_card->wandev.lock,&smp_flags); + } else { + handle_front_end_state(tmp_card); + } + } + } + } else { + if (card->wandev.fe_iface.isr){ + card->wandev.fe_iface.isr(&card->fe); + + if (lock){ + wan_smp_flag_t smp_flags; + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); + handle_front_end_state(card); + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + }else{ + handle_front_end_state(card); + } + } + } + return; +} + + +/**SECTION*************************************************************** + * + * HARDWARE Interrupt Handlers + * + ***********************************************************************/ + + +/*============================================================================ + * wpfw_isr + * + * Main interrupt service routine. + * Determin the interrupt received and handle it. + * + */ +#if 0 +static u32 aft_shared_irq=0; +static u32 aft_master_dev=0xF; +#endif +#if 0 +static int gdma_cnt=0; +#endif + +#define EC_IRQ_TIMEOUT (HZ/32) + +static WAN_IRQ_RETVAL wp_aft_global_isr (sdla_t* card) +{ + u32 reg_sec=0,reg=0; + u32 a108_reg=0, a56k_reg=0; + u32 fifo_port_intr=0; + u32 dma_port_intr=0; + u32 wdt_port_intr=0; + u32 tdmv_port_intr=0; + u32 fe_intr=0; + u32 max_ports=IS_BRI_CARD(card)?SDLA_MAX_PORTS:8; + + WAN_IRQ_RETVAL_DECL(irq_ret); + + if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ + DEBUG_TEST("%s: Card down, ignoring interrupt!!!!!!!\n", + card->devname); + WAN_IRQ_RETURN(irq_ret); + } + +#ifdef AFT_IRQ_STAT_DEBUG + card->wandev.stats.rx_errors++; +#endif + + if (tdm_check > 0){ + card->wandev.stats.rx_errors=tdm_check; + } + +#ifdef AFT_IRQ_DEBUG + card->wandev.stats.rx_packets++; + if (SYSTEM_TICKS-card->u.aft.gtimeout >= HZ){ + card->wandev.stats.tx_packets=card->wandev.stats.rx_packets; + card->wandev.stats.rx_packets=0; + card->u.aft.gtimeout=SYSTEM_TICKS; + } +#endif + + wan_set_bit(0,&card->in_isr); + + /* -----------------2/6/2003 9:02AM------------------ + * Disable all chip Interrupts (offset 0x040) + * -- "Transmit/Receive DMA Engine" interrupt disable + * -- "FiFo/Line Abort Error" interrupt disable + * --------------------------------------------------*/ + __sdla_bus_read_4(card->hw,AFT_CHIP_CFG_REG, ®); + reg_sec=reg; + + if (wan_test_bit(AFT_CHIPCFG_FE_INTR_STAT_BIT,®)){ + +#ifdef AFT_IRQ_STAT_DEBUG + card->wandev.stats.rx_dropped++; +#endif + DEBUG_BRI("%s(): line: %d\n", __FUNCTION__, __LINE__); + + if (wan_test_bit(AFT_CHIPCFG_FE_INTR_CFG_BIT,®)) { + + DEBUG_BRI("%s: Got Front End Interrupt 0x%08X\n", + card->devname,reg); + + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); + +#ifdef AFT_IRQ_STAT_DEBUG + card->wandev.stats.tx_dropped++; +#endif + fe_intr=1; + + if (card->wandev.fe_iface.check_isr && + card->wandev.fe_iface.check_isr(&card->fe)){ +#if defined(__LINUX__) + wan_set_bit(AFT_FE_INTR,&card->u.aft.port_task_cmd); + WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); + __aft_fe_intr_ctrl(card,0); +#else + front_end_interrupt(card,reg,0); +#endif + } + + }/* if (wan_test_bit(AFT_CHIPCFG_FE_INTR_CFG_BIT,®)) */ + + }/* if (wan_test_bit(AFT_CHIPCFG_FE_INTR_STAT_BIT,®)) */ + +/* New Octasic implementarion May 16 2006 */ +#if defined(CONFIG_WANPIPE_HWEC) + if (card->wandev.ec_dev && + SYSTEM_TICKS-card->wandev.ec_intmask > EC_IRQ_TIMEOUT) { + card->wandev.ec_intmask=SYSTEM_TICKS; + if (!wan_test_bit(AFT_FE_EC_POLL,&card->u.aft.port_task_cmd)){ + /* All work is done from ec_poll routine!!! */ + wan_set_bit(AFT_FE_EC_POLL,&card->u.aft.port_task_cmd); + WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); + } + } +#endif + + if (card->u.aft.firm_id == AFT_DS_FE_CORE_ID || IS_BRI_CARD(card)) { + + __sdla_bus_read_4(card->hw,AFT_CHIP_STAT_REG, &a108_reg); + + fifo_port_intr = aft_chipcfg_a108_get_fifo_intr_stats(a108_reg); + dma_port_intr = aft_chipcfg_a108_get_dma_intr_stats(a108_reg); + wdt_port_intr = aft_chipcfg_a108_get_wdt_intr_stats(a108_reg); + tdmv_port_intr = aft_chipcfg_a108_get_tdmv_intr_stats(a108_reg); + + }else if(IS_56K_CARD(card)){ + __sdla_bus_read_4(card->hw,AFT_CHIP_STAT_REG, &a56k_reg); + fifo_port_intr = wan_test_bit(AFT_CHIPCFG_A56K_FIFO_INTR_BIT,&a56k_reg); + dma_port_intr = wan_test_bit(AFT_CHIPCFG_A56K_DMA_INTR_BIT,&a56k_reg); + wdt_port_intr = wan_test_bit(AFT_CHIPCFG_A56K_WDT_INTR_BIT,&a56k_reg); + }else{ + fifo_port_intr = aft_chipcfg_get_hdlc_intr_stats(reg); + dma_port_intr = aft_chipcfg_get_dma_intr_stats(reg); + wdt_port_intr = aft_chipcfg_get_wdt_intr_stats(reg); + tdmv_port_intr = aft_chipcfg_get_tdmv_intr_stats(reg); + + if (wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { + tdmv_port_intr&=0x01; + } + } + + if (tdmv_port_intr || + dma_port_intr || + fifo_port_intr || + dma_port_intr || + wdt_port_intr) { + /* Pass Through */ + } else { + /* No more interrupts for us */ + goto aft_global_isr_exit; + } + + + if (wan_test_bit(AFT_LCFG_FIFO_INTR_BIT,&card->u.aft.lcfg_reg) && + wan_test_bit(card->wandev.comm_port,&fifo_port_intr)){ +#ifdef AFT_IRQ_STAT_DEBUG + card->wandev.stats.multicast++; +#endif + wp_aft_fifo_per_port_isr(card); + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); + } + +#if 1 + if (wan_test_bit(AFT_LCFG_DMA_INTR_BIT,&card->u.aft.lcfg_reg) && + wan_test_bit(card->wandev.comm_port,&dma_port_intr)){ + + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); + + wp_aft_dma_per_port_isr(card); + + /* Only enable fifo interrupts after a first + * successful DMA interrupt */ +#ifdef AFT_IRQ_STAT_DEBUG + card->wandev.stats.rx_length_errors++; +#endif + +#if 1 + if (wan_test_bit(0,&card->u.aft.comm_enabled) && + !wan_test_bit(AFT_LCFG_FIFO_INTR_BIT,&card->u.aft.lcfg_reg)){ + aft_fifo_intr_ctrl(card, 1); + } +#else +#warning "FIFO Interrupt Disabled" +#endif + } + +#else +#warning "NCDEBUG DMA IGNORED" +#endif + + if (wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { + + if (tdmv_port_intr && + !wan_test_bit(AFT_CHIPCFG_A108_A104_TDM_FIFO_SYNC_BIT,®)) { + + int ring_buf_enabled=wan_test_bit(AFT_CHIPCFG_A108_A104_TDM_DMA_RINGBUF_BIT,®); + sdla_t *tmp_card; + int ring_rsync=0; + void **card_list; + int i; + + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); + +#ifdef AFT_IRQ_STAT_DEBUG + card->wandev.stats.rx_crc_errors++; +#endif + + if (ring_buf_enabled) { + if (card->adptr_type == A104_ADPTR_4TE1 && + card->u.aft.firm_id == AFT_PMC_FE_CORE_ID) { + wan_set_bit(AFT_CHIPCFG_A104_TDM_ACK_BIT,®); + } else { + wan_set_bit(AFT_CHIPCFG_A108_TDM_GLOBAL_RX_INTR_ACK,®); + wan_set_bit(AFT_CHIPCFG_A108_TDM_GLOBAL_TX_INTR_ACK,®); + } + __sdla_bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); + + if (card->hw_iface.fe_test_bit(card->hw,1)) { + DEBUG_EVENT("%s: Global TDM Ring Resync\n",card->devname); + ring_rsync=1; + card->hw_iface.fe_clear_bit(card->hw,1); + } + } + + card_list=__sdla_get_ptr_isr_array(card->hw); + + //FIXME: Use value pre card type + for (i=0;iwandev.state == WAN_CONNECTED && + wan_test_bit(AFT_LCFG_TDMV_INTR_BIT,&tmp_card->u.aft.lcfg_reg)) { +#ifdef AFT_IRQ_STAT_DEBUG + tmp_card->wandev.stats.rx_crc_errors++; +#endif + + if (ring_buf_enabled) { + if (ring_rsync) { + aft_tdm_ring_rsync(tmp_card); + } else { + tmp_card->u.aft.tdm_rx_dma_toggle++; + if (tmp_card->u.aft.tdm_rx_dma_toggle >= AFT_TDMV_CIRC_BUF_LEN) { + tmp_card->u.aft.tdm_rx_dma_toggle=0; + } + + tmp_card->u.aft.tdm_tx_dma_toggle++; + if (tmp_card->u.aft.tdm_tx_dma_toggle >= AFT_TDMV_CIRC_BUF_LEN) { + tmp_card->u.aft.tdm_tx_dma_toggle=0; + } + } + } + +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) + if (tmp_card->wan_tdmv.sc) { + + aft_voice_span_rx_tx(tmp_card, + ring_buf_enabled); + }else +#endif + { + wp_aft_tdmv_per_port_isr(tmp_card); + } + } + } + + if (!ring_buf_enabled) { + if (card->adptr_type == A104_ADPTR_4TE1 && + card->u.aft.firm_id == AFT_PMC_FE_CORE_ID) { + wan_set_bit(AFT_CHIPCFG_A104_TDM_ACK_BIT,®); + } else { + wan_set_bit(AFT_CHIPCFG_A108_TDM_GLOBAL_RX_INTR_ACK,®); + wan_set_bit(AFT_CHIPCFG_A108_TDM_GLOBAL_TX_INTR_ACK,®); + } + __sdla_bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); + } + } + + } else { + + if (wan_test_bit(AFT_LCFG_TDMV_INTR_BIT,&card->u.aft.lcfg_reg) && + wan_test_bit(card->wandev.comm_port,&tdmv_port_intr)){ + + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); + +#ifdef AFT_IRQ_STAT_DEBUG + card->wandev.stats.rx_crc_errors++; +#endif +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) + + if (card->wan_tdmv.sc && + !card->wandev.rtp_len && + card->wandev.config_id != WANCONFIG_AFT_ANALOG) { + u32 dmareg; + aft_voice_span_rx_tx(card, 0); + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_DMA_CTRL_REG),&dmareg); + wan_set_bit(AFT_DMACTRL_TDMV_RX_TOGGLE,&dmareg); + wan_set_bit(AFT_DMACTRL_TDMV_TX_TOGGLE,&dmareg); + card->hw_iface.bus_write_4(card->hw, + AFT_PORT_REG(card,AFT_DMA_CTRL_REG),dmareg); + } else +#endif + { + wp_aft_tdmv_per_port_isr(card); + } + } + } + + if (wan_test_bit(card->wandev.comm_port,&wdt_port_intr)){ + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); + wp_aft_wdt_per_port_isr(card,1); + card->u.aft.wdt_tx_cnt=SYSTEM_TICKS; +#ifdef AFT_IRQ_STAT_DEBUG + card->wandev.stats.rx_fifo_errors++; +#endif + } + +#ifdef AFT_WDT_ENABLE + else if (card->wandev.state == WAN_CONNECTED && + SYSTEM_TICKS-card->u.aft.wdt_tx_cnt > (HZ>>2)){ + wp_aft_wdt_per_port_isr(card,0); + card->u.aft.wdt_tx_cnt=SYSTEM_TICKS; +#ifdef AFT_IRQ_STAT_DEBUG + card->wandev.stats.tx_aborted_errors++; +#endif + } +#endif + + /* -----------------2/6/2003 10:36AM----------------- + * Finish of the interupt handler + * --------------------------------------------------*/ + + +#if AFT_SECURITY_CHECK + + reg=reg_sec; + if (wan_test_bit(AFT_CHIPCFG_SECURITY_STAT_BIT,®)){ + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); + if (++card->u.aft.chip_security_cnt > AFT_MAX_CHIP_SECURITY_CNT){ + DEBUG_EVENT("%s: Critical: AFT Chip Security Compromised: Disabling Driver!(%08X)\n", + card->devname, reg); + DEBUG_EVENT("%s: Please call Sangoma Tech Support (www.sangoma.com)!\n", + card->devname); + + aft_critical_shutdown(card); + } + + } else if (aft_hwdev[card->wandev.card_type].aft_check_ec_security(card)){ + WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); + + if (++card->u.aft.chip_security_cnt > AFT_MAX_CHIP_SECURITY_CNT){ + DEBUG_EVENT("%s: Critical: Echo Canceller Chip Security Compromised: Disabling Driver!\n", + card->devname); + DEBUG_EVENT("%s: Please call Sangoma Tech Support (www.sangoma.com)!\n", + card->devname); + + card->u.aft.chip_security_cnt=0; + aft_critical_shutdown(card); + } + + } else if (card->u.aft.firm_id == AFT_DS_FE_CORE_ID && + card->wandev.state == WAN_CONNECTED && + SYSTEM_TICKS-card->u.aft.sec_chk_cnt > HZ) { + + u32 lcfg_reg; + + card->u.aft.sec_chk_cnt=SYSTEM_TICKS; + __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG), &lcfg_reg); + card->u.aft.lcfg_reg=lcfg_reg; + if (wan_test_bit(AFT_LCFG_TX_FE_SYNC_STAT_BIT,&lcfg_reg) || + wan_test_bit(AFT_LCFG_RX_FE_SYNC_STAT_BIT,&lcfg_reg)){ + if (++card->u.aft.chip_security_cnt > AFT_MAX_CHIP_SECURITY_CNT){ + DEBUG_EVENT("%s: Critical: A108 Lost Sync with Front End: Disabling Driver (0x%08X : A108S=0x%08X)!\n", + card->devname, + lcfg_reg,a108_reg); + DEBUG_EVENT("%s: Please call Sangoma Tech Support (www.sangoma.com)!\n", + card->devname); + + aft_critical_shutdown(card); + } + } else { + card->u.aft.chip_security_cnt=0; + } + } else { + card->u.aft.chip_security_cnt=0; + } +#endif + + DEBUG_TEST("---- ISR end.-------------------\n"); + +aft_global_isr_exit: + + wan_clear_bit(0,&card->in_isr); + WAN_IRQ_RETURN(irq_ret); +} + +static void wp_aft_dma_per_port_isr(sdla_t *card) +{ + int i; + u32 dma_tx_reg,dma_rx_reg; + private_area_t *chan; + u32 dma_tx_voice=0; + + /* -----------------2/6/2003 9:37AM------------------ + * Checking for Interrupt source: + * 1. Receive DMA Engine + * 2. Transmit DMA Engine + * 3. Error conditions. + * --------------------------------------------------*/ + + int num_of_logic_ch; + num_of_logic_ch=card->u.aft.num_of_time_slots; + + /* Zaptel optimization. Dont waist time looking at + channels, when we know that only a single DCHAN + will use this code */ +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) + if (card->wan_tdmv.sc) { + __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_RX_DMA_INTR_PENDING_REG),&dma_rx_reg); + __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_TX_DMA_INTR_PENDING_REG),&dma_tx_reg); + if (card->u.aft.tdmv_dchan) { + chan=(private_area_t*)card->u.aft.dev_to_ch_map[card->u.aft.tdmv_dchan-1]; + if (chan && wan_test_bit(0,&chan->up)) { + aft_dma_rx_complete(card,chan,0); + aft_dma_tx_complete(card,chan,0,0); + } + } + goto isr_skb_rx; + } +#endif + + /* Receive DMA Engine */ + __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_RX_DMA_INTR_PENDING_REG),&dma_rx_reg); + DEBUG_BRI("Line: %d: dma_rx_reg: 0x%X\n", __LINE__, dma_rx_reg); + + dma_rx_reg&=card->u.aft.active_ch_map; + + if (dma_rx_reg == 0){ + goto isr_skb_rx; + } + + dma_rx_reg &= card->u.aft.logic_ch_map; + DEBUG_BRI("Line: %d: dma_rx_reg: 0x%X\n", __LINE__, dma_rx_reg); + + dma_rx_reg &= ~(card->u.aft.tdm_logic_ch_map); + DEBUG_BRI("Line: %d: dma_rx_reg: 0x%X\n", __LINE__, dma_rx_reg); + + for (i=0; iu.aft.dev_to_ch_map[i]; + if (!chan){ + DEBUG_EVENT("%s: Error: No Dev for Rx logical ch=%d\n", + card->devname,i); + continue; + } + + if (!wan_test_bit(0,&chan->up)){ + continue; + } + + if (chan->channelized_cfg && !chan->hdlc_eng){ + wan_set_bit(i,&dma_tx_voice); + continue; + } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } + +#if 0 + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; +#endif + + DEBUG_BRI("%s: RX Interrupt pend. \n", card->devname); + + aft_dma_rx_complete(card,chan,0); + + +#if 0 + if (chan->cfg.tdmv_master_if && !chan->tdmv_irq_cfg){ + aft_channel_rxintr_ctrl(card,chan,1); + DEBUG_EVENT("%s: Master dev %s Synched to master irq\n", + card->devname,chan->if_name); + chan->tdmv_irq_cfg=1; + } +#endif + } + } + + +isr_skb_rx: + + /* Transmit DMA Engine */ + __sdla_bus_read_4(card->hw,AFT_PORT_REG(card,AFT_TX_DMA_INTR_PENDING_REG),&dma_tx_reg); + + dma_tx_reg&=card->u.aft.active_ch_map; + + dma_tx_reg&=~dma_tx_voice; + + if (dma_tx_reg == 0){ + goto isr_skb_tx; + } + + dma_tx_reg &= card->u.aft.logic_ch_map; + dma_tx_reg &= ~(card->u.aft.tdm_logic_ch_map); + + + for (i=0; iu.aft.dev_to_ch_map[i]; + if (!chan){ + DEBUG_EVENT("%s: Error: No Dev for Tx logical ch=%d\n", + card->devname,i); + continue; + } + + if (chan->channelized_cfg && !chan->hdlc_eng){ + continue; + } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } + + DEBUG_ISR("---- TX Interrupt pend. --\n"); + aft_dma_tx_complete(card,chan,0,0); + } + } + +isr_skb_tx: + DEBUG_ISR("---- ISR SKB TX end.-------------------\n"); + + +} + +static void wp_aft_tdmv_per_port_isr(sdla_t *card) +{ + int i; + private_area_t *chan; + +#if 0 + DEBUG_EVENT("%s: TDMV Interrupt LogicCh=%i\n", + card->devname,card->u.aft.num_of_time_slots); +#endif + /* -----------------2/6/2003 9:37AM------------------ + * Checking for Interrupt source: + * 1. Receive DMA Engine + * 2. Transmit DMA Engine + * 3. Error conditions. + * --------------------------------------------------*/ + + + for (i=0; iu.aft.num_of_time_slots;i++){ + + if (!wan_test_bit(i,&card->u.aft.tdm_logic_ch_map)){ + continue; + } + + chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; + if (!chan){ + DEBUG_EVENT("%s: Error: No Dev for Rx logical ch=%d\n", + card->devname,i); + continue; + } + + if (!wan_test_bit(0,&chan->up)){ + continue; + } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } + + if (chan->channelized_cfg && !chan->hdlc_eng){ + aft_dma_rx_tdmv(card,chan); + } + +#if 0 + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; +#endif + + DEBUG_ISR("%s: RX Interrupt pend. \n", + card->devname); + + } +} + + + + + +static void wp_aft_wdt_per_port_isr(sdla_t *card, int wdt_intr) +{ + int i,wdt_disable = 0; + int timeout=AFT_WDTCTRL_TIMEOUT; + + aft_wdt_reset(card); + + for (i=0; iu.aft.num_of_time_slots;i++){ + + private_area_t *chan; + + if (!wan_test_bit(i,&card->u.aft.logic_ch_map)){ + continue; + } + + chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; + if (!chan){ + continue; + } + + if (!wan_test_bit(0,&chan->up) || + wan_test_bit(0,&chan->interface_down)){ + continue; + } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } + +#if 0 + if (wdt_intr){ + WAN_NETIF_STATS_INC_TX_DROPPED(&chan->common); //++chan->if_stats.tx_dropped; + }else{ + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //++chan->if_stats.tx_errors; + } +#endif + + if (card->wandev.state == WAN_CONNECTED){ + + if (chan->single_dma_chain){ + wdt_disable=1; + continue; + } +#if 0 + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //++chan->if_stats.tx_errors; +#endif + aft_dma_tx_complete (card,chan,1,0); + + } + +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) + else{ + if (chan->tdmv_zaptel_cfg && + wan_test_bit(0,&chan->up) && + chan->cfg.tdmv_master_if){ + /* If the line becomes disconnected + * keep calling TDMV zaptel in order to + * provide timing */ + if (wdt_intr && chan->cfg.tdmv_master_if){ + int i, err; + void **card_list=__sdla_get_ptr_isr_array(card->hw); + sdla_t *tmp_card; + for (i=0;i<8;i++) { + tmp_card=card_list[i]; + if (!tmp_card) { + continue; + } + if (tmp_card != card) { + /* Only run timing from a first + configured single card */ + DEBUG_TEST("%s: Disabling zaptel timing ! \n",card->devname); + return; + } else { + break; + } + } +#if 0 + WAN_NETIF_STATS_INC_TX_DROPPED(&chan->common); //++chan->if_stats.tx_dropped; +#endif + +#if 1 + timeout=1; + aft_wdt_set(card,timeout); + WAN_TDMV_CALL(rx_tx_span, (card), err); +#else +#warning "NCDEBUG: rx_tx_span disabled poll" +#endif + return; + } + } + } +#endif + } + +#ifdef AFT_WDT_ENABLE + /* Since this fucntion can be called via interrupt or + * via interrupt poll, only re-enable wdt interrupt + * if the function was called from the wdt_intr + * not from wdt poll */ + if (!wdt_disable && wdt_intr){ + aft_wdt_set(card,timeout); + } +#endif + + return; + +} + +/**SECTION*********************************************************** + * + * WANPIPE Debugging Interfaces + * + ********************************************************************/ + + + +/*============================================================================= + * process_udp_mgmt_pkt + * + * Process all "wanpipemon" debugger commands. This function + * performs all debugging tasks: + * + * Line Tracing + * Line/Hardware Statistics + * Protocol Statistics + * + * "wanpipemon" utility is a user-space program that + * is used to debug the WANPIPE product. + * + */ +#if 1 +static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, + private_area_t* chan, int local_dev ) +{ + unsigned short buffer_length; + wan_udp_pkt_t *wan_udp_pkt; + wan_trace_t *trace_info=NULL; + + wan_udp_pkt = (wan_udp_pkt_t *)chan->udp_pkt_data; + + if (wan_atomic_read(&chan->udp_pkt_len) == 0){ + return -ENODEV; + } + + trace_info=&chan->trace_info; + wan_udp_pkt = (wan_udp_pkt_t *)chan->udp_pkt_data; + + { + + netskb_t *skb; + + wan_udp_pkt->wan_udp_opp_flag = 0; + + switch(wan_udp_pkt->wan_udp_command) { + + case READ_CONFIGURATION: + wan_udp_pkt->wan_udp_return_code = 0; + wan_udp_pkt->wan_udp_data_len=0; + break; + + case READ_CODE_VERSION: + wan_udp_pkt->wan_udp_return_code = 0; + wan_udp_pkt->wan_udp_data[0]=card->u.aft.firm_ver; + wan_udp_pkt->wan_udp_data_len=1; + break; + + case AFT_LINK_STATUS: + wan_udp_pkt->wan_udp_return_code = 0; + if (card->wandev.state == WAN_CONNECTED){ + wan_udp_pkt->wan_udp_data[0]=1; + }else{ + wan_udp_pkt->wan_udp_data[0]=0; + } + wan_udp_pkt->wan_udp_data_len=1; + break; + + case AFT_MODEM_STATUS: + wan_udp_pkt->wan_udp_return_code = 0; + if (card->wandev.state == WAN_CONNECTED){ + wan_udp_pkt->wan_udp_data[0]=0x28; + }else{ + wan_udp_pkt->wan_udp_data[0]=0; + } + wan_udp_pkt->wan_udp_data_len=1; + break; + + case DIGITAL_LOOPTEST: + wan_udp_pkt->wan_udp_return_code = + digital_loop_test(card,wan_udp_pkt); + break; + + case READ_OPERATIONAL_STATS: + wan_udp_pkt->wan_udp_return_code = 0; + memcpy(wan_udp_pkt->wan_udp_data,&chan->opstats,sizeof(aft_op_stats_t)); + wan_udp_pkt->wan_udp_data_len=sizeof(aft_op_stats_t); + break; + + case FLUSH_OPERATIONAL_STATS: + wan_udp_pkt->wan_udp_return_code = 0; + memset(&chan->opstats,0,sizeof(aft_op_stats_t)); + wan_udp_pkt->wan_udp_data_len=0; + break; + + case READ_COMMS_ERROR_STATS: + wan_udp_pkt->wan_udp_return_code = 0; + memcpy(wan_udp_pkt->wan_udp_data,&chan->errstats,sizeof(aft_comm_err_stats_t)); + wan_udp_pkt->wan_udp_data_len=sizeof(aft_comm_err_stats_t); + break; + + case FLUSH_COMMS_ERROR_STATS: + wan_udp_pkt->wan_udp_return_code = 0; + memset(&chan->errstats,0,sizeof(aft_comm_err_stats_t)); + wan_udp_pkt->wan_udp_data_len=0; + break; + + + case ENABLE_TRACING: + + wan_udp_pkt->wan_udp_return_code = WAN_CMD_OK; + wan_udp_pkt->wan_udp_data_len = 0; + + if (!wan_test_bit(0,&trace_info->tracing_enabled)){ + + trace_info->trace_timeout = SYSTEM_TICKS; + + wan_trace_purge(trace_info); + + if (wan_udp_pkt->wan_udp_data[0] == 0){ + wan_clear_bit(1,&trace_info->tracing_enabled); + DEBUG_UDP("%s: ADSL L3 trace enabled!\n", + card->devname); + }else if (wan_udp_pkt->wan_udp_data[0] == 1){ + wan_clear_bit(2,&trace_info->tracing_enabled); + wan_set_bit(1,&trace_info->tracing_enabled); + DEBUG_UDP("%s: ADSL L2 trace enabled!\n", + card->devname); + }else{ + wan_clear_bit(1,&trace_info->tracing_enabled); + wan_set_bit(2,&trace_info->tracing_enabled); + DEBUG_UDP("%s: ADSL L1 trace enabled!\n", + card->devname); + } + wan_set_bit (0,&trace_info->tracing_enabled); + + }else{ + DEBUG_EVENT("%s: Error: ATM trace running!\n", + card->devname); + wan_udp_pkt->wan_udp_return_code = 2; + } + + break; + + case DISABLE_TRACING: + + wan_udp_pkt->wan_udp_return_code = WAN_CMD_OK; + + if(wan_test_bit(0,&trace_info->tracing_enabled)) { + + wan_clear_bit(0,&trace_info->tracing_enabled); + wan_clear_bit(1,&trace_info->tracing_enabled); + wan_clear_bit(2,&trace_info->tracing_enabled); + + wan_trace_purge(trace_info); + + DEBUG_UDP("%s: Disabling AFT trace\n", + card->devname); + + }else{ + /* set return code to line trace already + disabled */ + wan_udp_pkt->wan_udp_return_code = 1; + } + + break; + + case GET_TRACE_INFO: + + if(wan_test_bit(0,&trace_info->tracing_enabled)){ + trace_info->trace_timeout = SYSTEM_TICKS; + }else{ + DEBUG_EVENT("%s: Error ATM trace not enabled\n", + card->devname); + /* set return code */ + wan_udp_pkt->wan_udp_return_code = 1; + break; + } + + buffer_length = 0; + wan_udp_pkt->wan_udp_atm_num_frames = 0; + wan_udp_pkt->wan_udp_atm_ismoredata = 0; + +#if defined(__FreeBSD__) || defined(__OpenBSD__) + while (wan_skb_queue_len(&trace_info->trace_queue)){ + WAN_IFQ_POLL(&trace_info->trace_queue, skb); + if (skb == NULL){ + DEBUG_EVENT("%s: No more trace packets in trace queue!\n", + card->devname); + break; + } + if ((WAN_MAX_DATA_SIZE - buffer_length) < skb->m_pkthdr.len){ + /* indicate there are more frames on board & exit */ + wan_udp_pkt->wan_udp_atm_ismoredata = 0x01; + break; + } + + m_copydata(skb, + 0, + skb->m_pkthdr.len, + &wan_udp_pkt->wan_udp_data[buffer_length]); + buffer_length += skb->m_pkthdr.len; + WAN_IFQ_DEQUEUE(&trace_info->trace_queue, skb); + if (skb){ + wan_skb_free(skb); + } + wan_udp_pkt->wan_udp_atm_num_frames++; + } +#elif defined(__LINUX__) + while ((skb=skb_dequeue(&trace_info->trace_queue)) != NULL){ + + if((MAX_TRACE_BUFFER - buffer_length) < wan_skb_len(skb)){ + /* indicate there are more frames on board & exit */ + wan_udp_pkt->wan_udp_atm_ismoredata = 0x01; + if (buffer_length != 0){ + wan_skb_queue_head(&trace_info->trace_queue, skb); + }else{ + /* If rx buffer length is greater than the + * whole udp buffer copy only the trace + * header and drop the trace packet */ + + memcpy(&wan_udp_pkt->wan_udp_atm_data[buffer_length], + wan_skb_data(skb), + sizeof(wan_trace_pkt_t)); + + buffer_length = sizeof(wan_trace_pkt_t); + wan_udp_pkt->wan_udp_atm_num_frames++; + wan_skb_free(skb); + } + break; + } + + memcpy(&wan_udp_pkt->wan_udp_atm_data[buffer_length], + wan_skb_data(skb), + wan_skb_len(skb)); + + buffer_length += wan_skb_len(skb); + wan_skb_free(skb); + wan_udp_pkt->wan_udp_atm_num_frames++; + } +#endif + /* set the data length and return code */ + wan_udp_pkt->wan_udp_data_len = buffer_length; + wan_udp_pkt->wan_udp_return_code = WAN_CMD_OK; + break; + + case ROUTER_UP_TIME: + wan_getcurrenttime(&chan->router_up_time, NULL); + chan->router_up_time -= chan->router_start_time; + *(unsigned long *)&wan_udp_pkt->wan_udp_data = + chan->router_up_time; + wan_udp_pkt->wan_udp_data_len = sizeof(unsigned long); + wan_udp_pkt->wan_udp_return_code = 0; + break; + + case WAN_GET_MEDIA_TYPE: + if (card->wandev.fe_iface.get_fe_media){ + wan_udp_pkt->wan_udp_data[0] = + card->wandev.fe_iface.get_fe_media(&card->fe); + wan_udp_pkt->wan_udp_return_code = WAN_CMD_OK; + wan_udp_pkt->wan_udp_data_len = sizeof(unsigned char); + }else{ + wan_udp_pkt->wan_udp_return_code = WAN_UDP_INVALID_CMD; + } + break; +#if 0 + case WAN_FE_GET_STAT: + case WAN_FE_SET_LB_MODE: + case WAN_FE_FLUSH_PMON: + case WAN_FE_GET_CFG: + case WAN_FE_SET_DEBUG_MODE: + case WAN_FE_TX_MODE: + + if (IS_TE1_CARD(card)){ + wan_smp_flag_t smp_flags; + card->hw_iface.hw_lock(card->hw,&smp_flags); + card->wandev.fe_iface.process_udp( + &card->fe, + &wan_udp_pkt->wan_udp_cmd, + &wan_udp_pkt->wan_udp_data[0]); + card->hw_iface.hw_unlock(card->hw,&smp_flags); + }else{ + wan_udp_pkt->wan_udp_return_code = WAN_UDP_INVALID_CMD; + } + break; +#endif + + case WAN_GET_PROTOCOL: + wan_udp_pkt->wan_udp_aft_num_frames = card->wandev.config_id; + wan_udp_pkt->wan_udp_return_code = CMD_OK; + wan_udp_pkt->wan_udp_data_len = 1; + break; + + case WAN_GET_PLATFORM: + wan_udp_pkt->wan_udp_data[0] = WAN_PLATFORM_ID; + wan_udp_pkt->wan_udp_return_code = CMD_OK; + wan_udp_pkt->wan_udp_data_len = 1; + break; + + case WAN_GET_MASTER_DEV_NAME: + wan_udp_pkt->wan_udp_data_len = 0; + wan_udp_pkt->wan_udp_return_code = 0xCD; + break; + + case AFT_HWEC_STATUS: + *(unsigned long *)&wan_udp_pkt->wan_udp_data[0] = + IS_E1_CARD(card) ? card->wandev.ec_map: + card->wandev.ec_map << 1; + wan_udp_pkt->wan_udp_data_len = sizeof(unsigned long); + wan_udp_pkt->wan_udp_return_code = 0; + break; + + default: + if ((wan_udp_pkt->wan_udp_command & 0xF0) == WAN_FE_UDP_CMD_START){ + /* FE udp calls */ + wan_smp_flag_t smp_flags,smp_flags1; + + card->hw_iface.hw_lock(card->hw,&smp_flags); + wan_spin_lock_irq(&card->wandev.lock,&smp_flags1); + card->wandev.fe_iface.process_udp( + &card->fe, + &wan_udp_pkt->wan_udp_cmd, + &wan_udp_pkt->wan_udp_data[0]); + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags1); + card->hw_iface.hw_unlock(card->hw,&smp_flags); + + break; + } + wan_udp_pkt->wan_udp_data_len = 0; + wan_udp_pkt->wan_udp_return_code = 0xCD; + + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT( + "%s: Warning, Illegal UDP command attempted from network: %x\n", + card->devname,wan_udp_pkt->wan_udp_command); + } + break; + } /* end of switch */ + } /* end of else */ + + /* Fill UDP TTL */ + wan_udp_pkt->wan_ip_ttl= card->wandev.ttl; + + wan_udp_pkt->wan_udp_request_reply = UDPMGMT_REPLY; + return 1; + +} +#endif + + + +/**SECTION************************************************************* + * + * TASK Functions and Triggers + * + **********************************************************************/ + + +/*============================================================================ + * port_set_state + * + * Set PORT state. + * + */ +static void port_set_state (sdla_t *card, int state) +{ + struct wan_dev_le *devle; + netdevice_t *dev; + + if (card->wandev.state != state) + { +#if 0 + switch (state) + { + case WAN_CONNECTED: + DEBUG_EVENT( "%s: Front End Link connected!\n", + card->devname); + break; + + case WAN_CONNECTING: + DEBUG_EVENT( "%s: Front End Link connecting...\n", + card->devname); + break; + + case WAN_DISCONNECTED: + DEBUG_EVENT( "%s: Front End Link disconnected!\n", + card->devname); + break; + } +#endif + card->wandev.state = state; + WAN_LIST_FOREACH(devle, &card->wandev.dev_head, dev_link){ + dev = WAN_DEVLE2DEV(devle); + if (!dev) continue; + set_chan_state(card, dev, state); + } + } +} + +/*============================================================ + * handle_front_end_state + * + * Front end state indicates the physical medium that + * the Z80 backend connects to. + * + * S514-1/2/3: V32/RS232/FT1 Front End + * Front end state is determined via + * Modem/Status. + * S514-4/5/7/8: 56K/T1/E1 Front End + * Front end state is determined via + * link status interrupt received + * from the front end hardware. + * + * If the front end state handler is enabed by the + * user. The interface state will follow the + * front end state. I.E. If the front end goes down + * the protocol and interface will be declared down. + * + * If the front end state is UP, then the interface + * and protocol will be up ONLY if the protocol is + * also UP. + * + * Therefore, we must have three state variables + * 1. Front End State (card->wandev.front_end_status) + * 2. Protocol State (card->wandev.state) + * 3. Interface State (dev->flags & IFF_UP) + * + */ + +static void handle_front_end_state(void *card_id) +{ + sdla_t *card = (sdla_t*)card_id; + + if (!wan_test_bit(AFT_CHIP_CONFIGURED,&card->u.aft.chip_cfg_status) && + card->fe.fe_status == FE_CONNECTED) { + DEBUG_TEST("%s: Skipping Front Front End State = %x\n", + card->devname,card->fe.fe_status); + + wan_set_bit(AFT_FRONT_END_UP,&card->u.aft.chip_cfg_status); + return; + } + + + if (card->wandev.ignore_front_end_status == WANOPT_YES) { + if (card->wandev.state != WAN_CONNECTED){ + enable_data_error_intr(card); + port_set_state(card,WAN_CONNECTED); + wan_set_bit(AFT_FE_LED,&card->u.aft.port_task_cmd); + } + return; + } + + if (card->fe.fe_status == FE_CONNECTED){ + if (card->wandev.state != WAN_CONNECTED){ + +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) + if (card->wan_tdmv.sc){ + int err; + WAN_TDMV_CALL(state, (card, WAN_CONNECTED), err); + } +#endif + /* WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); */ + + if (card->tdmv_conf.span_no && + !wan_test_bit(0,&card->u.aft.tdmv_master_if_up)){ + DEBUG_EVENT("%s: Skipping AFT Communication wait for MasterIF\n", + card->devname); + return; + } + + enable_data_error_intr(card); + port_set_state(card,WAN_CONNECTED); + wan_set_bit(AFT_FE_LED,&card->u.aft.port_task_cmd); + + } + }else{ + if (card->wandev.state == WAN_CONNECTED){ + port_set_state(card,WAN_DISCONNECTED); + disable_data_error_intr(card,LINK_DOWN); + + wan_set_bit(AFT_FE_LED,&card->u.aft.port_task_cmd); + /* We are already in the poll task here so + * no need to schedule. because next check in the + * poll routine would be the AFT_FE_LED */ + /* WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); */ + +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) + if (card->wan_tdmv.sc){ + int err; + WAN_TDMV_CALL(state, (card, WAN_DISCONNECTED), err); + } +#endif + } + } + +} + +unsigned char aft_read_cpld(sdla_t *card, unsigned short cpld_off) +{ + return aft_hwdev[card->wandev.card_type].aft_read_cpld(card,cpld_off); +} + +int aft_write_cpld(void *pcard, unsigned short off,unsigned char data) +{ + sdla_t *card = (sdla_t *)pcard; + return aft_hwdev[card->wandev.card_type].aft_write_cpld(card,off,data); +} + +#if 0 +/*============================================================================ + * Read TE1/56K Front end registers + */ +static unsigned char +write_front_end_reg (void* card1, unsigned short off, unsigned char value) +{ + sdla_t* card = (sdla_t*)card1; + + if (card->wandev.card_type == WANOPT_AFT_ANALOG){ + DEBUG_EVENT("%s: Internal Error (%s:%d)\n", + card->devname, __FUNCTION__,__LINE__); + return 0x00; + } + return aft_hwdev[card->wandev.card_type].aft_write_fe(card1,off,value); +} + +/*============================================================================ + * Read TE1/56K Front end registers + */ +static unsigned char +read_front_end_reg (void* card1, unsigned short off) +{ + sdla_t* card = (sdla_t*)card1; + + if (card->wandev.card_type == WANOPT_AFT_ANALOG){ + DEBUG_EVENT("%s: Internal Error (%s:%d)\n", + card->devname, __FUNCTION__,__LINE__); + return 0x00; + } + return aft_hwdev[card->wandev.card_type].aft_read_fe(card1,off); +} +#endif + +static unsigned char +aft_write_ec (void* card1, unsigned short off, unsigned char value) +{ + DEBUG_EVENT("ADEBUG: Write Octasic Offset %04X Value %02X!\n", + off, value); + return 0; +} + +/*============================================================================ + * Read from Octasic board + */ +static unsigned char +aft_read_ec (void* card1, unsigned short off) +{ + u8 value = 0x00; + + DEBUG_EVENT("ADEBUG: Read Octasic offset %04X Value %02X (temp)!\n", + off, value); + return value; +} + + + +static int aft_read(sdla_t *card, wan_cmd_api_t *api_cmd) +{ + WAN_ASSERT(card == NULL); + WAN_ASSERT(api_cmd == NULL); + + if(api_cmd->len == 1){ + if (api_cmd->offset <= 0x3C){ + card->hw_iface.pci_read_config_byte( + card->hw, + api_cmd->offset, + (u8*)&api_cmd->data[0]); + }else{ + card->hw_iface.bus_read_1( + card->hw, + api_cmd->offset, + (u8*)&api_cmd->data[0]); + } + }else if (api_cmd->len == 2){ + if (api_cmd->offset <= 0x3C){ + card->hw_iface.pci_read_config_word( + card->hw, + api_cmd->offset, + (u16*)&api_cmd->data[0]); + }else{ + card->hw_iface.bus_read_2( + card->hw, + api_cmd->offset, + (u16*)&api_cmd->data[0]); + } + }else if (api_cmd->len == 4){ + if (api_cmd->offset <= 0x3C){ + card->hw_iface.pci_read_config_dword(card->hw, + api_cmd->offset, + (u32*)&api_cmd->data[0]); + }else{ + WAN_ASSERT(card->hw_iface.bus_read_4 == NULL); + card->hw_iface.bus_read_4( + card->hw, + api_cmd->offset, + (u32*)&api_cmd->data[0]); + } + }else{ + card->hw_iface.peek(card->hw, + api_cmd->offset, + &api_cmd->data[0], + api_cmd->len); + } + +#if defined(DEBUG_REG) + DEBUG_EVENT("%s: Reading Bar%d Offset=0x%X Data=%08X Len=%d\n", + card->devname, + api_cmd->bar, + api_cmd->offset, + *(u32*)&api_cmd->data[0], + api_cmd->len); +#endif + + return 0; +} + +static int aft_fe_read(sdla_t *card, wan_cmd_api_t *api_cmd) +{ + wan_smp_flag_t smp_flags; + + card->hw_iface.hw_lock(card->hw,&smp_flags); + api_cmd->data[0] = (u8)card->fe.read_fe_reg(card, (int)api_cmd->offset); + card->hw_iface.hw_unlock(card->hw,&smp_flags); + +#ifdef DEB_XILINX + DEBUG_EVENT("%s: Reading Bar%d Offset=0x%X Len=%d Val=%02X\n", + card->devname,api_cmd->bar,api_cmd->offset,api_cmd->len, api_cmd->data[0]); +#endif + + return 0; +} + +static int aft_write(sdla_t *card, wan_cmd_api_t *api_cmd) +{ + + if (api_cmd->len == 1){ + card->hw_iface.bus_write_1( + card->hw, + api_cmd->offset, + *(u8*)&api_cmd->data[0]); +#if defined(DEBUG_REG) + DEBUG_EVENT("%s: Write Offset=0x%08X Data=0x%02X\n", + card->devname,api_cmd->offset, + *(u8*)&api_cmd->data[0]); +#endif + }else if (api_cmd->len == 2){ + card->hw_iface.bus_write_2( + card->hw, + api_cmd->offset, + *(u16*)&api_cmd->data[0]); +#if defined(DEBUG_REG) + DEBUG_EVENT("%s: Write Offset=0x%08X Data=0x%04X\n", + card->devname,api_cmd->offset, + *(unsigned short*)&api_cmd->data[0]); +#endif + }else if (api_cmd->len == 4){ + card->hw_iface.bus_write_4( + card->hw, + api_cmd->offset, + *(unsigned int*)&api_cmd->data[0]); +#if defined(DEBUG_REG) + DEBUG_EVENT("ADEBUG: %s: Write Offset=0x%08X Data=0x%08X\n", + card->devname,api_cmd->offset, + *(u32*)&api_cmd->data[0]); +#endif + }else{ + card->hw_iface.poke( + card->hw, + api_cmd->offset, + (u8*)&api_cmd->data[0], + api_cmd->len); +#if 0 + memcpy_toio((unsigned char*)vector, + (unsigned char*)&api_cmd->data[0], api_cmd->len); +#endif + } + + return 0; +} + +static int aft_fe_write(sdla_t *card, wan_cmd_api_t *api_cmd) +{ + wan_smp_flag_t smp_flags; + +#ifdef DEB_XILINX + DEBUG_EVENT("%s: Writting Bar%d Offset=0x%X Len=%d Val=%02X\n", + card->devname, + api_cmd->bar, + api_cmd->offset, + api_cmd->len, + api_cmd->data[0]); +#endif + + + card->hw_iface.hw_lock(card->hw,&smp_flags); + card->fe.write_fe_reg (card, (int)api_cmd->offset, (int)api_cmd->data[0]); + card->hw_iface.hw_unlock(card->hw,&smp_flags); + + return 0; + +} + + + +static int aft_write_bios(sdla_t *card, wan_cmd_api_t *api_cmd) +{ + +#ifdef DEB_XILINX + DEBUG_EVENT("Setting PCI 0xX=0x%08lX 0x3C=0x%08X\n", + (card->wandev.S514_cpu_no[0] == SDLA_CPU_A) ? 0x10 : 0x14, + card->u.aft.bar,card->wandev.irq); +#endif + card->hw_iface.pci_write_config_dword(card->hw, + (card->wandev.S514_cpu_no[0] == SDLA_CPU_A) ? 0x10 : 0x14, + card->u.aft.bar); + card->hw_iface.pci_write_config_dword(card->hw, 0x3C, card->wandev.irq); + card->hw_iface.pci_write_config_dword(card->hw, 0x0C, 0x0000ff00); + + return 0; +} + +#if 0 +extern int OctDrvIoctl(sdla_t*, int cmd, void*); +#endif + +static int aft_hwec(sdla_t *card, wan_cmd_api_t *api_cmd) +{ + +#if 0 + if (api_cmd->offset){ + /* Use direct read/write to/from octasic chip */ + if (api_cmd->len){ + /* Write */ + aft_write_ec (card, api_cmd->offset, api_cmd->data[0]); + }else{ + /* Read */ + api_cmd->data[0] = aft_read_ec (card, api_cmd->offset); + api_cmd->len = 1; + } + }else +#endif + { +#if 0 + OctDrvIoctl(card, api_cmd->cmd, api_cmd->data); +#endif + } + + return 0; +} + +static int aft_devel_ioctl(sdla_t *card, struct ifreq *ifr) +{ + wan_cmd_api_t api_cmd; + int err = -EINVAL; + + if (!ifr || !ifr->ifr_data){ + DEBUG_EVENT("%s: Error: No ifr or ifr_data\n",__FUNCTION__); + return -EFAULT; + } + + if (WAN_COPY_FROM_USER(&api_cmd,ifr->ifr_data,sizeof(wan_cmd_api_t))){ + return -EFAULT; + } + + switch(api_cmd.cmd){ + case SIOC_WAN_READ_REG: + err=aft_read(card, &api_cmd); + break; + case SIOC_WAN_WRITE_REG: + err=aft_write(card, &api_cmd); + break; + + case SIOC_WAN_FE_READ_REG: + err=aft_fe_read(card, &api_cmd); + break; + + case SIOC_WAN_FE_WRITE_REG: + err=aft_fe_write(card, &api_cmd); + break; + + case SIOC_WAN_SET_PCI_BIOS: + err=aft_write_bios(card, &api_cmd); + break; + + case SIOC_WAN_EC_REG: + err = aft_hwec(card, &api_cmd); + break; + } + if (WAN_COPY_TO_USER(ifr->ifr_data,&api_cmd,sizeof(wan_cmd_api_t))){ + return -EFAULT; + } + return err; +} + + +/*========================================= + * enable_data_error_intr + * + * Description: + * + * Run only after the front end comes + * up from down state. + * + * Clean the DMA Tx/Rx pending interrupts. + * (Ignore since we will reconfigure + * all dma descriptors. DMA controler + * was already disabled on link down) + * + * For all channels clean Tx/Rx Fifo + * + * Enable DMA controler + * (This starts the fifo cleaning + * process) + * + * For all channels reprogram Tx/Rx DMA + * descriptors. + * + * Clean the Tx/Rx Error pending interrupts. + * (Since dma fifo's are now empty) + * + * Enable global DMA and Error interrutps. + * + */ + +static void enable_data_error_intr(sdla_t *card) +{ + u32 reg; + int i,err; + int card_use_cnt; + + + + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &card_use_cnt); + + DEBUG_TEST("%s: %s() Card Port =%i Use Cnt = %i \n", + card->devname,__FUNCTION__,card->wandev.comm_port,card_use_cnt); + + + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG), ®); + if (wan_test_bit(AFT_LCFG_FE_IFACE_RESET_BIT,®)){ + DEBUG_EVENT("%s: Warning: Skipping data enable wait for cfg!\n", + card->devname); + return; + } + +#if 0 + aft_list_dma_chain_regs(card); +#endif + + if (card->tdmv_conf.span_no && + !wan_test_bit(0,&card->u.aft.tdmv_master_if_up)){ + DEBUG_EVENT("%s: Critical error: Enable Card while Master If Not up!\n", + card->devname); + } + + if (wan_test_bit(0,&card->u.aft.comm_enabled)){ + disable_data_error_intr(card,LINK_DOWN); + } + + aft_wdt_reset(card); + + if (!IS_BRI_CARD(card) || (IS_BRI_CARD(card) && card_use_cnt == 1)) { + /* Clean Tx/Rx DMA interrupts */ + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_TX_DMA_INTR_PENDING_REG), + ®); + + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_RX_DMA_INTR_PENDING_REG), + ®); + } + + + err=aft_hwdev[card->wandev.card_type].aft_test_sync(card,0); + if (err){ + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG), ®); + DEBUG_EVENT("%s: Error: Front End Interface out of sync! (0x%X)\n", + card->devname,reg); + + /*FIXME: How to recover from here, should never happen */ + } + + if (card->tdmv_conf.span_no){ + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_LINE_CFG_REG), ®); + wan_set_bit(AFT_LCFG_TDMV_INTR_BIT,®); + card->hw_iface.bus_write_4(card->hw, + AFT_PORT_REG(card,AFT_LINE_CFG_REG), reg); + + } + + for (i=0; iu.aft.num_of_time_slots;i++){ + private_area_t *chan; + + if (!wan_test_bit(i,&card->u.aft.logic_ch_map)){ + continue; + } + + chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; + if (!chan){ + continue; + } + + if (!wan_test_bit(0,&chan->up)){ + continue; + } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } + + DEBUG_TEST("%s: 1) Free Used DMA CHAINS %s\n", + card->devname,chan->if_name); + + aft_free_rx_complete_list(chan); + aft_free_rx_descriptors(chan); + + DEBUG_TEST("%s: 1) Free UNUSED DMA CHAINS %s\n", + card->devname,chan->if_name); + + wan_clear_bit(TX_INTR_PENDING,&chan->dma_chain_status); + + if (chan->channelized_cfg && !chan->hdlc_eng){ + aft_tx_dma_voice_handler((unsigned long)chan,0,1); + }else{ + aft_tx_dma_chain_handler((unsigned long)chan,0,1); + } + + aft_free_tx_descriptors(chan); + + DEBUG_TEST("%s: 2) Init interface fifo no wait %s\n", + card->devname,chan->if_name); + + aft_tslot_sync_ctrl(card,chan,0); + + aft_init_rx_dev_fifo(card, chan, WP_NO_WAIT); + aft_init_tx_dev_fifo(card, chan, WP_NO_WAIT); + + } + + + /* Enable Global DMA controler, in order to start the + * fifo cleaning */ + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),®); + wan_set_bit(AFT_DMACTRL_GLOBAL_INTR_BIT,®); + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),reg); + + /* For all channels clean Tx/Rx fifos */ + for (i=0; iu.aft.num_of_time_slots;i++){ + private_area_t *chan; + + if (!wan_test_bit(i,&card->u.aft.logic_ch_map)){ + continue; + } + + chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; + if (!chan){ + continue; + } + + if (!wan_test_bit(0,&chan->up)){ + continue; + } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } + + DEBUG_TEST("%s: 3) Init interface fifo %s\n", + card->devname,chan->if_name); + + aft_init_rx_dev_fifo(card, chan, WP_WAIT); + aft_init_tx_dev_fifo(card, chan, WP_WAIT); + + DEBUG_TEST("%s: Clearing Fifo and idle_flag %s\n", + card->devname,chan->if_name); + wan_clear_bit(0,&chan->idle_start); + } +#if 0 + aft_list_dma_chain_regs(card); +#endif + /* For all channels, reprogram Tx/Rx DMA descriptors. + * For Tx also make sure that the BUSY flag is clear + * and previoulsy Tx packet is deallocated */ + + for (i=0; iu.aft.num_of_time_slots;i++){ + private_area_t *chan; + + if (!wan_test_bit(i,&card->u.aft.logic_ch_map)){ + continue; + } + + chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; + if (!chan){ + continue; + } + + if (!wan_test_bit(0,&chan->up)){ + continue; + } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } + + DEBUG_TEST("%s: 4) Init interface %s\n", + card->devname,chan->if_name); + + chan->dma_index=0; + memset(chan->dma_history,0,sizeof(chan->dma_history)); + + aft_reset_rx_chain_cnt(chan); + +#if 0 + aft_list_descriptors(chan); +#endif + + aft_dma_rx(card,chan); + aft_tslot_sync_ctrl(card,chan,1); + + DEBUG_TEST("%s: DMA RX SETUP %s\n", + card->devname,chan->if_name); +#if 0 + aft_list_descriptors(chan); +#endif + } + + /* Clean Tx/Rx Error interrupts, since fifos are now + * empty, and Tx fifo may generate an underrun which + * we want to ignore :) */ + + card->u.aft.tdm_rx_dma_toggle=0; + card->u.aft.tdm_tx_dma_toggle=0; + + for (i=0; iu.aft.num_of_time_slots;i++){ + private_area_t *chan; + + if (!wan_test_bit(i,&card->u.aft.logic_ch_map)){ + continue; + } + + chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; + if (!chan){ + continue; + } + + if (!wan_test_bit(0,&chan->up)){ + continue; + } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + continue; + } + + if (!chan->hdlc_eng){ + aft_reset_tx_chain_cnt(chan); + aft_dma_tx(card,chan); + } + + if (chan->cfg.ss7_enable){ + aft_clear_ss7_force_rx(card,chan); + } + + if (chan->tdmv_zaptel_cfg && !chan->hdlc_eng){ + aft_dma_rx_tdmv(card,chan); + } + } + + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_RX_FIFO_INTR_PENDING_REG), + ®); + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_TX_FIFO_INTR_PENDING_REG), + ®); + + + /* Enable Global DMA and Error Interrupts */ + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_LINE_CFG_REG), ®); + + wan_set_bit(AFT_LCFG_DMA_INTR_BIT,®); + + wan_clear_bit(AFT_LCFG_FIFO_INTR_BIT,®); + if (card->tdmv_conf.span_no){ + wan_set_bit(AFT_LCFG_TDMV_INTR_BIT,®); + } + + card->hw_iface.bus_write_4(card->hw, + AFT_PORT_REG(card,AFT_LINE_CFG_REG), reg); + + card->u.aft.lcfg_reg=reg; + + + wan_set_bit(0,&card->u.aft.comm_enabled); + DEBUG_EVENT("%s: AFT communications enabled!\n", + card->devname); + + /* Enable Channelized Driver if configured */ + if (card->tdmv_conf.span_no) { + + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_RX_FIFO_INTR_PENDING_REG), + ®); + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_TX_FIFO_INTR_PENDING_REG), + ®); + +#if 1 + + if (wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { + + card->hw_iface.bus_read_4(card->hw,AFT_CHIP_CFG_REG,®); + + /* Reset Global Fifo for the whole card */ + if (!IS_BRI_CARD(card) || (IS_BRI_CARD(card) && card_use_cnt == 1)) { + wan_set_bit(AFT_CHIPCFG_A108_A104_TDM_FIFO_SYNC_BIT,®); + card->hw_iface.bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); + + /* Wait for Global Fifo Reset 1ms */ + WP_DELAY(1000); + } + + /* Clear Global Card Fifo reset */ + wan_clear_bit(AFT_CHIPCFG_A108_A104_TDM_FIFO_SYNC_BIT,®); + + /* Enable TDM Quad DMA Ring buffer */ + if (wan_test_bit(AFT_TDM_RING_BUF,&card->u.aft.chip_cfg_status)) { + wan_set_bit(AFT_CHIPCFG_A108_A104_TDM_DMA_RINGBUF_BIT,®); + card->hw_iface.fe_set_bit(card->hw,1); + }else{ + wan_clear_bit(AFT_CHIPCFG_A108_A104_TDM_DMA_RINGBUF_BIT,®); + } + +#if 1 + /* Global Acknowledge TDM Interrupt (Kickstart) */ + if (card->adptr_type == A104_ADPTR_4TE1 && + card->u.aft.firm_id == AFT_PMC_FE_CORE_ID) { + wan_set_bit(AFT_CHIPCFG_A104_TDM_ACK_BIT,®); + } else { + wan_set_bit(AFT_CHIPCFG_A108_TDM_GLOBAL_RX_INTR_ACK,®); + wan_set_bit(AFT_CHIPCFG_A108_TDM_GLOBAL_TX_INTR_ACK,®); + } + +#endif + card->hw_iface.bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); + + DEBUG_EVENT("%s: AFT Global TDM Intr\n", + card->devname); + + } else { + + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_DMA_CTRL_REG),®); + wan_set_bit(AFT_DMACTRL_TDMV_RX_TOGGLE,®); + wan_set_bit(AFT_DMACTRL_TDMV_TX_TOGGLE,®); + card->hw_iface.bus_write_4(card->hw, + AFT_PORT_REG(card,AFT_DMA_CTRL_REG),reg); + DEBUG_EVENT("%s: AFT Per Port TDM Intr\n",card->devname); + } + +#endif + }/* if (card->u.aft.cfg.tdmv_span_no) */ + +#ifdef AFT_WDT_ENABLE + aft_wdt_set(card,AFT_WDTCTRL_TIMEOUT); +#endif + + DEBUG_TEST("%s: %s() end: reg=0x%X!\n" + ,card->devname,__FUNCTION__,reg); + AFT_FUNC_DEBUG(); + +} + +static void disable_data_error_intr(sdla_t *card, unsigned char event) +{ + u32 reg; + int card_use_cnt; + + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &card_use_cnt); + + if(IS_BRI_CARD(card) && card_use_cnt > 1){ + return; + } + + DEBUG_TEST("%s: Event = %s\n",__FUNCTION__, + event==DEVICE_DOWN?"Device Down": "Link Down"); + + DEBUG_EVENT("%s: AFT communications disabled! %d\n", + card->devname, card_use_cnt); + + aft_wdt_reset(card); + + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG), ®); + + wan_clear_bit(AFT_LCFG_DMA_INTR_BIT,®); + wan_clear_bit(AFT_LCFG_FIFO_INTR_BIT,®); + wan_clear_bit(AFT_LCFG_TDMV_INTR_BIT,®); + + + if (IS_BRI_CARD(card)) { + if (card_use_cnt == 1 && event==DEVICE_DOWN){ + /* Disable Front End Interface */ + wan_set_bit(AFT_LCFG_FE_IFACE_RESET_BIT,®); + } + }else{ + if (event==DEVICE_DOWN){ + /* Disable Front End Interface */ + wan_set_bit(AFT_LCFG_FE_IFACE_RESET_BIT,®); + } + } + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG), reg); + card->u.aft.lcfg_reg=reg; + + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),®); + wan_clear_bit(AFT_DMACTRL_GLOBAL_INTR_BIT,®); + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),reg); + + + if (event==DEVICE_DOWN){ + wan_set_bit(CARD_DOWN,&card->wandev.critical); + }else{ + if (card->tdmv_conf.span_no){ + DEBUG_EVENT("%s: Starting TDMV 1ms Timer\n", + card->devname); +#ifdef AFT_WDT_ENABLE + aft_wdt_set(card,1); +#endif + } + } + + wan_clear_bit(0,&card->u.aft.comm_enabled); +} + + +/*============================================================================ + * Update communications error and general packet statistics. + */ +static int update_comms_stats(sdla_t* card) +{ + /* 1. On the first timer interrupt, update T1/E1 alarms + * and PMON counters (only for T1/E1 card) (TE1) + */ + + /* TE1 Update T1/E1 alarms */ + if (IS_TE1_CARD(card) && card->hw) { + wan_smp_flag_t smp_flags; + + card->hw_iface.hw_lock(card->hw,&smp_flags); + + if (card->wandev.fe_iface.read_alarm) { + card->wandev.fe_iface.read_alarm(&card->fe, 0); + } + /* TE1 Update T1/E1 perfomance counters */ +#if 0 +#warning "PMON DISABLED DUE TO ERROR" +#else + if (card->wandev.fe_iface.read_pmon) { + wan_smp_flag_t flags; + wan_spin_lock_irq(&card->wandev.lock,&flags); + card->wandev.fe_iface.read_pmon(&card->fe, 0); + wan_spin_unlock_irq(&card->wandev.lock,&flags); + } +#endif + + card->hw_iface.hw_unlock(card->hw,&smp_flags); + } + + return 0; +} + +static void aft_rx_fifo_over_recover(sdla_t *card, private_area_t *chan) +{ + + if (chan->channelized_cfg && !chan->hdlc_eng){ + return; + } + +#if 0 + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s Rx Fifo Recovery!\n", + card->devname,chan->if_name); + } +#endif + + aft_channel_rxdma_ctrl(card, chan, 0); + + aft_tslot_sync_ctrl(card,chan,0); + + aft_free_rx_complete_list(chan); + aft_free_rx_descriptors(chan); + + aft_init_rx_dev_fifo(card, chan, WP_NO_WAIT); + + aft_channel_rxdma_ctrl(card, chan, 1); + + aft_init_rx_dev_fifo(card, chan, WP_WAIT); + + chan->dma_index=0; + memset(chan->dma_history,0,sizeof(chan->dma_history)); + + aft_reset_rx_chain_cnt(chan); + aft_dma_rx(card,chan); + + aft_tslot_sync_ctrl(card,chan,1); + + wanpipe_wake_stack(chan); +} + +static void aft_tx_fifo_under_recover (sdla_t *card, private_area_t *chan) +{ + if (chan->channelized_cfg && !chan->hdlc_eng){ + return; + } + +#if 0 + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s Tx Fifo Recovery!\n", + card->devname,chan->if_name); + } +#endif + /* Enable DMA controler, in order to start the + * fifo cleaning */ + + aft_channel_txdma_ctrl(card, chan, 0); + +#if 0 + aft_list_tx_descriptors(chan); +#endif + aft_dma_tx_complete(card,chan,0, 1); + + aft_free_tx_descriptors(chan); + aft_init_tx_dev_fifo(card,chan,WP_NO_WAIT); + + aft_channel_txdma_ctrl(card, chan, 1); + + aft_init_tx_dev_fifo(card,chan,WP_WAIT); + wan_clear_bit(0,&chan->idle_start); + + aft_reset_tx_chain_cnt(chan); + aft_dma_tx(card,chan); + + wanpipe_wake_stack(chan); +} + +static int set_chan_state(sdla_t* card, netdevice_t* dev, int state) +{ + private_area_t *chan = wan_netif_priv(dev); + private_area_t *ch_ptr; + + if (!chan){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: %s:%d No chan ptr!\n", + card->devname,__FUNCTION__,__LINE__); + } + return -EINVAL; + } + + chan->common.state = state; + for (ch_ptr=chan; ch_ptr != NULL; ch_ptr=ch_ptr->next){ + ch_ptr->common.state=state; + + if (ch_ptr->tdmv_zaptel_cfg) { + continue; + } + + if (ch_ptr->common.usedby == TDM_VOICE_API || + ch_ptr->common.usedby == TDM_VOICE_DCHAN) { +#ifdef AFT_TDM_API_SUPPORT + if (is_tdm_api(ch_ptr,&ch_ptr->wp_tdm_api_dev)) { + wanpipe_tdm_api_update_state(&ch_ptr->wp_tdm_api_dev, state); + } +#endif + } + } + + if (state == WAN_CONNECTED){ + wan_clear_bit(0,&chan->idle_start); + WAN_NETIF_START_QUEUE(dev); + chan->opstats.link_active_count++; + WAN_NETIF_CARRIER_ON(dev); + WAN_NETIF_WAKE_QUEUE(dev); + }else{ + chan->opstats.link_inactive_modem_count++; + WAN_NETIF_CARRIER_OFF(dev); + WAN_NETIF_STOP_QUEUE(dev); + } + +#if defined(__LINUX__) +# if !defined(CONFIG_PRODUCT_WANPIPE_GENERIC) + if (chan->common.usedby == API) { + wan_update_api_state(chan); + } +#endif +#endif + + if (chan->common.usedby == STACK){ + if (state == WAN_CONNECTED){ + wanpipe_lip_connect(chan,0); + }else{ + wanpipe_lip_disconnect(chan,0); + } + } + +#if defined(NETGRAPH) + if (chan->common.usedby == WP_NETGRAPH){ + wan_ng_link_state(&chan->common, state); + } +#endif + return 0; +} + + + +/**SECTION************************************************************* + * + * Protocol API Support Functions + * + **********************************************************************/ + + +static int protocol_init (sdla_t *card, netdevice_t *dev, + private_area_t *chan, + wanif_conf_t* conf) +{ + + chan->common.protocol = conf->protocol; + + DEBUG_TEST("%s: Protocol init 0x%X PPP=0x0%x FR=0x0%X\n", + wan_netif_name(dev), chan->common.protocol, + WANCONFIG_PPP, + WANCONFIG_FR); + +#ifndef CONFIG_PRODUCT_WANPIPE_GENERIC + DEBUG_EVENT("%s: AFT Driver doesn't directly support any protocols!\n", + chan->if_name); + return -1; + +#else + if (chan->common.protocol == WANCONFIG_PPP || + chan->common.protocol == WANCONFIG_CHDLC){ + + struct ifreq ifr; + struct if_settings ifsettings; + + wanpipe_generic_register(card, dev, wan_netif_name(dev)); + chan->common.prot_ptr = dev; + + if (chan->common.protocol == WANCONFIG_CHDLC){ + DEBUG_EVENT("%s: Starting Kernel CISCO HDLC protocol\n", + chan->if_name); + ifsettings.type = IF_PROTO_CISCO; + }else{ + DEBUG_EVENT("%s: Starting Kernel Sync PPP protocol\n", + chan->if_name); + ifsettings.type = IF_PROTO_PPP; + + } + ifr.ifr_data = (caddr_t)&ifsettings; + if (wp_lite_set_proto(dev, &ifr)){ + wanpipe_generic_unregister(dev); + return -EINVAL; + } + + }else if (chan->common.protocol == WANCONFIG_GENERIC){ + chan->common.prot_ptr = dev; + + }else{ + DEBUG_EVENT("%s:%s: Unsupported protocol %d\n", + card->devname,chan->if_name,chan->common.protocol); + return -EPROTONOSUPPORT; + } +#endif + + return 0; +} + + +static int protocol_stop (sdla_t *card, netdevice_t *dev) +{ + private_area_t *chan=wan_netif_priv(dev); + int err = 0; + + if (!chan) + return 0; + + return err; +} + +static int protocol_shutdown (sdla_t *card, netdevice_t *dev) +{ + private_area_t *chan=wan_netif_priv(dev); + + if (!chan) + return 0; + +#ifndef CONFIG_PRODUCT_WANPIPE_GENERIC + + return 0; +#else + + if (chan->common.protocol == WANCONFIG_PPP || + chan->common.protocol == WANCONFIG_CHDLC){ + + chan->common.prot_ptr = NULL; + wanpipe_generic_unregister(dev); + + }else if (chan->common.protocol == WANCONFIG_GENERIC){ + DEBUG_EVENT("%s:%s Protocol shutdown... \n", + card->devname, chan->if_name); + } +#endif + return 0; +} + +void protocol_recv(sdla_t *card, private_area_t *chan, netskb_t *skb) +{ + +#ifdef CONFIG_PRODUCT_WANPIPE_GENERIC + if (chan->common.protocol == WANCONFIG_PPP || + chan->common.protocol == WANCONFIG_CHDLC){ + wanpipe_generic_input(chan->common.dev, skb); + return 0; + } + +#if defined(__LINUX__) + if (chan->common.protocol == WANCONFIG_GENERIC){ + skb->protocol = htons(ETH_P_HDLC); + skb->dev = chan->common.dev; + skb->mac.raw = wan_netif_data(skb); + netif_rx(skb); + return 0; + } +#endif + +#endif + +#if defined(__LINUX__) + + skb->protocol = htons(ETH_P_IP); + skb->dev = chan->common.dev; + skb->mac.raw = wan_skb_data(skb); + netif_rx(skb); + +#elif defined(__FreeBSD__) + + wan_skb_set_csum(skb,0); + + if (wan_iface.input && wan_iface.input(chan->common.dev, skb) != 0){ + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); //++chan->if_stats.rx_dropped; + wan_skb_free(skb); + return; + } + +#else + DEBUG_EVENT("%s: Action not supported (IP)!\n", + card->devname); + wan_skb_free(skb); +#endif + + return; +} + + +/**SECTION************************************************************* + * + * TE1 Config Code + * + **********************************************************************/ +static int aft_global_chip_configuration(sdla_t *card, wandev_conf_t* conf) +{ + int err=0; + + err = aft_hwdev[card->wandev.card_type].aft_global_chip_config(card); + return err; +} + +static int aft_global_chip_disable(sdla_t *card) +{ + + aft_hwdev[card->wandev.card_type].aft_global_chip_unconfig(card); + + return 0; +} + +/*========================================================= + * aft_chip_configure + * + */ + +static int aft_chip_configure(sdla_t *card, wandev_conf_t* conf) +{ + + return aft_hwdev[card->wandev.card_type].aft_chip_config(card); +} + +static int aft_chip_unconfigure(sdla_t *card) +{ + u32 reg=0; + + AFT_FUNC_DEBUG(); + + wan_set_bit(CARD_DOWN,&card->wandev.critical); + + aft_hwdev[card->wandev.card_type].aft_chip_unconfig(card); + + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG),&card->u.aft.lcfg_reg); + card->u.aft.lcfg_reg=reg; + return 0; +} + + +static int aft_dev_configure(sdla_t *card, private_area_t *chan, wanif_conf_t* conf) +{ + chan->logic_ch_num=-1; + + /* Channel definition section. If not channels defined + * return error */ + if (chan->time_slot_map == 0){ + DEBUG_EVENT("%s: Invalid Channel Selection 0x%lX\n", + card->devname,chan->time_slot_map); + return -EINVAL; + } + + + DEBUG_EVENT("%s: Active Ch Map :0x%08lX\n", + card->devname,chan->time_slot_map); + + + DEBUG_TEST("%s:%d: GOT Logic ch %ld Base 0x%X Size=0x%X\n", + __FUNCTION__,__LINE__,chan->logic_ch_num, + chan->fifo_base_addr, chan->fifo_size_code); + + + return aft_hwdev[card->wandev.card_type].aft_chan_config(card,chan); +} + +static void aft_dev_unconfigure(sdla_t *card, private_area_t *chan) +{ + aft_hwdev[card->wandev.card_type].aft_chan_unconfig(card,chan); + return ; +} + + +#define BIT_DEV_ADDR_CLEAR 0x600 + + + +/**SECTION************************************************************* + * + * TE1 Tx Functions + * DMA Chains + * + **********************************************************************/ + + +/*=============================================== + * aft_tx_dma_voice_handler + * + */ +static void aft_tx_dma_voice_handler(unsigned long data, int wdt, int reset) +{ + private_area_t *chan = (private_area_t *)data; + sdla_t *card = chan->card; + u32 reg,dma_descr,dma_status; + wan_dma_descr_t *dma_chain; + + if (wan_test_and_set_bit(TX_HANDLER_BUSY,&chan->dma_status)){ + DEBUG_EVENT("%s: SMP Critical in %s\n", + chan->if_name,__FUNCTION__); + return; + } + + dma_chain = &chan->tx_dma_chain_table[0]; + + if (reset){ + wan_clear_bit(0,&dma_chain->init); + dma_descr=(chan->logic_ch_num<<4) + AFT_PORT_REG(card,AFT_TX_DMA_HI_DESCR_BASE_REG); + card->hw_iface.bus_write_4(card->hw,dma_descr,0); + goto aft_tx_dma_voice_handler_exit; + } + + /* If the current DMA chain is in use,then + * all chains are busy */ + if (!wan_test_bit(0,&dma_chain->init)){ + goto aft_tx_dma_voice_handler_exit; + } + + dma_descr=(chan->logic_ch_num<<4) + AFT_PORT_REG(card,AFT_TX_DMA_HI_DESCR_BASE_REG); + card->hw_iface.bus_read_4(card->hw,dma_descr,®); + + /* If GO bit is set, then the current DMA chain + * is in process of being transmitted, thus + * all are busy */ + if (wan_test_bit(AFT_TXDMA_HI_GO_BIT,®)){ + goto aft_tx_dma_voice_handler_exit; + } + + dma_status = aft_txdma_hi_get_dma_status(reg); + + if (reg & AFT_TXDMA_HI_DMA_LENGTH_MASK){ + chan->errstats.Tx_dma_len_nonzero++; + chan->errstats.Tx_dma_errors++; + } + + if (dma_status){ + + DEBUG_TEST("%s:%s: Tx DMA Descriptor=0x%X\n", + card->devname,chan->if_name,reg); + + + /* Checking Tx DMA PCI error status. Has to be '0's */ + if (dma_status){ + + chan->errstats.Tx_pci_errors++; + if (wan_test_bit(AFT_TXDMA_HIDMASTATUS_PCI_M_ABRT,&dma_status)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s: Tx Error: Abort from Master: pci fatal error!\n", + card->devname,chan->if_name); + } + + } + if (wan_test_bit(AFT_TXDMA_HIDMASTATUS_PCI_T_ABRT,&dma_status)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s: Tx Error: Abort from Target: pci fatal error!\n", + card->devname,chan->if_name); + } + } + if (wan_test_bit(AFT_TXDMA_HIDMASTATUS_PCI_DS_TOUT,&dma_status)){ + DEBUG_TEST("%s:%s: Tx Warning: PCI Latency Timeout!\n", + card->devname,chan->if_name); + chan->errstats.Tx_pci_latency++; + goto aft_tx_dma_voice_handler_exit; + } + if (wan_test_bit(AFT_TXDMA_HIDMASTATUS_PCI_RETRY,&dma_status)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s:%s: Tx Error: 'Retry' exceeds maximum (64k): pci fatal error!\n", + card->devname,chan->if_name); + } + } + } + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //chan->if_stats.tx_errors++; + } + + + chan->opstats.Data_frames_Tx_count++; + chan->opstats.Data_bytes_Tx_count+=wan_skb_len(dma_chain->skb); + WAN_NETIF_STATS_INC_TX_PACKETS(&chan->common); //chan->if_stats.tx_packets++; + WAN_NETIF_STATS_INC_TX_BYTES(&chan->common,wan_skb_len(dma_chain->skb)); //chan->if_stats.tx_bytes+=wan_skb_len(dma_chain->skb); + + wan_clear_bit(0,&dma_chain->init); + +aft_tx_dma_voice_handler_exit: + wan_clear_bit(TX_HANDLER_BUSY,&chan->dma_status); + + return; +} + + + +/*=============================================== + * aft_tx_dma_chain_handler + * + */ +static void aft_tx_dma_chain_handler(unsigned long data, int wdt, int reset) +{ + private_area_t *chan = (private_area_t *)data; + sdla_t *card = chan->card; + u32 reg,dma_descr; + wan_dma_descr_t *dma_chain; + + if (wan_test_and_set_bit(TX_HANDLER_BUSY,&chan->dma_status)){ + DEBUG_EVENT("%s: SMP Critical in %s\n", + chan->if_name,__FUNCTION__); + return; + } + + dma_chain = &chan->tx_dma_chain_table[chan->tx_pending_chain_indx]; + + for (;;){ + + /* If the current DMA chain is in use,then + * all chains are busy */ + if (!wan_test_bit(0,&dma_chain->init)){ + break; + } + + dma_descr=(chan->logic_ch_num<<4) + (chan->tx_pending_chain_indx*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_TX_DMA_HI_DESCR_BASE_REG); + + card->hw_iface.bus_read_4(card->hw,dma_descr,®); + + /* If GO bit is set, then the current DMA chain + * is in process of being transmitted, thus + * all are busy */ + if (wan_test_bit(AFT_TXDMA_HI_GO_BIT,®)){ + break; + } + + if (!wan_test_bit(AFT_TXDMA_HI_INTR_DISABLE_BIT,®)){ + wan_clear_bit(TX_INTR_PENDING,&chan->dma_chain_status); + if (wdt){ + DEBUG_TEST("%s:%s TX WDT Timer got Interrtup pkt!\n", + card->devname,chan->if_name); + } + } + + + DEBUG_TEST("%s: TX DMA Handler Chain %d\n",chan->if_name,dma_chain->index); + + if (chan->hdlc_eng){ + + if (dma_chain->skb == chan->tx_hdlc_rpt_skb) { + if (wan_skb_queue_len(&chan->wp_tx_hdlc_rpt_list) == 0) { + wan_skb_queue_tail(&chan->wp_tx_hdlc_rpt_list,dma_chain->skb); + dma_chain->skb=NULL; + } else { + /* Drop down to init where packet will freed */ + } + chan->tx_hdlc_rpt_skb=NULL; + + } else if (dma_chain->skb){ + wan_skb_set_csum(dma_chain->skb, reg); + wan_skb_queue_tail(&chan->wp_tx_complete_list,dma_chain->skb); + dma_chain->skb=NULL; + } + } else { + if (dma_chain->skb != chan->tx_idle_skb){ + + wan_skb_set_csum(dma_chain->skb, reg); + aft_tx_post_complete(chan->card,chan,dma_chain->skb); + + if (chan->channelized_cfg && !chan->hdlc_eng){ + /* Voice code uses the rx buffer to + * transmit! So put the rx buffer back + * into the rx queue */ + aft_init_requeue_free_skb(chan, dma_chain->skb); + }else{ + wan_skb_free(dma_chain->skb); + } + + dma_chain->skb=NULL; + } + } + + aft_tx_dma_chain_init(chan,dma_chain); + + if (chan->single_dma_chain){ + break; + } + + if (++chan->tx_pending_chain_indx >= MAX_AFT_DMA_CHAINS){ + chan->tx_pending_chain_indx=0; + } + + dma_chain = &chan->tx_dma_chain_table[chan->tx_pending_chain_indx]; + + } + + wan_clear_bit(TX_HANDLER_BUSY,&chan->dma_status); + + if (wan_skb_queue_len(&chan->wp_tx_complete_list)){ + WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); + } + + return; +} + +/*=============================================== + * aft_dma_chain_tx + * + */ +static int aft_dma_chain_tx(wan_dma_descr_t *dma_chain,private_area_t *chan, int intr,int fifo) +{ + +#define dma_descr dma_chain->dma_descr +#define reg dma_chain->reg +#define dma_ch_indx dma_chain->index +#define len_align dma_chain->len_align +#define card chan->card + + unsigned int len = dma_chain->dma_len; + unsigned int ss7_ctrl=0; + + dma_descr=(chan->logic_ch_num<<4) + (dma_ch_indx*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_TX_DMA_HI_DESCR_BASE_REG); + + DEBUG_DMA("%s: %s:%s: LogicCh=%ld ChIndex=%d DmaDesc=0x%x set\n", + __FUNCTION__, card->devname, chan->if_name, + chan->logic_ch_num,dma_ch_indx,dma_descr); + + card->hw_iface.bus_read_4(card->hw,dma_descr,®); + + if (wan_test_bit(AFT_TXDMA_HI_GO_BIT,®)){ + DEBUG_EVENT("%s: Error: TxDMA GO Ready bit set on dma (chain=0x%X) Desc=0x%X Tx 0x%X\n", + card->devname,dma_descr,dma_ch_indx,reg); + /* Nothing we can do here, just reset + descriptor and keep going */ + card->hw_iface.bus_write_4(card->hw,dma_descr,0); + card->hw_iface.bus_read_4(card->hw,dma_descr,®); + } + + dma_descr=(chan->logic_ch_num<<4) + (dma_ch_indx*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_TX_DMA_LO_DESCR_BASE_REG); + + /* Write the pointer of the data packet to the + * DMA address register */ + reg=dma_chain->dma_addr; + + + if (chan->cfg.ss7_enable){ + ss7_ctrl=wan_skb_csum(dma_chain->skb); + wan_skb_set_csum(dma_chain->skb,0); + if (ss7_ctrl&AFT_SS7_CTRL_LEN_MASK){ + len-=4; + len+=ss7_ctrl&AFT_SS7_CTRL_LEN_MASK; + } + if (!wan_test_bit(AFT_SS7_CTRL_TYPE_BIT,&ss7_ctrl)){ + /*FISU*/ + if (chan->cfg.ss7_mode == WANOPT_SS7_MODE_4096){ + len-=WANOPT_SS7_FISU_4096_SZ; + }else{ + len-=WANOPT_SS7_FISU_128_SZ; + } + }else{ + /*LSSU*/ + len-=chan->cfg.ss7_lssu_size; + } + } + + /* Set the 32bit alignment of the data length. + * Used to pad the tx packet to the 32 bit + * boundary */ + aft_txdma_lo_set_alignment(®,len); + + len_align=0; + if (len&0x03){ + len_align=1; + } + + DEBUG_DMA("%s: %s:%s: TXDMA_LO=0x%X PhyAddr=0x%X DmaDescr=0x%X Len=%d\n", + __FUNCTION__,card->devname,chan->if_name, + reg,dma_chain->dma_addr,dma_descr,len); + + card->hw_iface.bus_write_4(card->hw,dma_descr,reg); + + dma_descr=(chan->logic_ch_num<<4) + (dma_ch_indx*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_TX_DMA_HI_DESCR_BASE_REG); + + reg=0; + + if (chan->cfg.ss7_enable){ + if (wan_test_bit(AFT_SS7_CTRL_TYPE_BIT,&ss7_ctrl)){ + wan_set_bit(AFT_TXDMA_HI_SS7_FISU_OR_LSSU_BIT,®); + }else{ + wan_clear_bit(AFT_TXDMA_HI_SS7_FISU_OR_LSSU_BIT,®); + } + if (wan_test_bit(AFT_SS7_CTRL_FORCE_BIT,&ss7_ctrl)){ + wan_set_bit(AFT_TXDMA_HI_SS7_FI_LS_FORCE_TX_BIT,®); + }else{ + wan_clear_bit(AFT_TXDMA_HI_SS7_FI_LS_FORCE_TX_BIT,®); + } + } + + aft_txdma_hi_set_dma_length(®,len,len_align); + + if (chan->single_dma_chain){ + wan_clear_bit(AFT_TXDMA_HI_LAST_DESC_BIT,®); + wan_clear_bit(AFT_TXDMA_HI_INTR_DISABLE_BIT,®); + + if (chan->channelized_cfg && !chan->hdlc_eng){ + wan_set_bit(AFT_TXDMA_HI_LAST_DESC_BIT,®); + } + }else{ + wan_set_bit(AFT_TXDMA_HI_LAST_DESC_BIT,®); + + if (intr){ + DEBUG_TEST("%s: Setting Interrupt on index=%d\n", + chan->if_name,dma_ch_indx); + wan_clear_bit(AFT_TXDMA_HI_INTR_DISABLE_BIT,®); + }else{ + wan_set_bit(AFT_TXDMA_HI_INTR_DISABLE_BIT,®); + } + } + + if (chan->hdlc_eng){ + /* Only enable the Frame Start/Stop on + * non-transparent hdlc configuration */ + wan_set_bit(AFT_TXDMA_HI_START_BIT,®); + wan_set_bit(AFT_TXDMA_HI_EOF_BIT,®); + }else{ + /* Used for transparent time slot + * synchronization */ + + if (chan->tslot_sync){ + wan_set_bit(AFT_TXDMA_HI_START_BIT,®); + } + } + + wan_set_bit(AFT_TXDMA_HI_GO_BIT,®); + if (fifo){ + /* Clear fifo command */ + wan_set_bit(AFT_TXDMA_HI_DMA_CMD_BIT,®); + } + + DEBUG_DMA("%s:: %s:%s: TXDMA_HI=0x%X DmaDescr=0x%X Len=%d Intr=%d\n", + __FUNCTION__,card->devname,chan->if_name, + reg,dma_descr,len,intr); + + card->hw_iface.bus_write_4(card->hw,dma_descr,reg); + +#if 1 + ++chan->tx_attempts; +#endif + + return 0; + +#undef dma_descr +#undef reg +#undef dma_ch_indx +#undef len_align +#undef card +} + +/*=============================================== + * aft_dma_chain_init + * + */ +static void aft_tx_dma_chain_init(private_area_t *chan, wan_dma_descr_t *dma_chain) +{ +#define card chan->card + + card->hw_iface.busdma_sync( card->hw, + dma_chain, + 1, 1, + SDLA_DMA_POSTWRITE); + card->hw_iface.busdma_unmap( card->hw, + dma_chain, + SDLA_DMA_POSTWRITE); + + if (dma_chain->skb){ + if (!chan->hdlc_eng){ + if (dma_chain->skb != chan->tx_idle_skb){ + if (chan->channelized_cfg && !chan->hdlc_eng){ + aft_init_requeue_free_skb(chan, dma_chain->skb); + }else{ + wan_skb_free(dma_chain->skb); + } + } + dma_chain->skb=NULL; + }else{ + wan_skb_free(dma_chain->skb); + dma_chain->skb=NULL; + } + } + wan_clear_bit(0,&dma_chain->init); +#undef card +} + +static void aft_rx_dma_chain_init(private_area_t *chan, wan_dma_descr_t *dma_chain) +{ +#define card chan->card + + card->hw_iface.busdma_sync( card->hw, + dma_chain, + 1, 1, + SDLA_DMA_POSTREAD); + card->hw_iface.busdma_unmap( card->hw, + dma_chain, + SDLA_DMA_POSTREAD); + + if (dma_chain->skb){ + aft_init_requeue_free_skb(chan,dma_chain->skb); + dma_chain->skb = NULL; + } + wan_clear_bit(0,&dma_chain->init); +#undef card +} + + + +static int aft_dma_voice_tx(sdla_t *card, private_area_t *chan) +{ + int err=0; + wan_dma_descr_t *dma_chain; + u32 reg, dma_ram_desc; + + if (wan_test_and_set_bit(TX_DMA_BUSY,&chan->dma_status)){ + DEBUG_EVENT("%s: SMP Critical in %s\n", + chan->if_name,__FUNCTION__); + + return -EBUSY; + } + + dma_chain = &chan->tx_dma_chain_table[0]; + + DEBUG_DMA("%s: %s:%s:: Chain %d Used %ld\n", + __FUNCTION__,card->devname,chan->if_name, + dma_chain->index,dma_chain->init); + + /* If the current DMA chain is in use,then + * all chains are busy */ + if (wan_test_and_set_bit(0,&dma_chain->init)){ + err=-EBUSY; + goto aft_dma_voice_tx_exit; + } + + if (!dma_chain->skb){ + unsigned char *buf; + + /* Take already preallocated buffer from rx queue. + * We are only using a single buffer for rx and tx */ + dma_chain->skb=wan_skb_dequeue(&chan->wp_rx_free_list); + if (!dma_chain->skb){ + DEBUG_EVENT("%s: Warning Tx chain = %d: no free tx bufs\n", + chan->if_name,dma_chain->index); + wan_clear_bit(0,&dma_chain->init); + err=-EINVAL; + goto aft_dma_voice_tx_exit; + } + + wan_skb_init(dma_chain->skb,16); + wan_skb_trim(dma_chain->skb,0); + + /*NC: We must set the initial value of the + * frist DMA TX transfer to 2*MTU. This is + * to avoid potential Tx FIFO underrun. + * + * This is equivalent of transmitting twice + * very fist time. */ + + + buf=wan_skb_put(dma_chain->skb,chan->mtu*2); + memset(buf,chan->idle_flag,chan->mtu*2); + + /* A-DMA */ + card->hw_iface.busdma_map( card->hw, + dma_chain, + wan_skb_data(dma_chain->skb), + wan_skb_len(dma_chain->skb), + chan->dma_mru, + SDLA_DMA_PREWRITE); + card->hw_iface.busdma_sync( card->hw, + dma_chain, + 1, 1, + SDLA_DMA_PREWRITE); + } + + dma_ram_desc=chan->logic_ch_num*4 + + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); + aft_dmachain_set_tx_dma_addr(®,1); + card->hw_iface.bus_write_4(card->hw,dma_ram_desc,reg); + + /* We set inital TX DMA with FIFO Reset option. This funciton + * will ONLY run once in TDM mode. After the inital TX the + * DMA Reload will be used to tx the Voice frame */ + err=aft_dma_chain_tx(dma_chain,chan,1,1); + if (err){ + DEBUG_EVENT("%s: Tx dma chain %d overrun error: should never happen!\n", + chan->if_name,dma_chain->index); + + /* Drop the tx packet here */ + aft_tx_dma_chain_init(chan,dma_chain); + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //chan->if_stats.tx_errors++; + err=-EINVAL; + goto aft_dma_voice_tx_exit; + } + +aft_dma_voice_tx_exit: + wan_clear_bit(TX_DMA_BUSY,&chan->dma_status); + + return 0; +} + +/*=============================================== + * aft_dma_tx + * + */ +static int aft_dma_tx (sdla_t *card,private_area_t *chan) +{ + int err=0, intr=0, cnt=0; + wan_dma_descr_t *dma_chain; + netskb_t *skb=NULL; + + if (chan->channelized_cfg && !chan->hdlc_eng){ + return aft_dma_voice_tx(card,chan); + } + + if (wan_test_and_set_bit(TX_DMA_BUSY,&chan->dma_status)){ + DEBUG_EVENT("%s: SMP Critical in %s\n", + chan->if_name,__FUNCTION__); + + return -EBUSY; + } + + if (chan->tx_chain_indx >= MAX_AFT_DMA_CHAINS){ + DEBUG_EVENT("%s: MAJOR ERROR: TE1 Tx: Dma tx chain = %d\n", + chan->if_name,chan->tx_chain_indx); + return -EBUSY; + } + + + /* The cnt is not used, its used only as a + * sanity check. The code below should break + * out of the loop before MAX_TX_BUF runs out! */ + for (cnt=0;cnttx_dma_chain_table[chan->tx_chain_indx]; + + /* FIXME: Reset TX Watchdog */ + /* aft_reset_tx_watchdog(card); */ + + /* If the current DMA chain is in use,then + * all chains are busy */ + if (wan_test_and_set_bit(0,&dma_chain->init)){ + wan_clear_bit(TX_DMA_BUSY,&chan->dma_status); + break; + } + + if(!chan->lip_atm){ + skb=wan_skb_dequeue(&chan->wp_tx_pending_list); + }else{ + skb=atm_tx_skb_dequeue(&chan->wp_tx_pending_list, chan->tx_idle_skb, chan->if_name); + } + + if (!skb){ + if (!chan->hdlc_eng){ + + skb=chan->tx_idle_skb; + if (!skb){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: Critical Error: Transparent tx no skb!\n", + chan->if_name); + } + break; + } + + WAN_NETIF_STATS_INC_TX_CARRIER_ERRORS(&chan->common); + + } else { + if (chan->cfg.hdlc_repeat) { + /* Pull the latest repeat frame out of the + repeat queue */ + for (;;) { + skb=wan_skb_dequeue(&chan->wp_tx_hdlc_rpt_list); + if (!skb) { + break; + } + if (wan_skb_queue_len(&chan->wp_tx_hdlc_rpt_list)){ + wan_skb_free(skb); + } else { + break; + } + } + + if (skb) { + chan->tx_hdlc_rpt_skb=skb; + } else { + WAN_NETIF_STATS_INC_TX_CARRIER_ERRORS(&chan->common); + /* Pass throught to no skb condition */ + } + } + + if (!skb) { + wan_clear_bit(0,&dma_chain->init); + wan_clear_bit(TX_DMA_BUSY,&chan->dma_status); + break; + } + } + } + + if ((unsigned long)wan_skb_data(skb) & 0x03){ + + err=aft_realign_skb_pkt(chan,skb); + if (err){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: Tx Error: Non Aligned packet %p: dropping...\n", + chan->if_name,wan_skb_data(skb)); + } + wan_skb_free(skb); + aft_tx_dma_chain_init(chan,dma_chain); + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //chan->if_stats.tx_errors++; + chan->opstats.Tx_Data_discard_lgth_err_count++; + continue; + } + } + + + if (!chan->hdlc_eng && (wan_skb_len(skb)%4)){ + + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: Tx Error: Tx Length %i not 32bit aligned: dropping...\n", + chan->if_name,wan_skb_len(skb)); + } + wan_skb_free(skb); + aft_tx_dma_chain_init(chan,dma_chain); + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //chan->if_stats.tx_errors++; + chan->opstats.Tx_Data_discard_lgth_err_count++; + continue; + } + + dma_chain->skb=skb; + + /* A-DMA */ + card->hw_iface.busdma_map( card->hw, + dma_chain, + wan_skb_data(dma_chain->skb), + wan_skb_len(dma_chain->skb), + wan_skb_len(dma_chain->skb), + SDLA_DMA_PREWRITE); + card->hw_iface.busdma_sync( card->hw, + dma_chain, + 1, chan->single_dma_chain, + SDLA_DMA_PREWRITE); + + DEBUG_TEST("%s: DMA Chain %d: Cur=%d Pend=%d\n", + chan->if_name,dma_chain->index, + chan->tx_chain_indx,chan->tx_pending_chain_indx); + + intr=0; + if (!wan_test_bit(TX_INTR_PENDING,&chan->dma_chain_status)){ + int pending_indx=chan->tx_pending_chain_indx; + if (chan->tx_chain_indx >= pending_indx){ + intr = ((MAX_AFT_DMA_CHAINS-(chan->tx_chain_indx - + pending_indx))<=2); + }else{ + intr = ((pending_indx - chan->tx_chain_indx)<=2); + } + + if (intr){ + DEBUG_TEST("%s: Setting tx interrupt on chain=%d\n", + chan->if_name,dma_chain->index); + wan_set_bit(TX_INTR_PENDING,&chan->dma_chain_status); + } + } + + + err=aft_dma_chain_tx(dma_chain,chan,intr,0); + if (err){ + DEBUG_EVENT("%s: Tx dma chain %d overrun error: should never happen!\n", + chan->if_name,dma_chain->index); + + +#if 0 + aft_list_tx_descriptors(chan); + aft_critical_shutdown(card); + break; +#endif + + /* Drop the tx packet here */ + aft_tx_dma_chain_init(chan,dma_chain); + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //chan->if_stats.tx_errors++; + break; + } + + if (skb){ + wan_capture_trace_packet(card, &chan->trace_info, skb, TRC_OUTGOING_FRM); + } + + if (chan->single_dma_chain){ + break; + }else{ + if (++chan->tx_chain_indx >= MAX_AFT_DMA_CHAINS){ + chan->tx_chain_indx=0; + } + } + } + + wan_clear_bit(TX_DMA_BUSY,&chan->dma_status); + + return 0; +} + + + +/**SECTION************************************************************* + * + * TE1 Rx Functions + * DMA Chains + * + **********************************************************************/ + +static int aft_dma_chain_rx(wan_dma_descr_t *dma_chain, private_area_t *chan, int intr, int fifo) +{ +#define dma_descr dma_chain->dma_descr +#define reg dma_chain->reg +#define len dma_chain->dma_len +#define dma_ch_indx dma_chain->index +#define len_align dma_chain->len_align +#define card chan->card + + /* Write the pointer of the data packet to the + * DMA address register */ + reg=dma_chain->dma_addr; + + /* Set the 32bit alignment of the data length. + * Since we are setting up for rx, set this value + * to Zero */ + aft_rxdma_lo_set_alignment(®,0); + + dma_descr=(chan->logic_ch_num<<4) + (dma_ch_indx*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_RX_DMA_LO_DESCR_BASE_REG); + + DEBUG_DMA("%s: %s:%s: RxDMA_LO(%ld) = 0x%X, PhyAddr:%X DmaDescr=0x%X (%p)\n", + __FUNCTION__,card->devname,chan->if_name, + chan->logic_ch_num,reg, + dma_chain->dma_addr, dma_descr,dma_chain); + + card->hw_iface.bus_write_4(card->hw,dma_descr,reg); + + dma_descr=(chan->logic_ch_num<<4) + (dma_ch_indx*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_RX_DMA_HI_DESCR_BASE_REG); + + reg =0; + + if (chan->single_dma_chain){ + wan_clear_bit(AFT_RXDMA_HI_LAST_DESC_BIT,®); + wan_clear_bit(AFT_RXDMA_HI_INTR_DISABLE_BIT,®); + + if (chan->channelized_cfg && !chan->hdlc_eng){ + wan_set_bit(AFT_RXDMA_HI_LAST_DESC_BIT,®); + } + + }else{ + wan_set_bit(AFT_RXDMA_HI_LAST_DESC_BIT,®); + +#if AFT_IFT_INTR_ENABLE + wan_set_bit(AFT_RXDMA_HI_IFT_INTR_ENB_BIT,®); +#else + wan_clear_bit(AFT_RXDMA_HI_IFT_INTR_ENB_BIT,®); +#endif + + if (intr){ + DEBUG_TEST("%s: Setting Rx Interrupt on index=%d\n", + chan->if_name,dma_ch_indx); + wan_clear_bit(AFT_RXDMA_HI_INTR_DISABLE_BIT,®); + }else{ + wan_set_bit(AFT_RXDMA_HI_INTR_DISABLE_BIT,®); + } + } + + if (chan->hdlc_eng){ + aft_rxdma_hi_set_dma_length(®,chan->dma_mru,1); + }else{ + aft_rxdma_hi_set_dma_length(®,chan->mru,0); + } + + wan_set_bit(AFT_RXDMA_HI_GO_BIT,®); + if (fifo){ + wan_set_bit(AFT_RXDMA_HI_DMA_CMD_BIT,®); + } + + DEBUG_DMA("%s: %s:%s: RXDMA_HI(%ld) = 0x%X, DmaDescr=0x%X\n", + __FUNCTION__,card->devname,chan->if_name, + chan->logic_ch_num,reg,dma_descr); + + card->hw_iface.bus_write_4(card->hw,dma_descr,reg); + + return 0; + +#undef dma_descr +#undef reg +#undef len +#undef dma_ch_indx +#undef len_align +#undef card +} + +static int aft_dma_voice_rx(sdla_t *card, private_area_t *chan) +{ + int err=0; + wan_dma_descr_t *dma_chain; + u32 reg, dma_ram_desc; + + if (wan_test_and_set_bit(RX_DMA_BUSY,&chan->dma_status)){ + DEBUG_EVENT("%s: SMP Critical in %s\n", + chan->if_name,__FUNCTION__); + return -EBUSY; + } + + dma_chain = &chan->rx_dma_chain_table[0]; + + DEBUG_DMA("%s: %s:%s: Chain %d Used %ld\n", + __FUNCTION__,card->devname,chan->if_name, + dma_chain->index,dma_chain->init); + + /* If the current DMA chain is in use,then + * all chains are busy */ + if (wan_test_and_set_bit(0,&dma_chain->init)){ + DEBUG_TEST("%s: Warning: %s():%d dma chain busy %d!\n", + card->devname, __FUNCTION__, __LINE__, + dma_chain->index); + err=-EBUSY; + goto aft_dma_single_chain_rx_exit; + } + + /* This will only be done on the first time. The dma_chain + * skb will be re-used all the time, thus no need for + * rx_free_list any more */ + if (!dma_chain->skb){ + dma_chain->skb=wan_skb_dequeue(&chan->wp_rx_free_list); + if (!dma_chain->skb){ + DEBUG_EVENT("%s: Warning Rx Voice chain = %d: no free rx bufs\n", + chan->if_name,dma_chain->index); + wan_clear_bit(0,&dma_chain->init); + err=-EINVAL; + goto aft_dma_single_chain_rx_exit; + } + + wan_skb_init(dma_chain->skb,16); + wan_skb_trim(dma_chain->skb,0); + + /* A-DMA */ + card->hw_iface.busdma_map( card->hw, + dma_chain, + wan_skb_tail(dma_chain->skb), + chan->dma_mru, + chan->dma_mru, + SDLA_DMA_PREREAD); + card->hw_iface.busdma_sync( card->hw, + dma_chain, + MAX_AFT_DMA_CHAINS, chan->single_dma_chain, + SDLA_DMA_PREREAD); + DEBUG_DMA("%s: RXDMA PHY = 0x%08X VIRT = %p \n", + chan->if_name, + dma_chain->dma_addr,wan_skb_tail(dma_chain->skb)+dma_chain->dma_offset); + }else{ + wan_skb_init(dma_chain->skb,16); + wan_skb_trim(dma_chain->skb,0); + } + + dma_ram_desc=chan->logic_ch_num*4 + + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); + aft_dmachain_set_rx_dma_addr(®,1); + card->hw_iface.bus_write_4(card->hw,dma_ram_desc,reg); + + err=aft_dma_chain_rx(dma_chain,chan,1,1); + if (err){ + DEBUG_EVENT("%s: Rx dma chain %d overrun error: should never happen!\n", + chan->if_name,dma_chain->index); + aft_rx_dma_chain_init(chan,dma_chain); + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //chan->if_stats.rx_errors++; + } + +aft_dma_single_chain_rx_exit: + + wan_clear_bit(RX_DMA_BUSY,&chan->dma_status); + return err; +} + + +static int aft_dma_rx(sdla_t *card, private_area_t *chan) +{ + int err=0, intr=0; + wan_dma_descr_t *dma_chain; + int cur_dma_ptr, i,max_dma_cnt,free_queue_len; + u32 reg, dma_ram_desc; + + if (chan->channelized_cfg && !chan->hdlc_eng){ + return aft_dma_voice_rx(card,chan); + } + + if (wan_test_and_set_bit(RX_DMA_BUSY,&chan->dma_status)){ + DEBUG_EVENT("%s: SMP Critical in %s\n", + chan->if_name,__FUNCTION__); + return -EBUSY; + } + + free_queue_len=wan_skb_queue_len(&chan->wp_rx_free_list); + if (!chan->single_dma_chain && + free_queue_len < MAX_AFT_DMA_CHAINS){ + aft_free_rx_complete_list(chan); + free_queue_len=wan_skb_queue_len(&chan->wp_rx_free_list); + if (free_queue_len < MAX_AFT_DMA_CHAINS){ + DEBUG_EVENT("%s: %s() CRITICAL ERROR: No free rx buffers\n", + card->devname,__FUNCTION__); + goto te1rx_skip; + } + } + + dma_ram_desc=chan->logic_ch_num*4 + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); + cur_dma_ptr=aft_dmachain_get_rx_dma_addr(reg); + +#if 0 + aft_chain_history(chan,chan->rx_chain_indx, cur_dma_ptr, chan->rx_pending_chain_indx,1); +#endif + max_dma_cnt = MAX_AFT_DMA_CHAINS; + + if (!chan->single_dma_chain && + free_queue_len < max_dma_cnt){ + max_dma_cnt = free_queue_len; + } + + DEBUG_RX("%s: (line: %d) DMA RX: CBoardPtr=%d Driver=%d MaxDMA=%d\n", + card->devname, __LINE__, cur_dma_ptr,chan->rx_chain_indx,max_dma_cnt); + + for (i=0;irx_dma_chain_table[chan->rx_chain_indx]; + + /* If the current DMA chain is in use,then + * all chains are busy */ + if (wan_test_and_set_bit(0,&dma_chain->init)){ + DEBUG_TEST("%s: Warning: %s():%d dma chain busy %d!\n", + card->devname, __FUNCTION__, __LINE__, + dma_chain->index); + + err=-EBUSY; + break; + } + + dma_chain->skb=wan_skb_dequeue(&chan->wp_rx_free_list); + if (!dma_chain->skb){ + /* If this ever happends, it means that wp_bh is stuck for some + * reason, thus start using the completed buffers, thus + * overflow the data */ + dma_chain->skb=wan_skb_dequeue(&chan->wp_rx_complete_list); + if (dma_chain->skb) { + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); //chan->if_stats.rx_dropped++; + wan_skb_init(dma_chain->skb,16); + wan_skb_trim(dma_chain->skb,0); + }else{ + DEBUG_EVENT("%s: Critical Rx chain = %d: no free rx bufs (Free=%i Comp=%i)\n", + chan->if_name,dma_chain->index, + wan_skb_queue_len(&chan->wp_rx_free_list), + wan_skb_queue_len(&chan->wp_rx_complete_list)); + wan_clear_bit(0,&dma_chain->init); + + aft_critical_shutdown(card); + err=-EINVAL; + break; + } + + } + + card->hw_iface.busdma_map( card->hw, + dma_chain, + wan_skb_tail(dma_chain->skb), + chan->dma_mru, + chan->dma_mru, + SDLA_DMA_PREREAD); + card->hw_iface.busdma_sync( card->hw, + dma_chain, + 1, chan->single_dma_chain, + SDLA_DMA_PREREAD); + intr=0; + if (!wan_test_bit(RX_INTR_PENDING,&chan->dma_chain_status)){ + + free_queue_len--; + + if (free_queue_len <= 2){ + DEBUG_TEST("%s: DBG: Setting intr queue size low\n", + card->devname); + intr=1; + }else{ + if (chan->rx_chain_indx >= cur_dma_ptr){ + intr = ((MAX_AFT_DMA_CHAINS - + (chan->rx_chain_indx-cur_dma_ptr)) <=4); + }else{ + intr = ((cur_dma_ptr - chan->rx_chain_indx)<=4); + } + } + + if (intr){ + DEBUG_TEST("%s: Setting Rx interrupt on chain=%d\n", + chan->if_name,dma_chain->index); + wan_set_bit(RX_INTR_PENDING,&chan->dma_chain_status); + } + } + + DEBUG_TEST("%s: Setting Buffer on Rx Chain = %d Intr=%d\n", + chan->if_name,dma_chain->index, intr); + + err=aft_dma_chain_rx(dma_chain,chan,intr,0); + if (err){ + DEBUG_EVENT("%s: Rx dma chain %d overrun error: should never happen!\n", + chan->if_name,dma_chain->index); + aft_rx_dma_chain_init(chan,dma_chain); + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //chan->if_stats.rx_errors++; + break; + } + + if (chan->single_dma_chain){ + break; + }else{ + if (++chan->rx_chain_indx >= MAX_AFT_DMA_CHAINS){ + chan->rx_chain_indx=0; + } + } + } + +#if 0 + aft_chain_history(chan,chan->rx_chain_indx, cur_dma_ptr, chan->rx_pending_chain_indx,2); + + if (chan->rx_chain_indx == cur_dma_ptr && + chan->rx_pending_chain_indx == cur_dma_ptr && + cur_dma_ptr != 0){ + DEBUG_EVENT("%s :Location 1 Listing Descr!\n", + chan->if_name); + aft_list_descriptors(chan); + } +#endif + aft_rx_cur_go_test(chan); + +te1rx_skip: + + wan_clear_bit(RX_DMA_BUSY,&chan->dma_status); + + return err; +} + +/*=============================================== + * aft_rx_dma_chain_handler + * + */ +/*N1*/ +static int aft_rx_dma_chain_handler(private_area_t *chan, int reset) +{ + sdla_t *card = chan->card; + u32 reg,dma_descr; + wp_rx_element_t *rx_el; + wan_dma_descr_t *dma_chain; + int i,max_dma_cnt, cur_dma_ptr; + int rx_data_available=0; + u32 dma_ram_desc; + + if (wan_test_and_set_bit(RX_HANDLER_BUSY,&chan->dma_status)){ + DEBUG_EVENT("%s: SMP Critical in %s\n", + chan->if_name,__FUNCTION__); + return rx_data_available; + } + + dma_ram_desc=chan->logic_ch_num*4 + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); + cur_dma_ptr=aft_dmachain_get_rx_dma_addr(reg); + + max_dma_cnt = MAX_AFT_DMA_CHAINS; + + DEBUG_RX("%s: (line: %d) DMA RX: CBoardPtr=%d Driver=%d MaxDMA=%d\n", + card->devname, __LINE__, + cur_dma_ptr, + chan->rx_chain_indx,max_dma_cnt); + +#if 0 + aft_chain_history(chan,chan->rx_chain_indx, cur_dma_ptr, chan->rx_pending_chain_indx,3); +#endif + + + for (i=0;irx_dma_chain_table[chan->rx_pending_chain_indx]; + + if (i>0 && chan->rx_pending_chain_indx == cur_dma_ptr){ + break; + } + + if (!dma_chain){ + DEBUG_EVENT("%s:%d Assertion Error !!!!\n", + __FUNCTION__,__LINE__); + break; + } + + /* If the current DMA chain is in use,then + * all chains are busy */ + if (!wan_test_bit(0,&dma_chain->init)){ + DEBUG_TEST("%s: Warning (%s) Pending chain %d empty!\n", + chan->if_name,__FUNCTION__,dma_chain->index); + + break; + } + + dma_descr=(chan->logic_ch_num<<4) + (dma_chain->index*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_RX_DMA_HI_DESCR_BASE_REG); + + card->hw_iface.bus_read_4(card->hw,dma_descr,®); + + /* If GO bit is set, then the current DMA chain + * is in process of being transmitted, thus + * all are busy */ + if (wan_test_bit(AFT_RXDMA_HI_GO_BIT,®)){ + if (wan_test_bit(WP_FIFO_ERROR_BIT, &chan->pkt_error)){ + break; + } + +#if 0 + if (chan->single_dma_chain){ + DEBUG_EVENT("%s: CRITICAL (%s) Pending chain %d Go bit still set!\n", + chan->if_name,__FUNCTION__,dma_chain->index); + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //++chan->if_stats.rx_errors; + }else{ + DEBUG_TEST("%s: Warning (%s) Pending chain %d Go bit still set!\n", + chan->if_name,__FUNCTION__,dma_chain->index); + } +#endif + break; + } + + if (!wan_test_bit(AFT_RXDMA_HI_INTR_DISABLE_BIT,®)){ + wan_clear_bit(RX_INTR_PENDING,&chan->dma_chain_status); + } + + if (sizeof(wp_rx_element_t) > wan_skb_headroom(dma_chain->skb)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: Rx error: rx_el=%u > max head room=%u\n", + chan->if_name, + (u32)sizeof(wp_rx_element_t), + (u32)wan_skb_headroom(dma_chain->skb)); + } + + aft_init_requeue_free_skb(chan, dma_chain->skb); + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //++chan->if_stats.rx_errors; + goto rx_hndlr_skip_rx; + }else{ + rx_el=(wp_rx_element_t *)wan_skb_push(dma_chain->skb, + sizeof(wp_rx_element_t)); + memset(rx_el,0,sizeof(wp_rx_element_t)); + } +#if 0 + WAN_NETIF_STATS_INC_RX_FRAME_ERRORS(&chan->common); //chan->if_stats.rx_frame_errors++; +#endif + + /* Reading Rx DMA descriptor information */ + dma_descr=(chan->logic_ch_num<<4) +(dma_chain->index*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_RX_DMA_LO_DESCR_BASE_REG); + + card->hw_iface.bus_read_4(card->hw,dma_descr, &rx_el->align); + rx_el->align&=AFT_RXDMA_LO_ALIGN_MASK; + + dma_descr=(chan->logic_ch_num<<4) +(dma_chain->index*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_RX_DMA_HI_DESCR_BASE_REG); + + card->hw_iface.bus_read_4(card->hw,dma_descr, &rx_el->reg); + + /* New for FreeBSD/Solaris */ + rx_el->len=rx_el->reg&AFT_RXDMA_HI_DMA_LENGTH_MASK; + if (chan->hdlc_eng){ + /* In HDLC mode, calculate rx length based + * on alignment value, received from DMA */ + rx_el->len=((((chan->dma_mru>>2)-1)-rx_el->len)<<2) - (~(rx_el->align)&AFT_RXDMA_LO_ALIGN_MASK); + }else{ + /* In Transparent mode, our RX buffer will always be + * aligned to the 32bit (word) boundary, because + * the RX buffers are all of equal length */ + rx_el->len=(((chan->mru>>2)-rx_el->len)<<2) - (~(0x03)&AFT_RXDMA_LO_ALIGN_MASK); + } + + rx_el->pkt_error= dma_chain->pkt_error; + rx_el->dma_addr = dma_chain->dma_addr; + + /* A-DMA */ + card->hw_iface.busdma_sync( card->hw, + dma_chain, + 1, chan->single_dma_chain, + SDLA_DMA_POSTREAD); + dma_chain->dma_len = rx_el->len; /* update real dma len*/ + card->hw_iface.busdma_unmap( card->hw, + dma_chain, + SDLA_DMA_POSTREAD); + + wan_skb_queue_tail(&chan->wp_rx_complete_list,dma_chain->skb); + rx_data_available=1; + + DEBUG_BRI("%s: RxInt Pending chain %d Rxlist=%d LO:0x%X HI:0x%X!\n", + chan->if_name,dma_chain->index, + wan_skb_queue_len(&chan->wp_rx_complete_list), + rx_el->align,rx_el->reg); + +rx_hndlr_skip_rx: + dma_chain->skb=NULL; + dma_chain->pkt_error=0; + wan_clear_bit(0,&dma_chain->init); + + if (chan->single_dma_chain){ + break; + } + + if (++chan->rx_pending_chain_indx >= MAX_AFT_DMA_CHAINS){ + chan->rx_pending_chain_indx=0; + } + } + + if (reset){ + goto reset_skip_rx_setup; + } + + aft_dma_rx(card,chan); + + if (wan_skb_queue_len(&chan->wp_rx_complete_list)){ + DEBUG_TEST("%s: Rx Queued list triggering\n",chan->if_name); + WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); + } + +reset_skip_rx_setup: + + wan_clear_bit(RX_HANDLER_BUSY,&chan->dma_status); + + + return rx_data_available; +} + +static int aft_dma_rx_complete(sdla_t *card, private_area_t *chan, int reset) +{ + if (chan->cfg.ss7_enable){ + aft_clear_ss7_force_rx(card,chan); + } + return aft_rx_dma_chain_handler(chan,reset); +} + +/*=============================================== + * TE1 DMA Chains Utility Funcitons + * + */ + + +static void aft_index_tx_rx_dma_chains(private_area_t *chan) +{ + int i; + + for (i=0;itx_dma_chain_table[i].index=i; + chan->rx_dma_chain_table[i].index=i; + } +} + + +static void aft_init_tx_rx_dma_descr(private_area_t *chan) +{ + int i; + u32 reg=0; + sdla_t *card=chan->card; + unsigned long tx_dma_descr,rx_dma_descr; + unsigned int dma_cnt=MAX_AFT_DMA_CHAINS; + + if (chan->single_dma_chain){ + dma_cnt=1; + } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + return; + } + + for (i=0;ilogic_ch_num<<4) + + (i*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_TX_DMA_HI_DESCR_BASE_REG); + + rx_dma_descr=(chan->logic_ch_num<<4) + + (i*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_RX_DMA_HI_DESCR_BASE_REG); + + card->hw_iface.bus_write_4(card->hw,tx_dma_descr,reg); + card->hw_iface.bus_write_4(card->hw,rx_dma_descr,reg); + + aft_tx_dma_chain_init(chan,&chan->tx_dma_chain_table[i]); + aft_rx_dma_chain_init(chan,&chan->rx_dma_chain_table[i]); + } +} + +static void aft_free_rx_complete_list(private_area_t *chan) +{ + void *skb; + + while((skb=wan_skb_dequeue(&chan->wp_rx_complete_list)) != NULL){ + DEBUG_TEST("%s: aft_free_rx_complete_list dropped\n", + chan->if_name); + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); //chan->if_stats.rx_dropped++; + aft_init_requeue_free_skb(chan, skb); + } +} + +static void aft_rx_cur_go_test(private_area_t *chan) +{ +#if 0 + u32 reg,cur_dma_ptr; + sdla_t *card=chan->card; + wan_dma_descr_t *dma_chain; + u32 dma_descr; + int i; + u32 dma_ram_desc; + unsigned int dma_cnt=MAX_AFT_DMA_CHAINS; + + dma_ram_desc=chan->logic_ch_num*4 + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); + cur_dma_ptr=aft_dmachain_get_rx_dma_addr(reg); + + dma_descr=(chan->logic_ch_num<<4) +(cur_dma_ptr*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_RX_DMA_HI_DESCR_BASE_REG); + + card->hw_iface.bus_read_4(card->hw,dma_descr,®); + + if (!wan_test_bit(AFT_RXDMA_HI_GO_BIT,®)){ + DEBUG_EVENT("%s: CRITICAL Cur =%d not Got bit set!\n", + chan->if_name, + cur_dma_ptr); + + + aft_list_descriptors(chan); + } +#endif +} + + +#if 0 +static void aft_list_descriptors(private_area_t *chan) +{ + u32 reg,cur_dma_ptr,lo_reg; + sdla_t *card=chan->card; + wan_dma_descr_t *dma_chain; + u32 dma_descr; + int i; + u32 dma_ram_desc; + unsigned int dma_cnt=MAX_AFT_DMA_CHAINS; + + dma_ram_desc=chan->logic_ch_num*4 + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); + cur_dma_ptr=aft_dmachain_get_rx_dma_addr(reg); + + DEBUG_TEST("%s: RX Chain DMA List: End=%d Begin=%d Cur=%d \n", + chan->if_name, + chan->rx_chain_indx, + chan->rx_pending_chain_indx, + cur_dma_ptr); + + if (chan->single_dma_chain){ + dma_cnt=1; + } + + for (i=0;irx_dma_chain_table[i]; + if (!dma_chain){ + DEBUG_EVENT("%s:%d Assertion Error !!!!\n", + __FUNCTION__,__LINE__); + break; + } + + dma_descr=(chan->logic_ch_num<<4) +(dma_chain->index*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_RX_DMA_HI_DESCR_BASE_REG); + + card->hw_iface.bus_read_4(card->hw,dma_descr,®); + + dma_descr=(chan->logic_ch_num<<4) +(dma_chain->index*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_RX_DMA_LO_DESCR_BASE_REG); + + card->hw_iface.bus_read_4(card->hw,dma_descr,&lo_reg); + + DEBUG_EVENT("%s: RX DMA=%d : Go=%u Intr=%u Used=%lu A=0%X R=0x%X L=0x%08X C=%i\n", + chan->if_name, + dma_chain->index, + wan_test_bit(AFT_RXDMA_HI_GO_BIT,®), + !wan_test_bit(AFT_RXDMA_HI_INTR_DISABLE_BIT,®), + dma_chain->init,dma_descr,reg,lo_reg,(lo_reg&0x1FF)/128); + } +} +#endif + +#if 0 +static void aft_list_tx_descriptors(private_area_t *chan) +{ + u32 reg,cur_dma_ptr,lo_reg; + sdla_t *card=chan->card; + wan_dma_descr_t *dma_chain; + u32 dma_descr; + int i; + u32 dma_ram_desc; + unsigned int dma_cnt=MAX_AFT_DMA_CHAINS; + + dma_ram_desc=chan->logic_ch_num*4 + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); + cur_dma_ptr=aft_dmachain_get_tx_dma_addr(reg); + + + DEBUG_TEST("%s: TX Chain DMA List: Cur(End)=%d, Pend(Begin)=%d HWCur=%d\n", + chan->if_name, + chan->tx_chain_indx, + chan->tx_pending_chain_indx, + cur_dma_ptr); + + if (chan->single_dma_chain){ + dma_cnt=1; + } + + for (i=0;itx_dma_chain_table[i]; + if (!dma_chain){ + DEBUG_EVENT("%s:%d Assertion Error !!!!\n", + __FUNCTION__,__LINE__); + break; + } + + dma_descr=(chan->logic_ch_num<<4) + + (dma_chain->index*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_TX_DMA_HI_DESCR_BASE_REG); + + card->hw_iface.bus_read_4(card->hw,dma_descr,®); + + dma_descr=(chan->logic_ch_num<<4) + + (dma_chain->index*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_TX_DMA_LO_DESCR_BASE_REG); + + card->hw_iface.bus_read_4(card->hw,dma_descr,&lo_reg); + + DEBUG_EVENT("%s: TX DMA=%d : Go=%u Intr=%u Used=%lu A=0%X R=0x%08X L=0x%08X C=%i\n", + chan->if_name, + dma_chain->index, + wan_test_bit(AFT_TXDMA_HI_GO_BIT,®), + wan_test_bit(AFT_TXDMA_HI_INTR_DISABLE_BIT,®) ? 0:1, + dma_chain->init, + dma_descr, + reg,lo_reg,(lo_reg&0x1FF)/128); + + } +} +#endif + +#if 0 +static void aft_list_dma_chain_regs(sdla_t *card) +{ + u32 reg; + int i; + u32 dma_ram_desc; + + for (i=0; iu.aft.num_of_time_slots;i++){ + + private_area_t *chan; + + if (!wan_test_bit(i,&card->u.aft.logic_ch_map)){ + continue; + } + + chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; + if (!chan){ + continue; + } + + if (!wan_test_bit(0,&chan->up)){ + continue; + } + + dma_ram_desc=chan->logic_ch_num*4 + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); + + DEBUG_EVENT("%s: DMA CHAIN: %i: 0x%08X\n", + card->devname,i,reg); + + } +} +#endif + + +static void aft_free_rx_descriptors(private_area_t *chan) +{ + u32 reg; + sdla_t *card=chan->card; + wan_dma_descr_t *dma_chain; + u32 dma_descr; + int i; + unsigned int dma_cnt=MAX_AFT_DMA_CHAINS; + + if (chan->single_dma_chain){ + dma_cnt=1; + } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + return; + } + + for (i=0;irx_dma_chain_table[i]; + if (!dma_chain){ + DEBUG_EVENT("%s:%d Assertion Error !!!!\n", + __FUNCTION__,__LINE__); + break; + } + + dma_descr=(chan->logic_ch_num<<4) + + (dma_chain->index*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_RX_DMA_HI_DESCR_BASE_REG); + + DEBUG_TEST("%s:%s: Rx: Freeing Descripors Ch=%ld Desc=0x%X\n", + card->devname,chan->if_name,chan->logic_ch_num,dma_descr); + + card->hw_iface.bus_read_4(card->hw,dma_descr,®); + + /* If GO bit is set, then the current DMA chain + * is in process of being transmitted, thus + * all are busy */ + reg=0; + card->hw_iface.bus_write_4(card->hw,dma_descr,reg); + + card->hw_iface.busdma_sync( card->hw, + dma_chain, + 1, chan->single_dma_chain, + SDLA_DMA_POSTREAD); + card->hw_iface.busdma_unmap( card->hw, + dma_chain, + SDLA_DMA_POSTREAD); + + if (dma_chain->skb){ + aft_init_requeue_free_skb(chan, dma_chain->skb); + } + + dma_chain->skb=NULL; + dma_chain->pkt_error=0; + wan_clear_bit(0,&dma_chain->init); + } + +} + +static void aft_reset_rx_chain_cnt(private_area_t *chan) +{ + u32 dma_ram_desc,reg,cur_dma_ptr; + sdla_t *card=chan->card; + + dma_ram_desc=chan->logic_ch_num*4+ + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); + cur_dma_ptr=aft_dmachain_get_rx_dma_addr(reg); + chan->rx_pending_chain_indx = chan->rx_chain_indx = cur_dma_ptr; + DEBUG_TEST("%s: Setting Rx Index to %d\n", + chan->if_name,cur_dma_ptr); + +} + +static void aft_reset_tx_chain_cnt(private_area_t *chan) +{ + u32 dma_ram_desc,reg,cur_dma_ptr; + sdla_t *card=chan->card; + + dma_ram_desc=chan->logic_ch_num*4+ + AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); + cur_dma_ptr=aft_dmachain_get_tx_dma_addr(reg); + chan->tx_pending_chain_indx = chan->tx_chain_indx = cur_dma_ptr; + DEBUG_TEST("%s: Setting Tx Index to %d\n", + chan->if_name,cur_dma_ptr); + +} + + + +static void aft_free_tx_descriptors(private_area_t *chan) +{ + u32 reg,dma_descr; + sdla_t *card=chan->card; + wan_dma_descr_t *dma_chain; + int i; + void *skb; + unsigned int dma_cnt=MAX_AFT_DMA_CHAINS; + + if (chan->single_dma_chain){ + dma_cnt=1; + } + + if (IS_BRI_CARD(card) && chan->dchan_time_slot >= 0){ + return; + } + + DEBUG_TEST("%s:%s: Tx: Freeing Descripors\n",card->devname,chan->if_name); + + for (i=0;itx_dma_chain_table[i]; + if (!dma_chain){ + DEBUG_EVENT("%s:%d Assertion Error !!!!\n", + __FUNCTION__,__LINE__); + break; + } + + dma_descr=(chan->logic_ch_num<<4) +(dma_chain->index*AFT_DMA_INDEX_OFFSET) + + AFT_PORT_REG(card,AFT_TX_DMA_HI_DESCR_BASE_REG); + + DEBUG_TEST("%s:%s: Tx: Freeing Descripors Ch=%ld Desc=0x%X\n", + card->devname,chan->if_name,chan->logic_ch_num,dma_descr); + reg=0; + card->hw_iface.bus_write_4(card->hw,dma_descr,reg); + + aft_tx_dma_chain_init(chan, dma_chain); + } + + chan->tx_chain_indx = chan->tx_pending_chain_indx; + + while((skb=wan_skb_dequeue(&chan->wp_tx_complete_list)) != NULL){ + wan_skb_free(skb); + } +} + + +/*===================================================== + * Chanalization/Logic Channel utilites + * + */ +void aft_free_logical_channel_num (sdla_t *card, int logic_ch) +{ + wan_clear_bit (logic_ch,&card->u.aft.logic_ch_map); + card->u.aft.dev_to_ch_map[logic_ch]=NULL; + + if (logic_ch >= card->u.aft.top_logic_ch){ + int i; + + card->u.aft.top_logic_ch=AFT_DEFLT_ACTIVE_CH; + + for (i=0;iu.aft.num_of_time_slots;i++){ + if (card->u.aft.dev_to_ch_map[i]){ + card->u.aft.top_logic_ch=i; + } + } + + + aft_dma_max_logic_ch(card); + } + +} + +void aft_dma_max_logic_ch(sdla_t *card) +{ + u32 reg; + + DEBUG_TEST("%s: Maximum Logic Ch set to %d \n", + card->devname,card->u.aft.top_logic_ch); + + reg=0; + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),®); + aft_dmactrl_set_max_logic_ch(®,card->u.aft.top_logic_ch); + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),reg); +} + +static int aft_tslot_sync_ctrl(sdla_t *card, private_area_t *chan, int mode) +{ + u32 dma_ram_reg,reg; + + if (chan->hdlc_eng){ + return 0; + } + + + dma_ram_reg=AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + dma_ram_reg+=(chan->logic_ch_num*4); + + card->hw_iface.bus_read_4(card->hw, dma_ram_reg, ®); + + if (mode){ + wan_set_bit(AFT_DMACHAIN_RX_SYNC_BIT,®); + }else{ + wan_clear_bit(AFT_DMACHAIN_RX_SYNC_BIT,®); + } + + card->hw_iface.bus_write_4(card->hw, dma_ram_reg, reg); + + return 0; +} + + + +static int aft_read_security(sdla_t *card) +{ + int adptr_security; + wan_smp_flag_t flags,smp_flags; + + if (card->adptr_subtype == AFT_SUBTYPE_SHARK){ + /* Shark cards are always channelized */ + card->u.aft.security_id=0x01; + return 0; + } + + card->hw_iface.hw_lock(card->hw,&smp_flags); + wan_spin_lock_irq(&card->wandev.lock,&flags); + adptr_security=aft_read_cpld(card,0x09); + wan_spin_unlock_irq(&card->wandev.lock,&flags); + card->hw_iface.hw_unlock(card->hw,&smp_flags); + + adptr_security=(adptr_security>>2)&0x03; + card->u.aft.security_id=adptr_security; + + if (adptr_security == 0x00){ + DEBUG_EVENT("%s: AFT Security: UnChannelised\n", + card->devname); + }else if (adptr_security == 0x01){ + DEBUG_EVENT("%s: AFT Security: Channelised\n", + card->devname); + }else{ + DEBUG_EVENT("%s: AFT Security: Unknown\n", + card->devname); + return -EINVAL; + } + + card->u.aft.security_cnt=0; + + return 0; +} + + +static int aft_front_end_mismatch_check(sdla_t * card) +{ + u32 reg; + + if (card->u.aft.firm_id == AFT_PMC_FE_CORE_ID) { + card->hw_iface.bus_read_4(card->hw,AFT_CHIP_CFG_REG, ®); + + if (IS_T1_CARD(card)){ + if (wan_test_bit(AFT_CHIPCFG_TE1_CFG_BIT,®)){ + DEBUG_EVENT("%s: Global Cfg Error: Initial front end cfg: E1\n", + card->devname); + return -EINVAL; + } + }else{ + if (!wan_test_bit(AFT_CHIPCFG_TE1_CFG_BIT,®)){ + DEBUG_EVENT("%s: Global Cfg Error: Initial front end cfg: T1\n", + card->devname); + return -EINVAL; + } + } + } + + return 0; +} + +static int aft_realign_skb_pkt(private_area_t *chan, netskb_t *skb) +{ + unsigned char *data=wan_skb_data(skb); + int len = wan_skb_len(skb); + + if (len > chan->dma_mru){ + DEBUG_EVENT("%s: Critical error: Tx unalign pkt(%d) > MTU buf(%d)!\n", + chan->if_name,len,chan->dma_mru); + return -ENOMEM; + } + + if (!chan->tx_realign_buf){ + chan->tx_realign_buf=wan_malloc(chan->dma_mru); + if (!chan->tx_realign_buf){ + DEBUG_EVENT("%s: Error: Failed to allocate tx memory buf\n", + chan->if_name); + return -ENOMEM; + }else{ + DEBUG_EVENT("%s: AFT Realign buffer allocated Len=%d\n", + chan->if_name,chan->dma_mru); + + } + } + + memcpy(chan->tx_realign_buf,data,len); + + wan_skb_init(skb,0); + wan_skb_trim(skb,0); + + if (wan_skb_tailroom(skb) < len){ + DEBUG_EVENT("%s: Critical error: Tx unalign pkt tail room(%i) < unalign len(%i)!\n", + chan->if_name,wan_skb_tailroom(skb),len); + + return -ENOMEM; + } + + data=wan_skb_put(skb,len); + + if ((unsigned long)data & 0x03){ + /* At this point pkt should be realigned. If not + * there is something really wrong! */ + return -EINVAL; + } + + memcpy(data,chan->tx_realign_buf,len); + + chan->opstats.Data_frames_Tx_realign_count++; + + return 0; +} + +void aft_wdt_set(sdla_t *card, unsigned char val) +{ + u8 reg; + u32 wdt_ctrl_reg=AFT_WDT_1TO4_CTRL_REG+card->wandev.comm_port; + + if (card->wandev.comm_port > 3) { + wdt_ctrl_reg=AFT_WDT_4TO8_CTRL_REG+(card->wandev.comm_port%4); + } + + card->hw_iface.bus_read_1(card->hw,wdt_ctrl_reg, ®); + aft_wdt_ctrl_set(®,val); + card->hw_iface.bus_write_1(card->hw,wdt_ctrl_reg, reg); +} +void aft_wdt_reset(sdla_t *card) +{ + u8 reg; + u32 wdt_ctrl_reg=AFT_WDT_1TO4_CTRL_REG+card->wandev.comm_port; + + if (card->wandev.comm_port > 3) { + wdt_ctrl_reg=AFT_WDT_4TO8_CTRL_REG+(card->wandev.comm_port%4); + } + + card->hw_iface.bus_read_1(card->hw, wdt_ctrl_reg, ®); + aft_wdt_ctrl_reset(®); + card->hw_iface.bus_write_1(card->hw, wdt_ctrl_reg, reg); +} + +#if defined(__LINUX__) +# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) +static void aft_port_task (void * card_ptr) +# else +static void aft_port_task (struct work_struct *work) +# endif +#else +static void aft_port_task (void * card_ptr, int arg) +#endif +{ +#if defined(__LINUX__) +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) + sdla_t *card = (sdla_t *)container_of(work, sdla_t, u.aft.port_task); +# else + sdla_t *card = (sdla_t *)card_ptr; +# endif +#else + sdla_t *card = (sdla_t *)card_ptr; +#endif + wan_smp_flag_t smp_flags; + + if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ + return; + } + + DEBUG_56K("%s: PORT TASK: 0x%X\n", card->devname,card->u.aft.port_task_cmd); + +#ifdef AFT_IRQ_STAT_DEBUG + card->wandev.stats.rx_missed_errors++; +#endif + + + if (wan_test_bit(AFT_FE_INTR,&card->u.aft.port_task_cmd)){ + + DEBUG_TEST("%s: PORT TASK: FE INTER\n", card->devname); + + card->hw_iface.hw_lock(card->hw,&smp_flags); + aft_fe_intr_ctrl(card, 0); + front_end_interrupt(card,0,1); + wan_clear_bit(AFT_FE_INTR,&card->u.aft.port_task_cmd); + aft_fe_intr_ctrl(card, 1); + card->hw_iface.hw_unlock(card->hw,&smp_flags); + + } + + if (wan_test_bit(AFT_FE_POLL,&card->u.aft.port_task_cmd)){ + DEBUG_TEST("%s: PORT TASK: FE POLL\n", card->devname); + card->hw_iface.hw_lock(card->hw,&smp_flags); + aft_fe_intr_ctrl(card, 0); + if (card->wandev.fe_iface.polling){ + wan_smp_flag_t smp_irq_flags; + int err = 0; + wan_spin_lock_irq(&card->wandev.lock,&smp_irq_flags); + err = card->wandev.fe_iface.polling(&card->fe); + + handle_front_end_state(card); + wan_spin_unlock_irq(&card->wandev.lock,&smp_irq_flags); + } + wan_clear_bit(AFT_FE_POLL,&card->u.aft.port_task_cmd); + aft_fe_intr_ctrl(card, 1); + card->hw_iface.hw_unlock(card->hw,&smp_flags); + } + + if (wan_test_bit(AFT_FE_LED,&card->u.aft.port_task_cmd)){ + DEBUG_TEST("%s: PORT TASK: FE LED\n", card->devname); + card->hw_iface.hw_lock(card->hw,&smp_flags); + aft_fe_intr_ctrl(card, 0); + if (card->wandev.state == WAN_CONNECTED){ + aft_hwdev[card->wandev.card_type].aft_led_ctrl(card, WAN_AFT_RED, 0,WAN_AFT_OFF); + aft_hwdev[card->wandev.card_type].aft_led_ctrl(card, WAN_AFT_GREEN, 0, WAN_AFT_ON); + }else{ + aft_hwdev[card->wandev.card_type].aft_led_ctrl(card, WAN_AFT_RED, 0,WAN_AFT_ON); + aft_hwdev[card->wandev.card_type].aft_led_ctrl(card, WAN_AFT_GREEN, 0, WAN_AFT_OFF); + } + wan_clear_bit(AFT_FE_LED,&card->u.aft.port_task_cmd); + aft_fe_intr_ctrl(card, 1); + card->hw_iface.hw_unlock(card->hw,&smp_flags); + } + +#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE + if (wan_test_bit(AFT_FE_TDM_RBS,&card->u.aft.port_task_cmd)){ + int err; + DEBUG_TEST("%s: PORT TASK: FE RBS\n", card->devname); + card->hw_iface.hw_lock(card->hw,&smp_flags); + + WAN_TDMV_CALL(rbsbits_poll, (&card->wan_tdmv, card), err); + + wan_clear_bit(AFT_FE_TDM_RBS,&card->u.aft.port_task_cmd); + card->hw_iface.hw_unlock(card->hw,&smp_flags); + } +#endif + +#if defined(CONFIG_WANPIPE_HWEC) + if (wan_test_bit(AFT_FE_EC_POLL,&card->u.aft.port_task_cmd)){ + + DEBUG_TEST("%s: PORT TASK: FE EC INTR\n", card->devname); + + if (card->wandev.ec_dev){ + card->hw_iface.hw_ec_lock(card->hw,&smp_flags); + wanpipe_ec_poll(card->wandev.ec_dev, card); + wan_clear_bit(AFT_FE_EC_POLL,&card->u.aft.port_task_cmd); + card->hw_iface.hw_ec_unlock(card->hw,&smp_flags); + } + } +#endif +} + +void __aft_fe_intr_ctrl(sdla_t *card, int status) +{ + u32 reg; + + if (!card->fe_no_intr || !status){ + card->hw_iface.bus_read_4(card->hw,AFT_CHIP_CFG_REG,®); + if (status){ + wan_set_bit(AFT_CHIPCFG_FE_INTR_CFG_BIT,®); + }else{ + wan_clear_bit(AFT_CHIPCFG_FE_INTR_CFG_BIT,®); + } + card->hw_iface.bus_write_4(card->hw,AFT_CHIP_CFG_REG,reg); + } +} + +void aft_fe_intr_ctrl(sdla_t *card, int status) +{ + wan_smp_flag_t smp_flags; + + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); + __aft_fe_intr_ctrl(card,status); + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); + +} + +static void aft_data_mux_cfg(sdla_t *card) +{ + if (!card->u.aft.cfg.data_mux_map){ + card->u.aft.cfg.data_mux_map=AFT_DEFAULT_DATA_MUX_MAP; + } + + card->hw_iface.bus_write_4(card->hw, AFT_DATA_MUX_REG, + card->u.aft.cfg.data_mux_map); + + DEBUG_EVENT("%s: AFT Data Mux Bit Map: 0x%08X\n", + card->devname,card->u.aft.cfg.data_mux_map); +} + +static void aft_data_mux_get_cfg(sdla_t *card) +{ + card->hw_iface.bus_read_4(card->hw, AFT_DATA_MUX_REG, + &card->u.aft.cfg.data_mux_map); + +} + +static int aft_hdlc_repeat_mangle(sdla_t *card,private_area_t *chan, netskb_t *skb, netskb_t **rskb) +{ + unsigned char *buf; + api_tx_hdr_t *tx_hdr = (api_tx_hdr_t *)wan_skb_data(skb); + + if (tx_hdr->wp_api_tx_hdr_hdlc_rpt_len == 0 || tx_hdr->wp_api_tx_hdr_hdlc_rpt_len > 8) { + return -1; + } + + *rskb=wan_skb_alloc(128); + if (!rskb) { + return -1; + } + + buf=wan_skb_put(*rskb,tx_hdr->wp_api_tx_hdr_hdlc_rpt_len); + memcpy(buf,tx_hdr->wp_api_tx_hdr_hdlc_rpt_data,tx_hdr->wp_api_tx_hdr_hdlc_rpt_len); + wan_skb_pull(skb,sizeof(api_tx_hdr_t)); + + return 0; +} + +static int aft_ss7_tx_mangle(sdla_t *card,private_area_t *chan, netskb_t *skb) +{ + int ss7_len=0,len=0; + unsigned int ss7_ctrl=0; + unsigned char *buf; + api_tx_hdr_t *tx_hdr = &chan->tx_api_hdr; + + memcpy(&chan->tx_api_hdr,wan_skb_data(skb),sizeof(api_tx_hdr_t)); + wan_skb_pull(skb,sizeof(api_tx_hdr_t)); + + if (!chan->tx_ss7_realign_buf){ + chan->tx_ss7_realign_buf=wan_malloc(chan->dma_mru); + if (!chan->tx_ss7_realign_buf){ + DEBUG_EVENT("%s: Error: Failed to allocate ss7 tx memory buf\n", + chan->if_name); + return -ENOMEM; + }else{ + DEBUG_TEST("%s: AFT SS7 Realign buffer allocated Len=%d\n", + chan->if_name,chan->dma_mru); + } + } + + memset(chan->tx_ss7_realign_buf,0,chan->dma_mru); + memcpy(chan->tx_ss7_realign_buf,wan_skb_data(skb),wan_skb_len(skb)); + len=wan_skb_len(skb); + + /* Align the end of the frame to 32 byte boundary */ + ss7_ctrl=(len%4)&AFT_SS7_CTRL_LEN_MASK; + if (ss7_ctrl != 0){ + len-=len%4; + len+=4; + } + + if (tx_hdr->hdr_u.ss7.type == WANOPT_SS7_FISU){ + if (chan->cfg.ss7_mode == WANOPT_SS7_MODE_4096){ + ss7_len=WANOPT_SS7_FISU_4096_SZ; + }else{ + ss7_len=WANOPT_SS7_FISU_128_SZ; + } + wan_clear_bit(AFT_SS7_CTRL_TYPE_BIT,&ss7_ctrl); + }else{ + ss7_len=chan->cfg.ss7_lssu_size; + wan_set_bit(AFT_SS7_CTRL_TYPE_BIT,&ss7_ctrl); + } + + if (tx_hdr->hdr_u.ss7.force_tx){ + wan_set_bit(AFT_SS7_CTRL_FORCE_BIT,&ss7_ctrl); + }else{ + wan_clear_bit(AFT_SS7_CTRL_FORCE_BIT,&ss7_ctrl); + } + + DEBUG_TEST("%s: SS7 DATA = 0x%X 0x%X 0x%X\n", + chan->if_name, + tx_hdr->hdr_u.ss7.data[0], + tx_hdr->hdr_u.ss7.data[1], + tx_hdr->hdr_u.ss7.data[2]); + + memcpy(&chan->tx_ss7_realign_buf[len],tx_hdr->hdr_u.ss7.data,ss7_len); + + len+=ss7_len; + + wan_skb_init(skb,0); + wan_skb_trim(skb,0); + + if (wan_skb_tailroom(skb) < len){ + DEBUG_EVENT("%s: Critical error: SS7 Tx unalign pkt tail room(%i) < len(%i)!\n", + chan->if_name,wan_skb_tailroom(skb),len); + + return -ENOMEM; + } + + buf=wan_skb_put(skb,len); + memcpy(buf,chan->tx_ss7_realign_buf,len); + + wan_skb_set_csum(skb, ss7_ctrl); + +#if 0 + debug_print_skb_pkt(chan->if_name, wan_skb_data(skb), wan_skb_len(skb), 0); +#endif + return 0; +} + + + + +#if 0 +static void aft_chain_history(private_area_t *chan,u8 end, u8 cur, u8 begin, u8 loc) +{ + dma_history_t *dma_hist = &chan->dma_history[chan->dma_index]; + + dma_hist->loc=loc; + dma_hist->end=end; + dma_hist->cur=cur; + dma_hist->begin=begin; + dma_hist->status=0; + + if (end > begin){ + if (cur > end || + cur < begin){ + DEBUG_TEST("%s: Rx: Critical: RxPendChain=%d HWDMA=%d RxEndChain=%d\n", + chan->if_name,begin,cur,end); + dma_hist->status=1; + } + }else if (end < begin){ + if (cur < begin && + cur > end){ + DEBUG_TEST("%s: Rx: Critical: RxEndChain=%d HWDMA=%d RxPendingChain=%d\n", + chan->if_name,begin,cur,end); + dma_hist->status=1; + + } + } + + if (++chan->dma_index >= MAX_DMA_HIST_SIZE){ + chan->dma_index=0; + } +} +#endif + +#if 0 +static void aft_display_chain_history(private_area_t *chan) +{ + int start=chan->dma_index; + int i; + dma_history_t *dma_hist = &chan->dma_history[start]; + + for (i=0;iloc == 0){ + continue; + } + + DEBUG_EVENT("%s: Loc=%02i End=%02d Cur=%02d Beg=%02d St=%s\n", + chan->if_name, + dma_hist->loc, + dma_hist->end, + dma_hist->cur, + dma_hist->begin, + dma_hist->status?"Error":"Ok"); + + start++; + if (start >= MAX_DMA_HIST_SIZE){ + start=0; + } + dma_hist = &chan->dma_history[start]; + } +} +#endif + +/* + * ****************************************************************** + * Proc FS function + */ +static int wan_aft_get_info(void* pcard, struct seq_file *m, int *stop_cnt) +{ + sdla_t *card = (sdla_t*)pcard; + + if (card->wandev.fe_iface.update_alarm_info){ + m->count = + WAN_FECALL( + &card->wandev, + update_alarm_info, + (&card->fe, m, stop_cnt)); + } + if (card->wandev.fe_iface.update_pmon_info){ + m->count = + WAN_FECALL( + &card->wandev, + update_pmon_info, + (&card->fe, m, stop_cnt)); + } + + return m->count; +} + +static int aft_tdmv_init(sdla_t *card, wandev_conf_t *conf) +{ + + int err; + int valid_firmware_ver=AFT_TDMV_FRM_VER; + + err=0; + DEBUG_EVENT("%s: TDMV Span = %d : %s\n", + card->devname, + card->tdmv_conf.span_no, + card->tdmv_conf.span_no?"Enabled":"Disabled"); + + if (card->tdmv_conf.span_no) { + if (card->wandev.config_id == WANCONFIG_AFT_ANALOG) { + valid_firmware_ver=AFT_MIN_ANALOG_FRMW_VER; + } + + if (card->u.aft.firm_ver < valid_firmware_ver){ + DEBUG_EVENT("%s: Error: Obselete AFT Firmware version: %X\n", + card->devname,card->u.aft.firm_ver); + DEBUG_EVENT("%s: Error: AFT TDMV Support depends on Firmware Ver >= %X\n", + card->devname,valid_firmware_ver); + return -EINVAL; + } + } + + + + return 0; + +} + + +/************************************************************** + * TDMV VOICE Functions + **************************************************************/ +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) +static int aft_tdmv_free(sdla_t *card) +{ + if (card->tdmv_conf.span_no && card->wan_tdmv.sc){ + int err; + WAN_TDMV_CALL(remove, (card), err); + } + return 0; +} +#endif + + +static int aft_tdmv_if_init(sdla_t *card, private_area_t *chan, wanif_conf_t *conf) +{ + BRI_INIT_FUNC(); + + if (!chan->channelized_cfg){ + BRI_INIT_FUNC(); + return 0; + } + + if (!card->tdmv_conf.span_no){ + DEBUG_EVENT("%s: Error: TDMV Span No is not set!\n", + card->devname); + return -EINVAL; + } + + if (chan->cfg.tdmv_master_if){ + DEBUG_EVENT("%s: Configuring TDMV Master dev %s\n", + card->devname,chan->if_name); + + /* Initialize a TDM bottom half handler + * Optionally used */ + WAN_TASKLET_INIT((&chan->common.bh_task),0,wp_tdm_bh,chan); + } + + if (conf->hdlc_streaming == 0){ + + int err; + + err=0; + + aft_hwdev[card->wandev.card_type].aft_fifo_adjust(card,AFT_TDMV_FIFO_LEVEL); + + if (chan->common.usedby == TDM_VOICE) { +#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE + WAN_TDMV_CALL(check_mtu, (card, conf->active_ch, &chan->mtu), err); + if (err){ + DEBUG_EVENT("Error: TMDV mtu check failed!"); + return -EINVAL; + } +#endif + } + + if (chan->common.usedby == TDM_VOICE_API) { + switch (chan->mtu) { + case 8: + case 16: + break; + case 40: + case 80: + if (!wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { + /* If Global TDM Feature is not enable + then 40 and 80 bytes TDM are not available */ + chan->mtu=16; + } + break; + default: + chan->mtu=16; + break; + } + } + + chan->mru = chan->mtu; + + card->u.aft.tdmv_mtu += chan->mtu; + + if (chan->tdmv_zaptel_cfg){ + chan->cfg.data_mux=1; + } + + conf->hdlc_streaming=0; + chan->tx_realign_buf = NULL; +#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE + card->wan_tdmv.brt_enable=0; +#endif + + }else{ + chan->cfg.data_mux=0; + } + + BRI_INIT_FUNC(); + +#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE + if (chan->tdmv_zaptel_cfg){ + int channel; + + /* The TDMV drivers always starts from number + * ZERO. Wanpipe driver doesn't allow timeslot + * ZERO. Thus, the active_ch map must me adjusted + * before calling tdmv_reg */ + if (IS_E1_CARD(card)){ + conf->active_ch=conf->active_ch>>1; + } + + if(IS_BRI_CARD(card)){ + if(chan->dchan_time_slot >= 0){ + conf->active_ch = 0x4<<(WAN_FE_LINENO(&card->fe)*2); + /* For the d-chan MUST set ONLY bit 2!! */ + } + } + + WAN_TDMV_CALL(reg, + (card, + &conf->tdmv, + conf->active_ch, + conf->hwec.enable, + chan->common.dev), channel); + + if (channel < 0){ + DEBUG_EVENT("%s: Error: Failed to register TDMV channel!\n", + chan->if_name); + + return -EINVAL; + } + chan->tdmv_chan=channel; + + + if (card->u.aft.tdmv_dchan_cfg_on_master && chan->cfg.tdmv_master_if){ + u32 orig_ch=conf->active_ch; + + conf->active_ch=card->u.aft.tdmv_dchan_cfg_on_master; + + WAN_TDMV_CALL(reg, + (card, + &conf->tdmv, + conf->active_ch, + conf->hwec.enable, + chan->common.dev), channel); + if (channel < 0){ + DEBUG_EVENT("%s: Error: Failed to register TDMV channel!\n", + chan->if_name); + + return -EINVAL; + } + + card->u.aft.tdmv_chan=channel; + card->u.aft.tdmv_dchan_active_ch=conf->active_ch; + conf->active_ch=orig_ch; + } + } +#endif + return 0; +} + + +static int aft_tdmv_if_free(sdla_t *card, private_area_t *chan) +{ +#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE + if (chan->tdmv_zaptel_cfg){ + int err; + WAN_TDMV_CALL(unreg, (card, chan->time_slot_map), err); + if (err){ + return err; + } + + if (card->u.aft.tdmv_dchan_cfg_on_master && chan->cfg.tdmv_master_if){ + DEBUG_EVENT("%s: Card Unregistering DCHAN\n", + card->devname); + WAN_TDMV_CALL(unreg, (card, card->u.aft.tdmv_dchan_active_ch), err); + card->u.aft.tdmv_dchan_cfg_on_master=0; + } + } +#endif + return 0; +} + +#if 0 +/* NCDEBUG */ +static int gtmp_cnt=0; +static void aft_set_channel(sdla_t *card, int ch) +{ + wan_dma_descr_t *tx_dma_chain; + u8 *buf; + private_area_t *chan=(private_area_t*)card->u.aft.dev_to_ch_map[ch]; + + if (!chan) return; + + tx_dma_chain = &chan->tx_dma_chain_table[0]; + if (!tx_dma_chain){ + return; + } + buf = (u8*)wan_skb_data(tx_dma_chain->skb); + buf[0]=gtmp_cnt++; + buf[1]=gtmp_cnt++; + buf[2]=gtmp_cnt++; + buf[3]=gtmp_cnt++; + buf[4]=gtmp_cnt++; + buf[5]=gtmp_cnt++; + buf[6]=gtmp_cnt++; + buf[7]=gtmp_cnt++; + + card->wandev.stats.tx_packets++; +} +#endif + + +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) +static int aft_voice_span_rx_tx(sdla_t *card, int rotate) +{ + int err; + err=0; + + if (card->wan_tdmv.sc){ + + if (rotate) { + WAN_TDMV_CALL(buf_rotate, (card,AFT_TDMV_CIRC_BUF,AFT_TDMV_BUF_MASK), err); + } + + if (!card->wandev.ec_enable || card->wandev.ec_enable_map == 0){ + WAN_TDMV_CALL(ec_span, (card), err); + } + + WAN_TDMV_CALL(rx_tx_span, (card), err); + + WAN_TDMV_CALL(is_rbsbits, (&card->wan_tdmv), err); + if (err == 1){ + wan_set_bit(AFT_FE_TDM_RBS,&card->u.aft.port_task_cmd); + WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); + } + +#if !defined(AFT_IRQ_DEBUG) + card->wandev.stats.rx_packets++; + card->wandev.stats.tx_packets++; +#endif + + } + return 0; +} +#endif + +static int aft_dma_rx_tdmv(sdla_t *card, private_area_t *chan) +{ + int err; + u32 rx_offset=0; + u32 tx_offset=0; + + wan_dma_descr_t *tx_dma_chain; + wan_dma_descr_t *rx_dma_chain; + + tx_dma_chain = &chan->tx_dma_chain_table[0]; + rx_dma_chain = &chan->rx_dma_chain_table[0]; + + + if (wan_test_bit(AFT_TDM_RING_BUF,&card->u.aft.chip_cfg_status)) { + rx_offset= AFT_TDMV_CIRC_BUF * card->u.aft.tdm_rx_dma_toggle; + tx_offset= AFT_TDMV_CIRC_BUF * card->u.aft.tdm_tx_dma_toggle; + } + + err=0; + + if (!tx_dma_chain || !rx_dma_chain){ + DEBUG_EVENT("%s: %s:%d ASSERT ERROR TxDma=%p RxDma=%p\n", + card->devname,__FUNCTION__,__LINE__, + tx_dma_chain,rx_dma_chain); + return -EINVAL; + } + + if (!rx_dma_chain->skb || !tx_dma_chain->skb){ + DEBUG_TEST("%s: %s:%d ASSERT ERROR TxSkb=%p RxSkb=%p\n", + card->devname,__FUNCTION__,__LINE__, + rx_dma_chain->skb,tx_dma_chain->skb); + return -EINVAL; + } + +#if 0 + /*Measure the round trip delay*/ + if (!chan->tdmv_rx_delay_cfg){ + int i; + unsigned char *buf=rx_dma_chain->dma_virt+offset; + for (i=0;i<8;i++){ + if (buf[i]==0x55){ + chan->tdmv_rx_delay_cfg=1; + DEBUG_EVENT("%s: Chan=%ld Delay=%d\n", + chan->if_name,chan->logic_ch_num, + chan->tdmv_rx_delay); + break; + } + chan->tdmv_rx_delay++; + } + } +#endif + + + if (chan->tdmv_zaptel_cfg){ +#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE + if (card->wan_tdmv.sc){ + +#if 0 +defined(AFT_TDMV_BH_ENABLE) + wan_dma_descr_t *tx_bh_dma_chain = &chan->tx_dma_chain_table[1]; + wan_dma_descr_t *rx_bh_dma_chain = &chan->rx_dma_chain_table[1]; + + if (!rx_bh_dma_chain->skb){ + rx_bh_dma_chain->skb=wan_skb_dequeue(&chan->wp_rx_free_list); + if (!rx_bh_dma_chain->skb){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: Critical TDM BH no free skb\n", + chan->if_name); + goto aft_tdm_bh_skip; + } + } + wan_skb_init(rx_bh_dma_chain->skb,16); + wan_skb_trim(rx_bh_dma_chain->skb,0); + } + + if (!tx_bh_dma_chain->skb){ + tx_bh_dma_chain->skb=wan_skb_dequeue(&chan->wp_rx_free_list); + if (!tx_bh_dma_chain->skb){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: Critical TDM BH no free skb\n", + chan->if_name); + goto aft_tdm_bh_skip; + } + } + wan_skb_init(tx_bh_dma_chain->skb,16); + wan_skb_trim(tx_bh_dma_chain->skb,0); + } + + memcpy(wan_skb_data(rx_bh_dma_chain->skb), + wan_skb_data(rx_dma_chain->skb),8); + + memcpy(wan_skb_data(tx_dma_chain->skb), + wan_skb_data(tx_bh_dma_chain->skb),8); + + rx_dma_chain=rx_bh_dma_chain; + tx_dma_chain=tx_bh_dma_chain; +aft_tdm_bh_skip: +#endif + + DEBUG_TEST ("%s: Calling Rx Chan=%i TdmvChan=%i\n", + card->devname,chan->logic_ch_num, + chan->tdmv_chan); + + if (card->wandev.rtp_len && card->wandev.rtp_tap) { + card->wandev.rtp_tap(card, + IS_T1_CARD(card) ? chan->first_time_slot : + chan->first_time_slot-1, + (unsigned char*)rx_dma_chain->dma_virt+rx_offset, + (unsigned char*)tx_dma_chain->dma_virt+tx_offset, + chan->mtu); + } + +#if 1 + WAN_TDMV_CALL(rx_chan, + (&card->wan_tdmv,chan->tdmv_chan, + (unsigned char*)rx_dma_chain->dma_virt+rx_offset, + (unsigned char*)tx_dma_chain->dma_virt+tx_offset), + err); +#else +#warning "NCDEBUG rx_chan disabled irq" +#endif + +#if 0 + if (((u8*)(rx_dma_chain->dma_virt+offset))[0] != 0xFF && + ((u8*)(rx_dma_chain->dma_virt+offset))[0] != 0x7F && + tx_debug_cnt < 100){ + DEBUG_EVENT("%s: %02X %02X %02X %02X %02X %02X %02X %02X\n", + card->devname, + ((u8*)(rx_dma_chain->dma_virt+offset))[0], + ((u8*)(rx_dma_chain->dma_virt+offset))[1], + ((u8*)(rx_dma_chain->dma_virt+offset))[2], + ((u8*)(rx_dma_chain->dma_virt+offset))[3], + ((u8*)(rx_dma_chain->dma_virt+offset))[4], + ((u8*)(rx_dma_chain->dma_virt+offset))[5], + ((u8*)(rx_dma_chain->dma_virt+offset))[6], + ((u8*)(rx_dma_chain->dma_virt+offset))[7]); + tx_debug_cnt++; + } +#endif + }else{ + return 1; + } +#endif + }else{ + +#ifdef AFT_TDM_API_SUPPORT + + + + wanpipe_tdm_api_rx_tx(&chan->wp_tdm_api_dev, + rx_dma_chain->dma_virt+rx_offset, + tx_dma_chain->dma_virt+tx_offset, + chan->mtu); +#endif + } + + if (chan->cfg.tdmv_master_if){ + u32 reg; + int err; + err=0; +#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE + if (chan->tdmv_zaptel_cfg){ + DEBUG_TEST ("%s: Calling Master Rx Tx Chan=%i\n", + card->devname,chan->logic_ch_num); +#if 0 +defined(AFT_TDMV_BH_ENABLE) +#warning "AFT A104: TDM Driver compiled in BH mode!" + + if (WAN_TASKLET_RUNNING((&chan->common.bh_task))){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: Critical Error: TDMV BH Overrun!\n", + card->devname); + } + } + + WAN_WP_TASKLET_SCHEDULE_PER_CPU((&chan->common.bh_task), + card->tdmv_conf.span_no); + + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),®); + wan_set_bit(AFT_DMACTRL_TDMV_RX_TOGGLE,®); + wan_set_bit(AFT_DMACTRL_TDMV_TX_TOGGLE,®); + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),reg); + +#else + +#if 1 + card->hw_iface.busdma_sync( card->hw, + &chan->tx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS, + chan->single_dma_chain, + SDLA_DMA_POSTREAD); + + WAN_TDMV_CALL(rx_tx_span, (card), err); + + card->hw_iface.busdma_sync( card->hw, + &chan->tx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS, + chan->single_dma_chain, + SDLA_DMA_PREWRITE); + card->hw_iface.busdma_sync( card->hw, + &chan->rx_dma_chain_table[0], + MAX_AFT_DMA_CHAINS, + chan->single_dma_chain, + SDLA_DMA_PREREAD); + +#else +#warning "NCDEBUG: rx_tx_span disabled irq" +#endif + + + if (!wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),®); + wan_set_bit(AFT_DMACTRL_TDMV_RX_TOGGLE,®); + wan_set_bit(AFT_DMACTRL_TDMV_TX_TOGGLE,®); + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),reg); + } + + if (card->wan_tdmv.sc){ + WAN_TDMV_CALL(is_rbsbits, (&card->wan_tdmv), err); + if (err == 1){ + wan_set_bit(AFT_FE_TDM_RBS,&card->u.aft.port_task_cmd); + WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); + } + } +#endif + }else{ +#else + if (!chan->tdmv_zaptel_cfg){ + +#endif + if (card->wandev.fe_iface.watchdog) { + err = card->wandev.fe_iface.watchdog(&card->fe); + } + + if (!wan_test_bit(AFT_TDM_GLOBAL_ISR,&card->u.aft.chip_cfg_status)) { + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),®); + wan_set_bit(AFT_DMACTRL_TDMV_RX_TOGGLE,®); + wan_set_bit(AFT_DMACTRL_TDMV_TX_TOGGLE,®); + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_DMA_CTRL_REG),reg); + } + } + + DEBUG_TEST("%s: Master device tx rx %i!\n", + card->devname,chan->logic_ch_num); + } + + chan->opstats.Data_frames_Rx_count++; + chan->opstats.Data_bytes_Rx_count+=chan->mru; + chan->opstats.Data_frames_Tx_count++; + chan->opstats.Data_bytes_Tx_count+=chan->mtu; + WAN_NETIF_STATS_INC_RX_PACKETS(&chan->common); //chan->if_stats.rx_packets++; + WAN_NETIF_STATS_INC_RX_BYTES(&chan->common,chan->mru); //chan->if_stats.rx_bytes += chan->mru; + WAN_NETIF_STATS_INC_TX_PACKETS(&chan->common); //chan->if_stats.tx_packets++; + WAN_NETIF_STATS_INC_TX_BYTES(&chan->common,chan->mtu); //chan->if_stats.tx_bytes += chan->mtu; + + return 0; +} + +static int aft_fifo_intr_ctrl(sdla_t *card, int ctrl) +{ + u32 reg; + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_RX_FIFO_INTR_PENDING_REG), + ®); + + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_TX_FIFO_INTR_PENDING_REG), + ®); + + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_LINE_CFG_REG), ®); + + if (ctrl){ + wan_set_bit(AFT_LCFG_FIFO_INTR_BIT,®); + }else{ + wan_clear_bit(AFT_LCFG_FIFO_INTR_BIT,®); + } + + card->hw_iface.bus_write_4(card->hw, + AFT_PORT_REG(card,AFT_LINE_CFG_REG), reg); + + card->u.aft.lcfg_reg=reg; + + + if (!ctrl){ + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_RX_FIFO_INTR_PENDING_REG), + ®); + + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_TX_FIFO_INTR_PENDING_REG), + ®); + } + + return 0; +} + +static int aft_tdm_intr_ctrl(sdla_t *card, int ctrl) +{ + u32 reg; + card->hw_iface.bus_read_4(card->hw, + AFT_PORT_REG(card,AFT_LINE_CFG_REG), ®); + + if (ctrl){ + wan_set_bit(AFT_LCFG_TDMV_INTR_BIT,®); + + }else{ + wan_clear_bit(AFT_LCFG_TDMV_INTR_BIT,®); + } + + card->hw_iface.bus_write_4(card->hw, + AFT_PORT_REG(card,AFT_LINE_CFG_REG), reg); + + card->u.aft.lcfg_reg=reg; + + return 0; +} + +#if defined(AFT_API_SUPPORT) +static int wan_aft_api_ioctl(sdla_t *card, private_area_t *chan, char *user_data) +{ + api_tx_hdr_t tx_hdr; + wan_event_ctrl_t event_ctrl; + int err = -EINVAL; + + if (WAN_COPY_FROM_USER(&tx_hdr, user_data, sizeof(api_tx_hdr_t))){ + DEBUG_EVENT("%s: Failed to copy data from user space!\n", + card->devname); + return -EFAULT; + } + memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); + switch(tx_hdr.wp_api_tx_hdr_event_type){ + case WP_API_EVENT_DTMF: + DEBUG_TEST("%s: %s HW DTMF events!\n", + card->devname, + (tx_hdr.wp_api_tx_hdr_event_mode==WP_API_EVENT_ENABLE)? + "Enable": "Disable"); + event_ctrl.type = WAN_EVENT_EC_DTMF; + event_ctrl.ts_map = tx_hdr.wp_api_tx_hdr_event_channel; + if (tx_hdr.wp_api_tx_hdr_event_mode == WP_API_EVENT_ENABLE){ + event_ctrl.mode = WAN_EVENT_ENABLE; + }else{ + event_ctrl.mode = WAN_EVENT_DISABLE; + } + err = aft_event_ctrl(chan, &event_ctrl); + break; + + case WP_API_EVENT_RM_DTMF: + DEBUG_TEST("%s: %s RM DTMF events!\n", + card->devname, + (tx_hdr.wp_api_tx_hdr_event_mode==WP_API_EVENT_ENABLE)? + "Enable": "Disable"); + event_ctrl.type = WAN_EVENT_RM_DTMF; + event_ctrl.mod_no = tx_hdr.wp_api_tx_hdr_event_channel; + if (tx_hdr.wp_api_tx_hdr_event_mode == WP_API_EVENT_ENABLE){ + event_ctrl.mode = WAN_EVENT_ENABLE; + }else{ + event_ctrl.mode = WAN_EVENT_DISABLE; + } + err = aft_event_ctrl(chan, &event_ctrl); + break; + + case WP_API_EVENT_RXHOOK: + DEBUG_TEST("%s: %s OFFHOOK/ONHOOK events!\n", + card->devname, + (tx_hdr.wp_api_tx_hdr_event_mode==WP_API_EVENT_ENABLE)? + "Enable": "Disable"); + event_ctrl.type = WAN_EVENT_RM_LC; + event_ctrl.mod_no = tx_hdr.wp_api_tx_hdr_event_channel; + if (tx_hdr.wp_api_tx_hdr_event_mode == WP_API_EVENT_ENABLE){ + event_ctrl.mode = WAN_EVENT_ENABLE; + }else{ + event_ctrl.mode = WAN_EVENT_DISABLE; + } + err = aft_event_ctrl(chan, &event_ctrl); + break; + case WP_API_EVENT_RING: + DEBUG_TEST("%s: %s RING events!\n", + card->devname, + (tx_hdr.wp_api_tx_hdr_event_mode==WP_API_EVENT_ENABLE)? + "Enable": "Disable"); + event_ctrl.type = WAN_EVENT_RM_RING; + event_ctrl.mod_no = tx_hdr.wp_api_tx_hdr_event_channel; + if (tx_hdr.wp_api_tx_hdr_event_mode == WP_API_EVENT_ENABLE){ + event_ctrl.mode = WAN_EVENT_ENABLE; + }else{ + event_ctrl.mode = WAN_EVENT_DISABLE; + } + err = aft_event_ctrl(chan, &event_ctrl); + break; + case WP_API_EVENT_TONE: + DEBUG_TEST("%s: %s TONE events!\n", + card->devname, + (tx_hdr.wp_api_tx_hdr_event_mode==WP_API_EVENT_ENABLE)? + "Enable": "Disable"); + event_ctrl.type = WAN_EVENT_RM_TONE; + event_ctrl.mod_no = tx_hdr.wp_api_tx_hdr_event_channel; + switch(tx_hdr.wp_api_tx_hdr_event_tone){ + case WP_API_EVENT_TONE_DIAL: + event_ctrl.tone = WAN_EVENT_TONE_DIAL; + break; + case WP_API_EVENT_TONE_BUSY: + event_ctrl.tone = WAN_EVENT_TONE_BUSY; + break; + case WP_API_EVENT_TONE_RING: + event_ctrl.tone = WAN_EVENT_TONE_RING; + break; + case WP_API_EVENT_TONE_CONGESTION: + event_ctrl.tone = WAN_EVENT_TONE_CONGESTION; + break; + default: + if (tx_hdr.wp_api_tx_hdr_event_mode == WP_API_EVENT_ENABLE){ + DEBUG_EVENT("%s: Unsupported tone type %d!\n", + card->devname, + tx_hdr.wp_api_tx_hdr_event_tone); + return -EINVAL; + } + break; + } + if (tx_hdr.wp_api_tx_hdr_event_mode == WP_API_EVENT_ENABLE){ + event_ctrl.mode = WAN_EVENT_ENABLE; + }else{ + event_ctrl.mode = WAN_EVENT_DISABLE; + } + err = aft_event_ctrl(chan, &event_ctrl); + break; + + case WP_API_EVENT_TXSIG_KEWL: + DEBUG_EVENT("%s: TXSIG KEWL for module %d!\n", + card->devname, + tx_hdr.wp_api_tx_hdr_event_channel); + event_ctrl.type = WAN_EVENT_RM_TXSIG_KEWL; + event_ctrl.mod_no = tx_hdr.wp_api_tx_hdr_event_channel; + err = aft_event_ctrl(chan, &event_ctrl); + break; + case WP_API_EVENT_TXSIG_START: + DEBUG_EVENT("%s: TXSIG START for module %d!\n", + card->devname, + tx_hdr.wp_api_tx_hdr_event_channel); + event_ctrl.type = WAN_EVENT_RM_TXSIG_START; + event_ctrl.mod_no = tx_hdr.wp_api_tx_hdr_event_channel; + err = aft_event_ctrl(chan, &event_ctrl); + break; + case WP_API_EVENT_TXSIG_OFFHOOK: + DEBUG_EVENT("%s: RM TXSIG OFFHOOK for module %d!\n", + card->devname, + tx_hdr.wp_api_tx_hdr_event_channel); + event_ctrl.type = WAN_EVENT_RM_TXSIG_OFFHOOK; + event_ctrl.mod_no = tx_hdr.wp_api_tx_hdr_event_channel; + err = aft_event_ctrl(chan, &event_ctrl); + break; + case WP_API_EVENT_TXSIG_ONHOOK: + DEBUG_EVENT("%s: RM TXSIG ONHOOK for module %d!\n", + card->devname, + tx_hdr.wp_api_tx_hdr_event_channel); + event_ctrl.type = WAN_EVENT_RM_TXSIG_ONHOOK; + event_ctrl.mod_no = tx_hdr.wp_api_tx_hdr_event_channel; + err = aft_event_ctrl(chan, &event_ctrl); + break; + case WP_API_EVENT_ONHOOKTRANSFER: + DEBUG_EVENT("%s: RM ONHOOKTRANSFER for module %d!\n", + card->devname, + tx_hdr.wp_api_tx_hdr_event_channel); + event_ctrl.type = WAN_EVENT_RM_ONHOOKTRANSFER; + event_ctrl.mod_no = tx_hdr.wp_api_tx_hdr_event_channel; + event_ctrl.ohttimer = tx_hdr.wp_api_tx_hdr_event_ohttimer; + err = aft_event_ctrl(chan, &event_ctrl); + break; + case WP_API_EVENT_SETPOLARITY: + DEBUG_EVENT("%s: RM SETPOLARITY for module %d!\n", + card->devname, + tx_hdr.wp_api_tx_hdr_event_channel); + event_ctrl.type = WAN_EVENT_RM_SETPOLARITY; + event_ctrl.mod_no = tx_hdr.wp_api_tx_hdr_event_channel; + event_ctrl.polarity = tx_hdr.wp_api_tx_hdr_event_polarity; + err = aft_event_ctrl(chan, &event_ctrl); + break; + case WP_API_EVENT_RING_DETECT: + DEBUG_EVENT("%s: %s: RM RING DETECT events for module %d!\n", + card->devname, + WP_API_EVENT_MODE_DECODE(tx_hdr.wp_api_tx_hdr_event_mode), + tx_hdr.wp_api_tx_hdr_event_channel); + event_ctrl.type = WAN_EVENT_RM_RING_DETECT; + event_ctrl.mod_no = tx_hdr.wp_api_tx_hdr_event_channel; + if (tx_hdr.wp_api_tx_hdr_event_mode == WP_API_EVENT_ENABLE){ + event_ctrl.mode = WAN_EVENT_ENABLE; + }else{ + event_ctrl.mode = WAN_EVENT_DISABLE; + } + err = aft_event_ctrl(chan, &event_ctrl); + break; + + default: + DEBUG_EVENT("%s: Unknown event type %02X!\n", + card->devname, + tx_hdr.wp_api_tx_hdr_event_type); + err = -EINVAL; + break; + } + return err; +} +#endif + +#if defined(AFT_API_SUPPORT) +static void wan_aft_api_dtmf (void* card_id, wan_event_t *event) +{ + sdla_t *card = (sdla_t*)card_id; + private_area_t *chan = NULL; + netskb_t *new_skb = NULL; + api_rx_hdr_t *rx_hdr; + int i; + + if (event->type == WAN_EVENT_EC_DTMF){ + DEBUG_TEST("%s: Received DTMF Event at AFT API (%d:%c:%s:%s)!\n", + card->devname, + event->channel, + event->digit, + (event->dtmf_port == WAN_EC_CHANNEL_PORT_ROUT)?"ROUT":"SOUT", + (event->dtmf_type == WAN_EC_TONE_PRESENT)?"PRESENT":"STOP"); + }else if (event->type == WAN_EVENT_RM_DTMF){ + DEBUG_TEST("%s: Received DTMF Event at AFT API (%d:%c)!\n", + card->devname, + event->channel, + event->digit); + } + + for (i=0;iu.aft.num_of_time_slots;i++){ + if (wan_test_bit(i,&card->u.aft.logic_ch_map)){ + unsigned long ts_map; + chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; + ts_map = chan->time_slot_map; + if (IS_T1_CARD(card) || IS_FXOFXS_CARD(card)){ + /* Convert active_ch bit map to user */ + ts_map = ts_map << 1; + } + if (wan_test_bit(event->channel,&ts_map)){ + break; + } + chan = NULL; + } + } + if (chan == NULL){ + DEBUG_EVENT("%s: Failed to find channel device (channel=%d)!\n", + card->devname, event->channel); + return; + } +#if defined(__LINUX__) + new_skb=wan_skb_alloc(sizeof(api_rx_element_t)); + if (new_skb == NULL) return; + + rx_hdr=(api_rx_hdr_t*)wan_skb_put(new_skb,sizeof(api_rx_element_t)); + memset(rx_hdr,0,sizeof(api_rx_hdr_t)); + + rx_hdr->error_flag = 0; + rx_hdr->event_type = WP_API_EVENT_DTMF; + rx_hdr->wp_api_rx_hdr_event_channel = event->channel; + rx_hdr->wp_api_rx_hdr_event_dtmf_digit = event->digit; + rx_hdr->wp_api_rx_hdr_event_dtmf_type = event->dtmf_type; + rx_hdr->wp_api_rx_hdr_event_dtmf_port = event->dtmf_port; + + new_skb->protocol = htons(PVC_PROT); + new_skb->mac.raw = new_skb->data; + new_skb->dev = chan->common.dev; + new_skb->pkt_type = WAN_PACKET_DATA; + + //if (wan_api_rx_dtmf(chan,new_skb) != 0){ + if (wan_api_rx(chan,new_skb) != 0){ + DEBUG_EVENT("%s: Failed to send up DTMF event!\n", + card->devname); + wan_skb_free(new_skb); + } +#else + DEBUG_EVENT("%s:%s: DTMF Event report is not supported!\n", + card->devname, chan->if_name); + new_skb = NULL; + rx_hdr = NULL; +#endif + return; +} +#endif + +#if defined(AFT_API_SUPPORT) +static void wan_aft_api_hook (void* card_id, wan_event_t *event) +{ + sdla_t *card = (sdla_t*)card_id; + private_area_t *chan = NULL; + netskb_t *new_skb = NULL; + api_rx_hdr_t *rx_hdr; + int i; + + if (event->type != WAN_EVENT_RM_LC){ + DEBUG_EVENT("ERROR: %s: Invalid Event type (%04X)!\n", + card->devname, event->type); + return; + } + DEBUG_EVENT("%s: Received %s (%d) Event at AFT API (%d)!\n", + card->devname, + WAN_EVENT_RXHOOK_DECODE(event->rxhook), event->rxhook, + event->channel); + + for (i=0;iu.aft.num_of_time_slots;i++){ + if (wan_test_bit(i,&card->u.aft.logic_ch_map)){ + unsigned long ts_map; + chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; + ts_map = chan->time_slot_map; + if (IS_T1_CARD(card) || IS_FXOFXS_CARD(card)){ + /* Convert active_ch bit map to user */ + ts_map = ts_map << 1; + } + if (wan_test_bit(event->channel,&ts_map)){ + break; + } + chan = NULL; + } + } + if (chan == NULL){ + DEBUG_EVENT("%s: Failed to find channel device (channel=%d)!\n", + card->devname, event->channel); + return; + } +#if defined(__LINUX__) + new_skb=wan_skb_alloc(sizeof(api_rx_element_t)); + if (new_skb == NULL) return; + + rx_hdr=(api_rx_hdr_t*)wan_skb_put(new_skb,sizeof(api_rx_element_t)); + memset(rx_hdr,0,sizeof(api_rx_hdr_t)); + + rx_hdr->error_flag = 0; + rx_hdr->event_type = WP_API_EVENT_RXHOOK; + rx_hdr->wp_api_rx_hdr_event_channel = event->channel; + if (event->rxhook == WAN_EVENT_RXHOOK_OFF){ + rx_hdr->wp_api_rx_hdr_event_rxhook_state = WP_API_EVENT_RXHOOK_OFF; + }else if (event->rxhook == WAN_EVENT_RXHOOK_ON){ + rx_hdr->wp_api_rx_hdr_event_rxhook_state = WP_API_EVENT_RXHOOK_ON; + } + + new_skb->protocol = htons(PVC_PROT); + new_skb->mac.raw = new_skb->data; + new_skb->dev = chan->common.dev; + new_skb->pkt_type = WAN_PACKET_DATA; + + if (wan_api_rx(chan,new_skb) != 0){ + DEBUG_EVENT("%s: Failed to send up HOOK event!\n", + card->devname); + wan_skb_free(new_skb); + } +#else + DEBUG_EVENT("%s:%s: RXHOOK Event report is not supported!\n", + card->devname, chan->if_name); + new_skb = NULL; + rx_hdr = NULL; +#endif + return; +} +#endif + +#if defined(AFT_API_SUPPORT) +static void wan_aft_api_ringtrip (void* card_id, wan_event_t *event) +{ + sdla_t *card = (sdla_t*)card_id; + + DEBUG_EVENT("%s: Unsupported event!\n", card->devname); + return; +} +#endif + +#if defined(AFT_API_SUPPORT) +static void wan_aft_api_ringdetect (void* card_id, wan_event_t *event) +{ + sdla_t *card = (sdla_t*)card_id; + private_area_t *chan = NULL; + netskb_t *new_skb = NULL; + api_rx_hdr_t *rx_hdr; + int i; + + if (event->type != WAN_EVENT_RM_RING_DETECT){ + DEBUG_EVENT("ERROR: %s: Invalid Event type (%04X)!\n", + card->devname, event->type); + return; + } + DEBUG_EVENT("%s: Received Ring Detect %s (%d) Event at AFT API (%d)!\n", + card->devname, + WAN_EVENT_RING_DECODE(event->ring_mode), event->ring_mode, + event->channel); + + for (i=0;iu.aft.num_of_time_slots;i++){ + if (wan_test_bit(i,&card->u.aft.logic_ch_map)){ + unsigned long ts_map; + chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; + ts_map = chan->time_slot_map; + if (IS_T1_CARD(card) || IS_FXOFXS_CARD(card)){ + /* Convert active_ch bit map to user */ + ts_map = ts_map << 1; + } + if (wan_test_bit(event->channel,&ts_map)){ + break; + } + chan = NULL; + } + } + if (chan == NULL){ + DEBUG_EVENT("%s: Failed to find channel device (channel=%d)!\n", + card->devname, event->channel); + return; + } +#if defined(__LINUX__) + new_skb=wan_skb_alloc(sizeof(api_rx_element_t)); + if (new_skb == NULL) return; + + rx_hdr=(api_rx_hdr_t*)wan_skb_put(new_skb,sizeof(api_rx_element_t)); + memset(rx_hdr,0,sizeof(api_rx_hdr_t)); + + rx_hdr->error_flag = 0; + rx_hdr->event_type = WP_API_EVENT_RING_DETECT; + rx_hdr->wp_api_rx_hdr_event_channel = event->channel; + if (event->ring_mode == WAN_EVENT_RING_PRESENT){ + rx_hdr->wp_api_rx_hdr_event_ringdetect_state = WAN_EVENT_RING_PRESENT; + }else if (event->ring_mode == WAN_EVENT_RING_STOP){ + rx_hdr->wp_api_rx_hdr_event_ringdetect_state = WAN_EVENT_RING_STOP; + }else{ + DEBUG_EVENT("%s: Invalid Rind Detect mode (%d)!\n", + card->devname, event->ring_mode); + wan_skb_free(new_skb); + return ; + } + + new_skb->protocol = htons(PVC_PROT); + new_skb->mac.raw = new_skb->data; + new_skb->dev = chan->common.dev; + new_skb->pkt_type = WAN_PACKET_DATA; + + if (wan_api_rx(chan,new_skb) != 0){ + DEBUG_EVENT("%s: Failed to send up HOOK event!\n", + card->devname); + wan_skb_free(new_skb); + } +#else + DEBUG_EVENT("%s:%s: RXHOOK Event report is not supported!\n", + card->devname, chan->if_name); + new_skb = NULL; + rx_hdr = NULL; +#endif + return; +} +#endif + +#if 0 +static void wp_tdmv_api_chan_rx_tx(sdla_t *card, + private_area_t *chan, + unsigned char *rxdata, unsigned char *txdata) +{ +#if defined(__LINUX__) + unsigned char *buf; + + if (!card->u.aft.tdmv_api_rx){ + card->u.aft.tdmv_api_rx=wan_skb_alloc(card->u.aft.tdmv_mtu); + if (!card->u.aft.tdmv_api_rx){ + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //++chan->if_stats.rx_errors; + goto wp_tdmv_api_rx_tx_chan_skip_rx; + } + } + + if (wan_skb_len(card->u.aft.tdmv_api_rx) > (card->u.aft.tdmv_mtu-chan->mru)){ + /* CRITICAL ERROR: We cannot fit the all timeslots into this + * packet */ + WAN_NETIF_STATS_INC_RX_ERRORS(&chan->common); //++chan->if_stats.rx_errors; + goto wp_tdmv_api_rx_tx_chan_skip_rx; + } + + buf=wan_skb_put(card->u.aft.tdmv_api_rx, chan->mru); + memcpy(buf,rxdata,chan->mru); + WAN_NETIF_STATS_INC_RX_DROPPED(&chan->common); //++chan->if_stats.rx_dropped; + +wp_tdmv_api_rx_tx_chan_skip_rx: + + if (!card->u.aft.tdmv_api_tx){ + card->u.aft.tdmv_api_tx=wan_skb_dequeue(&card->u.aft.tdmv_api_tx_list); + if (!card->u.aft.tdmv_api_tx){ + /* No tx packet, send idle frames */ + WAN_NETIF_STATS_INC_TX_CARRIER_ERRORS(&chan->common); //++chan->if_stats.tx_carrier_errors; + memset(txdata,chan->idle_flag,chan->mtu); + return; + } + } + + if (wan_skb_len(card->u.aft.tdmv_api_tx) < chan->mtu){ + /* CRITICAL ERROR: + * The tx api packet must have info for all + * timeslots */ + memset(txdata,chan->idle_flag,chan->mtu); + WAN_NETIF_STATS_INC_TX_ERRORS(&chan->common); //++chan->if_stats.tx_errors; + return; + } + + buf=wan_skb_data(card->u.aft.tdmv_api_tx); + memcpy(txdata,buf,chan->mtu); + wan_skb_pull(card->u.aft.tdmv_api_tx,chan->mtu); + WAN_NETIF_STATS_INC_TX_DROPPED(&chan->common); //++chan->if_stats.tx_dropped; + +#endif + return; +} + +/*================================================ + * wp_tdmv_api_rx_tx + * + * + */ + +static void wp_tdmv_api_rx_tx (sdla_t *card, private_area_t *chan) +{ +#if defined(__LINUX__) + chan=(private_area_t*)wan_netif_priv(chan->common.dev); + + if (!card->u.aft.tdmv_api_rx){ + /* CRITICAL ERROR: + * There should be an rx api packet here */ + goto wp_tdmv_api_rx_tx_skip_rx; + } + + if (wan_skb_len(card->u.aft.tdmv_api_rx) != card->u.aft.tdmv_mtu){ + wan_skb_free(card->u.aft.tdmv_api_rx); + card->u.aft.tdmv_api_rx=NULL; + goto wp_tdmv_api_rx_tx_skip_rx; + } + + if (wan_skb_headroom(card->u.aft.tdmv_api_rx) >= sizeof(api_rx_hdr_t)){ + api_rx_hdr_t *rx_hdr= + (api_rx_hdr_t*)skb_push(card->u.aft.tdmv_api_rx, + sizeof(api_rx_hdr_t)); + memset(rx_hdr,0,sizeof(api_rx_hdr_t)); + }else{ + wan_skb_free(card->u.aft.tdmv_api_rx); + card->u.aft.tdmv_api_rx=NULL; + goto wp_tdmv_api_rx_tx_skip_rx; + } + + card->u.aft.tdmv_api_rx->protocol = htons(PVC_PROT); + card->u.aft.tdmv_api_rx->mac.raw = card->u.aft.tdmv_api_rx->data; + card->u.aft.tdmv_api_rx->dev = chan->common.dev; + card->u.aft.tdmv_api_rx->pkt_type = WAN_PACKET_DATA; + + if (wan_api_rx(chan,card->u.aft.tdmv_api_rx) != 0){ + wan_skb_free(card->u.aft.tdmv_api_rx); + } + + card->u.aft.tdmv_api_rx=NULL; + +wp_tdmv_api_rx_tx_skip_rx: + + if (card->u.aft.tdmv_api_tx){ + + if (wan_skb_len(card->u.aft.tdmv_api_tx) != 0){ + /*CRITICAL ERROR: + * Length must be zero, because we pulled + * all timeslots out*/ + } + + wan_skb_free(card->u.aft.tdmv_api_tx); + card->u.aft.tdmv_api_tx=NULL; + + if (WAN_NETIF_QUEUE_STOPPED(chan->common.dev)){ + WAN_NETIF_WAKE_QUEUE(chan->common.dev); + wan_wakeup_api(chan); + } + } +#endif + return; +} +#endif + +#if defined(__LINUX__) +/*============================================= + * aft_set_ss7_force_rx + * + * Force the firmware to pass up a single + * ss7 packet. Otherwise, the ss7 engine + * will wait for the next different packet. + */ +static void aft_set_ss7_force_rx(sdla_t *card, private_area_t *chan) +{ + u32 reg, dma_ram_desc; + + if (wan_test_and_set_bit(0,&chan->ss7_force_rx)){ + DEBUG_TEST("%s: FORCE BUSY RX\n",card->devname); + return; + } + + dma_ram_desc=chan->logic_ch_num*4+AFT_PORT_REG(card,AFT_DMA_CHAIN_RAM_BASE_REG); + card->hw_iface.bus_read_4(card->hw,dma_ram_desc,®); + if (wan_test_bit(AFT_DMACHAIN_SS7_FORCE_RX,®)){ + wan_clear_bit(AFT_DMACHAIN_SS7_FORCE_RX,®); + }else{ + wan_set_bit(AFT_DMACHAIN_SS7_FORCE_RX,®); + } + card->hw_iface.bus_write_4(card->hw,dma_ram_desc,reg); + + DEBUG_TEST("%s: FORCE RX\n",card->devname); +} +#endif + +/*============================================= + * aft_clear_ss7_force_rx + * + * Reset the ss7 force rx logic. + * This must be done before trying to enable + * force rx again. + * Note: That first_time_slot must be cleared LAST. + * Thus the reverse clear order. + */ +static void aft_clear_ss7_force_rx(sdla_t *card, private_area_t *chan) +{ + wan_clear_bit(0,&chan->ss7_force_rx); +} + + +#if defined(AFT_API_SUPPORT) || defined(AFT_TDM_API_SUPPORT) +static int aft_event_ctrl(void *chan_ptr, wan_event_ctrl_t *p_event) +{ + sdla_t *card = NULL; + private_area_t *chan = (private_area_t *)chan_ptr; + wan_event_ctrl_t *event_ctrl; + int err = -EINVAL; + + card = chan->card; + event_ctrl = wan_malloc(sizeof(wan_event_ctrl_t)); + if (event_ctrl == NULL){ + DEBUG_EVENT("%s: Failed to allocate event control!\n", + card->devname); + return -EFAULT; + } + memset(event_ctrl, 0, sizeof(wan_event_ctrl_t)); + memcpy(event_ctrl, p_event, sizeof(wan_event_ctrl_t)); + + if (event_ctrl->type == WAN_EVENT_EC_DTMF && card->wandev.ec_dev){ +#if defined(CONFIG_WANPIPE_HWEC) + DEBUG_TEST("%s: Event control request EC_DTMF...\n", + chan->if_name); + err = wanpipe_ec_event_ctrl(card->wandev.ec_dev, card, event_ctrl); +#endif + }else if (chan->card->wandev.fe_iface.event_ctrl){ + + DEBUG_TEST("%s: FE Event control request...\n", + chan->if_name); + err = chan->card->wandev.fe_iface.event_ctrl( + &chan->card->fe, event_ctrl); + }else{ + DEBUG_TEST("%s: Unsupported event control request (%lX)\n", + chan->if_name, event_ctrl->type); + } + if (err){ + if (event_ctrl) wan_free(event_ctrl); + } + return err; +} +#endif + +#ifdef AFT_TDM_API_SUPPORT +static int aft_read_rbs_bits(void *chan_ptr, u32 ch, u8 *rbs_bits) +{ + private_area_t *chan = (private_area_t *)chan_ptr; + wan_smp_flag_t flags; + + if (!chan_ptr){ + return -EINVAL; + } + + chan->card->hw_iface.hw_lock(chan->card->hw,&flags); + *rbs_bits = chan->card->wandev.fe_iface.read_rbsbits( + &chan->card->fe, + chan->logic_ch_num+1, + WAN_TE_RBS_UPDATE); + chan->card->hw_iface.hw_unlock(chan->card->hw,&flags); + + return 0; + +} + +static int aft_write_rbs_bits(void *chan_ptr, u32 ch, u8 rbs_bits) +{ + private_area_t *chan = (private_area_t *)chan_ptr; + wan_smp_flag_t flags; + int err; + + if (!chan_ptr){ + return -EINVAL; + } + + chan->card->hw_iface.hw_lock(chan->card->hw,&flags); + err = chan->card->wandev.fe_iface.set_rbsbits(&chan->card->fe, + chan->logic_ch_num+1, + rbs_bits); + chan->card->hw_iface.hw_unlock(chan->card->hw,&flags); + + return err; +} + + +static int aft_write_hdlc_frame(void *chan_ptr, netskb_t *skb) +{ + private_area_t *chan = (private_area_t *)chan_ptr; + sdla_t *card=chan->card; + wan_smp_flag_t smp_flags; + int err=-EINVAL; + + if (!chan_ptr || !chan->common.dev || !card){ + WAN_ASSERT(1); + return -EINVAL; + } + + if (wan_skb_len(skb) > chan->mtu) { + return -EINVAL; + } + + + + if(IS_BRI_CARD(card)){ + if(chan->dchan_time_slot >= 0){ + /* NOTE: BRI dchan tx has to be done inside IRQ lock. + It allows to synchronize access to SPI on the card. + */ + card->hw_iface.hw_lock(card->hw,&smp_flags); + err=aft_bri_dchan_transmit(card, chan, + wan_skb_data(skb), + wan_skb_len(skb)); + card->hw_iface.hw_unlock(card->hw,&smp_flags); + if (err == 0) { + wan_skb_free(skb); + err = 0; + } else { + err = -EBUSY; + } + } else { + /* On b-channel data is transmitted using AFT DMA. */ + DEBUG_EVENT("%s: Error: BRI TX on non-dchanel!!\n", card->devname); + wan_skb_free(skb); + err = 0; + } + + return err; + } + + wan_spin_lock_irq(&card->wandev.lock, &smp_flags); + + if (wan_skb_queue_len(&chan->wp_tx_pending_list) > chan->max_tx_bufs){ + aft_dma_tx(card,chan); + wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + return -EBUSY; + } + + wan_skb_unlink(skb); + wan_skb_queue_tail(&chan->wp_tx_pending_list,skb); + aft_dma_tx(card,chan); + + + err=0; + wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + + + + return err; +} +#endif + + +static int aft_tdm_ring_rsync(sdla_t *card) +{ + int i; + private_area_t *chan; + for (i=0; iu.aft.num_of_time_slots;i++){ + + if (!wan_test_bit(i,&card->u.aft.tdm_logic_ch_map)){ + continue; + } + + chan=(private_area_t*)card->u.aft.dev_to_ch_map[i]; + if (!chan){ + DEBUG_EVENT("%s: Error: No Dev for Rx logical ch=%d\n", + card->devname,i); + continue; + } + + if (chan->channelized_cfg && !chan->hdlc_eng && chan->cfg.tdmv_master_if){ + + u32 lo_reg; + u32 dma_descr=(chan->logic_ch_num<<4) + + AFT_PORT_REG(card,AFT_RX_DMA_LO_DESCR_BASE_REG); + + card->hw_iface.bus_read_4(card->hw,dma_descr,&lo_reg); + + lo_reg=(lo_reg&AFT_TDMV_BUF_MASK)/AFT_TDMV_CIRC_BUF; + + if (card->wandev.ec_enable){ + /* HW EC standard */ + if (lo_reg > 0) { + card->u.aft.tdm_rx_dma_toggle = lo_reg-1; + } else { + card->u.aft.tdm_rx_dma_toggle = 3; + } + } else { + /* Software ec moves spike to 8bytes */ + card->u.aft.tdm_rx_dma_toggle=lo_reg+1; + if (card->u.aft.tdm_rx_dma_toggle > 3) { + card->u.aft.tdm_rx_dma_toggle=0; + } + } + + if (lo_reg < 3) { + card->u.aft.tdm_tx_dma_toggle = lo_reg+1; + } else { + card->u.aft.tdm_tx_dma_toggle = 0; + } + + DEBUG_EVENT("%s: Card TDM Rsync Rx=%i Tx=%i\n", + card->devname, + card->u.aft.tdm_rx_dma_toggle, + card->u.aft.tdm_tx_dma_toggle); + } + } + + return 0; +} + +static void aft_critical_shutdown (sdla_t *card) +{ + DEBUG_EVENT("%s: Error: Card Critically Shutdown!\n", + card->devname); + + if (card->wandev.fe_iface.pre_release){ + card->wandev.fe_iface.pre_release(&card->fe); + } + if (card->wandev.fe_iface.unconfig){ + card->wandev.fe_iface.unconfig(&card->fe); + } + disable_data_error_intr(card,DEVICE_DOWN); + wan_set_bit(CARD_DOWN,&card->wandev.critical); + port_set_state(card,WAN_DISCONNECTED); + + aft_hwdev[card->wandev.card_type].aft_led_ctrl(card, WAN_AFT_RED, 0,WAN_AFT_ON); + aft_hwdev[card->wandev.card_type].aft_led_ctrl(card, WAN_AFT_GREEN, 0, WAN_AFT_OFF); +} + +static int aft_hwec_config (sdla_t *card, private_area_t *chan, wanif_conf_t *conf, int ctrl) +{ + int err = 0; + unsigned int channel=0; + unsigned int tdmv_hwec_option=0; + + if (conf) { + tdmv_hwec_option=conf->hwec.enable; + } + + if (chan->common.usedby == TDM_VOICE_API || + chan->common.usedby == TDM_VOICE){ + + if (IS_TE1_CARD(card)) { + if (IS_T1_CARD(card)){ + channel = chan->first_time_slot; + }else{ + channel = chan->first_time_slot; + } + } else { + channel = chan->first_time_slot; + } + +#if defined(CONFIG_WANPIPE_HWEC) + if (ctrl == 0 && card->wandev.ec_enable){ + card->wandev.ec_enable(card, 0, channel); + + } else if (tdmv_hwec_option && card->wandev.ec_enable){ + DEBUG_HWEC("%s: HW echo canceller Enabled on channel %d\n", + chan->if_name, + channel); + err = card->wandev.ec_enable(card, 1, channel); + if (err) { + DEBUG_EVENT("%s: Failed to enable HWEC on channel %d\n", + chan->if_name,channel); + return err; + } + } +#endif + } + + return err; +} + + +#if defined(AFT_RTP_SUPPORT) +enum { + WAN_TDM_RTP_NO_CHANGE, + WAN_TDM_RTP_CALL_START, + WAN_TDM_RTP_CALL_STOP +}; + +static void aft_rtp_unconfig(sdla_t *card) +{ + wan_rtp_chan_t *rtp_chan; + int i; + + card->wandev.rtp_len=0; + + card->rtp_conf.rtp_ip=0; + card->rtp_conf.rtp_sample=0; + + if (card->wandev.rtp_dev) { + dev_put(card->wandev.rtp_dev); + card->wandev.rtp_dev=NULL; + } + + for (i=0;i<32;i++) { + rtp_chan=&card->wandev.rtp_chan[i]; + if (rtp_chan->rx_skb) { + wan_skb_free(rtp_chan->rx_skb); + rtp_chan->rx_skb=NULL; + } + if (rtp_chan->tx_skb) { + wan_skb_free(rtp_chan->tx_skb); + rtp_chan->rx_skb=NULL; + } + } + +} +#endif + + +#if defined(AFT_RTP_SUPPORT) +static int aft_rtp_config(sdla_t *card) +{ + netdevice_t *dev; + card->wandev.rtp_tap=NULL; + + if (!card->rtp_conf.rtp_ip || !card->rtp_conf.rtp_sample) { + return 1; + } + + if (card->rtp_conf.rtp_sample < 10 || card->rtp_conf.rtp_sample > 150) { + DEBUG_EVENT("%s: Error: Invalid RTP Sample %d [Min=10 Max=150ms]\n", + card->devname,card->rtp_conf.rtp_sample); + goto aft_rtp_init_exit; + } + + DEBUG_EVENT("%s: RTP TAP [ %d.%d.%d.%d:%d %dms %s %02X:%02X:%02X:%02X:%02X:%02X ]\n", + card->devname, + NIPQUAD(card->rtp_conf.rtp_ip), + card->rtp_conf.rtp_port, + card->rtp_conf.rtp_sample, + card->rtp_conf.rtp_devname, + card->rtp_conf.rtp_mac[0], + card->rtp_conf.rtp_mac[1], + card->rtp_conf.rtp_mac[2], + card->rtp_conf.rtp_mac[3], + card->rtp_conf.rtp_mac[4], + card->rtp_conf.rtp_mac[5]); + + card->wandev.rtp_len = (card->rtp_conf.rtp_sample * 8) + sizeof(wan_rtp_pkt_t); + + if ((card->wandev.rtp_dev=dev_get_by_name(card->rtp_conf.rtp_devname)) == NULL){ + DEBUG_EVENT("%s: Failed to open rtp tx device %s\n", + card->devname, + card->rtp_conf.rtp_devname); + goto aft_rtp_init_exit; + } + + dev=(netdevice_t*)card->wandev.rtp_dev; + + memcpy(card->rtp_conf.rtp_local_mac,dev->dev_addr,dev->addr_len); + card->rtp_conf.rtp_local_ip=wan_get_ip_address(card->wandev.rtp_dev,WAN_LOCAL_IP); + if (card->rtp_conf.rtp_local_ip == 0) { + goto aft_rtp_init_exit; + } + + card->wandev.rtp_tap=&aft_rtp_tap; + + memset(card->wandev.rtp_chan,0,sizeof(card->wandev.rtp_chan)); + + return 0; + +aft_rtp_init_exit: + + + aft_rtp_unconfig(card); + + DEBUG_EVENT("%s: Failed to configure rtp tap!\n",card->devname); + + return -1; + +} + + +static __inline void aft_rtp_tap_chan(sdla_t *card, u8 *data, u32 len, + netskb_t **skb_q, + u32 *timestamp, + u8 call_status, + u32 chan) +{ + wan_rtp_pkt_t *pkt; + u8 *buf; + netskb_t *skb; + u32 ts; + + if ((skb=*skb_q) == NULL) { + *skb_q=wan_skb_alloc(card->wandev.rtp_len+128); + if (!*skb_q) { + return; + } + skb=*skb_q; + pkt = (wan_rtp_pkt_t*)wan_skb_put(skb,sizeof(wan_rtp_pkt_t)); + memset(pkt,0,sizeof(wan_rtp_pkt_t)); + pkt->rtp_hdr.version=2; + if (IS_T1_CARD(card)) { + pkt->rtp_hdr.pt=0; + } else { + pkt->rtp_hdr.pt=1; + } + DEBUG_TEST("%s: RTP(%d) SKB Allocated Len=%i \n", + card->devname,chan,card->wandev.rtp_len); + } + + pkt = (wan_rtp_pkt_t*)wan_skb_data(skb); + + if (call_status == WAN_TDM_RTP_CALL_START) { + pkt->rtp_hdr.seq=0; + pkt->rtp_hdr.ts=0; + *timestamp=0; + } + + buf=wan_skb_put(skb,len); + memcpy(buf,data,len); + + ts=htonl(pkt->rtp_hdr.ts); + ts+=len; + pkt->rtp_hdr.ts = htonl(ts); + + if (wan_skb_len(skb) >= card->wandev.rtp_len || + call_status==WAN_TDM_RTP_CALL_STOP) { + netskb_t *nskb; + u16 seq; + + pkt->rtp_hdr.ts = *timestamp; + + wan_ip_udp_setup(card, + &card->rtp_conf, + chan, + wan_skb_data(skb), + wan_skb_len(skb)-sizeof(wan_rtp_pkt_t)); + + + nskb=wan_skb_clone(skb); + if (nskb) { + nskb->next = nskb->prev = NULL; + nskb->dev = card->wandev.rtp_dev; + nskb->protocol = htons(ETH_P_802_2); + nskb->mac.raw = wan_skb_data(nskb); + nskb->nh.raw = wan_skb_data(nskb); + dev_queue_xmit(nskb); + DEBUG_TEST("%s: RTP(%d) SKB Tx on dev %s \n", + card->devname,chan,nskb->dev->name); + } + + wan_skb_trim(skb,sizeof(wan_rtp_pkt_t)); + + pkt = (wan_rtp_pkt_t*)wan_skb_data(skb); + + seq=htons(pkt->rtp_hdr.seq); + seq++; + pkt->rtp_hdr.seq=htons(seq); + + *timestamp = htonl(ts); + DEBUG_TEST("Chan=%i Seq=%i TS=%i\n",chan,seq,ts); + pkt->rtp_hdr.ts = htonl(ts); + } +} + +static void aft_rtp_tap(void *card_ptr, u8 chan, u8* rx, u8* tx, u32 len) +{ + sdla_t *card = (sdla_t *)card_ptr; + u8 call_status=WAN_TDM_RTP_NO_CHANGE; + wan_rtp_chan_t *rtp_chan; + u32 span; + + if (!card || !rx || !tx ) { + if (WAN_NET_RATELIMIT()) { + DEBUG_EVENT("%s: Internal Error: rtp tap invalid pointers chan %i\n", + __FUNCTION__,chan); + } + return; + } + + if (!card->rtp_conf.rtp_ip || + !card->rtp_conf.rtp_sample || + !card->wandev.rtp_len || + !card->wandev.rtp_dev) { + if (WAN_NET_RATELIMIT()) { + DEBUG_EVENT("%s: RTP Tap Not configured %i\n", + card->devname,chan); + } + return; + } + + if (chan >= 32) { + if (WAN_NET_RATELIMIT()) { + DEBUG_EVENT("%s: Internal Error: rtp tap chan out of range %i\n", + card->devname,chan); + } + return; + } + + span = card->tdmv_conf.span_no-1; + rtp_chan = &card->wandev.rtp_chan[chan]; + + if (wan_test_bit(chan,&card->wandev.rtp_tap_call_map)) { + if (!wan_test_and_set_bit(chan,&card->wandev.rtp_tap_call_status)) { + /* Start of the call */ + call_status=WAN_TDM_RTP_CALL_START; + DEBUG_TEST("%s: CALL Start on ch %i\n", + card->devname,chan); + } + } else { + if (!wan_test_bit(chan,&card->wandev.rtp_tap_call_status)) { + /* Call not up */ + return; + } + wan_clear_bit(chan,&card->wandev.rtp_tap_call_status); + call_status=WAN_TDM_RTP_CALL_STOP; + DEBUG_TEST("%s: CALL Stop on ch %i\n", + card->devname,chan); + } + + + aft_rtp_tap_chan(card, rx, len, &rtp_chan->rx_skb, &rtp_chan->rx_ts, + call_status, (span<<4|(chan+1))); + aft_rtp_tap_chan(card, tx, len, &rtp_chan->tx_skb, &rtp_chan->tx_ts, + call_status, (span<<4|(chan+1))+2000); + +} +#endif + +static int aft_find_master_if_and_dchan(sdla_t *card, int *master_if, u32 active_ch) +{ + int dchan_found=0; + int i; + + if (card->tdmv_conf.dchan) { + if (IS_E1_CARD(card) && !(WAN_FE_FRAME(&card->fe) == WAN_FR_UNFRAMED)) { + card->tdmv_conf.dchan = card->tdmv_conf.dchan << 1; + wan_clear_bit(0,&card->tdmv_conf.dchan); + } + } + + for (i=card->u.aft.num_of_time_slots-1;i>=0;i--){ + if (wan_test_bit(i,&active_ch)){ + + if (wan_test_bit(i,&card->tdmv_conf.dchan)){ + dchan_found=1; + card->u.aft.tdmv_dchan=i; + continue; + } + + /* Find the TOP timeslot. This timeslot will be + * considered MASTER since it is the last timeslot + * to rx data from the T1 line */ + if (*master_if < 0){ + *master_if=i; + } + } + } + + if (card->tdmv_conf.dchan && !dchan_found){ + /* We configured for dchan however, this interface + * was not configued with the DCHAN timeslot. + * It IS now possible that another interface has + * this time slot */ + for (i=card->u.aft.num_of_time_slots-1;i>=0;i--){ + if (wan_test_bit(i,&card->tdmv_conf.dchan)){ + dchan_found=1; + card->u.aft.tdmv_dchan=i; + wan_set_bit(i,&card->u.aft.tdmv_dchan_cfg_on_master); + continue; + } + } + + if (!dchan_found) { + DEBUG_EVENT("%s: Error: TDM DCHAN is out of range 0x%08X\n", + card->devname,card->tdmv_conf.dchan); + return -EINVAL; + } + + /* We have found a DCHAN outside the + Voice active channels */ + } + + return 0; +} + + +static int digital_loop_test(sdla_t* card,wan_udp_pkt_t* wan_udp_pkt) +{ + netskb_t* skb; + netdevice_t* dev; + char* buf; + private_area_t *chan; + + dev = WAN_DEVLE2DEV(WAN_LIST_FIRST(&card->wandev.dev_head)); + if (dev == NULL) { + return 1; + } + chan = wan_netif_priv(dev); + if (chan == NULL) { + return 1; + } + + if (chan->common.state != WAN_CONNECTED) { + DEBUG_EVENT("%s: Loop test failed: dev not connected!\n", + card->devname); + return 2; + } + + skb = wan_skb_alloc(wan_udp_pkt->wan_udp_data_len+100); + if (skb == NULL) { + return 3; + } + + switch (chan->common.usedby) { + + case API: + wan_skb_push(skb, sizeof(api_rx_hdr_t)); + break; + + case STACK: + case WANPIPE: + break; + + case TDM_VOICE: + case TDM_VOICE_API: + case TDM_VOICE_DCHAN: + if (card->u.aft.tdmv_dchan) { + break; + } else { + DEBUG_EVENT("%s: Loop test failed: no dchan in TDMV mode!\n", + card->devname); + } + /* Fall into the default case */ + + default: + DEBUG_EVENT("%s: Loop test failed: invalid operation mode!\n", + card->devname); + wan_skb_free(skb); + return 4; + } + + buf = wan_skb_put(skb, wan_udp_pkt->wan_udp_data_len); + memcpy(buf, wan_udp_pkt->wan_udp_data, wan_udp_pkt->wan_udp_data_len); + +#if defined(__LINUX__) + skb->next = skb->prev = NULL; + skb->dev = dev; + skb->protocol = htons(ETH_P_IP); + skb->mac.raw = wan_skb_data(skb); + dev_queue_xmit(skb); +#elif defined(__FreeBSD__) || defined(__OpenBSD__) +# warning "FIXME: Add code for digital loop test" +#endif + return 0; +} + + + +void wanpipe_wake_stack(private_area_t* chan) +{ + WAN_NETIF_WAKE_QUEUE(chan->common.dev); + if (chan->common.usedby == API){ + wan_wakeup_api(chan); + }else if (chan->common.usedby == STACK){ + wanpipe_lip_kick(chan,0); + }else if (chan->common.usedby == TDM_VOICE_DCHAN){ +#ifdef AFT_TDM_API_SUPPORT + if (is_tdm_api(chan,&chan->wp_tdm_api_dev)){ + wanpipe_tdm_api_kick(&chan->wp_tdm_api_dev); + } +#endif + } +} + +/****** End ****************************************************************/ diff --git a/patches/kdrivers/src/net/sdla_aft_te3.c b/patches/kdrivers/src/net/sdla_aft_te3.c index c946094..bdacf5c 100644 --- a/patches/kdrivers/src/net/sdla_aft_te3.c +++ b/patches/kdrivers/src/net/sdla_aft_te3.c @@ -43,7 +43,6 @@ #define DBGSTATS if(0)DEBUG_EVENT - /****** Defines & Macros ****************************************************/ /* Private critical flags */ @@ -107,7 +106,7 @@ enum { #define MAX_AFT_DMA_CHAINS 16 #define MAX_TX_BUF (MAX_AFT_DMA_CHAINS)+1 -#define MAX_RX_BUF ((MAX_AFT_DMA_CHAINS)*8)+1 +#define MAX_RX_BUF ((MAX_AFT_DMA_CHAINS)*4)+1 #define MAX_RX_SCHAIN_BUF (MAX_RX_BUF)*2 @@ -282,15 +281,11 @@ static int if_init (netdevice_t* dev); #endif static int if_open (netdevice_t* dev); static int if_close (netdevice_t* dev); -static int if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd); - - - -static struct net_device_stats* if_stats (netdevice_t* dev); +static int if_do_ioctl(netdevice_t*, struct ifreq*, wan_ioctl_cmd_t); #if defined(__LINUX__) static int if_send (netskb_t* skb, netdevice_t* dev); -static int if_change_mtu(netdevice_t *dev, int new_mtu); +static struct net_device_stats* if_stats (netdevice_t* dev); #else static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct rtentry *rt); #endif @@ -376,8 +371,8 @@ static void protocol_recv(sdla_t *card, private_area_t *chan, netskb_t *skb); static int aft_alloc_rx_dma_buff(sdla_t *card, private_area_t *chan, int num); static int aft_init_requeue_free_skb(private_area_t *chan, netskb_t *skb); -static int write_framer(void *pcard,unsigned short framer_off,unsigned short framer_data); -static unsigned int read_framer(void *pcard,unsigned short framer_off); +//static int write_framer(void *pcard,unsigned short framer_off,unsigned short framer_data); +//static unsigned int read_framer(void *pcard,unsigned short framer_off); #if 0 //FIXME to be taken out check with M.F. static void framer_reset(sdla_t *card); @@ -503,9 +498,6 @@ int wp_aft_te3_init (sdla_t* card, wandev_conf_t* conf) return -EINVAL; } -#if defined(WAN_DEBUG_MEM) - DEBUG_EVENT("%s: Total Mem %d\n",__FUNCTION__,wan_atomic_read(&wan_debug_mem)); -#endif if (card->adptr_subtype == AFT_SUBTYPE_SHARK) { DEBUG_EVENT("%s: Starting SHARK T3/E3 Adapter!\n", @@ -516,7 +508,7 @@ int wp_aft_te3_init (sdla_t* card, wandev_conf_t* conf) card->wandev.clocking = conf->clocking; card->wandev.ignore_front_end_status = conf->ignore_front_end_status; card->wandev.ttl = conf->ttl; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; card->wandev.comm_port = conf->comm_port; card->wandev.udp_port = conf->udp_port; card->wandev.new_if_cnt = 0; @@ -538,14 +530,16 @@ int wp_aft_te3_init (sdla_t* card, wandev_conf_t* conf) card->fe.write_fe_cpld = write_fe_cpld; // card->fe.read_cpld = read_cpld; - card->fe.write_framer = write_framer; - card->fe.read_framer = read_framer; + card->fe.write_fe_reg = card->hw_iface.fe_write; + card->fe.read_fe_reg = card->hw_iface.fe_read; + //card->fe.write_framer = write_framer; + //card->fe.read_framer = read_framer; // card->wandev.write_front_end_reg = write_front_end_reg; // card->wandev.read_front_end_reg = read_front_end_reg; card->wandev.fe_enable_timer = enable_timer; card->wandev.te_link_state = handle_front_end_state; -//ALEX conf->interface = +//ALEX conf->electrical_interface = // IS_T1_CARD(card) ? WANOPT_V35 : WANOPT_RS232; if (card->wandev.comm_port == WANOPT_PRI){ @@ -671,12 +665,12 @@ int wp_aft_te3_init (sdla_t* card, wandev_conf_t* conf) */ static int update (wan_device_t* wandev) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; netdevice_t* dev; volatile private_area_t* chan; /* sanity checks */ - if((wandev == NULL) || (wandev->private == NULL)) + if((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if(wandev->state == WAN_UNCONFIGURED) @@ -748,7 +742,7 @@ static int update (wan_device_t* wandev) */ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; private_area_t* chan; int err = 0; netskb_t *skb; @@ -776,9 +770,6 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) #ifdef AFT_T3_SINGLE_DMA_CHAIN chan->single_dma_chain=1; #endif - if (conf->single_tx_buf) { - chan->single_dma_chain=1; - } strncpy(chan->if_name, wan_netif_name(dev), WAN_IFNAME_SZ); @@ -932,10 +923,6 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) goto new_if_error; } - if (chan->dma_mtu/2 > aft_rx_copyback) { - aft_rx_copyback=chan->dma_mtu/2; - } - chan->dma_bufs=card->u.xilinx.cfg.dma_per_ch; if (chan->single_dma_chain){ chan->dma_bufs=MAX_RX_SCHAIN_BUF; @@ -1017,7 +1004,6 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) wan_netif_set_priv(dev,chan); #if defined(__LINUX__) dev->init = &if_init; - # ifdef WANPIPE_GENERIC if_init(dev); # endif @@ -1027,9 +1013,7 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) chan->common.iface.close = &if_close; chan->common.iface.output = &if_send; chan->common.iface.ioctl = &if_do_ioctl; - chan->common.iface.get_stats = &if_stats; chan->common.iface.tx_timeout = &if_tx_timeout; - if (wan_iface.attach){ if (!ifunit(wan_netif_name(dev))){ wan_iface.attach(dev, NULL, chan->common.is_netdev); @@ -1202,7 +1186,6 @@ static int if_init (netdevice_t* dev) dev->watchdog_timeo = 2*HZ; #endif dev->do_ioctl = if_do_ioctl; - dev->change_mtu = if_change_mtu; if (chan->common.usedby == BRIDGE || chan->common.usedby == BRIDGE_NODE){ @@ -1225,6 +1208,8 @@ static int if_init (netdevice_t* dev) dev->type = ARPHRD_PPP; dev->mtu = card->wandev.mtu; dev->hard_header_len = 16; + dev->hard_header = NULL; + dev->rebuild_header = NULL; dev->addr_len = 0; } @@ -1300,6 +1285,7 @@ static int if_open (netdevice_t* dev) WAN_NETIF_STOP_QUEUE(dev); WAN_NETIF_CARRIER_OFF(dev); + /* If FRONT End is down, it means that the DMA * is disabled. In this case don't try to * reset fifo. Let the enable_data_error_intr() @@ -1518,7 +1504,9 @@ static void if_tx_timeout (netdevice_t *dev) xilinx_tx_fifo_under_recover(card,chan); wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); - aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); + if (!chan->single_dma_chain){ + aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); + } } @@ -1676,6 +1664,7 @@ if_send_exit_crit: } +#if defined(__LINUX__) /*============================================================================ * if_stats * @@ -1728,34 +1717,6 @@ static struct net_device_stats* if_stats (netdevice_t* dev) return &chan->if_stats; } - -#if defined(__LINUX__) -static int if_change_mtu(netdevice_t *dev, int new_mtu) -{ - private_area_t* chan= (private_area_t*)wan_netif_priv(dev); - - if (!chan){ - return -ENODEV; - } - - if (!chan->hdlc_eng) { - return -EINVAL; - } - - if (chan->common.usedby == API){ - new_mtu+=sizeof(api_tx_hdr_t); - }else if (chan->common.usedby == STACK){ - new_mtu+=32; - } - - if (new_mtu > chan->dma_mtu) { - return -EINVAL; - } - - dev->mtu = new_mtu; - - return 0; -} #endif /*======================================================================== @@ -1777,7 +1738,8 @@ static int if_change_mtu(netdevice_t *dev, int new_mtu) * wanpipemon debugger * */ -static int if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) +static int +if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, wan_ioctl_cmd_t cmd) { private_area_t* chan= (private_area_t*)wan_netif_priv(dev); sdla_t *card; @@ -1897,8 +1859,8 @@ static int if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) default: #ifndef WANPIPE_GENERIC - DEBUG_EVENT("%s: Command %x not supported!\n", - card->devname,cmd); + DEBUG_IOCTL("%s: Command %x not supported!\n", + card->devname,cmd); return -EOPNOTSUPP; #else if (card->wandev.ioctl){ @@ -2219,58 +2181,6 @@ static void xilinx_dma_rx_complete (sdla_t *card, private_area_t *chan, int wtd) aft_rx_dma_chain_handler(chan,wtd,0); } - -static int aft_check_pci_errors(sdla_t *card, private_area_t *chan, wp_rx_element_t *rx_el) -{ - int pci_err=0; - if (rx_el->reg&RxDMA_HI_DMA_PCI_ERROR_MASK){ - - if (rx_el->reg & RxDMA_HI_DMA_PCI_ERROR_M_ABRT){ - if (WAN_NET_RATELIMIT()) { - DEBUG_EVENT("%s:%s: Rx Error: Abort from Master: pci fatal error!\n", - card->devname,chan->if_name); - } - pci_err=1; - } - if (rx_el->reg & RxDMA_HI_DMA_PCI_ERROR_T_ABRT){ - if (WAN_NET_RATELIMIT()) { - DEBUG_EVENT("%s:%s: Rx Error: Abort from Target: pci fatal error!\n", - card->devname,chan->if_name); - } - pci_err=1; - } - if (rx_el->reg & RxDMA_HI_DMA_PCI_ERROR_DS_TOUT){ - if (WAN_NET_RATELIMIT()) { - DEBUG_EVENT("%s:%s: Rx Error: No 'DeviceSelect' from target: pci fatal error!\n", - card->devname,chan->if_name); - } - pci_err=1; - } - if (rx_el->reg & RxDMA_HI_DMA_PCI_ERROR_RETRY_TOUT){ - if (WAN_NET_RATELIMIT()) { - DEBUG_EVENT("%s:%s: Rx Error: 'Retry' exceeds maximum (64k): pci fatal error!\n", - card->devname,chan->if_name); - } - pci_err=1; - } - - if (!pci_err) { - if (WAN_NET_RATELIMIT()) { - DEBUG_EVENT("%s: RXDMA Unknown PCI ERROR = 0x%x\n",chan->if_name,rx_el->reg); - } - } - - - return -1; - } - - - - return 0; -} - - - /*=============================================== * xilinx_rx_post_complete * @@ -2304,17 +2214,34 @@ static void xilinx_rx_post_complete (sdla_t *card, private_area_t *chan, /* Checking Rx DMA Go bit. Has to be '0' */ if (wan_test_bit(RxDMA_HI_DMA_GO_READY_BIT,&rx_el->reg)){ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s:%s: Error: RxDMA Intr: GO bit set on Rx intr\n", + DEBUG_TEST("%s:%s: Error: RxDMA Intr: GO bit set on Rx intr\n", card->devname,chan->if_name); - } chan->if_stats.rx_errors++; chan->errstats.Rx_dma_descr_err++; goto rx_comp_error; } /* Checking Rx DMA PCI error status. Has to be '0's */ - if (aft_check_pci_errors(card,chan,rx_el) != 0) { + if (rx_el->reg&RxDMA_HI_DMA_PCI_ERROR_MASK){ + + if (rx_el->reg & RxDMA_HI_DMA_PCI_ERROR_M_ABRT){ + DEBUG_EVENT("%s:%s: Rx Error: Abort from Master: pci fatal error!\n", + card->devname,chan->if_name); + } + if (rx_el->reg & RxDMA_HI_DMA_PCI_ERROR_T_ABRT){ + DEBUG_EVENT("%s:%s: Rx Error: Abort from Target: pci fatal error!\n", + card->devname,chan->if_name); + } + if (rx_el->reg & RxDMA_HI_DMA_PCI_ERROR_DS_TOUT){ + DEBUG_EVENT("%s:%s: Rx Error: No 'DeviceSelect' from target: pci fatal error!\n", + card->devname,chan->if_name); + } + if (rx_el->reg & RxDMA_HI_DMA_PCI_ERROR_RETRY_TOUT){ + DEBUG_EVENT("%s:%s: Rx Error: 'Retry' exceeds maximum (64k): pci fatal error!\n", + card->devname,chan->if_name); + } + + DEBUG_EVENT("%s: RXDMA PCI ERROR = 0x%x\n",chan->if_name,rx_el->reg); chan->errstats.Rx_pci_errors++; chan->if_stats.rx_errors++; goto rx_comp_error; @@ -2519,11 +2446,10 @@ static void wp_bh (unsigned long data) static void wp_bh (void* data, int dummy) #endif { - private_area_t* chan = (private_area_t *)data; - netskb_t *new_skb,*skb; - unsigned char pkt_error; - unsigned long timeout=SYSTEM_TICKS; - int len; + private_area_t *chan = (private_area_t *)data; + netskb_t *new_skb,*skb; + unsigned char pkt_error; + wan_ticks_t timeout=SYSTEM_TICKS; DEBUG_TEST("%s: ------------ BEGIN --------------: %lu\n", __FUNCTION__,SYSTEM_TICKS); @@ -2541,12 +2467,24 @@ static void wp_bh (void* data, int dummy) #if 0 chan->if_stats.rx_errors++; #endif + + if (SYSTEM_TICKS-timeout > 3){ + chan->if_stats.rx_errors++; +#if 0 + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: BH Squeeze!\n",chan->if_name); + } +#endif + wan_skb_queue_head(&chan->wp_rx_complete_list,skb); + break; + } if (chan->common.usedby == API && chan->common.sk == NULL){ DEBUG_TEST("%s: No sock bound to channel rx dropping!\n", chan->if_name); chan->if_stats.rx_dropped++; aft_init_requeue_free_skb(chan, skb); + continue; } @@ -2617,7 +2555,7 @@ static void wp_bh (void* data, int dummy) wan_skb_free(new_skb); continue; } - + }else{ protocol_recv(chan->card,chan,new_skb); } @@ -2629,10 +2567,10 @@ static void wp_bh (void* data, int dummy) } if (SYSTEM_TICKS-timeout > 3){ - //chan->if_stats.rx_errors++; + chan->if_stats.rx_errors++; #if 0 if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: BH Squeeze! %li\n", + DEBUG_EVENT("%s: BH Squeeze! %i\n", chan->if_name,SYSTEM_TICKS-timeout); } #endif @@ -2647,7 +2585,9 @@ static void wp_bh (void* data, int dummy) WAN_TASKLET_END((&chan->common.bh_task)); - +#if 1 + { + int len; if ((len=wan_skb_queue_len(&chan->wp_rx_complete_list))){ DEBUG_TEST("%s: Triggering from bh rx=%i\n",chan->if_name,len); WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); @@ -2655,9 +2595,12 @@ static void wp_bh (void* data, int dummy) DEBUG_TEST("%s: Triggering from bh tx=%i\n",chan->if_name,len); WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); } + } +#endif DEBUG_TEST("%s: ------------ END -----------------: %lu\n", __FUNCTION__,SYSTEM_TICKS); + return; } @@ -2680,6 +2623,9 @@ static int fifo_error_interrupt(sdla_t *card, u32 reg, u32 tx_status, u32 rx_sta card->devname); return 0; } + + DEBUG_TEST("%s: RX FIFO=0x%08X TX FIFO=0x%08X\n", + card->devname,rx_status,tx_status); if (IS_TE3(&card->fe.fe_cfg)){ num_of_logic_ch=1; @@ -2938,7 +2884,6 @@ static WAN_IRQ_RETVAL wp_aft_te3_isr (sdla_t* card) XILINX_DMA_RX_INTR_PENDING_REG, &dma_rx_reg); - DEBUG_TEST("%s: DMA_RX_INTR_REG(0x%X) = 0x%X ActCH=0x%lX\n", card->devname, XILINX_DMA_RX_INTR_PENDING_REG,dma_rx_reg, @@ -3056,7 +3001,10 @@ isr_skb_tx: DEBUG_TEST("%s: Skipping Rx WTD Flags=%d\n", chan->if_name,wan_test_bit(0,&chan->up)); } - aft_enable_rx_watchdog(card,AFT_MAX_WTD_TIMEOUT); + aft_reset_rx_watchdog(card); + if (!chan->single_dma_chain){ + aft_enable_rx_watchdog(card,AFT_MAX_WTD_TIMEOUT); + } } DEBUG_TEST("%s: Rx WatchDog Expired %p!\n", @@ -3275,7 +3223,7 @@ static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, wan_udp_pkt->wan_udp_data_len = sizeof(unsigned long); wan_udp_pkt->wan_udp_return_code = 0; break; - + case READ_OPERATIONAL_STATS: wan_udp_pkt->wan_udp_return_code = 0; memcpy(wan_udp_pkt->wan_udp_data,&chan->opstats,sizeof(aft_op_stats_t)); @@ -3346,45 +3294,6 @@ static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, } break; } /* end of switch */ - -#if 0 - case READ_OPERATIONAL_STATS: - wan_udp_pkt->wan_udp_return_code = 0; - memcpy(wan_udp_pkt->wan_udp_data,&chan->opstats,sizeof(aft_op_stats_t)); - wan_udp_pkt->wan_udp_data_len=sizeof(aft_op_stats_t); - break; - - case FLUSH_OPERATIONAL_STATS: - wan_udp_pkt->wan_udp_return_code = 0; - memset(&chan->opstats,0,sizeof(aft_op_stats_t)); - wan_udp_pkt->wan_udp_data_len=0; - break; - - case READ_COMMS_ERROR_STATS: - wan_udp_pkt->wan_udp_return_code = 0; - memcpy(wan_udp_pkt->wan_udp_data,&chan->errstats,sizeof(aft_comm_err_stats_t)); - wan_udp_pkt->wan_udp_data_len=sizeof(aft_comm_err_stats_t); - break; - - case FLUSH_COMMS_ERROR_STATS: - wan_udp_pkt->wan_udp_return_code = 0; - memset(&chan->errstats,0,sizeof(aft_comm_err_stats_t)); - wan_udp_pkt->wan_udp_data_len=0; - break; - - default: - wan_udp_pkt->wan_udp_data_len = 0; - wan_udp_pkt->wan_udp_return_code = 0xCD; - - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT( - "%s: Warning, Illegal UDP command attempted from network: %x\n", - card->devname,wan_udp_pkt->wan_udp_command); - } - break; - } /* end of switch */ -#endif - } /* end of else */ /* Fill UDP TTL */ @@ -3935,7 +3844,7 @@ static void enable_data_error_intr(sdla_t *card) card->hw_iface.bus_read_4(card->hw,XILINX_DMA_CONTROL_REG,®); - + aft_enable_rx_watchdog(card,AFT_RX_TIMEOUT); aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); @@ -4031,7 +3940,7 @@ static int update_comms_stats(sdla_t* card) /* TE1 Update T1/E1 alarms */ if (IS_TE3(&card->fe.fe_cfg)) { - WAN_FECALL(&card->wandev, read_alarm, (&card->fe, 0)); + WAN_FECALL(&card->wandev, read_alarm, (&card->fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE)); /* TE1 Update T1/E1 perfomance counters */ WAN_FECALL(&card->wandev, read_pmon, (&card->fe, 0)); } @@ -4075,7 +3984,9 @@ static void xilinx_tx_fifo_under_recover (sdla_t *card, private_area_t *chan) wanpipe_lip_kick(chan,0); } #endif - aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); + if (!chan->single_dma_chain){ + aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); + } } static int xilinx_write_ctrl_hdlc(sdla_t *card, u32 timeslot, u8 reg_off, u32 data) @@ -4317,7 +4228,7 @@ static int xilinx_t3_exar_chip_configure(sdla_t *card) card->hw_iface.bus_write_4(card->hw,XILINX_CHIP_CFG_REG,reg); - WP_DELAY(100); + WP_DELAY(10); /* Disable the chip/hdlc reset condition */ wan_clear_bit(CHIP_RESET_BIT,®); @@ -4384,8 +4295,6 @@ static int xilinx_t3_exar_chip_configure(sdla_t *card) DEBUG_CFG("--- T3 Exar Chip enable/config. -- \n"); card->hw_iface.bus_write_4(card->hw,XILINX_CHIP_CFG_REG,reg); - - WP_DELAY(100); xilinx_delay(1); #if 0 @@ -4557,6 +4466,15 @@ static int xilinx_t3_exar_dev_configure(sdla_t *card, private_area_t *chan) card->u.xilinx.dev_to_ch_map[0]=(void*)chan; } + /* Setup global DMA parameters */ + if (chan->single_dma_chain){ + card->hw_iface.bus_read_4(card->hw,XILINX_DMA_CONTROL_REG,®); + reg&=~DMA_CHAIN_TE3_MASK; + reg|=1&DMA_CHAIN_TE3_MASK; + card->hw_iface.bus_write_4(card->hw,XILINX_DMA_CONTROL_REG,reg); + } + + reg=0; if (chan->hdlc_eng){ @@ -4675,6 +4593,9 @@ static void xilinx_t3_exar_transparent_config(sdla_t *card,private_area_t *chan) } +#if 0 +/* Alex +** This functions are moved to sdladrv_fe.c */ #define BIT_DEV_ADDR_CLEAR 0x600 static int write_framer(void *pcard, unsigned short framer_off,unsigned short framer_data) @@ -4689,12 +4610,10 @@ static int write_framer(void *pcard, unsigned short framer_off,unsigned short fr card->hw_iface.bus_write_2(card->hw, 0x46, framer_off); - WP_DELAY(5); card->hw_iface.bus_write_2(card->hw, 0x44, framer_data); - WP_DELAY(5); return 0; } @@ -4709,18 +4628,17 @@ static unsigned int read_framer(void *pcard,unsigned short framer_off) card->hw_iface.bus_write_2(card->hw, 0x46, framer_off); - WP_DELAY(5); card->hw_iface.bus_read_4(card->hw, 0x44, &framer_data); - WP_DELAY(5); DEBUG_TEST("READ FRAMER OFFSET=0x%02X DATA=0x%02X\n", framer_off,framer_data); return framer_data; } +#endif #if 0 static void framer_reset(sdla_t *card) @@ -4909,7 +4827,7 @@ static int aft_dma_chain_tx(aft_dma_chain_t *dma_chain,private_area_t *chan, int wan_set_bit(TxDMA_HI_DMA_GO_READY_BIT,®); - DEBUG_TX("%s: TXDMA_HI=0x%X DmaDescr=0x%lX len=%i\n", + DEBUG_TEST("%s: TXDMA_HI=0x%X DmaDescr=0x%lX len=%i\n", __FUNCTION__,reg,dma_chain->dma_addr,len); card->hw_iface.bus_write_4(card->hw,dma_descr,reg); @@ -5077,6 +4995,24 @@ static int xilinx_dma_te3_tx (sdla_t *card,private_area_t *chan, netskb_t *skb) } } +#if 0 + if (0){ + netskb_t *nskb=__dev_alloc_skb(wan_skb_len(skb),GFP_DMA|GFP_ATOMIC); + if (!nskb) { + wan_skb_free(skb); + wan_clear_bit(0,&dma_chain->init); + chan->if_stats.tx_errors++; + return -EINVAL; + } else { + unsigned char *buf = wan_skb_put(nskb,wan_skb_len(skb)); + memcpy(buf,wan_skb_data(skb),wan_skb_len(skb)); + wan_skb_free(skb); + skb=nskb; + } + } +#endif + + dma_chain->skb=skb; dma_chain->dma_addr = @@ -5136,7 +5072,7 @@ static int xilinx_dma_te3_tx (sdla_t *card,private_area_t *chan, netskb_t *skb) if (!wan_test_bit(TX_INTR_PENDING,&chan->dma_chain_status)){ aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); } - } + } wan_clear_bit(TX_DMA_BUSY,&chan->dma_status); @@ -5177,7 +5113,7 @@ static int aft_dma_chain_rx(aft_dma_chain_t *dma_chain, private_area_t *chan, in card->hw_iface.bus_write_4(card->hw,dma_descr,reg); - dma_descr= (u32)(dma_ch_indx<<4) + XILINX_RxDMA_DESCRIPTOR_HI; + dma_descr=(unsigned long)(dma_ch_indx<<4) + XILINX_RxDMA_DESCRIPTOR_HI; reg =0; @@ -5210,7 +5146,7 @@ static int aft_dma_chain_rx(aft_dma_chain_t *dma_chain, private_area_t *chan, in wan_set_bit(RxDMA_HI_DMA_GO_READY_BIT,®); - DEBUG_RX("%s: RXDMA_HI = 0x%X, BusAddr=0x%X DmaDescr=0x%X\n", + DEBUG_TEST("%s: RXDMA_HI = 0x%X, BusAddr=0x%X DmaDescr=0x%X\n", __FUNCTION__,reg,dma_chain->dma_addr,dma_descr); card->hw_iface.bus_write_4(card->hw,dma_descr,reg); @@ -5392,8 +5328,6 @@ static void aft_rx_dma_chain_handler(private_area_t *chan, int wtd, int reset) chan->if_name,__FUNCTION__); return; } - - aft_reset_rx_watchdog(card); if (!wtd){ /* Not watchdog, thus called from an interrupt. @@ -5462,26 +5396,17 @@ static void aft_rx_dma_chain_handler(private_area_t *chan, int wtd, int reset) dma_descr=(dma_chain->index<<4) + XILINX_RxDMA_DESCRIPTOR_HI; card->hw_iface.bus_read_4(card->hw,dma_descr, &rx_el->reg); - if (aft_check_pci_errors(card,chan,rx_el) != 0) { - chan->errstats.Rx_pci_errors++; - chan->if_stats.rx_errors++; - wan_skb_pull(dma_chain->skb, sizeof(wp_rx_element_t)); - aft_init_requeue_free_skb(chan, dma_chain->skb); - dma_chain->skb=NULL; - } else { + rx_el->pkt_error= dma_chain->pkt_error; + rx_el->dma_addr = dma_chain->dma_addr; - rx_el->pkt_error= dma_chain->pkt_error; - rx_el->dma_addr = dma_chain->dma_addr; + wan_skb_queue_tail(&chan->wp_rx_complete_list,dma_chain->skb); - wan_skb_queue_tail(&chan->wp_rx_complete_list,dma_chain->skb); - - DEBUG_RX("%s: RxInr Pending chain %i Rxlist=%i LO:0x%X HI:0x%X Data=0x%X Len=%i!\n", + DEBUG_RX("%s: RxInr Pending chain %i Rxlist=%i LO:0x%X HI:0x%X Data=0x%X Len=%i!\n", chan->if_name,dma_chain->index, wan_skb_queue_len(&chan->wp_rx_complete_list), rx_el->align,rx_el->reg, (*(unsigned char*)wan_skb_data(dma_chain->skb)), wan_skb_len(dma_chain->skb)); - } dma_chain->skb=NULL; dma_chain->dma_addr=0; @@ -5503,32 +5428,27 @@ static void aft_rx_dma_chain_handler(private_area_t *chan, int wtd, int reset) if (reset){ goto reset_skip_rx_setup; } - - if (!wtd) { - /* Only reload dma on interrupt */ - xilinx_dma_rx(card,chan,cur_dma_ptr); - } + + xilinx_dma_rx(card,chan,cur_dma_ptr); if (wan_skb_queue_len(&chan->wp_rx_complete_list)){ DEBUG_TEST("%s: Rx Queued list triggering\n",chan->if_name); WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); chan->rx_no_data_cnt=0; + }else{ + if (!chan->single_dma_chain){ + if ((chan->rx_no_data_cnt >= 0) && (++chan->rx_no_data_cnt < 3)){ + aft_enable_rx_watchdog(card,AFT_RX_TIMEOUT); + }else{ + /* Enable Rx Interrupt on pending rx descriptor */ + DEBUG_TEST("%s: Setting Max Rx Watchdog Timeout\n", + chan->if_name); + aft_enable_rx_watchdog(card,AFT_MAX_WTD_TIMEOUT); + chan->rx_no_data_cnt=-1; + } + } } -#if 1 - if (!chan->single_dma_chain) { - if ((chan->rx_no_data_cnt >= 0) && (++chan->rx_no_data_cnt < 3)){ - aft_enable_rx_watchdog(card,AFT_RX_TIMEOUT); - }else{ - /* Enable Rx Interrupt on pending rx descriptor */ - DEBUG_TEST("%s: Setting Max Rx Watchdog Timeout\n", - chan->if_name); - aft_enable_rx_watchdog(card,AFT_MAX_WTD_TIMEOUT); - chan->rx_no_data_cnt=-1; - } - } -#endif - reset_skip_rx_setup: wan_clear_bit(RX_HANDLER_BUSY,&chan->dma_status); @@ -5941,11 +5861,15 @@ static void aft_port_task (struct work_struct *work) static void aft_port_task (void * card_ptr, int arg) #endif { -#if defined(__LINUX__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +#if defined(__LINUX__) +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) sdla_t *card = (sdla_t *)container_of(work, sdla_t, u.aft.port_task); +# else + sdla_t *card = (sdla_t *)card_ptr; +# endif #else sdla_t *card = (sdla_t *)card_ptr; -#endif +#endif wan_smp_flag_t smp_flags,isr_flags; if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ diff --git a/patches/kdrivers/src/net/sdla_aft_te3.c~ b/patches/kdrivers/src/net/sdla_aft_te3.c~ deleted file mode 100644 index 543bbbd..0000000 --- a/patches/kdrivers/src/net/sdla_aft_te3.c~ +++ /dev/null @@ -1,5908 +0,0 @@ -/***************************************************************************** -* sdla_aft_te3.c WANPIPE(tm) AFT Xilinx Hardware Support -* -* Authors: Nenad Corbic -* -* Copyright: (c) 2003 Sangoma Technologies 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. -* ============================================================================ -* Jan 07, 2003 Nenad Corbic Initial version. -*****************************************************************************/ -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) -# include -# include -# include -# include /* Socket Driver common area */ -# include -# include -# if defined(CONFIG_PRODUCT_WANPIPE_GENERIC) -# include -# endif -# include -#else -# include -# include -# include -# include -# include -# include /* Socket Driver common area */ -# include -# include -# include -# if defined(CONFIG_PRODUCT_WANPIPE_GENERIC) -# include -# endif -# include -#endif - -//#define XILINX_A010 1 - -#define DBGSTATS if(0)DEBUG_EVENT - -/****** Defines & Macros ****************************************************/ - -/* Private critical flags */ -enum { - POLL_CRIT = PRIV_CRIT, - CARD_DOWN -}; - -enum { - LINK_DOWN, - DEVICE_DOWN -}; - -enum { - TX_DMA_BUSY, - TX_HANDLER_BUSY, - TX_INTR_PENDING, - TX_DATA_READY, - - RX_HANDLER_BUSY, - RX_DMA_BUSY, - RX_INTR_PENDING, - RX_DATA_READY, - - RX_WTD_SKIP, -}; - -enum { - AFT_FE_CFG_ERR, - AFT_FE_CFG, - AFT_FE_INTR, - AFT_FE_POLL, - AFT_FE_LED -}; - -#define MAX_IP_ERRORS 10 - -#define PORT(x) (x == 0 ? "PRIMARY" : "SECONDARY" ) - -#undef DEB_XILINX - -#if 0 -# define AFT_XTEST_DEBUG 1 -#else -# undef AFT_XTEST_DEBUG -#endif - -#if 1 -# define TRUE_FIFO_SIZE 1 -#else -# undef TRUE_FIFO_SIZE -# define HARD_FIFO_CODE 0x01 -#endif - - -#if 0 -#define AFT_T3_SINGLE_DMA_CHAIN 1 -#else -#undef AFT_T3_SINGLE_DMA_CHAIN -#endif - -#define MAX_AFT_DMA_CHAINS 16 -#define MAX_TX_BUF (MAX_AFT_DMA_CHAINS)+1 -#define MAX_RX_BUF ((MAX_AFT_DMA_CHAINS)*4)+1 -#define MAX_RX_SCHAIN_BUF (MAX_RX_BUF)*2 - - -#define AFT_MAX_CHIP_SECURITY_CNT 100 -/* Remove HDLC Address - * 1=Remove Enabled - * 0=Remove Disabled - */ - -static int aft_rx_copyback=1000; - -/******Data Structures*****************************************************/ - -/* This structure is placed in the private data area of the device structure. - * The card structure used to occupy the private area but now the following - * structure will incorporate the card structure along with Protocol specific data - */ - -typedef struct aft_dma_chain -{ - unsigned long init; - u32 dma_addr; - u32 dma_len; - netskb_t *skb; - u32 index; - - u32 dma_descr; - u32 len_align; - u32 reg; - - u8 pkt_error; -}aft_dma_chain_t; - -typedef struct private_area -{ - wanpipe_common_t common; - sdla_t *card; - netdevice_t *dev; - - wan_skb_queue_t wp_tx_free_list; - wan_skb_queue_t wp_tx_pending_list; - wan_skb_queue_t wp_tx_complete_list; - netskb_t *tx_dma_skb; - u8 tx_dma_cnt; - - wan_skb_queue_t wp_rx_free_list; - wan_skb_queue_t wp_rx_complete_list; - - unsigned long time_slot_map; - unsigned char num_of_time_slots; - long logic_ch_num; - - unsigned char hdlc_eng; - unsigned long dma_status; - unsigned char protocol; - unsigned char ignore_modem; - - struct net_device_stats if_stats; - aft_op_stats_t opstats; - aft_comm_err_stats_t errstats; -#if 1 - int tracing_enabled; /* For enabling Tracing */ - unsigned long router_start_time; - unsigned long trace_timeout; - - unsigned char route_status; - unsigned char route_removed; - unsigned long tick_counter; /* For 5s timeout counter */ - unsigned long router_up_time; - - unsigned char mc; /* Mulitcast support on/off */ - unsigned char udp_pkt_src; /* udp packet processing */ - unsigned short timer_int_enabled; - - unsigned char interface_down; - - /* Polling task queue. Each interface - * has its own task queue, which is used - * to defer events from the interrupt */ - wan_taskq_t poll_task; - wan_timer_info_t poll_delay_timer; - - u8 gateway; - u8 true_if_encoding; - - //FIXME: add driver stats as per frame relay! -#endif - -#if defined(__LINUX__) - /* Entry in proc fs per each interface */ - struct proc_dir_entry *dent; -#endif - - unsigned char udp_pkt_data[sizeof(wan_udp_pkt_t)+10]; - atomic_t udp_pkt_len; - - char if_name[WAN_IFNAME_SZ+1]; - - u8 idle_flag; - u16 max_idle_size; - u8 idle_start; - - u8 pkt_error; - u8 rx_fifo_err_cnt; - - int first_time_slot; - - netskb_t *tx_idle_skb; - unsigned char rx_dma; - unsigned char pci_retry; - - unsigned char fifo_size_code; - unsigned char fifo_base_addr; - unsigned char fifo_size; - - int dma_mtu; - - void * prot_ch; - int prot_state; - - wan_trace_t trace_info; - - /* TE3 Specific Dma Chains */ - unsigned char tx_chain_indx,tx_pending_chain_indx; - aft_dma_chain_t tx_dma_chain_table[MAX_AFT_DMA_CHAINS]; - - unsigned char rx_chain_indx, rx_pending_chain_indx; - aft_dma_chain_t rx_dma_chain_table[MAX_AFT_DMA_CHAINS]; - int rx_no_data_cnt; - - unsigned long dma_chain_status; - unsigned long up; - - unsigned char *tx_realign_buf; - unsigned int single_dma_chain; - unsigned int dma_bufs; - -}private_area_t; - -/* Route Status options */ -#define NO_ROUTE 0x00 -#define ADD_ROUTE 0x01 -#define ROUTE_ADDED 0x02 -#define REMOVE_ROUTE 0x03 - -#define WP_WAIT 0 -#define WP_NO_WAIT 1 - -/* variable for keeping track of enabling/disabling FT1 monitor status */ -//static int rCount; - -extern void disable_irq(unsigned int); -extern void enable_irq(unsigned int); - -/**SECTOIN************************************************** - * - * Function Prototypes - * - ***********************************************************/ - -int wp_aft_te3_default_devcfg(sdla_t* card, wandev_conf_t* conf); -int wp_aft_te3_default_ifcfg(sdla_t* card, wanif_conf_t* conf); - -/* WAN link driver entry points. These are called by the WAN router module. */ -static int update (wan_device_t* wandev); -static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf); -static int del_if(wan_device_t *wandev, netdevice_t *dev); - -/* Network device interface */ -#if defined(__LINUX__) -static int if_init (netdevice_t* dev); -#endif -static int if_open (netdevice_t* dev); -static int if_close (netdevice_t* dev); -static int if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd); - -static struct net_device_stats* if_stats (netdevice_t* dev); - -#if defined(__LINUX__) -static int if_send (netskb_t* skb, netdevice_t* dev); -#else -static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct rtentry *rt); -#endif - -static void handle_front_end_state(void* card_id); -static void enable_timer(void* card_id); -static void if_tx_timeout (netdevice_t *dev); - -/* Miscellaneous Functions */ -static void port_set_state (sdla_t *card, int); - -static void disable_comm (sdla_t *card); - -/* Interrupt handlers */ -static WAN_IRQ_RETVAL wp_aft_te3_isr (sdla_t* card); - -/* Bottom half handlers */ -#if defined(__LINUX__) -static void wp_bh (unsigned long); -#else -static void wp_bh (void*, int); -#endif - -/* Miscellaneous functions */ -static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, - private_area_t*, - int local_dev); - -static int xilinx_t3_exar_chip_configure(sdla_t *card); -static int xilinx_t3_exar_dev_configure(sdla_t *card, private_area_t *chan); -static void xilinx_t3_exar_dev_unconfigure(sdla_t *card, private_area_t *chan); -static void xilinx_t3_exar_chip_unconfigure(sdla_t *card); -static void xilinx_t3_exar_transparent_config(sdla_t *card,private_area_t *chan); - -static int xilinx_dma_rx(sdla_t *card, private_area_t *chan, int gcur_ptr); -static void xilinx_dev_enable(sdla_t *card, private_area_t *chan); -static void xilinx_dev_close(sdla_t *card, private_area_t *chan); -static void xilinx_dma_tx_complete (sdla_t *card, private_area_t *chan,int wtd); -static void xilinx_dma_rx_complete (sdla_t *card, private_area_t *chan, int wtd); -static int xilinx_init_rx_dev_fifo(sdla_t *card, private_area_t *chan, unsigned char); -static void xilinx_init_tx_dma_descr(sdla_t *card, private_area_t *chan); -static int xilinx_init_tx_dev_fifo(sdla_t *card, private_area_t *chan, unsigned char); -static void xilinx_tx_post_complete (sdla_t *card, private_area_t *chan, netskb_t *skb); -static void xilinx_rx_post_complete (sdla_t *card, private_area_t *chan, - netskb_t *skb, - netskb_t **new_skb, - unsigned char *pkt_error); - - - - -#if 0 -//FIXME: Not used check with M.F. if still needed -static unsigned char read_cpld(sdla_t *card, unsigned short cpld_off); -#endif -static int write_cpld(void *pcard, unsigned short cpld_off,unsigned char cpld_data); -static int write_fe_cpld(void *pcard, unsigned short off,unsigned char data); - -static int aft_devel_ioctl(sdla_t *card,struct ifreq *ifr); -static int xilinx_write_bios(sdla_t *card, wan_cmd_api_t *api_cmd); -static int xilinx_write(sdla_t *card, wan_cmd_api_t *api_cmd); -static int xilinx_read(sdla_t *card, wan_cmd_api_t *api_cmd); - -static void front_end_interrupt(sdla_t *card, unsigned long reg); -static void enable_data_error_intr(sdla_t *card); -static void disable_data_error_intr(sdla_t *card, unsigned char); - -static void xilinx_tx_fifo_under_recover (sdla_t *card, private_area_t *chan); - -static int xilinx_write_ctrl_hdlc(sdla_t *card, u32 timeslot, u8 reg_off, u32 data); - -static int set_chan_state(sdla_t* card, netdevice_t* dev, int state); - -static int update_comms_stats(sdla_t* card); - -static int protocol_init (sdla_t*card,netdevice_t *dev, - private_area_t *chan, wanif_conf_t* conf); -static int protocol_stop (sdla_t *card, netdevice_t *dev); -static int protocol_start (sdla_t *card, netdevice_t *dev); -static int protocol_shutdown (sdla_t *card, netdevice_t *dev); -static void protocol_recv(sdla_t *card, private_area_t *chan, netskb_t *skb); - -static int aft_alloc_rx_dma_buff(sdla_t *card, private_area_t *chan, int num); -static int aft_init_requeue_free_skb(private_area_t *chan, netskb_t *skb); - -static int write_framer(void *pcard,unsigned short framer_off,unsigned short framer_data); -static unsigned int read_framer(void *pcard,unsigned short framer_off); -#if 0 -//FIXME to be taken out check with M.F. -static void framer_reset(sdla_t *card); -#endif - -static int xilinx_dma_te3_tx (sdla_t *card,private_area_t *chan,netskb_t *skb); -static void aft_tx_dma_chain_handler(unsigned long data); -static void aft_tx_dma_chain_init(private_area_t *chan, aft_dma_chain_t *); -static void aft_rx_dma_chain_init(private_area_t *chan, aft_dma_chain_t *); -static void aft_index_tx_rx_dma_chains(private_area_t *chan); -static void aft_rx_dma_chain_handler(private_area_t *chan, int wtd, int reset); -#if 0 -//FIXME: Currently not used... -static void aft_dma_te3_set_intr(aft_dma_chain_t *dma_chain, private_area_t *chan); -#endif -static void aft_init_tx_rx_dma_descr(private_area_t *chan); -static void aft_free_rx_complete_list(private_area_t *chan); -static void aft_list_descriptors(private_area_t *chan); -static void aft_free_rx_descriptors(private_area_t *chan); -static void aft_te3_led_ctrl(sdla_t *card, int color, int led_pos, int on); -static void aft_list_tx_descriptors(private_area_t *chan); -static void aft_free_tx_descriptors(private_area_t *chan); - -#if defined(__LINUX__) -# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -static void aft_port_task (void * card_ptr); -# else -static void aft_port_task (struct work_struct *work); -# endif -#else -static void aft_port_task (void * card_ptr, int arg); -#endif - -#if 0 -static void aft_fe_intr_ctrl(sdla_t *card, int status); -#endif -static void __aft_fe_intr_ctrl(sdla_t *card, int status); - -static void aft_reset_rx_chain_cnt(private_area_t *chan); -static void aft_reset_tx_chain_cnt(private_area_t *chan); -static void aft_critical_shutdown (sdla_t *card); - -/* Procfs functions */ -static int wan_aft3_get_info(void* pcard, struct seq_file* m, int* stop_cnt); - -/* Function interface between WANPIPE layer and kernel */ -extern wan_iface_t wan_iface; - -static void xilinx_delay(int sec) -{ -#if 0 - unsigned long timeout=SYSTEM_TICKS; - while ((SYSTEM_TICKS-timeout)<(sec*HZ)){ - schedule(); - } -#endif -} - -/**SECTION********************************************************* - * - * Public Functions - * - ******************************************************************/ - -int wp_aft_te3_default_devcfg(sdla_t* card, wandev_conf_t* conf) -{ - conf->config_id = WANCONFIG_AFT_TE3; - conf->u.xilinx.dma_per_ch = MAX_RX_BUF; - conf->u.xilinx.mru = 1500; - return 0; -} - -int wp_aft_te3_default_ifcfg(sdla_t* card, wanif_conf_t* conf) -{ - conf->protocol = WANCONFIG_HDLC; - memcpy(conf->usedby, "WANPIPE", 7); - conf->if_down = 0; - conf->ignore_dcd = WANOPT_NO; - conf->ignore_cts = WANOPT_NO; - conf->hdlc_streaming = WANOPT_NO; - conf->mc = 0; - conf->gateway = 0; - conf->active_ch = ENABLE_ALL_CHANNELS; - - return 0; -} - -/*============================================================================ - * wp_xilinx_init - Cisco HDLC protocol initialization routine. - * - * @card: Wanpipe card pointer - * @conf: User hardware/firmware/general protocol configuration - * pointer. - * - * This routine is called by the main WANPIPE module - * during setup: ROUTER_SETUP ioctl(). - * - * At this point adapter is completely initialized - * and firmware is running. - * o read firmware version (to make sure it's alive) - * o configure adapter - * o initialize protocol-specific fields of the adapter data space. - * - * Return: 0 o.k. - * < 0 failure. - */ - -int wp_aft_te3_init (sdla_t* card, wandev_conf_t* conf) -{ - int err; - - /* Verify configuration ID */ - wan_clear_bit(CARD_DOWN,&card->wandev.critical); - if (card->wandev.config_id != WANCONFIG_AFT_TE3) { - DEBUG_EVENT( "%s: invalid configuration ID %u!\n", - card->devname, card->wandev.config_id); - return -EINVAL; - } - - if (conf == NULL){ - DEBUG_EVENT("%s: Bad configuration structre!\n", - card->devname); - return -EINVAL; - } - -#if defined(WAN_DEBUG_MEM) - DEBUG_EVENT("%s: Total Mem %d\n",__FUNCTION__,wan_atomic_read(&wan_debug_mem)); -#endif - - if (card->adptr_subtype == AFT_SUBTYPE_SHARK) { - DEBUG_EVENT("%s: Starting SHARK T3/E3 Adapter!\n", - card->devname); - } - - /* Obtain hardware configuration parameters */ - card->wandev.clocking = conf->clocking; - card->wandev.ignore_front_end_status = conf->ignore_front_end_status; - card->wandev.ttl = conf->ttl; - card->wandev.interface = conf->interface; - card->wandev.comm_port = conf->comm_port; - card->wandev.udp_port = conf->udp_port; - card->wandev.new_if_cnt = 0; - wan_atomic_set(&card->wandev.if_cnt,0); - card->u.aft.chip_security_cnt=0; - - memcpy(&card->u.xilinx.cfg,&conf->u.xilinx,sizeof(wan_xilinx_conf_t)); - - card->u.xilinx.cfg.dma_per_ch = MAX_RX_BUF; - - /* TE1 Make special hardware initialization for T1/E1 board */ - if (IS_TE3(&conf->fe_cfg)){ - - memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - sdla_te3_iface_init(&card->wandev.fe_iface); - card->fe.name = card->devname; - card->fe.card = card; - card->fe.write_cpld = write_cpld; - card->fe.write_fe_cpld = write_fe_cpld; - -// card->fe.read_cpld = read_cpld; - card->fe.write_framer = write_framer; - card->fe.read_framer = read_framer; - -// card->wandev.write_front_end_reg = write_front_end_reg; -// card->wandev.read_front_end_reg = read_front_end_reg; - card->wandev.fe_enable_timer = enable_timer; - card->wandev.te_link_state = handle_front_end_state; -//ALEX conf->interface = -// IS_T1_CARD(card) ? WANOPT_V35 : WANOPT_RS232; - - if (card->wandev.comm_port == WANOPT_PRI){ - conf->clocking = WANOPT_EXTERNAL; - } - - }else{ - DEBUG_EVENT("%s: Invalid Front-End media type!!\n", - card->devname); - return -EINVAL; - } - - if (card->wandev.ignore_front_end_status == WANOPT_NO){ - DEBUG_EVENT( - "%s: Enabling front end link monitor\n", - card->devname); - }else{ - DEBUG_EVENT( - "%s: Disabling front end link monitor\n", - card->devname); - } - - /* WARNING: After this point the init function - * must return with 0. The following bind - * functions will cause problems if structures - * below are not initialized */ - - card->wandev.update = &update; - card->wandev.new_if = &new_if; - card->wandev.del_if = &del_if; - card->disable_comm = &disable_comm; - -#ifdef WANPIPE_ENABLE_PROC_FILE_HOOKS - /* Proc fs functions hooks */ - card->wandev.get_config_info = &get_config_info; - card->wandev.get_status_info = &get_status_info; - card->wandev.get_dev_config_info= &get_dev_config_info; - card->wandev.get_if_info = &get_if_info; - card->wandev.set_dev_config = &set_dev_config; - card->wandev.set_if_info = &set_if_info; -#endif - card->wandev.get_info = &wan_aft3_get_info; - - /* Setup Port Bps */ - if(card->wandev.clocking) { - card->wandev.bps = conf->bps; - }else{ - card->wandev.bps = 0; - } - - /* For Primary Port 0 */ - card->wandev.mtu = - (conf->mtu >= MIN_WP_PRI_MTU) ? - wp_min(conf->mtu, MAX_WP_PRI_MTU) : DEFAULT_WP_PRI_MTU; - - - if (!card->u.xilinx.cfg.mru){ - card->u.xilinx.cfg.mru = card->wandev.mtu; - } - - - DEBUG_TEST("%s: Set MTU size to %d!\n", - card->devname, card->wandev.mtu); - - card->hw_iface.getcfg(card->hw, SDLA_BASEADDR, &card->u.xilinx.bar); - - xilinx_delay(1); - port_set_state(card,WAN_DISCONNECTED); - aft_te3_led_ctrl(card, WAN_AFT_RED, 0,WAN_AFT_ON); - aft_te3_led_ctrl(card, WAN_AFT_GREEN, 0, WAN_AFT_OFF); - - WAN_TASKQ_INIT((&card->u.aft.port_task),0,aft_port_task,card); - - card->isr = &wp_aft_te3_isr; - - err=xilinx_t3_exar_chip_configure(card); - if (err){ - return err; - } - - xilinx_delay(1); - - /* Set protocol link state to disconnected, - * After seting the state to DISCONNECTED this - * function must return 0 i.e. success */ - - DEBUG_EVENT( "%s: Init Done.\n",card->devname); - return 0; -} - - - - -/**SECTION************************************************************** - * - * WANPIPE Device Driver Entry Points - * - * *********************************************************************/ - - - -/*============================================================================ - * update - Update wanpipe device status & statistics - * - * @wandev: Wanpipe device pointer - * - * This procedure is called when updating the PROC file system. - * It returns various communications statistics. - * - * cat /proc/net/wanrouter/wanpipe# (where #=1,2,3...) - * - * These statistics are accumulated from 3 - * different locations: - * 1) The 'if_stats' recorded for the device. - * 2) Communication error statistics on the adapter. - * 3) Operational statistics on the adapter. - * - * The board level statistics are read during a timer interrupt. - * Note that we read the error and operational statistics - * during consecitive timer ticks so as to minimize the time - * that we are inside the interrupt handler. - * - */ -static int update (wan_device_t* wandev) -{ - sdla_t* card = wandev->private; - netdevice_t* dev; - volatile private_area_t* chan; - - /* sanity checks */ - if((wandev == NULL) || (wandev->private == NULL)) - return -EFAULT; - - if(wandev->state == WAN_UNCONFIGURED) - return -ENODEV; - - if(wan_test_bit(PERI_CRIT, (void*)&card->wandev.critical)) - return -EAGAIN; - - dev = WAN_DEVLE2DEV(WAN_LIST_FIRST(&card->wandev.dev_head)); - if(dev == NULL) - return -ENODEV; - - if((chan=wan_netif_priv(dev)) == NULL) - return -ENODEV; - - if(card->update_comms_stats){ - return -EAGAIN; - } - - DEBUG_TEST("%s: Chain Dma Status=0x%lX, TxCur=%i, TxPend=%i RxCur=%i RxPend=%i\n", - chan->if_name, - chan->dma_chain_status, - chan->tx_chain_indx, - chan->tx_pending_chain_indx, - chan->rx_chain_indx, - chan->rx_pending_chain_indx); - - - update_comms_stats(card); - - return 0; -} - - - -/*============================================================================ - * new_if - Create new logical channel. - * - * &wandev: Wanpipe device pointer - * &dev: Network device pointer - * &conf: User configuration options pointer - * - * This routine is called by the ROUTER_IFNEW ioctl, - * in wanmain.c. The ioctl passes us the user configuration - * options which we use to configure the driver and - * firmware. - * - * This functions main purpose is to allocate the - * private structure for protocol and bind it - * to dev->priv pointer. - * - * Also the dev->init pointer should also be initialized - * to the if_init() function. - * - * Any allocation necessary for the private strucutre - * should be done here, as well as proc/ file initializetion - * for the network interface. - * - * o parse media- and hardware-specific configuration - * o make sure that a new channel can be created - * o allocate resources, if necessary - * o prepare network device structure for registaration. - * o add network interface to the /proc/net/wanrouter - * - * The opposite of this function is del_if() - * - * Return: 0 o.k. - * < 0 failure (channel will not be created) - */ -static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) -{ - sdla_t* card = wandev->private; - private_area_t* chan; - int err = 0; - netskb_t *skb; - - DEBUG_EVENT( "%s: Configuring Interface: %s\n", - card->devname, wan_netif_name(dev)); - - if ((conf->name[0] == '\0') || (strlen(conf->name) > WAN_IFNAME_SZ)){ - DEBUG_EVENT( "%s: Invalid interface name!\n", - card->devname); - return -EINVAL; - } - - /* allocate and initialize private data */ - chan = wan_malloc(sizeof(private_area_t)); - if(chan == NULL){ - WAN_MEM_ASSERT(card->devname); - return -ENOMEM; - } - memset(chan, 0, sizeof(private_area_t)); - - chan->first_time_slot=-1; - chan->single_dma_chain=0; - -#ifdef AFT_T3_SINGLE_DMA_CHAIN - chan->single_dma_chain=1; -#endif - - strncpy(chan->if_name, wan_netif_name(dev), WAN_IFNAME_SZ); - - chan->card = card; - - wan_skb_queue_init(&chan->wp_tx_free_list); - wan_skb_queue_init(&chan->wp_tx_pending_list); - wan_skb_queue_init(&chan->wp_tx_complete_list); - - wan_skb_queue_init(&chan->wp_rx_free_list); - wan_skb_queue_init(&chan->wp_rx_complete_list); - - wan_trace_info_init(&chan->trace_info,MAX_TRACE_QUEUE); - - /* Initiaize Tx/Rx DMA Chains */ - aft_index_tx_rx_dma_chains(chan); - - /* Initialize the socket binding information - * These hooks are used by the API sockets to - * bind into the network interface */ - - WAN_TASKLET_INIT((&chan->common.bh_task),0,wp_bh,chan); - chan->common.dev = dev; - chan->tracing_enabled = 0; - chan->route_status = NO_ROUTE; - chan->route_removed = 0; - - /* Setup interface as: - * WANPIPE = IP over Protocol (Firmware) - * API = Raw Socket access to Protocol (Firmware) - * BRIDGE = Ethernet over Protocol, no ip info - * BRIDGE_NODE = Ethernet over Protocol, with ip info - */ - if(strcmp(conf->usedby, "WANPIPE") == 0) { - - DEBUG_EVENT( "%s: Running in WANPIPE mode\n", - wandev->name); - chan->common.usedby = WANPIPE; - - /* Option to bring down the interface when - * the link goes down */ - if (conf->if_down){ - wan_set_bit(DYN_OPT_ON,&chan->interface_down); - DEBUG_EVENT( - "%s:%s: Dynamic interface configuration enabled\n", - card->devname,chan->if_name); - } - - if (conf->protocol != WANOPT_NO){ - wan_netif_set_priv(dev,chan); - if ((err=protocol_init(card,dev,chan,conf)) != 0){ - wan_netif_set_priv(dev, chan); - goto new_if_error; - } - - if (conf->ignore_dcd == WANOPT_YES || conf->ignore_cts == WANOPT_YES){ - DEBUG_EVENT( "%s: Ignore modem changes DCD/CTS\n",card->devname); - chan->ignore_modem=1; - }else{ - DEBUG_EVENT( "%s: Restart protocol on modem changes DCD/CTS\n", - card->devname); - } - } - - } else if( strcmp(conf->usedby, "API") == 0) { - chan->common.usedby = API; - DEBUG_EVENT( "%s:%s: Running in API mode\n", - wandev->name,chan->if_name); - wan_reg_api(chan, dev, card->devname); - - }else if (strcmp(conf->usedby, "BRIDGE") == 0) { - chan->common.usedby = BRIDGE; - DEBUG_EVENT( "%s:%s: Running in WANPIPE (BRIDGE) mode.\n", - card->devname,chan->if_name); - - }else if (strcmp(conf->usedby, "BRIDGE_N") == 0) { - chan->common.usedby = BRIDGE_NODE; - DEBUG_EVENT( "%s:%s: Running in WANPIPE (BRIDGE_NODE) mode.\n", - card->devname,chan->if_name); - - }else if (strcmp(conf->usedby, "STACK") == 0) { - chan->common.usedby = STACK; - if (chan->hdlc_eng){ - card->wandev.mtu+=32; - } - DEBUG_EVENT( "%s:%s: Running in Stack mode.\n", - card->devname,chan->if_name); - - - }else{ - DEBUG_EVENT( "%s:%s: Error: Invalid operation mode [WANPIPE|API|BRIDGE|BRIDGE_NODE]\n", - card->devname,chan->if_name); - err=-EINVAL; - goto new_if_error; - } - - xilinx_delay(1); - - chan->hdlc_eng = conf->hdlc_streaming; - - if (!chan->hdlc_eng){ - if (card->wandev.mtu&0x03){ - DEBUG_EVENT("%s:%s: Error, Transparent MTU must be word aligned!\n", - card->devname,chan->if_name); - err = -EINVAL; - goto new_if_error; - } - } - chan->time_slot_map=conf->active_ch; - - err=xilinx_t3_exar_dev_configure(card,chan); - if (err){ - goto new_if_error; - } - - xilinx_delay(1); - - - if (!chan->hdlc_eng){ - unsigned char *buf; - - if (!chan->max_idle_size){ - chan->max_idle_size=card->wandev.mtu; - } - - DEBUG_EVENT("%s:%s: Config for Transparent mode: Idle=%X Len=%u\n", - card->devname,chan->if_name, - chan->idle_flag,chan->max_idle_size); - - chan->idle_flag=0x7E; - - chan->tx_idle_skb = wan_skb_alloc(chan->max_idle_size); - if (!chan->tx_idle_skb){ - err=-ENOMEM; - goto new_if_error; - } - buf=wan_skb_put(chan->tx_idle_skb,chan->max_idle_size); - memset(buf,chan->idle_flag,chan->max_idle_size); - } - - chan->dma_mtu = card->wandev.mtu >= card->u.xilinx.cfg.mru? - card->wandev.mtu:card->u.xilinx.cfg.mru; - - chan->dma_mtu = xilinx_valid_mtu(chan->dma_mtu); - if (!chan->dma_mtu){ - DEBUG_EVENT("%s:%s: Error invalid MTU %i mru %i\n", - card->devname, - chan->if_name, - card->wandev.mtu,card->u.xilinx.cfg.mru); - err= -EINVAL; - goto new_if_error; - } - - chan->dma_bufs=card->u.xilinx.cfg.dma_per_ch; - if (chan->single_dma_chain){ - chan->dma_bufs=MAX_RX_SCHAIN_BUF; - } - - DEBUG_EVENT("%s:%s: Allocating %i dma len=%i Chains=%s\n", - card->devname,chan->if_name, - chan->dma_bufs, - chan->dma_mtu, - chan->single_dma_chain ? "Off":"On"); - - - err=aft_alloc_rx_dma_buff(card, chan, chan->dma_bufs); - if (err){ - goto new_if_error; - } - - /* If gateway option is set, then this interface is the - * default gateway on this system. We must know that information - * in case DYNAMIC interface configuration is enabled. - * - * I.E. If the interface is brought down by the driver, the - * default route will also be removed. Once the interface - * is brought back up, we must know to re-astablish the - * default route. - */ - if ((chan->gateway = conf->gateway) == WANOPT_YES){ - DEBUG_EVENT( "%s: Interface %s is set as a gateway.\n", - card->devname,chan->if_name); - } - - /* Get Multicast Information from the user - * FIXME: This option is not clearly defined - */ - chan->mc = conf->mc; - - - /* The network interface "dev" has been passed as - * an argument from the above layer. We must initialize - * it so it can be registered into the kernel. - * - * The "dev" structure is the link between the kernel - * stack and the wanpipe driver. It contains all - * access hooks that kernel uses to communicate to - * the our driver. - * - * For now, just set the "dev" name to the user - * defined name and initialize: - * dev->if_init : function that will be called - * to further initialize - * dev structure on "ifconfig up" - * - * dev->priv : private structure allocated above - * - */ - -#if 0 - /* Create interface file in proc fs. - * Once the proc file system is created, the new_if() function - * should exit successfuly. - * - * DO NOT place code under this function that can return - * anything else but 0. - */ - err = wanrouter_proc_add_interface(wandev, - &chan->dent, - chan->if_name, - dev); - if (err){ - DEBUG_EVENT( - "%s: can't create /proc/net/router/frmw/%s entry!\n", - card->devname, chan->if_name); - goto new_if_error; - } -#endif - /* Only setup the dev pointer once the new_if function has - * finished successfully. DO NOT place any code below that - * can return an error */ - wan_netif_set_priv(dev,chan); -#if defined(__LINUX__) - dev->init = &if_init; -# ifdef WANPIPE_GENERIC - if_init(dev); -# endif -#else - chan->common.is_netdev = 1; - chan->common.iface.open = &if_open; - chan->common.iface.close = &if_close; - chan->common.iface.output = &if_send; - chan->common.iface.ioctl = &if_do_ioctl; - chan->common.iface.get_stats = &if_stats; - chan->common.iface.tx_timeout = &if_tx_timeout; - if (wan_iface.attach){ - if (!ifunit(wan_netif_name(dev))){ - wan_iface.attach(dev, NULL, chan->common.is_netdev); - } - }else{ - DEBUG_EVENT("%s: Failed to attach network interface %s!\n", - card->devname, wan_netif_name(dev)); - wan_netif_set_priv(dev, NULL); - err = -EINVAL; - goto new_if_error; - } - wan_netif_set_mtu(dev, card->wandev.mtu); -#endif - - /* Increment the number of network interfaces - * configured on this card. - */ - wan_atomic_inc(&card->wandev.if_cnt); - - chan->common.state = WAN_CONNECTING; - - DEBUG_EVENT( "\n"); - - return 0; - -new_if_error: - - while ((skb=wan_skb_dequeue(&chan->wp_tx_free_list)) != NULL){ - wan_skb_free(skb); - } - - while ((skb=wan_skb_dequeue(&chan->wp_rx_free_list)) != NULL){ - wan_skb_free(skb); - } - - WAN_TASKLET_KILL(&chan->common.bh_task); - - if (chan->common.usedby == API){ - wan_unreg_api(chan, card->devname); - } - - if (chan->tx_idle_skb){ - wan_skb_free(chan->tx_idle_skb); - chan->tx_idle_skb=NULL; - } - - wan_free(chan); - - wan_netif_set_priv(dev,NULL); - - return err; -} - -/*============================================================================ - * del_if - Delete logical channel. - * - * @wandev: Wanpipe private device pointer - * @dev: Netowrk interface pointer - * - * This function is called by ROUTER_DELIF ioctl call - * to deallocate the network interface. - * - * The network interface and the private structure are - * about to be deallocated by the upper layer. - * We have to clean and deallocate any allocated memory. - * - * NOTE: DO NOT deallocate dev->priv here! It will be - * done by the upper layer. - * - */ -static int del_if (wan_device_t* wandev, netdevice_t* dev) -{ - private_area_t* chan = wan_netif_priv(dev); - sdla_t* card = chan->card; - netskb_t *skb; - wan_smp_flag_t flags; - - xilinx_t3_exar_dev_unconfigure(card,chan); - - WAN_TASKLET_KILL(&chan->common.bh_task); - - if (chan->common.usedby == API){ - wan_unreg_api(chan, card->devname); - } - - protocol_shutdown(card,dev); - - - wan_spin_lock_irq(&card->wandev.lock,&flags); - - while ((skb=wan_skb_dequeue(&chan->wp_rx_free_list)) != NULL){ - wan_skb_free(skb); - } - - while ((skb=wan_skb_dequeue(&chan->wp_rx_complete_list)) != NULL){ - wan_skb_free(skb); - } - - while ((skb=wan_skb_dequeue(&chan->wp_tx_free_list)) != NULL){ - wan_skb_free(skb); - } - - if (chan->tx_realign_buf){ - wan_free(chan->tx_realign_buf); - chan->tx_realign_buf=NULL; - } - - wan_spin_unlock_irq(&card->wandev.lock,&flags); - - /* Delete interface name from proc fs. */ -#if 0 - wanrouter_proc_delete_interface(wandev, chan->if_name); -#endif - - /* Decrement the number of network interfaces - * configured on this card. - */ - wan_atomic_dec(&card->wandev.if_cnt); - - DEBUG_SUB_MEM(sizeof(private_area_t)); - return 0; -} - - -/**SECTION*********************************************************** - * - * KERNEL Device Entry Interfaces - * - ********************************************************************/ - - - -/*============================================================================ - * if_init - Initialize Linux network interface. - * - * @dev: Network interface pointer - * - * During "ifconfig up" the upper layer calls this function - * to initialize dev access pointers. Such as transmit, - * stats and header. - * - * It is called only once for each interface, - * during Linux network interface registration. - * - * Returning anything but zero will fail interface - * registration. - */ -#if defined(__LINUX__) -static int if_init (netdevice_t* dev) -{ - private_area_t* chan = wan_netif_priv(dev); - sdla_t* card = chan->card; - wan_device_t* wandev = &card->wandev; -#ifdef WANPIPE_GENERIC - hdlc_device* hdlc; -#endif - - /* Initialize device driver entry points */ - dev->open = &if_open; - dev->stop = &if_close; -#ifdef WANPIPE_GENERIC - hdlc = dev_to_hdlc(dev); - hdlc->xmit = if_send; -#else - dev->hard_start_xmit = &if_send; -#endif - dev->get_stats = &if_stats; -#if defined(LINUX_2_4)||defined(LINUX_2_6) - dev->tx_timeout = &if_tx_timeout; - dev->watchdog_timeo = 2*HZ; -#endif - dev->do_ioctl = if_do_ioctl; - - if (chan->common.usedby == BRIDGE || - chan->common.usedby == BRIDGE_NODE){ - - /* Setup the interface for Bridging */ - int hw_addr=0; - ether_setup(dev); - - /* Use a random number to generate the MAC address */ - memcpy(dev->dev_addr, "\xFE\xFC\x00\x00\x00\x00", 6); - get_random_bytes(&hw_addr, sizeof(hw_addr)); - *(int *)(dev->dev_addr + 2) += hw_addr; - - }else{ - - if (chan->protocol != WANCONFIG_PPP && - chan->protocol != WANCONFIG_CHDLC){ - dev->flags |= IFF_POINTOPOINT; - dev->flags |= IFF_NOARP; - dev->type = ARPHRD_PPP; - dev->mtu = card->wandev.mtu; - dev->hard_header_len = 16; - dev->addr_len = 0; - } - - if (chan->common.usedby == API){ - dev->mtu = card->wandev.mtu+sizeof(api_tx_hdr_t); - } - - /* Enable Mulitcasting if user selected */ - if (chan->mc == WANOPT_YES){ - dev->flags |= IFF_MULTICAST; - } - - if (chan->true_if_encoding){ - dev->type = ARPHRD_HDLC; /* This breaks the tcpdump */ - }else{ - dev->type = ARPHRD_PPP; - } - } - - /* Initialize hardware parameters */ - dev->irq = wandev->irq; - dev->dma = wandev->dma; - dev->base_addr = wandev->ioport; - card->hw_iface.getcfg(card->hw, SDLA_MEMBASE, &dev->mem_start); - card->hw_iface.getcfg(card->hw, SDLA_MEMEND, &dev->mem_end); - - /* Set transmit buffer queue length - * If too low packets will not be retransmitted - * by stack. - */ - dev->tx_queue_len = 100; - - return 0; -} -#endif - -/*============================================================================ - * if_open - Open network interface. - * - * @dev: Network device pointer - * - * On ifconfig up, this function gets called in order - * to initialize and configure the private area. - * Driver should be configured to send and receive data. - * - * This functions starts a timer that will call - * frmw_config() function. This function must be called - * because the IP addresses could have been changed - * for this interface. - * - * Return 0 if O.k. or errno. - */ -static int if_open (netdevice_t* dev) -{ - private_area_t* chan = wan_netif_priv(dev); - sdla_t* card = chan->card; - wan_smp_flag_t flags; - -#if defined(__LINUX__) - /* Only one open per interface is allowed */ - if (open_dev_check(dev)){ - DEBUG_EVENT("%s: Open dev check failed!\n", - wan_netif_name(dev)); - return -EBUSY; - } -#endif - - /* Initialize the router start time. - * Used by wanpipemon debugger to indicate - * how long has the interface been up */ - wan_getcurrenttime(&chan->router_start_time, NULL); - - WAN_NETIF_STOP_QUEUE(dev); - WAN_NETIF_CARRIER_OFF(dev); - - /* If FRONT End is down, it means that the DMA - * is disabled. In this case don't try to - * reset fifo. Let the enable_data_error_intr() - * function do this, after front end has come up */ - - wan_spin_lock_irq(&card->wandev.lock,&flags); - if (card->wandev.state == WAN_CONNECTED){ - DEBUG_TEST("%s: OPEN reseting fifo\n", - wan_netif_name(dev)); - xilinx_init_rx_dev_fifo(card,chan,WP_WAIT); - xilinx_init_tx_dev_fifo(card,chan,WP_WAIT); - xilinx_init_tx_dma_descr(card,chan); - - xilinx_dma_rx(card,chan,-1); - } - - /* Check for transparent HDLC mode */ - if (!chan->hdlc_eng){ - /* The Transparent HDLC engine is - * enabled. The Rx dma has already - * been setup above. Now setup - * TX DMA and enable the HDLC engine */ - - DEBUG_CFG("%s: Transparent Tx Enabled!\n", - wan_netif_name(dev)); - - xilinx_t3_exar_transparent_config(card,chan); - } - - xilinx_dev_enable(card,chan); - wan_set_bit(0,&chan->up); - - if (card->wandev.state == WAN_CONNECTED){ - /* If Front End is connected already set interface - * state to Connected too */ - set_chan_state(card, dev, WAN_CONNECTED); - WAN_NETIF_WAKE_QUEUE(dev); - WAN_NETIF_CARRIER_ON(dev); - if (chan->common.usedby == API){ - wan_wakeup_api(chan); - }else if (chan->common.usedby == STACK){ - wanpipe_lip_kick(chan,0); - } - } - - wan_spin_unlock_irq(&card->wandev.lock,&flags); - - chan->ignore_modem=0x0F; - - /* Increment the module usage count */ - wanpipe_open(card); - - protocol_start(card,dev); - - /* Wait for the front end interrupt - * before enabling the card */ - return 0; -} - -/*============================================================================ - * if_close - Close network interface. - * - * @dev: Network device pointer - * - * On ifconfig down, this function gets called in order - * to cleanup interace private area. - * - * IMPORTANT: - * - * No deallocation or unconfiguration should ever occur in this - * function, because the interface can come back up - * (via ifconfig up). - * - * Furthermore, in dynamic interfacace configuration mode, the - * interface will come up and down to reflect the protocol state. - * - * Any deallocation and cleanup can occur in del_if() - * function. That function is called before the dev interface - * itself is deallocated. - * - * Thus, we should only stop the net queue and decrement - * the wanpipe usage counter via wanpipe_close() function. - */ - -static int if_close (netdevice_t* dev) -{ - private_area_t* chan = wan_netif_priv(dev); - sdla_t* card = chan->card; - wan_smp_flag_t smp_flags; - - wan_clear_bit(0,&chan->up); - - WAN_NETIF_STOP_QUEUE(dev); - -#if defined(LINUX_2_1) - dev->start=0; -#endif - protocol_stop(card,dev); - - chan->common.state = WAN_DISCONNECTED; - - wan_spin_lock_irq(&card->wandev.lock,&smp_flags); - xilinx_dev_close(card,chan); - wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); - - chan->ignore_modem=0x00; - - wanpipe_close(card); - return 0; -} - - -/*============================================================= - * disable_comm - Main shutdown function - * - * @card: Wanpipe device pointer - * - * The command 'wanrouter stop' has been called - * and the whole wanpipe device is going down. - * This is the last function called to disable - * all comunications and deallocate any memory - * that is still allocated. - * - * o Disable communications, turn off interrupts - * o Deallocate memory used, if any - * o Unconfigure TE1 card - */ - -static void disable_comm (sdla_t *card) -{ - wan_smp_flag_t flags; - - /* Unconfiging, only on shutdown */ - if (IS_TE3(&card->fe.fe_cfg)) { - if (card->wandev.fe_iface.unconfig){ - card->wandev.fe_iface.unconfig(&card->fe); - } - } - - wan_spin_lock_irq(&card->wandev.lock,&flags); - - /* Disable DMA ENGINE before we perform - * core reset. Otherwise, we will receive - * rx fifo errors on subsequent resetart. */ - disable_data_error_intr(card,DEVICE_DOWN); - - wan_set_bit(CARD_DOWN,&card->wandev.critical); - - wan_spin_unlock_irq(&card->wandev.lock,&flags); - - WP_DELAY(10); - aft_te3_led_ctrl(card, WAN_AFT_RED, 0,WAN_AFT_ON); - aft_te3_led_ctrl(card, WAN_AFT_GREEN, 0, WAN_AFT_ON); - - xilinx_t3_exar_chip_unconfigure(card); - - return; -} - - - -/*============================================================================ - * if_tx_timeout - * - * Kernel networking stack calls this function in case - * the interface has been stopped for TX_TIMEOUT seconds. - * - * This would occur if we lost TX interrupts or the - * card has stopped working for some reason. - * - * Handle transmit timeout event from netif watchdog - */ -static void if_tx_timeout (netdevice_t *dev) -{ - private_area_t* chan = wan_netif_priv(dev); - sdla_t *card = chan->card; - unsigned int cur_dma_ptr; - u32 reg; - wan_smp_flag_t smp_flags; - - /* If our device stays busy for at least 5 seconds then we will - * kick start the device by making dev->tbusy = 0. We expect - * that our device never stays busy more than 5 seconds. So this - * is only used as a last resort. - */ - - ++chan->if_stats.collisions; - - DEBUG_EVENT( "%s: Transmit timed out on %s\n", - card->devname,wan_netif_name(dev)); - -// DEBUG_EVENT("%s: TxStatus=0x%X DMAADDR=0x%lX DMALEN=%i \n", -// chan->if_name, -// chan->dma_status, -// chan->tx_dma_addr, -// chan->tx_dma_len); - - card->hw_iface.bus_read_4(card->hw,AFT_TE3_CRNT_DMA_DESC_ADDR_REG,®); - cur_dma_ptr=get_current_tx_dma_ptr(reg); - - DEBUG_EVENT("%s: Chain TxIntrPend=%i, TxBusy=%i TxCur=%i, TxPend=%i HwCur=%i TxErr=%li\n", - chan->if_name, - wan_test_bit(TX_INTR_PENDING,&chan->dma_chain_status), - wan_test_bit(TX_DMA_BUSY,&chan->dma_status), - chan->tx_chain_indx, - chan->tx_pending_chain_indx, - cur_dma_ptr, - chan->if_stats.tx_fifo_errors); - - /* The Interrupt didn't trigger. - * Clear the interrupt pending flag and - * let watch dog, clean up the tx chain */ - - wan_spin_lock_irq(&card->wandev.lock, &smp_flags); - aft_list_tx_descriptors(chan); - xilinx_tx_fifo_under_recover(card,chan); - wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); - - aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); -} - - -/*============================================================================ - * if_send - Send a packet on a network interface. - * - * @dev: Network interface pointer - * @skb: Packet obtained from the stack or API - * that should be sent out the port. - * - * o Mark interface as stopped - * (marks start of the transmission) to indicate - * to the stack that the interface is busy. - * - * o Check link state. - * If link is not up, then drop the packet. - * - * o Copy the tx packet into the protocol tx buffers on - * the adapter. - * - * o If tx successful: - * Free the skb buffer and mark interface as running - * and return 0. - * - * o If tx failed, busy: - * Keep interface marked as busy - * Do not free skb buffer - * Enable Tx interrupt (which will tell the stack - * that interace is not busy) - * Return a non-zero value to tell the stack - * that the tx should be retried. - * - * Return: 0 complete (socket buffer must be freed) - * non-0 packet may be re-transmitted - * - */ -#if defined(__LINUX__) -static int if_send (netskb_t* skb, netdevice_t* dev) -#else -static int if_send(netdevice_t *dev, netskb_t *skb, struct sockaddr *dst,struct rtentry *rt) -#endif -{ - - private_area_t *chan = wan_netif_priv(dev); - sdla_t *card = chan->card; - wan_smp_flag_t smp_flags; - - /* Mark interface as busy. The kernel will not - * attempt to send any more packets until we clear - * this condition */ - - if (skb == NULL){ - /* This should never happen. Just a sanity check. - */ - DEBUG_EVENT( "%s: interface %s got kicked!\n", - card->devname, wan_netif_name(dev)); - - WAN_NETIF_WAKE_QUEUE(dev); - return 0; - } - - /* Non 2.4 kernels used to call if_send() - * after TX_TIMEOUT seconds have passed of interface - * being busy. Same as if_tx_timeout() in 2.4 kernels */ -#if defined(LINUX_2_1) - if (dev->tbusy){ - - /* If our device stays busy for at least 5 seconds then we will - * kick start the device by making dev->tbusy = 0. We expect - * that our device never stays busy more than 5 seconds. So this - * is only used as a last resort. - */ - ++chan->if_stats.collisions; - if((SYSTEM_TICKS - chan->tick_counter) < (5 * HZ)) { - return 1; - } - - if_tx_timeout(dev); - } -#endif - - if (chan->common.state != WAN_CONNECTED){ - WAN_NETIF_STOP_QUEUE(dev); - if (WAN_NETIF_CARRIER_OK(dev)){ - DEBUG_EVENT("%s: Critical Error: Carrier on on tx dev down\n", - chan->if_name); - } - wan_netif_set_ticks(dev, SYSTEM_TICKS); - ++chan->if_stats.tx_carrier_errors; - - - return 1; - - } else if (!WAN_NETIF_UP(dev)) { - ++chan->if_stats.tx_carrier_errors; - WAN_NETIF_START_QUEUE(dev); - wan_skb_free(skb); - wan_netif_set_ticks(dev, SYSTEM_TICKS); - return 0; - - }else { - int err=0; - - if (chan->common.usedby == API){ - if (sizeof(api_tx_hdr_t) >= wan_skb_len(skb)){ - wan_skb_free(skb); - ++chan->if_stats.tx_errors; - WAN_NETIF_START_QUEUE(dev); - goto if_send_exit_crit; - } - wan_skb_pull(skb,sizeof(api_tx_hdr_t)); - } - - wan_spin_lock_irq(&card->wandev.lock, &smp_flags); - - err=xilinx_dma_te3_tx(card,chan,skb); - - switch (err){ - - case 0: - WAN_NETIF_START_QUEUE(dev); - wan_netif_set_ticks(dev, SYSTEM_TICKS); - err=0; - break; - - case -EBUSY: - WAN_NETIF_STOP_QUEUE(dev); - err=1; - break; - - default: - - /* The packet was dropped - * by the tx chain handler. - * The tx_dropped stat was updated, - * thus all is left for us is - * to start the interface again. - * This SHOULD NEVER happen */ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: TE3 Failed to send: Should never happend!\n", - chan->if_name); - } - WAN_NETIF_START_QUEUE(dev); - wan_netif_set_ticks(dev, SYSTEM_TICKS); - err=0; - } - wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); - - return err; - } - -if_send_exit_crit: - - return 0; -} - - -/*============================================================================ - * if_stats - * - * Used by /proc/net/dev and ifconfig to obtain interface - * statistics. - * - * Return a pointer to struct net_device_stats. - */ -static struct net_device_stats* if_stats (netdevice_t* dev) -{ - private_area_t* chan; - - if ((chan=wan_netif_priv(dev)) == NULL) - return NULL; - -#if 0 -{ - sdla_t *card; - card=chan->card; - - - u8 *base_addr=card->u.xilinx.rx_dma_ptr; - u8 *base_addr_tx=card->u.xilinx.tx_dma_ptr; - u8 *addr=(u8*)wan_dma_get_vaddr(card,base_addr); - u8 *addrtx=(u8*)wan_dma_get_vaddr(card,base_addr_tx); - u8 *addr1, *addr0; - - addr+=chan->logic_ch_num*card->u.xilinx.dma_mtu_off; - - addr0=addr+0*card->u.xilinx.dma_mtu; - addr1=addr+1*card->u.xilinx.dma_mtu; - - DEBUG_EVENT("%s: Buf 0: 0x%02X 1: 0x%02X Txbuf: 0x%02X RxCompList=%i RxFreeList=%i TxList=%i\n", - wan_netif_name(dev),addr0[0],addr1[0],addrtx[0], - wan_skb_queue_len(&chan->wp_rx_complete_list), - wan_skb_queue_len(&chan->wp_rx_free_list), - wan_skb_queue_len(&chan->wp_tx_pending_list)); -} -#endif - - -#if 0 - DEBUG_EVENT("%s: RxCompList=%i RxFreeList=%i TxList=%i\n", - wan_netif_name(dev), - wan_skb_queue_len(&chan->wp_rx_complete_list), - wan_skb_queue_len(&chan->wp_rx_free_list), - wan_skb_queue_len(&chan->wp_tx_pending_list)); -#endif - - - return &chan->if_stats; -} - - - - -/*======================================================================== - * - * if_do_ioctl - Ioctl handler for fr - * - * @dev: Device subject to ioctl - * @ifr: Interface request block from the user - * @cmd: Command that is being issued - * - * This function handles the ioctls that may be issued by the user - * to control or debug the protocol or hardware . - * - * It does both busy and security checks. - * This function is intended to be wrapped by callers who wish to - * add additional ioctl calls of their own. - * - * Used by: SNMP Mibs - * wanpipemon debugger - * - */ -static int if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) -{ - private_area_t* chan= (private_area_t*)wan_netif_priv(dev); - sdla_t *card; -#if defined(__LINUX__) - wan_smp_flag_t smp_flags; -#endif - wan_udp_pkt_t *wan_udp_pkt; - int err=0; - - if (!chan){ - return -ENODEV; - } - card=chan->card; - - NET_ADMIN_CHECK(); - - switch(cmd) - { -#if defined(__LINUX__) - case SIOC_WANPIPE_BIND_SK: - if (!ifr){ - err= -EINVAL; - break; - } - - wan_spin_lock_irq(&card->wandev.lock, &smp_flags); - err=wan_bind_api_to_svc(chan,ifr->ifr_data); - chan->if_stats.rx_dropped=0; - wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); - break; - - case SIOC_WANPIPE_UNBIND_SK: - if (!ifr){ - err= -EINVAL; - break; - } - - wan_spin_lock_irq(&card->wandev.lock, &smp_flags); - err=wan_unbind_api_from_svc(chan,ifr->ifr_data); - wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); - - break; - - case SIOC_WANPIPE_CHECK_TX: - case SIOC_ANNEXG_CHECK_TX: - err=0; - break; - - case SIOC_WANPIPE_DEV_STATE: - err = chan->common.state; - break; - - case SIOC_ANNEXG_KICK: - err=0; - break; -#endif - case SIOC_WAN_DEVEL_IOCTL: - err = aft_devel_ioctl(card, ifr); - break; - - case SIOC_AFT_CUSTOMER_ID: - err=0; - break; - - case SIOC_WANPIPE_PIPEMON: - - if (wan_atomic_read(&chan->udp_pkt_len) != 0){ - return -EBUSY; - } - - wan_atomic_set(&chan->udp_pkt_len,MAX_LGTH_UDP_MGNT_PKT); - - /* For performance reasons test the critical - * here before spin lock */ - if (wan_test_bit(0,&card->in_isr)){ - wan_atomic_set(&chan->udp_pkt_len,0); - return -EBUSY; - } - - - wan_udp_pkt=(wan_udp_pkt_t*)chan->udp_pkt_data; - if (WAN_COPY_FROM_USER(&wan_udp_pkt->wan_udp_hdr,ifr->ifr_data,sizeof(wan_udp_hdr_t))){ - wan_atomic_set(&chan->udp_pkt_len,0); - return -EFAULT; - } - - /* We have to check here again because we don't know - * what happened during spin_lock */ - if (wan_test_bit(0,&card->in_isr)) { - DEBUG_EVENT( "%s:%s Pipemon command failed, Driver busy: try again.\n", - card->devname, - wan_netif_name(chan->common.dev)); - wan_atomic_set(&chan->udp_pkt_len,0); - return -EBUSY; - } - - process_udp_mgmt_pkt(card,dev,chan,1); - - /* This area will still be critical to other - * PIPEMON commands due to udp_pkt_len - * thus we can release the irq */ - - if (wan_atomic_read(&chan->udp_pkt_len) > sizeof(wan_udp_pkt_t)){ - DEBUG_EVENT( "%s: Error: Pipemon buf too bit on the way up! %i\n", - card->devname,wan_atomic_read(&chan->udp_pkt_len)); - wan_atomic_set(&chan->udp_pkt_len,0); - return -EINVAL; - } - - if (WAN_COPY_TO_USER(ifr->ifr_data,&wan_udp_pkt->wan_udp_hdr,sizeof(wan_udp_hdr_t))){ - wan_atomic_set(&chan->udp_pkt_len,0); - return -EFAULT; - } - - wan_atomic_set(&chan->udp_pkt_len,0); - return 0; - - default: -#ifndef WANPIPE_GENERIC - DEBUG_EVENT("%s: Command %x not supported!\n", - card->devname,cmd); - return -EOPNOTSUPP; -#else - if (card->wandev.ioctl){ - err = card->wandev.hdlc_ioctl(card, dev, ifr, cmd); - } -#endif - } - - return err; -} - - -/**SECTION********************************************************** - * - * FIRMWARE Specific Interface Functions - * - *******************************************************************/ - - -#define FIFO_RESET_TIMEOUT_CNT 1000 -#define FIFO_RESET_TIMEOUT_US 10 -static int xilinx_init_rx_dev_fifo(sdla_t *card, private_area_t *chan, unsigned char wait) -{ - - u32 reg; - u32 dma_descr; - u8 timeout=1; - u16 i; - unsigned int cur_dma_ptr; - - /* Clean RX DMA fifo */ - aft_reset_rx_chain_cnt(chan); - - card->hw_iface.bus_read_4(card->hw,AFT_TE3_CRNT_DMA_DESC_ADDR_REG,®); - cur_dma_ptr=get_current_rx_dma_ptr(reg); - - dma_descr=(unsigned long)(cur_dma_ptr<<4) + XILINX_RxDMA_DESCRIPTOR_HI; - reg=0; - wan_set_bit(INIT_DMA_FIFO_CMD_BIT,®); - - DEBUG_TEST("%s: Clearing RX Fifo %s DmaDescr=(0x%X) Reg=(0x%X)\n", - __FUNCTION__,chan->if_name, - dma_descr,reg); - - card->hw_iface.bus_write_4(card->hw,dma_descr,reg); - - if (wait == WP_WAIT){ - for(i=0;ihw_iface.bus_read_4(card->hw,dma_descr,®); - if (wan_test_bit(INIT_DMA_FIFO_CMD_BIT,®)){ - WP_DELAY(FIFO_RESET_TIMEOUT_US); - continue; - } - timeout=0; - break; - } - - if (timeout){ - DEBUG_EVENT("%s:%s: Error: Rx fifo reset timedout %u us\n", - card->devname,chan->if_name,i*FIFO_RESET_TIMEOUT_US); - }else{ - DEBUG_TEST("%s:%s: Rx Fifo Reset Successful\n", - card->devname,chan->if_name); - } - }else{ - timeout=0; - } - - return timeout; -} - -static int xilinx_init_tx_dev_fifo(sdla_t *card, private_area_t *chan, unsigned char wait) -{ - u32 reg; - u32 dma_descr; - u8 timeout=1; - u16 i; - unsigned int cur_dma_ptr; - - aft_reset_tx_chain_cnt(chan); - - card->hw_iface.bus_read_4(card->hw,AFT_TE3_CRNT_DMA_DESC_ADDR_REG,®); - cur_dma_ptr=get_current_tx_dma_ptr(reg); - - /* Clean TX DMA fifo */ - dma_descr=(unsigned long)(cur_dma_ptr<<4) + XILINX_TxDMA_DESCRIPTOR_HI; - reg=0; - wan_set_bit(INIT_DMA_FIFO_CMD_BIT,®); - - DEBUG_TEST("%s: Clearing TX Fifo %s DmaDescr=(0x%X) Reg=(0x%X)\n", - __FUNCTION__,chan->if_name, - dma_descr,reg); - - card->hw_iface.bus_write_4(card->hw,dma_descr,reg); - - if (wait == WP_WAIT){ - for(i=0;ihw_iface.bus_read_4(card->hw,dma_descr,®); - if (wan_test_bit(INIT_DMA_FIFO_CMD_BIT,®)){ - WP_DELAY(FIFO_RESET_TIMEOUT_US); - continue; - } - timeout=0; - break; - } - - if (timeout){ - DEBUG_EVENT("%s:%s: Error: Tx fifo reset timedout %u us\n", - card->devname,chan->if_name,i*FIFO_RESET_TIMEOUT_US); - }else{ - DEBUG_TEST("%s:%s: Tx Fifo Reset Successful\n", - card->devname,chan->if_name); - } - }else{ - timeout=0; - } - - return timeout; -} - - -static void xilinx_dev_enable(sdla_t *card, private_area_t *chan) -{ - u32 reg; - - DEBUG_TEST("%s: Enabling Global Inter Mask !\n",chan->if_name); - - /* Enable Logic Channel Interrupts for DMA and fifo */ - card->hw_iface.bus_read_4(card->hw, - XILINX_GLOBAL_INTER_MASK, ®); - wan_set_bit(chan->logic_ch_num,®); - - card->hw_iface.bus_write_4(card->hw, - XILINX_GLOBAL_INTER_MASK, reg); - - wan_set_bit(chan->logic_ch_num,&card->u.xilinx.active_ch_map); -} - - - -static void xilinx_dev_close(sdla_t *card, private_area_t *chan) -{ - u32 reg; - - DEBUG_CFG("-- Close Xilinx device. --\n"); - - /* Disable Logic Channel Interrupts for DMA and fifo */ - card->hw_iface.bus_read_4(card->hw, - XILINX_GLOBAL_INTER_MASK, ®); - - wan_clear_bit(chan->logic_ch_num,®); - wan_clear_bit(chan->logic_ch_num,&card->u.xilinx.active_ch_map); - - /* We are masking the chan interrupt. - * Lock to make sure that the interrupt is - * not running */ - card->hw_iface.bus_write_4(card->hw, - XILINX_GLOBAL_INTER_MASK, reg); - - - aft_reset_rx_watchdog(card); - aft_reset_tx_watchdog(card); - - reg=0; - - /* Select an HDLC logic channel for configuration */ - card->hw_iface.bus_read_4(card->hw, XILINX_TIMESLOT_HDLC_CHAN_REG, ®); - - reg&=~HDLC_LOGIC_CH_BIT_MASK; - reg&= HDLC_LCH_TIMESLOT_MASK; /* mask not valid bits */ - - card->hw_iface.bus_write_4(card->hw, - XILINX_TIMESLOT_HDLC_CHAN_REG, - (reg|(chan->logic_ch_num&HDLC_LOGIC_CH_BIT_MASK))); - - - reg=0; - xilinx_write_ctrl_hdlc(card, - chan->first_time_slot, - XILINX_HDLC_CONTROL_REG, - reg); - - /* Initialize DMA descriptors and DMA Chains */ - aft_init_tx_rx_dma_descr(chan); - -} - -/**SECTION************************************************************* - * - * TX Handlers - * - **********************************************************************/ - - -/*=============================================== - * xilinx_dma_tx_complete - * - */ -static void xilinx_dma_tx_complete (sdla_t *card, private_area_t *chan, int wtd) -{ - DEBUG_TEST("%s: Tx interrupt wtd=%d\n",chan->if_name,wtd); - - aft_reset_tx_watchdog(card); - - if (!wtd){ - wan_clear_bit(TX_INTR_PENDING,&chan->dma_chain_status); - } - - aft_tx_dma_chain_handler((unsigned long)chan); - - - if (WAN_NETIF_QUEUE_STOPPED(chan->common.dev)){ - WAN_NETIF_WAKE_QUEUE(chan->common.dev); -#ifndef CONFIG_PRODUCT_WANPIPE_GENERIC - if (chan->common.usedby == API){ - wan_wakeup_api(chan); - }else if (chan->common.usedby == STACK){ - wanpipe_lip_kick(chan,0); - } -#endif - } - - if (!chan->single_dma_chain){ - aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); - } - - return; -} - -/*=============================================== - * xilinx_tx_post_complete - * - */ -static void xilinx_tx_post_complete (sdla_t *card, private_area_t *chan, netskb_t *skb) -{ - unsigned long reg = wan_skb_csum(skb); - - if ((wan_test_bit(TxDMA_HI_DMA_GO_READY_BIT,®)) || - (reg & TxDMA_HI_DMA_DATA_LENGTH_MASK) || - (reg&TxDMA_HI_DMA_PCI_ERROR_MASK)){ - - DEBUG_EVENT("%s:%s: Tx DMA Descriptor=0x%lX\n", - card->devname,chan->if_name,reg); - - /* Checking Tx DMA Go bit. Has to be '0' */ - if (wan_test_bit(TxDMA_HI_DMA_GO_READY_BIT,®)){ - DEBUG_TEST("%s:%s: Error: TxDMA Intr: GO bit set on Tx intr\n", - card->devname,chan->if_name); - chan->errstats.Tx_dma_errors++; - } - - if (reg & TxDMA_HI_DMA_DATA_LENGTH_MASK){ - DEBUG_TEST("%s:%s: Error: TxDMA Length not equal 0 \n", - card->devname,chan->if_name); - chan->errstats.Tx_dma_len_nonzero++; - } - - /* Checking Tx DMA PCI error status. Has to be '0's */ - if (reg&TxDMA_HI_DMA_PCI_ERROR_MASK){ - - chan->errstats.Tx_pci_errors++; - - if (reg & TxDMA_HI_DMA_PCI_ERROR_M_ABRT){ - DEBUG_EVENT("%s:%s: Tx Error: Abort from Master: pci fatal error!\n", - card->devname,chan->if_name); - } - if (reg & TxDMA_HI_DMA_PCI_ERROR_T_ABRT){ - DEBUG_EVENT("%s:%s: Tx Error: Abort from Target: pci fatal error!\n", - card->devname,chan->if_name); - } - if (reg & TxDMA_HI_DMA_PCI_ERROR_DS_TOUT){ - DEBUG_EVENT("%s:%s: Tx Warning: PCI Latency Timeout!\n", - card->devname,chan->if_name); - chan->errstats.Tx_pci_latency++; - goto tx_post_ok; - } - if (reg & TxDMA_HI_DMA_PCI_ERROR_RETRY_TOUT){ - DEBUG_EVENT("%s:%s: Tx Error: 'Retry' exceeds maximum (64k): pci fatal error!\n", - card->devname,chan->if_name); - } - } - chan->if_stats.tx_errors++; - goto tx_post_exit; - } - -tx_post_ok: - chan->opstats.Data_frames_Tx_count++; - chan->opstats.Data_bytes_Tx_count+=wan_skb_len(skb); - chan->if_stats.tx_packets++; - chan->if_stats.tx_bytes+=wan_skb_len(skb); - - /* Indicate that the first tx frame went - * out on the transparent link */ - wan_set_bit(0,&chan->idle_start); - - wan_capture_trace_packet(card, &chan->trace_info, skb, TRC_OUTGOING_FRM); - -tx_post_exit: - - return; -} - - - -/**SECTION************************************************************* - * - * RX Handlers - * - **********************************************************************/ - -/*=============================================== - * xilinx_dma_rx_complete - * - */ -static void xilinx_dma_rx_complete (sdla_t *card, private_area_t *chan, int wtd) -{ - aft_reset_rx_watchdog(card); - aft_rx_dma_chain_handler(chan,wtd,0); -} - -/*=============================================== - * xilinx_rx_post_complete - * - */ -static void xilinx_rx_post_complete (sdla_t *card, private_area_t *chan, - netskb_t *skb, - netskb_t **new_skb, - unsigned char *pkt_error) -{ - - unsigned int len,data_error = 0; - unsigned char *buf; - -#if 0 - wp_rx_element_t *rx_el=(wp_rx_element_t *)&skb->cb[0]; -#else - wp_rx_element_t *rx_el; - rx_el=(wp_rx_element_t *)wan_skb_data(skb); -#endif - DEBUG_RX("%s:%s: RX HI=0x%X LO=0x%X\n DMA=0x%lX", - __FUNCTION__,chan->if_name,rx_el->reg,rx_el->align,rx_el->dma_addr); - -#if 0 - chan->if_stats.rx_errors++; -#endif - - rx_el->align&=RxDMA_LO_ALIGNMENT_BIT_MASK; - *pkt_error=0; - *new_skb=NULL; - - - /* Checking Rx DMA Go bit. Has to be '0' */ - if (wan_test_bit(RxDMA_HI_DMA_GO_READY_BIT,&rx_el->reg)){ - DEBUG_TEST("%s:%s: Error: RxDMA Intr: GO bit set on Rx intr\n", - card->devname,chan->if_name); - chan->if_stats.rx_errors++; - chan->errstats.Rx_dma_descr_err++; - goto rx_comp_error; - } - - /* Checking Rx DMA PCI error status. Has to be '0's */ - if (rx_el->reg&RxDMA_HI_DMA_PCI_ERROR_MASK){ - - if (rx_el->reg & RxDMA_HI_DMA_PCI_ERROR_M_ABRT){ - DEBUG_EVENT("%s:%s: Rx Error: Abort from Master: pci fatal error!\n", - card->devname,chan->if_name); - } - if (rx_el->reg & RxDMA_HI_DMA_PCI_ERROR_T_ABRT){ - DEBUG_EVENT("%s:%s: Rx Error: Abort from Target: pci fatal error!\n", - card->devname,chan->if_name); - } - if (rx_el->reg & RxDMA_HI_DMA_PCI_ERROR_DS_TOUT){ - DEBUG_EVENT("%s:%s: Rx Error: No 'DeviceSelect' from target: pci fatal error!\n", - card->devname,chan->if_name); - } - if (rx_el->reg & RxDMA_HI_DMA_PCI_ERROR_RETRY_TOUT){ - DEBUG_EVENT("%s:%s: Rx Error: 'Retry' exceeds maximum (64k): pci fatal error!\n", - card->devname,chan->if_name); - } - - DEBUG_EVENT("%s: RXDMA PCI ERROR = 0x%x\n",chan->if_name,rx_el->reg); - chan->errstats.Rx_pci_errors++; - chan->if_stats.rx_errors++; - goto rx_comp_error; - } - - if (chan->hdlc_eng){ - - /* Checking Rx DMA Frame start bit. (information for api) */ - if (!wan_test_bit(RxDMA_HI_DMA_FRAME_START_BIT,&rx_el->reg)){ - DEBUG_TEST("%s:%s RxDMA Intr: Start flag missing: MTU Mismatch! Reg=0x%X\n", - card->devname,chan->if_name,rx_el->reg); - chan->if_stats.rx_frame_errors++; - chan->opstats.Rx_Data_discard_long_count++; - chan->errstats.Rx_hdlc_corrupiton++; - goto rx_comp_error; - } - - /* Checking Rx DMA Frame end bit. (information for api) */ - if (!wan_test_bit(RxDMA_HI_DMA_FRAME_END_BIT,&rx_el->reg)){ - DEBUG_TEST("%s:%s: RxDMA Intr: End flag missing: MTU Mismatch! Reg=0x%X\n", - card->devname,chan->if_name,rx_el->reg); - chan->if_stats.rx_frame_errors++; - chan->opstats.Rx_Data_discard_long_count++; - chan->errstats.Rx_hdlc_corrupiton++; - goto rx_comp_error; - - } else { /* Check CRC error flag only if this is the end of Frame */ - - if (wan_test_bit(RxDMA_HI_DMA_CRC_ERROR_BIT,&rx_el->reg)){ - DEBUG_TEST("%s:%s: RxDMA Intr: CRC Error! Reg=0x%X Len=%i\n", - card->devname,chan->if_name,rx_el->reg, - (rx_el->reg&RxDMA_HI_DMA_DATA_LENGTH_MASK)>>2); - chan->if_stats.rx_frame_errors++; - chan->opstats.Rx_Data_discard_long_count++; - chan->errstats.Rx_hdlc_corrupiton++; - wan_set_bit(WP_CRC_ERROR_BIT,&rx_el->pkt_error); - data_error = 1; - } - - /* Check if this frame is an abort, if it is - * drop it and continue receiving */ - if (wan_test_bit(RxDMA_HI_DMA_FRAME_ABORT_BIT,&rx_el->reg)){ - DEBUG_TEST("%s:%s: RxDMA Intr: Abort! Reg=0x%X\n", - card->devname,chan->if_name,rx_el->reg); - chan->if_stats.rx_frame_errors++; - chan->opstats.Rx_Data_discard_long_count++; - chan->errstats.Rx_hdlc_corrupiton++; - wan_set_bit(WP_ABORT_ERROR_BIT,&rx_el->pkt_error); - data_error = 1; - } - - if (chan->common.usedby != API && data_error){ - goto rx_comp_error; - } - } - } - - len=rx_el->reg&RxDMA_HI_DMA_DATA_LENGTH_MASK; - - if (chan->hdlc_eng){ - /* In HDLC mode, calculate rx length based - * on alignment value, received from DMA */ - len=((((chan->dma_mtu>>2)-1)-len)<<2) - (~(rx_el->align)&RxDMA_LO_ALIGNMENT_BIT_MASK); - }else{ - /* In Transparent mode, our RX buffer will always be - * aligned to the 32bit (word) boundary, because - * the RX buffers are all of equal length */ - len=(((card->wandev.mtu>>2)-len)<<2) - (~(0x03)&RxDMA_LO_ALIGNMENT_BIT_MASK); - } - - *pkt_error=rx_el->pkt_error; - - /* After a RX FIFO overflow, we must mark max 7 - * subsequent frames since firmware, cannot - * guarantee the contents of the fifo */ - - if (wan_test_bit(WP_FIFO_ERROR_BIT,&rx_el->pkt_error)){ - if (++chan->rx_fifo_err_cnt >= WP_MAX_FIFO_FRAMES){ - chan->rx_fifo_err_cnt=0; - } - wan_set_bit(WP_FIFO_ERROR_BIT,pkt_error); - }else{ - if (chan->rx_fifo_err_cnt){ - if (++chan->rx_fifo_err_cnt >= WP_MAX_FIFO_FRAMES){ - chan->rx_fifo_err_cnt=0; - } - wan_set_bit(WP_FIFO_ERROR_BIT,pkt_error); - } - } - - wan_skb_pull(skb, sizeof(wp_rx_element_t)); - - if (len > aft_rx_copyback){ - /* The rx size is big enough, thus - * send this buffer up the stack - * and allocate another one */ - wan_skb_put(skb,len); - *new_skb=skb; - - aft_alloc_rx_dma_buff(card,chan,1); - }else{ - - /* The rx packet is very - * small thus, allocate a new - * buffer and pass it up */ - *new_skb=wan_skb_alloc(len + 20); - if (!*new_skb){ - DEBUG_EVENT("%s:%s: Failed to allocate rx skb pkt (len=%i)!\n", - card->devname,chan->if_name,(len+20)); - chan->if_stats.rx_dropped++; - goto rx_comp_error; - } - - buf=wan_skb_put((*new_skb),len); - memcpy(buf,wan_skb_tail(skb),len); - - aft_init_requeue_free_skb(chan, skb); - } - - return; - -rx_comp_error: - - aft_init_requeue_free_skb(chan, skb); - return; -} - - - -/**SECTION************************************************** - * - * Logic Channel Registration Support and - * Utility funcitons - * - **********************************************************/ - -static int aft_init_requeue_free_skb(private_area_t *chan, netskb_t *skb) -{ - wan_skb_init(skb,16); - wan_skb_trim(skb,0); -#if 0 - memset(&skb->cb[0],0,sizeof(wp_rx_element_t)); -#endif - wan_skb_queue_tail(&chan->wp_rx_free_list,skb); - - return 0; -} - -static int aft_alloc_rx_dma_buff(sdla_t *card, private_area_t *chan, int num) -{ - int i; - netskb_t *skb; - - for (i=0;idma_mtu); - if (!skb){ - DEBUG_EVENT("%s: %s no memory\n", - chan->if_name,__FUNCTION__); - return -ENOMEM; - } - wan_skb_queue_tail(&chan->wp_rx_free_list,skb); - } - - return 0; -} - - -/*============================================================================ - * Enable timer interrupt - */ -static void enable_timer (void* card_id) -{ - sdla_t* card = (sdla_t*)card_id; - - DEBUG_TEST("%s: %s Sdla Polling!\n",__FUNCTION__,card->devname); - -#if defined(__LINUX__) - wan_set_bit(AFT_FE_POLL,&card->u.aft.port_task_cmd); - WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); -#else - { - wan_smp_flag_t smp_flags, smp_flags1; - card->hw_iface.hw_lock(card->hw,&smp_flags1); - wan_spin_lock_irq(&card->wandev.lock, &smp_flags); - WAN_FECALL(&card->wandev, polling, (&card->fe)); - wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); - card->hw_iface.hw_unlock(card->hw,&smp_flags1); - } -#endif - return; -} - -/**SECTION************************************************** - * - * API Bottom Half Handlers - * - **********************************************************/ - -#if defined(__LINUX__) -static void wp_bh (unsigned long data) -#else -static void wp_bh (void* data, int dummy) -#endif -{ - private_area_t* chan = (private_area_t *)data; - netskb_t *new_skb,*skb; - unsigned char pkt_error; - unsigned long timeout=SYSTEM_TICKS; - - DEBUG_TEST("%s: ------------ BEGIN --------------: %lu\n", - __FUNCTION__,SYSTEM_TICKS); - - if (!wan_test_bit(0,&chan->up)){ - DEBUG_EVENT("%s: wp_bh() chan not up!\n", - chan->if_name); - WAN_TASKLET_END((&chan->common.bh_task)); - return; - } - - - while((skb=wan_skb_dequeue(&chan->wp_rx_complete_list)) != NULL){ - -#if 0 - chan->if_stats.rx_errors++; -#endif - - if (SYSTEM_TICKS-timeout > 3){ - chan->if_stats.rx_errors++; -#if 0 - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: BH Squeeze!\n",chan->if_name); - } -#endif - wan_skb_queue_head(&chan->wp_rx_complete_list,skb); - break; - } - - if (chan->common.usedby == API && chan->common.sk == NULL){ - DEBUG_TEST("%s: No sock bound to channel rx dropping!\n", - chan->if_name); - chan->if_stats.rx_dropped++; - aft_init_requeue_free_skb(chan, skb); - - continue; - } - - new_skb=NULL; - pkt_error=0; - - /* The post function will take care - * of the skb and new_skb buffer. - * If new_skb buffer exists, driver - * must pass it up the stack, or free it */ - xilinx_rx_post_complete (chan->card, chan, - skb, - &new_skb, - &pkt_error); - if (new_skb){ - - int len=wan_skb_len(new_skb); - - wan_capture_trace_packet(chan->card, &chan->trace_info, - new_skb,TRC_INCOMING_FRM); - - if (chan->common.usedby == API){ -#if defined(__LINUX__) -# ifndef CONFIG_PRODUCT_WANPIPE_GENERIC - - /* Only for API, we insert packet status - * byte to indicate a packet error. Take - * this byte and put it in the api header */ - - if (wan_skb_headroom(new_skb) >= sizeof(api_rx_hdr_t)){ - api_rx_hdr_t *rx_hdr= - (api_rx_hdr_t*)skb_push(new_skb,sizeof(api_rx_hdr_t)); - memset(rx_hdr,0,sizeof(api_rx_hdr_t)); - rx_hdr->error_flag=pkt_error; - }else{ - int hroom=wan_skb_headroom(new_skb); - int rx_sz=sizeof(api_rx_hdr_t); - DEBUG_EVENT("%s: Error Rx pkt headroom %i < %i\n", - chan->if_name, - hroom, - rx_sz); - ++chan->if_stats.rx_dropped; - wan_skb_free(new_skb); - continue; - } - - new_skb->protocol = htons(PVC_PROT); - wan_skb_reset_mac_header(new_skb); - new_skb->dev = chan->common.dev; - new_skb->pkt_type = WAN_PACKET_DATA; -#if 0 - chan->if_stats.rx_frame_errors++; -#endif - if (wan_api_rx(chan,new_skb) != 0){ - DEBUG_TEST("%s: Error: Rx Socket busy!\n", - chan->if_name); - ++chan->if_stats.rx_dropped; - wan_skb_free(new_skb); - continue; - } -# endif -#endif - - }else if (chan->common.usedby == STACK){ - - if (wanpipe_lip_rx(chan,new_skb) != 0){ - ++chan->if_stats.rx_dropped; - wan_skb_free(new_skb); - continue; - } - - }else{ - protocol_recv(chan->card,chan,new_skb); - } - - chan->opstats.Data_frames_Rx_count++; - chan->opstats.Data_bytes_Rx_count+=len; - chan->if_stats.rx_packets++; - chan->if_stats.rx_bytes+=len; - } - - if (SYSTEM_TICKS-timeout > 3){ - chan->if_stats.rx_errors++; -#if 0 - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: BH Squeeze! %i\n", - chan->if_name,SYSTEM_TICKS-timeout); - } -#endif - break; - } - } - - while((skb=wan_skb_dequeue(&chan->wp_tx_complete_list)) != NULL){ - xilinx_tx_post_complete (chan->card,chan,skb); - wan_skb_free(skb); - } - - - WAN_TASKLET_END((&chan->common.bh_task)); -#if 1 - { - int len; - if ((len=wan_skb_queue_len(&chan->wp_rx_complete_list))){ - DEBUG_TEST("%s: Triggering from bh rx=%i\n",chan->if_name,len); - WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); - }else if ((len=wan_skb_queue_len(&chan->wp_tx_complete_list))){ - DEBUG_TEST("%s: Triggering from bh tx=%i\n",chan->if_name,len); - WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); - } - } -#endif - - DEBUG_TEST("%s: ------------ END -----------------: %lu\n", - __FUNCTION__,SYSTEM_TICKS); - - return; -} - -/**SECTION************************************************** - * - * Interrupt Support Functions - * - **********************************************************/ - -static int fifo_error_interrupt(sdla_t *card, u32 reg, u32 tx_status, u32 rx_status) -{ - u32 err=0; - u32 i; - private_area_t *chan; - int num_of_logic_ch; - - - if (card->wandev.state != WAN_CONNECTED){ - DEBUG_EVENT("%s: Warning: Ignoring Error Intr: link disc!\n", - card->devname); - return 0; - } - - if (IS_TE3(&card->fe.fe_cfg)){ - num_of_logic_ch=1; - }else{ - num_of_logic_ch=card->u.xilinx.num_of_time_slots; - } - - if (tx_status != 0){ - for (i=0;iu.xilinx.logic_ch_map)){ - - chan=(private_area_t*)card->u.xilinx.dev_to_ch_map[i]; - if (!chan){ - DEBUG_EVENT("Warning: ignoring tx error intr: no dev!\n"); - continue; - } - - if (!wan_test_bit(0,&chan->up)){ - DEBUG_EVENT("%s: Warning: ignoring tx error intr: dev down 0x%X UP=0x%X!\n", - wan_netif_name(chan->common.dev),chan->common.state,chan->ignore_modem); - continue; - } - - if (chan->common.state != WAN_CONNECTED){ - DEBUG_EVENT("%s: Warning: ignoring tx error intr: dev disc!\n", - wan_netif_name(chan->common.dev)); - continue; - } - - if (!chan->hdlc_eng && !wan_test_bit(0,&chan->idle_start)){ - DEBUG_EVENT("%s: Warning: ignoring tx error intr: dev init error!\n", - wan_netif_name(chan->common.dev)); - if (chan->hdlc_eng){ - xilinx_tx_fifo_under_recover(card,chan); - } - continue; - } - DEBUG_TEST("%s:%s: Warning TX Fifo Error on LogicCh=%li Slot=%i!\n", - card->devname,chan->if_name,chan->logic_ch_num,i); - - xilinx_tx_fifo_under_recover(card,chan); - ++chan->if_stats.tx_fifo_errors; - err=-EINVAL; - } - } - } - - - if (rx_status != 0){ - for (i=0;iu.xilinx.logic_ch_map)){ - chan=(private_area_t*)card->u.xilinx.dev_to_ch_map[i]; - if (!chan){ - continue; - } - - if (!wan_test_bit(0,&chan->up)){ - DEBUG_EVENT("%s: Warning: ignoring rx error intr: dev down 0x%X UP=0x%X!\n", - wan_netif_name(chan->common.dev),chan->common.state,chan->ignore_modem); - continue; - } - - if (chan->common.state != WAN_CONNECTED){ - DEBUG_EVENT("%s: Warning: ignoring rx error intr: dev disc!\n", - wan_netif_name(chan->common.dev)); - continue; - } - - DEBUG_TEST("%s:%s: Warning RX Fifo Error on LCh=%li Slot=%i RxCL=%i RxFL=%i RxDMA=%i\n", - card->devname,chan->if_name,chan->logic_ch_num,i, - wan_skb_queue_len(&chan->wp_rx_complete_list), - wan_skb_queue_len(&chan->wp_rx_free_list), - chan->rx_dma); - - ++chan->if_stats.rx_fifo_errors; -#if 0 -{ - unsigned long dma_descr; - unsigned int reg; - dma_descr=(chan->logic_ch_num<<4) + XILINX_RxDMA_DESCRIPTOR_HI; - card->hw_iface.bus_read_4(card->hw, dma_descr, ®); - DEBUG_EVENT("%s: Hi Descriptor 0x%X\n",chan->if_name,reg); -} -#endif - - wan_set_bit(WP_FIFO_ERROR_BIT, &chan->pkt_error); - - err=-EINVAL; - } - } - } - - return err; -} - - -static void front_end_interrupt(sdla_t *card, unsigned long reg) -{ - /* FIXME: To be filled by ALEX :) */ - DEBUG_TE3("%s: front_end_interrupt!\n",card->devname); - -// wp_debug_func_add(__FUNCTION__); - - if (IS_TE3(&card->fe.fe_cfg)){ - /* FIXME HANDLE T3 Interrupt */ - WAN_FECALL(&card->wandev, isr, (&card->fe)); - }else{ - DEBUG_EVENT("%s: Internal Error (Never should happened)!\n", - card->devname); - } - - handle_front_end_state(card); - return; -} - -/**SECTION*************************************************************** - * - * HARDWARE Interrupt Handlers - * - ***********************************************************************/ - - -/*============================================================================ - * wpfw_isr - * - * Main interrupt service routine. - * Determin the interrupt received and handle it. - * - */ -static WAN_IRQ_RETVAL wp_aft_te3_isr (sdla_t* card) -{ - int i; - u32 reg; - u32 dma_tx_reg,dma_rx_reg,rx_fifo_status=0,tx_fifo_status=0; - private_area_t *chan; - int skip_rx_wtd=0; - WAN_IRQ_RETVAL_DECL(irq_ret); - - if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ - WAN_IRQ_RETURN(irq_ret); - } - - wan_set_bit(0,&card->in_isr); - - /* -----------------2/6/2003 9:02AM------------------ - * Disable all chip Interrupts (offset 0x040) - * -- "Transmit/Receive DMA Engine" interrupt disable - * -- "FiFo/Line Abort Error" interrupt disable - * --------------------------------------------------*/ - card->hw_iface.bus_read_4(card->hw,XILINX_CHIP_CFG_REG, ®); - - DEBUG_TEST("\n"); - DEBUG_TEST("%s: ISR (0x%X) = 0x%08X \n", - card->devname,XILINX_CHIP_CFG_REG,reg); - - if (wan_test_bit(ENABLE_TE3_FRACTIONAL,®)){ - unsigned int frc_crc; - u32 freg; - - card->hw_iface.bus_read_4(card->hw,TE3_FRACT_ENCAPSULATION_REG, &freg); - frc_crc=get_te3_rx_fract_crc_cnt(freg); - if (frc_crc){ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: TE3 Frac CRC Cnt = %i 0x%08X\n", - card->devname, frc_crc,reg); - } - } - } - - if (wan_test_bit(SECURITY_STATUS_FLAG,®)){ - WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); - if (++card->u.aft.chip_security_cnt > - AFT_MAX_CHIP_SECURITY_CNT){ - -#if 1 - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: Critical: Chip Security Compromised: Disabling Driver (%i)!\n", - card->devname,card->u.aft.chip_security_cnt); - } - card->u.aft.chip_security_cnt=0; - aft_critical_shutdown(card); - goto isr_end; -#else - - DEBUG_EVENT("%s: Critical: Chip Security Compromised: Disabling Driver (%i)!\n", - card->devname,card->u.aft.chip_security_cnt); - DEBUG_EVENT("%s: Please call Sangoma Tech Support (www.sangoma.com)!\n", - card->devname); - - - aft_critical_shutdown(card); - goto isr_end; -#endif - } - }else{ - card->u.aft.chip_security_cnt=0; - } - - /* Note: If interrupts are received without pending - * flags, it usually indicates that the interrupt - * is being shared. (Check 'cat /proc/interrupts') - */ - - if (wan_test_bit(FRONT_END_INTR_ENABLE_BIT,®)){ - if (wan_test_bit(FRONT_END_INTR_FLAG,®)){ - WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); -#if defined(__LINUX__) - wan_set_bit(AFT_FE_INTR,&card->u.aft.port_task_cmd); - WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); - - __aft_fe_intr_ctrl(card,0); -#else - front_end_interrupt(card,reg); -#endif - } - } - - /* Test Fifo Error Interrupt, - * If set shutdown all interfaces and - * reconfigure */ - if (wan_test_bit(ERROR_INTR_ENABLE_BIT,®)){ - if (wan_test_bit(ERROR_INTR_FLAG,®)){ - WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); - - card->hw_iface.bus_read_4(card->hw,XILINX_HDLC_TX_INTR_PENDING_REG,&tx_fifo_status); - card->hw_iface.bus_read_4(card->hw,XILINX_HDLC_RX_INTR_PENDING_REG,&rx_fifo_status); - - rx_fifo_status&=card->u.aft.active_ch_map; - tx_fifo_status&=card->u.aft.active_ch_map; - - fifo_error_interrupt(card,reg,tx_fifo_status,rx_fifo_status); - } - } - - /* -----------------2/6/2003 9:37AM------------------ - * Checking for Interrupt source: - * 1. Receive DMA Engine - * 2. Transmit DMA Engine - * 3. Error conditions. - * --------------------------------------------------*/ - if (wan_test_bit(GLOBAL_INTR_ENABLE_BIT,®) && - (wan_test_bit(DMA_INTR_FLAG,®) || rx_fifo_status)){ - - int num_of_logic_ch; - - WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); - - if (IS_TE3(&card->fe.fe_cfg)){ - num_of_logic_ch=1; - }else{ - num_of_logic_ch=card->u.xilinx.num_of_time_slots; - } - - /* Receive DMA Engine */ - card->hw_iface.bus_read_4(card->hw, - XILINX_DMA_RX_INTR_PENDING_REG, - &dma_rx_reg); - - - DEBUG_TEST("%s: DMA_RX_INTR_REG(0x%X) = 0x%X ActCH=0x%lX\n", - card->devname, - XILINX_DMA_RX_INTR_PENDING_REG,dma_rx_reg, - card->u.xilinx.active_ch_map); - - dma_rx_reg&=card->u.xilinx.active_ch_map; - - if (dma_rx_reg == 0 && rx_fifo_status == 0){ - goto isr_skb_rx; - } - - for (i=0; iu.xilinx.logic_ch_map)){ - - chan=(private_area_t*)card->u.xilinx.dev_to_ch_map[i]; - if (!chan){ - DEBUG_EVENT("%s: Error: No Dev for Rx logical ch=%i\n", - card->devname,i); - continue; - } - - if (!wan_test_bit(0,&chan->up)){ - DEBUG_EVENT("%s: Error: Dev not up for Rx logical ch=%i\n", - card->devname,i); - continue; - } - -#if 0 - chan->if_stats.rx_frame_errors++; -#endif - - DEBUG_ISR("%s: RX Interrupt pend. \n", - card->devname); - xilinx_dma_rx_complete(card,chan,0); - skip_rx_wtd=1; - } - } -isr_skb_rx: - - /* Transmit DMA Engine */ - - card->hw_iface.bus_read_4(card->hw, - XILINX_DMA_TX_INTR_PENDING_REG, - &dma_tx_reg); - - dma_tx_reg&=card->u.xilinx.active_ch_map; - - DEBUG_TEST("%s: DMA_TX_INTR_REG(0x%X) = 0x%X, ChMap=0x%lX NumofCh=%i\n", - card->devname, - XILINX_DMA_TX_INTR_PENDING_REG, - dma_tx_reg, - card->u.xilinx.active_ch_map, - num_of_logic_ch); - - if (dma_tx_reg == 0){ - goto isr_skb_tx; - } - - for (i=0; iu.xilinx.logic_ch_map)){ - chan=(private_area_t*)card->u.xilinx.dev_to_ch_map[i]; - if (!chan){ - DEBUG_EVENT("%s: Error: No Dev for Tx logical ch=%i\n", - card->devname,i); - continue; - } - - if (!wan_test_bit(0,&chan->up)){ - DEBUG_EVENT("%s: Error: Dev not up for Tx logical ch=%i\n", - card->devname,i); - continue; - } - - - DEBUG_TEST("---- TX Interrupt pend. --\n"); - xilinx_dma_tx_complete(card,chan,0); - - }else{ - DEBUG_EVENT("Failed Testing for Tx Timeslot %i TxReg=0x%X ChMap=0x%lX\n",i, - dma_tx_reg,card->u.xilinx.logic_ch_map); - } - } - } - -isr_skb_tx: - - DEBUG_ISR("---- ISR SKB TX end.-------------------\n"); - - if (wan_test_bit(AFT_TE3_TX_WDT_INTR_PND,®)){ - WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); - aft_reset_tx_watchdog(card); - chan=(private_area_t*)card->u.xilinx.dev_to_ch_map[0]; - if (chan && wan_test_bit(0,&chan->up)){ -#if 0 - ++chan->if_stats.tx_dropped; -#endif - xilinx_dma_tx_complete (card,chan,1); - } - DEBUG_TEST("%s: Tx WatchDog Expired!\n",card->devname); - aft_reset_tx_watchdog(card); - } - - if (wan_test_bit(AFT_TE3_RX_WDT_INTR_PND,®)){ - WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); - aft_reset_rx_watchdog(card); - chan=(private_area_t*)card->u.xilinx.dev_to_ch_map[0]; - if (!skip_rx_wtd && chan && wan_test_bit(0,&chan->up)){ -#if 0 - chan->if_stats.rx_dropped++; -#endif - xilinx_dma_rx_complete (card,chan,1); - }else{ - if (chan){ - DEBUG_TEST("%s: Skipping Rx WTD Flags=%d\n", - chan->if_name,wan_test_bit(0,&chan->up)); - } - aft_reset_rx_watchdog(card); - aft_enable_rx_watchdog(card,AFT_MAX_WTD_TIMEOUT); - } - - DEBUG_TEST("%s: Rx WatchDog Expired %p!\n", - card->devname,chan); - } - - - /* -----------------2/6/2003 10:36AM----------------- - * Finish of the interupt handler - * --------------------------------------------------*/ -isr_end: - DEBUG_ISR("---- ISR end.-------------------\n"); - wan_clear_bit(0,&card->in_isr); - WAN_IRQ_RETURN(irq_ret); -} - - - -/**SECTION*********************************************************** - * - * WANPIPE Debugging Interfaces - * - ********************************************************************/ - - - -/*============================================================================= - * process_udp_mgmt_pkt - * - * Process all "wanpipemon" debugger commands. This function - * performs all debugging tasks: - * - * Line Tracing - * Line/Hardware Statistics - * Protocol Statistics - * - * "wanpipemon" utility is a user-space program that - * is used to debug the WANPIPE product. - * - */ -#if 1 -static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, - private_area_t* chan, int local_dev ) -{ - unsigned short buffer_length; - wan_udp_pkt_t *wan_udp_pkt; - wan_trace_t *trace_info=NULL; - - wan_udp_pkt = (wan_udp_pkt_t *)chan->udp_pkt_data; - - if (wan_atomic_read(&chan->udp_pkt_len) == 0){ - return -ENODEV; - } - - trace_info=&chan->trace_info; - wan_udp_pkt = (wan_udp_pkt_t *)chan->udp_pkt_data; - - { - - netskb_t *skb; - - wan_udp_pkt->wan_udp_opp_flag = 0; - - switch(wan_udp_pkt->wan_udp_command) { - - case READ_CONFIGURATION: - case READ_CODE_VERSION: - wan_udp_pkt->wan_udp_return_code = 0; - wan_udp_pkt->wan_udp_data_len=0; - break; - - - case ENABLE_TRACING: - - wan_udp_pkt->wan_udp_return_code = WAN_CMD_OK; - wan_udp_pkt->wan_udp_data_len = 0; - - if (!wan_test_bit(0,&trace_info->tracing_enabled)){ - - trace_info->trace_timeout = SYSTEM_TICKS; - - wan_trace_purge(trace_info); - - if (wan_udp_pkt->wan_udp_data[0] == 0){ - wan_clear_bit(1,&trace_info->tracing_enabled); - DEBUG_UDP("%s: TE3 trace enabled!\n", - card->devname); - }else if (wan_udp_pkt->wan_udp_data[0] == 1){ - wan_clear_bit(2,&trace_info->tracing_enabled); - wan_set_bit(1,&trace_info->tracing_enabled); - DEBUG_UDP("%s: TE3 trace enabled!\n", - card->devname); - }else{ - wan_clear_bit(1,&trace_info->tracing_enabled); - wan_set_bit(2,&trace_info->tracing_enabled); - DEBUG_UDP("%s: TE3 trace enabled!\n", - card->devname); - } - wan_set_bit (0,&trace_info->tracing_enabled); - - }else{ - DEBUG_EVENT("%s: Error: TE3 trace already running!\n", - card->devname); - wan_udp_pkt->wan_udp_return_code = 2; - } - - break; - - case DISABLE_TRACING: - - wan_udp_pkt->wan_udp_return_code = WAN_CMD_OK; - - if(wan_test_bit(0,&trace_info->tracing_enabled)) { - - wan_clear_bit(0,&trace_info->tracing_enabled); - wan_clear_bit(1,&trace_info->tracing_enabled); - wan_clear_bit(2,&trace_info->tracing_enabled); - - wan_trace_purge(trace_info); - - DEBUG_UDP("%s: Disabling TE3 trace\n", - card->devname); - - }else{ - /* set return code to line trace already - disabled */ - wan_udp_pkt->wan_udp_return_code = 1; - } - - break; - - case GET_TRACE_INFO: - - if(wan_test_bit(0,&trace_info->tracing_enabled)){ - trace_info->trace_timeout = SYSTEM_TICKS; - }else{ - DEBUG_EVENT("%s: Error TE3 trace not enabled\n", - card->devname); - /* set return code */ - wan_udp_pkt->wan_udp_return_code = 1; - break; - } - - buffer_length = 0; - wan_udp_pkt->wan_udp_atm_num_frames = 0; - wan_udp_pkt->wan_udp_atm_ismoredata = 0; - -#if defined(__FreeBSD__) || defined(__OpenBSD__) - while (wan_skb_queue_len(&trace_info->trace_queue)){ - WAN_IFQ_POLL(&trace_info->trace_queue, skb); - if (skb == NULL){ - DEBUG_EVENT("%s: No more trace packets in trace queue!\n", - card->devname); - break; - } - if ((WAN_MAX_DATA_SIZE - buffer_length) < skb->m_pkthdr.len){ - /* indicate there are more frames on board & exit */ - wan_udp_pkt->wan_udp_atm_ismoredata = 0x01; - break; - } - - m_copydata(skb, - 0, - skb->m_pkthdr.len, - &wan_udp_pkt->wan_udp_data[buffer_length]); - buffer_length += skb->m_pkthdr.len; - WAN_IFQ_DEQUEUE(&trace_info->trace_queue, skb); - if (skb){ - wan_skb_free(skb); - } - wan_udp_pkt->wan_udp_atm_num_frames++; - } -#elif defined(__LINUX__) - while ((skb=skb_dequeue(&trace_info->trace_queue)) != NULL){ - - if((MAX_TRACE_BUFFER - buffer_length) < wan_skb_len(skb)){ - /* indicate there are more frames on board & exit */ - wan_udp_pkt->wan_udp_atm_ismoredata = 0x01; - if (buffer_length != 0){ - wan_skb_queue_head(&trace_info->trace_queue, skb); - }else{ - /* If rx buffer length is greater than the - * whole udp buffer copy only the trace - * header and drop the trace packet */ - - memcpy(&wan_udp_pkt->wan_udp_atm_data[buffer_length], - wan_skb_data(skb), - sizeof(wan_trace_pkt_t)); - - buffer_length = sizeof(wan_trace_pkt_t); - wan_udp_pkt->wan_udp_atm_num_frames++; - wan_skb_free(skb); - } - break; - } - - memcpy(&wan_udp_pkt->wan_udp_atm_data[buffer_length], - wan_skb_data(skb), - wan_skb_len(skb)); - - buffer_length += wan_skb_len(skb); - wan_skb_free(skb); - wan_udp_pkt->wan_udp_atm_num_frames++; - } -#endif - /* set the data length and return code */ - wan_udp_pkt->wan_udp_data_len = buffer_length; - wan_udp_pkt->wan_udp_return_code = WAN_CMD_OK; - break; - - case ROUTER_UP_TIME: - wan_getcurrenttime( &chan->router_up_time, NULL ); - chan->router_up_time -= chan->router_start_time; - *(unsigned long *)&wan_udp_pkt->wan_udp_data = - chan->router_up_time; - wan_udp_pkt->wan_udp_data_len = sizeof(unsigned long); - wan_udp_pkt->wan_udp_return_code = 0; - break; - - case READ_OPERATIONAL_STATS: - wan_udp_pkt->wan_udp_return_code = 0; - memcpy(wan_udp_pkt->wan_udp_data,&chan->opstats,sizeof(aft_op_stats_t)); - wan_udp_pkt->wan_udp_data_len=sizeof(aft_op_stats_t); - break; - - case FLUSH_OPERATIONAL_STATS: - wan_udp_pkt->wan_udp_return_code = 0; - memset(&chan->opstats,0,sizeof(aft_op_stats_t)); - wan_udp_pkt->wan_udp_data_len=0; - break; - - case READ_COMMS_ERROR_STATS: - wan_udp_pkt->wan_udp_return_code = 0; - memcpy(wan_udp_pkt->wan_udp_data,&chan->errstats,sizeof(aft_comm_err_stats_t)); - wan_udp_pkt->wan_udp_data_len=sizeof(aft_comm_err_stats_t); - break; - - case FLUSH_COMMS_ERROR_STATS: - wan_udp_pkt->wan_udp_return_code = 0; - memset(&chan->errstats,0,sizeof(aft_comm_err_stats_t)); - wan_udp_pkt->wan_udp_data_len=0; - break; - - default: - wan_udp_pkt->wan_udp_data_len = 0; - wan_udp_pkt->wan_udp_return_code = 0xCD; - - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT( - "%s: Warning, Illegal UDP command attempted from network: %x\n", - card->devname,wan_udp_pkt->wan_udp_command); - } - break; - } /* end of switch */ - } /* end of else */ - - /* Fill UDP TTL */ - wan_udp_pkt->wan_ip_ttl= card->wandev.ttl; - - wan_udp_pkt->wan_udp_request_reply = UDPMGMT_REPLY; - return 1; - -} -#endif - -/**SECTION************************************************************* - * - * TASK Functions and Triggers - * - **********************************************************************/ - - -/*============================================================================ - * port_set_state - * - * Set PORT state. - * - */ -static void port_set_state (sdla_t *card, int state) -{ - struct wan_dev_le *devle; - netdevice_t *dev; - - if (card->wandev.state != state) - { -#if 0 - switch (state) - { - case WAN_CONNECTED: - DEBUG_EVENT( "%s: Link connected!\n", - card->devname); - break; - - case WAN_CONNECTING: - DEBUG_EVENT( "%s: Link connecting...\n", - card->devname); - break; - - case WAN_DISCONNECTED: - DEBUG_EVENT( "%s: Link disconnected!\n", - card->devname); - break; - } -#endif - card->wandev.state = state; - WAN_LIST_FOREACH(devle, &card->wandev.dev_head, dev_link){ - dev = WAN_DEVLE2DEV(devle); - if (!dev) continue; - set_chan_state(card, dev, state); - } - } -} - -/*============================================================ - * handle_front_end_state - * - * Front end state indicates the physical medium that - * the Z80 backend connects to. - * - * S514-1/2/3: V32/RS232/FT1 Front End - * Front end state is determined via - * Modem/Status. - * S514-4/5/7/8: 56K/T1/E1 Front End - * Front end state is determined via - * link status interrupt received - * from the front end hardware. - * - * If the front end state handler is enabed by the - * user. The interface state will follow the - * front end state. I.E. If the front end goes down - * the protocol and interface will be declared down. - * - * If the front end state is UP, then the interface - * and protocol will be up ONLY if the protocol is - * also UP. - * - * Therefore, we must have three state variables - * 1. Front End State (card->wandev.front_end_status) - * 2. Protocol State (card->wandev.state) - * 3. Interface State (dev->flags & IFF_UP) - * - */ - -static void handle_front_end_state(void *card_id) -{ - sdla_t *card = (sdla_t*)card_id; - unsigned char status; - - if (card->wandev.ignore_front_end_status == WANOPT_YES){ - return; - } - - WAN_FECALL(&card->wandev, get_fe_status, (&card->fe, &status)); - if (status == FE_CONNECTED){ - if (card->wandev.state != WAN_CONNECTED){ - enable_data_error_intr(card); - port_set_state(card,WAN_CONNECTED); - card->u.xilinx.state_change_exit_isr=1; - wan_set_bit(AFT_FE_LED,&card->u.aft.port_task_cmd); - } - } else { - if (card->wandev.state != WAN_DISCONNECTED){ - port_set_state(card,WAN_DISCONNECTED); - disable_data_error_intr(card,LINK_DOWN); - card->u.xilinx.state_change_exit_isr=1; - wan_set_bit(AFT_FE_LED,&card->u.aft.port_task_cmd); - } - } -} - -#if 0 -static unsigned char read_cpld(sdla_t *card, unsigned short cpld_off) -{ - - u16 org_off; - u8 tmp; - - cpld_off &= ~BIT_DEV_ADDR_CLEAR; - cpld_off |= BIT_DEV_ADDR_CPLD; - - /*ALEX: Save the current address. */ - card->hw_iface.bus_read_2(card->hw, - XILINX_MCPU_INTERFACE_ADDR, - &org_off); - card->hw_iface.bus_write_2(card->hw, - XILINX_MCPU_INTERFACE_ADDR, - cpld_off); - - card->hw_iface.bus_read_1(card->hw,XILINX_MCPU_INTERFACE, &tmp); - - /*ALEX: Restore original address */ - card->hw_iface.bus_write_2(card->hw, - XILINX_MCPU_INTERFACE_ADDR, - org_off); - return tmp; - - -} -#endif - -static int write_cpld(void *pcard, unsigned short off,unsigned char data) -{ - sdla_t *card = (sdla_t*)pcard; - u16 org_off; - - off &= ~BIT_DEV_ADDR_CLEAR; - off |= BIT_DEV_ADDR_CPLD; - - /*ALEX: Save the current original address */ - card->hw_iface.bus_read_2(card->hw, - XILINX_MCPU_INTERFACE_ADDR, - &org_off); - - /* This delay is required to avoid bridge optimization - * (combining two writes together)*/ - WP_DELAY(5); - - card->hw_iface.bus_write_2(card->hw, - XILINX_MCPU_INTERFACE_ADDR, - off); - - /* This delay is required to avoid bridge optimization - * (combining two writes together)*/ - WP_DELAY(5); - - card->hw_iface.bus_write_1(card->hw, - XILINX_MCPU_INTERFACE, - data); - /*ALEX: Restore the original address */ - card->hw_iface.bus_write_2(card->hw, - XILINX_MCPU_INTERFACE_ADDR, - org_off); - return 0; -} - - -static int write_fe_cpld(void *pcard, unsigned short off,unsigned char data) -{ - sdla_t *card = (sdla_t*)pcard; - u16 org_off; - - off &= ~AFT3_BIT_DEV_ADDR_EXAR_CLEAR; - off |= AFT3_BIT_DEV_ADDR_EXAR_CPLD; - - /*ALEX: Save the current original address */ - card->hw_iface.bus_read_2(card->hw, - XILINX_MCPU_INTERFACE_ADDR, - &org_off); - - /* This delay is required to avoid bridge optimization - * (combining two writes together)*/ - WP_DELAY(5); - - card->hw_iface.bus_write_2(card->hw, - XILINX_MCPU_INTERFACE_ADDR, - off); - - /* This delay is required to avoid bridge optimization - * (combining two writes together)*/ - WP_DELAY(5); - - card->hw_iface.bus_write_1(card->hw, - XILINX_MCPU_INTERFACE, - data); - /*ALEX: Restore the original address */ - card->hw_iface.bus_write_2(card->hw, - XILINX_MCPU_INTERFACE_ADDR, - org_off); - return 0; -} - -#if 0 -static unsigned char write_front_end_reg (void* card1, unsigned short off, unsigned char value) -{ - sdla_t* card = (sdla_t*)card1; - - off &= ~BIT_DEV_ADDR_CLEAR; - card->hw_iface.bus_write_2(card->hw,XILINX_MCPU_INTERFACE_ADDR, off); - /* NC: Mar 25 2004 - * This delays are required to avoid bridge optimization - * (combining two writes together) - */ - WP_DELAY(5); - card->hw_iface.bus_write_1(card->hw,XILINX_MCPU_INTERFACE, value); - WP_DELAY(5); - - return 0; -} - -/*============================================================================ - * Read TE1/56K Front end registers - */ -static unsigned char read_front_end_reg (void* card1, unsigned short off) -{ - sdla_t* card = (sdla_t*)card1; - u8 tmp; - - off &= ~BIT_DEV_ADDR_CLEAR; - card->hw_iface.bus_write_2(card->hw, XILINX_MCPU_INTERFACE_ADDR, off); - card->hw_iface.bus_read_1(card->hw,XILINX_MCPU_INTERFACE, &tmp); - WP_DELAY(5); - - return tmp; -} -#endif - -static int xilinx_read(sdla_t *card, wan_cmd_api_t *api_cmd) -{ - - if (api_cmd->offset <= 0x3C){ - card->hw_iface.pci_read_config_dword(card->hw, - api_cmd->offset, - (u32*)&api_cmd->data[0]); - api_cmd->len=4; - - }else{ - card->hw_iface.peek(card->hw, api_cmd->offset, &api_cmd->data[0], api_cmd->len); - } - -#ifdef DEB_XILINX - DEBUG_EVENT("%s: Reading Bar%i Offset=0x%X Len=%i\n", - card->devname,api_cmd->bar,api_cmd->offset,api_cmd->len); -#endif - - return 0; -} - -static int xilinx_write(sdla_t *card, wan_cmd_api_t *api_cmd) -{ - -#ifdef DEB_XILINX - DEBUG_EVENT("%s: Writting Bar%i Offset=0x%X Len=%i\n", - card->devname, - api_cmd->bar,api_cmd->offset,api_cmd->len); -#endif - -#if 0 - card->hw_iface.poke(card->hw, api_cmd->offset, &api_cmd->data[0], api_cmd->len); -#endif - if (api_cmd->len == 1){ - card->hw_iface.bus_write_1( - card->hw, - api_cmd->offset, - (u8)api_cmd->data[0]); - }else if (api_cmd->len == 2){ - card->hw_iface.bus_write_2( - card->hw, - api_cmd->offset, - *(u16*)&api_cmd->data[0]); - }else if (api_cmd->len == 4){ - card->hw_iface.bus_write_4( - card->hw, - api_cmd->offset, - *(u32*)&api_cmd->data[0]); - }else{ - card->hw_iface.poke( - card->hw, - api_cmd->offset, - &api_cmd->data[0], - api_cmd->len); - } - - return 0; -} - -static int xilinx_write_bios(sdla_t *card, wan_cmd_api_t *api_cmd) -{ -#ifdef DEB_XILINX - DEBUG_EVENT("Setting PCI 0x%X=0x%08lX 0x3C=0x%08X\n", - (card->wandev.S514_cpu_no[0] == SDLA_CPU_A) ? 0x10 : 0x14, - card->u.xilinx.bar,card->wandev.irq); -#endif - card->hw_iface.pci_write_config_dword(card->hw, - (card->wandev.S514_cpu_no[0] == SDLA_CPU_A) ? 0x10 : 0x14, - card->u.xilinx.bar); - card->hw_iface.pci_write_config_dword(card->hw, 0x3C, card->wandev.irq); - card->hw_iface.pci_write_config_dword(card->hw, 0x0C, 0x0000ff00); - - return 0; -} - -static int aft_devel_ioctl(sdla_t *card,struct ifreq *ifr) -{ - wan_cmd_api_t api_cmd; - int err; - - if (!ifr || !ifr->ifr_data){ - DEBUG_EVENT("%s: Error: No ifr or ifr_data\n",__FUNCTION__); - return -EINVAL; - } - - if (WAN_COPY_FROM_USER(&api_cmd,ifr->ifr_data,sizeof(wan_cmd_api_t))){ - return -EFAULT; - } - - switch(api_cmd.cmd){ -#if defined(__LINUX__) - case SDLA_HDLC_READ_REG: -#endif - case SIOC_WAN_READ_REG: - err=xilinx_read(card, &api_cmd); - break; - -#if defined(__LINUX__) - case SDLA_HDLC_WRITE_REG: -#endif - case SIOC_WAN_WRITE_REG: - err=xilinx_write(card, &api_cmd); - break; - -#if defined(__LINUX__) - case SDLA_HDLC_SET_PCI_BIOS: -#endif - case SIOC_WAN_SET_PCI_BIOS: - err=xilinx_write_bios(card, &api_cmd); - break; - } - - if (WAN_COPY_TO_USER(ifr->ifr_data,&api_cmd,sizeof(wan_cmd_api_t))){ - return -EFAULT; - } - return 0; -} - -/*========================================= - * enable_data_error_intr - * - * Description: - * - * Run only after the front end comes - * up from down state. - * - * Clean the DMA Tx/Rx pending interrupts. - * (Ignore since we will reconfigure - * all dma descriptors. DMA controler - * was already disabled on link down) - * - * For all channels clean Tx/Rx Fifo - * - * Enable DMA controler - * (This starts the fifo cleaning - * process) - * - * For all channels reprogram Tx/Rx DMA - * descriptors. - * - * Clean the Tx/Rx Error pending interrupts. - * (Since dma fifo's are now empty) - * - * Enable global DMA and Error interrutps. - * - */ - -static void enable_data_error_intr(sdla_t *card) -{ - struct wan_dev_le *devle; - u32 reg; - netdevice_t *dev; - - DEBUG_TEST("%s: %s() !!!\n", - card->devname,__FUNCTION__); - - - /* Clean Tx/Rx DMA interrupts */ - card->hw_iface.bus_read_4(card->hw, - XILINX_DMA_RX_INTR_PENDING_REG, ®); - card->hw_iface.bus_read_4(card->hw, - XILINX_DMA_TX_INTR_PENDING_REG, ®); - - - /* For all channels clean Tx/Rx fifos */ - WAN_LIST_FOREACH(devle, &card->wandev.dev_head, dev_link){ - private_area_t *chan; - - dev = WAN_DEVLE2DEV(devle); - if (!dev || !wan_netif_priv(dev)) - continue; - chan = wan_netif_priv(dev); - - if (!wan_test_bit(0,&chan->up)){ - continue; - } - - aft_list_descriptors(chan); - - DEBUG_TEST("%s: 1) Free Used DMA CHAINS %s\n", - card->devname,chan->if_name); - - aft_rx_dma_chain_handler(chan,0,1); - aft_free_rx_complete_list(chan); - - - aft_list_descriptors(chan); - - DEBUG_TEST("%s: 1) Free UNUSED DMA CHAINS %s\n", - card->devname,chan->if_name); - - aft_free_rx_descriptors(chan); - - aft_free_tx_descriptors(chan); - - - DEBUG_TEST("%s: 2) Init interface fifo no wait %s\n", - card->devname,chan->if_name); - - xilinx_init_rx_dev_fifo(card, chan, WP_NO_WAIT); - xilinx_init_tx_dev_fifo(card, chan, WP_NO_WAIT); - - aft_list_descriptors(chan); - } - - - - if (card->fe.fe_cfg.cfg.te3_cfg.fractional){ - card->hw_iface.bus_read_4(card->hw,TE3_FRACT_ENCAPSULATION_REG,®); - - DEBUG_EVENT("%s: Rx Fractional Frame Size = 0x%lX\n", - card->devname, - get_te3_rx_fract_frame_size(reg)); - - /* FIXME: Setup bitrate and tx frame size */ - } - - - /* Enable DMA controler, in order to start the - * fifo cleaning */ - reg=0; - reg|=(AFT_T3_DMA_FIFO_MARK << DMA_FIFO_T3_MARK_BIT_SHIFT); - reg|=(MAX_AFT_DMA_CHAINS-1)&DMA_CHAIN_TE3_MASK; - - wan_set_bit(DMA_RX_ENGINE_ENABLE_BIT,®); - wan_set_bit(DMA_TX_ENGINE_ENABLE_BIT,®); - card->hw_iface.bus_write_4(card->hw,XILINX_DMA_CONTROL_REG,reg); - - /* For all channels clean Tx/Rx fifos */ - WAN_LIST_FOREACH(devle, &card->wandev.dev_head, dev_link){ - private_area_t *chan; - - dev = WAN_DEVLE2DEV(devle); - if (!dev || !wan_netif_priv(dev)) - continue; - chan = wan_netif_priv(dev); - - if (!wan_test_bit(0,&chan->up)){ - continue; - } - - DEBUG_TEST("%s: 3) Init interface fifo %s\n", - card->devname,chan->if_name); - - xilinx_init_rx_dev_fifo(card, chan, WP_WAIT); - xilinx_init_tx_dev_fifo(card, chan, WP_WAIT); - - DEBUG_TEST("%s: Clearing Fifo and idle_flag %s\n", - card->devname,chan->if_name); - wan_clear_bit(0,&chan->idle_start); - } - - /* For all channels, reprogram Tx/Rx DMA descriptors. - * For Tx also make sure that the BUSY flag is clear - * and previoulsy Tx packet is deallocated */ - - WAN_LIST_FOREACH(devle, &card->wandev.dev_head, dev_link){ - private_area_t *chan; - - dev = WAN_DEVLE2DEV(devle); - if (!dev || !wan_netif_priv(dev)) - continue; - chan = wan_netif_priv(dev); - - if (!wan_test_bit(0,&chan->up)){ - continue; - } - - DEBUG_TEST("%s: 4) Init interface %s\n", - card->devname,chan->if_name); - - xilinx_dma_rx(card,chan,-1); - - aft_list_descriptors(chan); - - DEBUG_TEST("%s: Clearing Fifo and idle_flag %s\n", - card->devname,chan->if_name); - - } - - /* Clean Tx/Rx Error interrupts, since fifos are now - * empty, and Tx fifo may generate an underrun which - * we want to ignore :) */ - - card->hw_iface.bus_read_4(card->hw, - XILINX_HDLC_RX_INTR_PENDING_REG, ®); - card->hw_iface.bus_read_4(card->hw, - XILINX_HDLC_TX_INTR_PENDING_REG, ®); - - /* Enable Global DMA and Error Interrupts */ - reg=0; - card->hw_iface.bus_read_4(card->hw,XILINX_CHIP_CFG_REG,®); - wan_set_bit(GLOBAL_INTR_ENABLE_BIT,®); - wan_set_bit(ERROR_INTR_ENABLE_BIT,®); - card->hw_iface.bus_write_4(card->hw,XILINX_CHIP_CFG_REG,reg); - - - card->hw_iface.bus_read_4(card->hw,XILINX_DMA_CONTROL_REG,®); - - aft_enable_rx_watchdog(card,AFT_RX_TIMEOUT); - aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); - - DEBUG_TEST("%s: END !!! Dma=0x%08X\n", - __FUNCTION__,reg); - -} - -static void disable_data_error_intr(sdla_t *card, unsigned char event) -{ - u32 reg; -#if 0 - private_area_t *chan; - - card->hw_iface.bus_read_4(card->hw,XILINX_CHIP_CFG_REG,®); - wan_clear_bit(GLOBAL_INTR_ENABLE_BIT,®); - wan_clear_bit(ERROR_INTR_ENABLE_BIT,®); - wan_clear_bit(FRONT_END_INTR_ENABLE_BIT,®); - wan_clear_bit(ENABLE_TE3_FRACTIONAL,®); - card->hw_iface.bus_write_4(card->hw,XILINX_CHIP_CFG_REG,reg); - - aft_reset_rx_watchdog(card); - aft_reset_tx_watchdog(card); - - chan=(private_area_t*)card->u.xilinx.dev_to_ch_map[0]; - if (chan && wan_test_bit(0,&chan->up)){ - xilinx_dev_close(card,chan); - WAN_NETIF_STOP_QUEUE(chan->common.dev); - WAN_TASKLET_KILL(&chan->common.bh_task); - } - - xilinx_t3_exar_chip_unconfigure(card); - - WP_DELAY(10500); - - xilinx_t3_exar_chip_configure(card); - if (chan && wan_test_bit(0,&chan->up)){ - WP_DELAY(500); - xilinx_t3_exar_dev_configure(card,chan); - WP_DELAY(500); - xilinx_dev_enable(card, chan); - WAN_TASKLET_INIT((&chan->common.bh_task),0,wp_bh,(unsigned long)chan); - } -#endif - - - card->hw_iface.bus_read_4(card->hw,XILINX_CHIP_CFG_REG,®); - wan_clear_bit(GLOBAL_INTR_ENABLE_BIT,®); - wan_clear_bit(ERROR_INTR_ENABLE_BIT,®); - if (event==DEVICE_DOWN){ - wan_clear_bit(FRONT_END_INTR_ENABLE_BIT,®); - wan_clear_bit(ENABLE_TE3_FRACTIONAL,®); - } - card->hw_iface.bus_write_4(card->hw,XILINX_CHIP_CFG_REG,reg); - - card->hw_iface.bus_read_4(card->hw,XILINX_DMA_CONTROL_REG,®); - wan_clear_bit(DMA_RX_ENGINE_ENABLE_BIT,®); - wan_clear_bit(DMA_TX_ENGINE_ENABLE_BIT,®); - card->hw_iface.bus_write_4(card->hw,XILINX_DMA_CONTROL_REG,reg); - - aft_reset_rx_watchdog(card); - aft_reset_tx_watchdog(card); - - if (event==DEVICE_DOWN){ - wan_set_bit(CARD_DOWN,&card->wandev.critical); - } - - - DEBUG_TEST("%s: Event = %s\n",__FUNCTION__, - event==DEVICE_DOWN?"Device Down": "Link Down"); - -} - -static void xilinx_init_tx_dma_descr(sdla_t *card, private_area_t *chan) -{ - unsigned long dma_descr; - unsigned long reg=0; - - dma_descr=(chan->logic_ch_num<<4) + XILINX_TxDMA_DESCRIPTOR_HI; - card->hw_iface.bus_write_4(card->hw,dma_descr, reg); -} - - - -/*============================================================================ - * Update communications error and general packet statistics. - */ -static int update_comms_stats(sdla_t* card) -{ - /* 1. On the first timer interrupt, update T1/E1 alarms - * and PMON counters (only for T1/E1 card) (TE1) - */ - - /* TE1 Update T1/E1 alarms */ - if (IS_TE3(&card->fe.fe_cfg)) { - WAN_FECALL(&card->wandev, read_alarm, (&card->fe, 0)); - /* TE1 Update T1/E1 perfomance counters */ - WAN_FECALL(&card->wandev, read_pmon, (&card->fe, 0)); - } - - return 0; -} - -static void xilinx_tx_fifo_under_recover (sdla_t *card, private_area_t *chan) -{ - -#if 1 - u32 reg; - /* Enable DMA controler, in order to start the - * fifo cleaning */ - card->hw_iface.bus_read_4(card->hw,XILINX_DMA_CONTROL_REG,®); - wan_clear_bit(DMA_TX_ENGINE_ENABLE_BIT,®); - card->hw_iface.bus_write_4(card->hw,XILINX_DMA_CONTROL_REG,reg); -#endif - -#if 0 - aft_list_tx_descriptors(chan); -#endif - aft_free_tx_descriptors(chan); - -#if 1 - xilinx_init_tx_dev_fifo(card,chan,WP_NO_WAIT); - - card->hw_iface.bus_read_4(card->hw,XILINX_DMA_CONTROL_REG,®); - wan_set_bit(DMA_TX_ENGINE_ENABLE_BIT,®); - card->hw_iface.bus_write_4(card->hw,XILINX_DMA_CONTROL_REG,reg); - - xilinx_init_tx_dev_fifo(card,chan,WP_WAIT); -#endif - wan_clear_bit(0,&chan->idle_start); - - WAN_NETIF_WAKE_QUEUE(chan->common.dev); -#ifndef CONFIG_PRODUCT_WANPIPE_GENERIC - if (chan->common.usedby == API){ - wan_wakeup_api(chan); - }else if (chan->common.usedby == STACK){ - wanpipe_lip_kick(chan,0); - } -#endif - aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); -} - -static int xilinx_write_ctrl_hdlc(sdla_t *card, u32 timeslot, u8 reg_off, u32 data) -{ - /* M.F. for Exar T3 card direct access - * without analize current timeslot */ - - card->hw_iface.bus_write_4(card->hw,reg_off,data); - - return 0; -} - -static int set_chan_state(sdla_t* card, netdevice_t* dev, int state) -{ - private_area_t *chan = wan_netif_priv(dev); - if (!chan || !wan_test_bit(0,&chan->up)) { - return -ENODEV; - } - - chan->common.state = state; - if (state == WAN_CONNECTED){ - wan_clear_bit(0,&chan->idle_start); - WAN_NETIF_CARRIER_ON(dev); - WAN_NETIF_WAKE_QUEUE(dev); - chan->opstats.link_active_count++; - }else{ - WAN_NETIF_CARRIER_OFF(dev); - WAN_NETIF_STOP_QUEUE(dev); - chan->opstats.link_inactive_modem_count++; - } - -#if defined(__LINUX__) -# if !defined(CONFIG_PRODUCT_WANPIPE_GENERIC) - if (chan->common.usedby == API){ - wan_update_api_state(chan); - } -#endif -#endif - - if (chan->common.usedby == STACK){ - if (state == WAN_CONNECTED){ - wanpipe_lip_connect(chan,0); - }else{ - wanpipe_lip_disconnect(chan,0); - } - } - return 0; -} - - -/**SECTION************************************************************* - * - * Protocol API Support Functions - * - **********************************************************************/ - - -static int protocol_init (sdla_t *card, netdevice_t *dev, - private_area_t *chan, - wanif_conf_t* conf) -{ - - chan->common.protocol = conf->protocol; - - DEBUG_TEST("%s: Protocol init 0x%X PPP=0x0%x FR=0x0%X\n", - wan_netif_name(dev), chan->common.protocol, - WANCONFIG_PPP, - WANCONFIG_FR); - -#ifndef CONFIG_PRODUCT_WANPIPE_GENERIC - - DEBUG_EVENT("%s: AFT Driver doesn't directly support any protocols!\n", - chan->if_name); - return -1; - -#else - if (chan->common.protocol == WANCONFIG_PPP || - chan->common.protocol == WANCONFIG_CHDLC){ - - struct ifreq ifr; - struct if_settings ifsettings; - - wanpipe_generic_register(card, dev, wan_netif_name(dev)); - chan->common.prot_ptr = dev; - - if (chan->common.protocol == WANCONFIG_CHDLC){ - DEBUG_EVENT("%s: Starting Kernel CISCO HDLC protocol\n", - chan->if_name); - ifsettings.type = IF_PROTO_CISCO; - }else{ - DEBUG_EVENT("%s: Starting Kernel Sync PPP protocol\n", - chan->if_name); - ifsettings.type = IF_PROTO_PPP; - - } - ifr.ifr_data = (caddr_t)&ifsettings; - if (wp_lite_set_proto(dev, &ifr)){ - wanpipe_generic_unregister(dev); - return -EINVAL; - } - - }else if (chan->common.protocol == WANCONFIG_GENERIC){ - chan->common.prot_ptr = dev; - - }else{ - DEBUG_EVENT("%s:%s: Unsupported protocol %d\n", - card->devname,chan->if_name,chan->common.protocol); - return -EPROTONOSUPPORT; - } -#endif - - return 0; -} - - -static int protocol_start (sdla_t *card, netdevice_t *dev) -{ - int err=0; - - private_area_t *chan=wan_netif_priv(dev); - - if (!chan) - return 0; - - return err; -} - -static int protocol_stop (sdla_t *card, netdevice_t *dev) -{ - private_area_t *chan=wan_netif_priv(dev); - int err = 0; - - if (!chan) - return 0; - - return err; -} - -static int protocol_shutdown (sdla_t *card, netdevice_t *dev) -{ - private_area_t *chan=wan_netif_priv(dev); - - if (!chan) - return 0; - -#ifndef CONFIG_PRODUCT_WANPIPE_GENERIC - - return 0; -#else - - if (chan->common.protocol == WANCONFIG_PPP || - chan->common.protocol == WANCONFIG_CHDLC){ - - chan->common.prot_ptr = NULL; - wanpipe_generic_unregister(dev); - - }else if (chan->common.protocol == WANCONFIG_GENERIC){ - DEBUG_EVENT("%s:%s Protocol shutdown... \n", - card->devname, chan->if_name); - } -#endif - return 0; -} - -void protocol_recv(sdla_t *card, private_area_t *chan, netskb_t *skb) -{ - -#ifdef CONFIG_PRODUCT_WANPIPE_GENERIC - if (chan->common.protocol == WANCONFIG_PPP || - chan->common.protocol == WANCONFIG_CHDLC){ - wanpipe_generic_input(chan->common.dev, skb); - return 0; - } -#endif - -#if defined(__LINUX__) && defined(CONFIG_PRODUCT_WANPIPE_GENERIC) - if (chan->common.protocol == WANCONFIG_GENERIC){ - skb->protocol = htons(ETH_P_HDLC); - skb->dev = chan->common.dev; - wan_skb_reset_mac_header(skb); - netif_rx(skb); - return 0; - } -#endif - -#if defined(__LINUX__) - skb->protocol = htons(ETH_P_IP); - skb->dev = chan->common.dev; - wan_skb_reset_mac_header(skb); - netif_rx(skb); -#else - DEBUG_EVENT("%s: Action not supported (IP)!\n", - card->devname); - wan_skb_free(skb); -#endif - - return; -} - - -/**SECTION************************************************************* - * - * T3 Exar Config Code - * - **********************************************************************/ - - -/*========================================================= - * xilinx_t3_exar_chip_configure - * - */ - -static int xilinx_t3_exar_chip_configure(sdla_t *card) -{ - u32 reg,tmp; - volatile unsigned char cnt=0; - int err=0; - - DEBUG_CFG("T3 Exar Chip Configuration. -- \n"); - - xilinx_delay(1); - - card->hw_iface.bus_read_4(card->hw,XILINX_CHIP_CFG_REG, ®); - - /* Enable the chip/hdlc reset condition */ - reg=0; - wan_set_bit(CHIP_RESET_BIT,®); - wan_set_bit(FRONT_END_RESET_BIT,®); - - /* Hardcode the AFT T3/E3 clock source - * to External/Normal */ - if (card->fe.fe_cfg.cfg.te3_cfg.clock == WAN_MASTER_CLK){ - wan_set_bit(AFT_T3_CLOCK_MODE,®); - }else{ - wan_clear_bit(AFT_T3_CLOCK_MODE,®); - } - - DEBUG_CFG("--- T3 Exar Chip Reset. -- \n"); - - card->hw_iface.bus_write_4(card->hw,XILINX_CHIP_CFG_REG,reg); - - WP_DELAY(100); - - /* Disable the chip/hdlc reset condition */ - wan_clear_bit(CHIP_RESET_BIT,®); - wan_clear_bit(FRONT_END_RESET_BIT,®); - - /* Disable ALL chip interrupts */ - wan_clear_bit(GLOBAL_INTR_ENABLE_BIT,®); - wan_clear_bit(ERROR_INTR_ENABLE_BIT,®); - wan_clear_bit(FRONT_END_INTR_ENABLE_BIT,®); - - /* Configure for T3 or E3 front end */ - - if (IS_DS3(&card->fe.fe_cfg)){ - card->u.xilinx.num_of_time_slots=NUM_OF_T1_CHANNELS; - wan_clear_bit(INTERFACE_TYPE_T3_E3_BIT,®); - if (card->fe.fe_cfg.frame == WAN_FR_DS3_Cbit){ - wan_set_bit(INTERFACE_MODE_DS3_C_BIT,®); - }else{ - wan_clear_bit(INTERFACE_MODE_DS3_C_BIT,®); - } - }else if (IS_E3(&card->fe.fe_cfg)){ - card->u.xilinx.num_of_time_slots=NUM_OF_E1_CHANNELS; - wan_set_bit(INTERFACE_TYPE_T3_E3_BIT,®); - if (card->fe.fe_cfg.frame == WAN_FR_E3_G832){ - wan_set_bit(INTERFACE_MODE_E3_G832,®); - }else{ - wan_clear_bit(INTERFACE_MODE_E3_G832,®); - } - }else{ - DEBUG_EVENT("%s: Error: T3 Exar doesn't support non T3/E3 interface!\n", - card->devname); - return -EINVAL; - } - - /* Hardcode the HDLC Conroller to - * HDLC mode. The transparent mode can be - * configured later in new_if() section - * - * HDLC =clear bit - * TRANSPARENT =set bit - * */ - wan_clear_bit(AFT_T3_HDLC_TRANS_MODE,®); - - - /* Enable/Disable TX and RX Fractional - * HDLC */ - - /* FIXME: HAVE A CONFIG OPTION HERE */ - - /* Enable Internal HDLC Encapsulation core */ - if (card->fe.fe_cfg.cfg.te3_cfg.fractional){ - DEBUG_EVENT("%s: BEFORE TE3 FRACT = 0x%X\n", - card->devname, reg); - - wan_set_bit(ENABLE_TE3_FRACTIONAL,®); - - //te3_enable_fractional(®, TE3_FRACT_VENDOR_KENTROX); - DEBUG_EVENT("%s: AFTER TE3 FRACT = 0x%X\n", - card->devname, reg); - }else{ - wan_clear_bit(ENABLE_TE3_FRACTIONAL,®); - } - - DEBUG_CFG("--- T3 Exar Chip enable/config. -- \n"); - - card->hw_iface.bus_write_4(card->hw,XILINX_CHIP_CFG_REG,reg); - - WP_DELAY(100); - - xilinx_delay(1); -#if 0 - framer_reset(card); /* was for A105 proto */ -#endif /* M.F. remove for A300 */ - -#if 0 - write_cpld(card,0x00, 0x00); /* M.F. was 0x01 for A105 proto */ - /* M.F. 0x00 for A300 */ - /* set DS3 interface mode */ - write_cpld(card,0x01, 0x00); /* clear TxAIS bit */ - - // 3. Setup Framer - write_framer(card,0x00, 0x6F); /* DS3 - mode (bit 6)*/ - /* Internal LOS enable (bit 5)*/ - /* Interrupt enabl.reset(bit 3)*/ - /* Frame format M13 (bit 2)*/ - /* TimRef - Mode 3 (code '1X')*/ - write_framer(card,0x01, 0xA2); /* */ -#else - -//FIXME: Alex to put in Exar T3/E3 Configuration - DEBUG_EVENT("%s: Config %s Front End: Clock=%s Type=0x%X\n", - card->devname, - FE_MEDIA_DECODE(&card->fe), - (card->fe.fe_cfg.cfg.te3_cfg.clock == WAN_MASTER_CLK)? - "Master":"Normal", - card->adptr_subtype); - - if (card->wandev.fe_iface.config){ - err = card->wandev.fe_iface.config(&card->fe); - if (err){ - DEBUG_EVENT("%s: Failed %s configuratoin!\n", - card->devname, - FE_MEDIA_DECODE(&card->fe)); - return -EINVAL; - } - }else{ - DEBUG_EVENT("%s: Internal Error (%s:%d)\n", - card->devname, - __FUNCTION__,__LINE__); - return -EINVAL; - } -#endif - for (;;){ - card->hw_iface.bus_read_4(card->hw,XILINX_CHIP_CFG_REG, ®); - - if (!wan_test_bit(HDLC_CORE_READY_FLAG_BIT,®)){ - /* The HDLC Core is not ready! we have - * an error. */ - if (++cnt > 5){ - err = -EINVAL; - break; - }else{ - WP_DELAY(500); - /* FIXME: we cannot do this while in - * critical area */ - } - }else{ - err=0; - break; - } - } - - xilinx_delay(1); - - if (err != 0){ - DEBUG_EVENT("%s: Error: HDLC Core Not Ready!\n", - card->devname); - - card->hw_iface.bus_read_4(card->hw,XILINX_CHIP_CFG_REG, ®); - - /* Disable the chip/hdlc reset condition */ - wan_set_bit(CHIP_RESET_BIT,®); - - card->hw_iface.bus_write_4(card->hw,XILINX_CHIP_CFG_REG,reg); - return err; - } else{ - DEBUG_CFG("%s: HDLC Core Ready 0x%08X\n", - card->devname,reg); - } - - xilinx_delay(1); - - /* Setup global DMA parameters */ - reg=0; - reg|=(AFT_T3_DMA_FIFO_MARK << DMA_FIFO_T3_MARK_BIT_SHIFT); - reg|=(MAX_AFT_DMA_CHAINS-1)&DMA_CHAIN_TE3_MASK; - - /* Enable global DMA engine and set to default - * number of active channels. Note: this value will - * change in dev configuration */ - wan_set_bit(DMA_RX_ENGINE_ENABLE_BIT,®); - wan_set_bit(DMA_TX_ENGINE_ENABLE_BIT,®); - - DEBUG_CFG("--- Setup DMA control Reg. -- \n"); - - card->hw_iface.bus_write_4(card->hw,XILINX_DMA_CONTROL_REG,reg); - DEBUG_CFG("--- Tx/Rx global enable. -- \n"); - - xilinx_delay(1); - - reg=0; - card->hw_iface.bus_write_4(card->hw,XILINX_TIMESLOT_HDLC_CHAN_REG,reg); - - /* Clear interrupt pending registers befor first interrupt enable */ - card->hw_iface.bus_read_4(card->hw, XILINX_DMA_RX_INTR_PENDING_REG, &tmp); - card->hw_iface.bus_read_4(card->hw, XILINX_DMA_TX_INTR_PENDING_REG, &tmp); - card->hw_iface.bus_read_4(card->hw, XILINX_HDLC_RX_INTR_PENDING_REG, &tmp); - card->hw_iface.bus_read_4(card->hw, XILINX_HDLC_TX_INTR_PENDING_REG, &tmp); - - card->hw_iface.bus_read_4(card->hw, XILINX_CHIP_CFG_REG, (u32*)®); - - if (wan_test_bit(DMA_INTR_FLAG,®)){ - DEBUG_EVENT("%s: Error: Active DMA Interrupt Pending. !\n", - card->devname); - - reg = 0; - /* Disable the chip/hdlc reset condition */ - wan_set_bit(CHIP_RESET_BIT,®); - card->hw_iface.bus_write_4(card->hw,XILINX_CHIP_CFG_REG,reg); - return err; - } - if (wan_test_bit(ERROR_INTR_FLAG,®)){ - DEBUG_EVENT("%s: Error: Active Error Interrupt Pending. !\n", - card->devname); - - reg = 0; - /* Disable the chip/hdlc reset condition */ - wan_set_bit(CHIP_RESET_BIT,®); - card->hw_iface.bus_write_4(card->hw,XILINX_CHIP_CFG_REG,reg); - return err; - } - - - /* Alawys disable global data and error - * interrupts */ - wan_clear_bit(GLOBAL_INTR_ENABLE_BIT,®); - wan_clear_bit(ERROR_INTR_ENABLE_BIT,®); - -#ifndef AFT_XTEST_DEBUG - /* Always enable the front end interrupt */ - wan_set_bit(FRONT_END_INTR_ENABLE_BIT,®); -#endif - DEBUG_CFG("--- Set Global Interrupts (0x%X)-- \n",reg); - - xilinx_delay(1); - - card->hw_iface.bus_write_4(card->hw,XILINX_CHIP_CFG_REG,reg); - - DEBUG_CFG("--- Set Global Interrupt enabled. -- \n"); - - return err; -} - -static int xilinx_t3_exar_dev_configure(sdla_t *card, private_area_t *chan) -{ - - u32 reg,reg1; - - DEBUG_TEST("-- T3 Exar Dev Configure Xilinx. --\n"); - - - chan->logic_ch_num=0; - chan->first_time_slot=0; - card->u.xilinx.logic_ch_map=0x01; - - if (!card->u.xilinx.dev_to_ch_map[0]){ - card->u.xilinx.dev_to_ch_map[0]=(void*)chan; - } - - reg=0; - - if (chan->hdlc_eng){ - /* HDLC engine is enabled on the above logical channels */ - wan_clear_bit(HDLC_RX_PROT_DISABLE_BIT,®); - wan_clear_bit(HDLC_TX_PROT_DISABLE_BIT,®); - - wan_set_bit(HDLC_TX_CHAN_ENABLE_BIT,®); - - if (card->fe.fe_cfg.cfg.te3_cfg.fractional){ - DEBUG_EVENT("%s: Configuring for Fractional\n",card->devname); - wan_set_bit(HDLC_RX_ADDR_FIELD_DISC_BIT,®); - wan_set_bit(HDLC_TX_ADDR_INSERTION_BIT,®); - }else{ - wan_set_bit(HDLC_RX_ADDR_RECOGN_DIS_BIT,®); - } - - if (card->fe.fe_cfg.cfg.te3_cfg.fcs == 32){ - wan_set_bit(HDLC_TX_FCS_SIZE_BIT,®); - wan_set_bit(HDLC_RX_FCS_SIZE_BIT,®); - } - - DEBUG_EVENT("%s:%s: Config for HDLC mode: FCS=%d\n", - card->devname,chan->if_name, - card->fe.fe_cfg.cfg.te3_cfg.fcs); - }else{ - - /* Transprent Mode */ - - /* Do not start HDLC Core here, because - * we have to setup Tx/Rx DMA buffers first - * The transparent mode, will start - * comms as soon as the HDLC is enabled */ - - } - - /* Select an HDLC Tx channel for configuration */ - reg1=0; - card->hw_iface.bus_write_4(card->hw, AFT_T3_RXTX_ADDR_SELECT_REG, reg1); - - if (card->fe.fe_cfg.cfg.te3_cfg.fractional){ - xilinx_write_ctrl_hdlc(card, - chan->first_time_slot, - XILINX_HDLC_ADDR_REG, - 0xA5A5A5A5); - } - - xilinx_write_ctrl_hdlc(card, - chan->first_time_slot, - XILINX_HDLC_CONTROL_REG, - reg); - - - /* Select an HDLC Rx channel for configuration */ - reg1=1; - card->hw_iface.bus_write_4(card->hw, AFT_T3_RXTX_ADDR_SELECT_REG, reg1); - - if (card->fe.fe_cfg.cfg.te3_cfg.fractional){ - - xilinx_write_ctrl_hdlc(card, - chan->first_time_slot, - XILINX_HDLC_ADDR_REG, - 0xA5A5A5A5); - } - - xilinx_write_ctrl_hdlc(card, - chan->first_time_slot, - XILINX_HDLC_CONTROL_REG, - reg); - - return 0; - -} - -static void xilinx_t3_exar_dev_unconfigure(sdla_t *card, private_area_t *chan) -{ - /* Nothing to do for T3 Exar */ - wan_smp_flag_t flags; - - wan_spin_lock_irq(&card->wandev.lock,&flags); - card->u.xilinx.dev_to_ch_map[0]=NULL; - aft_reset_rx_watchdog(card); - aft_reset_tx_watchdog(card); - wan_spin_unlock_irq(&card->wandev.lock,&flags); - -} - -static void xilinx_t3_exar_chip_unconfigure(sdla_t *card) -{ - - u32 reg=0; - - card->hw_iface.bus_read_4(card->hw,XILINX_CHIP_CFG_REG, ®); - - /* Enable the chip/hdlc reset condition */ - wan_set_bit(CHIP_RESET_BIT,®); - wan_set_bit(FRONT_END_RESET_BIT,®); - - card->hw_iface.bus_write_4(card->hw,XILINX_CHIP_CFG_REG,reg); - -} - - -static void xilinx_t3_exar_transparent_config(sdla_t *card,private_area_t *chan) -{ - u32 reg; - - DEBUG_EVENT("%s: Configuring for Transparent mode!\n", - card->devname); - - /* T3/E3 Exar Card */ - card->hw_iface.bus_read_4(card->hw,XILINX_CHIP_CFG_REG, ®); - /* Enable hdlc transparent mode */ - wan_set_bit(AFT_T3_HDLC_TRANS_MODE,®); - card->hw_iface.bus_write_4(card->hw,XILINX_CHIP_CFG_REG,reg); -} - - -#define BIT_DEV_ADDR_CLEAR 0x600 - -static int write_framer(void *pcard, unsigned short framer_off,unsigned short framer_data) -{ - sdla_t *card = (sdla_t*)pcard; - - framer_off &= ~BIT_DEV_ADDR_CLEAR; - - DEBUG_TEST("WRITE FRAMER OFFSET=0x%02X DATA=0x%02X\n", - framer_off,framer_data); - - card->hw_iface.bus_write_2(card->hw, - 0x46, - framer_off); - WP_DELAY(5); - - card->hw_iface.bus_write_2(card->hw, - 0x44, - framer_data); - WP_DELAY(5); - return 0; -} - -static unsigned int read_framer(void *pcard,unsigned short framer_off) -{ - sdla_t *card = (sdla_t*)pcard; - unsigned int framer_data; - - framer_off &= ~BIT_DEV_ADDR_CLEAR; - - - card->hw_iface.bus_write_2(card->hw, - 0x46, - framer_off); - WP_DELAY(5); - - card->hw_iface.bus_read_4(card->hw, - 0x44, - &framer_data); - WP_DELAY(5); - - DEBUG_TEST("READ FRAMER OFFSET=0x%02X DATA=0x%02X\n", - framer_off,framer_data); - - return framer_data; -} - -#if 0 -static void framer_reset(sdla_t *card) -{ - int i = 0; - unsigned short j = 0; - - j = (unsigned short)read_cpld(card,0x00); - j = j & 0x00FE; - write_cpld(card,0x00, j); - // delay - for(i=0;i<10;i++); - j = j | 0x0001; - write_cpld(card,0x00, j); -} -#endif - -/**SECTION************************************************************* - * - * TE3 Exar Tx Functions - * DMA Chains - * - **********************************************************************/ - - -/*=============================================== - * aft_tx_dma_chain_handler - * - */ -static void aft_tx_dma_chain_handler(unsigned long data) -{ - private_area_t *chan = (private_area_t *)data; - sdla_t *card = chan->card; - int dma_free=0; - u32 reg,dma_descr; - aft_dma_chain_t *dma_chain; - - if (wan_test_and_set_bit(TX_HANDLER_BUSY,&chan->dma_status)){ - DEBUG_EVENT("%s: SMP Critical in %s\n", - chan->if_name,__FUNCTION__); - return; - } - - dma_chain = &chan->tx_dma_chain_table[chan->tx_pending_chain_indx]; - - for (;;){ - - /* If the current DMA chain is in use,then - * all chains are busy */ - if (!wan_test_bit(0,&dma_chain->init)){ - break; - } - - dma_descr=(chan->tx_pending_chain_indx<<4) + XILINX_TxDMA_DESCRIPTOR_HI; - card->hw_iface.bus_read_4(card->hw,dma_descr,®); - - /* If GO bit is set, then the current DMA chain - * is in process of being transmitted, thus - * all are busy */ - if (wan_test_bit(TxDMA_HI_DMA_GO_READY_BIT,®)){ - break; - } - - DEBUG_TEST("%s: TX DMA Handler Chain %i\n",chan->if_name,dma_chain->index); - - if (dma_chain->skb){ -//NENAD -#if 1 - wan_skb_set_csum(dma_chain->skb, reg); - wan_skb_queue_tail(&chan->wp_tx_complete_list,dma_chain->skb); - dma_chain->skb=NULL; -#else - chan->if_stats.tx_packets++; - chan->if_stats.tx_bytes+=wan_skb_len(dma_chain->skb); -#endif - } - - aft_tx_dma_chain_init(chan,dma_chain); - - if (chan->single_dma_chain){ - break; - } - - if (++chan->tx_pending_chain_indx >= MAX_AFT_DMA_CHAINS){ - chan->tx_pending_chain_indx=0; - } - - dma_chain = &chan->tx_dma_chain_table[chan->tx_pending_chain_indx]; - dma_free=1; - } - - wan_clear_bit(TX_HANDLER_BUSY,&chan->dma_status); - - if (wan_skb_queue_len(&chan->wp_tx_complete_list)){ - WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); - } - - return; -} - -/*=============================================== - * aft_dma_chain_tx - * - */ -static int aft_dma_chain_tx(aft_dma_chain_t *dma_chain,private_area_t *chan, int intr) -{ - -#define dma_descr dma_chain->dma_descr -#define reg dma_chain->reg -#define len dma_chain->dma_len -#define dma_ch_indx dma_chain->index -#define len_align dma_chain->len_align -#define card chan->card - - dma_descr=(dma_ch_indx<<4) + XILINX_TxDMA_DESCRIPTOR_HI; - - DEBUG_TX("%s:%d: chan logic ch=%i chain=%li dma_descr=0x%x set!\n", - __FUNCTION__,__LINE__,chan->logic_ch_num,dma_ch_indx,dma_descr); - - card->hw_iface.bus_read_4(card->hw,dma_descr,®); - - if (wan_test_bit(TxDMA_HI_DMA_GO_READY_BIT,®)){ - DEBUG_EVENT("%s: Error: TxDMA GO Ready bit set on dma (chain=%i) Tx 0x%X\n", - card->devname,dma_ch_indx,reg); - card->hw_iface.bus_write_4(card->hw,dma_descr,0); - return -EBUSY; - } - - dma_descr=(dma_ch_indx<<4) + XILINX_TxDMA_DESCRIPTOR_LO; - - /* Write the pointer of the data packet to the - * DMA address register */ - reg=dma_chain->dma_addr; - - /* Set the 32bit alignment of the data length. - * Used to pad the tx packet to the 32 bit - * boundary */ - reg&=~(TxDMA_LO_ALIGNMENT_BIT_MASK); - reg|=(len&0x03); - - len_align=0; - if (len&0x03){ - len_align=1; - } - - DEBUG_TX("%s: TXDMA_LO=0x%X PhyAddr=0x%X DmaDescr=0x%X\n", - __FUNCTION__,reg,dma_chain->dma_addr,dma_descr); - - card->hw_iface.bus_write_4(card->hw,dma_descr,reg); - - dma_descr=(dma_ch_indx<<4) + XILINX_TxDMA_DESCRIPTOR_HI; - - reg=0; - - reg|=(((len>>2)+len_align)&TxDMA_HI_DMA_DATA_LENGTH_MASK); - - reg|=(chan->fifo_size_code&DMA_FIFO_SIZE_MASK)<fifo_base_addr&DMA_FIFO_BASE_ADDR_MASK)<< - DMA_FIFO_BASE_ADDR_SHIFT; - - - if (chan->single_dma_chain){ - wan_clear_bit(DMA_HI_TE3_NOT_LAST_FRAME_BIT,®); - wan_clear_bit(DMA_HI_TE3_INTR_DISABLE_BIT,®); - }else{ - - wan_set_bit(DMA_HI_TE3_NOT_LAST_FRAME_BIT,®); - - if (intr){ - DEBUG_TEST("%s: Setting Interrupt on index=%i\n", - chan->if_name,dma_ch_indx); - wan_clear_bit(DMA_HI_TE3_INTR_DISABLE_BIT,®); - }else{ - wan_set_bit(DMA_HI_TE3_INTR_DISABLE_BIT,®); - } - } - - if (chan->hdlc_eng){ - /* Only enable the Frame Start/Stop on - * non-transparent hdlc configuration */ - - wan_set_bit(TxDMA_HI_DMA_FRAME_START_BIT,®); - wan_set_bit(TxDMA_HI_DMA_FRAME_END_BIT,®); - } - - wan_set_bit(TxDMA_HI_DMA_GO_READY_BIT,®); - - DEBUG_TX("%s: TXDMA_HI=0x%X DmaDescr=0x%lX len=%i\n", - __FUNCTION__,reg,dma_chain->dma_addr,len); - - card->hw_iface.bus_write_4(card->hw,dma_descr,reg); - -#if 0 - ++chan->if_stats.tx_fifo_errors; -#endif - - return 0; - -#undef dma_descr -#undef reg -#undef len -#undef dma_ch_indx -#undef len_align -#undef card -} - -/*=============================================== - * aft_dma_chain_init - * - */ -static void aft_tx_dma_chain_init(private_area_t *chan, aft_dma_chain_t *dma_chain) -{ - - if (dma_chain->dma_addr){ - chan->card->hw_iface.pci_unmap_dma(chan->card->hw, - dma_chain->dma_addr, - dma_chain->dma_len, - PCI_DMA_TODEVICE); - } - - - if (dma_chain->skb){ - wan_skb_free(dma_chain->skb); - dma_chain->skb=NULL; - } - - dma_chain->dma_addr=0; - dma_chain->dma_len=0; - - wan_clear_bit(0,&dma_chain->init); -} - -static void aft_rx_dma_chain_init(private_area_t *chan, aft_dma_chain_t *dma_chain) -{ - - if (dma_chain->dma_addr){ - chan->card->hw_iface.pci_unmap_dma(chan->card->hw, - dma_chain->dma_addr, - dma_chain->dma_len, - PCI_DMA_FROMDEVICE); - } - - - if (dma_chain->skb){ - aft_init_requeue_free_skb(chan,dma_chain->skb); - dma_chain->skb=NULL; - } - - dma_chain->dma_addr=0; - dma_chain->dma_len=0; - - wan_clear_bit(0,&dma_chain->init); -} - -static int aft_realign_skb_pkt(private_area_t *chan, netskb_t *skb) -{ - unsigned char *data=wan_skb_data(skb); - int len = wan_skb_len(skb); - - if (len > chan->dma_mtu){ - DEBUG_EVENT("%s: Critical error: Tx unalign pkt(%d) > MTU buf(%d)!\n", - chan->if_name,len,chan->dma_mtu); - return -ENOMEM; - } - - if (!chan->tx_realign_buf){ - chan->tx_realign_buf=wan_malloc(chan->dma_mtu); - if (!chan->tx_realign_buf){ - DEBUG_EVENT("%s: Error: Failed to allocate tx memory buf\n", - chan->if_name); - return -ENOMEM; - }else{ - DEBUG_EVENT("%s: AFT Realign buffer allocated Len=%d\n", - chan->if_name,chan->dma_mtu); - - } - } - - memcpy(chan->tx_realign_buf,data,len); - - wan_skb_init(skb,0); - wan_skb_trim(skb,0); - - if (wan_skb_tailroom(skb) < len){ - DEBUG_EVENT("%s: Critical error: Tx unalign pkt tail room(%i) < unalign len(%i)!\n", - chan->if_name,wan_skb_tailroom(skb),len); - - return -ENOMEM; - } - - data=wan_skb_put(skb,len); - - if ((unsigned long)data & 0x03){ - /* At this point pkt should be realigned. If not - * there is something really wrong! */ - return -EINVAL; - } - - memcpy(data,chan->tx_realign_buf,len); - - return 0; -} - - - -/*=============================================== - * xilinx_dma_te3_tx - * - */ -static int xilinx_dma_te3_tx (sdla_t *card,private_area_t *chan, netskb_t *skb) -{ - int err=0, intr=0; - aft_dma_chain_t *dma_chain; - - if (wan_test_and_set_bit(TX_DMA_BUSY,&chan->dma_status)){ - DEBUG_EVENT("%s: SMP Critical in %s\n", - chan->if_name,__FUNCTION__); - - return -EBUSY; - } - - if (chan->tx_chain_indx >= MAX_AFT_DMA_CHAINS){ - DEBUG_EVENT("%s: MAJOR ERROR: TE3 Tx: Dma tx chain = %i\n", - chan->if_name,chan->tx_chain_indx); - if (!chan->single_dma_chain){ - aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); - } - return -EBUSY; - } - - dma_chain = &chan->tx_dma_chain_table[chan->tx_chain_indx]; - - aft_reset_tx_watchdog(card); - - /* If the current DMA chain is in use,then - * all chains are busy */ - if (wan_test_and_set_bit(0,&dma_chain->init)){ - wan_clear_bit(TX_DMA_BUSY,&chan->dma_status); - return -EBUSY; - } - - if ((unsigned long)wan_skb_data(skb) & 0x03){ - err=aft_realign_skb_pkt(chan,skb); - if (err){ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: Tx Error: Non Aligned packet %p: dropping...\n", - chan->if_name,wan_skb_data(skb)); - } - wan_skb_free(skb); - wan_clear_bit(0,&dma_chain->init); - chan->if_stats.tx_errors++; - return -EINVAL; - } - } - - dma_chain->skb=skb; - - dma_chain->dma_addr = - card->hw_iface.pci_map_dma(card->hw, - wan_skb_data(dma_chain->skb), - wan_skb_len(dma_chain->skb), - PCI_DMA_TODEVICE); - - dma_chain->dma_len = wan_skb_len(dma_chain->skb); - - - DEBUG_TX("%s: DMA Chain %i: Cur=%i Pend=%i Len=%i\n", - chan->if_name,dma_chain->index, - chan->tx_chain_indx,chan->tx_pending_chain_indx, - wan_skb_len(dma_chain->skb)); - - intr=0; - if (!chan->single_dma_chain && - !wan_test_bit(TX_INTR_PENDING,&chan->dma_chain_status)){ - int pending_indx=chan->tx_pending_chain_indx; - if (chan->tx_chain_indx >= pending_indx){ - intr = ((MAX_AFT_DMA_CHAINS-(chan->tx_chain_indx - - pending_indx))<=2); - }else{ - intr = ((pending_indx - chan->tx_chain_indx)<=2); - } - - if (intr){ - DEBUG_TEST("%s: Setting tx interrupt on chain=%i\n", - chan->if_name,dma_chain->index); - wan_set_bit(TX_INTR_PENDING,&chan->dma_chain_status); - } - } - - err=aft_dma_chain_tx(dma_chain,chan,intr); - if (err){ - DEBUG_EVENT("%s: Tx dma chain %i overrun error: should never happen!\n", - chan->if_name,dma_chain->index); - aft_tx_dma_chain_init(chan,dma_chain); - chan->if_stats.tx_errors++; - - wan_clear_bit(TX_DMA_BUSY,&chan->dma_status); - return -EINVAL; - } - - - /* We are sure that the packet will - * be bound and transmitted, thus unhook - * it from the protocol stack */ - wan_skb_unlink(skb); - - if (!chan->single_dma_chain){ - if (++chan->tx_chain_indx >= MAX_AFT_DMA_CHAINS){ - chan->tx_chain_indx=0; - } - - if (!wan_test_bit(TX_INTR_PENDING,&chan->dma_chain_status)){ - aft_enable_tx_watchdog(card,AFT_TX_TIMEOUT); - } - } - - wan_clear_bit(TX_DMA_BUSY,&chan->dma_status); - - return 0; -} - - - -/**SECTION************************************************************* - * - * TE3 Exar Rx Functions - * DMA Chains - * - **********************************************************************/ - -static int aft_dma_chain_rx(aft_dma_chain_t *dma_chain, private_area_t *chan, int intr) -{ -#define dma_descr dma_chain->dma_descr -#define reg dma_chain->reg -#define len dma_chain->dma_len -#define dma_ch_indx dma_chain->index -#define len_align dma_chain->len_align -#define card chan->card - - /* Write the pointer of the data packet to the - * DMA address register */ - reg=dma_chain->dma_addr; - - /* Set the 32bit alignment of the data length. - * Since we are setting up for rx, set this value - * to Zero */ - reg&=~(RxDMA_LO_ALIGNMENT_BIT_MASK); - - dma_descr=(dma_ch_indx<<4) + XILINX_RxDMA_DESCRIPTOR_LO; - -// DEBUG_RX("%s: RxDMA_LO = 0x%X, BusAddr=0x%X DmaDescr=0x%X\n", -// __FUNCTION__,reg,bus_addr,dma_descr); - - card->hw_iface.bus_write_4(card->hw,dma_descr,reg); - - dma_descr=(unsigned long)(dma_ch_indx<<4) + XILINX_RxDMA_DESCRIPTOR_HI; - - reg =0; - - if (chan->single_dma_chain){ - wan_clear_bit(DMA_HI_TE3_NOT_LAST_FRAME_BIT,®); - wan_clear_bit(DMA_HI_TE3_INTR_DISABLE_BIT,®); - }else{ - - wan_set_bit(DMA_HI_TE3_NOT_LAST_FRAME_BIT,®); - - if (intr){ - DEBUG_TEST("%s: Setting Rx Interrupt on index=%i\n", - chan->if_name,dma_ch_indx); - wan_clear_bit(DMA_HI_TE3_INTR_DISABLE_BIT,®); - }else{ - wan_set_bit(DMA_HI_TE3_INTR_DISABLE_BIT,®); - } - - } - - if (chan->hdlc_eng){ - reg|=((chan->dma_mtu>>2)-1)&RxDMA_HI_DMA_DATA_LENGTH_MASK; - }else{ - reg|=(card->wandev.mtu>>2)&RxDMA_HI_DMA_DATA_LENGTH_MASK; - } - - reg|=(chan->fifo_size_code&DMA_FIFO_SIZE_MASK)<fifo_base_addr&DMA_FIFO_BASE_ADDR_MASK)<< - DMA_FIFO_BASE_ADDR_SHIFT; - - wan_set_bit(RxDMA_HI_DMA_GO_READY_BIT,®); - - DEBUG_RX("%s: RXDMA_HI = 0x%X, BusAddr=0x%X DmaDescr=0x%X\n", - __FUNCTION__,reg,dma_chain->dma_addr,dma_descr); - - card->hw_iface.bus_write_4(card->hw,dma_descr,reg); - - return 0; - -#undef dma_descr -#undef reg -#undef len -#undef dma_ch_indx -#undef len_align -#undef card -} - -static int xilinx_dma_rx(sdla_t *card, private_area_t *chan, int gcur_ptr) -{ - int err=0, intr=0; - aft_dma_chain_t *dma_chain; - int cur_dma_ptr, i,max_dma_cnt,free_queue_len; - u32 reg; - - if (wan_test_and_set_bit(RX_DMA_BUSY,&chan->dma_status)){ - DEBUG_EVENT("%s: SMP Critical in %s\n", - chan->if_name,__FUNCTION__); - return -EBUSY; - } - - aft_reset_rx_watchdog(card); - - if (chan->single_dma_chain) { - max_dma_cnt=MAX_AFT_DMA_CHAINS; - cur_dma_ptr=0; - free_queue_len=MAX_AFT_DMA_CHAINS; - }else{ - - free_queue_len=wan_skb_queue_len(&chan->wp_rx_free_list); - if (free_queue_len == 0){ - aft_free_rx_complete_list(chan); - free_queue_len=wan_skb_queue_len(&chan->wp_rx_free_list); - if (free_queue_len == 0){ - DEBUG_EVENT("%s: %s() CRITICAL ERROR: No free rx buffers\n", - card->devname,__FUNCTION__); - goto te3_rx_skip; - } - } - - card->hw_iface.bus_read_4(card->hw,AFT_TE3_CRNT_DMA_DESC_ADDR_REG,®); - cur_dma_ptr=get_current_rx_dma_ptr(reg); - - if (chan->rx_chain_indx >= cur_dma_ptr){ - max_dma_cnt = MAX_AFT_DMA_CHAINS - (chan->rx_chain_indx-cur_dma_ptr); - }else{ - max_dma_cnt = cur_dma_ptr - chan->rx_chain_indx; - } - - if (free_queue_len < max_dma_cnt){ - #if 0 - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: Free List(%d) lower than max dma %d\n", - card->devname, - free_queue_len, - max_dma_cnt); - } - #endif - max_dma_cnt = free_queue_len; - } - - } - - DEBUG_TEST("%s: DMA RX: CBoardPtr=%i Driver=%i MaxDMA=%i\n", - card->devname,cur_dma_ptr,chan->rx_chain_indx,max_dma_cnt); - - for (i=0;irx_dma_chain_table[chan->rx_chain_indx]; - - /* If the current DMA chain is in use,then - * all chains are busy */ - if (wan_test_and_set_bit(0,&dma_chain->init)){ - DEBUG_TEST("%s: Warning: %s():%d dma chain busy %i!\n", - card->devname, __FUNCTION__, __LINE__, - dma_chain->index); - - err=-EBUSY; - break; - } - - dma_chain->skb=wan_skb_dequeue(&chan->wp_rx_free_list); - if (!dma_chain->skb){ - DEBUG_TEST("%s: Warning Rx chain = %i: no free rx bufs (RxComp=%i RxFree=%i)\n", - chan->if_name,dma_chain->index, - wan_skb_queue_len(&chan->wp_rx_complete_list), - wan_skb_queue_len(&chan->wp_rx_free_list)); - wan_clear_bit(0,&dma_chain->init); - err=-EINVAL; - break; - } - - dma_chain->dma_addr = - card->hw_iface.pci_map_dma(card->hw, - wan_skb_tail(dma_chain->skb), - chan->dma_mtu, - PCI_DMA_FROMDEVICE); - - dma_chain->dma_len = chan->dma_mtu; - - intr=0; - if (!wan_test_bit(RX_INTR_PENDING,&chan->dma_chain_status)){ - - free_queue_len--; - - if (free_queue_len <= 2){ - DEBUG_TEST("%s: DBG: Setting intr queue size low\n", - card->devname); - intr=1; - }else{ - if (chan->rx_chain_indx >= cur_dma_ptr){ - intr = ((MAX_AFT_DMA_CHAINS - - (chan->rx_chain_indx-cur_dma_ptr)) <=4); - }else{ - intr = ((cur_dma_ptr - chan->rx_chain_indx)<=4); - } - } - - if (intr){ - DEBUG_TEST("%s: Setting Rx interrupt on chain=%i\n", - chan->if_name,dma_chain->index); - wan_set_bit(RX_INTR_PENDING,&chan->dma_chain_status); - } - } - - DEBUG_TEST("%s: Setting Buffer on Rx Chain = %i Intr=%i\n", - chan->if_name,dma_chain->index, intr); - - err=aft_dma_chain_rx(dma_chain,chan,intr); - if (err){ - DEBUG_EVENT("%s: Rx dma chain %i overrun error: should never happen!\n", - chan->if_name,dma_chain->index); - aft_rx_dma_chain_init(chan,dma_chain); - chan->if_stats.rx_dropped++; - break; - } - - if (chan->single_dma_chain){ - break; - } - - if (++chan->rx_chain_indx >= MAX_AFT_DMA_CHAINS){ - chan->rx_chain_indx=0; - } - } - -te3_rx_skip: - - if (!chan->single_dma_chain){ - aft_enable_rx_watchdog(card,AFT_RX_TIMEOUT); - } - - wan_clear_bit(RX_DMA_BUSY,&chan->dma_status); - - return err; -} - -/*=============================================== - * aft_rx_dma_chain_handler - * - */ -//N1 -static void aft_rx_dma_chain_handler(private_area_t *chan, int wtd, int reset) -{ - sdla_t *card = chan->card; - u32 reg,dma_descr; - wp_rx_element_t *rx_el; - aft_dma_chain_t *dma_chain; - int i,max_dma_cnt, cur_dma_ptr; - - if (wan_test_and_set_bit(RX_HANDLER_BUSY,&chan->dma_status)){ - DEBUG_EVENT("%s: SMP Critical in %s\n", - chan->if_name,__FUNCTION__); - return; - } - - if (!wtd){ - /* Not watchdog, thus called from an interrupt. - * Clear the RX INTR Pending flag */ - wan_clear_bit(RX_INTR_PENDING,&chan->dma_chain_status); - } - - card->hw_iface.bus_read_4(card->hw,AFT_TE3_CRNT_DMA_DESC_ADDR_REG,®); - cur_dma_ptr=get_current_rx_dma_ptr(reg); - - max_dma_cnt = MAX_AFT_DMA_CHAINS; - - DEBUG_TEST("%s: DMA RX %s: CBoardPtr=%i Driver=%i MaxDMA=%i\n", - card->devname, - wtd?"WTD":"Intr", - cur_dma_ptr, - chan->rx_chain_indx,max_dma_cnt); - - for (i=0;irx_dma_chain_table[chan->rx_pending_chain_indx]; - if (!dma_chain){ - DEBUG_EVENT("%s:%d Assertion Error !!!!\n", - __FUNCTION__,__LINE__); - break; - } - - /* If the current DMA chain is in use,then - * all chains are busy */ - if (!wan_test_bit(0,&dma_chain->init)){ - DEBUG_TEST("%s: Warning (%s) Pending chain %i empty!\n", - chan->if_name,__FUNCTION__,dma_chain->index); - - break; - } - - dma_descr=(dma_chain->index<<4) + XILINX_RxDMA_DESCRIPTOR_HI; - card->hw_iface.bus_read_4(card->hw,dma_descr,®); - - /* If GO bit is set, then the current DMA chain - * is in process of being transmitted, thus - * all are busy */ - if (wan_test_bit(RxDMA_HI_DMA_GO_READY_BIT,®)){ - DEBUG_TEST("%s: Warning (%s) Pending chain %i Go bit still set!\n", - chan->if_name,__FUNCTION__,dma_chain->index); - break; - } - - card->hw_iface.pci_unmap_dma(card->hw, - dma_chain->dma_addr, - chan->dma_mtu, - PCI_DMA_FROMDEVICE); - - rx_el=(wp_rx_element_t *)wan_skb_push(dma_chain->skb, sizeof(wp_rx_element_t)); - memset(rx_el,0,sizeof(wp_rx_element_t)); - -#if 0 - chan->if_stats.rx_frame_errors++; -#endif - - /* Reading Rx DMA descriptor information */ - dma_descr=(dma_chain->index<<4) + XILINX_RxDMA_DESCRIPTOR_LO; - card->hw_iface.bus_read_4(card->hw,dma_descr, &rx_el->align); - rx_el->align&=RxDMA_LO_ALIGNMENT_BIT_MASK; - - dma_descr=(dma_chain->index<<4) + XILINX_RxDMA_DESCRIPTOR_HI; - card->hw_iface.bus_read_4(card->hw,dma_descr, &rx_el->reg); - - rx_el->pkt_error= dma_chain->pkt_error; - rx_el->dma_addr = dma_chain->dma_addr; - - wan_skb_queue_tail(&chan->wp_rx_complete_list,dma_chain->skb); - - DEBUG_RX("%s: RxInr Pending chain %i Rxlist=%i LO:0x%X HI:0x%X Data=0x%X Len=%i!\n", - chan->if_name,dma_chain->index, - wan_skb_queue_len(&chan->wp_rx_complete_list), - rx_el->align,rx_el->reg, - (*(unsigned char*)wan_skb_data(dma_chain->skb)), - wan_skb_len(dma_chain->skb)); - - dma_chain->skb=NULL; - dma_chain->dma_addr=0; - dma_chain->dma_len=0; - dma_chain->pkt_error=0; - wan_clear_bit(0,&dma_chain->init); - - - if (chan->single_dma_chain){ - break; - } - - if (++chan->rx_pending_chain_indx >= MAX_AFT_DMA_CHAINS){ - chan->rx_pending_chain_indx=0; - } - - } - - if (reset){ - goto reset_skip_rx_setup; - } - - xilinx_dma_rx(card,chan,cur_dma_ptr); - - if (wan_skb_queue_len(&chan->wp_rx_complete_list)){ - DEBUG_TEST("%s: Rx Queued list triggering\n",chan->if_name); - WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); - chan->rx_no_data_cnt=0; - }else{ - if (!chan->single_dma_chain){ - if ((chan->rx_no_data_cnt >= 0) && (++chan->rx_no_data_cnt < 3)){ - aft_enable_rx_watchdog(card,AFT_RX_TIMEOUT); - }else{ - /* Enable Rx Interrupt on pending rx descriptor */ - DEBUG_TEST("%s: Setting Max Rx Watchdog Timeout\n", - chan->if_name); - aft_enable_rx_watchdog(card,AFT_MAX_WTD_TIMEOUT); - chan->rx_no_data_cnt=-1; - } - } - } - -reset_skip_rx_setup: - - wan_clear_bit(RX_HANDLER_BUSY,&chan->dma_status); - - - return; -} - -static void aft_index_tx_rx_dma_chains(private_area_t *chan) -{ - int i; - - for (i=0;itx_dma_chain_table[i].index=i; - chan->rx_dma_chain_table[i].index=i; - } -} - - -static void aft_init_tx_rx_dma_descr(private_area_t *chan) -{ - int i; - u32 reg=0; - sdla_t *card=chan->card; - unsigned int tx_dma_descr,rx_dma_descr; - unsigned int dma_cnt=MAX_AFT_DMA_CHAINS; - - if (chan->single_dma_chain){ - dma_cnt=1; - } - - - for (i=0;ihw_iface.bus_write_4(card->hw,tx_dma_descr,reg); - card->hw_iface.bus_write_4(card->hw,rx_dma_descr,reg); - - aft_tx_dma_chain_init(chan,&chan->tx_dma_chain_table[i]); - aft_tx_dma_chain_init(chan,&chan->rx_dma_chain_table[i]); - } -} - -#if 0 -static void aft_dma_te3_set_intr(aft_dma_chain_t *dma_chain, private_area_t *chan) -{ -#define dma_ch_indx dma_chain->index -#define card chan->card - - u32 reg=0; - u32 len; - u32 dma_descr; - - /* If the current DMA chain is in use,then - * all chains are busy */ - if (!wan_test_bit(0,&dma_chain->init)){ - DEBUG_EVENT("%s: (%s) Error: Pending chain %i empty!\n", - chan->if_name,__FUNCTION__,dma_chain->index); - return; - } - - dma_descr=(unsigned long)(dma_ch_indx<<4) + XILINX_RxDMA_DESCRIPTOR_HI; - - card->hw_iface.bus_read_4(card->hw,dma_descr,®); - - /* If GO bit is set, then the current DMA chain - * is in process of being Received, thus - * all are busy */ - if (!wan_test_bit(RxDMA_HI_DMA_GO_READY_BIT,®)){ - DEBUG_EVENT("%s: (%s) Error: Pending chain %i Go bit is not set!\n", - chan->if_name,__FUNCTION__,dma_chain->index); - return; - } - - len=reg&RxDMA_HI_DMA_DATA_LENGTH_MASK; - - DEBUG_TEST("%s: Set Rx Intr on 1st Pending Chain: index=%i Len=%i (dmalen=%i)\n", - chan->if_name,dma_ch_indx,len,dma_chain->dma_len); - - wan_clear_bit(DMA_HI_TE3_INTR_DISABLE_BIT,®); - - card->hw_iface.bus_write_4(card->hw,dma_descr,reg); - -#undef dma_ch_indx -#undef card -} -#endif - -/* - * ****************************************************************** - * Proc FS function - */ -static int wan_aft3_get_info(void* pcard, struct seq_file *m, int *stop_cnt) -{ - sdla_t *card = (sdla_t*)pcard; - - m->count = - WAN_FECALL(&card->wandev, update_alarm_info, (&card->fe, m, stop_cnt)); - m->count = - WAN_FECALL(&card->wandev, update_pmon_info, (&card->fe, m, stop_cnt)); - - return m->count; -} - - -static void aft_free_rx_complete_list(private_area_t *chan) -{ - void *skb; - while((skb=wan_skb_dequeue(&chan->wp_rx_complete_list)) != NULL){ - - chan->if_stats.rx_dropped++; - aft_init_requeue_free_skb(chan, skb); - } -} - -static void aft_list_descriptors(private_area_t *chan) -{ -#if 0 - u32 reg,cur_dma_ptr; - sdla_t *card=chan->card; - aft_dma_chain_t *dma_chain; - u32 dma_descr; - int i; - - card->hw_iface.bus_read_4(card->hw,AFT_TE3_CRNT_DMA_DESC_ADDR_REG,®); - cur_dma_ptr=get_current_rx_dma_ptr(reg); - - DEBUG_EVENT("%s: List Descritpors:\n",chan->if_name); - - DEBUG_EVENT("%s: Chain DMA Status=0x%lX, TxCur=%i, TxPend=%i RxCur=%i RxPend=%i HwCur=%i RC=%i RFree=%i\n", - chan->if_name, - chan->dma_chain_status, - chan->tx_chain_indx, - chan->tx_pending_chain_indx, - chan->rx_chain_indx, - chan->rx_pending_chain_indx, - cur_dma_ptr, - wan_skb_queue_len(&chan->wp_rx_complete_list), - wan_skb_queue_len(&chan->wp_rx_free_list)); - - - for (i=0;irx_dma_chain_table[i]; - if (!dma_chain){ - DEBUG_EVENT("%s:%d Assertion Error !!!!\n", - __FUNCTION__,__LINE__); - break; - } - - dma_descr=(dma_chain->index<<4) + XILINX_RxDMA_DESCRIPTOR_HI; - card->hw_iface.bus_read_4(card->hw,dma_descr,®); - - DEBUG_EVENT("%s: DMA=%i : Init=%li Go=%u Intr=%u Addr=%s Skb=%s\n", - chan->if_name, - dma_chain->index, - dma_chain->init, - wan_test_bit(RxDMA_HI_DMA_GO_READY_BIT,®), - wan_test_bit(DMA_HI_TE3_INTR_DISABLE_BIT,®), - dma_chain->dma_addr?"Yes":"No", - dma_chain->skb?"Yes":"No"); - } -#endif -} - -static void aft_list_tx_descriptors(private_area_t *chan) -{ -#if 1 - u32 reg,cur_dma_ptr,low,dma_ctrl; - sdla_t *card=chan->card; - aft_dma_chain_t *dma_chain; - u32 dma_descr; - int i; - - card->hw_iface.bus_read_4(card->hw,AFT_TE3_CRNT_DMA_DESC_ADDR_REG,®); - cur_dma_ptr=get_current_tx_dma_ptr(reg); - - card->hw_iface.bus_read_4(card->hw,XILINX_DMA_CONTROL_REG,&dma_ctrl); - - DEBUG_EVENT("%s: List TX Descritpors:\n",chan->if_name); - - DEBUG_EVENT("%s: Chain DMA Status=0x%lX, TxCur=%i, TxPend=%i HwCur=%i RP=%i RC=%i RFree=%i Ctrl=0x%X\n", - chan->if_name, - chan->dma_chain_status, - chan->tx_chain_indx, - chan->tx_pending_chain_indx, - cur_dma_ptr, - wan_skb_queue_len(&chan->wp_tx_pending_list), - wan_skb_queue_len(&chan->wp_tx_complete_list), - wan_skb_queue_len(&chan->wp_tx_free_list), - dma_ctrl); - - - for (i=0;itx_dma_chain_table[i]; - if (!dma_chain){ - DEBUG_EVENT("%s:%d Assertion Error !!!!\n", - __FUNCTION__,__LINE__); - break; - } - - dma_descr=(dma_chain->index<<4) + XILINX_TxDMA_DESCRIPTOR_HI; - card->hw_iface.bus_read_4(card->hw,dma_descr,®); - - dma_descr=(dma_chain->index<<4) + XILINX_TxDMA_DESCRIPTOR_LO; - card->hw_iface.bus_read_4(card->hw,dma_descr,&low); - - DEBUG_EVENT("%s: DMA=%i : Init=%lu Go=%u Intr=%u Addr=%s Skb=%s HI=0x%X LO=0x%X\n", - chan->if_name, - dma_chain->index, - dma_chain->init, - wan_test_bit(TxDMA_HI_DMA_GO_READY_BIT,®), - wan_test_bit(DMA_HI_TE3_INTR_DISABLE_BIT,®), - dma_chain->dma_addr?"Yes":"No", - dma_chain->skb?"Yes":"No", - reg,low); - } -#endif -} - - -static void aft_free_rx_descriptors(private_area_t *chan) -{ - u32 reg; - sdla_t *card=chan->card; - aft_dma_chain_t *dma_chain; - u32 dma_descr; - int i; - - for (i=0;irx_dma_chain_table[i]; - if (!dma_chain){ - DEBUG_EVENT("%s:%d Assertion Error !!!!\n", - __FUNCTION__,__LINE__); - break; - } - - dma_descr=(dma_chain->index<<4) + XILINX_RxDMA_DESCRIPTOR_HI; - card->hw_iface.bus_read_4(card->hw,dma_descr,®); - - /* If GO bit is set, then the current DMA chain - * is in process of being transmitted, thus - * all are busy */ - reg=0; - card->hw_iface.bus_write_4(card->hw,dma_descr,reg); - - aft_rx_dma_chain_init(chan,&chan->rx_dma_chain_table[i]); - - dma_chain->skb=NULL; - dma_chain->dma_addr=0; - dma_chain->dma_len=0; - dma_chain->pkt_error=0; - wan_clear_bit(0,&dma_chain->init); - } - - aft_free_rx_complete_list(chan); - - DEBUG_TEST("%s: Free Rx Bufs (RxComp=%i RxFree=%i)\n", - chan->if_name, - wan_skb_queue_len(&chan->wp_rx_complete_list), - wan_skb_queue_len(&chan->wp_rx_free_list)); - - aft_reset_rx_chain_cnt(chan); -} - -static void aft_reset_rx_chain_cnt(private_area_t *chan) -{ - u32 reg,cur_dma_ptr; - sdla_t *card=chan->card; - card->hw_iface.bus_read_4(card->hw,AFT_TE3_CRNT_DMA_DESC_ADDR_REG,®); - - if (chan->single_dma_chain){ - set_current_rx_dma_ptr(®,0); - } - - cur_dma_ptr=get_current_rx_dma_ptr(reg); - chan->rx_pending_chain_indx = chan->rx_chain_indx = cur_dma_ptr; - return; -} - -static void aft_reset_tx_chain_cnt(private_area_t *chan) -{ - u32 reg,cur_dma_ptr; - sdla_t *card=chan->card; - card->hw_iface.bus_read_4(card->hw,AFT_TE3_CRNT_DMA_DESC_ADDR_REG,®); - - if (chan->single_dma_chain){ - set_current_tx_dma_ptr(®,0); - cur_dma_ptr=0; - } - - cur_dma_ptr=get_current_tx_dma_ptr(reg); - - chan->tx_pending_chain_indx = chan->tx_chain_indx = cur_dma_ptr; - return; -} - -static void aft_free_tx_descriptors(private_area_t *chan) -{ - u32 reg; - sdla_t *card=chan->card; - aft_dma_chain_t *dma_chain; - u32 dma_descr; - int i; - void *skb; - unsigned int dma_cnt=MAX_AFT_DMA_CHAINS; - - DEBUG_TEST("%s:%s: Tx: Freeing Descripors\n",card->devname,chan->if_name); - - wan_clear_bit(TX_INTR_PENDING,&chan->dma_chain_status); - wan_clear_bit(TX_DMA_BUSY,&chan->dma_status); - - for (i=0;itx_dma_chain_table[i]; - if (!dma_chain){ - DEBUG_EVENT("%s:%d Assertion Error !!!!\n", - __FUNCTION__,__LINE__); - break; - } - - dma_descr=(dma_chain->index<<4) + XILINX_TxDMA_DESCRIPTOR_HI; - reg=0; - card->hw_iface.bus_write_4(card->hw,dma_descr,reg); - - aft_tx_dma_chain_init(chan, dma_chain); - } - - aft_reset_tx_chain_cnt(chan); - - while((skb=wan_skb_dequeue(&chan->wp_tx_complete_list)) != NULL){ - wan_skb_free(skb); - } -} - - - -static void aft_te3_led_ctrl(sdla_t *card, int color, int led_pos, int on) -{ - u32 reg; - if (card->adptr_subtype == AFT_SUBTYPE_SHARK) { - - switch (color){ - - case WAN_AFT_RED: - if (on){ - wan_clear_bit(0,&card->u.aft.led_ctrl); - wan_clear_bit(2,&card->u.aft.led_ctrl); - }else{ - wan_set_bit(0,&card->u.aft.led_ctrl); - wan_set_bit(2,&card->u.aft.led_ctrl); - } - break; - - case WAN_AFT_GREEN: - if (on){ - wan_clear_bit(1,&card->u.aft.led_ctrl); - wan_clear_bit(3,&card->u.aft.led_ctrl); - }else{ - wan_set_bit(1,&card->u.aft.led_ctrl); - wan_set_bit(3,&card->u.aft.led_ctrl); - } - break; - } - - write_cpld(card,0x00,card->u.aft.led_ctrl); - } else { - card->hw_iface.bus_read_4(card->hw,TE3_LOCAL_CONTROL_STATUS_REG,®); - aft_te3_set_led(color, led_pos, on, ®); - card->hw_iface.bus_write_4(card->hw,TE3_LOCAL_CONTROL_STATUS_REG,reg); - } -} - - -static void __aft_fe_intr_ctrl(sdla_t *card, int status) -{ - u32 reg; - - card->hw_iface.bus_read_4(card->hw,XILINX_CHIP_CFG_REG,®); - if (status){ - wan_set_bit(FRONT_END_INTR_ENABLE_BIT,®); - }else{ - wan_clear_bit(FRONT_END_INTR_ENABLE_BIT,®); - } - card->hw_iface.bus_write_4(card->hw,XILINX_CHIP_CFG_REG,reg); -} - -#if 0 -static void aft_fe_intr_ctrl(sdla_t *card, int status) -{ - wan_smp_flag_t smp_flags; - - wan_spin_lock_irq(&card->wandev.lock,&smp_flags); - __aft_fe_intr_ctrl(card, status); - wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); -} -#endif - - -#if defined(__LINUX__) -# if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) -static void aft_port_task (void * card_ptr) -# else -static void aft_port_task (struct work_struct *work) -# endif -#else -static void aft_port_task (void * card_ptr, int arg) -#endif -{ -#if defined(__LINUX__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) - sdla_t *card = (sdla_t *)container_of(work, sdla_t, u.aft.port_task); -#else - sdla_t *card = (sdla_t *)card_ptr; -#endif - wan_smp_flag_t smp_flags,isr_flags; - - if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ - return; - } - - DEBUG_TEST("%s: AFT PORT TASK CMD=0x%X!\n", - card->devname,card->u.aft.port_task_cmd); - - if (wan_test_bit(AFT_FE_INTR,&card->u.aft.port_task_cmd)){ - card->hw_iface.hw_lock(card->hw,&smp_flags); - - wan_spin_lock_irq(&card->wandev.lock,&isr_flags); - __aft_fe_intr_ctrl(card, 0); - front_end_interrupt(card,0); - wan_clear_bit(AFT_FE_INTR,&card->u.aft.port_task_cmd); - __aft_fe_intr_ctrl(card, 1); - wan_spin_unlock_irq(&card->wandev.lock,&isr_flags); - - card->hw_iface.hw_unlock(card->hw,&smp_flags); - } - - if (wan_test_bit(AFT_FE_POLL,&card->u.aft.port_task_cmd)){ - card->hw_iface.hw_lock(card->hw,&smp_flags); - - wan_spin_lock_irq(&card->wandev.lock,&isr_flags); - __aft_fe_intr_ctrl(card, 0); - WAN_FECALL(&card->wandev, polling, (&card->fe)); - wan_clear_bit(AFT_FE_POLL,&card->u.aft.port_task_cmd); - __aft_fe_intr_ctrl(card, 1); - wan_spin_unlock_irq(&card->wandev.lock,&isr_flags); - - card->hw_iface.hw_unlock(card->hw,&smp_flags); - } - - if (wan_test_bit(AFT_FE_LED,&card->u.aft.port_task_cmd)){ - card->hw_iface.hw_lock(card->hw,&smp_flags); - wan_spin_lock_irq(&card->wandev.lock,&isr_flags); - __aft_fe_intr_ctrl(card, 0); - if (card->wandev.state == WAN_CONNECTED){ - aft_te3_led_ctrl(card, WAN_AFT_RED, 0, WAN_AFT_OFF); - aft_te3_led_ctrl(card, WAN_AFT_GREEN, 0,WAN_AFT_ON); - }else{ - aft_te3_led_ctrl(card, WAN_AFT_RED, 0, WAN_AFT_ON); - aft_te3_led_ctrl(card, WAN_AFT_GREEN, 0,WAN_AFT_OFF); - } - wan_clear_bit(AFT_FE_LED,&card->u.aft.port_task_cmd); - __aft_fe_intr_ctrl(card, 1); - wan_spin_unlock_irq(&card->wandev.lock,&isr_flags); - card->hw_iface.hw_unlock(card->hw,&smp_flags); - } - - -} - -static void aft_critical_shutdown (sdla_t *card) -{ - -#ifdef __LINUX__ - printk(KERN_ERR "%s: Error: Card Critically Shutdown!\n", - card->devname); -#else - DEBUG_EVENT("%s: Error: Card Critically Shutdown!\n", - card->devname); -#endif - - - /* Unconfiging, only on shutdown */ - if (IS_TE3(&card->fe.fe_cfg)) { - if (card->wandev.fe_iface.unconfig){ - card->wandev.fe_iface.unconfig(&card->fe); - } - } - - port_set_state(card,WAN_DISCONNECTED); - disable_data_error_intr(card,DEVICE_DOWN); - wan_set_bit(CARD_DOWN,&card->wandev.critical); - - aft_te3_led_ctrl(card, WAN_AFT_RED, 1, WAN_AFT_ON); - aft_te3_led_ctrl(card, WAN_AFT_GREEN, 1,WAN_AFT_OFF); - -} - -#if 0 -static int aft_hdlc_core_ready(sdla_t *card) -{ - u32 reg; - int i,err=1; - - for (i=0;i<5;i++){ - card->hw_iface.bus_read_4(card->hw,XILINX_CHIP_CFG_REG, ®); - - if (!wan_test_bit(HDLC_CORE_READY_FLAG_BIT,®)){ - WP_DELAY(500); - }else{ - err=0; - break; - } - } - - if (err){ - DEBUG_EVENT("%s: Critical Error: HDLC Core not ready!\n", - card->devname); - } - return err; -} -#endif -/****** End ****************************************************************/ diff --git a/patches/kdrivers/src/net/sdla_asyhdlc.c b/patches/kdrivers/src/net/sdla_asyhdlc.c index a848292..e98081f 100644 --- a/patches/kdrivers/src/net/sdla_asyhdlc.c +++ b/patches/kdrivers/src/net/sdla_asyhdlc.c @@ -229,7 +229,7 @@ static int set_asy_config (sdla_t* card); static int asy_comm_enable (sdla_t* card); /* Interrupt handlers */ -static WAN_IRQ_RETVAL wpc_isr (sdla_t* card); +static void wpc_isr (sdla_t* card); static void rx_intr (sdla_t* card); static void timer_intr(sdla_t *); @@ -387,7 +387,7 @@ int wp_asyhdlc_init (sdla_t* card, wandev_conf_t* conf) card->wandev.fe_enable_timer = chdlc_enable_timer; card->wandev.te_link_state = chdlc_handle_front_end_state; - conf->interface = + conf->electrical_interface = (IS_T1_CARD(card)) ? WANOPT_V35 : WANOPT_RS232; if (card->u.c.comm_port == WANOPT_PRI){ @@ -460,9 +460,9 @@ int wp_asyhdlc_init (sdla_t* card, wandev_conf_t* conf) card->u.c.update_call_count = 0; card->wandev.ttl = conf->ttl; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; - if ((card->u.c.comm_port == WANOPT_SEC && conf->interface == WANOPT_V35)&& + if ((card->u.c.comm_port == WANOPT_SEC && conf->electrical_interface == WANOPT_V35)&& card->type != SDLA_S514){ printk(KERN_INFO "%s: ERROR - V35 Interface not supported on S508 %s port \n", card->devname, PORT(card->u.c.comm_port)); @@ -609,7 +609,7 @@ int wp_asyhdlc_init (sdla_t* card, wandev_conf_t* conf) */ static int update (wan_device_t* wandev) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; netdevice_t *dev; chdlc_private_area_t* chdlc_priv_area; unsigned long smp_flags; @@ -619,7 +619,7 @@ static int update (wan_device_t* wandev) #endif /* sanity checks */ - if((wandev == NULL) || (wandev->private == NULL)) + if((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if(wandev->state == WAN_UNCONFIGURED) @@ -716,7 +716,7 @@ static int update (wan_device_t* wandev) */ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; chdlc_private_area_t* chdlc_priv_area; int err = 0; @@ -919,6 +919,8 @@ static int if_init (netdevice_t* dev) /* Initialize device driver entry points */ dev->open = &if_open; dev->stop = &if_close; + dev->hard_header = NULL; + dev->rebuild_header = NULL; dev->hard_start_xmit = &if_send; dev->get_stats = &if_stats; #if defined(LINUX_2_4)||defined(LINUX_2_6) @@ -1110,6 +1112,9 @@ static void disable_comm (sdla_t *card) /* TE1 - Unconfiging, only on shutdown */ if (IS_TE1_CARD(card)) { + if (card->wandev.fe_iface.pre_release){ + card->wandev.fe_iface.pre_release(&card->fe); + } if (card->wandev.fe_iface.unconfig){ card->wandev.fe_iface.unconfig(&card->fe); } @@ -1567,6 +1572,9 @@ static int chdlc_disable_comm_shutdown (sdla_t *card) /* TE1 - Unconfiging, only on shutdown */ if (IS_TE1_CARD(card)) { + if (card->wandev.fe_iface.pre_release){ + card->wandev.fe_iface.pre_release(&card->fe); + } if (card->wandev.fe_iface.unconfig){ card->wandev.fe_iface.unconfig(&card->fe); } @@ -1650,7 +1658,7 @@ static int update_comms_stats(sdla_t* card, if (IS_TE1_CARD(card)) { card->wandev.fe_iface.read_alarm(&card->fe, 0); /* TE1 Update T1/E1 perfomance counters */ - card->wandev.fe_iface.read_pmon(&card->fe, 0); + card->wandev.fe_iface.read_pmon(&card->fe); }else if (IS_56K_CARD(card)) { /* 56K Update CSU/DSU alarms */ card->wandev.fe_iface.read_alarm(&card->fe, 1); @@ -1737,7 +1745,7 @@ static unsigned char read_front_end_reg (void* card1, ...) /*============================================================================ * Write to TE1/56K Front end registers */ -static int write_front_end_reg (void* card1, ...) +static unsigned char write_front_end_reg (void* card1, ...) { va_list args; sdla_t *card = (sdla_t*)card1; @@ -1856,22 +1864,19 @@ static void chdlc_bh (unsigned long data) /*============================================================================ * Cisco HDLC interrupt service routine. */ -static WAN_IRQ_RETVAL wpc_isr (sdla_t* card) +static void wpc_isr (sdla_t* card) { netdevice_t* dev; SHARED_MEMORY_INFO_STRUCT flags; int i; - WAN_IRQ_RETVAL_DECL(irq_ret); - - WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); /* Check for which port the interrupt has been generated * Since Secondary Port is piggybacking on the Primary * the check must be done here. */ if (!card->hw){ - WAN_IRQ_RETURN(irq_ret); + return; } card->hw_iface.peek(card->hw, card->flags_off, @@ -1887,7 +1892,6 @@ static WAN_IRQ_RETVAL wpc_isr (sdla_t* card) if (!card->tty_opt && !dev && flags.interrupt_info_struct.interrupt_type != COMMAND_COMPLETE_APP_INT_PEND){ - WAN_IRQ_RETURN(irq_ret); goto isr_done; } @@ -1898,7 +1902,6 @@ static WAN_IRQ_RETVAL wpc_isr (sdla_t* card) if(test_bit(PERI_CRIT, (void*)&card->wandev.critical)) { printk(KERN_INFO "%s: Chdlc ISR: Critical with PERI_CRIT!\n", card->devname); - WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); goto isr_done; } @@ -1910,8 +1913,7 @@ static WAN_IRQ_RETVAL wpc_isr (sdla_t* card) card->devname); card->in_isr = 0; card->hw_iface.poke_byte(card->hw, card->intr_type_off, 0x00); - WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); - WAN_IRQ_RETURN(irq_ret); + return; } } @@ -1993,9 +1995,7 @@ isr_done: card->in_isr = 0; card->hw_iface.poke_byte(card->hw, card->intr_type_off, 0x00); - - WAN_IRQ_RETVAL_SET(irq_ret, WAN_IRQ_HANDLED); - WAN_IRQ_RETURN(irq_ret); + return; } /*============================================================================ @@ -2257,7 +2257,7 @@ static int set_asy_config(sdla_t* card) if(card->wandev.clocking) cfg.baud_rate = card->wandev.bps; - cfg.line_config_options = (card->wandev.interface == WANOPT_RS232) ? + cfg.line_config_options = (card->wandev.electrical_interface == WANOPT_RS232) ? INTERFACE_LEVEL_RS232 : INTERFACE_LEVEL_V35; cfg.modem_config_options = 0; @@ -3000,6 +3000,9 @@ static int config_chdlc (sdla_t *card, netdevice_t *dev) (IS_T1_CARD(card))?"T1":"E1"); return -EINVAL; } + if (card->wandev.fe_iface.post_init){ + err=card->wandev.fe_iface.post_init(&card->fe); + } } @@ -3016,6 +3019,9 @@ static int config_chdlc (sdla_t *card, netdevice_t *dev) card->devname); return -EINVAL; } + if (card->wandev.fe_iface.post_init){ + err=card->wandev.fe_iface.post_init(&card->fe); + } } @@ -3176,7 +3182,7 @@ static int chdlc_set_dev_config(struct file *file, if (wandev == NULL) return cnt; - card = (sdla_t*)wandev->private; + card = (sdla_t*)wandev->priv; printk(KERN_INFO "%s: New device config (%s)\n", wandev->name, buffer); diff --git a/patches/kdrivers/src/net/sdla_atm.c b/patches/kdrivers/src/net/sdla_atm.c index 4ccbe1c..f90e4e2 100644 --- a/patches/kdrivers/src/net/sdla_atm.c +++ b/patches/kdrivers/src/net/sdla_atm.c @@ -14,7 +14,7 @@ * ============================================================================ * Jul 13, 2004 David Rokhvarg Added Idle cell trace. * Sep 12, 2003 Nenad Corbic Fixed the TE1 clock selection, the -* conf->interfaces must be hardcoded, before +* conf->electrical_interfaces must be hardcoded, before * writting the value to the card structure. * Jan 07, 2002 Nenad Corbic Initial version. *****************************************************************************/ @@ -337,7 +337,7 @@ int wp_atm_init (sdla_t* card, wandev_conf_t* conf) if (IS_TE1_MEDIA(&conf->fe_cfg)){ memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - sdla_te_iface_init(&card->wandev.fe_iface); + sdla_te_iface_init(&card->fe,&card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; card->fe.write_fe_reg = write_front_end_reg; @@ -345,7 +345,7 @@ int wp_atm_init (sdla_t* card, wandev_conf_t* conf) card->wandev.fe_enable_timer = enable_timer; card->wandev.te_link_state = handle_front_end_state; - conf->interface = + conf->electrical_interface = (IS_T1_CARD(card)) ? WANOPT_V35 : WANOPT_RS232; if (card->wandev.comm_port == WANOPT_PRI){ @@ -355,7 +355,7 @@ int wp_atm_init (sdla_t* card, wandev_conf_t* conf) }else if (IS_56K_MEDIA(&conf->fe_cfg)){ memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - sdla_56k_iface_init(&card->wandev.fe_iface); + sdla_56k_iface_init(&card->fe,&card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; card->fe.write_fe_reg = write_front_end_reg; @@ -384,7 +384,7 @@ int wp_atm_init (sdla_t* card, wandev_conf_t* conf) card->wandev.clocking = conf->clocking; card->wandev.ignore_front_end_status = conf->ignore_front_end_status; card->wandev.ttl = conf->ttl; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; card->wandev.comm_port = conf->comm_port; card->wandev.udp_port = conf->udp_port; card->wandev.new_if_cnt = 0; @@ -656,13 +656,13 @@ atm_timer_poll_exit: */ static int update (wan_device_t* wandev) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; struct net_device* dev; volatile private_area_t* priv_area; unsigned long timeout; /* sanity checks */ - if((wandev == NULL) || (wandev->private == NULL)) + if((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if(wandev->state == WAN_UNCONFIGURED) @@ -751,7 +751,7 @@ static int update (wan_device_t* wandev) */ static int new_if (wan_device_t* wandev, struct net_device* dev, wanif_conf_t* conf) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; private_area_t* priv_area; int err = 0; @@ -971,7 +971,7 @@ new_if_error: static int del_if (wan_device_t* wandev, struct net_device* dev) { private_area_t* priv_area = dev->priv; - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; unsigned long flags; wan_atomic_dec(&card->wandev.if_cnt); @@ -1039,6 +1039,8 @@ static int if_init (struct net_device* dev) /* Initialize device driver entry points */ dev->open = &if_open; dev->stop = &if_close; + dev->hard_header = NULL; + dev->rebuild_header = NULL; dev->hard_start_xmit = &if_send; dev->get_stats = &if_stats; #if defined(LINUX_2_4)||defined(LINUX_2_6) @@ -1328,7 +1330,7 @@ static int if_send (netskb_t* skb, struct net_device* dev) { private_area_t *chan = dev->priv; sdla_t *card = chan->card; - unsigned long smp_flags=0; + unsigned long smp_flags; int err=0; /* Mark interface as busy. The kernel will not @@ -2065,7 +2067,7 @@ static int set_frmw_config(sdla_t* card) cfg.baud_rate = card->wandev.bps; } - cfg.line_config_options = (card->wandev.interface == WANOPT_RS232) ? + cfg.line_config_options = (card->wandev.electrical_interface == WANOPT_RS232) ? INTERFACE_LEVEL_RS232 : INTERFACE_LEVEL_V35; /* Automatic DTR/RTS and notify modem status changes */ @@ -3989,7 +3991,7 @@ static int get_dev_config_info(char* buf, char** start, off_t offs, int len, int return cnt; PROC_ADD_INIT(offs, stop_cnt); - card = (sdla_t*)wandev->private; + card = (sdla_t*)wandev->priv; PROC_ADD_LINE(cnt, (buf, &cnt, len, offs, &stop_cnt, &size, PROC_DEV_SEPARATE)); @@ -4037,7 +4039,7 @@ static int set_dev_config(struct file *file, if (wandev == NULL) return cnt; - card = (sdla_t*)wandev->private; + card = (sdla_t*)wandev->priv; DEBUG_EVENT( "%s: New device config (%s)\n", wandev->name, buffer); diff --git a/patches/kdrivers/src/net/sdla_bitstrm.c b/patches/kdrivers/src/net/sdla_bitstrm.c index f5b3933..d08ee4e 100644 --- a/patches/kdrivers/src/net/sdla_bitstrm.c +++ b/patches/kdrivers/src/net/sdla_bitstrm.c @@ -32,6 +32,11 @@ #include #include +#ifdef CONFIG_PRODUCT_WANPIPE_ANNEXG +# include "wanpipe_lapb_kernel.h" +#endif + + /****** Defines & Macros ****************************************************/ @@ -219,6 +224,10 @@ typedef struct bitstrm_private_area unsigned char rbs_on; unsigned char rbs_chan; unsigned char rbs_sig; + + netdevice_t *annexg_dev; + unsigned char label[WAN_IF_LABEL_SZ+1]; + //FIXME: add driver stats as per frame relay! } bitstrm_private_area_t; @@ -284,6 +293,14 @@ static int bstrm_comm_disable (sdla_t *card); static int bstrm_set_FE_config (sdla_t *card); +#ifdef CONFIG_PRODUCT_WANPIPE_ANNEXG +static int bind_annexg(netdevice_t *dev, netdevice_t *annexg_dev); +static netdevice_t * un_bind_annexg(wan_device_t *wandev, netdevice_t* annexg_dev_name); +static int get_map(wan_device_t*, netdevice_t*, struct seq_file* m, int*); +static void get_active_inactive(wan_device_t *wandev, netdevice_t *dev, + void *wp_stats); +#endif + /* Interrupt handlers */ static WAN_IRQ_RETVAL wpbit_isr (sdla_t* card); static void rx_intr (sdla_t* card); @@ -475,7 +492,7 @@ int wpbit_init (sdla_t* card, wandev_conf_t* conf) if (IS_TE1_MEDIA(&conf->fe_cfg)){ memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - sdla_te_iface_init(&card->wandev.fe_iface); + sdla_te_iface_init(&card->fe, &card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; card->fe.write_fe_reg = write_front_end_reg; @@ -484,7 +501,7 @@ int wpbit_init (sdla_t* card, wandev_conf_t* conf) card->wandev.fe_enable_timer = bstrm_enable_timer; card->wandev.te_link_state = bstrm_handle_front_end_state; - conf->interface = + conf->electrical_interface = (IS_T1_CARD(card)) ? WANOPT_V35 : WANOPT_RS232; if (card->u.b.comm_port == WANOPT_PRI){ @@ -501,7 +518,7 @@ int wpbit_init (sdla_t* card, wandev_conf_t* conf) }else if (IS_56K_MEDIA(&conf->fe_cfg)){ memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - sdla_56k_iface_init(&card->wandev.fe_iface); + sdla_56k_iface_init(&card->fe, &card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; card->fe.write_fe_reg = write_front_end_reg; @@ -555,6 +572,15 @@ int wpbit_init (sdla_t* card, wandev_conf_t* conf) card->wandev.new_if = &new_if; card->wandev.del_if = &del_if; card->wandev.udp_port = conf->udp_port; + + +#ifdef CONFIG_PRODUCT_WANPIPE_ANNEXG + card->wandev.bind_annexg = &bind_annexg; + card->wandev.un_bind_annexg = &un_bind_annexg; + card->wandev.get_map = &get_map; + card->wandev.get_active_inactive= &get_active_inactive; +#endif + card->wandev.new_if_cnt = 0; // Proc fs functions @@ -577,7 +603,7 @@ int wpbit_init (sdla_t* card, wandev_conf_t* conf) card->u.b.update_call_count = 0; card->wandev.ttl = conf->ttl; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; card->wandev.clocking = conf->clocking; @@ -877,13 +903,13 @@ int wpbit_init (sdla_t* card, wandev_conf_t* conf) static int update (wan_device_t* wandev) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; netdevice_t* dev; bitstrm_private_area_t* bstrm_priv_area; //unsigned long smp_flags; /* sanity checks */ - if((wandev == NULL) || (wandev->private == NULL)) + if((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if(wandev->state == WAN_UNCONFIGURED) @@ -1011,7 +1037,7 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) { int i; struct sk_buff *skb; - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; bitstrm_private_area_t* bstrm_priv_area; unsigned long smp_flags; int err=0; @@ -1199,6 +1225,17 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) bstrm_priv_area->protocol=0; DEBUG_EVENT( "%s: Running in STACK mode !\n", wandev->name); + +#ifdef CONFIG_PRODUCT_WANPIPE_ANNEXG + }else if (strcmp(conf->usedby, "ANNEXG") == 0) { + printk(KERN_INFO "%s:%s: Interface running in ANNEXG mode!\n", + wandev->name,bstrm_priv_area->if_name); + bstrm_priv_area->common.usedby=ANNEXG; + + if (strlen(conf->label)){ + strncpy(bstrm_priv_area->label,conf->label,WAN_IF_LABEL_SZ); + } +#endif } else if( strcmp(conf->usedby, "SWITCH") == 0) { bstrm_priv_area->common.usedby=SWITCH; @@ -1398,7 +1435,8 @@ new_if_error: static int del_if (wan_device_t* wandev, netdevice_t* dev) { bitstrm_private_area_t* bstrm_priv_area = dev->priv; - sdla_t *card = wandev->private; + bitstrm_private_area_t* chan = dev->priv; + sdla_t *card = wandev->priv; int i; unsigned long smp_flags; @@ -1406,6 +1444,34 @@ static int del_if (wan_device_t* wandev, netdevice_t* dev) return 0; } +#ifdef CONFIG_PRODUCT_WANPIPE_ANNEXG + if (chan->common.usedby == ANNEXG && chan->annexg_dev){ + netdevice_t *tmp_dev; + int err; + + printk(KERN_INFO "%s: Unregistering Lapb Protocol\n",wandev->name); + + if (!IS_FUNC_CALL(lapb_protocol,lapb_unregister)){ + wan_spin_lock_irq(&wandev->lock, &smp_flags); + chan->annexg_dev = NULL; + wan_spin_unlock_irq(&wandev->lock, &smp_flags); + return 0; + } + + wan_spin_lock_irq(&wandev->lock, &smp_flags); + tmp_dev=chan->annexg_dev; + chan->annexg_dev=NULL; + wan_spin_unlock_irq(&wandev->lock, &smp_flags); + + if ((err=lapb_protocol.lapb_unregister(tmp_dev))){ + wan_spin_lock_irq(&wandev->lock, &smp_flags); + chan->annexg_dev=tmp_dev; + wan_spin_unlock_irq(&wandev->lock, &smp_flags); + return err; + } + } +#endif + wan_spin_lock_irq(&card->wandev.lock, &smp_flags); if (test_bit(0,&card->in_isr)){ @@ -1638,14 +1704,14 @@ static int if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) DEBUG_DBG("INTERFACE_LEVEL_V35\n"); - card->wandev.interface = WANOPT_V35; + card->wandev.electrical_interface = WANOPT_V35; card->u.b.cfg.rx_complete_length = 720; card->u.b.cfg.max_length_tx_data_block = 720; card->u.b.time_slots = NO_ACTIVE_RX_TIME_SLOTS_T1; }else{ DEBUG_DBG("INTERFACE_LEVEL_RS232\n"); - card->wandev.interface = WANOPT_RS232; + card->wandev.electrical_interface = WANOPT_RS232; //Must be less than original 720, because //default .conf file is for T1. //It is max len which can be pushed into @@ -1654,11 +1720,9 @@ static int if_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) card->u.b.cfg.max_length_tx_data_block = 682;//divisible by 31 card->u.b.time_slots = NO_ACTIVE_RX_TIME_SLOTS_E1; } - if (card->wandev.fe_iface.pre_release){ card->wandev.fe_iface.pre_release(&card->fe); } - if (card->wandev.fe_iface.unconfig){ card->wandev.fe_iface.unconfig(&card->fe); } @@ -1989,10 +2053,10 @@ static void disable_comm (sdla_t *card) /* TE1 - Unconfiging */ + if (card->wandev.fe_iface.pre_release){ + card->wandev.fe_iface.pre_release(&card->fe); + } if (IS_TE1_CARD(card)) { - if (card->wandev.fe_iface.pre_release){ - card->wandev.fe_iface.pre_release(&card->fe); - } if (card->wandev.fe_iface.unconfig){ card->wandev.fe_iface.unconfig(&card->fe); } @@ -2025,7 +2089,14 @@ static void if_tx_timeout (netdevice_t *dev) }else if (chan->common.usedby == STACK){ wanpipe_lip_kick(chan,0); } - +#ifdef CONFIG_PRODUCT_WANPIPE_ANNEXG + if (chan->common.usedby == ANNEXG && + chan->annexg_dev){ + if (IS_FUNC_CALL(lapb_protocol,lapb_mark_bh)){ + lapb_protocol.lapb_mark_bh(chan->annexg_dev); + } + } +#endif } @@ -2730,6 +2801,13 @@ static void bstrm_tx_bh (unsigned long data) }else if (chan->common.usedby == STACK){ start_net_queue(chan->common.dev); wanpipe_lip_kick(chan,0); +#ifdef CONFIG_PRODUCT_WANPIPE_ANNEXG + }else if (chan->common.usedby == ANNEXG && + chan->annexg_dev){ + if (IS_FUNC_CALL(lapb_protocol,lapb_mark_bh)){ + lapb_protocol.lapb_mark_bh(chan->annexg_dev); + } +#endif }else if (chan->common.usedby == SWITCH){ start_net_queue(chan->common.dev); }else{ @@ -3246,7 +3324,9 @@ switch_hdlc_send: goto tx_up_skb_recover; } - }else{ +//ANNEXG RECEIVE + + } else{ buf = skb_push(new_skb,sizeof(api_rx_hdr_t)); memset(buf, 0, sizeof(api_rx_hdr_t)); @@ -3623,6 +3703,8 @@ static void calc_tx_crc(bitstrm_private_area_t *chan,unsigned char byte) static void tx_up_decode_pkt(bitstrm_private_area_t *chan) { unsigned char *buf; + sdla_t *card = chan->card; + struct sk_buff *skb = dev_alloc_skb(chan->rx_decode_len+sizeof(api_rx_hdr_t)); if (!skb){ DEBUG_EVENT( "%s: HDLC Tx up: failed to allocate memory!\n", @@ -3634,17 +3716,62 @@ static void tx_up_decode_pkt(bitstrm_private_area_t *chan) if (chan->common.usedby==STACK){ + buf = skb_put(skb,chan->rx_decode_len-2); + memcpy(buf, + chan->rx_decode_buf, + chan->rx_decode_len-2); + if (wanpipe_lip_rx(chan,skb) != 0){ dev_kfree_skb_any(skb); chan->card->wandev.stats.rx_dropped++; chan->ifstats.rx_dropped++; }else{ chan->card->wandev.stats.rx_packets++; - chan->card->wandev.stats.rx_bytes += chan->rx_decode_len; + chan->card->wandev.stats.rx_bytes += chan->rx_decode_len-2; chan->ifstats.rx_packets++; - chan->ifstats.rx_bytes+=chan->rx_decode_len; + chan->ifstats.rx_bytes+=chan->rx_decode_len-2; } +#ifdef CONFIG_PRODUCT_WANPIPE_ANNEXG + } else if (chan->common.usedby == ANNEXG) { + + if (!chan->annexg_dev) { + dev_kfree_skb_any(skb); + ++card->wandev.stats.rx_dropped; + chan->ifstats.rx_dropped++; + return; + } + + if ((chan->rx_decode_len) <= 2) { + DEBUG_EVENT("%s: Bad Rx Frame Length %i\n", + card->devname,chan->rx_decode_len); + dev_kfree_skb_any(skb); + ++card->wandev.stats.rx_dropped; + chan->ifstats.rx_dropped++; + return; + } + + buf = skb_put(skb,chan->rx_decode_len-2); + memcpy(buf, + chan->rx_decode_buf, + chan->rx_decode_len-2); + + skb->protocol = htons(ETH_P_X25); + skb->dev = chan->annexg_dev; + wan_skb_reset_mac_header(skb); + + if (IS_FUNC_CALL(lapb_protocol,lapb_rx)) { + lapb_protocol.lapb_rx(chan->annexg_dev,skb); + card->wandev.stats.rx_packets++; + card->wandev.stats.rx_bytes += chan->rx_decode_len-2; + chan->ifstats.rx_packets++; + chan->ifstats.rx_bytes+=chan->rx_decode_len-2; + } else { + dev_kfree_skb_any(skb); + ++card->wandev.stats.rx_dropped; + } + +#endif }else if (chan->common.usedby==API || chan->common.usedby==SWITCH){ buf = skb_put(skb,sizeof(api_rx_hdr_t)); @@ -4236,7 +4363,7 @@ static int set_bstrm_config(sdla_t* card) cfg.baud_rate = card->wandev.bps; } - cfg.line_config_options = (card->wandev.interface == WANOPT_RS232) ? + cfg.line_config_options = (card->wandev.electrical_interface == WANOPT_RS232) ? INTERFACE_LEVEL_RS232 : INTERFACE_LEVEL_V35; cfg.modem_config_options = 0; @@ -4592,7 +4719,7 @@ static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, /* Decapsulate pkt and pass it up the protocol stack */ new_skb->protocol = htons(ETH_P_IP); new_skb->dev = dev; - wan_skb_reset_mac_header(new_skb); + wan_skb_reset_mac_header(new_skb); netif_rx(new_skb); } else { @@ -4944,6 +5071,21 @@ static void port_set_state (sdla_t *card, int state) }else{ wanpipe_lip_disconnect(bstrm_priv_area,0); } + +#ifdef CONFIG_PRODUCT_WANPIPE_ANNEXG + } else if (bstrm_priv_area->common.usedby == ANNEXG && + bstrm_priv_area->annexg_dev){ + if (state == WAN_CONNECTED){ + if (IS_FUNC_CALL(lapb_protocol,lapb_link_up)){ + lapb_protocol.lapb_link_up(bstrm_priv_area->annexg_dev); + } + } else { + if (IS_FUNC_CALL(lapb_protocol,lapb_link_down)){ + lapb_protocol.lapb_link_down(bstrm_priv_area->annexg_dev); + } + } + +#endif }else if (bstrm_priv_area->common.usedby == API){ wan_wakeup_api(bstrm_priv_area); wan_update_api_state(bstrm_priv_area); @@ -5060,6 +5202,7 @@ static int config_bstrm (sdla_t *card) if (card->wandev.fe_iface.post_init){ err=card->wandev.fe_iface.post_init(&card->fe); } + } @@ -5153,10 +5296,10 @@ static int bstrm_get_config_info(void* priv, struct seq_file* m, int* stop_cnt) wan_device_t* wandev = (wan_device_t*)priv; sdla_t* card = NULL; - if (wandev == NULL || wandev->private == NULL) + if (wandev == NULL || wandev->priv == NULL) return 0; - card = (sdla_t*)wandev->private; + card = (sdla_t*)wandev->priv; if (!card->comm_enabled){ DEBUG_EVENT( "DEBUG: Enable communication for Bit Streaming protocol\n"); bstrm_comm_enable (card); @@ -5290,7 +5433,7 @@ static int bstrm_bind_dev_switch (sdla_t *card, bitstrm_private_area_t*chan, cha return 0; } - sw_dev = wan_dev_get_by_name(sw_dev_name); + sw_dev = dev_get_by_name(sw_dev_name); if (!sw_dev){ DEBUG_EVENT( "%s: Device %s waiting for switch device %s\n", card->devname, chan->if_name,sw_dev_name); @@ -5498,6 +5641,8 @@ static int protocol_shutdown (sdla_t *card, netdevice_t *dev) wp_sppp_detach(dev); dev->do_ioctl = NULL; + dev->hard_header = NULL; + dev->rebuild_header = NULL; if (chan->common.prot_ptr){ kfree(chan->common.prot_ptr); @@ -5735,3 +5880,100 @@ static int send_rbs_oob_msg (sdla_t *card, bitstrm_private_area_t *chan) return err; } +#ifdef CONFIG_PRODUCT_WANPIPE_ANNEXG +static int bind_annexg(netdevice_t *dev, netdevice_t *annexg_dev) +{ + unsigned long smp_flags=0; + bitstrm_private_area_t* chan = dev->priv; + sdla_t *card = chan->card; + if (!chan) + return -EINVAL; + + if (chan->common.usedby != ANNEXG) + return -EPROTONOSUPPORT; + + if (chan->annexg_dev) + return -EBUSY; + + spin_lock_irqsave(&card->wandev.lock,smp_flags); + chan->annexg_dev = annexg_dev; + spin_unlock_irqrestore(&card->wandev.lock,smp_flags); + return 0; +} + + +static netdevice_t * un_bind_annexg(wan_device_t *wandev, netdevice_t *annexg_dev) +{ + struct wan_dev_le *devle; + netdevice_t *dev; + unsigned long smp_flags=0; + sdla_t *card = wandev->priv; + + WAN_LIST_FOREACH(devle, &card->wandev.dev_head, dev_link){ + bitstrm_private_area_t* chan; + + dev = WAN_DEVLE2DEV(devle); + if (dev == NULL || (chan = wan_netif_priv(dev)) == NULL) + continue; + + if (!chan->annexg_dev || chan->common.usedby != ANNEXG) + continue; + + if (chan->annexg_dev == annexg_dev){ + spin_lock_irqsave(&card->wandev.lock,smp_flags); + chan->annexg_dev = NULL; + spin_unlock_irqrestore(&card->wandev.lock,smp_flags); + return dev; + } + } + return NULL; +} + + +static void get_active_inactive(wan_device_t *wandev, netdevice_t *dev, + void *wp_stats_ptr) +{ + bitstrm_private_area_t* chan = dev->priv; + wp_stack_stats_t *wp_stats = (wp_stack_stats_t *)wp_stats_ptr; + + if (chan->common.usedby == ANNEXG && chan->annexg_dev){ + if (IS_FUNC_CALL(lapb_protocol,lapb_get_active_inactive)){ + lapb_protocol.lapb_get_active_inactive(chan->annexg_dev,wp_stats); + } + } + + if (chan->common.state == WAN_CONNECTED){ + wp_stats->fr_active++; + }else{ + wp_stats->fr_inactive++; + } +} + +static int +get_map(wan_device_t *wandev, netdevice_t *dev, struct seq_file* m, int* stop_cnt) +{ + bitstrm_private_area_t* chan = dev->priv; + + if (!(dev->flags&IFF_UP)){ + return m->count; + } + + if (chan->common.usedby == ANNEXG && chan->annexg_dev){ + if (IS_FUNC_CALL(lapb_protocol,lapb_get_map)){ + return lapb_protocol.lapb_get_map(chan->annexg_dev, + m); + } + } + + PROC_ADD_LINE(m, + "%15s:%s:%c:%s:%c\n", + chan->label, + wandev->name,(wandev->state == WAN_CONNECTED) ? '*' : ' ', + dev->name,(chan->common.state == WAN_CONNECTED) ? '*' : ' '); + + return m->count; +} + +#endif + + diff --git a/patches/kdrivers/src/net/sdla_bri.c b/patches/kdrivers/src/net/sdla_bri.c new file mode 100755 index 0000000..201b4d0 --- /dev/null +++ b/patches/kdrivers/src/net/sdla_bri.c @@ -0,0 +1,3356 @@ +/*************************************************************************** + * sdla_bri.c WANPIPE(tm) + * ISDN-BRI support module for "Cologne XHFC-2SU" chip. + * + * Author(s): David Rokhvarg + * + * Copyright: (c) 1984 - 2007 Sangoma Technologies 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. + * + * ============================================================================ + * March 12, 2007 David Rokhvarg + * v1.0 Initial version. + * + * February 26, 2008 David Rokhvarg + * v1.1 Imrovements in SU State transition code. + * Implemented T3 and T4 timers. + * + ****************************************************************************** + */ + +/******************************************************************************* +** INCLUDE FILES +*******************************************************************************/ + +#if defined(__FreeBSD__) || defined(__OpenBSD__) +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include /* for 'wanpipe_common_t' used in 'sdla_aft_te1.h'*/ +# include /* for 'private_area_t' */ +#elif (defined __WINDOWS__) +# include +# include +# include +# include +# include +# include +# include +# include +# include /* for 'wanpipe_common_t' used in 'sdla_aft_te1.h'*/ +# include /* for 'private_area_t' */ +#else +# include +# include +# include +# include +# include +# include +# include +# include +# include /* for 'wanpipe_common_t' used in 'sdla_aft_te1.h'*/ +# include /* for 'private_area_t' */ +#endif + +#undef DEBUG_BRI +#define DEBUG_BRI if(0)DEBUG_EVENT + +/* DEBUG macro definitions */ +#define DEBUG_HFC_INIT if(0)DEBUG_EVENT +#define DEBUG_HFC_MODE if(0)DEBUG_EVENT +#define DEBUG_HFC_S0_STATES if(0)DEBUG_EVENT +#define DEBUG_HFC_IRQ if(0)DEBUG_EVENT +#define DEBUG_HFC_SU_IRQ if(0)DEBUG_EVENT + +#define DEBUG_HFC_TX if(0)DEBUG_EVENT +#define DEBUG_TX_DATA if(0)DEBUG_EVENT +#define TX_EXTRA_DBG if(0)DEBUG_EVENT +#define TX_FAST_DBG if(0)DEBUG_EVENT + +#define DEBUG_HFC_RX if(0)DEBUG_EVENT +#define RX_EXTRA_DBG if(0)DEBUG_EVENT +#define DEBUG_RX1 if(0)DEBUG_EVENT +#define DBG_RX_DATA if(0)DEBUG_EVENT + +#define DEBUG_HFC_CLOCK if(0)DEBUG_EVENT + +#define BUILD_MOD_TESTER 0 /* for Production Test */ +#define DBG_MODULE_TESTER if(0)DEBUG_EVENT + +#define NT_STATE_FUNC() if(0)DEBUG_EVENT("%s(): line: %d\n", __FUNCTION__, __LINE__) +#define CLOCK_FUNC() if(0)DEBUG_EVENT("%s(): line: %d\n", __FUNCTION__, __LINE__) + +#define DBG_SPI if(0)DEBUG_EVENT + +#define DEBUG_FE_STATUS if(0)DEBUG_EVENT + +/* Timer interrupt counter - used by activation timer T3 */ +#define HFC_TIMER_COUNTER_T3 2 + +#define FIFO_THRESHOLD_INDEX 1 + +#define LINE_STABILITY_THRESHOLD 3 + +enum { + WAITING_TO_STABILIZE=1, + LINE_STABLE, + LINE_DISCONNECTED +}; + + +#define CHECK_DATA 0 +#if CHECK_DATA +static void dump_chip_SRAM(sdla_fe_t *fe, u8 mod_no, u8 port_no); +static void dump_data(u8 *data, int data_len); +static int check_data(u8 *data, int data_len); +#endif + +/******************************************************************************* +** DEFINES AND MACROS +*******************************************************************************/ +#define REPORT_MOD_NO (mod_no+1) + +static u8 validate_fe_line_no(sdla_fe_t *fe, const char *caller_name) +{ + if ((int32_t)WAN_FE_LINENO(fe) < 0 || WAN_FE_LINENO(fe) > MAX_BRI_LINES){ + DEBUG_EVENT("%s(): %s: ISDN BRI: Invalid FE line number %d (Min=1 Max=%d)\n", + caller_name, fe->name, WAN_FE_LINENO(fe)+1, MAX_BRI_LINES); + return 1; + } + return 0; +} + +static int32_t validate_physical_mod_no(u32 mod_no, const char *caller_name) +{ + if(mod_no % 2){ + DEBUG_EVENT("%s(): Error: mod_no (%d) is not divisible by 2!!\n", + caller_name, mod_no); + return 1; + } + + if(mod_no >= MAX_BRI_LINES){ + DEBUG_EVENT("%s(): Error: mod_no (%d) is greate than maximum of %d!!\n", + caller_name, mod_no, MAX_BRI_LINES - 1); + return 1; + } + return 0; +} + +/* Translate FE_LINENO to physical module number divisible by BRI_MAX_PORTS_PER_CHIP. */ +static u8 fe_line_no_to_physical_mod_no(sdla_fe_t *fe) +{ + u8 mod_no; + + mod_no = WAN_FE_LINENO(fe); + /* get quotient between 0 and 11 (including) */ + mod_no = mod_no / BRI_MAX_PORTS_PER_CHIP; + /* here WAN_FE_LINENO(fe) is translated into an EVEN number between 0 and 22 (including). */ + mod_no *= BRI_MAX_PORTS_PER_CHIP; + + if(validate_physical_mod_no(mod_no, __FUNCTION__)){ + return 0; + } + + return mod_no; +} + +/* Translate FE_LINENO to port number on the module. can be only 0 or 1. */ +static u8 fe_line_no_to_port_no(sdla_fe_t *fe) +{ + return WAN_FE_LINENO(fe) % BRI_MAX_PORTS_PER_CHIP; +} + + +/*******************************************************************************/ +/* Register Write/Read debugging funcitons */ + +/* Enabling/Disabling register debugging */ +#define WAN_DEBUG_BRI_REG 0 + +#if WAN_DEBUG_BRI_REG + +#define HFC_WRITE 1 +#define HFC_READ 2 + +static void decode_reg_r_fifo(__u8 data, __u8 read_or_write_direction); +static void decode_reg_r_slot(__u8 data, __u8 read_or_write_direction); +static void decode_reg_r_su_irqmsk(__u8 data, __u8 read_or_write_direction); +static void decode_reg_r_fifo_md(__u8 data, __u8 read_or_write_direction); +static void decode_reg_r_pcm_md0(__u8 data, __u8 read_or_write_direction); +static void decode_reg_a_sl_cfg(__u8 data, __u8 read_or_write_direction); +static void decode_reg_a_con_hdlc(__u8 data, __u8 read_or_write_direction); +static void decode_reg_a_fifo_sta(__u8 data, __u8 read_or_write_direction); +static void decode_reg_a_su_rd_sta(__u8 data, __u8 read_or_write_direction); +#endif /* WAN_DEBUG_BRI_REG */ +/*******************************************************************************/ + + +/*******************************************************************************/ +/* SPI access functions and dbg macros */ + +static +__u8 _read_xhfc(sdla_fe_t *fe, u32 mod_no, u8 reg, const char *caller_name, int32_t file_lineno); + +static +int32_t _write_xhfc(sdla_fe_t *fe, u32 mod_no, u8 reg, u8 val, + const char *caller_name, int32_t file_lineno); + +/* Read/Write to front-end register */ +#define WRITE_REG(reg,val) _write_xhfc(fe, mod_no, reg, val, __FUNCTION__, __LINE__) +#define READ_REG(reg) _read_xhfc(fe, mod_no, reg, __FUNCTION__, __LINE__) + +/*******************************************************************************/ + + +/******************************************************************************* +** STRUCTURES AND TYPEDEFS +*******************************************************************************/ + + +/******************************************************************************* +** GLOBAL VARIABLES +*******************************************************************************/ +#if !defined(__WINDOWS__) +extern WAN_LIST_HEAD(, wan_tdmv_) wan_tdmv_head; +#endif + + +/******************************************************************************* +** FUNCTION PROTOTYPES +*******************************************************************************/ +static int32_t bri_global_config(void* pfe); +static int32_t bri_global_unconfig(void* pfe); +static int32_t wp_bri_config(void *pfe); +static int32_t wp_bri_unconfig(void *pfe); +static int32_t wp_bri_post_init(void *pfe); +static int32_t wp_bri_if_config(void *pfe, u32 mod_map, u8); +static int32_t wp_bri_if_unconfig(void *pfe, u32 mod_map, u8); +static int32_t wp_bri_disable_irq(sdla_fe_t *fe, u32 mod_no, u8 port_no); +static void bri_enable_interrupts(sdla_fe_t *fe, u32 mod_no, u8 port_no); +static int32_t wp_bri_intr(sdla_fe_t *); +static int32_t wp_bri_check_intr(sdla_fe_t *); +static int32_t wp_bri_polling(sdla_fe_t*); +static int32_t wp_bri_udp(sdla_fe_t*, void*, u8*); +static u32 wp_bri_active_map(sdla_fe_t* fe, u8 line_no); +static u8 wp_bri_fe_media(sdla_fe_t *fe); +static int32_t wp_bri_set_dtmf(sdla_fe_t*, int32_t, u8); +static int wp_bri_intr_ctrl(sdla_fe_t *fe, int, u_int8_t, u_int8_t, unsigned int); +static int wp_bri_event_ctrl(sdla_fe_t*, wan_event_ctrl_t*); + +static int wp_bri_pre_release(void* pfe); + +static int32_t wp_bri_dchan_tx(sdla_fe_t *fe, void *src_data_buffer, u32 buffer_len); + +static void *wp_bri_dchan_rx(sdla_fe_t *fe, u8 mod_no, u8 port_no); + +static int wp_bri_get_fe_status(sdla_fe_t *fe, unsigned char *status); +static int wp_bri_set_fe_status(sdla_fe_t *fe, unsigned char status); + + +/*******************************************************************************/ +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) +static void l1_timer_expire_t3(void* pfe); +static void l1_timer_expire_t4(void* pfe); +#elif defined(__WINDOWS__) +static void l1_timer_expire_t3(IN PKDPC Dpc, void* pfe, void* arg2, void* arg3); +static void l1_timer_expire_t4(IN PKDPC Dpc, void* pfe, void* arg2, void* arg3); +#else +static void l1_timer_expire_t3(unsigned long pfe); +static void l1_timer_expire_t4(unsigned long pfe); +#endif + +static void l1_timer_start_t3(void *pport); +static void l1_timer_stop_t3(void *pport); +static void l1_timer_start_t4(void *pport); +static void l1_timer_stop_t4(void *pport); +/*******************************************************************************/ + +#if defined(AFT_TDM_API_SUPPORT) +static int32_t wp_bri_watchdog(sdla_fe_t *fe); +#endif + +static int32_t wp_bri_spi_bus_reset(sdla_fe_t *fe); +static int32_t reset_chip(sdla_fe_t *fe, u32 mod_no); +static int32_t init_xfhc(sdla_fe_t *fe, u32 mod_no); +static void xhfc_select_fifo(sdla_fe_t *fe, u32 mod_no, u8 fifo); +static void xhfc_waitbusy(sdla_fe_t *fe, u32 mod_no); +static void xhfc_select_pcm_slot(sdla_fe_t *fe, u32 mod_no, u8 slot, u8 direction); +static void xhfc_increment_fifo(sdla_fe_t *fe, u32 mod_no); +static int32_t config_clock_routing(sdla_fe_t *fe, u32 mod_no, u8 master_mode); +static int32_t clock_control(sdla_fe_t *fe, u8 line_state); +static void xhfc_ph_command(sdla_fe_t *fe, bri_xhfc_port_t *port, u_char command); + +static u8 __su_new_state(sdla_fe_t *fe, u32 mod_no, u8 port_no); +static void sdla_bri_set_status(sdla_fe_t* fe, u8 mod_no, u8 port_no, u8 status); + +/* for selecting PCM direction */ +#define XHFC_DIRECTION_TX 0 +#define XHFC_DIRECTION_RX 1 + +#if 0 +static void xhfc_select_xhfc_channel(sdla_fe_t *fe, u32 mod_no, + u8 channel, u8 direction, u8 vrout_bitmap); +#endif + +static int32_t check_f0cl_increment(sdla_fe_t *fe, u8 old_f0cl, u8 new_f0cl, int32_t *diff); + +/******************************************************************************* +** FUNCTION DEFINITIONS +*******************************************************************************/ + + +/*******************************************************************************/ + +static +u8 _read_xhfc(sdla_fe_t *fe, u32 mod_no, u8 reg, const char *caller_name, int32_t file_lineno) +{ + u8 val = READ_BRI_REG(mod_no, reg); + +#if WAN_DEBUG_BRI_REG /* extra heavy debugging for the chip */ + switch(reg) + { + case R_FIFO: + decode_reg_r_fifo(val, HFC_READ); + break; + case R_SLOT: + decode_reg_r_slot(val, HFC_READ); + break; + case R_SU_IRQMSK: + decode_reg_r_su_irqmsk(val, HFC_READ); + break; + case R_FIFO_MD: + decode_reg_r_fifo_md(val, HFC_READ); + break; + case R_PCM_MD0: + decode_reg_r_pcm_md0(val, HFC_READ); + break; + case A_SL_CFG: + decode_reg_a_sl_cfg(val, HFC_READ); + break; + case A_CON_HDLC: + decode_reg_a_con_hdlc(val, HFC_READ); + break; + case A_FIFO_STA: + decode_reg_a_fifo_sta(val, HFC_READ); + break; + case A_SU_RD_STA: + decode_reg_a_su_rd_sta(val, HFC_READ); + break; + default: + ;/* DEBUG_HFC_MODE("HFC_READ: reg decoder unknow reg: 0x%X.\n", reg); */ + } +#endif + + return val; +} + +static +int32_t _write_xhfc(sdla_fe_t *fe, u32 mod_no, u8 reg, u8 val, const char *caller_name, int32_t file_lineno) +{ +#if WAN_DEBUG_BRI_REG /* extra heavy debugging for the chip */ + switch(reg) + { + case R_FIFO: + decode_reg_r_fifo(val, HFC_WRITE); + break; + case R_SLOT: + decode_reg_r_slot(val, HFC_WRITE); + break; + case R_SU_IRQMSK: + decode_reg_r_su_irqmsk(val, HFC_WRITE); + break; + case R_FIFO_MD: + decode_reg_r_fifo_md(val, HFC_WRITE); + break; + case R_PCM_MD0: + decode_reg_r_pcm_md0(val, HFC_WRITE); + break; + case A_SL_CFG: + decode_reg_a_sl_cfg(val, HFC_WRITE); + break; + case A_CON_HDLC: + decode_reg_a_con_hdlc(val, HFC_WRITE); + break; + case A_FIFO_STA: + decode_reg_a_fifo_sta(val, HFC_WRITE); + break; + case A_SU_RD_STA: + decode_reg_a_su_rd_sta(val, HFC_WRITE); + break; + default: + ;/* DEBUG_HFC_MODE("HFC_WRITE: reg decoder unknow reg: 0x%X.\n", reg); */ + } +#endif + return WRITE_BRI_REG(mod_no, reg, val); +} + +#if WAN_DEBUG_BRI_REG /* extra heavy debugging for the chip */ + +static const char* decode_hfc_direction(__u8 read_or_write_direction) +{ + switch(read_or_write_direction) + { + case HFC_WRITE: + return "HFC_WRITE"; + case HFC_READ: + return "HFC_READ"; + default: + return "Unknown HFC direction!!"; + } +} + +static void decode_reg_r_fifo(__u8 data, __u8 read_or_write_direction) +{ + reg_r_fifo r_fifo; + + r_fifo.reg = data; + + DEBUG_HFC_MODE("%s:R_FIFO=0x%02X: v_fifo_dir: 0x%X (%s) v_fifo_num: %d reserved_9: 0x%X v_rev: 0x%X\n", + decode_hfc_direction(read_or_write_direction), + data, + r_fifo.bit.v_fifo_dir, + (r_fifo.bit.v_fifo_dir == XHFC_DIRECTION_TX ? "Tx" : "Rx"), + r_fifo.bit.v_fifo_num, + r_fifo.bit.reserved_9, + r_fifo.bit.v_rev); +} + +static void decode_reg_r_slot(__u8 data, __u8 read_or_write_direction) +{ + reg_r_slot r_slot; + + r_slot.reg = data; + + DEBUG_HFC_MODE("%s:R_SLOT=0x%02X: PCM v_sl_dir: %s, PCM v_sl_num: %d\n", + decode_hfc_direction(read_or_write_direction), + data, + (r_slot.bit.v_sl_dir == XHFC_DIRECTION_TX ? "Tx" : "Rx"), + r_slot.bit.v_sl_num); +} + +static void decode_reg_a_sl_cfg(__u8 data, __u8 read_or_write_direction) +{ + reg_a_sl_cfg a_sl_cfg; + + a_sl_cfg.reg = data; + + DEBUG_HFC_MODE("%s:A_SL_CFG=0x%02X: v_ch_sdir: %s, v_ch_snum: %d, v_rout: %d\n", + decode_hfc_direction(read_or_write_direction), + data, + (a_sl_cfg.bit.v_ch_sdir == XHFC_DIRECTION_TX ? "Tx" : "Rx"), + a_sl_cfg.bit.v_ch_snum, + a_sl_cfg.bit.v_rout); +} + +static void decode_reg_a_con_hdlc(__u8 data, __u8 read_or_write_direction) +{ + reg_a_con_hdlc a_con_hdlc; + + a_con_hdlc.reg = data; + + DEBUG_HFC_MODE("%s:A_CON_HDLC=0x%02X: v_iff: 0x%X, HDLC or TRANSP (v_hdlc_trp): 0x%X, v_fifo_irq: 0x%X, v_data_flow: 0x%X\n", + decode_hfc_direction(read_or_write_direction), + data, + a_con_hdlc.bit.v_iff, + a_con_hdlc.bit.v_hdlc_trp, + a_con_hdlc.bit.v_fifo_irq, + a_con_hdlc.bit.v_data_flow); +} + +static void decode_reg_a_fifo_sta(__u8 data, __u8 read_or_write_direction) +{ + reg_a_fifo_sta a_fifo_sta; + + a_fifo_sta.reg = data; + + DEBUG_HFC_MODE("%s:A_FIFO_STA=0x%02X: v_fifo_err: 0x%X, v_abo_done: 0x%X\n", + decode_hfc_direction(read_or_write_direction), + data, + a_fifo_sta.bit.v_fifo_err, + a_fifo_sta.bit.v_abo_done); +} + +static void decode_reg_a_su_rd_sta(__u8 data, __u8 read_or_write_direction) +{ + reg_a_su_rd_sta a_su_rd_sta; + + a_su_rd_sta.reg = data; + + DEBUG_HFC_MODE( +"%s:A_SU_RD_STA=0x%02X: v_su_sta: 0x%X, v_su_fr_sync: 0x%X, v_su_t2_exp: 0x%X, v_su_info0: 0x%X, v_g2_g3: 0x%X,\n", + decode_hfc_direction(read_or_write_direction), + data, + a_su_rd_sta.bit.v_su_sta, + a_su_rd_sta.bit.v_su_fr_sync, + a_su_rd_sta.bit.v_su_t2_exp, + a_su_rd_sta.bit.v_su_info0, + a_su_rd_sta.bit.v_g2_g3); +} + + +static void decode_reg_r_su_irqmsk(__u8 data, __u8 read_or_write_direction) +{ + reg_r_su_irqmsk r_su_irqmsk; + + r_su_irqmsk.reg = data; + + DEBUG_HFC_MODE("%s:R_SU_IRQMSK=0x%02X: v_su0_irqmsk: 0x%X v_su1_irqmsk: 0x%X v_su2_irqmsk: 0x%X v_su3_irqmsk: 0x%X reserved_29: 0x%X\n", + decode_hfc_direction(read_or_write_direction), + data, + r_su_irqmsk.bit.v_su0_irqmsk, + r_su_irqmsk.bit.v_su1_irqmsk, + r_su_irqmsk.bit.v_su2_irqmsk, + r_su_irqmsk.bit.v_su3_irqmsk, + r_su_irqmsk.bit.reserved_29); +} + +static void decode_reg_r_fifo_md(__u8 data, __u8 read_or_write_direction) +{ + reg_r_fifo_md r_fifo_md; + + r_fifo_md.reg = data; + + DEBUG_HFC_MODE("%s:R_FIFO_MD=0x%02X: v_fifo_md: 0x%X v_df_md: 0x%X v_unidir_md: 0x%X v_unidir_rx: 0x%X reserved_7: 0x%X\n", + decode_hfc_direction(read_or_write_direction), + data, + r_fifo_md.bit.v_fifo_md, + r_fifo_md.bit.v_df_md, + r_fifo_md.bit.v_unidir_md, + r_fifo_md.bit.v_unidir_rx, + r_fifo_md.bit.reserved_7); +} + +static void decode_reg_r_pcm_md0(__u8 data, __u8 read_or_write_direction) +{ + reg_r_pcm_md0 r_pcm_md0; + + r_pcm_md0.reg = data; + + DEBUG_HFC_MODE("%s:R_PCM_MD0=0x%02X: v_pcm_md: 0x%X v_c4_pol: 0x%X v_f0_neg: 0x%X v_f0_len: 0x%X v_pcm_idx: 0x%X\n", + decode_hfc_direction(read_or_write_direction), + data, + r_pcm_md0.bit.v_pcm_md, + r_pcm_md0.bit.v_c4_pol, + r_pcm_md0.bit.v_f0_neg, + r_pcm_md0.bit.v_f0_len, + r_pcm_md0.bit.v_pcm_idx); +} +#endif /* WAN_DEBUG_BRI_REG */ + +/*******************************************************************************/ + +static void xhfc_waitbusy(sdla_fe_t *fe, u32 mod_no) +{ + u32 wait_counter = 0; +#define MAX_XHFC_WAIT_COUNTER 10000 + + do{ + if(!(READ_REG(R_STATUS) & M_BUSY)){ + break; + } + }while(wait_counter++ < MAX_XHFC_WAIT_COUNTER); + + if(wait_counter >= MAX_XHFC_WAIT_COUNTER){ + DEBUG_EVENT("%s: %s() time out!\n", fe->name, __FUNCTION__); + } +} + +static void xhfc_select_fifo(sdla_fe_t *fe, u32 mod_no, u8 fifo) +{ + WRITE_REG(R_FIFO, fifo); + xhfc_waitbusy(fe, mod_no); +} + +static void xhfc_select_pcm_slot(sdla_fe_t *fe, u32 mod_no, u8 slot, u8 direction) +{ + reg_r_slot r_slot; + + memset(&r_slot, 0, sizeof(reg_r_slot)); + + r_slot.bit.v_sl_dir = direction; + r_slot.bit.v_sl_num = slot; + + WRITE_REG(R_SLOT, r_slot.reg); + xhfc_waitbusy(fe, mod_no); +} + +#if 0 +static void xhfc_select_xhfc_channel(sdla_fe_t *fe, u32 mod_no, + u8 channel, u8 direction, u8 vrout_bitmap) +{ + reg_a_sl_cfg a_sl_cfg; + memset(&a_sl_cfg, 0, sizeof(reg_a_sl_cfg)); + + a_sl_cfg.bit.v_ch_sdir = direction; /* 1 bit */ + a_sl_cfg.bit.v_ch_snum = channel; /* 5 bits */ + a_sl_cfg.bit.v_rout = vrout_bitmap; + + WRITE_REG(A_SL_CFG, a_sl_cfg.reg); + xhfc_waitbusy(fe, mod_no); +} +#endif + +static void xhfc_increment_fifo(sdla_fe_t *fe, u32 mod_no) +{ + WRITE_REG(A_INC_RES_FIFO, M_INC_F); + xhfc_waitbusy(fe, mod_no); +} + +static u32 calculate_pcm_timeslot(u32 mod_no, u8 port_no, u8 bchan) +{ + u32 pcm_slot; +#if 0 + DEBUG_HFC_INIT("port_no: %d, bchan: %d\n", port_no, bchan); +#endif + if(validate_physical_mod_no(mod_no, __FUNCTION__)){ + return 0; + } + + pcm_slot = 2*port_no + bchan; /* 0, 1, 2, 3 */ + pcm_slot *= 2; /* 0, 2, 4, 6 */ + pcm_slot += (4*mod_no); /* mod_no is 0,2,4.... -->0+0, 0+8, 0+16 */ + + return pcm_slot; +} + +static int32_t reset_chip(sdla_fe_t *fe, u32 mod_no) +{ + sdla_bri_param_t *bri = &fe->bri_param; + wp_bri_module_t *bri_module; + int32_t err = 0; + + + DEBUG_HFC_INIT("%s(): mod_no: %d\n", __FUNCTION__, mod_no); + + WAN_ASSERT(fe->write_fe_reg == NULL); + WAN_ASSERT(fe->read_fe_reg == NULL); + + if(validate_physical_mod_no(mod_no, __FUNCTION__)){ + return 1; + } + + bri_module = &bri->mod[mod_no]; + + /* read ChipID from Read Only register R_CHIP_ID */ + fe->fe_chip_id = READ_REG(R_CHIP_ID); + switch (fe->fe_chip_id) + { + case CHIP_ID_2SU: + bri_module->num_ports = 2; + bri_module->max_fifo = 8; + bri_module->max_z = 0x7F; + /* set fifo mode 8 tx and 8 rx fifos */ + WRITE_REG( R_FIFO_MD, M1_FIFO_MD * 1); + break; + default: + err = 1; + DEBUG_EVENT("%s: %s(): unknown Chip ID 0x%x!\n", + fe->name, __FUNCTION__, fe->fe_chip_id); + return err; + } + + /* general soft chip reset */ + WRITE_REG(R_CIRM, M_SRES); + WP_DELAY(5); + WRITE_REG(R_CIRM, 0); + /* wait for XHFC init seqeuence to be finished */ + WP_DELAY(1000); + + + return 0; +} + +static int32_t clock_control(sdla_fe_t *fe, u8 line_state) +{ + sdla_t *card = (sdla_t*)fe->card; + u_int32_t reg; + + DEBUG_HFC_CLOCK("%s(): line_state: %d\n", __FUNCTION__, line_state); + + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG),®); + DEBUG_HFC_CLOCK("Original AFT_LINE_CFG_REG: 0x%X\n", reg); + + if (line_state == 1){ + /* The 'Reference' line is connected, enable sync from line interface */ + + if (wan_test_bit(A500_LINE_SYNC_MASTER_BIT, ®)) { + return 0; + } + + DEBUG_HFC_CLOCK("'Reference' line is connected, enable sync from line interface\n"); + wan_set_bit(A500_LINE_SYNC_MASTER_BIT, ®); + } + if (line_state == 0){ + /* The 'Reference' line is DISconnected, disable sync from line interface */ + + if (!wan_test_bit(A500_LINE_SYNC_MASTER_BIT, ®)) { + return 0; + } + + DEBUG_HFC_CLOCK("'Reference' line is disconnected, disable sync from line interface\n"); + wan_clear_bit(A500_LINE_SYNC_MASTER_BIT, ®); + } + + DEBUG_HFC_CLOCK("New AFT_LINE_CFG_REG: 0x%X\n", reg); + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_LINE_CFG_REG),reg); + + return 0; +} + +static int32_t config_clock_routing(sdla_fe_t *fe, u32 mod_no, u8 master_mode) +{ + reg_r_pcm_md0 pcm_md0; + reg_r_pcm_md2 r_pcm_md2; + reg_r_gpio_sel r_gpio_sel; + reg_r_gpio_en0 r_gpio_en0; + + DEBUG_HFC_CLOCK("%s(): mod_no: %d\n", __FUNCTION__, mod_no); + + WAN_ASSERT(fe->write_fe_reg == NULL); + WAN_ASSERT(fe->read_fe_reg == NULL); + + if(validate_physical_mod_no(mod_no, __FUNCTION__)){ + return 1; + } + + DEBUG_EVENT("%s: Module %d: configuring clock routing (SYNC_O is %s)...\n", + fe->name, REPORT_MOD_NO, (master_mode == WANOPT_YES ? "Enabled" : "Disabled")); + + /************************************************************************/ +#if 0 + { + reg_r_su_sync r_su_sync; + r_su_sync.reg = 0; + if(master_mode == WANOPT_YES){ + CLOCK_FUNC(); + //r_su_sync.bit.v_sync_sel = 0; //000 = source is line interface 0 + //r_su_sync.bit.v_man_sync = 1; + //r_su_sync.bit.v_auto_synci = 1; + }else{ + CLOCK_FUNC(); + + } + WRITE_REG(R_SU_SYNC, r_su_sync.reg); + } +#endif + /************************************************************************/ + r_gpio_sel.reg = 0; + r_gpio_en0.reg = 0; + if(master_mode == WANOPT_YES){ + CLOCK_FUNC(); + /* select 1-st function of pin 16 - SYNC_O. page 315. */ + r_gpio_sel.bit.v_gpio_sel6 = 0; + + /* enable output on pin 16 - page 314.*/ + r_gpio_en0.bit.v_gpio_en6 = 1; + }else{ + CLOCK_FUNC(); + /* if in NORMAL mode, do NOT provide output on 16, + so there is only one clock source - the master. */ + + /* select 2-nd function of pin 16 - GPIO6. page 315.*/ + r_gpio_sel.bit.v_gpio_sel6 = 1; + + /* DISABLE output on pin 16 - page 314. */ + r_gpio_en0.bit.v_gpio_en6 = 0; + } + WRITE_REG(R_GPIO_SEL, r_gpio_sel.reg); + WRITE_REG(R_GPIO_EN0, r_gpio_en0.reg); + + /************************************************************************/ +#if 1 + pcm_md0.reg = 0; + pcm_md0.bit.v_pcm_idx = 0xA; /* get access to R_PCM_MD2 */ + WRITE_REG(R_PCM_MD0, pcm_md0.reg); + + r_pcm_md2.reg = 0; + if(master_mode == WANOPT_YES){ + CLOCK_FUNC(); + r_pcm_md2.bit.v_sync_out1 = 0;/* 0 = SYNC_O is either SYNC_I or the received + synchronization pulse. page 244. */ + }else{ + /* r_pcm_md2.bit.v_sync_out1 = 1;*/ /* 1 = SYNC_O is either 512 kHz from the PLL or + the received multiframe / superframe + synchronization pulse. page 244. */ + } + + r_pcm_md2.bit.v_sync_out2 = 0;/* SYNC_O output selection + 0 = ST/Up receive from the selected line interface + in TE mode (see R_SU_SYNC register for synchronization source selection) + 1 = SYNC_I is connected to SYNC_O. page 244. */ +#if 0 + if(master_mode == WANOPT_NO){ + r_pcm_md2.bit.v_sync_src = 1; /*V_SYNC_SRC PCM PLL synchronization source selection + 0 = line interface (see R_SU_SYNC for further + synchronization configuration) + 1 = SYNC_I input (8 kHz). page 244. + */ + } +#endif + + WRITE_REG(R_PCM_MD2, r_pcm_md2.reg); +#endif + /************************************************************************/ + + return 0; +} + +/****************************************************************************** +* init_xfhc() +* +* Description : Physical module global configuration. Should be done only one +* time per-module. +* Assuming chip was already reset. +* +* Arguments : pfe - pointer to Front End structure. +* mod_no - module number. +* +* Returns : 0 - configred successfully, otherwise non-zero value. +*******************************************************************************/ +static int32_t init_xfhc(sdla_fe_t *fe, u32 mod_no) +{ + sdla_bri_param_t *bri = &fe->bri_param; + wp_bri_module_t *bri_module; + int32_t err = 0, i, timeout = 0x2000; + + u8 port_no, bchan; + reg_a_su_ctrl0 a_su_ctrl0; + reg_a_su_ctrl1 a_su_ctrl1; + reg_a_su_rd_sta a_su_rd_sta; + reg_r_fifo_thres r_fifo_thres; + + DEBUG_HFC_INIT("%s(): mod_no: %d\n", __FUNCTION__, mod_no); + + WAN_ASSERT(fe->write_fe_reg == NULL); + WAN_ASSERT(fe->read_fe_reg == NULL); + + if(validate_physical_mod_no(mod_no, __FUNCTION__)){ + return 1; + } + + bri_module = &bri->mod[mod_no]; + + DBG_MODULE_TESTER("read ChipID from Read Only register R_CHIP_ID: must be 0x61\n"); + + /* read ChipID from Read Only register R_CHIP_ID */ + fe->fe_chip_id = READ_REG(R_CHIP_ID); + switch (fe->fe_chip_id) + { + case CHIP_ID_2SU: + DEBUG_EVENT("%s: Detected XHFC-2SU chip.\n", fe->name); + bri_module->num_ports = 2; + bri_module->max_fifo = 8; + bri_module->max_z = 0x7F; + DBG_MODULE_TESTER("configure FIFOs\n"); + /* 01 = 8 FIFOs with 128 bytes for TX and RX each. page 125 */ + WRITE_REG( R_FIFO_MD, M1_FIFO_MD * 1); + break; + default: + err = 1; + DEBUG_EVENT("%s: %s(): unknown Chip ID 0x%x!\n", + fe->name, __FUNCTION__, fe->fe_chip_id); + return err; + } + + a_su_ctrl0.reg = 0; + a_su_ctrl1.reg = 0; + a_su_rd_sta.reg = 0; + + DBG_MODULE_TESTER("general soft chip reset\n"); + /* general soft chip reset */ + WRITE_REG(R_CIRM, M_SRES); + WP_DELAY(5); + WRITE_REG(R_CIRM, 0); + + /* amplitude */ + WRITE_REG(R_PWM_MD, 0x80); + WRITE_REG(R_PWM1, 0x18); + + /* Set FIFO threshold. page 124.*/ + r_fifo_thres.reg = 0; + r_fifo_thres.bit.v_thres_tx = r_fifo_thres.bit.v_thres_rx = FIFO_THRESHOLD_INDEX; + WRITE_REG(R_FIFO_THRES, r_fifo_thres.reg); + + DBG_MODULE_TESTER("wait 1 second for XHFC init seqeuence to be finished\n"); + /* wait for XHFC init seqeuence to be finished */ + WP_DELAY(1000); + + DBG_MODULE_TESTER("read chip 'busy' bit\n"); + while ((READ_REG(R_STATUS) & (M_BUSY | M_PCM_INIT)) && (timeout)){ + CLOCK_FUNC(); + timeout--; + } + + if (!(timeout)) { + DEBUG_EVENT("%s: %s(): Error: chip initialization sequence timeout!\n", + fe->name, __FUNCTION__); + return 1; + } + + + /* PCM: 1. Slave mode 2. PCM64 (4MBit/s data rate). */ + /* slow PCM adjust speed */ + bri_module->pcm_md1.bit.v_pll_adj = 3; + bri_module->pcm_md1.bit.v_pcm_dr = 1; /* dr stands for 'data rate' (64) */ + + WRITE_REG(R_PCM_MD0, bri_module->pcm_md0.reg + 0x90); /* get access to R_PCM_MD1 */ + WRITE_REG(R_PCM_MD1, bri_module->pcm_md1.reg); + + /* After chip reset SYNC_O is set for OUTPUT by default, make sure + SYNC_O is set for INPUT! Otherwise may cause clock conflict. + */ + config_clock_routing(fe, mod_no, WANOPT_NO); + + DEBUG_HFC_INIT("\n%s: configuring B-channels FIFOs...\n", fe->name); + /* configure B channel fifos for ST<->PCM data flow */ + for (port_no = 0; port_no < bri_module->num_ports; port_no++) {/* 2 ports */ + DEBUG_HFC_INIT("=========== port_no: %d ========\n", port_no); + for (bchan = 0; bchan < 2; bchan++) { /* 2 B channels on each port_no */ + DEBUG_HFC_INIT("port_no: %d, bchan: %d\n", port_no, bchan); + /* B chan - Tx of port_no */ + xhfc_select_fifo(fe, mod_no, port_no*8 + bchan*2); + /* ST-->PCM, channel enabled */ + WRITE_REG(A_CON_HDLC, 0xde);/* page 83: Tx, Transparent, ST/U-->PCM */ + /* 64kbit/s */ + WRITE_REG(A_SUBCH_CFG, 0); + /* no interrupts */ + WRITE_REG(A_FIFO_CTRL, 0); + + /* B chan - Rx of port_no */ + xhfc_select_fifo(fe, mod_no, port_no*8 + bchan*2 + 1); + /* ST<--PCM, channel enabled */ + WRITE_REG(A_CON_HDLC, 0xde);/* page 83: Rx, Transparent, ST/U<--PCM */ + /* 64kbit/s */ + WRITE_REG(A_SUBCH_CFG, 0); + /* no interrupts */ + WRITE_REG(A_FIFO_CTRL, 0); + } + } + DEBUG_HFC_INIT("\nDone\n"); + + DEBUG_HFC_INIT("\nconfiguring D-channel FIFOs...\n"); + /* configure D channel fifos */ + for (port_no = 0; port_no < bri_module->num_ports; port_no++) { + reg_a_con_hdlc a_con_hdlc; + + a_con_hdlc.reg = 0; + + a_con_hdlc.bit.v_iff = 1;/* InterFrameFill=ones */ + /* Interrupt every 2^n bytes. n = V_FIFO_IRQ+2 in register A_CON_HDLC. p. 137 */ + /*a_con_hdlc.bit.v_fifo_irq = 3;*/ /* 2^(3+2) = 32 bytes an interrupt is generated */ + a_con_hdlc.bit.v_fifo_irq = 4; /* 2^(4+2) = 64 bytes an interrupt is generated */ + + DEBUG_HFC_INIT("=========== port_no: %d ========\n", port_no); + /* D - Tx of port_no */ + xhfc_select_fifo(fe, mod_no, port_no*8 + 4); + /* FIFO-->ST, channel enabled, IFF=ones */ + WRITE_REG(A_CON_HDLC, a_con_hdlc.reg); + /* 16kbit/s */ + WRITE_REG(A_SUBCH_CFG, 2); +#if 0 + /* interrupts at end of frame only */ + WRITE_REG(A_FIFO_CTRL, 1); +#else + /* Interrupts at end of frame AND at fifo threshold. + Will work as 'transmit interrupt'. */ + WRITE_REG(A_FIFO_CTRL, 0x5); +#endif + + /* D - Rx of port_no */ + xhfc_select_fifo(fe, mod_no, port_no*8 + 4 + 1); + /* ST--> FIFO, channel enabled */ + WRITE_REG(A_CON_HDLC, a_con_hdlc.reg); + /* 16kbit/s */ + WRITE_REG(A_SUBCH_CFG, 2); +#if 0 + /* interrupts at end of frame only */ + WRITE_REG(A_FIFO_CTRL, 1); +#else + /* interrupts at end of frame AND at fifo threshold */ + WRITE_REG(A_FIFO_CTRL, 0x5); +#endif + } + DEBUG_HFC_INIT("\nDone\n"); + + DEBUG_HFC_INIT("Configure PCM time slots\n"); + /* Configure PCM time slots. + B-chan data will use PCM64 bus. D-chan data will use SPI. + */ + for (port_no = 0; port_no < bri_module->num_ports; port_no++) { + for (bchan = 0; bchan < 2; bchan++) { + + u_int8_t pcm_slot; + + DEBUG_HFC_INIT("port_no: %d, bchan: %d\n", port_no, bchan); + + if(mod_no >= MAX_BRI_MODULES){ + /* adjust mod_no to be between 0 and 10 (including)*/ + pcm_slot = calculate_pcm_timeslot(mod_no - MAX_BRI_MODULES, port_no, bchan); + /* AFT Line 1 will use odd PCM timeslots */ + pcm_slot += 1; + }else{ + /* AFT Line 0 will use even PCM timeslots */ + pcm_slot = calculate_pcm_timeslot(mod_no, port_no, bchan); + } + + DEBUG_HFC_INIT("selecting TX pcm_slot: %d\n", pcm_slot); + + /*****************************************************************************************/ + /* transmit slot - select direction TX */ + xhfc_select_pcm_slot(fe, mod_no, pcm_slot, XHFC_DIRECTION_TX); + + /* Connect time slot with channel and pin. + PCM data output on pin STIO2 (+0x40 swap pins) + 0x80+0x40==0xC0==11000000 -> v_rout==0x3 -> "output buffer for STIO2 enabled" page 257. + 0*8 + 0*2 = 0 --> HFC channel 0. + + Assign HFC channel (from 0 to 15) to the selected PCM slot. + */ + WRITE_REG(A_SL_CFG,0x80+0x40+port_no*8+bchan*2); /* assign HFC channel (from 0 to 15) + to the selected PCM slot. */ + + /*****************************************************************************************/ + /* receive slot - select direction RX */ + DEBUG_HFC_INIT("selecting RX pcm_slot: %d\n", pcm_slot); + + xhfc_select_pcm_slot(fe, mod_no, pcm_slot, XHFC_DIRECTION_RX); + + /* Connect time slot with channel and pin. + PCM data input from pin STIO1 (+0x40 swap pins). + Assign HFC channel (from 0 to 15) to the selected PCM slot. + */ + WRITE_REG(A_SL_CFG,0x80+0x40+port_no*8+bchan*2+1);/* assign HFC channel (from 0 to 15) + to the selected PCM slot. */ + }/* for (bchan = 0; bchan < 2; bchan++) */ + }/* for (port_no = 0; port_no < bri_module->num_ports; port_no++) */ + + DBG_MODULE_TESTER("configure ST ports\n"); + /* configure ST ports */ + for (port_no = 0; port_no < bri_module->num_ports; port_no++) { + u8 old_f0cl, new_f0cl; + int32_t f0cl_diff; + + DEBUG_HFC_INIT("%s(): configurig ST port_no: %d\n", __FUNCTION__, port_no); + + WRITE_REG(R_SU_SEL, port_no); + + switch(bri_module->type) + { + case MOD_TYPE_TE: + WRITE_REG(A_SU_CLK_DLY, CLK_DLY_TE); + + /* TE, ST B1+B2 tx enabled, end of pulse control enabled */ + WRITE_REG(A_SU_CTRL0, 0x43); + break; + + case MOD_TYPE_NT: + WRITE_REG(A_SU_CLK_DLY, CLK_DLY_NT); + + /* NT, ST B1+B2 tx enabled, end of pulse control enabled */ + a_su_ctrl0.bit.v_b1_tx_en = 1; + a_su_ctrl0.bit.v_b2_tx_en = 1; + a_su_ctrl0.bit.v_su_md = 1; + WRITE_REG(A_SU_CTRL0, a_su_ctrl0.reg); + break; + } + + /* reset default. TE and NT */ + WRITE_REG(A_SU_CTRL1, 0x0); + + switch(bri_module->type) + { + case MOD_TYPE_NT: + /* enables automatic transition G2->G3 */ + WRITE_REG(A_SU_CTRL1, M_G2_G3_EN); + break; + } + + /* ST B1+B2 rx enabled */ + WRITE_REG(A_SU_CTRL2, 0x3); + + /* end of pulse control for layer 1 compliance */ + WRITE_REG(A_ST_CTRL3, 0xf8); + + /* WRITE_REG(R_SU_SEL, port_no); */ +#if BUILD_MOD_TESTER + DBG_MODULE_TESTER("Activate ST port_no state machines (NT only!!)\n"); + /* try to activate port_no */ + switch(bri_module->type) + { + case MOD_TYPE_TE: + /*WRITE_REG(A_SU_WR_STA, STA_ACTIVATE);*/ + break; + case MOD_TYPE_NT: + WRITE_REG(A_SU_WR_STA, STA_ACTIVATE | M_SU_SET_G2_G3); + break; + } +#endif + DBG_MODULE_TESTER("poll R_F0_CNTL to make sure PCM is connected\n"); + + /* poll R_F0_CNTL to make sure PCM is connected */ + for (i = 0; i < 10; i++) { + + DBG_MODULE_TESTER("get current R_F0_CNTL\n"); + + old_f0cl=READ_REG(R_F0_CNTL); + DBG_MODULE_TESTER("wait for 10ms - f0cl should be incremented by 80 (+- 10 is ok)\n"); + /* wait for 10ms - f0cl should be incremented by 80 (+- 10 is ok) */ + WP_MDELAY(10); + + DBG_MODULE_TESTER("get the R_F0_CNTL after the wait\n"); + new_f0cl=READ_REG(R_F0_CNTL); + + if(check_f0cl_increment(fe, old_f0cl, new_f0cl, &f0cl_diff)){ + return 1; + } + } + + DEBUG_EVENT("%s: Module: %d, PCM 125us pulse ok. (f0cl diff: %d)\n", + fe->name, REPORT_MOD_NO + port_no, f0cl_diff); + + }/* for (port_no = 0; port_no < bri_module->num_ports; port_no++) */ + + /* init line interfaces state machines (in software only!) */ + for (port_no = 0; port_no < bri_module->num_ports; port_no++) { + + bri_module->port[port_no].idx = port_no; + bri_module->port[port_no].hw = bri_module; + + /*wan_set_bit(HFC_L1_ACTIVATING, &bri_module->port[port_no].l1_flags);*/ + + }/* for (port_no = 0; port_no < bri_module->num_ports; port_no++) */ + +#if BUILD_MOD_TESTER + /* for debugging only - read line status */ + WP_MDELAY(300); + + DBG_MODULE_TESTER("read line status - Connected/Disconnected\n"); + /* read line status - Connected/Disconnected */ + for (port_no = 0; port_no < bri_module->num_ports; port_no++) { + + DBG_MODULE_TESTER("select port_no %d\n", port_no); + WRITE_REG(R_SU_SEL, port_no); + + /* poll line status register for around 5ms */ + for (i = 0; i < 5; i++) { + u8 line_status; + + DBG_MODULE_TESTER("read ST line status for port_no %d\n", port_no); + /* read ST line status*/ + a_su_rd_sta.reg = line_status = READ_REG(A_SU_RD_STA); + + if(bri_module->type == MOD_TYPE_TE){ + DEBUG_HFC_S0_STATES("%d: TE: force F7 - pt:%d line status: 0x%02x, v_su_fr_sync: %d\n", + i, port_no, line_status, a_su_rd_sta.bit.v_su_fr_sync); + }else{ + DEBUG_HFC_S0_STATES("%d: NT: force G3 - pt:%d line status: 0x%02x, v_su_fr_sync: %d\n", + i, port_no, line_status, a_su_rd_sta.bit.v_su_fr_sync); + } + + DBG_MODULE_TESTER("a_su_rd_sta.bit.v_su_fr_sync: %d (0-Disconnected, 1-Connected)\n", a_su_rd_sta.bit.v_su_fr_sync); + + WP_MDELAY(200); + } + } +#endif + DBG_MODULE_TESTER("%s(): finished\n", __FUNCTION__); + + return 0; +} + +static int32_t check_f0cl_increment(sdla_fe_t *fe, u8 old_f0cl, u8 new_f0cl, int32_t *diff) +{ + *diff = new_f0cl - old_f0cl; + if(*diff < 0){ + *diff = 255 - old_f0cl; + *diff += new_f0cl; + } + + /* should be between 70 and 90 over 10ms time */ + if(*diff > 90 || *diff < 70){ + DEBUG_EVENT("%s: PCM ERROR 125us pulse not counting!! f0cl diff: %d\n", + fe->name, *diff); + return 1; + } + + DBG_MODULE_TESTER("f0cl diff: %d\n", *diff); + return 0; +} + +typedef enum _DCHAN_RC{ + DCHAN_STATUS_BUSY = 1, + DCHAN_STATUS_COMPLETE, + DCHAN_STATUS_INCOMPLETE, + DCHAN_STATUS_EMPTY +}DCHAN_RC; + +#define TX_EMPTY_FIFO 1 + +static int xhfc_write_fifo_dchan(sdla_fe_t *fe, u8 mod_no, + wp_bri_module_t *bri_module, bri_xhfc_port_t *port, + u8 *free_space) +{ + u8 *buf = NULL; + int *len = NULL, + *idx = NULL; + u8 fcnt, tcnt, i; + u8 free; + u8 f1, f2; + reg_a_fifo_sta fstat; + u8 *data; + u8 rc; + sdla_t *card = (sdla_t*)fe->card; + private_area_t *chan=NULL; + int fifo_usage; + + buf = port->dtxbuf; /* data buffer */ + len = &port->bytes2transmit; /* hdlc packet len */ + idx = &port->dtx_indx; /* already transmitted */ + + DEBUG_HFC_TX("%s(): *len: %d\n", __FUNCTION__, *len); + + /* select the D-channel TX fifo */ + xhfc_select_fifo(fe, mod_no, (port->idx*8+4)); + + fstat.reg = READ_REG(A_FIFO_STA); + if (fstat.reg) WRITE_REG( A_INC_RES_FIFO, 8); + + free = (bri_module->max_z - (READ_REG( A_USAGE))); + *free_space = free; + + TX_FAST_DBG("%s(): Line:%d: free: %d\n", __FUNCTION__, __LINE__, free); + + tcnt = ((free >= (*len - *idx)) ? (*len - *idx) : free); + + f1 = READ_REG( A_F1); + f2 = READ_REG( A_F2); + fcnt = 0x07 - ((f1 - f2) & 0x07); /* free frame count in tx fifo */ + + TX_FAST_DBG("%s(): free: %d, fcnt: %d, tcnt: %d\n", __FUNCTION__, free, fcnt, tcnt); + + TX_EXTRA_DBG("%s(): START: usage: 0x%X, z1: 0x%X z2: 0x%X f1: 0x%X: f2:0x%X f0c:0x%X\n", + __FUNCTION__, READ_REG( A_USAGE),READ_REG( A_Z1),READ_REG( A_Z2),f1,f2,READ_REG( R_F0_CNTL)); + + if (free && fcnt && tcnt) { + data = buf + *idx; + *idx += tcnt; + + TX_EXTRA_DBG("%s(): tcnt: %d, *idx: %d, fstat.reg: 0x%X, fstat.bit.v_fifo_err: %d\n", + __FUNCTION__, tcnt, *idx, fstat.reg, fstat.bit.v_fifo_err); + + /* write data to FIFO */ + i=0; + while (iu.aft.dev_to_ch_map[BRI_DCHAN_LOGIC_CHAN]; + if (chan) { + *len = 0; + *idx = 0; + TX_FAST_DBG("%s(): calling wanpipe_wake_stack()\n", __FUNCTION__); + wanpipe_wake_stack(chan); + } +#endif + + }else{ + xhfc_select_fifo(fe, mod_no, (port->idx*8+4));/* addition ?? */ + + DEBUG_HFC_TX("%s(): transmitted a part of frame.\n", __FUNCTION__); + rc = DCHAN_STATUS_INCOMPLETE; + } + }else{ + DEBUG_HFC_TX("%s(): NO free space in tx fifo!!\n", __FUNCTION__); + rc = DCHAN_STATUS_BUSY; /* there is NO free space in tx fifo */ + } + + TX_EXTRA_DBG("%s(): END: eof usage: 0x%X, z1: 0x%X z2: 0x%X f1: 0x%X: f2:0x%X f0c:0x%X\n", + __FUNCTION__, + READ_REG(A_USAGE), READ_REG( A_Z1), READ_REG(A_Z2),f1,f2,READ_REG( R_F0_CNTL)); + +#if TX_EMPTY_FIFO + chan=(private_area_t*)card->u.aft.dev_to_ch_map[BRI_DCHAN_LOGIC_CHAN]; + + /* make sure FIFO is empty before notifying the kernel about free TX space */ + fifo_usage = READ_REG(A_USAGE); + TX_FAST_DBG("%s(): chan: 0x%p, TX FIFO usage: %d\n", __FUNCTION__, chan, fifo_usage); + + if (chan) { + if(fifo_usage == 0){ + /* FIFO is empty */ + /*WP_DELAY(10000);*/ + *len = 0; + *idx = 0; + + TX_FAST_DBG("%s(): calling wanpipe_wake_stack()\n", __FUNCTION__); + wanpipe_wake_stack(chan); + } + } +#endif + + DEBUG_HFC_TX("%s(): returning: %d.\n", __FUNCTION__, rc); + return rc; +} + +/* +Transmit D channel frames. +Transmitting fifo data requires running PCM clocks with signal at C4IO and F0IO. +*/ +static int32_t wp_bri_dchan_tx(sdla_fe_t *fe, void *src_data_buffer, u32 buffer_len) +{ + u8 mod_no, port_no, rc; + sdla_bri_param_t *bri = &fe->bri_param; + wp_bri_module_t *bri_module; + bri_xhfc_port_t *port_ptr; + u8 free_space; + + mod_no = fe_line_no_to_physical_mod_no(fe); + port_no = fe_line_no_to_port_no(fe); + + DEBUG_TX_DATA("%lu: %s(): Module: %d, port_no: %d. fe->name: %s blen=%i\n", + jiffies, __FUNCTION__, mod_no, port_no, fe->name, buffer_len); + +#if BUILD_MOD_TESTER + { + u32 i; + u8 *tmp = (u8*)src_data_buffer; + + DEBUG_TX_DATA("TX data:\n"); + + for(i = 0; i < buffer_len; i++) { + _DEBUG_EVENT("%02x ", tmp[i]); + if(i && ((i % 20) == 0)){ + DEBUG_EVENT("\n"); + } + } + DEBUG_EVENT("\n"); + } +#endif + + bri_module = &bri->mod[mod_no]; + port_ptr = &bri_module->port[port_no]; + + DEBUG_HFC_S0_STATES("%s(): fe->fe_status: %i \n", __FUNCTION__, fe->fe_status); + + if(src_data_buffer == NULL){ + /* Caller is interested in tx buffer space, + return how many bytes is still left to transmit */ + return port_ptr->bytes2transmit; + } + + if(MAX_DFRAME_LEN_L1 <= buffer_len){ + DEBUG_EVENT("%s: %s(): Tx data length %d exceeds maximum of %d bytes!\n", + fe->name, __FUNCTION__, buffer_len, MAX_DFRAME_LEN_L1); + return -EINVAL; + } + + if(port_ptr->bytes2transmit){ + /* still transmitting previous frame */ + return -EBUSY; + } +/* + { + int ind; + u8 * u8_src_data_buffer = (u8*)src_data_buffer; + + for(ind = 0; ind < buffer_len; ind++){ + if(u8_src_data_buffer[ind] != ind){ + DEBUG_RX1("tx: u8_src_data_buffer[0x%x] is: 0x%x != 0x%x!!\n", + ind, u8_src_data_buffer[ind], ind); + } + } + } +*/ + + memcpy(port_ptr->dtxbuf, src_data_buffer, buffer_len); + port_ptr->bytes2transmit = buffer_len; + + rc = xhfc_write_fifo_dchan(fe, mod_no, bri_module, port_ptr, &free_space); + + /* The frame was accepted for transmission. Return ZERO even if the frame + will be actually transmitted in parts!!! + */ + return 0; +} + +#if CHECK_DATA +static void dump_chip_SRAM(sdla_fe_t *fe, u8 mod_no, u8 port_no) +{ + u8 db; + u16 a; + /* + XHFC dump of internal RAM + + the dump shows content of internal array registers + Z and F counters and other internal variables + + please select address range for D channel that shows the errors + + 128 bytes address range for receive buffer of channel 5, D rx port_no 0 + */ + /* wrong offset + u16 start_addr = 0x580; + u16 end_addr = 0x600; + */ + u16 start_addr = 0x280; + u16 end_addr = 0x300; + +/* + 128 bytes address range for receive buffer of channel 13, D rx port_no 1 + u16 start_addr = 0xd80; + u16 end_addr = 0xe00; +*/ + for (a = start_addr; a < end_addr; a++) + { + WRITE_REG(R_RAM_ADDR, (a & 0xff)); + WRITE_REG(R_RAM_CTRL, ((a >> 8) & 0xff)); + db=READ_REG(R_RAM_DATA); + + /* dummy read to add some delay */ + /*db=READ_REG(R_INT_DATA); + db=READ_REG(R_INT_DATA);*/ + + if((a % 16) == 0){ + _DEBUG_EVENT("\n %04x",a); + } + _DEBUG_EVENT(" %02x",db); + } + DBG_RX_DATA("\n"); +} + +static int check_data(u8 *data, int data_len) +{ + int i, rc = 0; + + /*DBG_RX_DATA("%s(): data_len: %d\n", __FUNCTION__, data_len);*/ + + for(i = 0; i < data_len; i++){ + if(data[i] == 0xFF){ + rc = 1; + break; + } + } + return rc; +} + +static void dump_data(u8 *data, int data_len) +{ + int i; + + DBG_RX_DATA("%s(): data_len: %d\n", __FUNCTION__, data_len); + + for(i = 0; i < data_len; i++){ + if((i%16) == 0){ + _DEBUG_EVENT("\n %04X", i); + } + + _DEBUG_EVENT(" %02X", data[i]); + + if (i == (data_len - 4)){ + printk (" -"); + } + } + _DEBUG_EVENT("\n"); +} +#endif/* CHECK_DATA */ + +static int xhfc_read_fifo_dchan(sdla_fe_t *fe, u8 mod_no, + wp_bri_module_t *bri_module, bri_xhfc_port_t *port, int *rx_data_len) +{ + u8 *buf = port->drxbuf; + int *idx = &port->drx_indx; + u8 *data; /* pointer for new data */ + u8 rcnt, i; + u8 f1=0, f2=0, z1=0, z2=0; + + /* select D-RX fifo */ + xhfc_select_fifo(fe, mod_no, (port->idx * 8) + 5); + + /* hdlc rcnt */ + f1 = READ_REG( A_F1); + f2 = READ_REG( A_F2); + z1 = READ_REG( A_Z1); + z2 = READ_REG( A_Z2); + + rcnt = (z1 - z2) & bri_module->max_z; + if (f1 != f2) + rcnt++; + + /* debug message of F and Z counters */ + RX_EXTRA_DBG("%s(): START: usage: 0x%X, z1: 0x%X z2: 0x%X f1: 0x%X: f2:0x%X f0c:0x%X\n", + __FUNCTION__, + READ_REG(A_USAGE), READ_REG( A_Z1), READ_REG(A_Z2),f1,f2,READ_REG( R_F0_CNTL)); + + if (rcnt > 0) { + data = buf + *idx; + *idx += rcnt; + if(*idx >= MAX_DFRAME_LEN_L1){ + if (0 && WAN_NET_RATELIMIT()) { + DEBUG_EVENT("%s: %s(): frame in mod_no %d, port_no %d > maximum size of %d bytes!\n", + fe->name, __FUNCTION__, mod_no, port->idx, MAX_DFRAME_LEN_L1); + } + *idx = 0; + *rx_data_len = 0; + return DCHAN_STATUS_EMPTY; + } + + DEBUG_HFC_RX("rcnt: %d\n", rcnt); + /* read data from FIFO */ + i=0; + while (i < rcnt) { + *(data+i) = READ_REG(A_FIFO_DATA); + i++; + } + + /* hdlc frame termination */ + if (f1 != f2) { + xhfc_increment_fifo(fe, mod_no); + /* check minimum frame size */ + if (*idx < 4) { + if (0 && WAN_NET_RATELIMIT()) { + DEBUG_EVENT("%s: %s(): frame in mod_no %d, port_no %d < minimum size of 4 bytes!\n", + fe->name, __FUNCTION__, mod_no, port->idx); + } + *idx = 0; + *rx_data_len = 0; + return DCHAN_STATUS_EMPTY; + } + + /* check crc */ + if (buf[(*idx) - 1]) { + if (0 && WAN_NET_RATELIMIT()) { + DEBUG_EVENT("%s: %s(): CRC-error in frame in mod_no %d, port_no %d!\n", + fe->name, __FUNCTION__, mod_no, port->idx); + } + *idx = 0; + *rx_data_len = 0; + return DCHAN_STATUS_EMPTY; + } + + /* D-Channel debug to syslog */ + DBG_RX_DATA("%lu:D-RX len(%02i):\n", jiffies, (*idx)); +#if 0 + i = 0; + while(i < (*idx)){ + printk("%02x ", buf[i++]); + if (i == (*idx - 3)){ + printk ("- "); + } + } + printk("\n"); +#endif + *rx_data_len = *idx - 3;/* discard CRC and STATUS - 3 bytes */ + /* STATUS is the last byte of a frame in the fifo + which is used to check if CRC is correct or not. + + After the ending flag of a frame the XHFC-2SU checks the HDLC CRC checksum. + If it is correct one byte with all �0�s is inserted behind + the CRC data in the FIFO named STAT (see Fig. 4.2). This last byte of a frame in the FIFO is different + from all �0�s if there is no correct CRC field at the end of the frame. + If the STAT value is 0xFF, the HDLC frame ended with at least 8 bits �1�s. This is similar to an abort + HDLC frame condition. + The ending flag of a HDLC frame can also be the starting flag of the next frame. + page 122. + */ +#if CHECK_DATA + if(check_data(port->drxbuf, *rx_data_len)){ + dump_chip_SRAM(fe, mod_no, port->idx); + dump_chip_SRAM(fe, mod_no, port->idx); + reset_chip(fe, mod_no); + dump_data(port->drxbuf, *idx); + } +#endif + *idx = 0; + + RX_EXTRA_DBG("%s(): END: eof usage: 0x%X, z1: 0x%X z2: 0x%X f1: 0x%X: f2:0x%X f0c:0x%X\n", + __FUNCTION__, + READ_REG(A_USAGE), READ_REG( A_Z1), READ_REG(A_Z2),f1,f2,READ_REG( R_F0_CNTL)); + + DEBUG_HFC_RX("%s(): finished receiving a frame.\n", __FUNCTION__); + return DCHAN_STATUS_COMPLETE; + }else{ + + RX_EXTRA_DBG("%s(): END: eof usage: 0x%X, z1: 0x%X z2: 0x%X f1: 0x%X: f2:0x%X f0c:0x%X\n", + __FUNCTION__, + READ_REG(A_USAGE), READ_REG( A_Z1), READ_REG(A_Z2),f1,f2,READ_REG( R_F0_CNTL)); + + DEBUG_HFC_RX("%s(): received a part of frame.\n", __FUNCTION__); + return DCHAN_STATUS_INCOMPLETE; + } + }else{ + + RX_EXTRA_DBG("%s(): END: eof usage: 0x%X, z1: 0x%X z2: 0x%X f1: 0x%X: f2:0x%X f0c:0x%X\n", + __FUNCTION__, + READ_REG(A_USAGE), READ_REG( A_Z1), READ_REG(A_Z2),f1,f2,READ_REG( R_F0_CNTL)); + + DEBUG_HFC_RX("%s(): RX FIFO is empty!\n", __FUNCTION__); + return DCHAN_STATUS_EMPTY; + } +} + + +static void *wp_bri_dchan_rx(sdla_fe_t *fe, u8 mod_no, u8 port_no) +{ + sdla_bri_param_t *bri = &fe->bri_param; + wp_bri_module_t *bri_module; + bri_xhfc_port_t *port_ptr; + netskb_t *skb; + u8 *skb_data_area; + int rc, rx_data_len = 0; + + /* Note: D channel is slow (less than 2 bytes / ms!!) */ + DEBUG_HFC_RX("%s(): line: %d, mod_no: %d port_no: %d\n", __FUNCTION__, __LINE__, mod_no, port_no); + + bri_module = &bri->mod[mod_no]; + port_ptr = &bri_module->port[port_no]; + + rc = xhfc_read_fifo_dchan(fe, mod_no, bri_module, port_ptr, &rx_data_len); + + skb = NULL; + if((rc == DCHAN_STATUS_COMPLETE) && (rx_data_len < MAX_DFRAME_LEN_L1) && (rx_data_len > 0)){ + /**************************/ + skb = wan_skb_alloc(rx_data_len); + if(skb == NULL){ + return NULL; + } + + skb_data_area = wan_skb_put(skb, rx_data_len); + memcpy(skb_data_area, port_ptr->drxbuf, rx_data_len); +#if 0 + { + int ind; + for(ind = 0; ind < rx_data_len; ind++){ + if(skb_data_area[ind] != ind){ + DEBUG_RX1("rx: skb_data_area[0x%x] is: 0x%x != 0x%x!!\n", + ind, skb_data_area[ind], ind); + } + } + } +#endif + } + + return skb; +} + + +/****************************************************************************** +** wp_bri_iface_init) - +** +** OK +*/ +int32_t wp_bri_iface_init(void *pfe_iface) +{ + sdla_fe_iface_t *fe_iface = (sdla_fe_iface_t*)pfe_iface; + + BRI_FUNC(); + fe_iface->global_config = &bri_global_config; /* not used in remora */ + fe_iface->global_unconfig = &bri_global_unconfig; /* not used in remora */ + + fe_iface->config = &wp_bri_config; + fe_iface->unconfig = &wp_bri_unconfig; + + fe_iface->pre_release = &wp_bri_pre_release; + + fe_iface->post_init = &wp_bri_post_init; + + fe_iface->if_config = &wp_bri_if_config; + fe_iface->if_unconfig = &wp_bri_if_unconfig; + + fe_iface->active_map = &wp_bri_active_map; + + fe_iface->set_fe_status = &wp_bri_set_fe_status; + fe_iface->get_fe_status = &wp_bri_get_fe_status; + + fe_iface->isr = &wp_bri_intr; + /* fe_iface->disable_irq = &wp_bri_disable_irq; */ + fe_iface->check_isr = &wp_bri_check_intr; + + fe_iface->polling = &wp_bri_polling; + fe_iface->process_udp = &wp_bri_udp; + fe_iface->get_fe_media = &wp_bri_fe_media; + + fe_iface->set_dtmf = &wp_bri_set_dtmf; + fe_iface->intr_ctrl = &wp_bri_intr_ctrl; + fe_iface->event_ctrl = &wp_bri_event_ctrl; + + fe_iface->isdn_bri_dchan_tx = &wp_bri_dchan_tx; +#if 0 + fe_iface->isdn_bri_dchan_rx = &wp_bri_dchan_rx; +#endif + +#if defined(AFT_TDM_API_SUPPORT) + fe_iface->watchdog = &wp_bri_watchdog; +#endif + + return 0; +} + +/* Should be done only ONCE per card. */ +static int32_t wp_bri_spi_bus_reset(sdla_fe_t *fe) +{ + sdla_t *card = (sdla_t*)fe->card; + + BRI_FUNC(); + + DEBUG_EVENT("%s: Executing SPI bus reset....\n", fe->name); + + card->hw_iface.bus_write_4( card->hw, + SPI_INTERFACE_REG, + MOD_SPI_RESET); + WP_DELAY(1000); + card->hw_iface.bus_write_4( card->hw, + SPI_INTERFACE_REG, + 0x00000000); + WP_DELAY(1000); + return 0; +} + +/****************************************************************************** +* scan_modules() +* +* Description : Scan for installed modules. +* +* Arguments : pfe - pointer to Front End structure. +* +* Returns : number of discovered modules. +*******************************************************************************/ +static int32_t scan_modules(sdla_fe_t *fe, u_int8_t rm_no) +{ + u_int8_t mod_no = 0x3; /* to read remora status register ALWAYS put 0x3 into mod_addr. */ + u_int8_t value, ind, mod_counter = 0; + u_int8_t mod_no_index; /* index in the array of ALL modules (NOT lines) on ALL remoras. From 0 to 11 */ + + /* format of remora status register: + bit 0 == 1 - module 1 active (exist) + bit 1 - type of module 1 (0 - NT, 1 - TE) + + bit 2 == 1 - module 2 active (exist) + bit 3 - type of module 1 (0 - NT, 1 - TE) + + bit 4 == 1 - module 3 active (exist) + bit 5 - type of module 1 (0 - NT, 1 - TE) + + bit 6,7 - has to be zeros for active remora. if non-zero, remora does not exist. + */ + + value = fe->read_fe_reg(fe->card, + mod_no, + MOD_TYPE_NONE, + rm_no, + 0); + +#define MODULE1 0 +#define MODULE2 2 +#define MODULE3 4 + + DEBUG_BRI_INIT("remora number: %d, remora status register: 0x%02X\n", rm_no, value); + + if(((value >> 7) & 0x01) || ((value >> 8) & 0x01)){ + DEBUG_EVENT("%s: Remora number %d does not exist.\n", fe->name, rm_no); + return 0; + }else{ + DEBUG_EVENT("%s: Remora number %d exist.\n", fe->name, rm_no); + } + + for(ind = 0; ind < 6; ind++){ + + switch(ind){ + + case MODULE1: + case MODULE2: + case MODULE3: + DEBUG_BRI_INIT("module Number on REMORA (0-2): %d\n", ind / 2); + + /* 0-11, all (even and odd) numbers */ + mod_no_index = rm_no * MAX_BRI_MODULES_PER_REMORA + ind / 2; + DEBUG_BRI_INIT("mod_no_index on CARD (should be 0-11): %d\n", mod_no_index); + + /* 0-23, only even numbers */ + mod_no_index = mod_no_index * 2; + DEBUG_BRI_INIT("mod_no_index (line number) on CARD (should be 0-23): %d\n", mod_no_index); + + if(mod_no_index >= MAX_BRI_LINES){ + DEBUG_EVENT("%s: Error: Module %d/%d exceeds maximum (%d)\n", + fe->name, mod_no_index, mod_no_index, MAX_BRI_LINES); + return 0; + } + + if((value >> ind) & 0x01){ + + mod_counter++; + + if((value >> (ind + 1)) & 0x01){ + + DEBUG_BRI_INIT("%s: Module %d type is: TE\n", + fe->name, mod_no_index); + + fe->bri_param.mod[mod_no_index].type = MOD_TYPE_TE; + + fe->bri_param.mod[mod_no_index].port[PORT_0].mode |= PORT_MODE_TE; + fe->bri_param.mod[mod_no_index].port[PORT_1].mode |= PORT_MODE_TE; + + }else{ + DEBUG_BRI_INIT("%s: Module %d type is: NT\n", + fe->name, mod_no_index); + + fe->bri_param.mod[mod_no_index].type = MOD_TYPE_NT; + + fe->bri_param.mod[mod_no_index].port[PORT_0].mode |= PORT_MODE_NT; + fe->bri_param.mod[mod_no_index].port[PORT_1].mode |= PORT_MODE_NT; + } + + /*Copy information from (even numbered) 'mod_no_index' to + (odd numbered) 'mod_no_index + 1' because for each module there are two lines.*/ + memcpy(&fe->bri_param.mod[mod_no_index + 1], &fe->bri_param.mod[mod_no_index], + sizeof(wp_bri_module_t)); + }else{ + DEBUG_BRI_INIT("%s: Module %d is not installed\n", + fe->name, mod_no_index); + } + DEBUG_BRI_INIT("=================================\n\n"); + break; + }/* switch() */ + }/* for() */ + + return mod_counter; +} + +/****************************************************************************** +* scan_remoras_and_modules() +* +* Description : Scan for installed Remoras and modules. +* +* Arguments : pfe - pointer to Front End structure. +* +* Returns : 0 - configred successfully, otherwise non-zero value. +*******************************************************************************/ +static int32_t scan_remoras_and_modules(void* pfe) +{ + sdla_fe_t *fe = (sdla_fe_t*)pfe; + int32_t rm_no, modules_counter = 0; + + BRI_FUNC(); + + for(rm_no = 0; rm_no < MAX_BRI_REMORAS; rm_no++){ + + modules_counter += scan_modules(fe, rm_no); + } + + if(modules_counter == 0){ + DEBUG_EVENT("%s: Error: modules counter is zero!\n", fe->name); + return 1; + }else{ + DEBUG_EVENT("%s: Total number of modules: %d.\n", fe->name, modules_counter); + return 0; + } +} + +/****************************************************************************** +* bri_global_config() +* +* Description : Global configuration for Sangoma BRI board. +* +* Notes : 1. This routine runs only ONCE for a physical 'base' CARD, +* not for 'additional' cards. +* 2. reset card's SPI. +* 3. Scan for installed Remoras and modules. +* +* Arguments : pfe - pointer to Front End structure. +* +* Returns : 0 - configred successfully, otherwise non-zero value. +*******************************************************************************/ +static int32_t bri_global_config(void* pfe) +{ + sdla_fe_t *fe = (sdla_fe_t*)pfe; + + BRI_FUNC(); + + DEBUG_EVENT("%s: %s Global Front End configuration\n", + fe->name, FE_MEDIA_DECODE(fe)); + + return 0; +} + +/******************************************************************************* +* bri_global_unconfig() +* +* Description : Global un-configuration for Sangoma BRI board. +* Note: This routne runs only ONCE for a physical card. +* +* Arguments : +* +* Returns : 0 +*******************************************************************************/ +static int32_t bri_global_unconfig(void* pfe) +{ + sdla_fe_t *fe = (sdla_fe_t*)pfe; + + BRI_FUNC(); + + DEBUG_EVENT("%s: %s Global Front End unconfiguration!\n", + fe->name, FE_MEDIA_DECODE(fe)); + + return 0; +} + + +/* + ****************************************************************************** + * wp_bri_pre_release() + * + * Description: BRI pre release function (not locked routines) + * Arguments: + * Returns: + ****************************************************************************** + */ +static int wp_bri_pre_release(void* pfe) +{ + sdla_fe_t *fe = (sdla_fe_t*)pfe; + wp_bri_module_t *bri_module; + sdla_bri_param_t *bri = &fe->bri_param; + u8 mod_no, port_no; + bri_xhfc_port_t *port_ptr; + + DEBUG_EVENT("%s: Running post initialization...\n", fe->name); + + if(validate_fe_line_no(fe, __FUNCTION__)){ + return 1; + } + + mod_no = fe_line_no_to_physical_mod_no(fe); + port_no = fe_line_no_to_port_no(fe); + + DEBUG_HFC_S0_STATES("%s(): mod_no: %i, port_no: %i\n", __FUNCTION__, mod_no, port_no); + + bri_module = &bri->mod[mod_no]; + + for (port_no = 0; port_no < bri_module->num_ports; port_no++) { + port_ptr = &bri_module->port[port_no]; + + wan_del_timer(&port_ptr->t3_timer); + wan_del_timer(&port_ptr->t4_timer); + }/* for (port_no = 0; port_no < bri_module->num_ports; port_no++) */ + + return 0; +} + +/****************************************************************************** +* wp_bri_config() - initialise the XHFC ISDN Chip. +* +* Description : Configure the PHYSICAL module ONE time. +* On each module 2 lines will be configured +* in exactly the same way. +* +* Arguments : pfe - pointer to Front End structure. +* +* Returns : 0 - configred successfully, otherwise non-zero value. +*******************************************************************************/ +static int32_t wp_bri_config(void *pfe) +{ + sdla_fe_t *fe = (sdla_fe_t*)pfe; + sdla_t *card = (sdla_t*)fe->card; + u8 mod_no, port_no, mod_cnt = 0; + /*sdlahw_t* hw = (sdlahw_t*)card->hw;*/ + int32_t err = 0, aft_line_no = 0; + u16 physical_module_config_counter; + u32 physical_card_config_counter; + wp_bri_module_t *bri_module; + sdla_bri_param_t *bri = &fe->bri_param; + + BRI_FUNC(); + + DEBUG_EVENT("%s: %s: Line %d Front End configuration\n", + fe->name, FE_MEDIA_DECODE(fe), WAN_FE_LINENO(fe) + 1); + + if(validate_fe_line_no(fe, __FUNCTION__)){ + return 1; + } + + mod_no = fe_line_no_to_physical_mod_no(fe); + port_no = fe_line_no_to_port_no(fe); + + DEBUG_EVENT("%s(): mod_no: %i, port_no: %i\n", __FUNCTION__, mod_no, port_no); + + WAN_ASSERT(fe->write_fe_reg == NULL); + WAN_ASSERT(fe->read_fe_reg == NULL); + + fe->bri_param.max_fe_channels = MAX_TIMESLOTS; + fe->bri_param.module_map[0] = fe->bri_param.module_map[1] = 0; + + bri_module = &bri->mod[mod_no]; + + card->hw_iface.getcfg(card->hw, SDLA_HWCPU_USEDCNT, &physical_card_config_counter); + if(physical_card_config_counter == 1){ + /* Per-card initialization. Important to do only ONCE.*/ + wp_bri_spi_bus_reset(fe); + } + + if(scan_remoras_and_modules(fe)){ + return 1; + } + +#if BUILD_MOD_TESTER + /* for Production Test nothing else should be done */ + return 0; +#endif + + /*Event lock */ + WAN_LIST_INIT(&fe->event); + /* wan_spin_lock_init(&fe->lock, "wp_bri_lock"); FIXME: 'lock' is not there, but what is there? */ + + card->hw_iface.getcfg(card->hw, SDLA_HWPORTREG, &physical_module_config_counter); + + /* configuration is in 'card' copy to 'interface' */ + fe->bri_param.is_clock_master = card->fe.fe_cfg.cfg.bri.clock_mode; + + if(fe->bri_param.is_clock_master == WANOPT_YES){ + + u32 recovery_clock_flag; + + card->hw_iface.getcfg(card->hw, SDLA_RECOVERY_CLOCK_FLAG, &recovery_clock_flag); + if (recovery_clock_flag){ + DEBUG_EVENT("%s: Error: Multiple Interfaces configured for LINE clocking!\n", + fe->name); + DEBUG_EVENT("%s: Please select only a single device as the LINE clock source\n", + fe->name); + return 1; + } + + if (fe->bri_param.mod[mod_no].type != MOD_TYPE_TE){ + DEBUG_EVENT("%s: Error: NT module does not support LINE clock recovery mode!\n", + fe->name); + return 1; + } + } + + bri_module->fe = fe; + + switch(fe->bri_param.mod[mod_no].type) + { + case MOD_TYPE_TE: + case MOD_TYPE_NT: + if(physical_module_config_counter == 1){ + + if((err = reset_chip(fe, mod_no))){ + return err; + } + + if((err = init_xfhc(fe, mod_no))){ + return err; + } + }else{ + bri_module->num_ports = BRI_MAX_PORTS_PER_CHIP; + bri_module->max_fifo = 8; + bri_module->max_z = 0x7F; + + /* init line interfaces state machines (in software only!) */ + for (port_no = 0; port_no < bri_module->num_ports; port_no++) { + + bri_module->port[port_no].idx = port_no; + bri_module->port[port_no].hw = bri_module; + + }/* for (port_no = 0; port_no < bri_module->num_ports; port_no++) */ + } + break; + + default: + DEBUG_EVENT("%s(): %s: Warning: Module %d (AFT Line: %d): Not Installed.\n", + __FUNCTION__, fe->name, REPORT_MOD_NO, aft_line_no); + break; + } + + /**************************************************************************/ + /* Set active modules (channels) bitmap for all installed LOGICAL modules */ + +#define BCHAN_BITMAP 0x3 /* each BRI line has 2 b-channels --> 2 bits */ + + if(mod_no < (MAX_BRI_LINES / 2)){ + /* 1-st aft line has timeslots 0-23 */ + aft_line_no = 0; + }else{ + /* 2-nd aft line has timeslots 24-47 */ + aft_line_no = 1; + } + + fe->bri_param.mod[mod_no].mod_no = mod_no; + + switch(fe->bri_param.mod[mod_no].type) + { + case MOD_TYPE_TE: + case MOD_TYPE_NT: + fe->bri_param.module_map[aft_line_no] |= (BCHAN_BITMAP << (mod_no*2)); + + DEBUG_EVENT("%s: Module %d (AFT Line: %d): Installed -- %s. Timeslots map: 0x%08X\n", + fe->name, REPORT_MOD_NO, aft_line_no, + WP_BRI_DECODE_MOD_TYPE(fe->bri_param.mod[mod_no].type), + (BCHAN_BITMAP << (mod_no*2))); + mod_cnt++; + break; + + default: + DEBUG_EVENT("%s(): %s: Warning: Module %d (AFT Line: %d): Not Installed.\n", + __FUNCTION__, fe->name, REPORT_MOD_NO, aft_line_no); + break; + } + + /*******************************************************/ + /* Enable interrupts on the installed PHYSICAL module. */ + switch(fe->bri_param.mod[mod_no].type) + { + case MOD_TYPE_TE: + case MOD_TYPE_NT: + if(physical_module_config_counter == 1){ +/* DAVIDR-consider moving call bri_enable_interrupts() to wp_bri_post_init() */ + bri_enable_interrupts(fe, mod_no, port_no); + }else{ + DEBUG_HFC_INIT("%s(): the other port_no is ALREADY running, interrupts are enabled.\n", + __FUNCTION__); + } + break; + default: + DEBUG_EVENT("%s(): %s: Warning: Module %d (AFT Line: %d): Not Installed.\n", + __FUNCTION__, fe->name, REPORT_MOD_NO, aft_line_no); + break; + } + + /******************************************************/ + /*------------------ CLOCK RECOVERY ------------------*/ + if(physical_card_config_counter == 1){ + /* Per-card initialization. Important to do only ONCE.*/ + u32 i; + + /* ALL modules MUST have GPIO6 function switched + from the default 'output' to 'input'. + Otherwise there will be a clock conflict! + */ + for(i = 0; i < MAX_BRI_LINES; i += BRI_MAX_PORTS_PER_CHIP){ + + switch(fe->bri_param.mod[i].type) + { + case MOD_TYPE_TE: + case MOD_TYPE_NT: + config_clock_routing(fe, i, WANOPT_NO); + break; + default: + continue; + }/* switch() */ + }/* for() */ + }/* if() */ + /*----------- END OF CLOCK RECOVERY ------------------*/ + /******************************************************/ + + if(fe->bri_param.is_clock_master == WANOPT_YES){ + u32 recovery_clock_flag = 1; + card->hw_iface.setcfg(card->hw, SDLA_RECOVERY_CLOCK_FLAG, &recovery_clock_flag); + } + return 0; +} + +/****************************************************************************** +** wp_bri_unconfig() - +** +** OK +*/ +static int32_t wp_bri_unconfig(void *pfe) +{ + sdla_fe_t *fe = (sdla_fe_t*)pfe; + u8 mod_no, port_no; + u16 physical_module_config_counter; + sdla_t *card = (sdla_t*)fe->card; + + if(validate_fe_line_no(fe, __FUNCTION__)){ + return 1; + } + + mod_no = fe_line_no_to_physical_mod_no(fe); + port_no = fe_line_no_to_port_no(fe); + + DEBUG_HFC_INIT("%s(): mod_no: %d, port_no: %d\n", __FUNCTION__, mod_no, port_no); + + DEBUG_EVENT("%s: Unconfiguring BRI Front End...\n", fe->name); + + card->hw_iface.getcfg(card->hw, SDLA_HWPORTREG, &physical_module_config_counter); + + WAN_ASSERT(fe->write_fe_reg == NULL); + WAN_ASSERT(fe->read_fe_reg == NULL); + + /******************************************************************/ + switch(fe->bri_param.mod[mod_no].type) + { + case MOD_TYPE_TE: + case MOD_TYPE_NT: + if(fe->bri_param.mod[mod_no].type == MOD_TYPE_TE && + fe->bri_param.is_clock_master == WANOPT_YES){ + /* master port_no is shutting down - switch all modules to internal card's clock */ + clock_control(fe, 0); + } + + config_clock_routing(fe, mod_no, WANOPT_NO); + + if(physical_module_config_counter == 1){ + wp_bri_disable_irq(fe, mod_no, port_no); + }else{ + DEBUG_HFC_INIT("%s(): the other port_no is still running, leave interrupts enabled.\n", + __FUNCTION__); + } + break; + default: + /* for missing (not installed) modules - do nothing */ + DEBUG_EVENT("%s(): %s: Warining: unknown module type!\n", + __FUNCTION__, fe->name); + break; + } + /******************************************************************/ + + if(fe->bri_param.is_clock_master == WANOPT_YES){ + u32 recovery_clock_flag = 0; + card->hw_iface.setcfg(card->hw, SDLA_RECOVERY_CLOCK_FLAG, &recovery_clock_flag); + } + + return 0; +} + +/****************************************************************************** +** wp_bri_post_init() - +** +** OK +*/ +static int32_t wp_bri_post_init(void *pfe) +{ + sdla_fe_t *fe = (sdla_fe_t*)pfe; + wp_bri_module_t *bri_module; + sdla_bri_param_t *bri = &fe->bri_param; + u8 mod_no, port_no; + bri_xhfc_port_t *port_ptr; + + DEBUG_EVENT("%s: Running post initialization...\n", fe->name); + + if(validate_fe_line_no(fe, __FUNCTION__)){ + return 1; + } + + mod_no = fe_line_no_to_physical_mod_no(fe); + port_no = fe_line_no_to_port_no(fe); + + DEBUG_HFC_S0_STATES("%s(): mod_no: %i, port_no: %i\n", __FUNCTION__, mod_no, port_no); + + bri_module = &bri->mod[mod_no]; + + /* */ + for (port_no = 0; port_no < bri_module->num_ports; port_no++) { + port_ptr = &bri_module->port[port_no]; + + wan_init_timer(&port_ptr->t3_timer, l1_timer_expire_t3, (wan_timer_arg_t)port_ptr); + wan_init_timer(&port_ptr->t4_timer, l1_timer_expire_t4, (wan_timer_arg_t)port_ptr); + }/* for (port_no = 0; port_no < bri_module->num_ports; port_no++) */ + +#if 1 + { + wan_smp_flag_t smp_flags1; + sdla_t *card = (sdla_t*)fe->card; + + /* Try to activate the port_no - if cable is in, line will get activated. + If no cable, the application will have to call wp_bri_set_fe_status() + to get line activated. */ + card->hw_iface.hw_lock(card->hw,&smp_flags1); + wp_bri_set_fe_status(fe, WAN_FE_CONNECTED); + card->hw_iface.hw_unlock(card->hw,&smp_flags1); + } +#endif + return 0; +} + + +/** + * l1_timer_start_t3 + */ +static void l1_timer_start_t3(void *pport) +{ + bri_xhfc_port_t *port_ptr = (bri_xhfc_port_t*)pport; + wp_bri_module_t *bri_module = port_ptr->hw; + u8 mod_no = bri_module->mod_no; + + DEBUG_HFC_S0_STATES("%s(): mod_no: %i, port number: %i\n", __FUNCTION__, mod_no, port_ptr->idx); + + if(!wan_test_and_set_bit(T3_TIMER_ACTIVE, &port_ptr->timer_flags)){ + + DEBUG_HFC_S0_STATES("Starting T3 timer...\n"); + +#if defined(__WINDOWS__) + /* delay is in MS, so it can be used directly by wan_add_timer() */ + wan_add_timer(&port_ptr->t3_timer, XHFC_TIMER_T3); +#else + wan_add_timer(&port_ptr->t3_timer, (XHFC_TIMER_T3 * HZ) / 1000); +#endif + } +} + +/** + * l1_timer_stop_t3 + */ +static void l1_timer_stop_t3(void *pport) +{ + bri_xhfc_port_t *port_ptr = (bri_xhfc_port_t*)pport; + wp_bri_module_t *bri_module = port_ptr->hw; + u8 mod_no = bri_module->mod_no; + + DEBUG_HFC_S0_STATES("%s(): mod_no: %i, port number: %i\n", __FUNCTION__, mod_no, port_ptr->idx); + DEBUG_HFC_S0_STATES("Stopping T3 timer...\n"); + + wan_clear_bit(T3_TIMER_ACTIVE, &port_ptr->timer_flags); + wan_clear_bit(HFC_L1_ACTIVATING, &port_ptr->l1_flags); + wan_del_timer(&port_ptr->t3_timer); +} + + +/* + ****************************************************************************** + * l1_timer_expire_t3() + * + * Description: called when timer t3 expires. + * Activation failed, force clean L1 deactivation. + * Arguments: + * Returns: + ****************************************************************************** + */ +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) +static void l1_timer_expire_t3(void* pport) +#elif defined(__WINDOWS__) +static void l1_timer_expire_t3(IN PKDPC Dpc, void* pport, void* arg2, void* arg3) +#else +static void l1_timer_expire_t3(unsigned long pport) +#endif +{ + bri_xhfc_port_t *port_ptr = (bri_xhfc_port_t*)pport; + wp_bri_module_t *bri_module = port_ptr->hw; + u8 mod_no = bri_module->mod_no; + sdla_fe_t *fe = (sdla_fe_t*)bri_module->fe; + sdla_t *card = (sdla_t*)fe->card; + wan_smp_flag_t smp_flags1; + + DEBUG_HFC_S0_STATES("%s(): mod_no: %i, port number: %i\n", __FUNCTION__, mod_no, port_ptr->idx); + + wan_clear_bit(T3_TIMER_ACTIVE, &port_ptr->timer_flags); + + wan_clear_bit(HFC_L1_ACTIVATING, &port_ptr->l1_flags); + card->hw_iface.hw_lock(card->hw,&smp_flags1); + xhfc_ph_command(fe, port_ptr, HFC_L1_FORCE_DEACTIVATE_TE); + card->hw_iface.hw_unlock(card->hw,&smp_flags1); +} + + +/** + * l1_timer_start_t4 + */ +static void l1_timer_start_t4(void *pport) +{ + bri_xhfc_port_t *port_ptr = (bri_xhfc_port_t*)pport; + wp_bri_module_t *bri_module = port_ptr->hw; + u8 mod_no = bri_module->mod_no; + + DEBUG_HFC_S0_STATES("%s(): mod_no: %i, port number: %i\n", __FUNCTION__, mod_no, port_ptr->idx); + + if(!wan_test_and_set_bit(T4_TIMER_ACTIVE, &port_ptr->timer_flags)){ + + DEBUG_HFC_S0_STATES("Starting T4 timer...\n"); + + wan_set_bit(HFC_L1_DEACTTIMER, &port_ptr->l1_flags); + +#if defined(__WINDOWS__) + /* delay is in MS, so it can be used directly by wan_add_timer() */ + wan_add_timer(&port_ptr->t4_timer, XHFC_TIMER_T4); +#else + wan_add_timer(&port_ptr->t4_timer, (XHFC_TIMER_T4 * HZ) / 1000); +#endif + } +} + +/** + * l1_timer_stop_t4 + */ +static void l1_timer_stop_t4(void *pport) +{ + bri_xhfc_port_t *port_ptr = (bri_xhfc_port_t*)pport; + wp_bri_module_t *bri_module = port_ptr->hw; + u8 mod_no = bri_module->mod_no; + + DEBUG_HFC_S0_STATES("%s(): mod_no: %i, port number: %i\n", __FUNCTION__, mod_no, port_ptr->idx); + DEBUG_HFC_S0_STATES("Stopping T4 timer...\n"); + + wan_clear_bit(T4_TIMER_ACTIVE, &port_ptr->timer_flags); + wan_clear_bit(HFC_L1_DEACTTIMER, &port_ptr->l1_flags); + wan_del_timer(&port_ptr->t4_timer); +} + + +/* + ****************************************************************************** + * l1_timer_expire_t4() + * + * Description: l1_timer_expire_t4 - called when timer t4 expires. + * Send (PH_DEACTIVATE | INDICATION) to upper layer. + * + * Arguments: + * Returns: + ****************************************************************************** + */ +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) +static void l1_timer_expire_t4(void* pport) +#elif defined(__WINDOWS__) +static void l1_timer_expire_t4(IN PKDPC Dpc, void* pport, void* arg2, void* arg3) +#else +static void l1_timer_expire_t4(unsigned long pport) +#endif +{ + bri_xhfc_port_t *port_ptr = (bri_xhfc_port_t*)pport; + wp_bri_module_t *bri_module = port_ptr->hw; + u8 mod_no = bri_module->mod_no; + + DEBUG_HFC_S0_STATES("%s(): mod_no: %i, port number: %i\n", __FUNCTION__, mod_no, port_ptr->idx); + + wan_clear_bit(T4_TIMER_ACTIVE, &port_ptr->timer_flags); + wan_clear_bit(HFC_L1_DEACTTIMER, &port_ptr->l1_flags); +} + +/****************************************************************************** +** wp_bri_if_config() - +** +** OK +*/ +static int32_t wp_bri_if_config(void *pfe, u32 mod_map, u8 usedby) +{ + BRI_FUNC(); + return 0; +} + + +/****************************************************************************** +** wp_bri_if_unconfig() - +** +** OK +*/ +static int32_t wp_bri_if_unconfig(void *pfe, u32 mod_map, u8 usedby) +{ + BRI_FUNC(); + return 0; +} + + +/******************************************************************************* +* bri_enable_interrupts() +* +* Description: Enable BRI interrupts - start interrupt and set interrupt mask. +* +* Arguments: +* +* Returns: +*******************************************************************************/ +static void bri_enable_interrupts(sdla_fe_t *fe, u32 mod_no, u8 port_no) +{ + sdla_bri_param_t *bri = &fe->bri_param; + wp_bri_module_t *bri_module; + reg_r_ti_wd r_ti_wd; + reg_r_misc_irqmsk r_misc_irqmsk; + reg_r_irq_ctrl r_irq_ctrl; + + BRI_FUNC(); + + if(validate_physical_mod_no(mod_no, __FUNCTION__)){ + return; + } + + DEBUG_EVENT("%s: Module: %d: Enabling %s Interrupts \n", + fe->name, REPORT_MOD_NO, + FE_MEDIA_DECODE(fe)); + + bri_module = &bri->mod[mod_no]; + + WRITE_REG(R_SU_IRQMSK, 0); + + r_ti_wd.reg = 0x0; + /* Configure Timer Interrupt - every 2.048 seconds (page 289, 297). + Used for SU port_no state monitoring with 'HFC_TIMER_COUNTER_T3'. + */ + r_ti_wd.bit.v_ev_ts = 0xD; + /* Watch Dog interrupt not used */ + r_ti_wd.bit.v_wd_ts = 0x0; + WRITE_REG(R_TI_WD, r_ti_wd.reg); + + r_misc_irqmsk.reg = 0; +#if !BUILD_MOD_TESTER + r_misc_irqmsk.bit.v_ti_irqmsk = 1;/* Enable (one) / Disable (zero) timer interrupts */ +#endif + WRITE_REG( R_MISC_IRQMSK, r_misc_irqmsk.reg); + + /* clear all pending interrupts bits */ + READ_REG( R_MISC_IRQ); + READ_REG( R_SU_IRQ); + READ_REG( R_FIFO_BL0_IRQ); + READ_REG( R_FIFO_BL1_IRQ); + READ_REG( R_FIFO_BL2_IRQ); + READ_REG( R_FIFO_BL3_IRQ); + +#if 1 + { + reg_r_su_irqmsk r_su_irqmsk; + + /* unmask FE interrupt for all ports */ + r_su_irqmsk.reg = 0; + r_su_irqmsk.bit.v_su0_irqmsk = 1; + r_su_irqmsk.bit.v_su1_irqmsk = 1; + WRITE_REG( R_SU_IRQMSK, r_su_irqmsk.reg); + } +#endif + + /* enable global (all) interrupts */ + r_irq_ctrl.reg = 0; + r_irq_ctrl.bit.v_glob_irq_en = 1; + r_irq_ctrl.bit.v_fifo_irq_en = 1; + WRITE_REG( R_IRQ_CTRL, r_irq_ctrl.reg); +} + +/****************************************************************************** +** wp_bri_disable_irq() - disable all interrupts by disabling M_GLOB_IRQ_EN +** +** OK +*/ +static int32_t wp_bri_disable_irq(sdla_fe_t *fe, u32 mod_no, u8 port_no) +{ + sdla_bri_param_t *bri = &fe->bri_param; + wp_bri_module_t *bri_module; + reg_r_su_irqmsk r_su_irqmsk; + reg_r_irq_ctrl r_irq_ctrl; + + BRI_FUNC(); + + if(validate_physical_mod_no(mod_no, __FUNCTION__)){ + return 1; + } + + DEBUG_EVENT("%s: Module: %d: Disabling %s Interrupts \n", + fe->name, REPORT_MOD_NO, + FE_MEDIA_DECODE(fe)); + + bri_module = &bri->mod[mod_no]; + + /* disable FE interrupt for the port */ + r_su_irqmsk.reg = 0; + WRITE_REG( R_SU_IRQMSK, r_su_irqmsk.reg); + +/* + if (!wan_test_bit(WP_RM_CONFIGURED,(void*)&fe->bri_param.critical)){ + return -EINVAL; + } +*/ + + /* disable global (all) other interrupts */ + r_irq_ctrl.reg = 0; + WRITE_REG( R_IRQ_CTRL, 0); + + return 0; +} + +static u32 wp_bri_active_map(sdla_fe_t* fe, u8 line_no) +{ + BRI_FUNC(); + + if(line_no >= 2){ + DEBUG_EVENT("%s: %s(): Error: Line number %d is out of range!\n", + fe->name, __FUNCTION__, line_no); + return 0; + } + + DEBUG_EVENT("%s: ACTIVE MAP Port=%i Returning 0x%08X\n", + fe->name, + WAN_FE_LINENO(fe), + 0x03 << (WAN_FE_LINENO(fe)%MAX_BRI_MODULES)*2); + + return 0x03 << (WAN_FE_LINENO(fe)%MAX_BRI_MODULES)*2; +} + +/****************************************************************************** +* wp_bri_fe_status() +* +* Description: +* Arguments: +* Returns: +*******************************************************************************/ +static u8 wp_bri_fe_media(sdla_fe_t *fe) +{ + BRI_FUNC(); + return fe->fe_cfg.media; +} + +/****************************************************************************** +* wp_bri_set_dtmf() +* +* Description: +* Arguments: +* Returns: +*******************************************************************************/ +static int32_t wp_bri_set_dtmf(sdla_fe_t *fe, int32_t mod_no, u8 val) +{ + BRI_FUNC(); +#if 0 + + if (mod_no > MAX_REMORA_MODULES){ + DEBUG_EVENT("%s: Module %d: Module number out of range!\n", + fe->name, mod_no); + return -EINVAL; + } + if (!wan_test_bit(mod_no-1, &fe->bri_param.module_map)){ + DEBUG_EVENT("%s: Module %d: Not configures yet!\n", + fe->name, mod_no); + return -EINVAL; + } + +#endif + return -EINVAL; +} + +#if 0 + +/******************************************************************************* +* sdla_bri_timer() +* +* Description: +* Arguments: +* Returns: +*******************************************************************************/ +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) +static void wp_bri_timer(void* pfe) +#elif defined(__WINDOWS__) +static void wp_bri_timer(IN PKDPC Dpc, void* pfe, void* arg2, void* arg3) +#else +static void wp_bri_timer(void *pfe) +#endif +{ + BRI_FUNC(); + return; +} + +/******************************************************************************* +* wp_bri_enable_timer() +* +* Description: Enable software timer interrupt in delay ms. +* Arguments: +* Returns: +*******************************************************************************/ +static void wp_bri_enable_timer(sdla_fe_t* fe, u8 mod_no, u8 cmd, u32 delay) +{ + BRI_FUNC(); + return; +} + +static int32_t wp_bri_regdump(sdla_fe_t* fe, u8 *data) +{ + BRI_FUNC(); + return 0; +} + +#endif /* if 0*/ + +static int32_t wp_bri_polling(sdla_fe_t* fe) +{ + BRI_FUNC(); + return 0; +} + +/******************************************************************************* +* wp_bri_udp() +* +* Description: +* Arguments: +* Returns: +*******************************************************************************/ +static int32_t wp_bri_udp(sdla_fe_t *fe, void* p_udp_cmd, u8* data) +{ + int32_t err = -EINVAL; + + BRI_FUNC(); +#if 0 + wan_cmd_t *udp_cmd = (wan_cmd_t*)p_udp_cmd; + + switch(udp_cmd->wan_cmd_command){ + case WAN_FE_REGDUMP: + err = wp_bri_regdump(fe, data); + if (err){ + udp_cmd->wan_cmd_return_code = WAN_CMD_OK; + udp_cmd->wan_cmd_data_len = (u16)err; + } + break; + + default: + udp_cmd->wan_cmd_return_code = WAN_UDP_INVALID_CMD; + udp_cmd->wan_cmd_data_len = 0; + break; + } +#endif + return err; +} + +/****************************************************************************** +* wp_bri_get_fe_status() +* +* Description : Get current FE line state - is it Connected or Disconnected +* +* Arguments : fe - pointer to Front End structure. +* status - pointer to location where the FE line state will +* be stored. +* +* Returns : always zero. +*******************************************************************************/ +static int wp_bri_get_fe_status(sdla_fe_t *fe, unsigned char *status) +{ + *status = fe->fe_status; + return 0; +} + +/****************************************************************************** +* wp_bri_set_fe_status() +* +* Description : Set FE line state to Connected or Disconnected. +* In BRI this means Activate or Deactivate the line. +* +* Arguments : fe - pointer to Front End structure. +* new_status - the new FE line state. +* +* Returns : 0 - success. +* 1 - failure. +*******************************************************************************/ +static int wp_bri_set_fe_status(sdla_fe_t *fe, unsigned char new_status) +{ + u8 mod_no, port_no; + int rc = 0; + sdla_bri_param_t *bri = &fe->bri_param; + wp_bri_module_t *bri_module; + bri_xhfc_port_t *port_ptr; + + mod_no = fe_line_no_to_physical_mod_no(fe); + port_no = fe_line_no_to_port_no(fe); + + DEBUG_FE_STATUS("%s(): Module: %d, port_no: %d. fe->name: %s, new status: %d (%s)\n", + __FUNCTION__, mod_no, port_no, fe->name, new_status, FE_STATUS_DECODE(new_status)); + + bri_module = &bri->mod[mod_no]; + port_ptr = &bri_module->port[port_no]; + + switch(new_status) + { + case WAN_FE_CONNECTED: + DEBUG_HFC_S0_STATES("l2->l1 -- ACTIVATE REQUEST\n"); + + if (port_ptr->mode & PORT_MODE_TE) { + if (wan_test_bit(HFC_L1_ACTIVATED, &port_ptr->l1_flags)) { + /* The line is already in active. Confirm to L2 that line is connected. */ + DEBUG_HFC_S0_STATES("l1->l2 -- ACTIVATE CONFIRM\n"); + sdla_bri_set_status(fe, mod_no, port_no, FE_CONNECTED); + } else { + + wan_test_and_set_bit(HFC_L1_ACTIVATING, &port_ptr->l1_flags); + + xhfc_ph_command(fe, port_ptr, HFC_L1_ACTIVATE_TE); + l1_timer_start_t3(port_ptr); + } + } else { + xhfc_ph_command(fe, port_ptr, HFC_L1_ACTIVATE_NT); + } + break; + + case WAN_FE_DISCONNECTED: + DEBUG_HFC_S0_STATES("l2->l1 -- DEACTIVATE REQUEST\n"); + + if (port_ptr->mode & PORT_MODE_TE) { + /* no deact request in TE mode ! */ + DEBUG_EVENT("%s(): %s: Error: 'deactivate' request is invalid for TE!\n", + __FUNCTION__, fe->name); + rc = 1; + } else { + xhfc_ph_command(fe, port_ptr, HFC_L1_DEACTIVATE_NT); + } + break; + + default: + DEBUG_EVENT("%s(): %s: Error: invalid new status '%d' (%s) requested!\n", + __FUNCTION__, fe->name, new_status, FE_STATUS_DECODE(new_status)); + rc = 1; + break; + } + + return rc; +} + + +/****************************************************************************** +* wp_bri_event_ctrl() +* +* Description: Enable/Disable event types +* Arguments: mod_no - Module number (1,2,3,... MAX_REMORA_MODULES) +* Returns: +******************************************************************************/ +static int wp_bri_event_ctrl(sdla_fe_t *fe, wan_event_ctrl_t *ectrl) +{ + int err = 0; + + BRI_FUNC(); + + WAN_ASSERT(ectrl == NULL); + + return err; +} + +#if defined(AFT_TDM_API_SUPPORT) +/****************************************************************************** +* wp_bri_watchdog() +* +* Description: +* Arguments: mod_no - Module number (1,2,3,... MAX_REMORA_MODULES) +* Returns: +******************************************************************************/ +static int32_t wp_bri_watchdog(sdla_fe_t *fe) +{ + int32_t mod_no; + + BRI_FUNC(); + + return 0; +} +#endif + +/****************************************************************************** +* wp_bri_intr_ctrl() +* +* Description: Enable/Disable extra interrupt types +* Arguments: mod_no - Module number (1,2,3,... MAX_REMORA_MODULES) +* Returns: +******************************************************************************/ +static int wp_bri_intr_ctrl(sdla_fe_t *fe, int mod_no, u_int8_t type, u_int8_t mode, unsigned int ts_map) +{ + int32_t err = 0; + + BRI_FUNC(); + + return err; + +} + +/****************************************************/ +/* Physical S/U commands to control Line Interface */ +/****************************************************/ +static void xhfc_ph_command(sdla_fe_t *fe, bri_xhfc_port_t *port, u_char command) +{ + wp_bri_module_t *bri_module = port->hw; + u8 mod_no = bri_module->mod_no; + + DEBUG_HFC_S0_STATES("%s()\n", __FUNCTION__); + + switch (command) + { + case HFC_L1_ACTIVATE_TE: + DEBUG_HFC_S0_STATES("HFC_L1_ACTIVATE_TE port(%i)\n", port->idx); + + WRITE_REG(R_SU_SEL, port->idx); + WRITE_REG(A_SU_WR_STA, STA_ACTIVATE); + break; + + case HFC_L1_FORCE_DEACTIVATE_TE: + DEBUG_HFC_S0_STATES("HFC_L1_FORCE_DEACTIVATE_TE port(%i)\n", port->idx); + + WRITE_REG(R_SU_SEL, port->idx); + WRITE_REG(A_SU_WR_STA, STA_DEACTIVATE); + break; + + case HFC_L1_ACTIVATE_NT: + DEBUG_HFC_S0_STATES("HFC_L1_ACTIVATE_NT port(%i)\n", port->idx); + + WRITE_REG(R_SU_SEL, port->idx); + WRITE_REG(A_SU_WR_STA, STA_ACTIVATE | M_SU_SET_G2_G3); + break; + + case HFC_L1_DEACTIVATE_NT: + DEBUG_HFC_S0_STATES("HFC_L1_DEACTIVATE_NT port(%i)\n", port->idx); + + WRITE_REG(R_SU_SEL, port->idx); + WRITE_REG(A_SU_WR_STA, STA_DEACTIVATE); + break; + default: + DEBUG_HFC_S0_STATES("Invalid command: %i !\n", command); + break; + } +} + +/****************************************************************************** +* sdla_bri_set_status() +* +* Description: set line status to 'connected' or 'disconnected' and indicate +* line state change to upper layer. +* Arguments: fe, mod_no, port_no, new line status +* Returns: nothing +******************************************************************************/ +static void sdla_bri_set_status(sdla_fe_t* fe, u8 mod_no, u8 port_no, u8 new_status) +{ + sdla_t *card = (sdla_t*)fe->card; + + BRI_FUNC(); + + DEBUG_HFC_S0_STATES("%s(): new_status: %i, old status: %i\n", + __FUNCTION__, new_status, fe->fe_status); + + if(validate_physical_mod_no(mod_no, __FUNCTION__)){ + return; + } + + if (new_status == fe->fe_status){ + return; + } + + fe->fe_status = new_status; + + if (new_status == FE_CONNECTED){ + DEBUG_EVENT("%s: %s Module: %d connected!\n", + fe->name, + FE_MEDIA_DECODE(fe), REPORT_MOD_NO + port_no); + + if (card->wandev.te_report_alarms){ + card->wandev.te_report_alarms(card, 0); + } + + }else{ + DEBUG_EVENT("%s: %s Module: %d disconnected!\n", + fe->name, + FE_MEDIA_DECODE(fe), REPORT_MOD_NO + port_no); + + if (card->wandev.te_report_alarms){ + card->wandev.te_report_alarms(card, 1); + } + + if(fe->bri_param.is_clock_master == WANOPT_YES){ + config_clock_routing(fe, mod_no, WANOPT_NO); + clock_control(fe, 0); + } + } + + return; +} + + +/****************************************************************************** +* su_new_state() +* +* Description: handle SU port state interrupt on a physical module +* +* SU port state interrupt notes: +* 1. Chip automatically goes into inactive state if: +* 1.1 line is disconnected +* 1.2 line is deactivated +* +* 2. Because of (1) user application will have to activate the line, +* wait for the line to get 'connected' for about 1 second and if +* after 1 second line is not getting 'connected', it means line is +* actually disconnected and NOT simply deactivated. +* +* Arguments: fe, mod_no +* +* Returns: nothing +******************************************************************************/ +static void su_new_state(sdla_fe_t *fe, u32 mod_no, u8 port_no) +{ + bri_xhfc_port_t *port; + sdla_bri_param_t *bri = &fe->bri_param; + wp_bri_module_t *bri_module; + u8 connected = 0; + + if(validate_physical_mod_no(mod_no, __FUNCTION__)){ + return; + } + + bri_module = &bri->mod[mod_no]; + port = &bri_module->port[port_no]; + + connected = __su_new_state(fe, mod_no, port_no); + if(connected == 1){ + sdla_bri_set_status(fe, mod_no, port_no, FE_CONNECTED); + + port->clock_routing_state = WAITING_TO_STABILIZE; + port->clock_routing_counter = 0; + + }else{ + sdla_bri_set_status(fe, mod_no, port_no, FE_DISCONNECTED); + + port->clock_routing_state = LINE_DISCONNECTED; + port->clock_routing_counter = 0; + } +} + + +static u8 __su_new_state(sdla_fe_t *fe, u32 mod_no, u8 port_no) +{ + bri_xhfc_port_t *port; + sdla_bri_param_t *bri = &fe->bri_param; + wp_bri_module_t *bri_module; + u8 connected = 0; + + BRI_FUNC(); + + if(validate_physical_mod_no(mod_no, __FUNCTION__)){ + return connected; + } + + bri_module = &bri->mod[mod_no]; + port = &bri_module->port[port_no]; + + DEBUG_HFC_S0_STATES("%s(): mod_no: %i, port number: %i\n", __FUNCTION__, mod_no, port->idx); + + if (port->mode & PORT_MODE_TE) { + DEBUG_HFC_S0_STATES("TE F%d\n", port->l1_state); + + if ((port->l1_state <= 3) || (port->l1_state >= 7)){ + l1_timer_stop_t3(port); + } + + switch (port->l1_state) + { + case (3): + if (wan_test_and_clear_bit(HFC_L1_ACTIVATED, &port->l1_flags)){ + l1_timer_start_t4(port); + } + return connected; + + case (7): + l1_timer_stop_t4(port); + connected = 1; + + if (wan_test_and_clear_bit(HFC_L1_ACTIVATING, &port->l1_flags)) { + DEBUG_HFC_S0_STATES("l1->l2 -- ACTIVATE CONFIRM\n"); + + wan_set_bit(HFC_L1_ACTIVATED, &port->l1_flags); + + } else { + if (!(wan_test_and_set_bit(HFC_L1_ACTIVATED, &port->l1_flags))) { + DEBUG_HFC_S0_STATES("l1->l2 -- ACTIVATE INDICATION\n"); + } else { + /* L1 was already activated (e.g. F8->F7) */ + return connected; + } + } + break; + + case (8): + l1_timer_stop_t4(port); + return connected; + + default: + return connected; + } + + } else if (port->mode & PORT_MODE_NT) { + + DEBUG_HFC_S0_STATES("NT G%d\n", port->l1_state); + + switch (port->l1_state) + { + case (1): + port->nt_timer = 0; + port->mode &= ~NT_TIMER; + + DEBUG_HFC_S0_STATES("l1->l2 (PH_DEACTIVATE | INDICATION)\n"); + break; + case (2): + if (port->nt_timer < 0) { + port->nt_timer = 0; + port->mode &= ~NT_TIMER; + xhfc_ph_command(fe, port, HFC_L1_DEACTIVATE_NT); + } else { + port->nt_timer = NT_T1_COUNT; + port->mode |= NT_TIMER; + + WRITE_REG(R_SU_SEL, port->idx); + WRITE_REG(A_SU_WR_STA, M_SU_SET_G2_G3); + } + return connected; + case (3): + port->nt_timer = 0; + port->mode &= ~NT_TIMER; + + DEBUG_HFC_S0_STATES("l1->l2 -- ACTIVATE INDICATION\n"); + connected = 1; + break; + case (4): + port->nt_timer = 0; + port->mode &= ~NT_TIMER; + return connected; + default: + break; + } + } + + return connected; +} + +/****************************************************************************** +* get_FE_ptr_for_port() +* +* Description : get pointer to FE structure belonging to a 'port_no' on +* module 'mod_no'. +* Allows to handle FE interrupt of ALL ports on the SAME +* physical module. +* Note: the returned pointer is NOT the same as the pointer +* in 'wp_bri_module_t->fe' because this function returns +* 'fe' related to the 'card'. +* +* Arguments : fe, mod_no, port_no +* +* Returns : fe pointer - found FE for the 'port_no'. +* NULL - FE for the 'port_no' not found (it means port_no +* is not used). +* +******************************************************************************/ +sdla_fe_t *get_FE_ptr_for_port(sdla_fe_t *original_fe, u8 mod_no, u8 port_no) +{ + sdla_t *card = (sdla_t*)original_fe->card; + sdla_t *tmp_card; + void **card_list; + + BRI_FUNC(); + + DEBUG_HFC_IRQ("%s(): mod: %d, port_no: %d (sum: %d)\n", + __FUNCTION__, mod_no, port_no, mod_no + port_no); + + card_list=__sdla_get_ptr_isr_array(card->hw); +/* +{ + int i; + for(i = 0; i < SDLA_MAX_PORTS; i++){ + DEBUG_HFC_IRQ("card_list[%d]: 0x%p\n", i, card_list[i]); + } +} +*/ + tmp_card=(sdla_t*)card_list[mod_no + port_no]; + + DEBUG_HFC_IRQ("%s(): card_list ptr: 0x%p\n", __FUNCTION__, card_list); + DEBUG_HFC_IRQ("%s(): card ptr: 0x%p, tmp_card ptr: 0x%p\n", __FUNCTION__, card, tmp_card); + + if (!tmp_card){ + return NULL; + } + + DEBUG_HFC_IRQ("%s(): %s\n", __FUNCTION__, tmp_card->devname); + + return &tmp_card->fe; +} + +/****************************************************************************** +* xhfc_interrupt() +* +* Description : handle interrupt on a PHYSICAL module +* +* Arguments : fe, mod_no +* +* Returns : 1 - interrupt recognized and handled +* 0 - interrupt not recognized (not generated by this module) +* +******************************************************************************/ +static int32_t xhfc_interrupt(sdla_fe_t *fe, u8 mod_no) +{ + sdla_fe_t *new_fe; + int32_t fifo_irq = 0, i; + sdla_bri_param_t *bri = &fe->bri_param; + wp_bri_module_t *bri_module; + u8 port_no; + reg_a_su_rd_sta new_su_state; + reg_r_su_irq r_su_irq; + reg_r_misc_irq r_misc_irq; + + BRI_FUNC(); + + if(validate_physical_mod_no(mod_no, __FUNCTION__)){ + return 0; + } + + bri_module = &bri->mod[mod_no]; + + /*DEBUG_HFC_SU_IRQ("%s(%lu): %s: mod_no: %d\n", __FUNCTION__, jiffies, fe->name, mod_no);*/ + + /* clear SU state interrupt */ + r_su_irq.reg = READ_REG(R_SU_IRQ); + + /* clear 'misc' interrupts such as timer interrupt */ + r_misc_irq.reg = READ_REG(R_MISC_IRQ); + + /***************************************************************************/ + fifo_irq = 0; + for (port_no = 0; port_no < bri_module->num_ports; port_no++) { + + DBG_MODULE_TESTER("get fifo IRQ state for port_no %d\n", port_no); + + /* get fifo IRQ states in bundle */ + fifo_irq |= (READ_REG(R_FIFO_BL0_IRQ + port_no) << (port_no * 8)); + + DBG_MODULE_TESTER("fifo_irq: 0x%X\n", fifo_irq); + } + + /***************************************************************************/ + for (i = 0; i < bri_module->num_ports; i++) { + + /****************************************************************/ + new_fe = get_FE_ptr_for_port(fe, mod_no, i); + DEBUG_HFC_IRQ("%s(): fe ptr: 0x%p\n", __FUNCTION__, fe); + if(new_fe == NULL){ + /* 'port_no' is not used by any 'wanpipe' */ + continue; + } + fe = new_fe; + + mod_no = fe_line_no_to_physical_mod_no(fe); + port_no = fe_line_no_to_port_no(fe); + /****************************************************************/ + + if(r_misc_irq.reg & M_TI_IRQ){ + sdla_bri_param_t *su_bri = &fe->bri_param; + wp_bri_module_t *su_bri_module = &su_bri->mod[mod_no]; + bri_xhfc_port_t *port_ptr = &su_bri_module->port[port_no]; + + //DEBUG_HFC_SU_IRQ("Timer IRQ\n"); + if(fe->bri_param.is_clock_master == WANOPT_YES && + port_ptr->clock_routing_state == WAITING_TO_STABILIZE){ + + port_ptr->clock_routing_counter++; + DEBUG_HFC_CLOCK("clock_routing_counter: %d\n", port_ptr->clock_routing_counter); + + if(port_ptr->clock_routing_counter == LINE_STABILITY_THRESHOLD){ + port_ptr->clock_routing_state = LINE_STABLE; + } + + if(port_ptr->clock_routing_state == LINE_STABLE){ + config_clock_routing(fe, mod_no, WANOPT_YES); + clock_control(fe, 1); + } + } + } + + /****************************************************************/ + + /* select the port on the chip */ + WRITE_REG(R_SU_SEL, port_no); + new_su_state.reg = READ_REG(A_SU_RD_STA); + + /*DEBUG_HFC_SU_IRQ("%s(): SU State: sta:%X, v_su_fr_sync: %i, v_su_info0: %i, v_g2_g3: %i\n", __FUNCTION__, + new_su_state.bit.v_su_sta, new_su_state.bit.v_su_fr_sync, + new_su_state.bit.v_su_info0, new_su_state.bit.v_g2_g3);*/ + + if((r_su_irq.reg & (1 << port_no))){ + sdla_bri_param_t *su_bri = &fe->bri_param; + wp_bri_module_t *su_bri_module = &su_bri->mod[mod_no]; + bri_xhfc_port_t *port_ptr = &su_bri_module->port[port_no]; + + DEBUG_HFC_S0_STATES("%s():SU IRQ:%lu: %s: SU State: 0x%X, v_su_fr_sync: %d, v_su_info0: %d, v_g2_g3: %d\n", + __FUNCTION__, jiffies, + (port_ptr->mode & PORT_MODE_NT) ? "NT: G" : "TE: F", + new_su_state.bit.v_su_sta, new_su_state.bit.v_su_fr_sync, + new_su_state.bit.v_su_info0, new_su_state.bit.v_g2_g3); + + if (new_su_state.bit.v_su_sta != port_ptr->l1_state) { + port_ptr->l1_state = new_su_state.bit.v_su_sta; + /* Handle S/U state change. */ + su_new_state(fe, mod_no, port_no); + } + + }/* if(r_misc_irq.reg & M_TI_IRQ || (r_su_irq.reg & (1 << port_no))) */ + + if(bri_module->port[port_no].bytes2transmit){ + u8 free_space; + + TX_FAST_DBG("%s(): port_no: %d, bytes2transmit: %d, dtx_indx: %d\n", + __FUNCTION__, port_no, bri_module->port[port_no].bytes2transmit, + bri_module->port[port_no].dtx_indx); + + xhfc_write_fifo_dchan(fe, mod_no, bri_module, &bri_module->port[port_no], &free_space); + } + + /* receive D-Channel Data */ + if (fifo_irq & (1 << (port_no*8+5)) ) { + netskb_t *skb = NULL; + DBG_MODULE_TESTER("There is receive D-Channel Data for port_no %d\n", port_no); + + skb = wp_bri_dchan_rx(fe, mod_no, port_no); + if(skb != NULL){ + sdla_t *card = (sdla_t*)fe->card; + private_area_t *chan; + + DEBUG_HFC_IRQ("%s(): Module: %d, port_no: %d.\n", __FUNCTION__, mod_no, port_no); + chan=(private_area_t*)card->u.aft.dev_to_ch_map[BRI_DCHAN_LOGIC_CHAN]; + + DEBUG_HFC_IRQ("%s(): chan ptr: 0x%p\n", __FUNCTION__, chan); + if (!chan){ + DEBUG_EVENT("%s: Error: No Dev for Rx logical ch=%d\n", + card->devname, BRI_DCHAN_LOGIC_CHAN); + break; + } + + wan_skb_queue_tail(&chan->wp_rx_bri_dchan_complete_list, skb); + WAN_TASKLET_SCHEDULE((&chan->common.bh_task)); + } + + }/* if ( fifo_irq & (1 << (port_no*8+5)) ) */ + }/* for (port_no = 0; port_no < bri_module->num_ports; port_no++) */ + /***************************************************************************/ + + return 1; +} + +static int32_t wp_bri_check_intr(sdla_fe_t *fe) +{ + /* must return 1! */ + return 1; +} + +static int32_t wp_bri_intr(sdla_fe_t *fe) +{ + u8 mod_no, port_no; + int32_t interrupt_serviced = 0; + + BRI_FUNC(); + + mod_no = fe_line_no_to_physical_mod_no(fe); + port_no = fe_line_no_to_port_no(fe); + + switch(fe->bri_param.mod[mod_no].type) + { + case MOD_TYPE_TE: + case MOD_TYPE_NT: + if(xhfc_interrupt(fe, mod_no)){ + /* at least one module generated an interrupt */ + interrupt_serviced = 1; + } + break; + default: + /* for missing (not installed) modules - do nothing */ + break; + } + + return interrupt_serviced; +} + + + diff --git a/patches/kdrivers/src/net/sdla_bri_tdmv.c b/patches/kdrivers/src/net/sdla_bri_tdmv.c new file mode 100755 index 0000000..2f3ac92 --- /dev/null +++ b/patches/kdrivers/src/net/sdla_bri_tdmv.c @@ -0,0 +1,1302 @@ +/*************************************************************************** + * sdla_bri_tdmv.c WANPIPE(tm) Multiprotocol WAN Link Driver. + * AFT BRI support. + * + * Author: David Rokhvarg + * + * Copyright: (c) 1984-2007 Sangoma Technologies 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. + * + * ============================================================================ + * June 5, 2007 David Rokhvarg Initial version. + ****************************************************************************** + */ + +/******************************************************************************* +** INCLUDE FILES +*******************************************************************************/ +#if defined(__FreeBSD__) || defined(__OpenBSD__) +# include +# include +# include +# include +# include +# include +# include +# include +#else +# include +# include +# include +# include +# include + +# include +# include +# include +#endif + +/******************************************************************************* +** DEFINES AND MACROS +*******************************************************************************/ + +#define DEBUG_TDMV_BRI if(0)DEBUG_EVENT + +#define REG_SHADOW +#define REG_WRITE_SHADOW +#undef PULSE_DIALING + +/* flags bits */ +#define WP_TDMV_REGISTER 1 /*0x01*/ +#define WP_TDMV_RUNNING 2 /*0x02*/ +#define WP_TDMV_UP 3 /*0x04*/ + +#define IS_TDMV_RUNNING(wr) wan_test_bit(WP_TDMV_RUNNING, &(wr)->flags) +#define IS_TDMV_UP(wr) wan_test_bit(WP_TDMV_UP, &(wr)->flags) +#define IS_TDMV_UP_RUNNING(wr) (IS_TDMV_UP(wr) && IS_TDMV_RUNNING(wr)) + +/******************************************************************************* +** STRUCTURES AND TYPEDEFS +*******************************************************************************/ +typedef struct { + int ready; + int offhook; + int lastpol; + int polarity; + int polaritydebounce; + int battery; + int battdebounce; + int ringdebounce; + int nobatttimer; + int wasringing; + + int echotune; /* echo tune */ + struct wan_rm_echo_coefs echoregs; /* echo tune */ +} tdmv_fxo_t; + +typedef struct { + int ready; + int lasttxhook; + int lasttxhook_update; + int lastrxhook; + int oldrxhook; + int debouncehook; + int debounce; + int palarms; + int ohttimer; +} tdmv_fxs_t; + +typedef struct wp_tdmv_bri_ { + void *card; + char *devname; + int num; + int flags; + wan_spinlock_t lock; + wan_spinlock_t tx_rx_lock; + union { + tdmv_fxo_t fxo; + tdmv_fxs_t fxs; + } mod[MAX_BRI_LINES]; + + int spanno; + struct zt_span span; + struct zt_chan chans[MAX_BRI_LINES]; + unsigned long reg_module_map; /* Registered modules */ + + u32 timeslot_map; + + /* Global configuration */ + + u32 intcount; + int pollcount; + unsigned char ec_chunk1[31][ZT_CHUNKSIZE]; + unsigned char ec_chunk2[31][ZT_CHUNKSIZE]; + int usecount; + u16 max_timeslots; /* up to MAX_BRI_LINES */ + int max_rxtx_len; + int channelized; + unsigned long echo_off_map; + int rxsig_state[MAX_BRI_LINES]; + int txsig_state[MAX_BRI_LINES]; /* not used */ + + u_int8_t dtmfsupport; + unsigned int dtmfactive; + unsigned int dtmfmask; + unsigned int dtmfmutemask; + + /* BRI D-chan */ + unsigned int dchan; + netdevice_t *dchan_dev; + +} wp_tdmv_bri_t; + +/******************************************************************************* +** GLOBAL VARIABLES +*******************************************************************************/ +static int wp_remora_no = 0; +extern WAN_LIST_HEAD(, wan_tdmv_) wan_tdmv_head; +//static int battdebounce = DEFAULT_BATT_DEBOUNCE; +//static int battthresh = DEFAULT_BATT_THRESH; + +/******************************************************************************* +** FUNCTION PROTOTYPES +*******************************************************************************/ +static int wp_tdmv_bri_check_mtu(void* pcard, unsigned long timeslot_map, int *mtu); +static int wp_tdmv_bri_create(void* pcard, wan_tdmv_conf_t *tdmv_conf); +static int wp_tdmv_bri_remove(void* pcard); + +static int wp_tdmv_bri_reg( + void *pcard, + wan_tdmv_if_conf_t *tdmv_conf, + unsigned int active_ch, + u8 ec_enable, + netdevice_t *dev); +static int wp_tdmv_bri_unreg(void* pcard, unsigned long ts_map); +static int wp_tdmv_bri_software_init(wan_tdmv_t *wan_tdmv); +static int wp_tdmv_bri_state(void* pcard, int state); +static int wp_tdmv_bri_running(void* pcard); +static int wp_tdmv_bri_is_rbsbits(wan_tdmv_t *wan_tdmv); +static int wp_tdmv_bri_rx_tx_span(void *pcard); +static int wp_tdmv_bri_rx_chan(wan_tdmv_t*, int,unsigned char*,unsigned char*); +static int wp_tdmv_bri_ec_span(void *pcard); + +static void wp_tdmv_bri_dtmf (void* card_id, wan_event_t *event); + +extern int wp_init_proslic(sdla_fe_t *fe, int mod_no, int fast, int sane); +extern int wp_init_voicedaa(sdla_fe_t *fe, int mod_no, int fast, int sane); + +static int wp_tdmv_tx_dchan(struct zt_chan *chan, int len); +static int wp_tdmv_rx_dchan(wan_tdmv_t*, int, unsigned char*, unsigned int); + +static int wp_tdmv_span_buf_rotate(void *pcard, u32, unsigned long); + +static void wp_tdmv_report_alarms(void* pcard, unsigned long te_alarm); + +/******************************************************************************* +** FUNCTION DEFINITIONS +*******************************************************************************/ + +static int +#if defined(__FreeBSD__) || defined(__OpenBSD__) +wp_bri_zap_ioctl(struct zt_chan *chan, unsigned int cmd, caddr_t data) +#else +wp_bri_zap_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) +#endif +{ + wp_tdmv_bri_t *wp = NULL; + int err = -ENOTTY; + + DEBUG_TDMV_BRI("%s(): line: %d\n", __FUNCTION__, __LINE__); + + switch(cmd) + { +#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN) && defined(ZT_DCHAN_TX) + case ZT_DCHAN_TX: + + DEBUG_TDMV_BRI("chan: 0x%p\n", chan); + + if(chan){ + DEBUG_TDMV_BRI("chan->pvt: 0x%p\n", chan->pvt); + } + + WAN_ASSERT(chan == NULL || chan->pvt == NULL); + wp = chan->pvt; + + if (wp->dchan_dev && wp->dchan_dev->hard_start_xmit){ + wp_tdmv_tx_dchan(chan, (int)data); + err=0; + }else{ + DEBUG_TDMV_BRI("%s(): line: %d\n", __FUNCTION__, __LINE__); + + DEBUG_TDMV_BRI("wp->dchan_dev: 0x%p\n", wp->dchan_dev); + if(wp->dchan_dev){ + DEBUG_TDMV_BRI("wp->dchan_dev->hard_start_xmit: 0x%p\n", + wp->dchan_dev->hard_start_xmit); + } + err=-EOPNOTSUPP; + } + break; + +#endif + + default: + DEBUG_EVENT("%s(): uknown cmd!\n", __FUNCTION__); + err = -ENOTTY; + break; + } + return err; +} + + +static int wp_bri_zap_open(struct zt_chan *chan) +{ + wp_tdmv_bri_t *wr = NULL; + + BRI_FUNC(); + + WAN_ASSERT2(chan == NULL, -ENODEV); + WAN_ASSERT2(chan->pvt == NULL, -ENODEV); + wr = chan->pvt; + wr->usecount++; + wan_set_bit(WP_TDMV_RUNNING, &wr->flags); + DEBUG_EVENT("%s: Open (usecount=%d, channo=%d, chanpos=%d)...\n", + wr->devname, + wr->usecount, + chan->channo, + chan->chanpos); + return 0; +} + +static int wp_bri_zap_close(struct zt_chan *chan) +{ + sdla_t *card = NULL; + wp_tdmv_bri_t* wr = NULL; + sdla_fe_t *fe = NULL; + + BRI_FUNC(); + + WAN_ASSERT2(chan == NULL, -ENODEV); + WAN_ASSERT2(chan->pvt == NULL, -ENODEV); + wr = chan->pvt; + card = wr->card; + fe = &card->fe; + wr->usecount--; + wan_clear_bit(WP_TDMV_RUNNING, &wr->flags); + + return 0; +} + +static int wp_bri_zap_watchdog(struct zt_span *span, int event) +{ + BRI_FUNC(); + +#if 0 + printk("TDM: Restarting DMA\n"); + wctdm_restart_dma(span->pvt); +#endif + return 0; +} + +/****************************************************************************** +** wp_remora_zap_hwec() - +** +** OK +*/ +static int wp_bri_zap_hwec(struct zt_chan *chan, int enable) +{ + wp_tdmv_bri_t *wr = NULL; + sdla_t *card = NULL; + int fe_chan = chan->chanpos; + int err = -ENODEV; + sdla_fe_t *fe = NULL; + + BRI_FUNC(); + + WAN_ASSERT2(chan == NULL, -ENODEV); + WAN_ASSERT2(chan->pvt == NULL, -ENODEV); + wr = chan->pvt; + WAN_ASSERT2(wr->card == NULL, -ENODEV); + card = wr->card; + fe = &card->fe; + + if (card->wandev.ec_enable){ + DEBUG_EVENT("[TDMV_BRI]: %s: %s(): channel %d\n", + wr->devname, __FUNCTION__, fe_chan); + + if(fe_chan == 1 || fe_chan == 2){ + err = card->wandev.ec_enable(card, enable, fe_chan); + }else{ + DEBUG_EVENT("[TDMV_BRI]: %s: %s(): Warning: invalid fe_channel %d!!\n", + wr->devname, __FUNCTION__, fe_chan); + err = 0; + } + }else{ + DEBUG_EVENT("[TDMV_BRI]: %s: %s(): card->wandev.ec_enable == NULL!!!!!!\n", + wr->devname, __FUNCTION__); + } + return err; +} + + +/****************************************************************************** +** wp_tdmv_rbsbits_poll() - +** +** DONE +*/ +static int wp_tdmv_rbsbits_poll(wan_tdmv_t *wan_tdmv, void *card1) +{ + wp_tdmv_bri_t *wp = NULL; + + BRI_FUNC(); + + WAN_ASSERT(wan_tdmv->sc == NULL); + wp = wan_tdmv->sc; + + return 0; +} + + +/****************************************************************************** +** wp_tdmv_bri_init() - +** +** OK +*/ +int wp_tdmv_bri_init(wan_tdmv_iface_t *iface) +{ + BRI_FUNC(); + + WAN_ASSERT(iface == NULL); + + memset(iface, 0, sizeof(wan_tdmv_iface_t)); + iface->check_mtu = wp_tdmv_bri_check_mtu; + iface->create = wp_tdmv_bri_create; + iface->remove = wp_tdmv_bri_remove; + iface->reg = wp_tdmv_bri_reg; + iface->unreg = wp_tdmv_bri_unreg; + iface->software_init = wp_tdmv_bri_software_init; + iface->state = wp_tdmv_bri_state; + iface->running = wp_tdmv_bri_running; + iface->is_rbsbits = wp_tdmv_bri_is_rbsbits; + iface->rx_tx_span = wp_tdmv_bri_rx_tx_span; + iface->rx_chan = wp_tdmv_bri_rx_chan; + iface->ec_span = wp_tdmv_bri_ec_span; + + iface->rbsbits_poll = wp_tdmv_rbsbits_poll; //????? + + iface->rx_dchan = wp_tdmv_rx_dchan; + + iface->buf_rotate = wp_tdmv_span_buf_rotate; + return 0; +} + + +static int wp_tdmv_bri_software_init(wan_tdmv_t *wan_tdmv) +{ + sdla_t *card = NULL; + sdla_fe_t *fe = NULL; + wp_tdmv_bri_t *wr = wan_tdmv->sc; + int x = 0, num = 0; + + BRI_FUNC(); + + WAN_ASSERT(wr == NULL); + WAN_ASSERT(wr->card == NULL); + card = wr->card; + fe = &card->fe; + + if (wan_test_bit(WP_TDMV_REGISTER, &wr->flags)){ + + WP_DELAY(1000); + DEBUG_EVENT( + "%s: Wanpipe device is already registered to Zaptel span # %d!\n", + wr->devname, wr->span.spanno); + return 0; + } + + /* Zapata stuff */ + sprintf(wr->span.name, "WPBRI/%d", wr->num); + sprintf(wr->span.desc, "wrtdm Board %d", wr->num + 1); + switch(fe->fe_cfg.tdmv_law){ + case WAN_TDMV_ALAW: + DEBUG_EVENT( + "%s: ALAW override parameter detected. Device will be operating in ALAW\n", + wr->devname); + wr->span.deflaw = ZT_LAW_ALAW; + break; + case WAN_TDMV_MULAW: + wr->span.deflaw = ZT_LAW_MULAW; + break; + } + +wr->span.deflaw = ZT_LAW_ALAW;//FIXME: hardcoded + + wr->dtmfsupport = card->u.aft.tdmv_hw_dtmf; + + for (x = 0; x < MAX_BRI_TIMESLOTS; x++) { + + sprintf(wr->chans[x].name, "WPBRI/%d/%d", wr->num, x); + + wr->chans[x].sigcap = ZT_SIG_EM | ZT_SIG_CLEAR | ZT_SIG_FXSLS | + ZT_SIG_FXSGS | ZT_SIG_FXSKS | ZT_SIG_FXOLS | + ZT_SIG_FXOGS | ZT_SIG_FXOKS | ZT_SIG_CAS | + ZT_SIG_SF; + switch(x) + { + case 0: + case 1: + DEBUG_EVENT("%s: Port %d Configure B-chan %d for voice (%s, type %s)!\n", + wr->devname, + WAN_FE_LINENO(fe) + 1, + x + 1, + wr->chans[x].name, + WP_BRI_DECODE_MOD_TYPE(fe->bri_param.mod[WAN_FE_LINENO(fe)].type)); + break; + + case 2: + DEBUG_EVENT("%s: Port %d Configure BRI D-chan (%s, type %s)!\n", + wr->devname, + WAN_FE_LINENO(fe) + 1, + wr->chans[x].name, + WP_BRI_DECODE_MOD_TYPE(fe->bri_param.mod[WAN_FE_LINENO(fe)].type));/* fe->bri_param.mod[2], there is no [2] */ + break; + }/* switch() */ + + wr->chans[x].chanpos = x+1; + wr->chans[x].pvt = wr; + num++; + + //wr->rxsig_state[x] = ZT_RXSIG_INITIAL; + }/* for() */ + + wr->span.pvt = wr; + wr->span.chans = wr->chans; + wr->span.channels = MAX_BRI_TIMESLOTS;/* this is the number of b-chans (2) and the d-chan on one BRI line. */; + wr->span.linecompat = ZT_CONFIG_AMI | ZT_CONFIG_CCS; /* <--- this is really BS */ + + wr->span.open = wp_bri_zap_open; + wr->span.close = wp_bri_zap_close; + + //wr->span.flags = ZT_FLAG_RBS; + + wr->span.ioctl = wp_bri_zap_ioctl; + wr->span.watchdog = wp_bri_zap_watchdog; + /* Set this pointer only if card has hw echo canceller module */ + if (card->wandev.ec_dev){ + wr->span.echocan = wp_bri_zap_hwec; + } +#if defined(__LINUX__) + init_waitqueue_head(&wr->span.maintq); +#endif + + WP_DELAY(1000); + + if (zt_register(&wr->span, 0)) { + + BRI_FUNC(); + DEBUG_EVENT("%s: Unable to register span with zaptel\n", + wr->devname); + + WP_DELAY(1000); + return -EINVAL; + } + + if (wr->span.spanno != wr->spanno +1){ + DEBUG_EVENT("\n"); + DEBUG_EVENT("WARNING: Span number %d is already used by another device!\n", + wr->spanno + 1); + DEBUG_EVENT(" Possible cause: Another TDM driver already loaded!\n"); + DEBUG_EVENT(" Solution: Unload wanpipe and check currently\n"); + DEBUG_EVENT(" used spans in /proc/zaptel directory.\n"); + DEBUG_EVENT(" Reconfiguring device %s to new span number # %d\n", + wr->devname,wr->span.spanno); + DEBUG_EVENT("\n"); + wr->spanno = wr->span.spanno-1; + }else{ + DEBUG_EVENT("%s: Wanpipe device is registered to Zaptel span # %d!\n", + wr->devname, wr->span.spanno); + } + wp_tdmv_bri_check_mtu(card, wr->reg_module_map, &wr->max_rxtx_len); + wan_set_bit(WP_TDMV_REGISTER, &wr->flags); + + /* Initialize Callback event function pointers */ + if (wr->dtmfsupport == WANOPT_YES){ + DEBUG_EVENT("ADBG> Updating event callback dtmf\n"); + card->wandev.event_callback.dtmf = wp_tdmv_bri_dtmf; + } + + WP_DELAY(1000); + + wr->span.alarms = ZT_ALARM_NONE;//FIXME: report real line state, also report alarms on line connect/disconnect. + zt_alarm_notify(&wr->span); + + return 0; +} + +/****************************************************************************** +** wp_tdmv_release() - +** +** OK +*/ +static void wp_tdmv_release(wp_tdmv_bri_t *wr) +{ + BRI_FUNC(); + + WAN_ASSERT1(wr == NULL); + if (wan_test_bit(WP_TDMV_REGISTER, &wr->flags)){ + DEBUG_EVENT("%s: Unregister WAN FXS/FXO device from Zaptel!\n", + wr->devname); + wan_clear_bit(WP_TDMV_REGISTER, &wr->flags); + zt_unregister(&wr->span); + wan_clear_bit(WP_TDMV_REGISTER, &wr->flags); + } + wan_free(wr); + return; +} + + +static wp_tdmv_bri_t *wan_remora_search(sdla_t * card) +{ + BRI_FUNC(); + + return NULL; +} + +/****************************************************************************** +** wp_tdmv_bri_check_mtu() - +** +** OK +*/ +static int wp_tdmv_bri_check_mtu(void* pcard, unsigned long timeslot_map, int *mtu) +{ + BRI_FUNC(); + + *mtu = ZT_CHUNKSIZE; + return 0; + +} + +/****************************************************************************** +** wp_tdmv_bri_create() - +*tdmv_* +** OK +*/ +static int wp_tdmv_bri_create(void* pcard, wan_tdmv_conf_t *tdmv_conf) +{ + sdla_t *card = (sdla_t*)pcard; + wp_tdmv_bri_t *wr = NULL; + wan_tdmv_t *tmp = NULL; + + BRI_FUNC(); + + WAN_ASSERT(card == NULL); + WAN_ASSERT(tdmv_conf->span_no == 0); + + wr = wan_remora_search(card); + if (wr){ + DEBUG_EVENT("%s: AFT remora card already configured!\n", + card->devname); + return -EINVAL; + } + + memset(&card->wan_tdmv, 0x0, sizeof(wan_tdmv_t)); + /* We are forcing to register wanpipe devices at the same sequence + * that it defines in /etc/zaptel.conf */ + WAN_LIST_FOREACH(tmp, &wan_tdmv_head, next){ + if (tmp->spanno == tdmv_conf->span_no){ + DEBUG_EVENT("%s: Registering device with an incorrect span number!\n", + card->devname); + DEBUG_EVENT("%s: Another wanpipe device already configured to span #%d!\n", + card->devname, tdmv_conf->span_no); + return -EINVAL; + } + if (!WAN_LIST_NEXT(tmp, next)){ + break; + } + } + + memset(&card->wan_tdmv, 0x0, sizeof(wan_tdmv_t)); + card->wan_tdmv.max_timeslots = card->fe.bri_param.max_fe_channels; + card->wan_tdmv.spanno = tdmv_conf->span_no; + card->wandev.te_report_alarms = wp_tdmv_report_alarms; + + wr = wan_malloc(sizeof(wp_tdmv_bri_t)); + if (wr == NULL){ + return -ENOMEM; + } + memset(wr, 0x0, sizeof(wp_tdmv_bri_t)); + card->wan_tdmv.sc = wr; + wr->spanno = tdmv_conf->span_no-1; + wr->num = wp_remora_no++; + wr->card = card; + wr->devname = card->devname; + wr->max_timeslots = card->fe.bri_param.max_fe_channels; + wr->max_rxtx_len = 0; + wan_spin_lock_init(&wr->lock, "wan_britdmv_lock"); + wan_spin_lock_init(&wr->tx_rx_lock, "wan_britdmv_txrx_lock"); + + /* BRI signalling is selected with hw HDLC (dchan is not 0) */ + wr->dchan = 3;/* MUST be 3! */ + + if (tmp){ + WAN_LIST_INSERT_AFTER(tmp, &card->wan_tdmv, next); + }else{ + WAN_LIST_INSERT_HEAD(&wan_tdmv_head, &card->wan_tdmv, next); + } + return 0; +} + + +/****************************************************************************** +** wp_tdmv_bri_reg() - calculate 'channo' based on 'activ_ch' for the +** interface. +** +** +** Returns: 0-31 - Return TDM Voice channel number. +** -EINVAL - otherwise +** OK +*/ +static int wp_tdmv_bri_reg( + void *pcard, + wan_tdmv_if_conf_t *tdmv_conf, + unsigned int active_ch, + u8 ec_enable, + netdevice_t *dev) +{ + sdla_t *card = (sdla_t*)pcard; + sdla_fe_t *fe = &card->fe; + wan_tdmv_t *wan_tdmv = &card->wan_tdmv; + wp_tdmv_bri_t *wr = NULL; + int i, channo = 0; + + BRI_FUNC(); + + WAN_ASSERT(wan_tdmv->sc == NULL); + wr = wan_tdmv->sc; + + + DEBUG_BRI("%s(): FE line no: %d, active_ch: 0x%X\n", + __FUNCTION__, WAN_FE_LINENO(fe), active_ch); + + if(WAN_FE_LINENO(fe) >= MAX_BRI_LINES){ + DEBUG_EVENT( + "%s: %s(): Error: invalid FE line number (%d)!\n", + card->devname, __FUNCTION__, WAN_FE_LINENO(fe)); + return -EINVAL; + } + + if (wan_test_bit(WP_TDMV_REGISTER, &wr->flags)){ + DEBUG_EVENT( + "%s: Error: Master device has already been configured!\n", + card->devname); + return -EINVAL; + } + + DEBUG_BRI("%s(): wr->max_timeslots: %d\n", __FUNCTION__, wr->max_timeslots); + + /* The Zaptel Channel Number for BRI must be adjusted based on + the module number to start from 0 */ + active_ch = active_ch>>(WAN_FE_LINENO(fe)*2); + + for(i = 0; i < wr->max_timeslots; i++){ + if (wan_test_bit(i, &active_ch)){ + if (tdmv_conf->tdmv_echo_off){ + wan_set_bit(i, &wr->echo_off_map); + } + channo = i; + break; + } + } + + DEBUG_BRI("1 %s(): channo: %d, wr->timeslot_map: 0x%X\n", + __FUNCTION__, channo, wr->timeslot_map); + + if(channo > 2){ + DEBUG_EVENT( + "%s: Error: TDMV iface %s failed to configure for channo %d! Must be between 0 and 2 (including).\n", + card->devname, + wan_netif_name(dev), + channo); + return -EINVAL; + } + + /* for BRI only bits 0 and 1 can be set! */ + wan_set_bit(channo, &wr->timeslot_map); + + if (i == wr->max_timeslots){ + DEBUG_EVENT("%s: Error: TDMV iface %s failed to configure for 0x%08X timeslots!\n", + card->devname, + wan_netif_name(dev), + active_ch); + return -EINVAL; + } + + DEBUG_EVENT("%s: Registering TDMV to %s module %d!\n", + card->devname, + WP_BRI_DECODE_MOD_TYPE(fe->bri_param.mod[WAN_FE_LINENO(fe)].type), + WAN_FE_LINENO(fe) + 1); + + wan_set_bit(channo, &wr->reg_module_map); + + if (tdmv_conf->tdmv_echo_off){ + DEBUG_EVENT("%s: TDMV Echo Ctrl:Off\n", + wr->devname); + } + memset(wr->chans[channo].sreadchunk, WAN_TDMV_IDLE_FLAG, ZT_CHUNKSIZE); + memset(wr->chans[channo].swritechunk, WAN_TDMV_IDLE_FLAG, ZT_CHUNKSIZE); + wr->chans[channo].readchunk = wr->chans[channo].sreadchunk; + wr->chans[channo].writechunk = wr->chans[channo].swritechunk; + wr->channelized = WAN_TRUE; + + wp_tdmv_bri_check_mtu(card, active_ch, &wr->max_rxtx_len); + + DEBUG_BRI("%s(): card->u.aft.tdmv_dchan: %d, channo: %d, wr->dchan: %d\n", + __FUNCTION__, card->u.aft.tdmv_dchan, channo, wr->dchan); + + if(wr->dchan != 3){ + DEBUG_EVENT("%s:%s: Error: 'dchan' (%d) not equal 3!\n", + card->devname, wan_netif_name(dev), wr->dchan); + return -EINVAL; + } + + if((channo + 1) == wr->dchan){ /* 3 */ + DEBUG_BRI("%s(): registering BRI D-chan 'dev' pointer\n", __FUNCTION__); + wr->dchan_dev = dev; + card->u.aft.tdmv_dchan = BRI_DCHAN_LOGIC_CHAN; + } + + return channo; +} + +/****************************************************************************** +** wp_tdmv_unreg() - +** +** OK +*/ +static int wp_tdmv_bri_unreg(void* pcard, unsigned long ts_map) +{ + sdla_t *card = (sdla_t*)pcard; + sdla_fe_t *fe = &card->fe; + wan_tdmv_t *wan_tdmv = &card->wan_tdmv; + wp_tdmv_bri_t *wr = NULL; + int channo = 0; + + BRI_FUNC(); + + WAN_ASSERT(wan_tdmv->sc == NULL); + wr = wan_tdmv->sc; + + for(channo = 0; channo < wr->max_timeslots; channo++){ + if (wan_test_bit(channo, &wr->reg_module_map)){ + DEBUG_EVENT( + "%s: Unregistering TDMV %s iface from module %d!\n", + card->devname, + WP_BRI_DECODE_MOD_TYPE(fe->bri_param.mod[0].type), + channo+1); + wan_clear_bit(channo, &wr->reg_module_map); + wan_clear_bit(channo, &wr->echo_off_map); + memset(wr->chans[channo].sreadchunk, + WAN_TDMV_IDLE_FLAG, + ZT_CHUNKSIZE); + memset(wr->chans[channo].swritechunk, + WAN_TDMV_IDLE_FLAG, + ZT_CHUNKSIZE); + wr->chans[channo].readchunk = + wr->chans[channo].sreadchunk; + wr->chans[channo].writechunk = + wr->chans[channo].swritechunk; + } + } + return 0; +} + + +/****************************************************************************** +** wp_tdmv_remove() - +** +** OK +*/ +static int wp_tdmv_bri_remove(void* pcard) +{ + sdla_t *card = (sdla_t*)pcard; + wan_tdmv_t *wan_tdmv = &card->wan_tdmv; + wp_tdmv_bri_t *wr = NULL; + + BRI_FUNC(); + + if (!card->wan_tdmv.sc){ + return 0; + } + + wr = wan_tdmv->sc; + /* Release span, possibly delayed */ + if (wr && wr->reg_module_map){ + DEBUG_EVENT( + "%s: Some interfaces are not unregistered (%08lX)!\n", + card->devname, + wr->reg_module_map); + return -EINVAL; + } + if (wr && wr->usecount){ + DEBUG_EVENT("%s: ERROR: Wanpipe is still used by Asterisk!\n", + card->devname); + return -EINVAL; + } + + if (wr){ + wan_clear_bit(WP_TDMV_RUNNING, &wr->flags); + wan_clear_bit(WP_TDMV_UP, &wr->flags); + wan_tdmv->sc = NULL; + card->wandev.te_report_alarms = NULL; + WAN_LIST_REMOVE(wan_tdmv, next); + wp_tdmv_release(wr); + }else{ + wan_tdmv->sc = NULL; + } + return 0; +} + +static int wp_tdmv_span_buf_rotate(void *pcard, u32 buf_sz, unsigned long mask) +{ + sdla_t *card = (sdla_t*)pcard; + wan_tdmv_t *wan_tdmv = &card->wan_tdmv; + wp_tdmv_bri_t *wp = NULL; + int x; + unsigned int rx_offset, tx_offset; + void *ptr; + + WAN_ASSERT(wan_tdmv->sc == NULL); + wp = wan_tdmv->sc; + + rx_offset = buf_sz * card->u.aft.tdm_rx_dma_toggle; + tx_offset = buf_sz * card->u.aft.tdm_tx_dma_toggle; + +#define BRI_NUM_OF_BCHANNELS 2 + for (x = 0; x < BRI_NUM_OF_BCHANNELS; x ++) { + /*for (x = 0; x < 32; x ++) {*/ + if (wan_test_bit(x,&wp->timeslot_map)) { + + wan_spin_lock(&wp->chans[x].lock); + + ptr=(void*)((((unsigned long)wp->chans[x].readchunk) & ~(mask)) + rx_offset); + wp->chans[x].readchunk = ptr; + ptr=(void*)((((unsigned long)wp->chans[x].writechunk) & ~(mask)) + tx_offset); + wp->chans[x].writechunk = ptr; + + wan_spin_unlock(&wp->chans[x].lock); + +#if defined(__LINUX__) + prefetch(wp->chans[x].readchunk); + prefetch(wp->chans[x].writechunk); +#endif + + if (card->wandev.rtp_len && card->wandev.rtp_tap) { + card->wandev.rtp_tap(card,x, + wp->chans[x].readchunk, + wp->chans[x].writechunk, + ZT_CHUNKSIZE); + } + } + } + + return 0; +} + +static int wp_tdmv_bri_state(void* pcard, int state) +{ + sdla_t *card = (sdla_t*)pcard; + wan_tdmv_t *wan_tdmv = &card->wan_tdmv; + wp_tdmv_bri_t *wr = NULL; + + BRI_FUNC(); + + WAN_ASSERT(wan_tdmv->sc == NULL); + wr = (wp_tdmv_bri_t*)wan_tdmv->sc; + + switch(state){ + case WAN_CONNECTED: + DEBUG_TDMV("%s: TDMV Remora state is CONNECTED!\n", + wr->devname); + wan_set_bit(WP_TDMV_UP, &wr->flags); + break; + + case WAN_DISCONNECTED: + DEBUG_TDMV("%s: TDMV Remora state is DISCONNECTED!\n", + wr->devname); + wan_clear_bit(WP_TDMV_UP, &wr->flags); + break; + } + return 0; +} + +/****************************************************************************** +** wp_tdmv_running() - +** +** OK +*/ +static int wp_tdmv_bri_running(void* pcard) +{ + sdla_t *card = (sdla_t*)pcard; + wan_tdmv_t *wan_tdmv = &card->wan_tdmv; + wp_tdmv_bri_t *wr = NULL; + + BRI_FUNC(); + + wr = wan_tdmv->sc; + if (wr && wr->usecount){ + DEBUG_EVENT("%s: WARNING: Wanpipe is still used by Asterisk!\n", + card->devname); + return -EINVAL; + } + return 0; +} + +/****************************************************************************** +** wp_tdmv_bri_is_rbsbits() - +** +** OK +*/ +static int wp_tdmv_bri_is_rbsbits(wan_tdmv_t *wan_tdmv) +{ + return 0; +} + +/****************************************************************************** +** wp_tdmv_rx_chan() - +** +** OK +*/ +static int wp_tdmv_bri_rx_chan(wan_tdmv_t *wan_tdmv, int channo, + unsigned char *rxbuf, + unsigned char *txbuf) +{ + wp_tdmv_bri_t *wr = wan_tdmv->sc; +#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE_ECHOMASTER + wan_tdmv_rxtx_pwr_t *pwr_rxtx = NULL; +#endif + + //DEBUG_TDMV_BRI("channo: %d\n", channo); + + //return 0; + + WAN_ASSERT2(wr == NULL, -EINVAL); + WAN_ASSERT2(channo < 0, -EINVAL); + WAN_ASSERT2(channo > 31, -EINVAL); + + if (!IS_TDMV_UP(wr)){ + return -EINVAL; + } + +#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE_ECHOMASTER + pwr_rxtx = &wan_tdmv->chan_pwr[channo]; +#endif + +#if 0 +DEBUG_EVENT("Module %d: RX: %02X %02X %02X %02X %02X %02X %02X %02X\n", + channo, + rxbuf[0], + rxbuf[1], + rxbuf[2], + rxbuf[3], + rxbuf[4], + rxbuf[5], + rxbuf[6], + rxbuf[7] + ); +#endif + wr->chans[channo].readchunk = rxbuf; + wr->chans[channo].writechunk = txbuf; + +#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE_ECHOMASTER + wp_tdmv_echo_check(wan_tdmv, &wr->chans[channo], channo); +#endif + + if (!wan_test_bit(channo, &wr->echo_off_map)){ +/*Echo spike starts at 25bytes*/ +#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE_ECHOMASTER + if(pwr_rxtx->current_state != ECHO_ABSENT){ +#endif +#if 0 +/* Echo spike starts at 16 bytes */ + + zt_ec_chunk( + &wr->chans[channo], + wr->chans[channo].readchunk, + wr->chans[channo].writechunk); +#endif + +#if 1 +/*Echo spike starts at 9 bytes*/ + zt_ec_chunk( + &wr->chans[channo], + wr->chans[channo].readchunk, + wr->ec_chunk1[channo]); + memcpy( + wr->ec_chunk1[channo], + wr->chans[channo].writechunk, + ZT_CHUNKSIZE); +#endif + +#if 0 +/*Echo spike starts at bytes*/ + zt_ec_chunk( + &wr->chans[channo], + wr->chans[channo].readchunk, + wr->ec_chunk1[channo]); + memcpy( + wr->ec_chunk1[channo], + wr->ec_chunk2[channo], + ZT_CHUNKSIZE); + + memcpy( + wr->ec_chunk2[channo], + wr->chans[channo].writechunk, + ZT_CHUNKSIZE); +#endif + +#ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE_ECHOMASTER + } /*if(pwr_rxtx->current_state != ECHO_ABSENT) */ +#endif + } /* if (!wan_test_bit(channo, &wr->echo_off_map)) */ + + return 0; +} + +static int wp_tdmv_bri_rx_tx_span(void *pcard) +{ + sdla_t *card = (sdla_t*)pcard; + wan_tdmv_t *wan_tdmv = &card->wan_tdmv; + wp_tdmv_bri_t *wr = NULL; + + /*BRI_FUNC();*/ + + WAN_ASSERT(wan_tdmv->sc == NULL); + wr = wan_tdmv->sc; + + wr->intcount++; + + zt_receive(&wr->span); + zt_transmit(&wr->span); + + return 0; +} + +static int wp_tdmv_bri_ec_span(void *pcard) +{ + sdla_t *card = (sdla_t*)pcard; + wan_tdmv_t *wan_tdmv = &card->wan_tdmv; + wp_tdmv_bri_t *wr = NULL; + + //BRI_FUNC(); + + WAN_ASSERT(wan_tdmv->sc == NULL); + + wr = wan_tdmv->sc; + + zt_ec_span(&wr->span); + + return 0; + +} + +static void wp_tdmv_bri_dtmf (void* card_id, wan_event_t *event) +{ + sdla_t *card = (sdla_t*)card_id; + wan_tdmv_t *wan_tdmv = &card->wan_tdmv; + wp_tdmv_bri_t *wr = NULL; + + BRI_FUNC(); + + WAN_ASSERT1(wan_tdmv->sc == NULL); + wr = wan_tdmv->sc; + + if (event->type == WAN_EVENT_EC_DTMF){ + DEBUG_EVENT("%s: Received DTMF Event at TDM BRI (%d:%c:%s:%s)!\n", + card->devname, + event->channel, + event->digit, + (event->dtmf_port == WAN_EC_CHANNEL_PORT_ROUT)?"ROUT":"SOUT", + (event->dtmf_type == WAN_EC_TONE_PRESENT)?"PRESENT":"STOP"); + }else if (event->type == WAN_EVENT_RM_DTMF){ + DEBUG_EVENT("%s: Received DTMF Event at TDM BRI (%d:%c)!\n", + card->devname, + event->channel, + event->digit); + } + + if (!(wr->dtmfmask & (1 << (event->channel-1)))){ + DEBUG_EVENT("%s: DTMF is not enabled for the channel %d\n", + card->devname, + event->channel); + return; + } + if (event->dtmf_type == WAN_EC_TONE_PRESENT){ + wr->dtmfactive |= (1 << event->channel); + zt_qevent_lock( + &wr->span.chans[event->channel-1], + (ZT_EVENT_DTMFDOWN | event->digit)); + }else{ + wr->dtmfactive &= ~(1 << event->channel); + zt_qevent_lock( + &wr->span.chans[event->channel-1], + (ZT_EVENT_DTMFUP | event->digit)); + } + return; +} + +static int wp_tdmv_tx_dchan(struct zt_chan *chan, int len) +{ + wp_tdmv_bri_t *wp = NULL; + netskb_t *skb = NULL; + wan_smp_flag_t smp_flags; + unsigned char *data = NULL; + int err = 0; + + WAN_ASSERT2(chan == NULL, -ENODEV); + WAN_ASSERT2(chan->pvt == NULL, -ENODEV); + wp = chan->pvt; + WAN_ASSERT(wp->dchan_dev == NULL); + + if (len <= 2){ + return -EINVAL; + } + len -= 2; /* Remove checksum */ + skb = wan_skb_alloc(len+1); + if (skb == NULL){ + return -ENOMEM; + } + data = wan_skb_put(skb, len); + wan_spin_lock_irq(&chan->lock, &smp_flags); + memcpy(data, chan->writebuf[chan->inwritebuf], len); + wan_spin_unlock_irq(&chan->lock, &smp_flags); +#if 0 + { + int i; + DEBUG_EVENT("%s: TX DCHAN len: %d\n", chan->name, len); + /* + for(i = 0; i < len; i++){ + _DEBUG_EVENT("%02X ", data[i]); + } + _DEBUG_EVENT("\n"); + */ + } +#endif + if (skb){ + err = wp->dchan_dev->hard_start_xmit(skb, wp->dchan_dev); + if (err){ + wan_skb_free(skb); + } + } + + return err; +} + +/****************************************************************************** +** wp_tdmv_rx_dchan() - +** +** OK +*/ +static int wp_tdmv_rx_dchan(wan_tdmv_t *wan_tdmv, int channo, + unsigned char *rxbuf, unsigned int len) +{ + wp_tdmv_bri_t *wp = wan_tdmv->sc; + struct zt_chan *chan = NULL, *ms = NULL; + wan_smp_flag_t smp_flags; + unsigned char *buf = NULL; + int oldbuf; + int i, left; + + DEBUG_TDMV("%s(): channo: %d, wp->dchan: %d, len: %d\n", __FUNCTION__, channo, wp->dchan, len); + + WAN_ASSERT(wp == NULL); + WAN_ASSERT(channo != wp->dchan-1); + chan = &wp->chans[wp->dchan-1]; + WAN_ASSERT(chan == NULL || chan->master == NULL); + ms = chan->master; + + BRI_FUNC(); + + if (!IS_TDMV_UP(wp)){ + DEBUG_TDMV("%s: Asterisk is not running!\n", + wp->devname); + return -EINVAL; + } + if (!(ms->flags & ZT_FLAG_HDLC)){ + DEBUG_TDMV("%s: ERROR: %s not defined as D-CHAN! Or received HDLC data before 'ztcfg' was run.\n", + wp->devname, ms->name); + return -EINVAL; + } + + if (ms->inreadbuf < 0){ + return -EINVAL; + } + + if (ms->inreadbuf >= ZT_MAX_NUM_BUFS){ + DEBUG_EVENT("%s: RX buffer (%s) is out of range (%d-%d)!\n", + wp->devname, ms->name, ms->inreadbuf,ZT_MAX_NUM_BUFS); + return -EINVAL; + } + + /* FIXME wan_spin_lock_irqsave(&wp->tx_rx_lock, smp_flags); */ + wan_spin_lock_irq(&chan->lock, &smp_flags); + buf = ms->readbuf[ms->inreadbuf]; + left = ms->blocksize - ms->readidx[ms->inreadbuf]; + if (len + 2 > left) { + DEBUG_EVENT("%s: ERROR: Not ehough space for RX HDLC packet (%d:%d)!\n", + wp->devname, len+2, left); + wan_spin_unlock_irq(&chan->lock, &smp_flags); + return -EINVAL; + } + for(i = 0; i < len; i++){ + buf[ms->readidx[ms->inreadbuf]++] = rxbuf[i]; + } + /* Add extra 2 bytes for checksum */ + buf[ms->readidx[ms->inreadbuf]++] = 0x00; + buf[ms->readidx[ms->inreadbuf]++] = 0x00; + + oldbuf = ms->inreadbuf; + ms->readn[ms->inreadbuf] = ms->readidx[ms->inreadbuf]; + ms->inreadbuf = (ms->inreadbuf + 1) % ms->numbufs; + if (ms->inreadbuf == ms->outreadbuf) { + /* Whoops, we're full, and have no where else + to store into at the moment. We'll drop it + until there's a buffer available */ + ms->inreadbuf = -1; + /* Enable the receiver in case they've got POLICY_WHEN_FULL */ + ms->rxdisable = 0; + } + if (ms->outreadbuf < 0) { /* start out buffer if not already */ + ms->outreadbuf = oldbuf; + } + /* FIXME wan_spin_unlock_irq(&wp->tx_rx_lock, &smp_flags); */ + wan_spin_unlock_irq(&chan->lock, &smp_flags); + if (!ms->rxdisable) { /* if receiver enabled */ + DEBUG_TDMV("%s: HDLC block is ready!\n", + wp->devname); + /* Notify a blocked reader that there is data available + to be read, unless we're waiting for it to be full */ +#if defined(__LINUX__) + wake_up_interruptible(&ms->readbufq); + wake_up_interruptible(&ms->sel); + if (ms->iomask & ZT_IOMUX_READ) + wake_up_interruptible(&ms->eventbufq); +#elif defined(__FreeBSD__) || defined(__OpenBSD__) + wakeup(&ms->readbufq); + wakeup(&ms->sel); + if (ms->iomask & ZT_IOMUX_READ) + wakeup(&ms->eventbufq); + +#endif + } + return 0; +} + + +/****************************************************************************** +** wp_tdmv_report_alarms() - +** +** DONE +*/ +static void wp_tdmv_report_alarms(void* pcard, unsigned long te_alarm) +{ + sdla_t *card = (sdla_t*)pcard; + wan_tdmv_t *wan_tdmv = &card->wan_tdmv; + wp_tdmv_bri_t *wp = wan_tdmv->sc; + + /* The sc pointer can be NULL, on shutdown. In this + * case don't generate error, just get out */ + if (!wp){ + return; + } + + if(te_alarm == 0){ + wp->span.alarms = ZT_ALARM_NONE; + }else{ + wp->span.alarms = ZT_ALARM_RED; + } + zt_alarm_notify(&wp->span); + return; +} diff --git a/patches/kdrivers/src/net/sdla_bsc.c b/patches/kdrivers/src/net/sdla_bsc.c index ef22e90..033a61c 100644 --- a/patches/kdrivers/src/net/sdla_bsc.c +++ b/patches/kdrivers/src/net/sdla_bsc.c @@ -282,7 +282,7 @@ int wpbsc_init (sdla_t* card, wandev_conf_t* conf) card->wandev.new_if_cnt = 0; card->wandev.ttl = conf->ttl; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; card->wandev.clocking = conf->clocking; card->wandev.mtu = cfg.max_data_frame_size; @@ -320,12 +320,12 @@ int wpbsc_init (sdla_t* card, wandev_conf_t* conf) */ static int update (wan_device_t* wandev) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; netdevice_t* dev; volatile bscmp_private_area_t* bscmp_priv_area; /* sanity checks */ - if((wandev == NULL) || (wandev->private == NULL)) + if((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if(wandev->state == WAN_UNCONFIGURED) @@ -360,7 +360,7 @@ static int update (wan_device_t* wandev) */ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; bscmp_private_area_t* bscmp_priv_area; @@ -431,6 +431,8 @@ static int if_init (netdevice_t* dev) /* Initialize device driver entry points */ dev->open = &if_open; dev->stop = &if_close; + dev->hard_header = NULL; + dev->rebuild_header = NULL; dev->hard_start_xmit = &if_send; dev->get_stats = &if_stats; dev->do_ioctl = &if_ioctl; diff --git a/patches/kdrivers/src/net/sdla_bscstrm.c b/patches/kdrivers/src/net/sdla_bscstrm.c index 1d60715..07f85ce 100644 --- a/patches/kdrivers/src/net/sdla_bscstrm.c +++ b/patches/kdrivers/src/net/sdla_bscstrm.c @@ -262,7 +262,7 @@ int wp_bscstrm_init (sdla_t* card, wandev_conf_t* conf) card->wandev.new_if_cnt = 0; card->wandev.ttl = conf->ttl; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; card->wandev.clocking = conf->clocking; card->wandev.mtu = 1000; @@ -292,7 +292,7 @@ int wp_bscstrm_init (sdla_t* card, wandev_conf_t* conf) printk(KERN_INFO "%s: Bisync Streaming Config: \n",card->devname); printk(KERN_INFO "%s: Comm Port = %s\n", card->devname,card->wandev.comm_port==0?"PRI":"SEC"); - printk(KERN_INFO "%s: Baud Rate = %u\n", + printk(KERN_INFO "%s: Baud Rate = %lu\n", card->devname,card->wandev.bscstrm_cfg.baud_rate); printk(KERN_INFO "%s: Adapter Frequency = %lu\n", card->devname,card->wandev.bscstrm_cfg.adapter_frequency); @@ -353,12 +353,12 @@ int wp_bscstrm_init (sdla_t* card, wandev_conf_t* conf) */ static int update (wan_device_t* wandev) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; netdevice_t* dev; volatile bscstrm_private_area_t* bscstrm_priv_area; /* sanity checks */ - if((wandev == NULL) || (wandev->private == NULL)) + if((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if(wandev->state == WAN_UNCONFIGURED) @@ -398,7 +398,7 @@ static void bscstrm_bh (unsigned long data) */ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; bscstrm_private_area_t* bscstrm_priv_area; @@ -489,6 +489,8 @@ static int if_init (netdevice_t* dev) /* Initialize device driver entry points */ dev->open = &if_open; dev->stop = &if_close; + dev->hard_header = NULL; + dev->rebuild_header = NULL; dev->hard_start_xmit = &if_send; dev->get_stats = &if_stats; dev->do_ioctl = &if_ioctl; diff --git a/patches/kdrivers/src/net/sdla_chdlc.c b/patches/kdrivers/src/net/sdla_chdlc.c index d89cd95..45a9c57 100644 --- a/patches/kdrivers/src/net/sdla_chdlc.c +++ b/patches/kdrivers/src/net/sdla_chdlc.c @@ -452,7 +452,7 @@ int wpc_init (sdla_t* card, wandev_conf_t* conf) if (IS_TE1_MEDIA(&conf->fe_cfg)){ memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - sdla_te_iface_init(&card->wandev.fe_iface); + sdla_te_iface_init(&card->fe, &card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; card->fe.write_fe_reg = write_front_end_reg; @@ -460,7 +460,7 @@ int wpc_init (sdla_t* card, wandev_conf_t* conf) card->wandev.fe_enable_timer = chdlc_enable_timer; card->wandev.te_link_state = chdlc_handle_front_end_state; - conf->interface = + conf->electrical_interface = (IS_T1_CARD(card)) ? WANOPT_V35 : WANOPT_RS232; if (card->u.c.comm_port == WANOPT_PRI){ @@ -470,7 +470,7 @@ int wpc_init (sdla_t* card, wandev_conf_t* conf) }else if (IS_56K_MEDIA(&conf->fe_cfg)){ memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - sdla_56k_iface_init(&card->wandev.fe_iface); + sdla_56k_iface_init(&card->fe, &card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; card->fe.write_fe_reg = write_front_end_reg; @@ -538,9 +538,9 @@ int wpc_init (sdla_t* card, wandev_conf_t* conf) card->u.c.update_call_count = 0; card->wandev.ttl = conf->ttl; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; - if ((card->u.c.comm_port == WANOPT_SEC && conf->interface == WANOPT_V35)&& + if ((card->u.c.comm_port == WANOPT_SEC && conf->electrical_interface == WANOPT_V35)&& card->type != SDLA_S514){ printk(KERN_INFO "%s: ERROR - V35 Interface not supported on S508 %s port \n", card->devname, PORT(card->u.c.comm_port)); @@ -749,7 +749,7 @@ int wpc_init (sdla_t* card, wandev_conf_t* conf) */ static int update (wan_device_t* wandev) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; netdevice_t *dev; chdlc_private_area_t* chdlc_priv_area; unsigned long smp_flags; @@ -759,7 +759,7 @@ static int update (wan_device_t* wandev) #endif /* sanity checks */ - if((wandev == NULL) || (wandev->private == NULL)) + if((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if(wandev->state == WAN_UNCONFIGURED) @@ -856,7 +856,7 @@ static int update (wan_device_t* wandev) */ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; chdlc_private_area_t* chdlc_priv_area; int err = 0; @@ -1189,6 +1189,8 @@ static int if_init (netdevice_t* dev) /* Initialize device driver entry points */ dev->open = &if_open; dev->stop = &if_close; + dev->hard_header = NULL; + dev->rebuild_header = NULL; dev->hard_start_xmit = &if_send; dev->get_stats = &if_stats; #if defined(LINUX_2_4)||defined(LINUX_2_6) @@ -1393,7 +1395,6 @@ static void disable_comm (sdla_t *card) if (card->wandev.fe_iface.pre_release){ card->wandev.fe_iface.pre_release(&card->fe); } - if (card->wandev.fe_iface.unconfig){ card->wandev.fe_iface.unconfig(&card->fe); } @@ -1907,7 +1908,6 @@ static int chdlc_disable_comm_shutdown (sdla_t *card) if (card->wandev.fe_iface.pre_release){ card->wandev.fe_iface.pre_release(&card->fe); } - if (card->wandev.fe_iface.unconfig){ card->wandev.fe_iface.unconfig(&card->fe); } @@ -2536,7 +2536,7 @@ static void rx_intr (sdla_t* card) api_rx_hdr->usec=tv.tv_usec; skb->protocol = htons(WP_PVC_PROT); - wan_skb_reset_mac_header(skb); + wan_skb_reset_mac_header(skb); skb->dev = dev; skb->pkt_type = WAN_PACKET_DATA; @@ -2553,7 +2553,7 @@ static void rx_intr (sdla_t* card) if (chdlc_priv_area->annexg_dev){ skb->protocol = htons(ETH_P_X25); skb->dev = chdlc_priv_area->annexg_dev; - wan_skb_reset_mac_header(skb); + wan_skb_reset_mac_header(skb); if (wan_api_enqueue_skb(chdlc_priv_area,skb) < 0){ wan_skb_free(skb); @@ -2597,7 +2597,7 @@ static void rx_intr (sdla_t* card) skb->protocol = htons(ETH_P_IP); skb->dev = dev; - wan_skb_reset_mac_header(skb); + wan_skb_reset_mac_header(skb); netif_rx(skb); } @@ -2683,7 +2683,7 @@ static int set_chdlc_config(sdla_t* card) cfg.baud_rate = card->wandev.bps; } - cfg.line_config_options = (card->wandev.interface == WANOPT_RS232) ? + cfg.line_config_options = (card->wandev.electrical_interface == WANOPT_RS232) ? INTERFACE_LEVEL_RS232 : INTERFACE_LEVEL_V35; @@ -2768,21 +2768,6 @@ static int chdlc_calibrate_baud (sdla_t *card) { wan_mbox_t* mb = &card->wan_mbox; int err; - int enable_again=0; - sdla_t *tmp_card=NULL; - - if (card->wandev.connection == WANOPT_SWITCHED && - card->wandev.clocking == WANOPT_EXTERNAL && - card->next) { - tmp_card=card->next; - if (tmp_card->wandev.connection == WANOPT_SWITCHED && - tmp_card->wandev.clocking == WANOPT_EXTERNAL && - tmp_card->u.c.comm_enabled ) { - DEBUG_EVENT("%s: Next comm enabled -> disabling!\n",tmp_card->devname); - chdlc_comm_disable (tmp_card); - enable_again=1; - } - } mb->wan_data_len = 0; mb->wan_command = START_BAUD_CALIBRATION; @@ -2791,16 +2776,9 @@ static int chdlc_calibrate_baud (sdla_t *card) if (err != COMMAND_OK) chdlc_error (card, err, mb); - - if (enable_again && tmp_card) { - DEBUG_EVENT("%s: Next comm enabled -> re-enabling!\n",tmp_card->devname); - chdlc_comm_enable (tmp_card); - } - return err; } - static int chdlc_read_baud_calibration (sdla_t *card) { wan_mbox_t* mb = &card->wan_mbox; @@ -2867,7 +2845,7 @@ static int set_asy_config(sdla_t* card) if(card->wandev.clocking) cfg.baud_rate = card->wandev.bps; - cfg.line_config_options = (card->wandev.interface == WANOPT_RS232) ? + cfg.line_config_options = (card->wandev.electrical_interface == WANOPT_RS232) ? INTERFACE_LEVEL_RS232 : INTERFACE_LEVEL_V35; cfg.modem_config_options = 0; @@ -3964,7 +3942,7 @@ dflt_1: /* Decapsulate pkt and pass it up the protocol stack */ new_skb->protocol = htons(ETH_P_IP); new_skb->dev = dev; - wan_skb_reset_mac_header(new_skb); + wan_skb_reset_mac_header(new_skb); netif_rx(new_skb); } else { @@ -4264,7 +4242,6 @@ static int config_chdlc (sdla_t *card, netdevice_t *dev) if (card->wandev.fe_iface.post_init){ err=card->wandev.fe_iface.post_init(&card->fe); } - } @@ -4970,7 +4947,7 @@ static void wanpipe_tty_receive(sdla_t *card, unsigned addr, unsigned int len) if (net_ratelimit()){ printk(KERN_INFO "%s: Received packet size too big: %i bytes, Max: %i!\n", - card->devname,len,TTY_CHDLC_MAX_MTU); + card->devname,len,TTY_FLIPBUF_SIZE); } return; } @@ -4981,11 +4958,11 @@ static void wanpipe_tty_receive(sdla_t *card, unsigned addr, unsigned int len) } #endif #else - if ((tty->flip.count+len) >= TTY_CHDLC_MAX_MTU){ + if ((tty->flip.count+len) >= TTY_FLIPBUF_SIZE){ if (net_ratelimit()){ printk(KERN_INFO "%s: Received packet size too big: %i bytes, Max: %i!\n", - card->devname,len,TTY_CHDLC_MAX_MTU); + card->devname,len,TTY_FLIPBUF_SIZE); } return; } @@ -5054,7 +5031,7 @@ static void wanpipe_tty_receive(sdla_t *card, unsigned addr, unsigned int len) if (net_ratelimit()){ printk(KERN_INFO "%s: Received packet size too big: %i bytes, Max: %i!\n", - card->devname,len,TTY_CHDLC_MAX_MTU); + card->devname,len,TTY_FLIPBUF_SIZE); } return; } @@ -5149,6 +5126,9 @@ static int config_tty (sdla_t *card) (IS_T1_CARD(card))?"T1":"E1"); return -EINVAL; } + if (card->wandev.fe_iface.post_init){ + err=card->wandev.fe_iface.post_init(&card->fe); + } } @@ -5165,6 +5145,9 @@ static int config_tty (sdla_t *card) card->devname); return -EINVAL; } + if (card->wandev.fe_iface.post_init){ + err=card->wandev.fe_iface.post_init(&card->fe); + } } @@ -5828,7 +5811,7 @@ static int chdlc_set_dev_config(struct file *file, if (wandev == NULL) return cnt; - card = (sdla_t*)wandev->private; + card = (sdla_t*)wandev->priv; printk(KERN_INFO "%s: New device config (%s)\n", wandev->name, buffer); diff --git a/patches/kdrivers/src/net/sdla_ec.c b/patches/kdrivers/src/net/sdla_ec.c index 92a2e99..8caf63b 100644 --- a/patches/kdrivers/src/net/sdla_ec.c +++ b/patches/kdrivers/src/net/sdla_ec.c @@ -29,8 +29,6 @@ # if defined(WAN_OCT6100_DAEMON) # include # endif -#elif (defined __WINDOWS__) -# include #else # include # include @@ -338,6 +336,9 @@ static int wan_ec_action(void *pcard, int enable, int channel) ec->ec_channels_no--; } } + }else{ + DEBUG_HWEC("[HWEC]: %s: %s(): card->wandev.hwec_enable == NULL!\n", + card->devname, __FUNCTION__); } return err; } diff --git a/patches/kdrivers/src/net/sdla_ec_dev.c b/patches/kdrivers/src/net/sdla_ec_dev.c index 0c5d77f..c7b5837 100644 --- a/patches/kdrivers/src/net/sdla_ec_dev.c +++ b/patches/kdrivers/src/net/sdla_ec_dev.c @@ -117,7 +117,7 @@ static int wp_ecdev_reg_globals(void) { int err; - wan_spin_lock_init(&wp_ecdev_hash_lock); + wan_spin_lock_init(&wp_ecdev_hash_lock, "wan_ecdev_lock"); memset(wp_ecdev_hash,0,sizeof(wp_ecdev_hash)); DEBUG_EVENT("%s: Registering Wanpipe ECDEV Device!\n",__FUNCTION__); diff --git a/patches/kdrivers/src/net/sdla_edac.c b/patches/kdrivers/src/net/sdla_edac.c index 189cc74..9f48958 100644 --- a/patches/kdrivers/src/net/sdla_edac.c +++ b/patches/kdrivers/src/net/sdla_edac.c @@ -30,8 +30,6 @@ # include # include -#elif (defined __WINDOWS__) -# include #else #if 0 diff --git a/patches/kdrivers/src/net/sdla_edu.c b/patches/kdrivers/src/net/sdla_edu.c index 930f223..fcc8cdb 100644 --- a/patches/kdrivers/src/net/sdla_edu.c +++ b/patches/kdrivers/src/net/sdla_edu.c @@ -180,7 +180,7 @@ int wpedu_init (sdla_t* card, wandev_conf_t* conf) }else{ card->wandev.mtu = conf->mtu; } - card->wandev.interface = 0; + card->wandev.electrical_interface = 0; card->wandev.clocking = 0; port_num = card->u.c.comm_port; @@ -230,7 +230,7 @@ int wpedu_init (sdla_t* card, wandev_conf_t* conf) */ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; edu_private_area_t* edu_private_area; int err = 0; @@ -372,6 +372,8 @@ static int if_init (netdevice_t* dev) /* Initialize device driver entry points */ dev->open = &if_open; dev->stop = &if_close; + dev->hard_header = NULL; + dev->rebuild_header = NULL; dev->hard_start_xmit = &if_send; dev->get_stats = &if_stats; #if defined(LINUX_2_4)||defined(LINUX_2_6) @@ -809,8 +811,8 @@ static void DoIoctl(sdla_t *card) //The flag is set to one before an application will load the card. //No application will be able to reload the card until the flag is reset by //SDLA_CMD_DEREGISTER. - if(card->wandev.interface == 0) - { card->wandev.interface = 1; + if(card->wandev.electrical_interface == 0) + { card->wandev.electrical_interface = 1; ioctl_cmd->return_code = 0; }else { //indicate failure to the caller @@ -821,7 +823,7 @@ static void DoIoctl(sdla_t *card) case SDLA_CMD_DEREGISTER: DEBUG_IOCTL("SDLA_CMD_DEREGISTER\n"); - card->wandev.interface = 0; + card->wandev.electrical_interface = 0; ioctl_cmd->return_code = 0; break; diff --git a/patches/kdrivers/src/net/sdla_fr.c b/patches/kdrivers/src/net/sdla_fr.c index 3be681a..7ccb401 100644 --- a/patches/kdrivers/src/net/sdla_fr.c +++ b/patches/kdrivers/src/net/sdla_fr.c @@ -319,7 +319,9 @@ typedef struct fr_channel #define TMR_INT_ENABLED_UPDATE_DLCI 0x40 #define TMR_INT_ENABLED_TE 0x80 + #pragma pack(1) + typedef struct dlci_status { unsigned short dlci ; @@ -341,6 +343,7 @@ typedef struct fr_dlci_interface unsigned short packet_length ; unsigned char reserved ; } fr_dlci_interface_t; + #pragma pack() extern void disable_irq(unsigned int); @@ -568,7 +571,7 @@ int wpf_init(sdla_t *card, wandev_conf_t *conf) if (IS_TE1_MEDIA(&conf->fe_cfg)) { memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - sdla_te_iface_init(&card->wandev.fe_iface); + sdla_te_iface_init(&card->fe, &card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; card->fe.write_fe_reg = write_front_end_reg; @@ -576,14 +579,14 @@ int wpf_init(sdla_t *card, wandev_conf_t *conf) card->wandev.fe_enable_timer = fr_enable_timer; card->wandev.te_link_state = fr_handle_front_end_state; - conf->interface = + conf->electrical_interface = (IS_T1_FEMEDIA(&card->fe)) ? WANOPT_V35 : WANOPT_RS232; conf->clocking = WANOPT_EXTERNAL; }else if (IS_56K_MEDIA(&conf->fe_cfg)) { memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - sdla_56k_iface_init(&card->wandev.fe_iface); + sdla_56k_iface_init(&card->fe, &card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; card->fe.write_fe_reg = write_front_end_reg; @@ -714,7 +717,7 @@ int wpf_init(sdla_t *card, wandev_conf_t *conf) if (conf->clocking == WANOPT_INTERNAL) u.cfg.port |= 0x0001; - if (conf->interface == WANOPT_RS232) + if (conf->electrical_interface == WANOPT_RS232) u.cfg.port |= 0x0002; if (conf->u.fr.t391) @@ -766,7 +769,7 @@ int wpf_init(sdla_t *card, wandev_conf_t *conf) card->wandev.mtu = conf->mtu; card->wandev.bps = conf->bps; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; card->wandev.clocking = conf->clocking; card->wandev.station = conf->u.fr.station; card->poll = NULL; @@ -846,10 +849,10 @@ int wpf_init(sdla_t *card, wandev_conf_t *conf) (IS_T1_CARD(card))?"T1":"E1"); return -EIO; } + /* Run rest of initialization not from lock */ if (card->wandev.fe_iface.post_init){ err=card->wandev.fe_iface.post_init(&card->fe); } - }else if (IS_56K_CARD(card)) { int err = -EINVAL; @@ -864,6 +867,7 @@ int wpf_init(sdla_t *card, wandev_conf_t *conf) card->devname); return -EIO; } + /* Run rest of initialization not from lock */ if (card->wandev.fe_iface.post_init){ err=card->wandev.fe_iface.post_init(&card->fe); } @@ -947,13 +951,13 @@ static int update (wan_device_t* wandev) unsigned long smp_flags; /* sanity checks */ - if ((wandev == NULL) || (wandev->private == NULL)) + if ((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if (wandev->state == WAN_UNCONFIGURED) return -ENODEV; - card = wandev->private; + card = wandev->priv; if (test_and_set_bit(0,&card->update_comms_stats)){ return -EBUSY; @@ -1020,7 +1024,7 @@ static int update (wan_device_t* wandev) static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; fr_channel_t* chan; int dlci = 0; int err = 0; @@ -1360,7 +1364,7 @@ static int del_if (wan_device_t* wandev, netdevice_t* dev) { fr_channel_t* chan = dev->priv; unsigned long smp_flags; - sdla_t *card=wandev->private; + sdla_t *card=wandev->priv; /* Delete interface name from proc fs. */ wanrouter_proc_delete_interface(wandev, chan->name); @@ -1434,7 +1438,6 @@ static void disable_comm (sdla_t *card) if (card->wandev.fe_iface.pre_release){ card->wandev.fe_iface.pre_release(&card->fe); } - if (card->wandev.fe_iface.unconfig){ card->wandev.fe_iface.unconfig(&card->fe); } @@ -1459,6 +1462,8 @@ static int if_init (netdevice_t* dev) /* Initialize device driver entry points */ dev->open = &if_open; dev->stop = &if_close; + dev->hard_header = NULL; + dev->rebuild_header = NULL; dev->hard_start_xmit = &if_send; dev->get_stats = &if_stats; #if defined(LINUX_2_4) || defined(LINUX_2_6) @@ -6237,7 +6242,7 @@ static int fr_set_dev_config(struct file *file, if (wandev == NULL) return cnt; - card = (sdla_t*)wandev->private; + card = (sdla_t*)wandev->priv; printk(KERN_INFO "%s: New device config (%s)\n", wandev->name, buffer); diff --git a/patches/kdrivers/src/net/sdla_ft1.c b/patches/kdrivers/src/net/sdla_ft1.c index 0008a5d..e370675 100644 --- a/patches/kdrivers/src/net/sdla_ft1.c +++ b/patches/kdrivers/src/net/sdla_ft1.c @@ -204,7 +204,7 @@ int wpft1_init (sdla_t* card, wandev_conf_t* conf) card->u.c.update_call_count = 0; card->wandev.ttl = 0x7F; - card->wandev.interface = 0; + card->wandev.electrical_interface = 0; card->wandev.clocking = 0; diff --git a/patches/kdrivers/src/net/sdla_mp_fr.c b/patches/kdrivers/src/net/sdla_mp_fr.c index 062f8ec..104da38 100644 --- a/patches/kdrivers/src/net/sdla_mp_fr.c +++ b/patches/kdrivers/src/net/sdla_mp_fr.c @@ -434,7 +434,7 @@ int wp_hdlc_fr_init (sdla_t* card, wandev_conf_t* conf) #ifdef TE1_56_CARD_SUPPORT memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - sdla_te_iface_init(&card->wandev.fe_iface); + sdla_te_iface_init(&card->fe, &card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; card->fe.write_fe_reg = write_front_end_reg; @@ -442,7 +442,7 @@ int wp_hdlc_fr_init (sdla_t* card, wandev_conf_t* conf) card->wandev.fe_enable_timer = hdlc_enable_timer; card->wandev.te_link_state = fr_handle_front_end_state; - conf->interface = + conf->electrical_interface = (IS_T1_CARD(card)) ? WANOPT_V35 : WANOPT_RS232; if (card->u.c.comm_port == WANOPT_PRI){ @@ -456,7 +456,7 @@ int wp_hdlc_fr_init (sdla_t* card, wandev_conf_t* conf) #ifdef TE1_56_CARD_SUPPORT memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - sdla_56k_iface_init(&card->wandev.fe_iface); + sdla_56k_iface_init(&card->fe,&card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; card->fe.write_fe_reg = write_front_end_reg; @@ -541,11 +541,11 @@ int wp_hdlc_fr_init (sdla_t* card, wandev_conf_t* conf) card->u.c.update_call_count = 0; card->wandev.ttl = conf->ttl; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; /* The secondary port on S508 card can only have RS232 interface */ - if ((card->u.c.comm_port == WANOPT_SEC && conf->interface == WANOPT_V35)&& + if ((card->u.c.comm_port == WANOPT_SEC && conf->electrical_interface == WANOPT_V35)&& card->type != SDLA_S514){ printk(KERN_INFO "%s: ERROR - V35 Interface not supported on S508 %s port \n", card->devname, PORT(card->u.c.comm_port)); @@ -750,7 +750,7 @@ int wp_hdlc_fr_init (sdla_t* card, wandev_conf_t* conf) */ static int update (wan_device_t* wandev) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; unsigned long smp_flags; #if 0 SHARED_MEMORY_INFO_STRUCT *flags; @@ -759,7 +759,7 @@ static int update (wan_device_t* wandev) /* sanity checks */ - if((wandev == NULL) || (wandev->private == NULL)) + if((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if(wandev->state == WAN_UNCONFIGURED) @@ -828,7 +828,7 @@ static int update (wan_device_t* wandev) */ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; fr_private_area_t* chan; int err = 0; unsigned short dlci=0; @@ -983,7 +983,7 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) static int del_if (wan_device_t* wandev, netdevice_t* dev) { fr_private_area_t *chan = dev->priv; - sdla_t *card = wandev->private; + sdla_t *card = wandev->priv; fr_prot_t *fr_prot = FR_PROT_AREA(card); unsigned long smp_flags; @@ -1067,6 +1067,9 @@ static void disable_comm (sdla_t *card) #ifdef TE1_56_CARD_SUPPORT /* TE1 - Unconfiging */ if (IS_TE1_CARD(card)) { + if (card->wandev.fe_iface.pre_release){ + card->wandev.fe_iface.pre_release(&card->fe); + } if (card->wandev.fe_iface.unconfig){ card->wandev.fe_iface.unconfig(&card->fe); } @@ -1107,6 +1110,7 @@ static int if_init (netdevice_t* dev) #endif dev->do_ioctl = if_do_ioctl; + dev->hard_header = NULL; dev->hard_header_len = 0; dev->addr_len = 2; *(u16*)dev->dev_addr = htons(chan->dlci); @@ -1344,7 +1348,7 @@ static int if_send (struct sk_buff* skb, netdevice_t* dev) fr_private_area_t *chan = dev->priv; sdla_t *card = chan->card; //int udp_type = 0; - unsigned long smp_flags=0; + unsigned long smp_flags; int err=0; #if defined(LINUX_2_4)||defined(LINUX_2_6) @@ -2376,7 +2380,7 @@ static int set_hdlc_config(sdla_t* card) if(card->wandev.clocking) cfg.baud_rate = card->wandev.bps; - cfg.line_config_options = (card->wandev.interface == WANOPT_RS232) ? + cfg.line_config_options = (card->wandev.electrical_interface == WANOPT_RS232) ? INTERFACE_LEVEL_RS232 : INTERFACE_LEVEL_V35; cfg.modem_config_options = 0; @@ -3579,6 +3583,10 @@ static int config_hdlc (sdla_t *card) (IS_T1_CARD(card))?"T1":"E1"); return -EINVAL; } + /* Run rest of initialization not from lock */ + if (card->wandev.fe_iface.post_init){ + err=card->wandev.fe_iface.post_init(&card->fe); + } } @@ -3595,6 +3603,10 @@ static int config_hdlc (sdla_t *card) card->devname); return -EINVAL; } + /* Run rest of initialization not from lock */ + if (card->wandev.fe_iface.post_init){ + err=card->wandev.fe_iface.post_init(&card->fe); + } } #endif @@ -3723,7 +3735,7 @@ static int fr_set_dev_config(struct file *file, if (wandev == NULL) return cnt; - card = (sdla_t*)wandev->private; + card = (sdla_t*)wandev->priv; printk(KERN_INFO "%s: New device config (%s)\n", wandev->name, buffer); @@ -5028,7 +5040,7 @@ static netdevice_t * un_bind_annexg(wan_device_t *wandev, netdevice_t *annexg_de struct wan_dev_le *devle; netdevice_t *dev; unsigned long smp_flags=0; - sdla_t *card = wandev->private; + sdla_t *card = wandev->priv; WAN_LIST_FOREACH(devle, &card->wandev.dev_head, dev_link){ fr_channel_t *chan; diff --git a/patches/kdrivers/src/net/sdla_pos.c b/patches/kdrivers/src/net/sdla_pos.c index a3bb7db..cb39ada 100644 --- a/patches/kdrivers/src/net/sdla_pos.c +++ b/patches/kdrivers/src/net/sdla_pos.c @@ -190,7 +190,7 @@ int wp_pos_init (sdla_t* card, wandev_conf_t* conf) card->wandev.clocking = conf->clocking; card->wandev.ignore_front_end_status = conf->ignore_front_end_status; card->wandev.ttl = conf->ttl; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; card->wandev.comm_port = conf->comm_port; card->wandev.udp_port = conf->udp_port; card->wandev.new_if_cnt = 0; @@ -273,14 +273,14 @@ int wp_pos_init (sdla_t* card, wandev_conf_t* conf) */ static int update (wan_device_t* wandev) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; struct net_device* dev; volatile private_area_t* priv_area; DEBUG_EVENT("%s: %d\n",__FUNCTION__, __LINE__); /* sanity checks */ - if((wandev == NULL) || (wandev->private == NULL)) + if((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if(wandev->state == WAN_UNCONFIGURED) @@ -343,7 +343,7 @@ static int update (wan_device_t* wandev) */ static int new_if (wan_device_t* wandev, struct net_device* dev, wanif_conf_t* conf) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; private_area_t* priv_area; DEBUG_EVENT("%s: %d\n",__FUNCTION__, __LINE__); @@ -486,6 +486,8 @@ static int if_init (struct net_device* dev) /* Initialize device driver entry points */ dev->open = &if_open; dev->stop = &if_close; + dev->hard_header = NULL; + dev->rebuild_header = NULL; dev->hard_start_xmit = &if_send; dev->get_stats = &if_stats; dev->do_ioctl = if_do_ioctl; diff --git a/patches/kdrivers/src/net/sdla_ppp.c b/patches/kdrivers/src/net/sdla_ppp.c index 06aa85a..fbf46e5 100644 --- a/patches/kdrivers/src/net/sdla_ppp.c +++ b/patches/kdrivers/src/net/sdla_ppp.c @@ -439,7 +439,7 @@ int wpp_init(sdla_t *card, wandev_conf_t *conf) if (IS_TE1_MEDIA(&conf->fe_cfg)){ memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - sdla_te_iface_init(&card->wandev.fe_iface); + sdla_te_iface_init(&card->fe, &card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; card->fe.write_fe_reg = write_front_end_reg; @@ -447,14 +447,14 @@ int wpp_init(sdla_t *card, wandev_conf_t *conf) card->wandev.fe_enable_timer = ppp_enable_timer; card->wandev.te_link_state = ppp_handle_front_end_state; - conf->interface = + conf->electrical_interface = (IS_T1_CARD(card)) ? WANOPT_V35 : WANOPT_RS232; conf->clocking = WANOPT_EXTERNAL; }else if (IS_56K_MEDIA(&conf->fe_cfg)){ memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - sdla_56k_iface_init(&card->wandev.fe_iface); + sdla_56k_iface_init(&card->fe, &card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; card->fe.write_fe_reg = write_front_end_reg; @@ -496,7 +496,7 @@ int wpp_init(sdla_t *card, wandev_conf_t *conf) wp_min(conf->mtu, PPP_MAX_MTU) : PPP_DFLT_MTU; card->wandev.bps = conf->bps; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; card->wandev.clocking = conf->clocking; card->isr = &wpp_isr; card->poll = NULL; @@ -570,13 +570,13 @@ int wpp_init(sdla_t *card, wandev_conf_t *conf) */ static int update(wan_device_t *wandev) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; netdevice_t *dev; volatile ppp_private_area_t *ppp_priv_area; unsigned long smp_flags; /* sanity checks */ - if ((wandev == NULL) || (wandev->private == NULL)) + if ((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if (wandev->state == WAN_UNCONFIGURED) @@ -655,7 +655,7 @@ static int update(wan_device_t *wandev) */ static int new_if(wan_device_t *wandev, netdevice_t *dev, wanif_conf_t *conf) { - sdla_t *card = wandev->private; + sdla_t *card = wandev->priv; ppp_private_area_t *ppp_priv_area; int err = 0; @@ -868,7 +868,6 @@ static void disable_comm (sdla_t *card) if (card->wandev.fe_iface.pre_release){ card->wandev.fe_iface.pre_release(&card->fe); } - if (card->wandev.fe_iface.unconfig){ card->wandev.fe_iface.unconfig(&card->fe); } @@ -894,6 +893,8 @@ static int if_init(netdevice_t *dev) /* Initialize device driver entry points */ dev->open = &if_open; dev->stop = &if_close; + dev->hard_header = NULL; + dev->rebuild_header = NULL; dev->hard_start_xmit = &if_send; dev->get_stats = &if_stats; #if defined(LINUX_2_4)||defined(LINUX_2_6) @@ -2792,7 +2793,7 @@ static int config508(netdevice_t *dev, sdla_t *card) if (card->wandev.clocking) cfg.line_speed = card->wandev.bps; - if (card->wandev.interface == WANOPT_RS232) + if (card->wandev.electrical_interface == WANOPT_RS232) cfg.conf_flags |= INTERFACE_LEVEL_RS232; @@ -3405,7 +3406,7 @@ udp_dflt_cmd: stack */ new_skb->protocol = ppp_priv_area->protocol; new_skb->dev = dev; - wan_skb_reset_mac_header(new_skb); + wan_skb_reset_mac_header(new_skb); netif_rx(new_skb); @@ -3819,6 +3820,7 @@ static int config_ppp (sdla_t *card) (IS_T1_CARD(card))?"T1":"E1"); return 0; } + /* Run rest of initialization not from lock */ if (card->wandev.fe_iface.post_init){ err=card->wandev.fe_iface.post_init(&card->fe); } @@ -3836,6 +3838,7 @@ static int config_ppp (sdla_t *card) card->devname); return 0; } + /* Run rest of initialization not from lock */ if (card->wandev.fe_iface.post_init){ err=card->wandev.fe_iface.post_init(&card->fe); } @@ -4236,7 +4239,7 @@ static int ppp_set_dev_config(struct file *file, if (wandev == NULL) return cnt; - card = (sdla_t*)wandev->private; + card = (sdla_t*)wandev->priv; printk(KERN_INFO "%s: New device config (%s)\n", wandev->name, buffer); diff --git a/patches/kdrivers/src/net/sdla_remora.c b/patches/kdrivers/src/net/sdla_remora.c index 73ef7fd..df81aad 100644 --- a/patches/kdrivers/src/net/sdla_remora.c +++ b/patches/kdrivers/src/net/sdla_remora.c @@ -16,7 +16,7 @@ ****************************************************************************** */ -/******************************************************************************* +/****************************************************************************** ** INCLUDE FILES *******************************************************************************/ #if defined(__FreeBSD__) || defined(__OpenBSD__) @@ -31,9 +31,9 @@ # include #elif (defined __WINDOWS__) # include -# include # include # include +# include #else # include # include @@ -45,24 +45,39 @@ # include #endif +#if !defined(__WINDOWS__) +#if 1 +#define AFT_FUNC_DEBUG() +#else +#define AFT_FUNC_DEBUG() DEBUG_EVENT("%s:%d\n",__FUNCTION__,__LINE__) +#endif +#endif /******************************************************************************* ** DEFINES AND MACROS *******************************************************************************/ +#undef WAN_REMORA_AUTO_CALIBRATE + #if 1 # define AFT_TDM_API_SUPPORT #else # undef AFT_TDM_API_SUPPORT #endif +#if 1 +# define AFT_API_SUPPORT +#else +# undef AFT_API_SUPPORT +#endif + #if 0 # define AFT_RM_INTR_SUPPORT #else # undef AFT_RM_INTR_SUPPORT #endif -#define AUDIO_RINGCHECK +#undef AUDIO_RINGCHECK #if 1 /* Current A200 designs (without interrupts) */ @@ -79,7 +94,7 @@ #define WP_RM_CONFIGURED 0x03 #define WP_RM_TIMER_EVENT_PENDING 0x04 -#define WP_RM_POLL_TIMER 1000 +#define WP_RM_POLL_TIMER 100 #define WP_RM_POLL_EVENT_TIMER 10 #define WP_RM_POLL_TONE_TIMER 5000 #define WP_RM_POLL_RING_TIMER 10000 @@ -89,8 +104,6 @@ enum { WP_RM_POLL_TONE_RING, WP_RM_POLL_TONE_CONGESTION, WP_RM_POLL_TONE_DONE, - //WP_RM_POLL_RING, - //WP_RM_POLL_RING_STOP, WP_RM_POLL_TDMV, WP_RM_POLL_EVENT, WP_RM_POLL_INIT, @@ -106,9 +119,42 @@ enum { WP_RM_POLL_TXSIG_ONHOOK, WP_RM_POLL_ONHOOKTRANSFER, WP_RM_POLL_SETPOLARITY, - WP_RM_POLL_RING_DETECT + WP_RM_POLL_RING_DETECT, + WP_RM_POLL_READ, + WP_RM_POLL_WRITE, + WP_RM_POLL_RXSIG_OFFHOOK, + WP_RM_POLL_RXSIG_ONHOOK }; +#define WP_RM_POLL_DECODE(type) \ + ((type) == WP_RM_POLL_TONE_DIAL) ? "Tone (dial)": \ + ((type) == WP_RM_POLL_TONE_BUSY) ? "Tone (busy)": \ + ((type) == WP_RM_POLL_TONE_RING) ? "Tone (ring)": \ + ((type) == WP_RM_POLL_TONE_CONGESTION) ? "Tone (congestion)": \ + ((type) == WP_RM_POLL_TONE_DONE) ? "Tone (done)": \ + ((type) == WP_RM_POLL_TDMV) ? "TDMV": \ + ((type) == WP_RM_POLL_EVENT) ? "RM-Event": \ + ((type) == WP_RM_POLL_INIT) ? "Init": \ + ((type) == WP_RM_POLL_POWER) ? "Power": \ + ((type) == WP_RM_POLL_LC) ? "Loop closure": \ + ((type) == WP_RM_POLL_RING_TRIP) ? "Ring Trip": \ + ((type) == WP_RM_POLL_DTMF) ? "DTMF": \ + ((type) == WP_RM_POLL_RING) ? "Ring": \ + ((type) == WP_RM_POLL_TONE) ? "Tone": \ + ((type) == WP_RM_POLL_TXSIG_KEWL) ? "TX Sig KEWL": \ + ((type) == WP_RM_POLL_TXSIG_START) ? "TX Sig Start": \ + ((type) == WP_RM_POLL_TXSIG_OFFHOOK) ? "TX Sig Off-hook": \ + ((type) == WP_RM_POLL_TXSIG_ONHOOK) ? "TX Sig On-hook": \ + ((type) == WP_RM_POLL_ONHOOKTRANSFER) ? "On-hook transfer": \ + ((type) == WP_RM_POLL_SETPOLARITY) ? "Set polarity": \ + ((type) == WP_RM_POLL_RING_DETECT) ? "Ring Detect": \ + ((type) == WP_RM_POLL_READ) ? "FE Read": \ + ((type) == WP_RM_POLL_WRITE) ? "FE Write":"Unknown RM poll event" \ + ((type) == WP_RM_POLL_RXSIG_OFFHOOK) ? "RX Sig Off-hook": \ + ((type) == WP_RM_POLL_RXSIG_ONHOOK) ? "RX Sig On-hook": \ + "Unknown RM poll event" + + /* tone_struct DialTone ** OSC1= 350 Hz OSC2= 440 Hz .0975 Volts -18 dBm */ #define DIALTONE_IR13 0x7b30 @@ -332,7 +378,6 @@ static struct fxo_mode { { "USA", 0, 0, 0, 0, 0, 0x3, 0, 0, }, { "YEMEN", 0, 0, 0, 0, 0, 0x3, 0, 0, }, }; - static int acim2tiss[16] = { 0x0, 0x1, 0x4, 0x5, 0x7, 0x0, 0x0, 0x6, 0x0, 0x0, 0x0, 0x2, 0x0, 0x3 }; /******************************************************************************* @@ -345,7 +390,7 @@ static int acim2tiss[16] = { 0x0, 0x1, 0x4, 0x5, 0x7, 0x0, 0x0, 0x6, 0x0, 0x0, 0 #if !defined(__WINDOWS__) extern WAN_LIST_HEAD(, wan_tdmv_) wan_tdmv_head; #endif -static int battdebounce = DEFAULT_BATT_DEBOUNCE; +static int battdebounce = 64; //DEFAULT_BATT_DEBOUNCE; static int battthresh = DEFAULT_BATT_THRESH; /******************************************************************************* @@ -357,6 +402,7 @@ int wp_init_voicedaa(sdla_fe_t *fe, int mod_no, int fast, int sane); static int wp_remora_config(void *pfe); static int wp_remora_unconfig(void *pfe); static int wp_remora_post_init(void *pfe); +static int wp_remora_pre_release(void* pfe); static int wp_remora_if_config(void *pfe, u32 mod_map, u8); static int wp_remora_if_unconfig(void *pfe, u32 mod_map, u8); static int wp_remora_disable_irq(void *pfe); @@ -364,7 +410,7 @@ static int wp_remora_intr(sdla_fe_t *); static int wp_remora_check_intr(sdla_fe_t *); static int wp_remora_polling(sdla_fe_t*); static int wp_remora_udp(sdla_fe_t*, void*, unsigned char*); -static unsigned int wp_remora_active_map(sdla_fe_t* fe); +static unsigned int wp_remora_active_map(sdla_fe_t* fe, unsigned char); static unsigned char wp_remora_fe_media(sdla_fe_t *fe); static int wp_remora_set_dtmf(sdla_fe_t*, int, unsigned char); static int wp_remora_intr_ctrl(sdla_fe_t*, int, u_int8_t, u_int8_t, unsigned int); @@ -403,7 +449,7 @@ static void wait_just_a_bit(int foo, int fast) #if defined(__FreeBSD__) || defined(__OpenBSD__) WP_SCHEDULE(foo, "A200"); #else - unsigned long start_ticks; + wan_ticks_t start_ticks; start_ticks = SYSTEM_TICKS + foo; while(SYSTEM_TICKS < start_ticks){ WP_DELAY(100); @@ -427,6 +473,17 @@ static void wp_remora_reset_spi(sdla_fe_t *fe) SPI_INTERFACE_REG, 0x00000000); WP_DELAY(1000); + +#if 0 +{ + unsigned int value; + + /* Enable Slow speed SPI */ + card->hw_iface.bus_read_4(card->hw, 0x40, &data); + data |= 0x00000020; + card->hw_iface.bus_write_4(card->hw, 0x40, data); +} +#endif return; } @@ -434,7 +491,8 @@ static void wp_remora_reset_spi(sdla_fe_t *fe) static int wp_proslic_setreg_indirect(sdla_fe_t *fe, int mod_no, unsigned char address, unsigned short data) { - + DEBUG_REG("%s: Indirect Register %d = %X\n", + fe->name, address, data); WRITE_RM_REG(mod_no, IDA_LO,(unsigned char)(data & 0xFF)); WRITE_RM_REG(mod_no, IDA_HI,(unsigned char)((data & 0xFF00)>>8)); WRITE_RM_REG(mod_no, IAA,address); @@ -458,10 +516,12 @@ static int wp_proslic_init_indirect_regs(sdla_fe_t *fe, int mod_no) { unsigned char i; + DEBUG_CFG("%s: Initializing Indirect Registers...\n", fe->name); for (i=0; iname); return 0; } @@ -472,6 +532,7 @@ static int wp_proslic_verify_indirect_regs(sdla_fe_t *fe, int mod_no) unsigned short i, initial; int j; + DEBUG_CFG("%s: Verifing Indirect Registers...\n", fe->name); for (i=0; iname, mod_no, + fe->name, mod_no+1, i); return -1; } @@ -489,7 +550,7 @@ static int wp_proslic_verify_indirect_regs(sdla_fe_t *fe, int mod_no) if ( j != initial && indirect_regs[i].altaddr != 255){ DEBUG_EVENT( "%s: Module %d: Internal Error: iReg=%s (%X) Value=%X (%X)\n", - fe->name, mod_no, + fe->name, mod_no+1, indirect_regs[i].name, indirect_regs[i].address, j, initial); @@ -500,51 +561,50 @@ static int wp_proslic_verify_indirect_regs(sdla_fe_t *fe, int mod_no) if (!passed) { DEBUG_EVENT( "%s: Module %d: Init Indirect Registers UNSUCCESSFULLY.\n", - fe->name, mod_no); + fe->name, mod_no+1); return -1; } + DEBUG_CFG("%s: Verifing Indirect Registers...Done!\n", fe->name); return 0; } - +/****************************************************************************** +** wp_remora_chain_enable() - +** +** OK +*/ static int wp_remora_chain_enable(sdla_fe_t *fe) { int mod_no; unsigned char byte; - for(mod_no = 0;mod_no < MAX_REMORA_MODULES; mod_no += 2){ + for(mod_no = 0;mod_no < MAX_REMORA_MODULES; mod_no ++){ if (fe->rm_param.mod[mod_no].type == MOD_TYPE_NONE){ byte = READ_RM_FXS_REG(mod_no, 0, 0); byte &= 0x0F; if (byte == 0x05){ - DEBUG_RM("%s: Module %d/%d FXS\n", - fe->name, mod_no,mod_no+1); + DEBUG_RM("%s: Module %d FXS\n", + fe->name, mod_no+1); fe->rm_param.mod[mod_no].type = MOD_TYPE_FXS; - fe->rm_param.mod[mod_no+1].type = - MOD_TYPE_FXS; }else if (byte == 0x00){ - DEBUG_RM("%s: Module %d/%d TEST\n", - fe->name, mod_no,mod_no+1); + DEBUG_RM("%s: Module %d TEST\n", + fe->name, mod_no+1); fe->rm_param.mod[mod_no].type = MOD_TYPE_TEST; - fe->rm_param.mod[mod_no+1].type = - MOD_TYPE_TEST; } } } /* Reset SPI interface */ wp_remora_reset_spi(fe); - for(mod_no = 0;mod_no < MAX_REMORA_MODULES; mod_no += 2){ + for(mod_no = 0;mod_no < MAX_REMORA_MODULES; mod_no ++){ if (fe->rm_param.mod[mod_no].type == MOD_TYPE_NONE){ byte = READ_RM_FXO_REG(mod_no,1,2); if (byte == 0x03){ - DEBUG_RM("%s: Module %d/%d FXO\n", - fe->name, mod_no,mod_no+1); + DEBUG_RM("%s: Module %d FXO\n", + fe->name, mod_no+1); fe->rm_param.mod[mod_no].type = MOD_TYPE_FXO; - fe->rm_param.mod[mod_no+1].type = - MOD_TYPE_FXO; } } } @@ -553,14 +613,14 @@ static int wp_remora_chain_enable(sdla_fe_t *fe) wp_remora_reset_spi(fe); /* Now enable chain mode for only FXS modules (FXO by default chain) */ - for(mod_no = 0;mod_no < MAX_REMORA_MODULES; mod_no += 2){ - if (fe->rm_param.mod[mod_no].type == MOD_TYPE_FXS){ + for(mod_no = 0;mod_no < MAX_REMORA_MODULES; mod_no ++){ + if (fe->rm_param.mod[mod_no].type == MOD_TYPE_FXS && mod_no % 2 == 0){ WRITE_RM_FXS_REG(mod_no,0,0,0xC0); byte = READ_RM_FXS_REG(mod_no, 1, 0); if ((byte & 0x80) != 0x80){ DEBUG_RM( "%s: Module %d: Failed to enable chain (%02X)!\n", - fe->name, mod_no, byte); + fe->name, mod_no+1, byte); return -EINVAL; } }else if (fe->rm_param.mod[mod_no].type == MOD_TYPE_FXO){ @@ -568,24 +628,17 @@ static int wp_remora_chain_enable(sdla_fe_t *fe) if (byte != 0x03){ /* Should never happened */ fe->rm_param.mod[mod_no].type = MOD_TYPE_NONE; - fe->rm_param.mod[mod_no+1].type = MOD_TYPE_NONE; continue; } }else if (fe->rm_param.mod[mod_no].type == MOD_TYPE_TEST){ /* Test module or nothing */ continue; - }else{ - DEBUG_RM( - "%s: Module %d: Failed to detect FXO/FXS module!\n", - fe->name, mod_no); - continue; } DEBUG_RM( - "%s: Module %d/%d %s (chain)\n", - fe->name, mod_no,mod_no+1, + "%s: Module %d %s (chain)\n", + fe->name, mod_no+1, WP_REMORA_DECODE_TYPE(fe->rm_param.mod[mod_no].type)); fe->rm_param.mod[mod_no].chain = MOD_CHAIN_ENABLED; - fe->rm_param.mod[mod_no+1].chain= MOD_CHAIN_ENABLED; } return 0; } @@ -598,7 +651,7 @@ static int wp_init_proslic_insane(sdla_fe_t *fe, int mod_no) if ((value & 0x30) >> 4){ DEBUG_RM("%s: Proslic on module %d is not a Si3210 (%02X)!\n", fe->name, - mod_no, + mod_no+1, value); return -1; } @@ -618,7 +671,7 @@ static int wp_init_proslic_insane(sdla_fe_t *fe, int mod_no) if (value != 0x2) { DEBUG_EVENT( "%s: Proslic on module %d insane (1) %d should be 2!\n", - fe->name, mod_no, value); + fe->name, mod_no+1, value); return -1; } @@ -626,7 +679,7 @@ static int wp_init_proslic_insane(sdla_fe_t *fe, int mod_no) if (value != 0x0) { DEBUG_EVENT( "%s: Proslic on modyle %d insane (2) %d should be 0!\n", - fe->name, mod_no, value); + fe->name, mod_no+1, value); return -1; } @@ -634,7 +687,7 @@ static int wp_init_proslic_insane(sdla_fe_t *fe, int mod_no) if (value != 0x33) { DEBUG_EVENT( "%s: Proslic on module %d insane (3) %02X should be 0x33\n", - fe->name, mod_no, value); + fe->name, mod_no+1, value); return -1; } WRITE_RM_REG(mod_no, 30, 0); @@ -644,10 +697,11 @@ static int wp_init_proslic_insane(sdla_fe_t *fe, int mod_no) static int wp_powerup_proslic(sdla_fe_t *fe, int mod_no, int fast) { wp_remora_fxs_t *fxs; - unsigned long start_ticks; + wan_ticks_t start_ticks; int loopcurrent = 20, lim; unsigned char vbat; + DEBUG_CFG("%s: PowerUp SLIC initialization...\n", fe->name); fxs = &fe->rm_param.mod[mod_no].u.fxs; /* set the period of the DC-DC converter to 1/64 kHz START OUT SLOW*/ WRITE_RM_REG(mod_no, 92, 0xf5); @@ -673,7 +727,7 @@ static int wp_powerup_proslic(sdla_fe_t *fe, int mod_no, int fast) "%s: Module %d: Failed to powerup within %d ms (%dV : %dV)!\n", fe->name, mod_no+1, - (int)(((SYSTEM_TICKS - start_ticks) * 1000 / HZ)), + (u_int32_t)(((SYSTEM_TICKS - start_ticks) * 1000 / HZ)), (vbat * 375)/1000, (0xc0 * 375)/1000); DEBUG_EVENT( "%s: Module %d: Did you remember to plug in the power cable?\n", @@ -718,14 +772,16 @@ static int wp_powerup_proslic(sdla_fe_t *fe, int mod_no, int fast) } wait_just_a_bit(HZ/10, fast); } + DEBUG_CFG("%s: PowerUp SLIC initialization...Done!\n", fe->name); return 0; } static int wp_proslic_powerleak_test(sdla_fe_t *fe, int mod_no, int fast) { - unsigned long start_ticks; + wan_ticks_t start_ticks; unsigned char vbat; + DEBUG_CFG("%s: PowerLeak ProSLIC testing...\n", fe->name); /* powerleak */ WRITE_RM_REG(mod_no, 64, 0); WRITE_RM_REG(mod_no, 14, 0x10); @@ -739,7 +795,7 @@ static int wp_proslic_powerleak_test(sdla_fe_t *fe, int mod_no, int fast) fe->name, mod_no+1, 376 * vbat / 1000, vbat, - (int)((SYSTEM_TICKS - start_ticks) * 1000 / HZ)); + (u_int32_t)((SYSTEM_TICKS - start_ticks) * 1000 / HZ)); return -1; } DEBUG_RM("%s: Module %d: Post-leakage voltage: %d volts\n", @@ -747,13 +803,16 @@ static int wp_proslic_powerleak_test(sdla_fe_t *fe, int mod_no, int fast) mod_no+1, 376 * vbat / 1000); + DEBUG_CFG("%s: PowerLeak ProSLIC testing...Done!\n", fe->name); return 0; } +#if defined(WAN_REMORA_AUTO_CALIBRATE) static int wp_proslic_calibrate(sdla_fe_t *fe, int mod_no, int fast) { - volatile unsigned long start_ticks; + volatile wan_ticks_t start_ticks; + DEBUG_CFG("%s: ProSLIC calibration...\n", fe->name); /* perform all calibration */ WRITE_RM_REG(mod_no, 97, 0x1f); /* start */ @@ -769,14 +828,16 @@ static int wp_proslic_calibrate(sdla_fe_t *fe, int mod_no, int fast) } wait_just_a_bit(HZ/10, fast); } + DEBUG_CFG("%s: ProSLIC calibration...Done!\n", fe->name); return 0; } - +#else static int wp_proslic_manual_calibrate(sdla_fe_t *fe, int mod_no, int fast) { - volatile unsigned long start_ticks; + volatile wan_ticks_t start_ticks; int i=0; + DEBUG_CFG("%s: ProSLIC manual calibration...\n", fe->name); WRITE_RM_REG(mod_no, 21, 0x00); WRITE_RM_REG(mod_no, 22, 0x00); WRITE_RM_REG(mod_no, 23, 0x00); @@ -799,12 +860,12 @@ static int wp_proslic_manual_calibrate(sdla_fe_t *fe, int mod_no, int fast) } wait_just_a_bit(HZ/10, fast); - wp_proslic_setreg_indirect(fe, mod_no, 88, 0x0); - wp_proslic_setreg_indirect(fe, mod_no, 89, 0x0); - wp_proslic_setreg_indirect(fe, mod_no, 90, 0x0); - wp_proslic_setreg_indirect(fe, mod_no, 91, 0x0); - wp_proslic_setreg_indirect(fe, mod_no, 92, 0x0); - wp_proslic_setreg_indirect(fe, mod_no, 93, 0x0); + wp_proslic_setreg_indirect(fe, mod_no, 88, 0x00); + wp_proslic_setreg_indirect(fe, mod_no, 89, 0x00); + wp_proslic_setreg_indirect(fe, mod_no, 90, 0x00); + wp_proslic_setreg_indirect(fe, mod_no, 91, 0x00); + wp_proslic_setreg_indirect(fe, mod_no, 92, 0x00); + wp_proslic_setreg_indirect(fe, mod_no, 93, 0x00); /* Step 16 */ /* Insert manual calibration for sangoma Si3210 */ @@ -843,8 +904,10 @@ static int wp_proslic_manual_calibrate(sdla_fe_t *fe, int mod_no, int fast) while(READ_RM_REG(mod_no, 96) != 0){ if ((SYSTEM_TICKS - start_ticks) > 400){ DEBUG_EVENT( - "%s: Module %d: Timeout on SLIC calibration (%ld:%ld!\n", - fe->name, mod_no+1,start_ticks,SYSTEM_TICKS); + "%s: Module %d: Timeout on SLIC calibration (%ld:%ld)!\n", + fe->name, mod_no+1, + (unsigned long)start_ticks, + (unsigned long)SYSTEM_TICKS); return -1; } wait_just_a_bit(HZ/10, fast); @@ -852,9 +915,10 @@ static int wp_proslic_manual_calibrate(sdla_fe_t *fe, int mod_no, int fast) DEBUG_RM("%s: Module %d: Calibration is done\n", fe->name, mod_no+1); /*READ_RM_REG(mod_no, 96);*/ - + DEBUG_CFG("%s: ProSLIC manual calibration...Done!\n", fe->name); return 0; } +#endif /* static */ int wp_init_proslic(sdla_fe_t *fe, int mod_no, int fast, int sane) @@ -870,6 +934,7 @@ int wp_init_proslic(sdla_fe_t *fe, int mod_no, int fast, int sane) fe->rm_param.mod[mod_no].u.fxs.idletxhookstate = 1; } + DEBUG_CFG("%s: Start ProSLIC configuration...\n", fe->name); /* Step 8 */ if (!sane && wp_init_proslic_insane(fe, mod_no)){ return -2; @@ -936,13 +1001,15 @@ int wp_init_proslic(sdla_fe_t *fe, int mod_no, int fast, int sane) /* Step 13 */ WRITE_RM_REG(mod_no, 64, 0); - //if (wp_proslic_calibrate(fe, mod_no, fast)){ - // return -1; - //} +#if defined(WAN_REMORA_AUTO_CALIBRATE) + if (wp_proslic_calibrate(fe, mod_no, fast)){ + return -1; + } +#else if (wp_proslic_manual_calibrate(fe, mod_no, fast)){ return -1; } - +#endif /* Perform DC-DC calibration */ WRITE_RM_REG(mod_no, 93, 0x99); wait_just_a_bit(10, fast); @@ -1003,17 +1070,17 @@ int wp_init_proslic(sdla_fe_t *fe, int mod_no, int fast, int sane) WRITE_RM_REG(mod_no, 73, 0x04); if (!strcmp(fxo_modes[fe->fe_cfg.cfg.remora.opermode].name, "AUSTRALIA")) { - value = acim2tiss[fxo_modes[fe->fe_cfg.cfg.remora.opermode].acim]; + value = (unsigned char)acim2tiss[fxo_modes[fe->fe_cfg.cfg.remora.opermode].acim]; WRITE_RM_REG(mod_no, 10, 0x8 | value); if (fxo_modes[fe->fe_cfg.cfg.remora.opermode].ring_osc){ wp_proslic_setreg_indirect( fe, mod_no, 20, - fxo_modes[fe->fe_cfg.cfg.remora.opermode].ring_osc); + (unsigned char)fxo_modes[fe->fe_cfg.cfg.remora.opermode].ring_osc); } if (fxo_modes[fe->fe_cfg.cfg.remora.opermode].ring_x){ wp_proslic_setreg_indirect( fe, mod_no, 21, - fxo_modes[fe->fe_cfg.cfg.remora.opermode].ring_x); + (unsigned char)fxo_modes[fe->fe_cfg.cfg.remora.opermode].ring_x); } } @@ -1046,12 +1113,44 @@ int wp_init_proslic(sdla_fe_t *fe, int mod_no, int fast, int sane) } }else{ if (!strcmp(fxo_modes[fe->fe_cfg.cfg.remora.opermode].name, "AUSTRALIA")) { - WRITE_RM_REG(mod_no, 74, 0x3f); - if (wp_proslic_setreg_indirect(fe, mod_no, 21, 0x1d1)){ - return -1; - } - DEBUG_EVENT("%s: Module %d: Boosting ringer (89V peak)\n", + if (fe->fe_cfg.cfg.remora.fxs_ringampl){ + u16 ringx=0x00; + u8 vbath = 0x00; + switch(fe->fe_cfg.cfg.remora.fxs_ringampl){ + case 47: ringx = 0x163; vbath = 0x31; break; + case 45: ringx = 0x154; vbath = 0x2f; break; + case 40: ringx = 0x12e; vbath = 0x2b; break; + case 35: ringx = 0x108; vbath = 0x26; break; + case 30: ringx = 0xe2; vbath = 0x21; break; + case 25: ringx = 0xbc; vbath = 0x1d; break; + case 20: ringx = 0x97; vbath = 0x1b; break; + case 15: ringx = 0x71; vbath = 0x13; break; + case 10: ringx = 0x4b; vbath = 0x0e; break; + } + if (ringx && vbath){ + DEBUG_EVENT( + "%s: Module %d: Ringing Amplitude %d (RNGX:%04X VBATH:%02X)\n", + fe->name,mod_no+1, fe->fe_cfg.cfg.remora.fxs_ringampl, ringx, vbath); + WRITE_RM_REG(mod_no, 74, vbath); + if (wp_proslic_setreg_indirect(fe, mod_no, 21, ringx)){ + DEBUG_EVENT( + "%s: Module %d: Failed to set RingX value!\n", + fe->name, mod_no+1); + } + + }else{ + DEBUG_EVENT( + "%s: Module %d: Invalid Ringing Amplitude value %d\n", + fe->name, mod_no+1, fe->fe_cfg.cfg.remora.fxs_ringampl); + } + }else{ + WRITE_RM_REG(mod_no, 74, 0x3f); + if (wp_proslic_setreg_indirect(fe, mod_no, 21, 0x1d1)){ + return -1; + } + DEBUG_EVENT("%s: Module %d: Boosting ringer (89V peak)\n", fe->name, mod_no+1); + } } else if (fe->fe_cfg.cfg.remora.fxs_lowpower == WANOPT_YES){ if (wp_proslic_setreg_indirect(fe, mod_no, 21, 0x108)){ return -1; @@ -1162,6 +1261,7 @@ int wp_init_proslic(sdla_fe_t *fe, int mod_no, int fast, int sane) fe->name, mod_no+1, READ_RM_REG(mod_no, 82)*375/1000, READ_RM_REG(mod_no, 83)*375/1000); + DEBUG_CFG("%s: Start ProSLIC configuration...Done!\n", fe->name); return 0; } @@ -1175,7 +1275,7 @@ static int wp_voicedaa_insane(sdla_fe_t *fe, int mod_no) byte = READ_RM_REG(mod_no, 11); DEBUG_TEST("%s: Module %d: VoiceDAA System: %02x\n", fe->name, - mod_no, + mod_no+1, byte & 0xf); return 0; } @@ -1183,8 +1283,8 @@ static int wp_voicedaa_insane(sdla_fe_t *fe, int mod_no) int wp_init_voicedaa(sdla_fe_t *fe, int mod_no, int fast, int sane) { - unsigned char reg16=0, reg26=0, reg30=0, reg31=0; - unsigned long start_ticks; + unsigned char reg16=0, reg26=0, reg30=0, reg31=0; + wan_ticks_t start_ticks; if (!sane && wp_voicedaa_insane(fe, mod_no)){ return -2; @@ -1254,12 +1354,12 @@ int wp_init_voicedaa(sdla_fe_t *fe, int mod_no, int fast, int sane) DEBUG_EVENT( "%s: Module %d: VoiceDAA did not bring up ISO link properly!\n", fe->name, - mod_no); + mod_no+1); return -1; } DEBUG_TEST("%s: Module %d: ISO-Cap is now up, line side: %02x rev %02x\n", fe->name, - mod_no, + mod_no+1, READ_RM_REG(mod_no, 11) >> 4, (READ_RM_REG(mod_no, 13) >> 2) & 0xf); } else { @@ -1273,6 +1373,7 @@ int wp_init_voicedaa(sdla_fe_t *fe, int mod_no, int fast, int sane) WRITE_RM_REG(mod_no, 2, 0x87/*0x84*/); fe->rm_param.mod[mod_no].u.fxo.imask = 0xFF; #else + WRITE_RM_REG(mod_no, 2, 0x04 | 0x03); /* Ring detect mode (begin/end) */ fe->rm_param.mod[mod_no].u.fxo.imask = 0x00; #endif @@ -1325,7 +1426,7 @@ int wp_init_voicedaa(sdla_fe_t *fe, int mod_no, int fast, int sane) if (!strcmp(fxo_modes[fe->fe_cfg.cfg.remora.opermode].name, "NEWZEALAND")) { DEBUG_EVENT("%s: Module %d: Adjusting gain\n", fe->name, - mod_no); + mod_no+1); WRITE_RM_REG(mod_no, 38, 0x7); } @@ -1338,29 +1439,39 @@ int wp_init_voicedaa(sdla_fe_t *fe, int mod_no, int fast, int sane) ** ** OK */ -int wp_remora_iface_init(void *pfe_iface) +int wp_remora_iface_init(void *p_fe, void *pfe_iface) { + sdla_fe_t *fe = (sdla_fe_t*)p_fe; sdla_fe_iface_t *fe_iface = (sdla_fe_iface_t*)pfe_iface; fe_iface->config = &wp_remora_config; fe_iface->unconfig = &wp_remora_unconfig; + fe_iface->post_init = &wp_remora_post_init; + fe_iface->if_config = &wp_remora_if_config; fe_iface->if_unconfig = &wp_remora_if_unconfig; + fe_iface->pre_release = &wp_remora_pre_release; fe_iface->active_map = &wp_remora_active_map; + fe_iface->isr = &wp_remora_intr; fe_iface->disable_irq = &wp_remora_disable_irq; fe_iface->check_isr = &wp_remora_check_intr; + fe_iface->polling = &wp_remora_polling; fe_iface->process_udp = &wp_remora_udp; fe_iface->get_fe_media = &wp_remora_fe_media; + fe_iface->set_dtmf = &wp_remora_set_dtmf; fe_iface->intr_ctrl = &wp_remora_intr_ctrl; + fe_iface->event_ctrl = &wp_remora_event_ctrl; -#if defined(AFT_TDM_API_SUPPORT) +#if defined(AFT_TDM_API_SUPPORT) || defined(AFT_API_SUPPORT) fe_iface->watchdog = &wp_remora_watchdog; #endif + WAN_LIST_INIT(&fe->event); + wan_spin_lock_irq_init(&fe->lockirq, "wan_rm_lock"); return 0; } @@ -1419,10 +1530,6 @@ static int wp_remora_config(void *pfe) fe->rm_param.module_map = 0; fe->rm_param.intcount = 0; fe->rm_param.last_watchdog = SYSTEM_TICKS; - /*Event lock */ - WAN_LIST_INIT(&fe->event); - wan_spin_lock_init(&fe->lock); - if (wp_remora_opermode(fe)){ return -EINVAL; } @@ -1447,19 +1554,10 @@ retry_cfg: if (!(err = wp_init_proslic(fe, mod_no, 0, sane))){ DEBUG_EVENT( "%s: Module %d: Installed -- Auto FXS!\n", - fe->name, - mod_no); + fe->name, mod_no+1); wan_set_bit(mod_no, &fe->rm_param.module_map); fe->rm_param.mod[mod_no].u.fxs.oldrxhook = 1; /* default (off-hook) */ mod_cnt++; -#if 0 - }else{ - DEBUG_EVENT( - "%s: Module %d: FXS failed!\n", - fe->name, - mod_no); - err_cnt++; -#endif } break; @@ -1468,56 +1566,48 @@ retry_cfg: if (!err){ DEBUG_EVENT( "%s: Module %d: Installed -- Auto FXO (%s mode)!\n", - fe->name, - mod_no, + fe->name, mod_no+1, fxo_modes[fe->fe_cfg.cfg.remora.opermode].name); wan_set_bit(mod_no, &fe->rm_param.module_map); mod_cnt++; -#if 0 - }else{ - DEBUG_EVENT( - "%s: Module %d: FXO failed!\n", - fe->name, - mod_no); - err_cnt++; -#endif } break; case MOD_TYPE_TEST: DEBUG_EVENT( "%s: Module %d: Installed -- FXS/FXO tester!\n", - fe->name, - mod_no); + fe->name, mod_no+1); wan_set_bit(mod_no, &fe->rm_param.module_map); + ((sdla_t*)fe->card)->fe_no_intr = 0x1; mod_cnt++; break; default: DEBUG_TDMV("%s: Module %d: Not Installed!\n", - fe->name, - mod_no); + fe->name, mod_no+1); break; } if (err/* && !sane*/){ - sane = 1; - if (retry++ < 10) goto retry_cfg; + if (!sane/*retry++ < 10*/){ + sane = 1; + DEBUG_EVENT("%s: Module %d: Retry configuration...\n", + fe->name, mod_no+1); + goto retry_cfg; + } DEBUG_EVENT("%s: Module %d: %s failed!\n", - fe->name, - mod_no, + fe->name, mod_no+1, WP_REMORA_DECODE_TYPE(fe->rm_param.mod[mod_no].type)); err_cnt++; - }else{ -#if defined(__WINDOWS__) - //FIXME: should be fixed for linux too? - //if not reset to zero, initialization will fail even - //if "retry_cfg" was SUCCESSFUL!! - err_cnt = 0; -#endif } } - if (err_cnt){ - DEBUG_EVENT("%s: %d FXO/FXS module(s) are failed to initialize!\n", +#if 0 + /* NC REMOVED IT TEMPORARILY */ + if (err_cnt && fe->fe_cfg.cfg.remora.relaxcfg != WANOPT_YES){ +#else + if (err_cnt) { +#endif + DEBUG_EVENT( + "%s: %d FXO/FXS module(s) are failed to initialize!\n", fe->name, err_cnt); return -EINVAL; } @@ -1527,9 +1617,15 @@ retry_cfg: #endif if (mod_cnt == 0){ - DEBUG_EVENT("%s: No FXO/FXS modules are found!\n", + if (err_cnt){ + DEBUG_EVENT( + "ERROR: %s: Configuration is failed for all FXO/FXS modules!\n", fe->name); - // return -EINVAL; + }else{ + DEBUG_EVENT("ERROR: %s: No FXO/FXS modules are found!\n", + fe->name); + } + return -EINVAL; } /* Initialize and start T1/E1 timer */ wan_set_bit(WP_RM_TIMER_KILL,(void*)&fe->rm_param.critical); @@ -1574,8 +1670,6 @@ retry_cfg: static int wp_remora_unconfig(void *pfe) { sdla_fe_t *fe = (sdla_fe_t*)pfe; - sdla_fe_timer_event_t *fe_event; - wan_smp_flag_t smp_flags; int mod_no; DEBUG_EVENT("%s: Unconfiguring FXS/FXO Front End...\n", @@ -1586,6 +1680,32 @@ static int wp_remora_unconfig(void *pfe) /* Clear and Kill TE timer poll command */ wan_clear_bit(WP_RM_CONFIGURED,(void*)&fe->rm_param.critical); + + for(mod_no = 0; mod_no < MAX_REMORA_MODULES; mod_no++){ + if (wan_test_bit(mod_no, &fe->rm_param.module_map)) { + wan_clear_bit(mod_no, &fe->rm_param.module_map); + } + } + return 0; +} + +/* + ****************************************************************************** + * sdla_te_pre_release() + * + * Description: T1/E1 pre release routines (not locked). + * Arguments: + * Returns: + ****************************************************************************** + */ +static int wp_remora_pre_release(void* pfe) +{ + sdla_fe_t *fe = (sdla_fe_t*)pfe; + sdla_fe_timer_event_t *fe_event = NULL; + wan_smp_flag_t smp_flags; + int empty = 0; + + /* Kill TE timer poll command */ wan_set_bit(WP_RM_TIMER_KILL,(void*)&fe->rm_param.critical); if (wan_test_bit(WP_RM_TIMER_RUNNING,(void*)&fe->rm_param.critical)){ @@ -1593,19 +1713,20 @@ static int wp_remora_unconfig(void *pfe) } wan_clear_bit(WP_RM_TIMER_RUNNING,(void*)&fe->rm_param.critical); - wan_spin_lock_irq(&fe->lock,&smp_flags); - while(!WAN_LIST_EMPTY(&fe->event)){ - fe_event = WAN_LIST_FIRST(&fe->event); - WAN_LIST_REMOVE(fe_event, next); - if (fe_event) wan_free(fe_event); - } - wan_spin_unlock_irq(&fe->lock,&smp_flags); - - for(mod_no = 0; mod_no < MAX_REMORA_MODULES; mod_no++){ - if (wan_test_bit(mod_no, &fe->rm_param.module_map)) { - wan_clear_bit(mod_no, &fe->rm_param.module_map); + do{ + wan_spin_lock_irq(&fe->lockirq,&smp_flags); + if (!WAN_LIST_EMPTY(&fe->event)){ + fe_event = WAN_LIST_FIRST(&fe->event); + WAN_LIST_REMOVE(fe_event, next); + }else{ + empty = 1; } - } + wan_spin_unlock_irq(&fe->lockirq,&smp_flags); + /* Free should be called not from spin_lock_irq (windows) !!!! */ + if (fe_event) wan_free(fe_event); + fe_event = NULL; + }while(!empty); + return 0; } @@ -1718,7 +1839,7 @@ static int wp_remora_disable_irq(void *pfe) return 0; } -static unsigned int wp_remora_active_map(sdla_fe_t* fe) +static unsigned int wp_remora_active_map(sdla_fe_t* fe, unsigned char not_used) { return fe->rm_param.module_map; } @@ -1749,12 +1870,12 @@ static int wp_remora_set_dtmf(sdla_fe_t *fe, int mod_no, unsigned char val) if (mod_no > MAX_REMORA_MODULES){ DEBUG_EVENT("%s: Module %d: Module number out of range!\n", - fe->name, mod_no); + fe->name, mod_no+1); return -EINVAL; } if (!wan_test_bit(mod_no-1, &fe->rm_param.module_map)){ DEBUG_EVENT("%s: Module %d: Not configures yet!\n", - fe->name, mod_no); + fe->name, mod_no+1); return -EINVAL; } @@ -1784,7 +1905,7 @@ static void wp_remora_timer(unsigned long pfe) wan_smp_flag_t smp_flags; int empty = 1; - DEBUG_RM("%s: RM timer!\n", fe->name); + DEBUG_TEST("%s: RM timer!\n", fe->name); if (wan_test_bit(WP_RM_TIMER_KILL,(void*)&fe->rm_param.critical)){ wan_clear_bit(WP_RM_TIMER_RUNNING,(void*)&fe->rm_param.critical); @@ -1799,9 +1920,9 @@ static void wp_remora_timer(unsigned long pfe) wan_clear_bit(WP_RM_TIMER_RUNNING,(void*)&fe->rm_param.critical); /* Enable hardware interrupt for TE1 */ - wan_spin_lock_irq(&fe->lock,&smp_flags); + wan_spin_lock_irq(&fe->lockirq,&smp_flags); empty = WAN_LIST_EMPTY(&fe->event); - wan_spin_unlock_irq(&fe->lock,&smp_flags); + wan_spin_unlock_irq(&fe->lockirq,&smp_flags); if (!empty){ if (wan_test_and_set_bit(WP_RM_TIMER_EVENT_PENDING,(void*)&fe->rm_param.critical)){ @@ -1814,7 +1935,7 @@ static void wp_remora_timer(unsigned long pfe) wp_remora_polling(fe); } }else{ - sdla_rm_add_timer(fe, 1000); + sdla_rm_add_timer(fe, WP_RM_POLL_TIMER); } return; } @@ -1832,7 +1953,7 @@ static int sdla_rm_add_timer(sdla_fe_t* fe, unsigned long delay) { int err; - DEBUG_RM("%s: Add new RM timer!\n", fe->name); + DEBUG_TEST("%s: Add new RM timer!\n", fe->name); err = wan_add_timer(&fe->timer, delay * HZ / 1000); if (err){ /* Failed to add timer */ @@ -1843,19 +1964,26 @@ static int sdla_rm_add_timer(sdla_fe_t* fe, unsigned long delay) } +/****************************************************************************** +** wp_remora_polling() +** +** Description: +** Arguments: +** Returns: +******************************************************************************/ static int wp_remora_polling(sdla_fe_t* fe) { -#if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) - int err = 0; -#endif sdla_t *card = (sdla_t*)fe->card; + int err = 0; + sdla_fe_timer_event_t *fe_event; + wan_event_t event; wan_smp_flag_t smp_flags; int pending = 0, mod_no = 0; u8 imask; - WAN_ASSERT(fe->write_fe_reg == NULL); - WAN_ASSERT(fe->read_fe_reg == NULL); + WAN_ASSERT_RC(fe->write_fe_reg == NULL,0); + WAN_ASSERT_RC(fe->read_fe_reg == NULL, 0); #if 0 DEBUG_EVENT("%s: %s:%d: ---------------START ----------------------\n", @@ -1864,28 +1992,33 @@ static int wp_remora_polling(sdla_fe_t* fe) DEBUG_EVENT("%s: %s:%d: ---------------STOP ----------------------\n", fe->name, __FUNCTION__,__LINE__); #endif - - wan_spin_lock_irq(&fe->lock,&smp_flags); + wan_spin_lock_irq(&fe->lockirq,&smp_flags); if (WAN_LIST_EMPTY(&fe->event)){ wan_clear_bit(WP_RM_TIMER_EVENT_PENDING,(void*)&fe->rm_param.critical); - wan_spin_unlock_irq(&fe->lock,&smp_flags); + wan_spin_unlock_irq(&fe->lockirq,&smp_flags); DEBUG_EVENT("%s: WARNING: No FE events in a queue!\n", fe->name); - sdla_rm_add_timer(fe, HZ); - return 0; +// sdla_rm_add_timer(fe, HZ); +// return 0; + return HZ; } fe_event = WAN_LIST_FIRST(&fe->event); WAN_LIST_REMOVE(fe_event, next); - wan_spin_unlock_irq(&fe->lock,&smp_flags); - + wan_spin_unlock_irq(&fe->lockirq,&smp_flags); +#if defined(__WINDOWS__) + /* FIXME: Try to make common code for all OS */ + /* poll is NOT locked outside! */ wan_spin_lock_irq(&card->wandev.lock,&smp_flags); +#endif mod_no = fe_event->rm_event.mod_no; - DEBUG_RM("%s: Module %d: RM Polling State=%s Cmd=0x%X!\n", - fe->name, mod_no, + DEBUG_RM("[RM] %s: Module %d: RM Polling State=%s Cmd=%s(%X) Mode=%s!\n", + fe->name, mod_no+1, fe->fe_status==FE_CONNECTED?"Con":"Disconn", - fe_event->type); + WP_RM_POLL_DECODE(fe_event->type), fe_event->type, + WAN_EVENT_MODE_DECODE(fe_event->mode)); + switch(fe_event->type){ case WP_RM_POLL_POWER: @@ -1953,10 +2086,10 @@ static int wp_remora_polling(sdla_fe_t* fe) break; case WP_RM_POLL_TONE: if (fe_event->mode == WAN_EVENT_ENABLE){ - DEBUG_EVENT("%s: Module %d: %s %s events (%d)!\n", - fe->name, mod_no, + DEBUG_RM("%s: Module %d: %s %s events (%d)!\n", + fe->name, mod_no+1, WAN_EVENT_MODE_DECODE(fe_event->mode), - WAN_EVENT_TYPE_DECODE(fe_event->type), + WP_RM_POLL_DECODE(fe_event->type), fe_event->rm_event.tone); switch(fe_event->rm_event.tone){ case WAN_EVENT_TONE_DIAL: @@ -1987,7 +2120,7 @@ static int wp_remora_polling(sdla_fe_t* fe) case WP_RM_POLL_TXSIG_START: if (fe->rm_param.mod[mod_no].type == MOD_TYPE_FXS){ DEBUG_RM("%s: Module %d: txsig START.\n", - fe->name, mod_no); + fe->name, mod_no+1); fe->rm_param.mod[mod_no].u.fxs.lasttxhook = 4; WRITE_RM_REG(mod_no, 64, fe->rm_param.mod[mod_no].u.fxs.lasttxhook); @@ -2068,10 +2201,13 @@ static int wp_remora_polling(sdla_fe_t* fe) /* Can't change polarity while ringing or when open */ if ((fe->rm_param.mod[mod_no].u.fxs.lasttxhook == 0x04) || (fe->rm_param.mod[mod_no].u.fxs.lasttxhook == 0x00)){ -#if defined(__WINDOWS__) +#if 0 /*defined(__WINDOWS__)*/ //done with the event, reset the pointer. fe->rm_param.mod[mod_no].current_control_event_ptr = NULL; + + wan_spin_lock_irq(&card->wandev.lock,&smp_flags); card->event_control_running = 0; + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); #endif break; } @@ -2086,24 +2222,26 @@ static int wp_remora_polling(sdla_fe_t* fe) break; case WP_RM_POLL_RING_DETECT: - imask = READ_RM_REG(mod_no, 3); - if (fe_event->mode == WAN_EVENT_ENABLE){ - imask |= 0x80; - wan_set_bit(WAN_RM_EVENT_RING_DETECT, - &fe->rm_param.mod[mod_no].events); - }else{ - imask &= ~0x80; - wan_clear_bit(WAN_RM_EVENT_RING_DETECT, - &fe->rm_param.mod[mod_no].events); + if (fe->rm_param.mod[mod_no].type == MOD_TYPE_FXO){ + imask = READ_RM_REG(mod_no, 3); + if (fe_event->mode == WAN_EVENT_ENABLE){ + imask |= 0x80; + wan_set_bit(WAN_RM_EVENT_RING_DETECT, + &fe->rm_param.mod[mod_no].events); + }else{ + imask &= ~0x80; + wan_clear_bit(WAN_RM_EVENT_RING_DETECT, + &fe->rm_param.mod[mod_no].events); + } + WRITE_RM_REG(mod_no, 3, imask); } - WRITE_RM_REG(mod_no, 3, imask); break; #if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE) case WP_RM_POLL_TDMV: #if defined(__WINDOWS__) //FIXME: implement - TDM_FUNC_DBG + TDM_FUNC_DBG(); #else WAN_TDMV_CALL(polling, (card), err); #endif @@ -2112,15 +2250,51 @@ static int wp_remora_polling(sdla_fe_t* fe) case WP_RM_POLL_INIT: wp_init_proslic(fe, fe_event->rm_event.mod_no, 1, 1); break; + case WP_RM_POLL_READ: + fe->rm_param.reg_dbg_value = READ_RM_REG(mod_no,fe_event->rm_event.reg); + fe->rm_param.reg_dbg_ready = 1; + DEBUG_RM("%s: Module %d: Reading %s register: Reg[%d]=%02X\n", + fe->name, mod_no+1, + WP_REMORA_DECODE_TYPE(fe->rm_param.mod[mod_no].type), + fe_event->rm_event.reg, + fe->rm_param.reg_dbg_value); + break; + case WP_RM_POLL_WRITE: + DEBUG_RM("%s: Module %d: Writting %s register: Reg[%d]=%02X\n", + fe->name, mod_no+1, + WP_REMORA_DECODE_TYPE(fe->rm_param.mod[mod_no].type), + fe_event->rm_event.reg, + fe_event->rm_event.value); + WRITE_RM_REG(mod_no, fe_event->rm_event.reg, fe_event->rm_event.value); + break; + case WP_RM_POLL_RXSIG_ONHOOK: + event.type = WAN_EVENT_RM_LC; + event.channel = mod_no+1; + event.rxhook = WAN_EVENT_RXHOOK_ON; + if (card->wandev.event_callback.hook){ + card->wandev.event_callback.hook(card, &event); + } + break; + case WP_RM_POLL_RXSIG_OFFHOOK: + event.type = WAN_EVENT_RM_LC; + event.channel = mod_no+1; + event.rxhook = WAN_EVENT_RXHOOK_OFF; + if (card->wandev.event_callback.hook){ + card->wandev.event_callback.hook(card, &event); + } + break; default: DEBUG_EVENT("ERROR: %s: Invalid poll event type %X!\n", fe->name, fe_event->type); break; } - wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); - #if defined(__WINDOWS__) + /* poll is NOT locked outside! */ + wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); +#endif + +#if 0/*defined(__WINDOWS__)*/ //done with the event, reset the pointer. fe->rm_param.mod[mod_no].current_control_event_ptr = NULL; @@ -2139,11 +2313,13 @@ static int wp_remora_polling(sdla_fe_t* fe) /* Add fe timer */ fe_event = WAN_LIST_FIRST(&fe->event); if (fe_event){ - sdla_rm_add_timer(fe, fe_event->delay); +// sdla_rm_add_timer(fe, fe_event->delay); + return fe_event->delay; }else{ - sdla_rm_add_timer(fe, HZ); +// sdla_rm_add_timer(fe, WP_RM_POLL_TIMER); } - return 0; +// return 0; + return WP_RM_POLL_TIMER; } /* @@ -2185,26 +2361,92 @@ sdla_rm_add_event(sdla_fe_t *fe, sdla_fe_timer_event_t *fe_event) DEBUG_EVENT("%s: %s:%d: ---------------STOP ----------------------\n", fe->name, __FUNCTION__,__LINE__); #endif - wan_spin_lock_irq(&fe->lock,&smp_flags); + wan_spin_lock_irq(&fe->lockirq,&smp_flags); if (WAN_LIST_EMPTY(&fe->event)){ WAN_LIST_INSERT_HEAD(&fe->event, event, next); }else{ +#if defined(__WINDOWS__) + /* only one event allowed at a time */ + DEBUG_RM("%s: returning EBUSY\n", + fe->name); + wan_spin_unlock_irq(&fe->lockirq, &smp_flags); + return EBUSY; +#else sdla_fe_timer_event_t *tmp; WAN_LIST_FOREACH(tmp, &fe->event, next){ if (!WAN_LIST_NEXT(tmp, next)) break; } if (tmp == NULL){ DEBUG_EVENT("%s: Internal Error!!!\n", fe->name); - wan_spin_unlock_irq(&fe->lock, &smp_flags); + wan_spin_unlock_irq(&fe->lockirq, &smp_flags); return -EINVAL; } WAN_LIST_INSERT_AFTER(tmp, event, next); +#endif } - wan_spin_unlock_irq(&fe->lock, &smp_flags); + wan_spin_unlock_irq(&fe->lockirq, &smp_flags); return 0; } +/****************************************************************************** +* wp_remora_event_verification() +* +* Description: +* Arguments: mod_no - Module number (1,2,3,... MAX_REMORA_MODULES) +* Returns: +******************************************************************************/ +static int +wp_remora_event_verification(sdla_fe_t *fe, wan_event_ctrl_t *ectrl) +{ + int mod_no = ectrl->mod_no-1; + /* Event verification */ + if (fe->rm_param.mod[mod_no].type == MOD_TYPE_FXS){ + switch(ectrl->type){ + case WAN_EVENT_RM_POWER: + case WAN_EVENT_RM_LC: + case WAN_EVENT_RM_DTMF: + case WAN_EVENT_RM_RING_TRIP: + case WAN_EVENT_RM_RING: + case WAN_EVENT_RM_TONE: + case WAN_EVENT_RM_TXSIG_KEWL: + case WAN_EVENT_RM_TXSIG_START: + case WAN_EVENT_RM_TXSIG_OFFHOOK: + case WAN_EVENT_RM_TXSIG_ONHOOK: + case WAN_EVENT_RM_ONHOOKTRANSFER: + case WAN_EVENT_RM_SETPOLARITY: + break; + default: + DEBUG_EVENT( + "%s: Module %d: Remora RING Event is only valid for FXS module (%X)\n", + fe->name,mod_no+1, + ectrl->type); + return -EINVAL; + } + }else if (fe->rm_param.mod[mod_no].type == MOD_TYPE_FXO){ + switch(ectrl->type){ + case WAN_EVENT_RM_RING_DETECT: + case WAN_EVENT_RM_TXSIG_START: + case WAN_EVENT_RM_TXSIG_OFFHOOK: + case WAN_EVENT_RM_TXSIG_ONHOOK: + break; + default: + DEBUG_EVENT( + "%s: Module %d: Remora RING Event is only valid for FXO module(%X)\n", + fe->name,mod_no+1, + ectrl->type); + return -EINVAL; + } + }else{ + DEBUG_EVENT( + "%s: Module %d: Unknown Module type %X\n", + fe->name,mod_no+1, + fe->rm_param.mod[mod_no].type); + return -EINVAL; + } + + return 0; +} /****************************************************************************** * wp_remora_event_ctrl() * @@ -2216,14 +2458,13 @@ static int wp_remora_event_ctrl(sdla_fe_t *fe, wan_event_ctrl_t *ectrl) { sdla_fe_timer_event_t fe_event; - int mod_no, err = 0; + int mod_no = ectrl->mod_no-1, err = 0; WAN_ASSERT(ectrl == NULL); - mod_no = ectrl->mod_no; - - if (mod_no >= MAX_REMORA_MODULES){ + + if (mod_no+1 > MAX_REMORA_MODULES){ DEBUG_EVENT("%s: Module %d: Module number is out of range!\n", - fe->name, mod_no); + fe->name, mod_no+1); return -EINVAL; } if (!wan_test_bit(mod_no, &fe->rm_param.module_map)) { @@ -2232,12 +2473,18 @@ wp_remora_event_ctrl(sdla_fe_t *fe, wan_event_ctrl_t *ectrl) return -EINVAL; } - DEBUG_RM("%s: Module %d: Scheduling %s event type!\n", - fe->name, mod_no, - WAN_EVENT_TYPE_DECODE(ectrl->type)); + if (wp_remora_event_verification(fe, ectrl)){ + return -EINVAL; + } + + DEBUG_RM("%s: Module %d: Scheduling %s event (%s:%X)!\n", + fe->name, mod_no+1, + WAN_EVENT_TYPE_DECODE(ectrl->type), + WAN_EVENT_MODE_DECODE(ectrl->mode), ectrl->mode); fe_event.mode = ectrl->mode; - fe_event.rm_event.mod_no= ectrl->mod_no; + fe_event.rm_event.mod_no= mod_no; + fe_event.delay = WP_RM_POLL_TIMER; switch(ectrl->type){ case WAN_EVENT_RM_POWER: fe_event.type = WP_RM_POLL_POWER; @@ -2245,15 +2492,18 @@ wp_remora_event_ctrl(sdla_fe_t *fe, wan_event_ctrl_t *ectrl) case WAN_EVENT_RM_LC: fe_event.type = WP_RM_POLL_LC; break; - case WAN_EVENT_RM_RING_TRIP: - fe_event.type = WP_RM_POLL_RING_TRIP; - break; case WAN_EVENT_RM_DTMF: fe_event.type = WP_RM_POLL_DTMF; break; + case WAN_EVENT_RM_RING_TRIP: + fe_event.type = WP_RM_POLL_RING_TRIP; + break; case WAN_EVENT_RM_RING: fe_event.type = WP_RM_POLL_RING; break; + case WAN_EVENT_RM_RING_DETECT: + fe_event.type = WP_RM_POLL_RING_DETECT; + break; case WAN_EVENT_RM_TONE: fe_event.type = WP_RM_POLL_TONE; fe_event.rm_event.tone = ectrl->tone; @@ -2277,16 +2527,7 @@ wp_remora_event_ctrl(sdla_fe_t *fe, wan_event_ctrl_t *ectrl) case WAN_EVENT_RM_SETPOLARITY: fe_event.type = WP_RM_POLL_SETPOLARITY; break; - case WAN_EVENT_RM_RING_DETECT: - fe_event.type = WP_RM_POLL_RING_DETECT; - break; - default: - DEBUG_EVENT("%s: Module %d: Invalid wan event type %X\n", - fe->name,mod_no, - ectrl->type); - return -EINVAL; - } - + } err = sdla_rm_add_event(fe, &fe_event); return err; } @@ -2294,8 +2535,8 @@ wp_remora_event_ctrl(sdla_fe_t *fe, wan_event_ctrl_t *ectrl) static int wp_remora_dialtone(sdla_fe_t *fe, int mod_no) { - DEBUG_EVENT("%s: Module %d: Enable Dial tone\n", - fe->name, mod_no); + DEBUG_RM("%s: Module %d: Enable Dial tone\n", + fe->name, mod_no+1); wp_proslic_setreg_indirect(fe, mod_no, 13,DIALTONE_IR13); wp_proslic_setreg_indirect(fe, mod_no, 14,DIALTONE_IR14); wp_proslic_setreg_indirect(fe, mod_no, 16,DIALTONE_IR16); @@ -2318,8 +2559,8 @@ static int wp_remora_dialtone(sdla_fe_t *fe, int mod_no) static int wp_remora_busytone(sdla_fe_t *fe, int mod_no) { - DEBUG_EVENT("%s: Module %d: Enable Busy tone\n", - fe->name, mod_no); + DEBUG_RM("%s: Module %d: Enable Busy tone\n", + fe->name, mod_no+1); wp_proslic_setreg_indirect(fe, mod_no, 13,BUSYTONE_IR13); wp_proslic_setreg_indirect(fe, mod_no, 14,BUSYTONE_IR14); wp_proslic_setreg_indirect(fe, mod_no, 16,BUSYTONE_IR16); @@ -2342,8 +2583,8 @@ static int wp_remora_busytone(sdla_fe_t *fe, int mod_no) static int wp_remora_ringtone(sdla_fe_t *fe, int mod_no) { - DEBUG_EVENT("%s: Module %d: Enable Ring tone\n", - fe->name, mod_no); + DEBUG_RM("%s: Module %d: Enable Ring tone\n", + fe->name, mod_no+1); wp_proslic_setreg_indirect(fe, mod_no, 13,RINGBACKTONE_IR13); wp_proslic_setreg_indirect(fe, mod_no, 14,RINGBACKTONE_IR14); wp_proslic_setreg_indirect(fe, mod_no, 16,RINGBACKTONE_IR16); @@ -2366,8 +2607,8 @@ static int wp_remora_ringtone(sdla_fe_t *fe, int mod_no) static int wp_remora_congestiontone(sdla_fe_t *fe, int mod_no) { - DEBUG_EVENT("%s: Module %d: Enable Congestion tone\n", - fe->name, mod_no); + DEBUG_RM("%s: Module %d: Enable Congestion tone\n", + fe->name, mod_no+1); wp_proslic_setreg_indirect(fe, mod_no, 13,CONGESTIONTONE_IR13); wp_proslic_setreg_indirect(fe, mod_no, 14,CONGESTIONTONE_IR14); wp_proslic_setreg_indirect(fe, mod_no, 16,CONGESTIONTONE_IR16); @@ -2469,27 +2710,42 @@ static int wp_remora_stats_voltage(sdla_fe_t* fe, unsigned char *data) */ static int wp_remora_udp(sdla_fe_t *fe, void* p_udp_cmd, unsigned char* data) { - wan_cmd_t *udp_cmd = (wan_cmd_t*)p_udp_cmd; - sdla_fe_debug_t *fe_debug; - int err = -EINVAL; + wan_cmd_t *udp_cmd = (wan_cmd_t*)p_udp_cmd; + sdla_fe_debug_t *fe_debug; + sdla_fe_timer_event_t event; + int err = -EINVAL; + memset(&event, 0, sizeof(sdla_fe_timer_event_t)); switch(udp_cmd->wan_cmd_command){ -#if 0 -/* FIXME: Update wanpipemon to use API ioctl call */ case WAN_FE_TONES: - fe->rm_param.timer_mod_no = data[0]; - wp_remora_enable_timer(fe, WP_RM_POLL_TONE_DIAL, WP_RM_POLL_TIMER); + event.type = WP_RM_POLL_TONE; + event.rm_event.mod_no = data[0]; + if (data[1]){ + event.mode = WAN_EVENT_ENABLE; + }else{ + event.mode = WAN_EVENT_DISABLE; + } + event.rm_event.tone = WAN_EVENT_TONE_DIAL; + event.delay = WP_RM_POLL_TIMER; + sdla_rm_add_event(fe, &event); udp_cmd->wan_cmd_return_code = WAN_CMD_OK; - udp_cmd->wan_cmd_data_len = 0; break; case WAN_FE_RING: - fe->rm_param.timer_mod_no = data[0]; - wp_remora_enable_timer(fe, WP_RM_POLL_RING, WP_RM_POLL_TIMER); + event.type = WP_RM_POLL_RING; + event.mode = WAN_EVENT_ENABLE; + + event.rm_event.mod_no = data[0]; + if (data[1]){ + event.mode = WAN_EVENT_ENABLE; + }else{ + event.mode = WAN_EVENT_DISABLE; + } + event.delay = WP_RM_POLL_TIMER; + sdla_rm_add_event(fe, &event); udp_cmd->wan_cmd_return_code = WAN_CMD_OK; - udp_cmd->wan_cmd_data_len = 0; break; -#endif + case WAN_FE_REGDUMP: err = wp_remora_regdump(fe, data); if (err){ @@ -2500,33 +2756,6 @@ static int wp_remora_udp(sdla_fe_t *fe, void* p_udp_cmd, unsigned char* data) case WAN_FE_STATS: err = wp_remora_stats_voltage(fe, data); -#if 0 - /* verify TIP/RING voltage */ - if (!fast){ - WRITE_RM_REG(mod_no, 8, 0x2); - wait_just_a_bit(HZ, fast); - start_ticks = SYSTEM_TICKS; - while(READ_RM_REG(mod_no, 81) < 0x75){ - if ((SYSTEM_TICKS - start_ticks) > HZ*10){ - break; - } - wait_just_a_bit(HZ, fast); - } - wait_just_a_bit(HZ, fast); - if (READ_RM_REG(mod_no, 81) < 0x75){ - if (sane){ - DEBUG_EVENT( - "%s: Module %d: TIP/RING is too low on FXS %d!\n", - fe->name, - mod_no, - READ_RM_REG(mod_no, 81) * 375 / 1000); - } - WRITE_RM_REG(mod_no, 8, 0x0); - return -1; - } - WRITE_RM_REG(mod_no, 8, 0x0); - } -#endif if (err){ udp_cmd->wan_cmd_return_code = WAN_CMD_OK; udp_cmd->wan_cmd_data_len = (unsigned short)err; @@ -2535,13 +2764,45 @@ static int wp_remora_udp(sdla_fe_t *fe, void* p_udp_cmd, unsigned char* data) case WAN_FE_SET_DEBUG_MODE: fe_debug = (sdla_fe_debug_t*)&data[0]; -#if 0 switch(fe_debug->type){ - case WAN_FE_DEBUG_VOLTAGE: - /* FIXME: Add code */ + case WAN_FE_DEBUG_REG: + if (fe->rm_param.reg_dbg_busy){ + if (fe_debug->fe_debug_reg.read == 2 && fe->rm_param.reg_dbg_ready){ + /* Poll the register value */ + fe_debug->fe_debug_reg.value = fe->rm_param.reg_dbg_value; + udp_cmd->wan_cmd_return_code = WAN_CMD_OK; + fe->rm_param.reg_dbg_busy = 0; + } + break; + } + event.type = (fe_debug->fe_debug_reg.read) ? + WP_RM_POLL_READ : WP_RM_POLL_WRITE; + event.rm_event.mod_no = fe_debug->mod_no; + event.rm_event.reg = (u_int16_t)fe_debug->fe_debug_reg.reg; + event.rm_event.value = fe_debug->fe_debug_reg.value; + event.delay = WP_RM_POLL_TIMER; + if (fe_debug->fe_debug_reg.read){ + fe->rm_param.reg_dbg_busy = 1; + fe->rm_param.reg_dbg_ready = 0; + } + sdla_rm_add_event(fe, &event); + udp_cmd->wan_cmd_return_code = WAN_CMD_OK; + break; + + case WAN_FE_DEBUG_HOOK: + event.type = (fe_debug->fe_debug_hook.offhook) ? + WP_RM_POLL_RXSIG_OFFHOOK: + WP_RM_POLL_RXSIG_ONHOOK; + event.rm_event.mod_no = fe_debug->mod_no; + sdla_rm_add_event(fe, &event); + udp_cmd->wan_cmd_return_code = WAN_CMD_OK; + break; + + default: + udp_cmd->wan_cmd_return_code = WAN_UDP_INVALID_CMD; + udp_cmd->wan_cmd_data_len = 0; break; } -#endif break; default: @@ -2564,7 +2825,7 @@ static int wp_init_proslic_recheck_sanity(sdla_fe_t *fe, int mod_no) sdla_fe_timer_event_t event; DEBUG_EVENT( "%s: Module %d: Ouch, part reset, quickly restoring reality\n", - fe->name, mod_no); + fe->name, mod_no+1); event.type = WP_RM_POLL_INIT; event.delay = WP_RM_POLL_TIMER; event.rm_event.mod_no = mod_no; @@ -2592,9 +2853,12 @@ static int wp_init_proslic_recheck_sanity(sdla_fe_t *fe, int mod_no) return 0; } -#if defined(AFT_TDM_API_SUPPORT) +#if defined(AFT_TDM_API_SUPPORT) || defined(AFT_API_SUPPORT) static void wp_remora_voicedaa_check_hook(sdla_fe_t *fe, int mod_no) { +//#undef DEBUG_RM +//#define DEBUG_RM DEBUG_EVENT + sdla_t *card = NULL; wan_event_t event; #ifndef AUDIO_RINGCHECK @@ -2626,11 +2890,12 @@ static void wp_remora_voicedaa_check_hook(sdla_fe_t *fe, int mod_no) } if (poopy) return; + #ifndef AUDIO_RINGCHECK if (!fe->rm_param.mod[mod_no].u.fxo.offhook) { res = READ_RM_REG(mod_no, 5); if ((res & 0x60) && fe->rm_param.mod[mod_no].u.fxo.battery) { - fe->rm_param.mod[mod_no].u.fxo.ringdebounce += (WP_RM_CHUNKSIZE * 16); + fe->rm_param.mod[mod_no].u.fxo.ringdebounce += (WP_RM_CHUNKSIZE * 4); if (fe->rm_param.mod[mod_no].u.fxo.ringdebounce >= WP_RM_CHUNKSIZE * 64) { if (!fe->rm_param.mod[mod_no].u.fxo.wasringing) { fe->rm_param.mod[mod_no].u.fxo.wasringing = 1; @@ -2648,7 +2913,7 @@ static void wp_remora_voicedaa_check_hook(sdla_fe_t *fe, int mod_no) fe->rm_param.mod[mod_no].u.fxo.ringdebounce = WP_RM_CHUNKSIZE * 64; } } else { - fe->rm_param.mod[mod_no].u.fxo.ringdebounce -= WP_RM_CHUNKSIZE * 4; + fe->rm_param.mod[mod_no].u.fxo.ringdebounce -= WP_RM_CHUNKSIZE * 2; if (fe->rm_param.mod[mod_no].u.fxo.ringdebounce <= 0) { if (fe->rm_param.mod[mod_no].u.fxo.wasringing) { fe->rm_param.mod[mod_no].u.fxo.wasringing = 0; @@ -2700,6 +2965,9 @@ static void wp_remora_voicedaa_check_hook(sdla_fe_t *fe, int mod_no) #endif } #else + DEBUG_RM("%s: Module %d: On-Hook status!\n", + fe->name, + mod_no + 1); event.type = WAN_EVENT_RM_LC; event.channel = mod_no+1; event.rxhook = WAN_EVENT_RXHOOK_ON; @@ -2710,7 +2978,9 @@ static void wp_remora_voicedaa_check_hook(sdla_fe_t *fe, int mod_no) fe->rm_param.mod[mod_no].u.fxo.battdebounce = battdebounce; } else if (!fe->rm_param.mod[mod_no].u.fxo.battery) fe->rm_param.mod[mod_no].u.fxo.battdebounce = battdebounce; + } else if (abs(b) > battthresh) { + if (!fe->rm_param.mod[mod_no].u.fxo.battery && !fe->rm_param.mod[mod_no].u.fxo.battdebounce) { DEBUG_RM("%s: Module %d: BATTERY (%s)!\n", @@ -2771,12 +3041,11 @@ static void wp_remora_voicedaa_check_hook(sdla_fe_t *fe, int mod_no) if (fe->rm_param.mod[mod_no].u.fxo.lastpol != fe->rm_param.mod[mod_no].u.fxo.polarity) { DEBUG_RM( - "%s: Module %d: %lu Polarity reversed (%d -> %d)\n", - fe->name, - mod_no + 1, - SYSTEM_TICKS, + "%s: Module %d: Polarity reversed (%d -> %d) (%ul)\n", + fe->name, mod_no + 1, fe->rm_param.mod[mod_no].u.fxo.polarity, - fe->rm_param.mod[mod_no].u.fxo.lastpol); + fe->rm_param.mod[mod_no].u.fxo.lastpol, + (unsigned int)SYSTEM_TICKS); if (fe->rm_param.mod[mod_no].u.fxo.polarity){ /* FIXME: Add revers polarity event */ } @@ -2786,6 +3055,8 @@ static void wp_remora_voicedaa_check_hook(sdla_fe_t *fe, int mod_no) } } return; +//#undef DEBUG_RM +//#define DEBUG_RM DEBUG_TEST } #endif @@ -2866,7 +3137,7 @@ static void wp_remora_proslic_check_hook(sdla_fe_t *fe, int mod_no) #endif #endif -#if defined(AFT_TDM_API_SUPPORT) +#if defined(AFT_TDM_API_SUPPORT) || defined(AFT_API_SUPPORT) /****************************************************************************** * wp_remora_watchdog() * @@ -2877,11 +3148,7 @@ static void wp_remora_proslic_check_hook(sdla_fe_t *fe, int mod_no) static int wp_remora_watchdog(sdla_fe_t *fe) { int mod_no; - - if (SYSTEM_TICKS - fe->rm_param.last_watchdog < WP_RM_WATCHDOG_TIMEOUT) { - return 0; - } - fe->rm_param.last_watchdog = SYSTEM_TICKS; + for (mod_no = 0; mod_no < fe->rm_param.max_fe_channels; mod_no++) { if (!wan_test_bit(mod_no, &fe->rm_param.module_map)) { @@ -2950,9 +3217,14 @@ static int wp_remora_watchdog(sdla_fe_t *fe) wp_remora_voicedaa_check_hook(fe, mod_no); } } + #if defined(AFT_RM_VIRTUAL_INTR_SUPPORT) - if (wp_remora_check_intr(fe)){ - wp_remora_intr(fe); + if (SYSTEM_TICKS - fe->rm_param.last_watchdog > WP_RM_WATCHDOG_TIMEOUT) { + fe->rm_param.last_watchdog = SYSTEM_TICKS; + + if (wp_remora_check_intr(fe)){ + wp_remora_intr(fe); + } } #endif @@ -2975,17 +3247,18 @@ wp_remora_intr_ctrl(sdla_fe_t *fe, int mod_no, u_int8_t type, u_int8_t mode, uns if (mod_no >= MAX_REMORA_MODULES){ DEBUG_EVENT( "%s: Module %d: Module number is out of range!\n", - fe->name, mod_no); + fe->name, mod_no+1); return -EINVAL; } if (!wan_test_bit(mod_no, &fe->rm_param.module_map)) { DEBUG_EVENT("%s: Module %d: Unconfigured module!\n", - fe->name, mod_no); + fe->name, mod_no+1); return -EINVAL; } if (fe->rm_param.mod[mod_no].type == MOD_TYPE_FXS){ - if (type & WAN_RM_INTR_GLOBAL){ + switch(type){ + case WAN_RM_INTR_GLOBAL: if (mode == WAN_FE_INTR_ENABLE){ WRITE_RM_REG(mod_no, 21, fe->rm_param.mod[mod_no].u.fxs.imask1); WRITE_RM_REG(mod_no, 22, fe->rm_param.mod[mod_no].u.fxs.imask2); @@ -2995,16 +3268,30 @@ wp_remora_intr_ctrl(sdla_fe_t *fe, int mod_no, u_int8_t type, u_int8_t mode, uns WRITE_RM_REG(mod_no, 22, 0x00); WRITE_RM_REG(mod_no, 23, 0x00); } + break; + default: + DEBUG_EVENT( + "%s: Module %d: Unsupported FXS interrupt type (%X)!\n", + fe->name, mod_no+1, type); + err = -EINVAL; + break; } }else if (fe->rm_param.mod[mod_no].type == MOD_TYPE_FXO){ - - if (type & WAN_RM_INTR_GLOBAL){ + switch(type){ + case WAN_RM_INTR_GLOBAL: if (mode == WAN_FE_INTR_ENABLE){ WRITE_RM_REG(mod_no, 3, fe->rm_param.mod[mod_no].u.fxo.imask); }else{ WRITE_RM_REG(mod_no, 3, 0x00); } + break; + default: + DEBUG_EVENT( + "%s: Module %d: Unsupported FXO interrupt type (%X)!\n", + fe->name, mod_no+1, type); + err = -EINVAL; + break; } } return err; @@ -3025,7 +3312,7 @@ static int wp_remora_check_intr_fxs(sdla_fe_t *fe, int mod_no) int err = 0; DEBUG_EVENT( "%s: Module %d: Oops, part reset, quickly restoring reality\n", - fe->name, mod_no); + fe->name, mod_no+1); #if 0 wp_init_proslic(fe, mod_no, 1, 1); #else @@ -3050,7 +3337,6 @@ static int wp_remora_check_intr_fxo(sdla_fe_t *fe, int mod_no) u_int8_t status; status = READ_RM_REG(mod_no, 4); - return (status) ? 1 : 0; } @@ -3059,8 +3345,6 @@ static int wp_remora_check_intr(sdla_fe_t *fe) int mod_no = 0, pending = 0; fe->rm_param.intcount++; - //mod_no = fe->rm_param.intcount % MAX_REMORA_MODULES; - for(mod_no = 0; mod_no < MAX_REMORA_MODULES; mod_no++){ if (wan_test_bit(mod_no, &fe->rm_param.module_map)) { if (fe->rm_param.mod[mod_no].type == MOD_TYPE_FXS){ @@ -3137,8 +3421,6 @@ static int wp_remora_intr_fxs(sdla_fe_t *fe, int mod_no) WAN_ASSERT(fe->card == NULL); card = fe->card; - DEBUG_TDMAPI("mod_no: %d\n", mod_no); - stat1 = READ_RM_REG(mod_no, 18); if (stat1){ /* Ack interrupts for now */ @@ -3152,7 +3434,7 @@ static int wp_remora_intr_fxs(sdla_fe_t *fe, int mod_no) if (stat2 & 0x02){ DEBUG_RM( "%s: Module %d: LCIP interrupt pending!\n", - fe->name, mod_no); + fe->name, mod_no+1); #if 0 if (card->wandev.fe_notify_iface.hook_state){ card->wandev.fe_notify_iface.hook_state( @@ -3164,13 +3446,13 @@ static int wp_remora_intr_fxs(sdla_fe_t *fe, int mod_no) if (status & 0x01){ DEBUG_RM( "RM: %s: Module %d: Off-hook status!\n", - fe->name, mod_no); + fe->name, mod_no+1); fe->rm_param.mod[mod_no].u.fxs.oldrxhook = 1; event.rxhook = WAN_EVENT_RXHOOK_OFF; }else/* if (fe->rm_param.mod[mod_no].u.fxs.oldrxhook)*/{ DEBUG_RM( "RM: %s: Module %d: On-hook status!\n", - fe->name, mod_no); + fe->name, mod_no+1); fe->rm_param.mod[mod_no].u.fxs.oldrxhook = 0; event.rxhook = WAN_EVENT_RXHOOK_ON; } @@ -3183,7 +3465,7 @@ static int wp_remora_intr_fxs(sdla_fe_t *fe, int mod_no) if (stat2 & 0x01){ DEBUG_RM( "%s: Module %d: Ring TRIP interrupt pending!\n", - fe->name, mod_no); + fe->name, mod_no+1); #if 0 if (card->wandev.fe_notify_iface.hook_state){ card->wandev.fe_notify_iface.hook_state( @@ -3201,27 +3483,51 @@ static int wp_remora_intr_fxs(sdla_fe_t *fe, int mod_no) if (status & 0x02){ DEBUG_RM( "%s: Module %d: Ring Trip detect occured!\n", - fe->name, mod_no); - event.rxhook = WAN_EVENT_RING_TRIP_PRESENT; + fe->name, mod_no+1); + event.ring_mode = WAN_EVENT_RING_TRIP_PRESENT; }else{ DEBUG_RM( "%s: Module %d: Ring Trip detect not occured!\n", - fe->name, mod_no); - event.rxhook = WAN_EVENT_RING_TRIP_STOP; + fe->name, mod_no+1); + event.ring_mode = WAN_EVENT_RING_TRIP_STOP; } if (card->wandev.event_callback.ringtrip){ card->wandev.event_callback.ringtrip(card, &event); } } + if (stat2 & 0x80) { + DEBUG_EVENT("%s: Module %d: Power Alarm Q6!\n", + fe->name, mod_no+1); + } + if (stat2 & 0x40) { + DEBUG_EVENT("%s: Module %d: Power Alarm Q5!\n", + fe->name, mod_no+1); + } + if (stat2 & 0x20) { + DEBUG_EVENT("%s: Module %d: Power Alarm Q4!\n", + fe->name, mod_no+1); + } + if (stat2 & 0x10) { + DEBUG_EVENT("%s: Module %d: Power Alarm Q3!\n", + fe->name, mod_no+1); + } + if (stat2 & 0x08) { + DEBUG_EVENT("%s: Module %d: Power Alarm Q2!\n", + fe->name, mod_no+1); + } + if (stat2 & 0x04) { + DEBUG_EVENT("%s: Module %d: Power Alarm Q1!\n", + fe->name, mod_no+1); + } DEBUG_RM( "%s: Module %d: Reg[64]=%02X Reg[68]=%02X\n", - fe->name, mod_no, + fe->name, mod_no+1, READ_RM_REG(mod_no,64), status); WRITE_RM_REG(mod_no, 19, stat2); }else{ #if defined(__WINDOWS__) - TDM_FUNC_DBG + TDM_FUNC_DBG(); #endif } @@ -3257,27 +3563,33 @@ static int wp_remora_intr_fxo(sdla_fe_t *fe, int mod_no) fe->name, mod_no+1); fe->rm_param.mod[mod_no].u.fxo.ring_detect = 0; event.ring_mode = WAN_EVENT_RING_STOP; - }else{ + } else { DEBUG_RM( "%s: Module %d: Beginning of ring burst\n", fe->name, mod_no+1); fe->rm_param.mod[mod_no].u.fxo.ring_detect = 1; event.ring_mode = WAN_EVENT_RING_PRESENT; } - }else{ + } else { DEBUG_RM( "%s: Module %d: Beginning of ring burst\n", fe->name, mod_no+1); fe->rm_param.mod[mod_no].u.fxo.ring_detect = 1; event.ring_mode = WAN_EVENT_RING_PRESENT; } +#ifdef AUDIO_RINGCHECK +/* If audio ringcheck is enabled, we use this code + * if disabled we use the check_hook code. + * Right now we use the check_hook code because + * this code does not have debounce */ if (card->wandev.event_callback.ringdetect){ card->wandev.event_callback.ringdetect(card, &event); - } - }else if (status){ - DEBUG_RM( - "%s: Module %d: Receive interrupt %02X!\n", - fe->name, mod_no+1, status); + } +#endif + } + if (status & 0x01){ + DEBUG_RM("%s: Module %d: Polarity reversed!\n", + fe->name, mod_no+1); } WRITE_RM_REG(mod_no, 4, 0x00); diff --git a/patches/kdrivers/src/net/sdla_remora_tdmv.c b/patches/kdrivers/src/net/sdla_remora_tdmv.c index f1ab4bd..e555af1 100644 --- a/patches/kdrivers/src/net/sdla_remora_tdmv.c +++ b/patches/kdrivers/src/net/sdla_remora_tdmv.c @@ -25,15 +25,15 @@ # include # include # include +# include # include # include -#elif (defined __WINDOWS__) -# include #else # include # include # include # include +# include # include #endif @@ -42,6 +42,7 @@ *******************************************************************************/ #define REG_SHADOW #define REG_WRITE_SHADOW +#define NEW_PULSE_DIALING #undef PULSE_DIALING #if 0 @@ -115,8 +116,8 @@ typedef struct wp_tdmv_remora_ { char *devname; int num; int flags; - wan_spinlock_t lock; - wan_spinlock_t tx_rx_lock; + wan_spinlock_t lockirq; + wan_spinlock_t tx_rx_lockirq; union { tdmv_fxo_t fxo; tdmv_fxs_t fxs; @@ -146,11 +147,9 @@ typedef struct wp_tdmv_remora_ { int channelized; unsigned char hwec; unsigned long echo_off_map; - int rxsig_state[MAX_REMORA_MODULES]; - int txsig_state[MAX_REMORA_MODULES]; /* not used */ - int battdebounce; - int battthresh; + int battdebounce; /* global for FXO */ + int battthresh; /* global for FXO */ u_int8_t dtmfsupport; unsigned int dtmfactive; @@ -202,6 +201,7 @@ wp_remora_zap_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) wp_tdmv_remora_t *wr = chan->pvt; sdla_t *card = NULL; sdla_fe_t *fe = NULL; + wan_event_ctrl_t *event_ctrl = NULL; int x, err; WAN_ASSERT(wr->card == NULL); @@ -276,7 +276,7 @@ wp_remora_zap_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) wr->mod[chan->chanpos-1].fxo.echotune = 1; #else DEBUG_EVENT("%s: Module %d: Setting echo registers: \n", - fe->name, chan->chanpos-1); + wr->devname, chan->chanpos-1); /* Set the ACIM register */ WRITE_RM_REG(chan->chanpos - 1, 30, echoregs.acim); @@ -291,7 +291,7 @@ wp_remora_zap_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) WRITE_RM_REG(chan->chanpos - 1, 52, echoregs.coef8); DEBUG_EVENT("%s: Module %d: Set echo registers successfully\n", - fe->name, chan->chanpos-1); + wr->devname, chan->chanpos-1); #endif break; } else { @@ -300,33 +300,49 @@ wp_remora_zap_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) } break; - case ZT_TONEDETECT: - err = WAN_COPY_FROM_USER(&x, (int*)data, sizeof(int)); - /*err = get_user(x, (int *)data);*/ - if (err) return -EFAULT; -#if 0 + if (WAN_COPY_FROM_USER(&x, (int*)data, sizeof(int))){ + return -EFAULT; + } - if (!wc->vpm) - return -ENOSYS; -#endif - if (wr->dtmfsupport != WANOPT_YES){ + if (wr->dtmfsupport != WANOPT_YES || card->wandev.ec_dev == NULL){ return -ENOSYS; } - DEBUG_EVENT("%s: Hardware Tone Event detection (%s:%s)!\n", - fe->name, - (x & ZT_TONEDETECT_ON) ? "ON" : "OFF", + DEBUG_TDMV("[TDMV_RM]: %s: HW Tone Detection %s on channel %d (%s)!\n", + wr->devname, + (x & ZT_TONEDETECT_ON) ? "ON" : "OFF", chan->chanpos - 1, (x & ZT_TONEDETECT_MUTE) ? "Mute ON" : "Mute OFF"); - if (x & ZT_TONEDETECT_ON) + if (x & ZT_TONEDETECT_ON){ wr->dtmfmask |= (1 << (chan->chanpos - 1)); - else + }else{ wr->dtmfmask &= ~(1 << (chan->chanpos - 1)); - if (x & ZT_TONEDETECT_MUTE) + } + if (x & ZT_TONEDETECT_MUTE){ wr->dtmfmutemask |= (1 << (chan->chanpos - 1)); - else + }else{ wr->dtmfmutemask &= ~(1 << (chan->chanpos - 1)); + } + +#if defined(CONFIG_WANPIPE_HWEC) + event_ctrl = wan_malloc(sizeof(wan_event_ctrl_t)); + if (event_ctrl==NULL){ + DEBUG_EVENT( + "%s: Failed to allocate memory for event ctrl!\n", + wr->devname); + return -EFAULT; + } + event_ctrl->type = WAN_EVENT_EC_CHAN_MODIFY; + event_ctrl->channel = chan->chanpos-1; + event_ctrl->mode = (x & ZT_TONEDETECT_MUTE) ? WAN_EVENT_ENABLE : WAN_EVENT_DISABLE; + if (wanpipe_ec_event_ctrl(card->wandev.ec_dev, card, event_ctrl)){ + wan_free(event_ctrl); + } + err = 0; +#else + err = -EINVAL; +#endif break; default: @@ -490,7 +506,7 @@ static int wp_remora_zap_hwec(struct zt_chan *chan, int enable) { wp_tdmv_remora_t *wr = NULL; sdla_t *card = NULL; - int channel = chan->chanpos; + int fe_chan = chan->chanpos; int err = -ENODEV; WAN_ASSERT2(chan == NULL, -ENODEV); @@ -506,7 +522,7 @@ static int wp_remora_zap_hwec(struct zt_chan *chan, int enable) * asterisk. In persist mode off asterisk * controls hardware echo cancellation */ if (card->hwec_conf.persist_disable) { - err = card->wandev.ec_enable(card, enable, channel-1); + err = card->wandev.ec_enable(card, enable, fe_chan); } else { err = 0; } @@ -558,7 +574,7 @@ static void wp_tdmv_remora_proslic_recheck_sanity(wp_tdmv_remora_t *wr, int mod_ if (res) { DEBUG_EVENT( "%s: Module %d: Ouch, part reset, quickly restoring reality\n", - wr->devname, mod_no); + wr->devname, mod_no+1); wp_init_proslic(fe, mod_no, 1, 1); } else { if (wr->mod[mod_no].fxs.palarms++ < MAX_ALARMS) { @@ -599,7 +615,7 @@ wp_tdmv_remora_voicedaa_recheck_sanity(wp_tdmv_remora_t *wr, int mod_no) if (!res) { DEBUG_EVENT( "%s: Module %d: Ouch, part reset, quickly restoring reality\n", - wr->devname, mod_no); + wr->devname, mod_no+1); wp_init_voicedaa(fe, mod_no, 1, 1); } return; @@ -655,7 +671,6 @@ static void wp_tdmv_remora_voicedaa_check_hook(wp_tdmv_remora_t *wr, int mod_no) if (wr->mod[mod_no].fxo.ringdebounce >= ZT_CHUNKSIZE * 64) { if (!wr->mod[mod_no].fxo.wasringing) { wr->mod[mod_no].fxo.wasringing = 1; - wr->rxsig_state[mod_no] = ZT_RXSIG_RING; zt_hooksig(&wr->chans[mod_no], ZT_RXSIG_RING); DEBUG_TDMV("%s: Module %d: RING on span %d!\n", wr->devname, @@ -669,7 +684,6 @@ static void wp_tdmv_remora_voicedaa_check_hook(wp_tdmv_remora_t *wr, int mod_no) if (wr->mod[mod_no].fxo.ringdebounce <= 0) { if (wr->mod[mod_no].fxo.wasringing) { wr->mod[mod_no].fxo.wasringing = 0; - wr->rxsig_state[mod_no] = ZT_RXSIG_OFFHOOK; zt_hooksig(&wr->chans[mod_no], ZT_RXSIG_OFFHOOK); DEBUG_TDMV("%s: Module %d: NO RING on span %d!\n", wr->devname, @@ -700,7 +714,8 @@ static void wp_tdmv_remora_voicedaa_check_hook(wp_tdmv_remora_t *wr, int mod_no) wr->mod[mod_no].fxo.nobatttimer++; #if 0 if (wr->mod[mod_no].fxo.battery) - printk("Battery loss: %d (%d debounce)\n", b, wr->mod[mod_no].fxo.battdebounce); + printk("Battery loss: %d (%d debounce)\n", + b, wr->mod[mod_no].fxo.battdebounce); #endif if (wr->mod[mod_no].fxo.battery && !wr->mod[mod_no].fxo.battdebounce) { DEBUG_TDMV( @@ -712,7 +727,6 @@ static void wp_tdmv_remora_voicedaa_check_hook(wp_tdmv_remora_t *wr, int mod_no) #ifdef JAPAN if ((!wr->mod[mod_no].fxo.ohdebounce) && wr->mod[mod_no].fxo.offhook) { - wr->rxsig_state[mod_no] = ZT_RXSIG_ONHOOK; zt_hooksig(&wr->chans[mod_no], ZT_RXSIG_ONHOOK); DEBUG_TDMV( "%s: Module %d: Signalled On Hook span %d\n", @@ -745,7 +759,6 @@ static void wp_tdmv_remora_voicedaa_check_hook(wp_tdmv_remora_t *wr, int mod_no) #ifdef ZERO_BATT_RING if (wr->mod[mod_no].fxo.onhook) { wr->mod[mod_no].fxo.onhook = 0; - wr->rxsig_state[mod_no] = ZT_RXSIG_OFFHOOK; zt_hooksig(&wr->chans[mod_no], ZT_RXSIG_OFFHOOK); DEBUG_TDMV( "%s: Module %d: Signalled Off Hook span %d\n", @@ -754,13 +767,12 @@ static void wp_tdmv_remora_voicedaa_check_hook(wp_tdmv_remora_t *wr, int mod_no) wr->span.spanno); } #else + zt_hooksig(&wr->chans[mod_no], ZT_RXSIG_OFFHOOK); DEBUG_TDMV( "%s: Module %d: Signalled Off Hook span %d\n", wr->devname, mod_no + 1, wr->span.spanno); - wr->rxsig_state[mod_no] = ZT_RXSIG_OFFHOOK; - zt_hooksig(&wr->chans[mod_no], ZT_RXSIG_OFFHOOK); #endif wr->mod[mod_no].fxo.battery = 1; wr->mod[mod_no].fxo.nobatttimer = 0; @@ -784,6 +796,7 @@ static void wp_tdmv_remora_voicedaa_check_hook(wp_tdmv_remora_t *wr, int mod_no) /* It's something else... */ wr->mod[mod_no].fxo.battdebounce = wr->battdebounce; } + if (wr->mod[mod_no].fxo.battdebounce) wr->mod[mod_no].fxo.battdebounce--; if (wr->mod[mod_no].fxo.polaritydebounce) { @@ -791,12 +804,12 @@ static void wp_tdmv_remora_voicedaa_check_hook(wp_tdmv_remora_t *wr, int mod_no) if (wr->mod[mod_no].fxo.polaritydebounce < 1) { if (wr->mod[mod_no].fxo.lastpol != wr->mod[mod_no].fxo.polarity) { DEBUG_TDMV( - "%s: Module %d: Polarity reversed %d -> %d (%lu)\n", + "%s: Module %d: Polarity reversed %d -> %d (%u)\n", wr->devname, mod_no + 1, wr->mod[mod_no].fxo.polarity, wr->mod[mod_no].fxo.lastpol, - SYSTEM_TICKS); + (u32)SYSTEM_TICKS); if (wr->mod[mod_no].fxo.polarity){ zt_qevent_lock(&wr->chans[mod_no], ZT_EVENT_POLARITY); @@ -855,7 +868,6 @@ static void wp_tdmv_remora_proslic_check_hook(wp_tdmv_remora_t *wr, int mod_no) DEBUG_TDMV( "%s: Module %d: Going off hook\n", wr->devname, mod_no + 1); - wr->rxsig_state[mod_no] = ZT_RXSIG_OFFHOOK; zt_hooksig(&wr->chans[mod_no], ZT_RXSIG_OFFHOOK); #if 0 if (robust) @@ -868,7 +880,6 @@ static void wp_tdmv_remora_proslic_check_hook(wp_tdmv_remora_t *wr, int mod_no) DEBUG_TDMV( "%s: Module %d: Going on hook\n", wr->devname, mod_no + 1); - wr->rxsig_state[mod_no] = ZT_RXSIG_ONHOOK; zt_hooksig(&wr->chans[mod_no], ZT_RXSIG_ONHOOK); wr->mod[mod_no].fxs.oldrxhook = 0; } @@ -893,16 +904,6 @@ static int wp_tdmv_remora_check_hook(sdla_fe_t *fe, int mod_no) wp_tdmv_remora_voicedaa_check_hook(wr, mod_no); } -#if 0 - if (wr->rxsig_state[mod_no] != wr->chans[mod_no].rxhooksig){ - DEBUG_EVENT( - "%s: Module %d: WARNING: Update RX SIG state again %X (%X)\n", - wr->devname, mod_no + 1, - wr->rxsig_state[mod_no], - wr->chans[mod_no].rxhooksig); - zt_hooksig(&wr->chans[mod_no], wr->rxsig_state[mod_no]); - } -#endif return 0; } @@ -917,10 +918,8 @@ static int wp_tdmv_remora_hook(sdla_fe_t *fe, int mod_no, int off_hook) wr = wan_tdmv->sc; if (off_hook){ - wr->rxsig_state[mod_no] = ZT_RXSIG_OFFHOOK; zt_hooksig(&wr->chans[mod_no], ZT_RXSIG_OFFHOOK); }else{ - wr->rxsig_state[mod_no] = ZT_RXSIG_ONHOOK; zt_hooksig(&wr->chans[mod_no], ZT_RXSIG_ONHOOK); } wr->mod[mod_no].fxs.lastrxhook = off_hook; @@ -987,15 +986,21 @@ static int wp_tdmv_remora_software_init(wan_tdmv_t *wan_tdmv) break; } - wr->battthresh = (fe->fe_cfg.cfg.remora.battthresh) ? - fe->fe_cfg.cfg.remora.battthresh : DEFAULT_BATT_THRESH; - wr->battdebounce = (fe->fe_cfg.cfg.remora.battdebounce) ? - fe->fe_cfg.cfg.remora.battdebounce : DEFAULT_BATT_DEBOUNCE; - DEBUG_EVENT("%s: Battery Threshhold %d (%d)\n", - wr->devname, wr->battthresh, DEFAULT_BATT_THRESH); - DEBUG_EVENT("%s: Battery Debounce %d (%d)\n", - wr->devname, wr->battdebounce, DEFAULT_BATT_DEBOUNCE); wr->dtmfsupport = card->u.aft.tdmv_hw_dtmf; + wr->battthresh = DEFAULT_BATT_THRESH; + wr->battdebounce= DEFAULT_BATT_DEBOUNCE; + if (fe->fe_cfg.cfg.remora.battthresh && + fe->fe_cfg.cfg.remora.battthresh != DEFAULT_BATT_THRESH){ + wr->battthresh = fe->fe_cfg.cfg.remora.battthresh; + DEBUG_EVENT("%s: A200/A400 Remora Battery Threshhold changed %d -> %d\n", + wr->devname, DEFAULT_BATT_THRESH, wr->battthresh); + } + if (fe->fe_cfg.cfg.remora.battdebounce && + fe->fe_cfg.cfg.remora.battdebounce != DEFAULT_BATT_DEBOUNCE){ + wr->battdebounce = fe->fe_cfg.cfg.remora.battdebounce; + DEBUG_EVENT("%s: A200/A400 Remora Battery Debounce changed %d -> %d\n", + wr->devname, DEFAULT_BATT_DEBOUNCE, wr->battdebounce); + } for (x = 0; x < MAX_REMORA_MODULES; x++) { if (wan_test_bit(x, &fe->rm_param.module_map)){ @@ -1033,7 +1038,6 @@ static int wp_tdmv_remora_software_init(wan_tdmv_t *wan_tdmv) wr->chans[x].pvt = wr; num++; } - wr->rxsig_state[x] = ZT_RXSIG_INITIAL; } wr->span.pvt = wr; wr->span.chans = wr->chans; @@ -1076,8 +1080,13 @@ static int wp_tdmv_remora_software_init(wan_tdmv_t *wan_tdmv) /* Initialize Callback event function pointers */ if (wr->dtmfsupport == WANOPT_YES){ + DEBUG_EVENT("%s: Enable HW DTMF detection!\n", wr->devname); card->wandev.event_callback.dtmf = wp_tdmv_remora_dtmf; } + if (fe->fe_cfg.cfg.remora.fxs_pulsedialing == WANOPT_YES){ + DEBUG_EVENT("%s: Enable Pulse Dialing mode\n", + wr->devname); + } return 0; } @@ -1178,8 +1187,8 @@ static int wp_tdmv_remora_create(void* pcard, wan_tdmv_conf_t *tdmv_conf) wr->devname = card->devname; wr->max_timeslots = card->fe.rm_param.max_fe_channels; wr->max_rxtx_len = 0; - wan_spin_lock_init(&wr->lock); - wan_spin_lock_init(&wr->tx_rx_lock); + wan_spin_lock_irq_init(&wr->lockirq, "wan_rmtdmv_lock"); + wan_spin_lock_irq_init(&wr->tx_rx_lockirq, "wan_rmtdmv_txrx_lock"); if (tmp){ WAN_LIST_INSERT_AFTER(tmp, &card->wan_tdmv, next); @@ -1413,7 +1422,7 @@ static int wp_tdmv_remora_rx_chan(wan_tdmv_t *wan_tdmv, int channo, wan_tdmv_rxtx_pwr_t *pwr_rxtx = NULL; #endif sdla_t *card; - + WAN_ASSERT2(wr == NULL, -EINVAL); WAN_ASSERT2(channo < 0, -EINVAL); WAN_ASSERT2(channo > 31, -EINVAL); @@ -1454,7 +1463,7 @@ DEBUG_EVENT("Module %d: RX: %02X %02X %02X %02X %02X %02X %02X %02X\n", #ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE_ECHOMASTER if(pwr_rxtx->current_state != ECHO_ABSENT){ #endif - + if (wan_test_bit(AFT_TDM_SW_RING_BUF,&card->u.aft.chip_cfg_status)) { /* Updated for SWRING buffer * Sets up the spike at 3 bytes */ @@ -1559,7 +1568,7 @@ static int wp_tdmv_remora_rx_tx_span(void *pcard) } else if (fe->rm_param.mod[x].type == MOD_TYPE_FXO) { if (wr->mod[x].fxo.echotune){ - DEBUG_EVENT("%s: Module %d: Setting echo registers: \n", + DEBUG_RM("%s: Module %d: Setting echo registers: \n", fe->name, x); /* Set the ACIM register */ @@ -1575,7 +1584,7 @@ static int wp_tdmv_remora_rx_tx_span(void *pcard) WRITE_RM_REG(x, 51, wr->mod[x].fxo.echoregs.coef7); WRITE_RM_REG(x, 52, wr->mod[x].fxo.echoregs.coef8); - DEBUG_EVENT("%s: Module %d: Set echo registers successfully\n", + DEBUG_RM("%s: Module %d: Set echo registers successfully\n", fe->name, x); wr->mod[x].fxo.echotune = 0; } @@ -1587,12 +1596,23 @@ static int wp_tdmv_remora_rx_tx_span(void *pcard) } #endif } + +#if defined(NEW_PULSE_DIALING) + if (fe->fe_cfg.cfg.remora.fxs_pulsedialing == WANOPT_YES){ + /* + ** Alex 31 Mar, 2006 + ** Check for HOOK status every interrupt + ** (in pulse mode is very critical) */ + wp_tdmv_remora_check_hook(fe, x); + } +#else #ifdef PULSE_DIALING /* ** Alex 31 Mar, 2006 ** Check for HOOK status every interrupt ** (in pulse mode is very critical) */ wp_tdmv_remora_check_hook(fe, x); +#endif #endif } @@ -1616,8 +1636,14 @@ static int wp_tdmv_remora_rx_tx_span(void *pcard) } #endif +#if defined(NEW_PULSE_DIALING) + if (fe->fe_cfg.cfg.remora.fxs_pulsedialing != WANOPT_YES){ + wp_tdmv_remora_check_hook(fe, x); + } +#else #ifndef PULSE_DIALING wp_tdmv_remora_check_hook(fe, x); +#endif #endif if (!(wr->intcount & 0xf0)){ if (fe->rm_param.mod[x].type == MOD_TYPE_FXS) { @@ -1670,25 +1696,29 @@ static void wp_tdmv_remora_dtmf (void* card_id, wan_event_t *event) wr = wan_tdmv->sc; if (event->type == WAN_EVENT_EC_DTMF){ - DEBUG_EVENT("%s: Received DTMF Event at TDM RM (%d:%c:%s:%s)!\n", + DEBUG_TDMV( + "[TDMV_RM]: %s: Received EC DTMF Event at TDM (%d:%c:%s:%s)!\n", card->devname, event->channel, event->digit, (event->dtmf_port == WAN_EC_CHANNEL_PORT_ROUT)?"ROUT":"SOUT", (event->dtmf_type == WAN_EC_TONE_PRESENT)?"PRESENT":"STOP"); }else if (event->type == WAN_EVENT_RM_DTMF){ - DEBUG_EVENT("%s: Received DTMF Event at TDM RM (%d:%c)!\n", + DEBUG_TDMV( + "[TDMV_RM]: %s: Received RM DTMF Event at TDM (%d:%c)!\n", card->devname, event->channel, event->digit); } if (!(wr->dtmfmask & (1 << (event->channel-1)))){ - DEBUG_TDMV("%s: DTMF is not enabled for the channel %d\n", + DEBUG_TDMV( + "[TDMV] %s: DTMF is not enabled for the channel %d\n", card->devname, event->channel); return; } + if (event->dtmf_type == WAN_EC_TONE_PRESENT){ wr->dtmfactive |= (1 << event->channel); zt_qevent_lock( diff --git a/patches/kdrivers/src/net/sdla_sdlc.c b/patches/kdrivers/src/net/sdla_sdlc.c index df8dbe1..f7b7f89 100644 --- a/patches/kdrivers/src/net/sdla_sdlc.c +++ b/patches/kdrivers/src/net/sdla_sdlc.c @@ -250,7 +250,7 @@ int wp_sdlc_init (sdla_t* card, wandev_conf_t* conf) card->wandev.set_if_info = &chdlc_set_if_info; card->wandev.ttl = conf->ttl; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; card->wandev.clocking = conf->clocking; port_num = card->u.sdlc.comm_port; @@ -345,13 +345,13 @@ int wp_sdlc_init (sdla_t* card, wandev_conf_t* conf) */ static int update (wan_device_t* wandev) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; netdevice_t* dev; volatile sdlc_private_area_t* sdlc_priv_area; unsigned long timeout; /* sanity checks */ - if((wandev == NULL) || (wandev->private == NULL)) + if((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if(wandev->state == WAN_UNCONFIGURED) @@ -410,7 +410,7 @@ static int update (wan_device_t* wandev) static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; sdlc_private_area_t* sdlc_priv_area; int err = 0; @@ -518,6 +518,8 @@ static int del_if (wan_device_t* wandev, netdevice_t* dev) * since in some cases (mrouted) daemons continue * to call ioctl() after the device has gone down */ dev->do_ioctl = NULL; + dev->hard_header = NULL; + dev->rebuild_header = NULL; sdlc_set_intr_mode(card, 0); if (card->u.sdlc.comm_enabled){ @@ -1646,7 +1648,7 @@ static int set_sdlc_config(sdla_t* card) cfg.general_operational_config_bits=card->wandev.sdlc_cfg.general_operational_config_bits; - if (card->wandev.interface != WANOPT_RS232){ + if (card->wandev.electrical_interface != WANOPT_RS232){ cfg.general_operational_config_bits |= INTERFACE_LEVEL_V35; } @@ -2257,7 +2259,7 @@ static int chdlc_set_dev_config(struct file *file, if (wandev == NULL) return cnt; - card = (sdla_t*)wandev->private; + card = (sdla_t*)wandev->priv; printk(KERN_INFO "%s: New device config (%s)\n", wandev->name, buffer); diff --git a/patches/kdrivers/src/net/sdla_serial.c b/patches/kdrivers/src/net/sdla_serial.c new file mode 100644 index 0000000..d5acfd0 --- /dev/null +++ b/patches/kdrivers/src/net/sdla_serial.c @@ -0,0 +1,1016 @@ +/*************************************************************************** + * sdla_serial.c WANPIPE(tm) + * Serial A140 support module for A140 Serial FE. + * + * Author(s): Nenad Corbic + * + * Copyright: (c) 2007 Sangoma Technologies 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. + * + * ============================================================================ + * Nov 1, 2007 Nenad Corbic Initial version. + ****************************************************************************** + */ + +/******************************************************************************* +** INCLUDE FILES +*******************************************************************************/ + +#if defined(__FreeBSD__) || defined(__OpenBSD__) +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include /* for 'wanpipe_common_t' used in 'sdla_aft_te1.h'*/ +# include /* for 'private_area_t' */ +#elif (defined __WINDOWS__) +# include +# include +# include +# include +# include +# include +# include +# include +# include /* for 'wanpipe_common_t' used in 'sdla_aft_te1.h'*/ +# include /* for 'private_area_t' */ +#else +# include +# include +# include +# include +# include +# include +# include +# include +# include /* for 'wanpipe_common_t' used in 'sdla_aft_te1.h'*/ +# include /* for 'private_area_t' */ +#endif + +#undef DEBUG_SERIAL +#define DEBUG_SERIAL if(0)DEBUG_EVENT + +/* DEBUG macro definitions */ +#define DEBUG_HFC_INIT if(0)DEBUG_EVENT +#define DEBUG_HFC_MODE if(0)DEBUG_EVENT +#define DEBUG_HFC_S0_STATES if(0)DEBUG_EVENT +#define DEBUG_HFC_IRQ if(0)DEBUG_EVENT +#define DEBUG_HFC_SU_IRQ if(0)DEBUG_EVENT + +#define DEBUG_HFC_TX if(0)DEBUG_EVENT +#define DEBUG_TX_DATA if(0)DEBUG_EVENT +#define TX_EXTRA_DBG if(0)DEBUG_EVENT +#define TX_FAST_DBG if(0)DEBUG_EVENT + +#define DEBUG_HFC_RX if(0)DEBUG_EVENT +#define RX_EXTRA_DBG if(0)DEBUG_EVENT +#define DEBUG_RX1 if(0)DEBUG_EVENT +#define DBG_RX_DATA if(0)DEBUG_EVENT + +#define DEBUG_HFC_CLOCK if(0)DEBUG_EVENT + +#define BUILD_MOD_TESTER 0 /* for Production Test */ +#define DBG_MODULE_TESTER if(0)DEBUG_EVENT + +#define NT_STATE_FUNC() if(0)DEBUG_EVENT("%s(): line: %d\n", __FUNCTION__, __LINE__) +#define CLOCK_FUNC() if(0)DEBUG_EVENT("%s(): line: %d\n", __FUNCTION__, __LINE__) + +#define DBG_SPI if(0)DEBUG_EVENT + +#define DEBUG_FE_STATUS if(0)DEBUG_EVENT + +#define SERIAL_FUNC() if(1)DEBUG_EVENT("%s(): line: %d\n", __FUNCTION__, __LINE__) + +/* Timer interrupt counter - used by activation timer T3 */ +#define HFC_TIMER_COUNTER_T3 2 + +#undef NT_T1_COUNT + +#define FIFO_THRESHOLD_INDEX 1 + +#define LINE_STABILITY_THRESHOLD 3 + +enum { + WAITING_TO_STABILIZE=1, + LINE_STABLE, + LINE_DISCONNECTED +}; + +#define CHECK_DATA 0 + + +int aft_serial_write_cpld(void *card, unsigned short off,u_int16_t data); +unsigned char aft_serial_read_cpld(void *card, unsigned short cpld_off); + +/******************************************************************************* +** DEFINES AND MACROS +*******************************************************************************/ +#define REPORT_MOD_NO (mod_no+1) + +static u8 validate_fe_line_no(sdla_fe_t *fe, const char *caller_name) +{ + if ((int32_t)WAN_FE_LINENO(fe) < 0 || WAN_FE_LINENO(fe) > MAX_SERIAL_LINES){ + DEBUG_EVENT("%s(): %s: SERIAL: Invalid FE line number %d (Min=1 Max=%d)\n", + caller_name, fe->name, WAN_FE_LINENO(fe)+1, MAX_SERIAL_LINES); + return 1; + } + return 0; +} + +#define FE_LINENO_TO_MODULENO_AND_PORTNO(fe) \ +{ \ + mod_no = fe_line_no_to_physical_mod_no(fe); \ + port = fe_line_no_to_port_no(fe); \ +} + +#if 0 +/* wait for "milliseconds * 1/1000" of sec */ +static void WP_MDELAY(u32 milliseconds) +{ + for (; milliseconds > 0; --milliseconds){ + WP_DELAY(1000); + } +} +#endif + +/*******************************************************************************/ +/* Register Write/Read debugging funcitons */ + +/* Enabling/Disabling register debugging */ +#define WAN_DEBUG_SERIAL_REG 0 + +#if WAN_DEBUG_SERIAL_REG + +#define HFC_WRITE 1 +#define HFC_READ 2 + +#endif /* WAN_DEBUG_SERIAL_REG */ +/*******************************************************************************/ + +/*******************************************************************************/ + +/******************************************************************************* +** STRUCTURES AND TYPEDEFS +*******************************************************************************/ + +/******************************************************************************* +** GLOBAL VARIABLES +*******************************************************************************/ +#if !defined(__WINDOWS__) +extern WAN_LIST_HEAD(, wan_tdmv_) wan_tdmv_head; +#endif + +/******************************************************************************* +** FUNCTION PROTOTYPES +*******************************************************************************/ +static int32_t serial_global_config(void* pfe); +static int32_t serial_global_unconfig(void* pfe); +static int32_t wp_serial_config(void *pfe); +static int32_t wp_serial_unconfig(void *pfe); +static int32_t wp_serial_post_init(void *pfe); +static int32_t wp_serial_if_config(void *pfe, u32 mod_map, u8); +static int32_t wp_serial_if_unconfig(void *pfe, u32 mod_map, u8); +//static int32_t wp_serial_disable_irq(sdla_fe_t *fe, u32 mod_no, u8 port); +//static void serial_enable_interrupts(sdla_fe_t *fe, u32 mod_no, u8 port); +static int32_t wp_serial_intr(sdla_fe_t *); +static int32_t wp_serial_check_intr(sdla_fe_t *); +static int32_t wp_serial_polling(sdla_fe_t*); +static int32_t wp_serial_udp(sdla_fe_t*, void*, u8*); +static u32 wp_serial_active_map(sdla_fe_t* fe, u8 line_no); +static u8 wp_serial_fe_media(sdla_fe_t *fe); +static int32_t wp_serial_set_dtmf(sdla_fe_t*, int32_t, u8); +static int wp_serial_intr_ctrl(sdla_fe_t *fe, int mod_no, u_int8_t, u_int8_t mode, unsigned int ts_map); +static int32_t wp_serial_event_ctrl(sdla_fe_t*, wan_event_ctrl_t*); + +static int wp_serial_get_fe_status(sdla_fe_t *fe, unsigned char *status); +static int wp_serial_set_fe_status(sdla_fe_t *fe, unsigned char status); + +#if 0 +static void wp_serial_enable_timer(sdla_fe_t* fe, u8 mod_no, u8 cmd, u32 delay); + +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +static void wp_serial_timer(void*); +#elif defined(__WINDOWS__) +static void wp_serial_timer(IN PKDPC,void*,void*,void*); +#else +static void wp_serial_timer(void*); +#endif +#endif /* if 0 */ + +#if defined(AFT_TDM_API_SUPPORT) +static int32_t wp_serial_watchdog(sdla_fe_t *fe); +#endif + + +/* for selecting PCM direction */ +#define XHFC_DIRECTION_TX 0 +#define XHFC_DIRECTION_RX 1 + +#if 0 +static void xhfc_select_xhfc_channel(sdla_fe_t *fe, u32 mod_no, + u8 channel, u8 direction, u8 vrout_bitmap); +#endif + +//static int32_t check_f0cl_increment(sdla_fe_t *fe, u8 old_f0cl, u8 new_f0cl, int32_t *diff); + +/******************************************************************************* +** FUNCTION DEFINITIONS +*******************************************************************************/ + + +/*******************************************************************************/ + + + + +/****************************************************************************** +** wp_serial_iface_init) - +** +** OK +*/ +int32_t wp_serial_iface_init(void *pfe_iface) +{ + sdla_fe_iface_t *fe_iface = (sdla_fe_iface_t*)pfe_iface; + + SERIAL_FUNC(); + fe_iface->global_config = &serial_global_config; /* not used in remora */ + fe_iface->global_unconfig = &serial_global_unconfig; /* not used in remora */ + + fe_iface->config = &wp_serial_config; + fe_iface->unconfig = &wp_serial_unconfig; + + fe_iface->post_init = &wp_serial_post_init; + + fe_iface->if_config = &wp_serial_if_config; + fe_iface->if_unconfig = &wp_serial_if_unconfig; + + fe_iface->active_map = &wp_serial_active_map; + + fe_iface->set_fe_status = &wp_serial_set_fe_status; + fe_iface->get_fe_status = &wp_serial_get_fe_status; + + fe_iface->isr = &wp_serial_intr; +// fe_iface->disable_irq = &wp_serial_disable_irq; + fe_iface->check_isr = &wp_serial_check_intr; + + fe_iface->polling = &wp_serial_polling; + fe_iface->process_udp = &wp_serial_udp; + fe_iface->get_fe_media = &wp_serial_fe_media; + + fe_iface->set_dtmf = &wp_serial_set_dtmf; + fe_iface->intr_ctrl = &wp_serial_intr_ctrl; + fe_iface->event_ctrl = &wp_serial_event_ctrl; + + +#if defined(AFT_TDM_API_SUPPORT) + fe_iface->watchdog = &wp_serial_watchdog; +#endif + + return 0; +} + +#if defined(NOTUSED) +/* Should be done only ONCE per card. */ +static int32_t wp_serial_spi_bus_reset(sdla_fe_t *fe) +{ + sdla_t *card = (sdla_t*)fe->card; + + SERIAL_FUNC(); + + DEBUG_EVENT("%s: Executing SPI bus reset....\n", fe->name); + + card->hw_iface.bus_write_4( card->hw, + SPI_INTERFACE_REG, + MOD_SPI_RESET); + WP_DELAY(1000); + card->hw_iface.bus_write_4( card->hw, + SPI_INTERFACE_REG, + 0x00000000); + WP_DELAY(1000); + return 0; +} +#endif + +/****************************************************************************** +* serial_global_config() +* +* Description : Global configuration for Sangoma SERIAL board. +* +* Notes : 1. This routine runs only ONCE for a physical 'base' CARD, +* not for 'additional' cards. +* 2. reset card's SPI. +* 3. Scan for installed Remoras and modules. +* +* Arguments : pfe - pointer to Front End structure. +* +* Returns : 0 - configred successfully, otherwise non-zero value. +*******************************************************************************/ +static int32_t serial_global_config(void* pfe) +{ + sdla_fe_t *fe = (sdla_fe_t*)pfe; + + SERIAL_FUNC(); + + DEBUG_EVENT("%s: %s Global Front End configuration\n", + fe->name, FE_MEDIA_DECODE(fe)); + + return 0; +} + +/******************************************************************************* +* serial_global_unconfig() +* +* Description : Global un-configuration for Sangoma SERIAL board. +* Note: This routne runs only ONCE for a physical card. +* +* Arguments : +* +* Returns : 0 +*******************************************************************************/ +static int32_t serial_global_unconfig(void* pfe) +{ + sdla_fe_t *fe = (sdla_fe_t*)pfe; + sdla_t *card = (sdla_t*)fe->card; + + SERIAL_FUNC(); + aft_serial_write_cpld(card,0x08,0x00); + aft_serial_write_cpld(card,0x09,0x00); + + DEBUG_EVENT("%s: %s Global Front End unconfiguration!\n", + fe->name, FE_MEDIA_DECODE(fe)); + + return 0; +} + +/****************************************************************************** +* wp_serial_config() - initialise the XHFC ISDN Chip. +* +* Description : Configure the PHYSICAL module ONE time. +* On each module 2 lines will be configured +* in exactly the same way. +* +* Arguments : pfe - pointer to Front End structure. +* +* Returns : 0 - configred successfully, otherwise non-zero value. +*******************************************************************************/ +static int32_t wp_serial_config(void *pfe) +{ + sdla_fe_t *fe = (sdla_fe_t*)pfe; + sdla_t *card = (sdla_t*)fe->card; + u32 reg; + u8 cpld_reg_val; + unsigned short cpld_reg=0; + + SERIAL_FUNC(); + + DEBUG_EVENT("%s: %s: Line %d Front End configuration\n", + fe->name, FE_MEDIA_DECODE(fe), WAN_FE_LINENO(fe) + 1); + + if(validate_fe_line_no(fe, __FUNCTION__)){ + return 1; + } + + + switch (card->wandev.line_coding){ + case WANOPT_NRZ: + case WANOPT_NRZI: + break; + default: + DEBUG_EVENT("%s: A140: Error: Unsupported line coding mode 0x%X\n", + card->devname, + card->wandev.line_coding); + return -1; + } + + switch (card->adptr_type) { + + case AFT_ADPTR_2SERIAL_V35X21: + case AFT_ADPTR_4SERIAL_V35X21: + DEBUG_EVENT("%s: A140: Configuring for V35\n", + card->devname); + + switch(WAN_FE_LINENO(fe)) { + + case 0: + case 2: + cpld_reg=0x08; + break; + case 1: + case 3: + cpld_reg=0x09; + break; + default: + DEBUG_EVENT("%s: Error: Invalid Serial Port Number! (%i) \n", + card->devname,WAN_FE_LINENO(fe)); + return -EINVAL; + }; + + cpld_reg_val=aft_serial_read_cpld(card,cpld_reg); + + if(card->wandev.clocking) { + +/*FIXME: Must check for case where first port started in external mode + At this time, if port 1 start in normal & prot 3 in master, the + port 1 will silently be reconfigured to Master after port 3 starts */ + + aft_serial_write_cpld(card,cpld_reg,0x05); + } else { + if (wan_test_bit(2,&cpld_reg_val)) { + DEBUG_EVENT("%s: Error: Clocking configuration mismatch!\n", + card->devname); + DEBUG_EVENT("%s: Ports 1&3 and 2&4 must use same clock source!\n", + card->devname); + return -EINVAL; + } + + aft_serial_write_cpld(card,cpld_reg,0x01); + } + break; + + case AFT_ADPTR_2SERIAL_RS232: + case AFT_ADPTR_4SERIAL_RS232: + + DEBUG_EVENT("%s: A140: Configuring for RS232\n", + card->devname); + + if (WAN_FE_LINENO(fe) < 2) { + cpld_reg=0x08; + } else { + cpld_reg=0x09; + } + + cpld_reg_val=aft_serial_read_cpld(card,cpld_reg); + if(card->wandev.clocking) { + wan_set_bit((WAN_FE_LINENO(fe)%2), &cpld_reg_val); + } else { + wan_clear_bit((WAN_FE_LINENO(fe)%2), &cpld_reg_val); + } + aft_serial_write_cpld(card,cpld_reg,cpld_reg_val); + + break; + + default: + DEBUG_EVENT("%s: Error: Invalid Serial Card Type 0x%X\n", + card->devname,card->adptr_type); + return -1; + } + + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_SERIAL_LINE_CFG_REG),®); + + DEBUG_EVENT("%s: A140: Configurfed for 0x%08X\n", + card->devname, + reg); + + + if (card->wandev.clocking) { + DEBUG_EVENT("%s: A140: Configuring for Internal Clocking: Baud=%i\n", + card->devname, + card->wandev.bps); + wan_set_bit(AFT_SERIAL_LCFG_CLK_SRC_BIT, ®); + aft_serial_set_baud_rate(®,card->wandev.bps); + } else { + DEBUG_EVENT("%s: A140: Configuring for External Clocking: Baud=%i\n", + card->devname, + card->wandev.bps); + wan_clear_bit(AFT_SERIAL_LCFG_CLK_SRC_BIT, ®); + } + + switch (card->wandev.line_coding){ + case WANOPT_NRZ: + DEBUG_EVENT("%s: A140: Configuring for NRZ\n", + card->devname); + aft_serial_set_lcoding(®,WANOPT_NRZ); + break; + case WANOPT_NRZI: + DEBUG_EVENT("%s: A140: Configuring for NRZI\n", + card->devname); + aft_serial_set_lcoding(®,WANOPT_NRZI); + break; + default: + /* Should never happen because we check above */ + DEBUG_EVENT("%s: A140: Error: Unsupported line coding mode 0x%X\n", + card->devname, + card->wandev.line_coding); + return -1; + } + + if (card->wandev.connection == WANOPT_SWITCHED){ + DEBUG_EVENT("%s: A140: Configuring for Switched CTS/RTS\n",card->devname); + wan_set_bit(AFT_SERIAL_LCFG_SWMODE_BIT, ®); + wan_set_bit(AFT_SERIAL_LCFG_IDLE_DET_BIT,®); + } else { + wan_clear_bit(AFT_SERIAL_LCFG_SWMODE_BIT, ®); + wan_clear_bit(AFT_SERIAL_LCFG_IDLE_DET_BIT,®); + } + + + /* Hardcode to sync device type */ + wan_clear_bit(AFT_SERIAL_LCFG_IFACE_TYPE_BIT,®); + + /* CTS/DCD Interrupt Enable */ + wan_set_bit(AFT_SERIAL_LCFG_CTS_INTR_EN_BIT,®); + wan_set_bit(AFT_SERIAL_LCFG_DCD_INTR_EN_BIT,®); + + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_SERIAL_LINE_CFG_REG),reg); + + DEBUG_EVENT("%s: A140: Configurfed for 0x%08X\n", + card->devname, + reg); + + /* Raise RTS and DTR */ + wan_set_bit(AFT_SERIAL_LCFG_RTS_BIT,®); + wan_set_bit(AFT_SERIAL_LCFG_DTR_BIT,®); + + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_SERIAL_LINE_CFG_REG),reg); + + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_SERIAL_LINE_CFG_REG),®); + + DEBUG_EVENT("%s: A140: Configurfed for 0x%08X\n", + card->devname, + reg); + + return 0; +} + +/****************************************************************************** +** wp_serial_unconfig() - +** +** OK +*/ +static int32_t wp_serial_unconfig(void *pfe) +{ + sdla_fe_t *fe = (sdla_fe_t*)pfe; + sdla_t *card = (sdla_t*)fe->card; + u32 reg=0; + unsigned short cpld_reg; + unsigned char cpld_reg_val; + + SERIAL_FUNC(); + + if(validate_fe_line_no(fe, __FUNCTION__)){ + return 1; + } + + switch (card->adptr_type) { + case AFT_ADPTR_2SERIAL_RS232: + case AFT_ADPTR_4SERIAL_RS232: + + if (WAN_FE_LINENO(fe) < 2) { + cpld_reg=0x08; + } else { + cpld_reg=0x09; + } + + cpld_reg_val=aft_serial_read_cpld(card,cpld_reg); + wan_clear_bit((WAN_FE_LINENO(fe)%2), &cpld_reg_val); + aft_serial_write_cpld(card,cpld_reg,cpld_reg_val); + break; + } + + card->hw_iface.bus_write_4(card->hw,AFT_PORT_REG(card,AFT_SERIAL_LINE_CFG_REG),reg); + + return 0; +} + +/****************************************************************************** +** wp_serial_post_init() - +** +** OK +*/ +static int32_t wp_serial_post_init(void *pfe) +{ + sdla_fe_t *fe = (sdla_fe_t*)pfe; + + SERIAL_FUNC(); + + DEBUG_EVENT("%s: Running post initialization...\n", fe->name); + /* return sdla_rm_add_timer(fe, HZ); */ + return 0; +} + + +/****************************************************************************** +** wp_serial_if_config() - +** +** OK +*/ +static int32_t wp_serial_if_config(void *pfe, u32 mod_map, u8 usedby) +{ + SERIAL_FUNC(); + return 0; +} + + +/****************************************************************************** +** wp_serial_if_unconfig() - +** +** OK +*/ +static int32_t wp_serial_if_unconfig(void *pfe, u32 mod_map, u8 usedby) +{ + SERIAL_FUNC(); + return 0; +} + + + +#if defined(NOTUSED) +/******************************************************************************* +* serial_enable_interrupts() +* +* Description: Enable SERIAL interrupts - start interrupt and set interrupt mask. +* +* Arguments: +* +* Returns: +*******************************************************************************/ +static void serial_enable_interrupts(sdla_fe_t *fe, u32 mod_no, u8 port) +{ + + + SERIAL_FUNC(); + +} +#endif + +#if defined(NOTUSED) +/****************************************************************************** +** wp_serial_disable_irq() - disable all interrupts by disabling M_GLOB_IRQ_EN +** +** OK +*/ +static int32_t wp_serial_disable_irq(sdla_fe_t *fe, u32 mod_no, u8 port) +{ + + return 0; +} +#endif + +static u32 wp_serial_active_map(sdla_fe_t* fe, u8 line_no) +{ + SERIAL_FUNC(); + + return 0x01; +} + +/****************************************************************************** +* wp_serial_fe_status() +* +* Description: +* Arguments: +* Returns: +*******************************************************************************/ +static u8 wp_serial_fe_media(sdla_fe_t *fe) +{ + SERIAL_FUNC(); + return fe->fe_cfg.media; +} + +/****************************************************************************** +* wp_serial_set_dtmf() +* +* Description: +* Arguments: +* Returns: +*******************************************************************************/ +static int32_t wp_serial_set_dtmf(sdla_fe_t *fe, int32_t mod_no, u8 val) +{ + SERIAL_FUNC(); + + return -EINVAL; +} + +#if 0 + +/******************************************************************************* +* sdla_serial_timer() +* +* Description: +* Arguments: +* Returns: +*******************************************************************************/ +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) +static void wp_serial_timer(void* pfe) +#elif defined(__WINDOWS__) +static void wp_serial_timer(IN PKDPC Dpc, void* pfe, void* arg2, void* arg3) +#else +static void wp_serial_timer(void *pfe) +#endif +{ + SERIAL_FUNC(); + return; +} + +/******************************************************************************* +* wp_serial_enable_timer() +* +* Description: Enable software timer interrupt in delay ms. +* Arguments: +* Returns: +*******************************************************************************/ +static void wp_serial_enable_timer(sdla_fe_t* fe, u8 mod_no, u8 cmd, u32 delay) +{ + SERIAL_FUNC(); + return; +} + +static int32_t wp_serial_regdump(sdla_fe_t* fe, u8 *data) +{ + SERIAL_FUNC(); + return 0; +} + +#endif /* if 0*/ + +static int32_t wp_serial_polling(sdla_fe_t* fe) +{ + SERIAL_FUNC(); + return 0; +} + +/******************************************************************************* +* wp_serial_udp() +* +* Description: +* Arguments: +* Returns: +*******************************************************************************/ +static int32_t wp_serial_udp(sdla_fe_t *fe, void* p_udp_cmd, u8* data) +{ + int32_t err = -EINVAL; + + SERIAL_FUNC(); +#if 0 + wan_cmd_t *udp_cmd = (wan_cmd_t*)p_udp_cmd; + + switch(udp_cmd->wan_cmd_command){ + case WAN_FE_REGDUMP: + err = wp_serial_regdump(fe, data); + if (err){ + udp_cmd->wan_cmd_return_code = WAN_CMD_OK; + udp_cmd->wan_cmd_data_len = (u16)err; + } + break; + + default: + udp_cmd->wan_cmd_return_code = WAN_UDP_INVALID_CMD; + udp_cmd->wan_cmd_data_len = 0; + break; + } +#endif + return err; +} + +/****************************************************************************** +* wp_serial_get_fe_status() +* +* Description : Get current FE line state - is it Connected or Disconnected +* +* Arguments : fe - pointer to Front End structure. +* status - pointer to location where the FE line state will +* be stored. +* +* Returns : always zero. +*******************************************************************************/ +static int wp_serial_get_fe_status(sdla_fe_t *fe, unsigned char *status) +{ + *status = fe->fe_status; + return 0; +} + +/****************************************************************************** +* wp_serial_set_fe_status() +* +* Description : Set FE line state to Connected or Disconnected. +* In SERIAL this means Activate or Deactivate the line. +* +* Arguments : fe - pointer to Front End structure. +* new_status - the new FE line state. +* +* Returns : 0 - success. +* 1 - failure. +*******************************************************************************/ +static int wp_serial_set_fe_status(sdla_fe_t *fe, unsigned char new_status) +{ + int rc=0; + SERIAL_FUNC(); + return rc; +} + + + +/****************************************************************************** +* wp_serial_event_ctrl() +* +* Description: Enable/Disable event types +* Arguments: mod_no - Module number (1,2,3,... MAX_REMORA_MODULES) +* Returns: +******************************************************************************/ +static int32_t +wp_serial_event_ctrl(sdla_fe_t *fe, wan_event_ctrl_t *ectrl) +{ + int32_t err = 0; + + SERIAL_FUNC(); + + WAN_ASSERT(ectrl == NULL); + + return err; +} + +#if defined(AFT_TDM_API_SUPPORT) +/****************************************************************************** +* wp_serial_watchdog() +* +* Description: +* Arguments: mod_no - Module number (1,2,3,... MAX_REMORA_MODULES) +* Returns: +******************************************************************************/ +static int32_t wp_serial_watchdog(sdla_fe_t *fe) +{ + int32_t mod_no; + + SERIAL_FUNC(); + + return 0; +} +#endif + +/****************************************************************************** +* wp_serial_intr_ctrl() +* +* Description: Enable/Disable extra interrupt types +* Arguments: mod_no - Module number (1,2,3,... MAX_REMORA_MODULES) +* Returns: +******************************************************************************/ +static int wp_serial_intr_ctrl(sdla_fe_t *fe, int mod_no, u_int8_t type, u_int8_t mode, unsigned int ts_map) +{ + + SERIAL_FUNC(); + + return 0; + +} + +#if defined(NOTUSED) +/****************************************************************************** +* sdla_serial_set_status() +* +* Description: handle interrupt on a physical module +* Arguments: fe, mod_no +* Returns: 1 - interrupt recognized and handled +* 0 - interrupt not recognized (not generated by this module) +******************************************************************************/ +static void sdla_serial_set_status(sdla_fe_t* fe, u8 mod_no, u8 port_no, u8 status) +{ + sdla_t *card = (sdla_t*)fe->card; + u8 old_fe_status = fe->fe_status; + + + SERIAL_FUNC(); + + +#if 0 + if(old_fe_status == status){ + return; + } +#endif + + fe->fe_status = status; + + if (old_fe_status != fe->fe_status){ + if (fe->fe_status == FE_CONNECTED){ + DEBUG_EVENT("%s: %s Module: %d connected!\n", + fe->name, + FE_MEDIA_DECODE(fe), REPORT_MOD_NO + port_no); + + if (card->wandev.te_report_alarms){ + card->wandev.te_report_alarms(card, 0); + } + + }else{ + DEBUG_EVENT("%s: %s Module: %d disconnected!\n", + fe->name, + FE_MEDIA_DECODE(fe), REPORT_MOD_NO + port_no); + if (card->wandev.te_report_alarms){ + card->wandev.te_report_alarms(card, 1); + } + } + } + + return; +} +#endif + + +static int32_t wp_serial_check_intr(sdla_fe_t *fe) +{ + /* must return 1! */ + return 1; +} + +static int32_t wp_serial_intr(sdla_fe_t *fe) +{ + sdla_t *card = (sdla_t*)fe->card; + u32 reg; + + SERIAL_FUNC(); + card->hw_iface.bus_read_4(card->hw,AFT_PORT_REG(card,AFT_SERIAL_LINE_CFG_REG),®); + DEBUG_EVENT("%s: DCD/CTS VALUES = 0x%02X\n",card->devname,(reg>>2)&0x03); + + return 0; +} + +/*************************************************************************** + Front End T1/E1 interface for Normal cards +***************************************************************************/ +int aft_serial_write_fe(void* phw, ...) +{ + va_list args; + u16 qaccess, off, line_no; + u8 value; +// u8 qaccess = card->wandev.state == WAN_CONNECTED ? 1 : 0; + + va_start(args, phw); + qaccess = (u16)va_arg(args, int); + line_no = (u16)va_arg(args, int); + off = (u16)va_arg(args, int); + value = (u8)va_arg(args, int); + va_end(args); + + SERIAL_FUNC(); + + return 0; +} + + +/*============================================================================ + * Read TE1/56K Front end registers + */ + + +u32 aft_serial_read_fe (void* phw, ...) +{ + va_list args; + u_int16_t qaccess, line_no, off; + u_int8_t tmp=0; +// u8 qaccess = card->wandev.state == WAN_CONNECTED ? 1 : 0; + + va_start(args, phw); + qaccess = (u_int16_t)va_arg(args, int); + line_no = (u_int16_t)va_arg(args, int); + off = (u_int8_t)va_arg(args, int); + va_end(args); + + SERIAL_FUNC(); + + return tmp; +} + +int aft_serial_write_cpld(void *pcard, unsigned short off,u_int16_t data) +{ + int err = -EINVAL; + sdla_t *card = (sdla_t*)pcard; + + if (card->hw_iface.fe_test_and_set_bit(card->hw,0)){ + DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", + card->devname, __FUNCTION__,__LINE__); + return 0x00; + } + + if (card->hw_iface.write_cpld){ + err = card->hw_iface.write_cpld(card->hw, (u16)off, (u8)data); + } + + card->hw_iface.fe_clear_bit(card->hw,0); + return 0; +} + +unsigned char aft_serial_read_cpld(void *pcard, unsigned short cpld_off) +{ + u8 tmp=0; + int err = -EINVAL; + sdla_t *card = (sdla_t*)pcard; + + if (card->hw_iface.fe_test_and_set_bit(card->hw,0)){ + DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", + card->devname, __FUNCTION__,__LINE__); + return 0x00; + } + + if (card->hw_iface.read_cpld){ + err = card->hw_iface.read_cpld(card->hw, (u16)cpld_off, &tmp); + } + + card->hw_iface.fe_clear_bit(card->hw,0); + return tmp; +} diff --git a/patches/kdrivers/src/net/sdla_tdmv.c b/patches/kdrivers/src/net/sdla_tdmv.c index c4d1950..96e318d 100644 --- a/patches/kdrivers/src/net/sdla_tdmv.c +++ b/patches/kdrivers/src/net/sdla_tdmv.c @@ -31,6 +31,7 @@ # include # include # include +# include # include /* WANPIPE TDM Voice definitions */ # include #elif (defined __WINDOWS__) @@ -40,6 +41,7 @@ # include # include # include +# include # include /* WANPIPE TDM Voice definitions */ #endif @@ -87,8 +89,6 @@ # if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN_ZAPTEL) # undef ZT_DCHAN_TX # endif -#else -#warning "TDM VOICE DCHAN DISABLED" #endif #if defined(__FreeBSD__) @@ -142,8 +142,8 @@ typedef struct wp_tdmv_pvt_area { sdla_t* card; char* devname; - wan_spinlock_t lock; - wan_spinlock_t tx_rx_lock; + wan_spinlock_t lockirq; + wan_spinlock_t tx_rx_lockirq; int ise1; int num; int spanno; @@ -192,6 +192,11 @@ typedef struct wp_tdmv_pvt_area unsigned int dchan_map; netdevice_t *dchan_dev; + u_int8_t dtmfsupport; + unsigned int dtmfactive; + unsigned int dtmfmask; + unsigned int dtmfmutemask; + } wp_tdmv_softc_t; @@ -235,7 +240,6 @@ static int wp_tdmv_hwec(struct zt_chan *chan, int enable); #if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN) && defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN_ZAPTEL) static void wp_tdmv_tx_hdlc_hard(struct zt_chan *chan); #endif - static int wp_tdmv_state(void* pcard, int state); static int wp_tdmv_running(void* pcard); @@ -271,6 +275,8 @@ static inline void stop_alarm(wp_tdmv_softc_t* wp); static int wp_tdmv_init(void* pcard, wanif_conf_t *conf); +static void wp_tdmv_callback_dtmf (void*, wan_event_t*); + /****************************************************************************** ** wp_tdmv_te1_init() - ** @@ -368,8 +374,8 @@ static int wp_tdmv_create(void* pcard, wan_tdmv_conf_t *tdmv_conf) wp->ise1 = IS_E1_FEMEDIA(&card->fe) ? 1 : 0; wp->max_timeslots = IS_E1_FEMEDIA(&card->fe) ? 31: 24; wp->max_rxtx_len = 0; - wan_spin_lock_init(&wp->lock); - wan_spin_lock_init(&wp->tx_rx_lock); + wan_spin_lock_irq_init(&wp->lockirq, "wan_te1tdmv_lock"); + wan_spin_lock_irq_init(&wp->tx_rx_lockirq, "wan_te1tdmv_txrx_lock"); /* AHDLC */ if (tdmv_conf->dchan){ /* PRI signalling is selected with hw HDLC (dchan is not 0) */ @@ -575,10 +581,10 @@ static int wp_tdmv_remove(void* pcard) return -EINVAL; } - wan_spin_lock_irq(&wp->lock, &flags); + wan_spin_lock_irq(&wp->lockirq, &flags); card->wandev.te_report_rbsbits = NULL; card->wandev.te_report_alarms = NULL; - wan_spin_unlock_irq(&wp->lock, &flags); + wan_spin_unlock_irq(&wp->lockirq, &flags); if (wp){ wan_clear_bit(WP_TDMV_RUNNING, &wp->flags); @@ -716,6 +722,7 @@ static void wp_tdmv_report_rbsbits(void* pcard, int channel, unsigned char statu if (!(wp->chans[i].sig & ZT_SIG_CLEAR) && (wp->chans[i].rxsig != rxs)){ zt_rbsbits(&wp->chans[i], rxs); +#if 1 DEBUG_TDMV( "[TDMV] %s: %s:%02d(%d) RX RBS: A:%1d B:%1d C:%1d D:%1d\n", wp->devname, @@ -725,6 +732,7 @@ static void wp_tdmv_report_rbsbits(void* pcard, int channel, unsigned char statu (rxs & ZT_BBIT) ? 1 : 0, (rxs & ZT_CBIT) ? 1 : 0, (rxs & ZT_DBIT) ? 1 : 0); +#endif } } @@ -811,13 +819,13 @@ static void wp_tdmv_report_alarms(void* pcard, unsigned long te_alarm) if (wp->ise1) { if (te_alarm & WAN_TE_BIT_RED_ALARM) alarms |= ZT_ALARM_RED; - if (te_alarm & WAN_TE_BIT_OOF_ALARM) + if (te_alarm & WAN_TE_BIT_OOF_ALARM) alarms |= ZT_ALARM_RED; } else { /* Check actual alarm status */ if (te_alarm & WAN_TE_BIT_RED_ALARM) alarms |= ZT_ALARM_RED; - if (te_alarm & WAN_TE_BIT_OOF_ALARM) + if (te_alarm & WAN_TE_BIT_OOF_ALARM) alarms |= ZT_ALARM_RED; } /* Keep track of recovering */ @@ -848,7 +856,6 @@ static void wp_tdmv_report_alarms(void* pcard, unsigned long te_alarm) wp->span.alarms = alarms; zt_alarm_notify(&wp->span); - return; } @@ -1130,7 +1137,11 @@ static int wp_tdmv_software_init(wan_tdmv_t *wan_tdmv) wp->spanno + 1); DEBUG_EVENT(" Possible cause: Another TDM driver already loaded!\n"); DEBUG_EVENT(" Solution: Unload wanpipe and check currently\n"); +#if defined(__LINUX__) DEBUG_EVENT(" used spans in /proc/zaptel directory.\n"); +#else + DEBUG_EVENT(" used spans.\n"); +#endif DEBUG_EVENT(" Reconfiguring device %s to new span number # %d\n", wp->devname,wp->span.spanno); DEBUG_EVENT("\n"); @@ -1161,6 +1172,14 @@ static int wp_tdmv_software_init(wan_tdmv_t *wan_tdmv) card->tdmv_iface.is_rbsbits = wp_tdmv_is_rbsbits; card->tdmv_iface.rbsbits_poll = wp_tdmv_rbsbits_poll; } + + wp->dtmfsupport = card->u.aft.tdmv_hw_dtmf; + /* Initialize Callback event function pointers */ + if (wp->dtmfsupport == WANOPT_YES){ + DEBUG_EVENT("%s: Enable HW DTMF detection!\n", wp->devname); + card->wandev.event_callback.dtmf = wp_tdmv_callback_dtmf; + } + return 0; } @@ -1210,9 +1229,9 @@ static int wp_tdmv_shutdown(struct zt_span *span) WAN_ASSERT2(span->pvt == NULL, -ENODEV); wp = span->pvt; wan_clear_bit(WP_TDMV_RUNNING, &wp->flags); - wan_spin_lock_irq(&wp->lock, &flags); + wan_spin_lock_irq(&wp->lockirq, &flags); span->flags &= ~ZT_FLAG_RUNNING; - wan_spin_unlock_irq(&wp->lock, &flags); + wan_spin_unlock_irq(&wp->lockirq, &flags); return 0; } @@ -1231,7 +1250,7 @@ static int wp_tdmv_maint(struct zt_span *span, int cmd) WAN_ASSERT2(span == NULL, -ENODEV); WAN_ASSERT2(span->pvt == NULL, -ENODEV); wp = span->pvt; - wan_spin_lock_irq(&wp->lock, &flags); + wan_spin_lock_irq(&wp->lockirq, &flags); if (wp->ise1) { #if 0 /* FIXME: Support E1 */ @@ -1328,7 +1347,7 @@ static int wp_tdmv_maint(struct zt_span *span, int cmd) res = -EINVAL; } } - wan_spin_unlock_irq(&wp->lock, &flags); + wan_spin_unlock_irq(&wp->lockirq, &flags); return res; } @@ -1549,9 +1568,8 @@ static int wp_tdmv_rbsbits(struct zt_chan *chan, int bits) if (bits & ZT_DBIT) ABCD_bits |= WAN_RBS_SIG_D; if (IS_CHAN_HARDHDLC(chan)){ - return 0; - } - + return 0; + } DEBUG_TDMV( "[TDMV] %s: %s:%02d(%d) TX RBS: A:%1d B:%1d C:%1d D:%1d\n", wp->devname, @@ -1787,25 +1805,68 @@ wp_tdmv_ioctl(struct zt_chan *chan, unsigned int cmd, caddr_t data) wp_tdmv_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) #endif { - int err = -ENOTTY; - wp_tdmv_softc_t *wp=NULL; + sdla_t *card = NULL; + wp_tdmv_softc_t *wp = NULL; + wan_event_ctrl_t *event_ctrl = NULL; + int err = -ENOTTY, x; #ifdef CONFIG_PRODUCT_WANPIPE_TDM_VOICE_ECHOMASTER - wp_tdmv_softc_t *echo_detect_wp = NULL; int echo_detect_chan = 0; #endif + WAN_ASSERT(chan == NULL || chan->pvt == NULL); wp = chan->pvt; - + WAN_ASSERT(wp->card == NULL); + card = wp->card; + switch(cmd) { + case ZT_TONEDETECT: + err = WAN_COPY_FROM_USER(&x, (int*)data, sizeof(int)); + if (err) return -EFAULT; + if (wp->dtmfsupport != WANOPT_YES || card->wandev.ec_dev == NULL){ + return -ENOSYS; + } + DEBUG_TDMV("[TDMV] %s: Hardware Tone Event detection (%s:%s)!\n", + wp->devname, + (x & ZT_TONEDETECT_ON) ? "ON" : "OFF", + (x & ZT_TONEDETECT_MUTE) ? "Mute ON" : "Mute OFF"); + + if (x & ZT_TONEDETECT_ON){ + wp->dtmfmask |= (1 << (chan->chanpos - 1)); + }else{ + wp->dtmfmask &= ~(1 << (chan->chanpos - 1)); + } + if (x & ZT_TONEDETECT_MUTE){ + wp->dtmfmutemask |= (1 << (chan->chanpos - 1)); + }else{ + wp->dtmfmutemask &= ~(1 << (chan->chanpos - 1)); + } + +#if defined(CONFIG_WANPIPE_HWEC) + event_ctrl = wan_malloc(sizeof(wan_event_ctrl_t)); + if (event_ctrl==NULL){ + DEBUG_EVENT( + "%s: Failed to allocate memory for event ctrl!\n", + wp->devname); + return -EFAULT; + } + event_ctrl->type = WAN_EVENT_EC_CHAN_MODIFY; + event_ctrl->channel = chan->chanpos-1; + event_ctrl->mode = (x & ZT_TONEDETECT_MUTE) ? WAN_EVENT_ENABLE : WAN_EVENT_DISABLE; + if (wanpipe_ec_event_ctrl(card->wandev.ec_dev, card, event_ctrl)){ + wan_free(event_ctrl); + } + err = 0; +#else + err = -EINVAL; +#endif + break; + #if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN) && defined(ZT_DCHAN_TX) case ZT_DCHAN_TX: - WAN_ASSERT(chan == NULL || chan->pvt == NULL); - wp = chan->pvt; - if (wp->dchan_dev && wp->dchan_dev->hard_start_xmit){ wp_tdmv_tx_dchan(chan, (int)data); err=0; @@ -1821,16 +1882,16 @@ wp_tdmv_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) WAN_ASSERT(chan == NULL || chan->pvt == NULL); - echo_detect_wp = chan->pvt; echo_detect_chan = chan->chanpos - 1; - DEBUG_ECHO("on span: %d, chanpos: %d\n", echo_detect_wp->spanno, - echo_detect_chan); + DEBUG_ECHO("on span: %d, chanpos: %d\n", + wp->spanno, + echo_detect_chan); if(echo_detect_chan > 30 || echo_detect_chan < 0){ err=-EOPNOTSUPP; }else{ - wan_tdmv_t *wan_tdmv = &echo_detect_wp->card->wan_tdmv; + wan_tdmv_t *wan_tdmv = &wp->card->wan_tdmv; wan_tdmv_rxtx_pwr_t *pwr_rxtx = &wan_tdmv->chan_pwr[echo_detect_chan]; DEBUG_ECHO("%s():using %s table.\n", __FUNCTION__, @@ -1880,29 +1941,30 @@ static int wp_tdmv_hwec(struct zt_chan *chan, int enable) WAN_ASSERT2(wp->card == NULL, -ENODEV); card = wp->card; + if (!wp->ise1){ + channel--; + } + if (enable) { wan_set_bit(channel,&card->wandev.rtp_tap_call_map); } else { wan_clear_bit(channel,&card->wandev.rtp_tap_call_map); } - - + if (card->wandev.ec_enable){ - DEBUG_TDMV("[TDMV]: %s: %s HW echo canceller on channel %d\n", + DEBUG_TDMV("[TDMV] %s: %s HW echo canceller on channel %d\n", wp->devname, (enable) ? "Enable" : "Disable", channel); - if (!wp->ise1){ - channel--; - } + /* The ec persist flag enables and disables * persistent echo control. In persist mode * echo cancellation is enabled regardless of * asterisk. In persist mode off asterisk - * controls hardware echo cancellation */ + * controls hardware echo cancellation */ if (card->hwec_conf.persist_disable || IS_CHAN_HARDHDLC(chan)) { - err = card->wandev.ec_enable(card, enable, channel); + err = card->wandev.ec_enable(card, enable, chan->chanpos); } else { err = 0; } @@ -2031,7 +2093,6 @@ static int wp_tdmv_rx_dchan(wan_tdmv_t *wan_tdmv, int channo, wp->devname); return -EINVAL; } - if (!IS_CHAN_HARDHDLC(ms)){ DEBUG_TDMV("%s: ERROR: %s not defined as D-CHAN!\n", wp->devname, ms->name); @@ -2093,18 +2154,15 @@ static int wp_tdmv_rx_dchan(wan_tdmv_t *wan_tdmv, int channo, wake_up_interruptible(&ms->eventbufq); #elif defined(__FreeBSD__) || defined(__OpenBSD__) wakeup(&ms->readbufq); - wakeup(&ms->sel); + _selwakeup(&ms->sel); if (ms->iomask & ZT_IOMUX_READ) wakeup(&ms->eventbufq); - #endif } return 0; } #endif - - #if defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN) && defined(CONFIG_PRODUCT_WANPIPE_TDM_VOICE_DCHAN_ZAPTEL) static void wp_tdmv_tx_hdlc_hard(struct zt_chan *chan) { @@ -2150,7 +2208,6 @@ static int wp_tdmv_tx_dchan(struct zt_chan *chan, int len) WAN_ASSERT2(chan->pvt == NULL, -ENODEV); wp = chan->pvt; WAN_ASSERT(wp->dchan_dev == NULL); - if (len <= 2){ return -EINVAL; @@ -2187,7 +2244,6 @@ static int wp_tdmv_tx_dchan(struct zt_chan *chan, int len) #endif - /****************************************************************************** ** wp_tdmv_rx_chan() - ** @@ -2307,6 +2363,7 @@ static int wp_tdmv_rx_chan(wan_tdmv_t *wan_tdmv, int channo, return 0; } + static int wp_tdmv_span_buf_rotate(void *pcard, u32 buf_sz, unsigned long mask) { sdla_t *card = (sdla_t*)pcard; @@ -2353,7 +2410,6 @@ static int wp_tdmv_span_buf_rotate(void *pcard, u32 buf_sz, unsigned long mask) } } - return 0; } @@ -2420,3 +2476,51 @@ static int wp_tdmv_init(void* pcard, wanif_conf_t *conf) return -EINVAL; } +/****************************************************************************** +** wp_tdmv_callback_dtmf() - +* +** OK +*/ +static void wp_tdmv_callback_dtmf (void* card_id, wan_event_t *event) +{ + sdla_t *card = (sdla_t*)card_id; + wan_tdmv_t *wan_tdmv = &card->wan_tdmv; + wp_tdmv_softc_t *wp = NULL; + + WAN_ASSERT1(wan_tdmv->sc == NULL); + wp = wan_tdmv->sc; + + if (event->type != WAN_EVENT_EC_DTMF){ + DEBUG_EVENT("ERROR: %s: Invalid event type %X!\n", + card->devname, event->type); + return; + } + DEBUG_TDMV( + "[TDMV] %s: Received EC DTMF Event at TDM (%d:%c:%s:%s)!\n", + card->devname, + event->channel, + event->digit, + (event->dtmf_port == WAN_EC_CHANNEL_PORT_ROUT)?"ROUT":"SOUT", + (event->dtmf_type == WAN_EC_TONE_PRESENT)?"PRESENT":"STOP"); + + if (!(wp->dtmfmask & (1 << (event->channel-1)))){ + DEBUG_TDMV( + "[TDMV] %s: DTMF is not enabled for the channel %d\n", + card->devname, + event->channel); + return; + } + + if (event->dtmf_type == WAN_EC_TONE_PRESENT){ + wp->dtmfactive |= (1 << event->channel); + zt_qevent_lock( + &wp->span.chans[event->channel-1], + (ZT_EVENT_DTMFDOWN | event->digit)); + }else{ + wp->dtmfactive &= ~(1 << event->channel); + zt_qevent_lock( + &wp->span.chans[event->channel-1], + (ZT_EVENT_DTMFUP | event->digit)); + } + return; +} diff --git a/patches/kdrivers/src/net/sdla_te1.c b/patches/kdrivers/src/net/sdla_te1.c index 77be60b..4bbbb79 100644 --- a/patches/kdrivers/src/net/sdla_te1.c +++ b/patches/kdrivers/src/net/sdla_te1.c @@ -29,25 +29,27 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: sdla_te1.c,v 1.255 2007/03/30 21:13:30 sangoma Exp $ + * $Id: sdla_te1.c,v 1.285 2008/03/06 21:29:43 sangoma Exp $ */ /* - ****************************************************************************** - * sdla_te1.c WANPIPE(tm) Multiprotocol WAN Link Driver. - * T1/E1 board configuration. - * - * Author: Alex Feldman - * - * ============================================================================ - * Aprl 29, 2001 Alex Feldman Initial version. - * - * - * - * MAr 7, 2007 Alex Feldman Remove Squence option. Some equipment - * doesn't like it. - ****************************************************************************** - */ +******************************************************************************* +** sdla_te1.c WANPIPE(tm) Multiprotocol WAN Link Driver. +** T1/E1 board configuration. +** +** Author: Alex Feldman +** +** ============================================================================ +** Aprl 29, 2001 Alex Feldman Initial version. +** Mar 7, 2007 Alex Feldman Remove Squence option. Some equipment +** doesn't like it. +** Nov 16, 2007 Alex Feldman Enable SQUELCHE bit in RLPS register. +** In some cases, LOS/ALOS is going crazy +** while cable doesn't have termination. +** (specialy for A102 old cards) +** Nov 21, 2007 Alex Feldman Add LOS Alarm for link state verification +** in Unframed mode. +******************************************************************************/ /****************************************************************************** * INCLUDE FILES @@ -84,7 +86,15 @@ /****************************************************************************** * DEFINES AND MACROS ******************************************************************************/ -#define WAN_TE1_IGNORE_RLPS_ALOS +#define WAN_TE1_IGNORE_RLPS_ALOS + +#if 0 +# define FE_ALOS_ENABLE +# define FE_LOS_ENABLE +# define FE_OOF_PRINT +# define FE_LOS_PRINT +# define FE_ALOS_PRINT +#endif #define FIRST_SAMPLE 0 #define LAST_SAMPLE 23 @@ -99,39 +109,44 @@ static int te_reg_verify = 0; if (te_reg_verify){\ unsigned char current_val;\ current_val=fe->read_fe_reg( \ - fe->card, \ + ((sdla_t*)fe->card)->hw, \ + (int)(((sdla_t*)fe->card)->wandev.state==WAN_CONNECTED), \ (int)fe->fe_cfg.line_no, \ (int)((reg) + (fe->fe_cfg.line_no*PMC4_LINE_DELTA)));\ DEBUG_EVENT("%s: Writing Reg:%02X=%02X (%02X)\n", \ fe->name,(unsigned char)(reg),(unsigned char)(val),current_val);\ }\ fe->write_fe_reg( \ - fe->card, \ - (int)fe->fe_cfg.line_no, \ + ((sdla_t*)fe->card)->hw, \ + (int)(((sdla_t*)fe->card)->wandev.state==WAN_CONNECTED), \ + (int)fe->fe_cfg.line_no, \ (int)((reg) + (fe->fe_cfg.line_no*PMC4_LINE_DELTA)), \ (int)(val)) #define WRITE_REG_LINE(fe_line_no, reg,val) \ fe->write_fe_reg( \ - fe->card, \ - (int)fe_line_no, \ + ((sdla_t*)fe->card)->hw, \ + (int)(((sdla_t*)fe->card)->wandev.state==WAN_CONNECTED), \ + (int)fe_line_no, \ (int)((reg) + (fe_line_no)*PMC4_LINE_DELTA), \ (int)(val)) #define READ_REG(reg) \ fe->read_fe_reg( \ - fe->card, \ - (int)fe->fe_cfg.line_no, \ + ((sdla_t*)fe->card)->hw, \ + (int)(((sdla_t*)fe->card)->wandev.state==WAN_CONNECTED), \ + (int)fe->fe_cfg.line_no, \ (int)((reg) + (fe->fe_cfg.line_no*PMC4_LINE_DELTA))) #define READ_REG_LINE(fe_line_no, reg) \ fe->read_fe_reg( \ - fe->card, \ - (int)fe_line_no, \ + ((sdla_t*)fe->card)->hw, \ + (int)(((sdla_t*)fe->card)->wandev.state==WAN_CONNECTED), \ + (int)fe_line_no, \ (int)((reg) + (fe_line_no)*PMC4_LINE_DELTA)) /* Enabling/Disabling register debugging */ - #undef WAN_DEBUG_TE1_REG +#undef WAN_DEBUG_TE1_REG #ifdef WAN_DEBUG_TE1_REG # define TEST_REG(reg,value){ \ @@ -199,7 +214,8 @@ static int te_reg_verify = 0; #define WAN_TE1_FRAMED_ALARMS (WAN_TE_BIT_RED_ALARM | WAN_TE_BIT_OOF_ALARM) -#define WAN_TE1_UNFRAMED_ALARMS (WAN_TE_BIT_RED_ALARM | WAN_TE_BIT_LOS_ALARM) +/* Nov 21, 2007 AF */ +#define WAN_TE1_UNFRAMED_ALARMS (WAN_TE_BIT_RED_ALARM|WAN_TE_BIT_LOS_ALARM) #if 0 #define TE1_FRAME_ALARM (\ @@ -214,14 +230,6 @@ static int te_reg_verify = 0; WAN_TE_BIT_LOS_ALARM) #endif -#if 0 -# define FE_ALOS_ENABLE - -# define FE_OOF_PRINT -# define FE_LOS_PRINT -# define FE_ALOS_PRINT -#endif - /****************************************************************************** * STRUCTURES AND TYPEDEFS ******************************************************************************/ @@ -2300,7 +2308,7 @@ static int sdla_te_intr(sdla_fe_t *); static int sdla_te_check_intr(sdla_fe_t *); static int sdla_te_polling(sdla_fe_t*); static int sdla_te_udp(sdla_fe_t*, void*, unsigned char*); -static void sdla_te_set_status(sdla_fe_t*, unsigned long); +static void sdla_te_set_status(sdla_fe_t*, u_int32_t ); static int sdla_te_get_snmp_data(sdla_fe_t* fe, void* pdev, void* data); static int sdla_te_set_lbmode(sdla_fe_t*, unsigned char, unsigned char); @@ -2327,11 +2335,11 @@ static void sdla_te_abcd_update(sdla_fe_t* fe); static int sdla_te_pmon(sdla_fe_t *fe, int); static int sdla_te_flush_pmon(sdla_fe_t *fe); -static unsigned int sdla_te_read_alarms(sdla_fe_t *fe, int action); +static u_int32_t sdla_te_read_alarms(sdla_fe_t *fe, int action); static int sdla_te_print_alarms(sdla_fe_t* fe, unsigned int); static char* sdla_te_print_channels(sdla_fe_t* fe); -static int sdla_te_set_alarms(sdla_fe_t* pfe, unsigned int); -static int sdla_te_clear_alarms(sdla_fe_t* pfe, unsigned long); +static int sdla_te_set_alarms(sdla_fe_t* pfe, u_int32_t); +static int sdla_te_clear_alarms(sdla_fe_t* pfe, u_int32_t); static int sdla_te_sigctrl(sdla_fe_t*, int, unsigned long, int); static int sdla_te_add_event(sdla_fe_t*, sdla_fe_timer_event_t*); @@ -3292,8 +3300,9 @@ int sdla_te_default_cfg(void* pfe, void* pfe_cfg, int media) * Returns: ****************************************************************************** */ -int sdla_te_iface_init(void *pfe_iface) +int sdla_te_iface_init(void *p_fe, void *pfe_iface) { + sdla_fe_t *fe = (sdla_fe_t*)p_fe; sdla_fe_iface_t *fe_iface = (sdla_fe_iface_t*)pfe_iface; fe_iface->reset = &sdla_te_reset; @@ -3308,6 +3317,7 @@ int sdla_te_iface_init(void *pfe_iface) fe_iface->disable_irq = &sdla_te_disable_irq; fe_iface->check_isr = &sdla_te_check_intr; fe_iface->polling = &sdla_te_polling; + fe_iface->add_timer = &sdla_te_add_timer; fe_iface->process_udp = &sdla_te_udp; fe_iface->print_fe_alarm = &sdla_te_print_alarms; fe_iface->print_fe_act_channels = &sdla_te_print_channels; @@ -3331,6 +3341,11 @@ int sdla_te_iface_init(void *pfe_iface) fe_iface->get_snmp_data = &sdla_te_get_snmp_data; #endif + /* Initial FE state */ + fe->fe_status = FE_UNITIALIZED; /*FE_DISCONNECTED;*/ + WAN_LIST_INIT(&fe->event); + wan_spin_lock_irq_init(&fe->lockirq, "wan_te1_lock"); + return 0; } @@ -3459,7 +3474,7 @@ static int sdla_pmc4351_te_config(sdla_fe_t *fe, u16 adapter_type) /* XLPG Line Driver Configuration (Reg. 0xF0) */ if (IS_FE_TXTRISTATE(fe)){ - DEBUG_EVENT("%s: Disable Transmitter (tx tri-state mode)!\n", + DEBUG_EVENT("%s: Disable TX (tri-state mode)\n", fe->name); WRITE_REG(REG_XLPG_LINE_CFG, BIT_XLPG_LINE_CFG_HIGHZ); }else{ @@ -3522,6 +3537,8 @@ static int sdla_pmc4351_te_config(sdla_fe_t *fe, u16 adapter_type) } if (WAN_FE_FRAME(fe) == WAN_FR_ESF){ value |= BIT_T1_XBAS_ESF; + }else if (WAN_FE_FRAME(fe) == WAN_FR_SLC96){ + value |= BIT_T1_XBAS_FMS1; } if (IS_J1_FEMEDIA(fe)){ value |= BIT_T1_XBAS_JPN; @@ -3532,6 +3549,8 @@ static int sdla_pmc4351_te_config(sdla_fe_t *fe, u16 adapter_type) value = 0x00; if (WAN_FE_FRAME(fe) == WAN_FR_ESF){ value = BIT_T1_FRMR_ESF | BIT_T1_FRMR_ESFFA; + }else if (WAN_FE_FRAME(fe) == WAN_FR_SLC96){ + value = BIT_T1_FRMR_FMS1; } if (IS_J1_FEMEDIA(fe)){ value |= BIT_T1_FRMR_JPN; @@ -3542,6 +3561,8 @@ static int sdla_pmc4351_te_config(sdla_fe_t *fe, u16 adapter_type) value = 0x00; if (WAN_FE_FRAME(fe) == WAN_FR_ESF){ value = BIT_T1_ALMI_CFG_ESF; + }else if (WAN_FE_FRAME(fe) == WAN_FR_SLC96){ + value |= BIT_T1_ALMI_CFG_FMS1; } WRITE_REG(REG_T1_ALMI_CFG, value); } @@ -3619,7 +3640,7 @@ static int sdla_pmc4351_te_config(sdla_fe_t *fe, u16 adapter_type) } /* RLPS Configuration and Status (Reg 0xF8) */ - /* AF Nov 2007 + /* AF Nov 16, 2007 ** Set SQUELCHE to 1. This forces RLPS to stop sending pulses ** to CDRC during ALOS conditions */ #if defined (WAN_TE1_IGNORE_RLPS_ALOS) @@ -3815,6 +3836,8 @@ static int sdla_pmc4354_te_config(sdla_fe_t *fe, u16 adapter_type) } if (WAN_FE_FRAME(fe) == WAN_FR_ESF){ value |= BIT_T1_XBAS_ESF; + //}else if (WAN_FE_FRAME(fe) == WAN_FR_SLC96){ + // value |= BIT_T1_XBAS_FMS1; } if (IS_J1_FEMEDIA(fe)){ value |= BIT_T1_XBAS_JPN; @@ -3825,7 +3848,10 @@ static int sdla_pmc4354_te_config(sdla_fe_t *fe, u16 adapter_type) value = 0x00; if (WAN_FE_FRAME(fe) == WAN_FR_ESF){ value = BIT_T1_FRMR_ESF | BIT_T1_FRMR_ESFFA; + }else if (WAN_FE_FRAME(fe) == WAN_FR_SLC96){ + value = BIT_T1_FRMR_FMS1; } + if (IS_J1_FEMEDIA(fe)){ value |= BIT_T1_FRMR_JPN; } @@ -3835,6 +3861,8 @@ static int sdla_pmc4354_te_config(sdla_fe_t *fe, u16 adapter_type) value = 0x00; if (WAN_FE_FRAME(fe) == WAN_FR_ESF){ value |= BIT_T1_ALMI_CFG_ESF; + }else if (WAN_FE_FRAME(fe) == WAN_FR_SLC96){ + value |= BIT_T1_ALMI_CFG_FMS1; } WRITE_REG(REG_T1_ALMI_CFG, value); } @@ -3932,16 +3960,16 @@ static int sdla_pmc4354_te_config(sdla_fe_t *fe, u16 adapter_type) } /* RLPS Configuration and Status (Reg 0xQF8) */ - /* AF Nov 2007 - ** Set SQUELCHE to 1. This forces RLPS to stop sending pulses - ** to CDRC during ALOS conditions */ + /* AF Nov 16, 2007 + ** Set SQUELCHE to 1. This forces RLPS to stop sending pulses + ** to CDRC during ALOS conditions */ #if defined (WAN_TE1_IGNORE_RLPS_ALOS) - WRITE_REG(REG_RLPS_CFG_STATUS, - BIT_RLPS_CFG_STATUS_LONGE | - BIT_RLPS_CFG_STATUS_SQUELCHE); + WRITE_REG(REG_RLPS_CFG_STATUS, + BIT_RLPS_CFG_STATUS_LONGE | + BIT_RLPS_CFG_STATUS_SQUELCHE); #else - WRITE_REG(REG_RLPS_CFG_STATUS, - BIT_RLPS_CFG_STATUS_LONGE); + WRITE_REG(REG_RLPS_CFG_STATUS, + BIT_RLPS_CFG_STATUS_LONGE); #endif /* RLPS ALOS Detection/Clearance Thresholds (Reg 0xQF9) */ @@ -4052,7 +4080,7 @@ static int sdla_pmc4354_te_config(sdla_fe_t *fe, u16 adapter_type) /* XLPG Line Driver Configuration (Reg. 0xQF0) */ if (IS_FE_TXTRISTATE(fe)){ - DEBUG_EVENT("%s: Disable Transmitter (tx tri-state mode)!\n", + DEBUG_EVENT("%s: Disable TX (tri-state mode)\n", fe->name); WRITE_REG(REG_XLPG_LINE_CFG, BIT_XLPG_LINE_CFG_HIGHZ); }else{ @@ -4113,79 +4141,177 @@ static int sdla_pmc4354_rlps_optim(sdla_fe_t *fe) return 0; } +/****************************************************************************** +** sdla_t1_cfg_verify() +** +** Description: Verify T1 Front-End configuration +** Arguments: +** Returns: 0 - successfully, otherwise -EINVAL. +*******************************************************************************/ +static int sdla_t1_cfg_verify(void* pfe) +{ + sdla_fe_t *fe = (sdla_fe_t*)pfe; + + /* Verify FE framing type */ + switch(WAN_FE_FRAME(fe)){ + case WAN_FR_D4: case WAN_FR_ESF: case WAN_FR_UNFRAMED: + break; + case WAN_FR_NONE: + DEBUG_EVENT("%s: Defaulting T1 Frame = ESF\n", + fe->name); + WAN_FE_FRAME(fe) = WAN_FR_ESF; + break; + default: + DEBUG_EVENT("%s: Error: Invalid %s FE Framing type (%X)\n", + fe->name, + FE_MEDIA_DECODE(fe), + WAN_FE_FRAME(fe)); + return -EINVAL; + break; + } + + /* Verify FE line code type */ + switch(WAN_FE_LCODE(fe)){ + case WAN_LCODE_B8ZS: case WAN_LCODE_AMI: + break; + case WAN_LCODE_NONE: + DEBUG_EVENT("%s: Defaulting T1 Line Code = B8ZS\n", + fe->name); + WAN_FE_LCODE(fe) = WAN_LCODE_B8ZS; + break; + default: + DEBUG_EVENT("%s: Error: Invalid %s FE Line code type (%X)\n", + fe->name, + FE_MEDIA_DECODE(fe), + WAN_FE_LCODE(fe)); + return -EINVAL; + break; + } + + /* Verify LBO */ + switch(WAN_TE1_LBO(fe)) { + case WAN_T1_LBO_0_DB: case WAN_T1_LBO_75_DB: + case WAN_T1_LBO_15_DB: case WAN_T1_LBO_225_DB: + case WAN_T1_0_133: case WAN_T1_133_266: case WAN_T1_110_220: + case WAN_T1_266_399: case WAN_T1_220_330: + case WAN_T1_399_533: case WAN_T1_330_440: case WAN_T1_440_550: + case WAN_T1_533_655: case WAN_T1_550_660: + break; + case WAN_T1_LBO_NONE: + DEBUG_EVENT("%s: Defaulting T1 LBO = 0 db\n", + fe->name); + WAN_TE1_LBO(fe) = WAN_T1_LBO_0_DB; + break; + default: + DEBUG_EVENT("%s: Error: Invalid %s LBO value (%X)\n", + fe->name, + FE_MEDIA_DECODE(fe), + WAN_TE1_LBO(fe)); + return -EINVAL; + break; + } + return 0; +} + +/****************************************************************************** +** sdla_e1_cfg_verify() +** +** Description: Verify E1 Front-End configuration +** Arguments: +** Returns: 0 - successfully, otherwise -EINVAL. +*******************************************************************************/ +static int sdla_e1_cfg_verify(void* pfe) +{ + sdla_fe_t *fe = (sdla_fe_t*)pfe; + + /* Verify FE framing type */ + switch(WAN_FE_FRAME(fe)){ + case WAN_FR_NCRC4: case WAN_FR_CRC4: case WAN_FR_UNFRAMED: + break; + case WAN_FR_NONE: + DEBUG_EVENT("%s: Defaulting E1 Frame = CRC4\n", + fe->name); + WAN_FE_FRAME(fe) = WAN_FR_CRC4; + break; + default: + DEBUG_EVENT("%s: Error: Invalid %s FE Framing type (%X)\n", + fe->name, + FE_MEDIA_DECODE(fe), + WAN_FE_FRAME(fe)); + return -EINVAL; + break; + } + /* Verify FE line code type */ + switch(WAN_FE_LCODE(fe)){ + case WAN_LCODE_HDB3: case WAN_LCODE_AMI: + break; + case WAN_LCODE_NONE: + DEBUG_EVENT("%s: Defaulting E1 Line Code = HDB3\n", + fe->name); + WAN_FE_LCODE(fe) = WAN_LCODE_HDB3; + break; + default: + DEBUG_EVENT("%s: Error: Invalid %s FE Line code type (%X)\n", + fe->name, + FE_MEDIA_DECODE(fe), + WAN_FE_LCODE(fe)); + return -EINVAL; + break; + } + + /* Verify LBO */ + switch(WAN_TE1_LBO(fe)) { + case WAN_E1_120: case WAN_E1_75: + break; + case WAN_T1_LBO_NONE: + DEBUG_EVENT("%s: Defaulting E1 LBO = 120 OH\n", + fe->name); + WAN_TE1_LBO(fe) = WAN_E1_120; + break; + default: + DEBUG_EVENT("%s: Error: Invalid %s LBO value (%X)\n", + fe->name, + FE_MEDIA_DECODE(fe), + WAN_TE1_LBO(fe)); + return -EINVAL; + break; + } + + switch(WAN_TE1_SIG_MODE(fe)){ + case WAN_TE1_SIG_CAS: case WAN_TE1_SIG_CCS: + break; + case WAN_TE1_SIG_NONE: + DEBUG_EVENT("%s: Defaulting E1 Signalling = CCS\n", + fe->name); + WAN_TE1_SIG_MODE(fe) = WAN_TE1_SIG_CCS; + break; + default: + DEBUG_EVENT("%s: Error: Invalid E1 Signalling type (%X)\n", + fe->name, + WAN_TE1_SIG_MODE(fe)); + return -EINVAL; + break; + } + return 0; +} + /* - ****************************************************************************** - * sdla_te_chip_config() - * - * Description: Configure Sangoma T1/E1 chip - * Arguments: - * Returns: - ****************************************************************************** - */ +****************************************************************************** +** sdla_te_chip_config() +** +** Description: Configure Sangoma T1/E1 chip +** Arguments: +** Returns: +******************************************************************************/ static int sdla_te_chip_config(sdla_fe_t *fe) { sdla_t* card = (sdla_t*)fe->card; u16 adapter_type; - unsigned char value = 0x00; WAN_ASSERT(fe->write_fe_reg == NULL); WAN_ASSERT(fe->read_fe_reg == NULL); - /* Revision/Chip ID (Reg. 0x0D) */ - value = READ_REG_LINE(0, REG_REVISION_CHIP_ID); - fe->fe_chip_id = value & MASK_CHIP_ID; - switch(fe->fe_chip_id){ - case CHIP_ID_COMET: - fe->fe_cfg.line_no = 0; - break; - case CHIP_ID_COMET_QUAD: - if ((int)WAN_FE_LINENO(fe) < 0 || WAN_FE_LINENO(fe) > 3){ - DEBUG_EVENT("%s: TE Config: Invalid Port selected %d (Min=1 Max=4)\n", - fe->name, - WAN_FE_LINENO(fe)+1); - return -EINVAL; - } - break; - default: - DEBUG_EVENT("%s: ERROR: Unsupported PMC %s CHIP (%02X)\n", - fe->name, - FE_MEDIA_DECODE(fe), - (fe->fe_chip_id >> 5)); - return -EINVAL; - } - - card->hw_iface.getcfg(card->hw, SDLA_ADAPTERTYPE, &adapter_type); - DEBUG_EVENT("%s: Configuring PMC %s %s FE\n", - fe->name, - DECODE_CHIPID(fe->fe_chip_id), - FE_MEDIA_DECODE(fe)); - DEBUG_EVENT("%s: Port %d,%s,%s,%s\n", - fe->name, - WAN_FE_LINENO(fe)+1, - FE_LCODE_DECODE(fe), - FE_FRAME_DECODE(fe), - TE_LBO_DECODE(fe)); - DEBUG_EVENT("%s: Clk %s:%d, Ch %X\n", - fe->name, - TE_CLK_DECODE(fe), - WAN_TE1_REFCLK(fe), - WAN_TE1_ACTIVE_CH(fe)); - - if (IS_E1_FEMEDIA(fe)){ - DEBUG_EVENT("%s: Sig Mode %s\n", - fe->name, - WAN_TE1_SIG_DECODE(fe)); - } - - if (WAN_FE_FRAME(fe) == WAN_FR_UNFRAMED && - WAN_TE1_ACTIVE_CH(fe) != ENABLE_ALL_CHANNELS){ - DEBUG_EVENT( - "%s: ERROR: Invalid active channel list for Unframed mode (%X)!\n", - fe->name, WAN_TE1_ACTIVE_CH(fe)); - return -EINVAL; - } - fe->te_param.max_channels = (IS_E1_FEMEDIA(fe)) ? NUM_OF_E1_TIMESLOTS: NUM_OF_T1_CHANNELS; fe->te_param.lb_rx_code = LINELB_DS1LINE_DISABLE; @@ -4248,24 +4374,14 @@ static int sdla_te_chip_config(sdla_fe_t *fe) static int sdla_te_config(void* pfe) { sdla_fe_t *fe = (sdla_fe_t*)pfe; + int err = 0; + unsigned char value; WAN_ASSERT(fe->write_fe_reg == NULL); WAN_ASSERT(fe->read_fe_reg == NULL); - /* Initial FE state */ - fe->fe_status = FE_UNITIALIZED; /*FE_DISCONNECTED;*/ - WAN_LIST_INIT(&fe->event); - wan_spin_lock_init(&fe->lock); - -#if 1 memset(&fe->te_param, 0, sizeof(sdla_te_param_t)); - if (sdla_te_chip_config(fe)){ - DEBUG_EVENT("%s: Failed to configure %s Front-End chip!\n", - fe->name, - FE_MEDIA_DECODE(fe)); - return -EINVAL; - } -#else + /* Revision/Chip ID (Reg. 0x0D) */ value = READ_REG_LINE(0, REG_REVISION_CHIP_ID); fe->fe_chip_id = value & MASK_CHIP_ID; @@ -4289,8 +4405,18 @@ static int sdla_te_config(void* pfe) return -EINVAL; } + if (IS_T1_FEMEDIA(fe) || IS_J1_FEMEDIA(fe)){ + err = sdla_t1_cfg_verify(fe); + }else if (IS_E1_FEMEDIA(fe)){ + err = sdla_e1_cfg_verify(fe); + }else{ + DEBUG_EVENT("%s: Error: Invalid FE Media type (%X)\n", + fe->name, + WAN_FE_MEDIA(fe)); + err =-EINVAL; + } + if (err) return -EINVAL; - card->hw_iface.getcfg(card->hw, SDLA_ADAPTERTYPE, &adapter_type); DEBUG_EVENT("%s: Configuring PMC %s %s FE\n", fe->name, DECODE_CHIPID(fe->fe_chip_id), @@ -4313,8 +4439,6 @@ static int sdla_te_config(void* pfe) WAN_TE1_SIG_DECODE(fe)); } - memset(&fe->te_param, 0, sizeof(sdla_te_param_t)); - if (WAN_FE_FRAME(fe) == WAN_FR_UNFRAMED && WAN_TE1_ACTIVE_CH(fe) != ENABLE_ALL_CHANNELS){ DEBUG_EVENT( @@ -4323,57 +4447,17 @@ static int sdla_te_config(void* pfe) return -EINVAL; } - fe->te_param.max_channels = - (IS_E1_FEMEDIA(fe)) ? NUM_OF_E1_TIMESLOTS: NUM_OF_T1_CHANNELS; - fe->te_param.lb_rx_code = LINELB_DS1LINE_DISABLE; - switch(fe->fe_chip_id){ - case CHIP_ID_COMET: - sdla_pmc4351_te_config(fe, adapter_type); - break; - - case CHIP_ID_COMET_QUAD: - sdla_pmc4354_te_config(fe, adapter_type); - sdla_pmc4354_rlps_optim(fe); - break; - - default: - DEBUG_EVENT("%s: ERROR: Unsupported T1/E1 CHIP (0x%02X)\n", - fe->name, (fe->fe_chip_id >> 5)); + if (sdla_te_chip_config(fe)){ + DEBUG_EVENT("%s: Failed to configure %s Front-End chip!\n", + fe->name, + FE_MEDIA_DECODE(fe)); return -EINVAL; } - ClearRPSCReg(fe); - ClearTPSCReg(fe); - DisableAllChannels(fe); - EnableChannels(fe); -#if 0 - if (WAN_TE1_ACTIVE_CH(fe) == ENABLE_ALL_CHANNELS){ - DEBUG_EVENT("%s: All channels enabled\n", fe->name); - EnableAllChannels(fe); - }else{ - int channel_range = (IS_T1_FEMEDIA(fe)) ? - NUM_OF_T1_CHANNELS : NUM_OF_E1_CHANNELS; - //NUM_OF_T1_CHANNELS : NUM_OF_E1_TIMESLOTS; - - int i = 0; - - for(i = 1; i <= channel_range; i++){ - if (WAN_TE1_ACTIVE_CH(fe) & (1 << (i - 1))){ - DEBUG_EVENT("%s: Enable channel %d\n", - fe->name, i-1); - EnableTxChannel(fe, i-1); - EnableRxChannel(fe, i-1); - } - } - } -#endif - -#endif - /* Set initial FE status to uninitialized value and let the next function - * set correct value */ - fe->fe_status = FE_UNITIALIZED; /*FE_DISCONNECTED;*/ - /* Read initial alarm status and then enable T1/E1 alarm interrupts */ - /* sdla_te_alarm(fe, 0); */ + /* Read initial alarm status */ + sdla_te_read_alarms(fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE); + sdla_te_pmon(fe, WAN_FE_PMON_UPDATE); + sdla_te_flush_pmon(fe); wan_set_bit(TE_CONFIGURED,(void*)&fe->te_param.critical); return 0; @@ -4407,7 +4491,7 @@ static int sdla_te_reconfig(sdla_fe_t* fe) WRITE_REG(REG_E1_FRMR_CFG, value); }else if (WAN_TE1_SIG_MODE(fe) == WAN_TE1_SIG_CCS){ - DEBUG_EVENT("%s: Disable E1 CAS signalling mode!\n", + DEBUG_EVENT("%s: Enable E1 CCS signalling mode!\n", fe->name); /* E1-TRAN Configuration (Reg. 0x80) */ value = READ_REG(REG_E1_TRAN_CFG); @@ -4468,8 +4552,9 @@ static int sdla_te_post_init(void *pfe) static int sdla_te_pre_release(void* pfe) { sdla_fe_t *fe = (sdla_fe_t*)pfe; - sdla_fe_timer_event_t *fe_event; + sdla_fe_timer_event_t *fe_event = NULL; wan_smp_flag_t smp_flags; + int empty = 0; /* Kill TE timer poll command */ wan_set_bit(TE_TIMER_KILL,(void*)&fe->te_param.critical); @@ -4477,13 +4562,19 @@ static int sdla_te_pre_release(void* pfe) wan_del_timer(&fe->timer); } wan_clear_bit(TE_TIMER_RUNNING,(void*)&fe->te_param.critical); - wan_spin_lock_irq(&fe->lock,&smp_flags); - while(!WAN_LIST_EMPTY(&fe->event)){ - fe_event = WAN_LIST_FIRST(&fe->event); - WAN_LIST_REMOVE(fe_event, next); + do { + wan_spin_lock_irq(&fe->lockirq,&smp_flags); + if (!WAN_LIST_EMPTY(&fe->event)){ + fe_event = WAN_LIST_FIRST(&fe->event); + WAN_LIST_REMOVE(fe_event, next); + }else{ + empty = 1; + } + wan_spin_unlock_irq(&fe->lockirq,&smp_flags); + /* Free should be called not from spin_lock_irq (windows) !!!! */ if (fe_event) wan_free(fe_event); - } - wan_spin_unlock_irq(&fe->lock,&smp_flags); + fe_event = NULL; + }while(!empty); return 0; } @@ -4500,12 +4591,14 @@ static int sdla_te_pre_release(void* pfe) static void sdla_te_set_intr(sdla_fe_t* fe) { - DEBUG_EVENT("%s: Enabling %s Interrupts \n", + DEBUG_EVENT("%s: Enable %s Interrupts \n", fe->name, FE_MEDIA_DECODE(fe)); +#if defined(FE_LOS_ENABLE) /* Enable LOS interrupt */ WRITE_REG(REG_CDRC_INT_EN, BIT_CDRC_INT_EN_LOSE); +#endif #if defined(FE_ALOS_ENABLE) /* Enable ALOS interrupt */ @@ -4517,6 +4610,8 @@ static void sdla_te_set_intr(sdla_fe_t* fe) WRITE_REG(REG_T1_RBOC_ENABLE, BIT_T1_RBOC_ENABLE_IDLE | BIT_T1_RBOC_ENABLE_BOCE); + /* Clear ALM status register */ + READ_REG(REG_T1_ALMI_INT_STATUS); /* Enable interrupt on RED, AIS, YEL alarms */ WRITE_REG(REG_T1_ALMI_INT_EN, BIT_T1_ALMI_INT_EN_FASTD | @@ -4536,7 +4631,10 @@ static void sdla_te_set_intr(sdla_fe_t* fe) /* Enable PMON interrupt */ WRITE_REG(REG_PMON_INT_EN_STATUS, READ_REG(REG_PMON_INT_EN_STATUS) | BIT_PMON_INT_EN_STATUS_INTE); + sdla_te_pmon(fe, WAN_FE_PMON_UPDATE); /* Update PMON registers */ return; + + } /* @@ -4551,7 +4649,7 @@ static void sdla_te_set_intr(sdla_fe_t* fe) static void sdla_te_clear_intr(sdla_fe_t* fe) { - DEBUG_EVENT("%s: Clearing %s Interrupts\n", + DEBUG_EVENT("%s: Disable %s Interrupts\n", fe->name, FE_MEDIA_DECODE(fe)); @@ -4589,7 +4687,7 @@ static void sdla_te_clear_intr(sdla_fe_t* fe) /* Disable PMON interrupt */ WRITE_REG(REG_PMON_INT_EN_STATUS, READ_REG(REG_PMON_INT_EN_STATUS) & ~BIT_PMON_INT_EN_STATUS_INTE); - + sdla_te_pmon(fe, WAN_FE_PMON_UPDATE); /* Clean PMON registers */ return; } @@ -4678,8 +4776,8 @@ static int sdla_te_unconfig(void* pfe) /* Verify the FE timer is stopped */ if (!wan_test_bit(TE_TIMER_KILL,(void*)&fe->te_param.critical)){ - DEBUG_EVENT("%s: Front-End timer is not stopped!\n", - fe->name); + DEBUG_EVENT("%s: %s(): Front-End timer is not stopped!\n", + fe->name, __FUNCTION__); return -EINVAL; } @@ -4759,18 +4857,26 @@ static int sdla_te_normal_clock(sdla_fe_t *fe) return 0; } -static int sdla_te_is_t1_alarm(sdla_fe_t *fe, unsigned long alarm) +static u_int32_t sdla_te_is_t1_alarm(sdla_fe_t *fe, u_int32_t alarms) { - return (alarm & WAN_TE1_FRAMED_ALARMS); + u_int32_t alarm_mask = WAN_TE1_FRAMED_ALARMS; + + if (fe->fe_cfg.cfg.te_cfg.ignore_yel_alarm == WANOPT_NO){ + alarm_mask |= WAN_TE_BIT_RAI_ALARM; + } + return (alarms & alarm_mask); } -static int sdla_te_is_e1_alarm(sdla_fe_t *fe, unsigned long alarm) +static u_int32_t sdla_te_is_e1_alarm(sdla_fe_t *fe, u_int32_t alarms) { + u_int32_t alarm_mask = 0x00; if (WAN_FE_FRAME(fe) == WAN_FR_UNFRAMED){ - return (alarm & WAN_TE1_UNFRAMED_ALARMS); + alarm_mask = WAN_TE1_UNFRAMED_ALARMS; + }else{ + alarm_mask = WAN_TE1_FRAMED_ALARMS; } - return (alarm & WAN_TE1_FRAMED_ALARMS); + return (alarms & alarm_mask); } /* @@ -4783,42 +4889,37 @@ static int sdla_te_is_e1_alarm(sdla_fe_t *fe, unsigned long alarm) * Returns: ****************************************************************************** */ -static void sdla_te_set_status(sdla_fe_t* fe, unsigned long alarms) +static void sdla_te_set_status(sdla_fe_t* fe, u_int32_t alarms) { sdla_t *card = (sdla_t*)fe->card; + u_int32_t valid_rx_alarms = 0x00; unsigned char curr_fe_status = fe->fe_status; if (IS_T1_FEMEDIA(fe)){ - if (sdla_te_is_t1_alarm(fe, alarms)){ - if (fe->fe_status != FE_DISCONNECTED){ + valid_rx_alarms = sdla_te_is_t1_alarm(fe, alarms); + }else if (IS_E1_FEMEDIA(fe)){ + valid_rx_alarms = sdla_te_is_e1_alarm(fe, alarms); + } + + if (valid_rx_alarms){ + if (fe->fe_status != FE_DISCONNECTED){ + if (!(valid_rx_alarms & WAN_TE_BIT_RAI_ALARM)){ sdla_te_set_alarms(fe, WAN_TE_BIT_YEL_ALARM); - fe->fe_status = FE_DISCONNECTED; } - }else{ + fe->fe_status = FE_DISCONNECTED; + }else if (fe->te_param.tx_yel_alarm && valid_rx_alarms & WAN_TE_BIT_RAI_ALARM){ + /* Special case for loopback */ sdla_te_clear_alarms(fe, WAN_TE_BIT_YEL_ALARM); - if (!(fe->fe_alarm & WAN_TE_BIT_YEL_ALARM)){ - if (fe->fe_status != FE_CONNECTED){ - fe->fe_status = FE_CONNECTED; - } - }else{ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: T1 Waiting for Yellow Alarm to clear...\n", - fe->name); - } - fe->fe_status = FE_DISCONNECTED; - } - } + } }else{ - if (sdla_te_is_e1_alarm(fe, alarms)){ - if (fe->fe_status != FE_DISCONNECTED){ - fe->fe_status = FE_DISCONNECTED; - } - }else{ - if (fe->fe_status != FE_CONNECTED){ - fe->fe_status = FE_CONNECTED; + if (fe->fe_status != FE_CONNECTED){ + if (fe->te_param.tx_yel_alarm){ + sdla_te_clear_alarms(fe, WAN_TE_BIT_YEL_ALARM); } + fe->fe_status = FE_CONNECTED; } } + if (curr_fe_status != fe->fe_status){ if (fe->fe_status == FE_CONNECTED){ DEBUG_EVENT("%s: %s connected!\n", @@ -4949,16 +5050,15 @@ static void sdla_channels(sdla_fe_t* fe, unsigned long active_ch) * bit A - YEL (T1) ****************************************************************************** */ -static unsigned int sdla_te_read_alarms(sdla_fe_t *fe, int action) +static u_int32_t sdla_te_read_alarms(sdla_fe_t *fe, int action) { + u_int32_t new_alarms = 0; WAN_ASSERT(fe->write_fe_reg == NULL); WAN_ASSERT(fe->read_fe_reg == NULL); - if (IS_FE_ALARM_READ(action)){ - - unsigned long status = 0x00; - unsigned char value = 0x00; + /* Always read it (compatable with previous cards */ + if (IS_FE_ALARM_READ(action) || 1){ /* Check common alarm for E1 and T1 configuration ** 1. ALOS alarm @@ -4966,86 +5066,96 @@ static unsigned int sdla_te_read_alarms(sdla_fe_t *fe, int action) ** Reg 0xF8 (ALOSI = 1) */ if (READ_REG(REG_RLPS_ALOS_DET_PER) && (READ_REG(REG_RLPS_CFG_STATUS) & BIT_RLPS_CFG_STATUS_ALOSV)){ - status |= WAN_TE_BIT_ALOS_ALARM; + new_alarms |= WAN_TE_BIT_ALOS_ALARM; } /* 2. LOS alarm ** Reg 0x12 */ if (READ_REG(REG_CDRC_INT_STATUS) & BIT_CDRC_INT_STATUS_LOSV){ - status |= WAN_TE_BIT_LOS_ALARM; + new_alarms |= WAN_TE_BIT_LOS_ALARM; } /* 3. ALTLOS alarm ?????????????????? ** Reg 0x13 */ if (READ_REG(REG_ALTLOS_STATUS) & BIT_ALTLOS_STATUS_ALTLOS){ - status |= WAN_TE_BIT_ALTLOS_ALARM; + new_alarms |= WAN_TE_BIT_ALTLOS_ALARM; } /* Check specific E1 and T1 alarms */ if (IS_E1_FEMEDIA(fe)){ + u_int8_t e1_status, e1_mnt_status; + + e1_status = READ_REG(REG_E1_FRMR_FR_STATUS); + e1_mnt_status = READ_REG(REG_E1_FRMR_MAINT_STATUS); /* 4. OOF alarm */ if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ - if (READ_REG(REG_E1_FRMR_FR_STATUS) & BIT_E1_FRMR_FR_STATUS_OOFV){ - status |= WAN_TE_BIT_OOF_ALARM; + if (e1_status & BIT_E1_FRMR_FR_STATUS_OOFV){ + new_alarms |= WAN_TE_BIT_OOF_ALARM; } } /* 5. OOSMF alarm */ - if (READ_REG(REG_E1_FRMR_FR_STATUS) & BIT_E1_FRMR_FR_STATUS_OOSMFV){ - status |= WAN_TE_BIT_OOSMF_ALARM; + if (e1_status & BIT_E1_FRMR_FR_STATUS_OOSMFV){ + new_alarms |= WAN_TE_BIT_OOSMF_ALARM; } /* 6. OOCMF alarm */ - if (READ_REG(REG_E1_FRMR_FR_STATUS) & BIT_E1_FRMR_FR_STATUS_OOCMFV){ - status |= WAN_TE_BIT_OOCMF_ALARM; + if (e1_status & BIT_E1_FRMR_FR_STATUS_OOCMFV){ + new_alarms |= WAN_TE_BIT_OOCMF_ALARM; } /* 7. OOOF alarm */ - if (READ_REG(REG_E1_FRMR_FR_STATUS) & BIT_E1_FRMR_FR_STATUS_OOOFV){ - status |= WAN_TE_BIT_OOOF_ALARM; + if (e1_status & BIT_E1_FRMR_FR_STATUS_OOOFV){ + new_alarms |= WAN_TE_BIT_OOOF_ALARM; } /* 8. RAI alarm */ - if (READ_REG(REG_E1_FRMR_MAINT_STATUS) & BIT_E1_FRMR_MAINT_STATUS_RAIV){ - status |= WAN_TE_BIT_RAI_ALARM; + if (e1_mnt_status & BIT_E1_FRMR_MAINT_STATUS_RAIV){ + new_alarms |= WAN_TE_BIT_RAI_ALARM; } /* 9. RED alarm ** Reg 0x97 (REDD) */ - if (READ_REG(REG_E1_FRMR_MAINT_STATUS) & BIT_E1_FRMR_MAINT_STATUS_RED){ - status |= WAN_TE_BIT_RED_ALARM; + if (e1_mnt_status & BIT_E1_FRMR_MAINT_STATUS_RED){ + new_alarms |= WAN_TE_BIT_RED_ALARM; } /* 10. AIS alarm ** Reg 0x91 (AISC) ** Reg 0x97 (AIS) */ if ((READ_REG(REG_E1_FRMR_MAINT_OPT) & BIT_E1_FRMR_MAINT_OPT_AISC) && - (READ_REG(REG_E1_FRMR_MAINT_STATUS) & BIT_E1_FRMR_MAINT_STATUS_AIS)){ - status |= WAN_TE_BIT_AIS_ALARM; + (e1_mnt_status & BIT_E1_FRMR_MAINT_STATUS_AIS)){ + new_alarms |= WAN_TE_BIT_AIS_ALARM; } } else { + u_int8_t t1_status = 0x00, t1_alm_status = 0x00; + /* 4. OOF alarm ** Reg 0x4A (INFR=0 T1 mode) */ if (!(READ_REG(REG_T1_FRMR_INT_STATUS) & BIT_T1_FRMR_INT_STATUS_INFR)){ - status |= WAN_TE_BIT_OOF_ALARM; + new_alarms |= WAN_TE_BIT_OOF_ALARM; } - value = READ_REG(REG_T1_ALMI_DET_STATUS); + t1_alm_status = READ_REG(REG_T1_ALMI_INT_STATUS); + t1_status = READ_REG(REG_T1_ALMI_DET_STATUS); /* 5. AIS alarm ** Reg 0x62 (AIS) ** Reg 0x63 (AISD) */ - if (value & BIT_T1_ALMI_DET_STATUS_AISD){ - status |= WAN_TE_BIT_AIS_ALARM; + if (t1_status & BIT_T1_ALMI_DET_STATUS_AISD){ + new_alarms |= WAN_TE_BIT_AIS_ALARM; } /* 6. RED alarm ** Reg 0x63 (REDD) */ - if (value & BIT_T1_ALMI_DET_STATUS_REDD){ - status |= WAN_TE_BIT_RED_ALARM; + if ((t1_status & BIT_T1_ALMI_DET_STATUS_REDD) || + (t1_alm_status & BIT_T1_ALMI_INT_STATUS_RED)){ + new_alarms |= WAN_TE_BIT_RED_ALARM; } /* 7. YEL alarm ** Reg 0x62 (YEL) ** Reg 0x63 (YELD) */ - if (value & BIT_T1_ALMI_DET_STATUS_YELD){ - status |= WAN_TE_BIT_YEL_ALARM; + if (t1_status & BIT_T1_ALMI_DET_STATUS_YELD){ + new_alarms |= WAN_TE_BIT_RAI_ALARM; //WAN_TE_BIT_YEL_ALARM; } } - fe->fe_alarm = status; } - + if (IS_FE_ALARM_UPDATE(action) || 1){ + fe->fe_alarm = new_alarms; + } + if (IS_FE_ALARM_PRINT(action)){ sdla_te_print_alarms(fe, fe->fe_alarm); } @@ -5060,7 +5170,7 @@ static unsigned int sdla_te_read_alarms(sdla_fe_t *fe, int action) ** Arguments: ** Returns: */ -static int sdla_te_print_alarms(sdla_fe_t* fe, unsigned int alarms) +static int sdla_te_print_alarms(sdla_fe_t* fe, u_int32_t alarms) { if (!alarms){ alarms = fe->fe_alarm; @@ -5077,28 +5187,28 @@ static int sdla_te_print_alarms(sdla_fe_t* fe, unsigned int alarms) FE_MEDIA_DECODE(fe)); if (alarms & WAN_TE_BIT_ALOS_ALARM){ - DEBUG_EVENT("%s: ALOS alarm is ON\n", fe->name); + DEBUG_EVENT("%s: ALOS : ON\n", fe->name); } if (alarms & WAN_TE_BIT_LOS_ALARM){ - DEBUG_EVENT("%s: LOS alarm is ON\n", fe->name); + DEBUG_EVENT("%s: LOS : ON\n", fe->name); } if (alarms & WAN_TE_BIT_ALTLOS_ALARM){ - DEBUG_EVENT("%s: ATLLOS alarm is ON\n", fe->name); + DEBUG_EVENT("%s: ALTLOS : ON\n", fe->name); } if (alarms & WAN_TE_BIT_OOF_ALARM){ - DEBUG_EVENT("%s: OOF alarm is ON\n", fe->name); + DEBUG_EVENT("%s: OOF : ON\n", fe->name); } if (alarms & WAN_TE_BIT_RAI_ALARM){ - DEBUG_EVENT("%s: RAI alarm is ON\n", fe->name); + DEBUG_EVENT("%s: RAI : ON\n", fe->name); } if (alarms & WAN_TE_BIT_RED_ALARM){ - DEBUG_EVENT("%s: RED alarm is ON\n", fe->name); + DEBUG_EVENT("%s: RED : ON\n", fe->name); } if (alarms & WAN_TE_BIT_AIS_ALARM){ - DEBUG_EVENT("%s: AIS alarm is ON\n", fe->name); + DEBUG_EVENT("%s: AIS : ON\n", fe->name); } if (alarms & WAN_TE_BIT_YEL_ALARM){ - DEBUG_EVENT("%s: YEL alarm is ON\n", fe->name); + DEBUG_EVENT("%s: YEL : ON\n", fe->name); } return 0; } @@ -5111,18 +5221,19 @@ static int sdla_te_print_alarms(sdla_fe_t* fe, unsigned int alarms) ** Arguments: ** Returns: */ -static int sdla_te_set_alarms(sdla_fe_t* fe, unsigned int alarms) +static int sdla_te_set_alarms(sdla_fe_t* fe, u_int32_t alarms) { unsigned char value = 0x00; if (alarms & WAN_TE_BIT_YEL_ALARM){ - if (IS_T1_FEMEDIA(fe)){ + if (IS_T1_FEMEDIA(fe) && + fe->fe_cfg.cfg.te_cfg.ignore_yel_alarm == WANOPT_NO){ value = READ_REG(REG_T1_XBAS_ALARM_TX); if (!(value & BIT_T1_XBAS_ALARM_TX_XYEL)){ - value |= BIT_T1_XBAS_ALARM_TX_XYEL; - DEBUG_EVENT("%s: Setting YELLOW alarm!\n", + DEBUG_EVENT("%s: Set YELLOW alarm!\n", fe->name); - WRITE_REG(REG_T1_XBAS_ALARM_TX, value); + WRITE_REG(REG_T1_XBAS_ALARM_TX, value | BIT_T1_XBAS_ALARM_TX_XYEL); + fe->te_param.tx_yel_alarm = 1; } } } @@ -5137,33 +5248,32 @@ static int sdla_te_set_alarms(sdla_fe_t* fe, unsigned int alarms) ** Arguments: ** Returns: */ -static int sdla_te_clear_alarms(sdla_fe_t* fe, unsigned long alarms) +static int sdla_te_clear_alarms(sdla_fe_t* fe, u_int32_t alarms) { unsigned char value = 0x00; if (alarms & WAN_TE_BIT_YEL_ALARM){ - if (IS_T1_FEMEDIA(fe)){ + if (IS_T1_FEMEDIA(fe) && + fe->fe_cfg.cfg.te_cfg.ignore_yel_alarm == WANOPT_NO){ value = READ_REG(REG_T1_XBAS_ALARM_TX); if (value & BIT_T1_XBAS_ALARM_TX_XYEL){ - value &= ~BIT_T1_XBAS_ALARM_TX_XYEL; - DEBUG_EVENT("%s: Clearing YELLOW alarm!\n", + DEBUG_EVENT("%s: Clear YELLOW alarm!\n", fe->name); - WRITE_REG(REG_T1_XBAS_ALARM_TX, value); + WRITE_REG(REG_T1_XBAS_ALARM_TX, value & ~BIT_T1_XBAS_ALARM_TX_XYEL); + fe->te_param.tx_yel_alarm = 0; } } } return 0; } -/* - ****************************************************************************** - * sdla_te_pmon() - * - * Description: Read PMC performance monitoring counters - * Arguments: - * Returns: - ****************************************************************************** - */ +/****************************************************************************** +* sdla_te_pmon() +* +* Description: Read PMC performance monitoring counters +* Arguments: +* Returns: +******************************************************************************/ #define PMON_DEF_NUM 0x1FFF static int sdla_te_pmon(sdla_fe_t *fe, int action) { @@ -5216,15 +5326,14 @@ static int sdla_te_pmon(sdla_fe_t *fe, int action) return 0; } -/* - ****************************************************************************** - * sdla_fe_flush_pmon() - * - * Description: Flush PMC performance monitoring counters - * Arguments: - * Returns: - ****************************************************************************** - */ + +/****************************************************************************** +* sdla_fe_flush_pmon() +* +* Description: Flush PMC performance monitoring counters +* Arguments: +* Returns: +******************************************************************************/ static int sdla_te_flush_pmon(sdla_fe_t *fe) { fe->fe_stats.te_pmon.lcv_errors = 0; @@ -5292,12 +5401,11 @@ static int sdla_te_check_intr(sdla_fe_t *fe) if (!wan_test_bit(TE_CONFIGURED,(void*)&fe->te_param.critical)){ return 0; } - if (fe->fe_chip_id == CHIP_ID_COMET_QUAD){ val = READ_REG_LINE(0, REG_COMET_QUAD_MASTER_INTR); val &= BITS_COMET_QUAD_MASTER_INTR; if (!(val & (1 << WAN_FE_LINENO(fe)))){ - DEBUG_TEST("%s: This interrupt not for this port %d\n", + DEBUG_ISR("%s: This interrupt not for this port %d\n", fe->name, WAN_FE_LINENO(fe)+1); return 0; @@ -5319,7 +5427,7 @@ static int sdla_te_intr(sdla_fe_t *fe) val = READ_REG_LINE(0, REG_COMET_QUAD_MASTER_INTR); val &= BITS_COMET_QUAD_MASTER_INTR; if (!(val & (1 << WAN_FE_LINENO(fe)))){ - DEBUG_TEST("%s: This interrupt not for this port %d\n", + DEBUG_ISR("%s: This interrupt not for this port %d\n", fe->name, WAN_FE_LINENO(fe)+1); return 0; @@ -5347,7 +5455,7 @@ static int sdla_te_intr(sdla_fe_t *fe) sdla_te_tx_intr(fe); sdla_te_rx_intr(fe); - DEBUG_TEST("%s: FE Interrupt Alarms=0x%lX\n", + DEBUG_ISR("%s: FE Interrupt Alarms=0x%X\n", fe->name,fe->fe_alarm); sdla_te_set_status(fe, fe->fe_alarm); @@ -5486,34 +5594,28 @@ static void sdla_t1_rx_intr(sdla_fe_t* fe) if (status & BIT_T1_ALMI_INT_STATUS_YELI){ if (status & BIT_T1_ALMI_INT_STATUS_YEL){ if (!(fe->fe_alarm & WAN_TE_BIT_YEL_ALARM)){ -#if 0 -Alex Sep 16 - DEBUG_EVENT("%s: T1 YELLOW alarm is ON\n", + DEBUG_EVENT("%s: RAI alarm is ON\n", fe->name); - fe->fe_alarm |= WAN_TE_BIT_YEL_ALARM; -#endif + fe->fe_alarm |= WAN_TE_BIT_RAI_ALARM; //WAN_TE_BIT_YEL_ALARM; } }else{ if (fe->fe_alarm & WAN_TE_BIT_YEL_ALARM){ -#if 0 -Alex Sep 16 - DEBUG_EVENT("%s: T1 YELLOW alarm is OFF\n", + DEBUG_EVENT("%s: RAI alarm is OFF\n", fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_YEL_ALARM; -#endif + fe->fe_alarm &= ~WAN_TE_BIT_RAI_ALARM; //~WAN_TE_BIT_YEL_ALARM; } } } if (status & BIT_T1_ALMI_INT_STATUS_REDI){ if (status & BIT_T1_ALMI_INT_STATUS_RED){ if (!(fe->fe_alarm & WAN_TE_BIT_RED_ALARM)){ - DEBUG_EVENT("%s: T1 RED alarm is ON\n", + DEBUG_EVENT("%s: RED alarm is ON\n", fe->name); fe->fe_alarm |= WAN_TE_BIT_RED_ALARM; } }else{ if (fe->fe_alarm & WAN_TE_BIT_RED_ALARM){ - DEBUG_EVENT("%s: T1 RED alarm is OFF\n", + DEBUG_EVENT("%s: RED alarm is OFF\n", fe->name); fe->fe_alarm &= ~WAN_TE_BIT_RED_ALARM; } @@ -5522,77 +5624,26 @@ Alex Sep 16 if (status & BIT_T1_ALMI_INT_STATUS_AISI){ if (status & BIT_T1_ALMI_INT_STATUS_AIS){ if (!(fe->fe_alarm & WAN_TE_BIT_AIS_ALARM)){ - DEBUG_EVENT("%s: T1 Alarm Indication Signal is ON\n", + DEBUG_EVENT("%s: AIS alarm is ON\n", fe->name); fe->fe_alarm |= WAN_TE_BIT_AIS_ALARM; } }else{ if (fe->fe_alarm & WAN_TE_BIT_AIS_ALARM){ - DEBUG_EVENT("%s: T1 Alarm Indication Signal is OFF\n", - fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_AIS_ALARM; - } - } - } - -#if 0 - if (status & - (BIT_T1_ALMI_INT_STATUS_YELI | - BIT_T1_ALMI_INT_STATUS_REDI | - BIT_T1_ALMI_INT_STATUS_AISI)){ - if (status & (BIT_T1_ALMI_INT_STATUS_YEL | - BIT_T1_ALMI_INT_STATUS_RED | - BIT_T1_ALMI_INT_STATUS_AIS)){ - - /* Update T1/E1 alarm status */ - if (!(fe->fe_alarm & WAN_TE_BIT_YEL_ALARM) && - (status & BIT_T1_ALMI_INT_STATUS_YEL)){ - DEBUG_EVENT("%s: T1 YELLOW alarm is ON\n", - fe->name); - fe->fe_alarm |= WAN_TE_BIT_YEL_ALARM; - } - if (!(fe->fe_alarm & WAN_TE_BIT_RED_ALARM) && - (status & BIT_T1_ALMI_INT_STATUS_RED)){ - DEBUG_EVENT("%s: T1 RED alarm is ON\n", - fe->name); - fe->fe_alarm |= WAN_TE_BIT_RED_ALARM; - } - if (!(fe->fe_alarm & WAN_TE_BIT_AIS_ALARM) && - (status & BIT_T1_ALMI_INT_STATUS_AIS)){ - DEBUG_EVENT("%s: T1 Alarm Indication Signal is ON\n", - fe->name); - fe->fe_alarm |= WAN_TE_BIT_AIS_ALARM; - } - }else{ - /* Update T1/E1 alarm status */ - if ((fe->fe_alarm & WAN_TE_BIT_YEL_ALARM) && - !(status & BIT_T1_ALMI_INT_STATUS_YEL)){ - DEBUG_EVENT("%s: T1 YELLOW alarm is OFF\n", - fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_YEL_ALARM; - } - if ((fe->fe_alarm & WAN_TE_BIT_RED_ALARM) && - !(status & BIT_T1_ALMI_INT_STATUS_RED)){ - DEBUG_EVENT("%s: T1 RED alarm is OFF\n", - fe->name); - fe->fe_alarm &= ~WAN_TE_BIT_RED_ALARM; - } - if ((fe->fe_alarm & WAN_TE_BIT_AIS_ALARM) && - !(status & BIT_T1_ALMI_INT_STATUS_AIS)){ - DEBUG_EVENT("%s: T1 Alarm Indication Signal is OFF\n", + DEBUG_EVENT("%s: AIS alarm is OFF\n", fe->name); fe->fe_alarm &= ~WAN_TE_BIT_AIS_ALARM; } } } -#endif } /* 8. RBOC */ if (fe->te_param.intr_src3 & BIT_INT_SRC_3_RBOC){ status = READ_REG(REG_T1_RBOC_CODE_STATUS); if (status & BIT_T1_RBOC_CODE_STATUS_BOCI){ - unsigned long time; + wan_ticks_t time; + time = SYSTEM_TICKS; status &= MASK_T1_RBOC_CODE_STATUS; switch(status){ @@ -5735,13 +5786,13 @@ Alex Sep 16 (status & BIT_T1_FRMR_INT_STATUS_INFRI)){ if (status & BIT_T1_FRMR_INT_STATUS_INFR){ if (!(fe->fe_alarm & WAN_TE_BIT_OOF_ALARM)){ - DEBUG_EVENT("%s: T1 Out of Frame alarm is ON!\n", + DEBUG_EVENT("%s: OOF alarm is ON!\n", fe->name); fe->fe_alarm |= WAN_TE_BIT_OOF_ALARM; } }else{ if (fe->fe_alarm & WAN_TE_BIT_OOF_ALARM){ - DEBUG_EVENT("%s: T1 Out of Frame alarm is OFF!\n", + DEBUG_EVENT("%s: OOF alarm is OFF!\n", fe->name); fe->fe_alarm &= ~WAN_TE_BIT_OOF_ALARM; } @@ -5756,7 +5807,7 @@ Alex Sep 16 if (status & BIT_RLPS_CFG_STATUS_ALOSV){ if (!(fe->fe_alarm & WAN_TE_BIT_ALOS_ALARM)){ if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: T1 ALOS alarm is ON\n", + DEBUG_EVENT("%s: ALOS alarm is ON\n", fe->name); } fe->fe_alarm |= WAN_TE_BIT_ALOS_ALARM; @@ -5764,7 +5815,7 @@ Alex Sep 16 }else{ if (fe->fe_alarm & WAN_TE_BIT_ALOS_ALARM){ if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: T1 ALOS alarm is OFF\n", + DEBUG_EVENT("%s: ALOS alarm is OFF\n", fe->name); } fe->fe_alarm &= ~WAN_TE_BIT_ALOS_ALARM; @@ -5781,7 +5832,7 @@ Alex Sep 16 if (status & BIT_CDRC_INT_STATUS_LOSV){ if (!(fe->fe_alarm & WAN_TE_BIT_LOS_ALARM)){ if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: T1 LOS alarm is ON\n", + DEBUG_EVENT("%s: LOS alarm is ON\n", fe->name); } fe->fe_alarm |= WAN_TE_BIT_LOS_ALARM; @@ -5789,7 +5840,7 @@ Alex Sep 16 }else{ if (fe->fe_alarm & WAN_TE_BIT_LOS_ALARM){ if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: T1 LOS alarm is OFF\n", + DEBUG_EVENT("%s: LOS alarm is OFF\n", fe->name); } fe->fe_alarm &= ~WAN_TE_BIT_LOS_ALARM; @@ -5815,13 +5866,13 @@ Alex Sep 16 if ((status & BIT_ALTLOS_STATUS_ALTLOSI) && (status & BIT_ALTLOS_STATUS_ALTLOSE)){ if (status & BIT_ALTLOS_STATUS_ALTLOS){ if (!(fe->fe_alarm & WAN_TE_BIT_ALTLOS_ALARM)){ - DEBUG_EVENT("%s: T1 Alternate Loss of Signal alarm is ON\n", + DEBUG_EVENT("%s: ALTLOS alarm is ON\n", fe->name); fe->fe_alarm |= WAN_TE_BIT_ALTLOS_ALARM; } }else{ if (fe->fe_alarm & WAN_TE_BIT_ALTLOS_ALARM){ - DEBUG_EVENT("%s: T1 Alternate Loss of Signal alarm is OFF\n", + DEBUG_EVENT("%s: ALTLOS alarm is OFF\n", fe->name); fe->fe_alarm &= ~WAN_TE_BIT_ALTLOS_ALARM; } @@ -5958,13 +6009,13 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) if (WAN_FE_FRAME(fe) != WAN_FR_UNFRAMED){ if (status & BIT_E1_FRMR_FR_STATUS_OOFV){ if (!(fe->fe_alarm & WAN_TE_BIT_OOF_ALARM)){ - DEBUG_EVENT("%s: E1 Out of Frame alarm is ON\n", + DEBUG_EVENT("%s: OOF alarm is ON\n", fe->name); fe->fe_alarm |= WAN_TE_BIT_OOF_ALARM; } }else{ if (fe->fe_alarm & WAN_TE_BIT_OOF_ALARM){ - DEBUG_EVENT("%s: E1 Out of Frame alarm is OFF\n", + DEBUG_EVENT("%s: OOF alarm is OFF\n", fe->name); fe->fe_alarm &= ~WAN_TE_BIT_OOF_ALARM; } @@ -5975,11 +6026,11 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) if ((int_en & BIT_E1_FRMR_FRM_STAT_INT_EN_OOSMFE) && (int_status & BIT_E1_FRMR_FRM_STAT_INT_IND_OOSMFI)){ if (status & BIT_E1_FRMR_FR_STATUS_OOSMFV){ - DEBUG_EVENT("%s: E1 Loss of Signaling multiframe alarm is ON\n", + DEBUG_EVENT("%s: OOSMF alarm is ON\n", fe->name); fe->fe_alarm |= WAN_TE_BIT_OOSMF_ALARM; }else{ - DEBUG_EVENT("%s: E1 Loss of Signaling multiframe alarm is OFF\n", + DEBUG_EVENT("%s: OOSMF alarm is OFF\n", fe->name); fe->fe_alarm &= ~WAN_TE_BIT_OOSMF_ALARM; } @@ -5988,11 +6039,11 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) if ((int_en & BIT_E1_FRMR_FRM_STAT_INT_EN_OOCMFE) && (int_status & BIT_E1_FRMR_FRM_STAT_INT_IND_OOCMFI)){ if (status & BIT_E1_FRMR_FR_STATUS_OOCMFV){ - DEBUG_EVENT("%s: E1 Loss of CRC multiframe alarm is ON\n", + DEBUG_EVENT("%s: OOCMF alarm is ON\n", fe->name); fe->fe_alarm |= WAN_TE_BIT_OOCMF_ALARM; }else{ - DEBUG_EVENT("%s: E1 Loss of CRC multiframe alarm is OFF\n", + DEBUG_EVENT("%s: OOCMF alarm is OFF\n", fe->name); fe->fe_alarm &= ~WAN_TE_BIT_OOCMF_ALARM; } @@ -6003,11 +6054,11 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) if ((READ_REG(REG_E1_FRMR_P_A_INT_EN) & BIT_E1_FRMR_P_A_INT_EN_OOOFE) && (status & BIT_E1_FRMR_P_A_INT_STAT_OOOFI)){ if (READ_REG(REG_E1_FRMR_FR_STATUS) & BIT_E1_FRMR_FR_STATUS_OOOFV){ - DEBUG_EVENT("%s: E1 out of offline frame alarm is ON\n", + DEBUG_EVENT("%s: OOOF alarm is ON\n", fe->name); fe->fe_alarm |= WAN_TE_BIT_OOOF_ALARM; }else{ - DEBUG_EVENT("%s: E1 out of offline frame alarm is OFF\n", + DEBUG_EVENT("%s: OOOF alarm is OFF\n", fe->name); fe->fe_alarm &= ~WAN_TE_BIT_OOOF_ALARM; } @@ -6023,17 +6074,17 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) if ((int_en & BIT_E1_FRMR_M_A_INT_EN_REDE) && (int_status & BIT_E1_FRMR_M_A_INT_IND_REDI)){ if (status & BIT_E1_FRMR_MAINT_STATUS_RED){ - DEBUG_EVENT("%s: E1 RED alarm is ON\n", fe->name); + DEBUG_EVENT("%s: RED alarm is ON\n", fe->name); fe->fe_alarm |= WAN_TE_BIT_RED_ALARM; }else{ - DEBUG_EVENT("%s: E1 RED alarm is OFF\n", fe->name); + DEBUG_EVENT("%s: RED alarm is OFF\n", fe->name); fe->fe_alarm &= ~WAN_TE_BIT_RED_ALARM; } } if ((int_en & BIT_E1_FRMR_M_A_INT_EN_AISE) && (int_status & BIT_E1_FRMR_M_A_INT_IND_AISI)){ if (status & BIT_E1_FRMR_MAINT_STATUS_AIS){ - DEBUG_EVENT("%s: E1 AIS alarm is ON\n", fe->name); + DEBUG_EVENT("%s: AIS alarm is ON\n", fe->name); fe->fe_alarm |= WAN_TE_BIT_AIS_ALARM; /* AS/ACIF S016 Clause 5.2.3 */ WRITE_REG(REG_E1_TRAN_TX_ALARM_CTRL, @@ -6043,7 +6094,7 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) sdla_te_master_clock(fe); } }else{ - DEBUG_EVENT("%s: E1 AIS alarm is OFF\n", fe->name); + DEBUG_EVENT("%s: AIS alarm is OFF\n", fe->name); fe->fe_alarm &= ~WAN_TE_BIT_AIS_ALARM; /* AS/ACIF S016 Clause 5.2.3 */ WRITE_REG(REG_E1_TRAN_TX_ALARM_CTRL, @@ -6057,10 +6108,10 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) if ((int_en & BIT_E1_FRMR_M_A_INT_EN_RAIE) && (int_status & BIT_E1_FRMR_M_A_INT_IND_RAII)){ if (status & BIT_E1_FRMR_MAINT_STATUS_RAIV){ - DEBUG_EVENT("%s: E1 RAI alarm is ON\n", fe->name); + DEBUG_EVENT("%s: RAI alarm is ON\n", fe->name); fe->fe_alarm |= WAN_TE_BIT_RAI_ALARM; }else{ - DEBUG_EVENT("%s: E1 RAI alarm is OFF\n", fe->name); + DEBUG_EVENT("%s: RAI alarm is OFF\n", fe->name); fe->fe_alarm &= ~WAN_TE_BIT_RAI_ALARM; } } @@ -6074,7 +6125,7 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) (status & BIT_RLPS_CFG_STATUS_ALOSI)){ if (status & BIT_RLPS_CFG_STATUS_ALOSV){ if (!(fe->fe_alarm & WAN_TE_BIT_ALOS_ALARM)){ - DEBUG_EVENT("%s: E1 ALOS alarm is ON\n", + DEBUG_EVENT("%s: ALOS alarm is ON\n", fe->name); fe->fe_alarm |= WAN_TE_BIT_ALOS_ALARM; /* AS/ACIF S016 Clause 5.2.3 */ @@ -6084,7 +6135,7 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) } }else{ if (fe->fe_alarm & WAN_TE_BIT_ALOS_ALARM){ - DEBUG_EVENT("%s: E1 ALOS alarm is OFF\n", + DEBUG_EVENT("%s: ALOS alarm is OFF\n", fe->name); fe->fe_alarm &= ~WAN_TE_BIT_ALOS_ALARM; /* AS/ACIF S016 Clause 5.2.3 */ @@ -6103,12 +6154,12 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) (status & BIT_CDRC_INT_STATUS_LOSI)){ if (status & BIT_CDRC_INT_STATUS_LOSV){ if (!(fe->fe_alarm & WAN_TE_BIT_LOS_ALARM)){ - DEBUG_EVENT("%s: E1 LOS alarm is ON\n", fe->name); + DEBUG_EVENT("%s: LOS alarm is ON\n", fe->name); fe->fe_alarm |= WAN_TE_BIT_LOS_ALARM; } }else{ if (fe->fe_alarm & WAN_TE_BIT_LOS_ALARM){ - DEBUG_EVENT("%s: E1 LOS alarm is OFF\n", fe->name); + DEBUG_EVENT("%s: LOS alarm is OFF\n", fe->name); fe->fe_alarm &= ~WAN_TE_BIT_LOS_ALARM; } } @@ -6147,7 +6198,7 @@ static void sdla_e1_rx_intr(sdla_fe_t* fe) if (fe->te_param.intr_src1 & BIT_INT_SRC_1_PMON){ status = READ_REG(REG_PMON_INT_EN_STATUS); if (status & BIT_PMON_INT_EN_STATUS_XFER){ - sdla_te_pmon(fe, 0); + sdla_te_pmon(fe, WAN_FE_PMON_READ); } } #if 0 @@ -6202,6 +6253,7 @@ sdla_te_set_lbmode(sdla_fe_t *fe, unsigned char type, unsigned char mode) case WAN_TE1_PAYLB_MODE: err = sdla_te_paylb(fe, mode); break; + case WAN_TE1_DDLB_MODE: err = sdla_te_ddlb(fe, mode); break; @@ -6328,8 +6380,12 @@ static void sdla_te_timer(unsigned long pfe) fe->name, FE_MEDIA_DECODE(fe)); + DEBUG_TE1("%s(): line: %d\n", __FUNCTION__, __LINE__); + if (wan_test_bit(TE_TIMER_KILL,(void*)&fe->te_param.critical)){ wan_clear_bit(TE_TIMER_RUNNING,(void*)&fe->te_param.critical); + + DEBUG_TE1("%s(): line: %d\n", __FUNCTION__, __LINE__); return; } if (!wan_test_bit(TE_TIMER_RUNNING,(void*)&fe->te_param.critical)){ @@ -6341,9 +6397,9 @@ static void sdla_te_timer(unsigned long pfe) wan_clear_bit(TE_TIMER_RUNNING,(void*)&fe->te_param.critical); /* Enable hardware interrupt for TE1 */ - wan_spin_lock_irq(&fe->lock,&smp_flags); + wan_spin_lock_irq(&fe->lockirq,&smp_flags); empty = WAN_LIST_EMPTY(&fe->event); - wan_spin_unlock_irq(&fe->lock,&smp_flags); + wan_spin_unlock_irq(&fe->lockirq,&smp_flags); if (!empty){ if (wan_test_and_set_bit(TE_TIMER_EVENT_PENDING,(void*)&fe->te_param.critical)){ DEBUG_EVENT("%s: RM timer event is pending!\n", fe->name); @@ -6392,7 +6448,7 @@ sdla_te_add_event(sdla_fe_t *fe, sdla_fe_timer_event_t *fe_event) } memcpy(new_fe_event, fe_event, sizeof(sdla_fe_timer_event_t)); - wan_spin_lock_irq(&fe->lock,&smp_flags); + wan_spin_lock_irq(&fe->lockirq,&smp_flags); if (WAN_LIST_EMPTY(&fe->event)){ WAN_LIST_INSERT_HEAD(&fe->event, new_fe_event, next); }else{ @@ -6402,12 +6458,12 @@ sdla_te_add_event(sdla_fe_t *fe, sdla_fe_timer_event_t *fe_event) } if (tmp == NULL){ DEBUG_EVENT("%s: Internal Error!!!\n", fe->name); - wan_spin_unlock_irq(&fe->lock,&smp_flags); + wan_spin_unlock_irq(&fe->lockirq,&smp_flags); return -EINVAL; } WAN_LIST_INSERT_AFTER(tmp, new_fe_event, next); } - wan_spin_unlock_irq(&fe->lock,&smp_flags); + wan_spin_unlock_irq(&fe->lockirq,&smp_flags); return 0; } @@ -6424,15 +6480,17 @@ static int sdla_te_add_timer(sdla_fe_t* fe, unsigned long delay) { int err=0; - if (wan_test_bit(TE_TIMER_KILL,(void*)&fe->te_param.critical)){ + if (wan_test_bit(TE_TIMER_KILL,(void*)&fe->te_param.critical) || + wan_test_bit(TE_TIMER_RUNNING,(void*)&fe->te_param.critical)) { return 0; } - if (wan_test_bit(TE_TIMER_RUNNING,(void*)&fe->te_param.critical)) { - return 0; - } - +#if defined(__WINDOWS__) + /* delay is in MS, so it can be used directly by wan_add_timer() */ + err = wan_add_timer(&fe->timer, delay); +#else err = wan_add_timer(&fe->timer, delay * HZ / 1000); +#endif if (err){ /* Failed to add timer */ return -EINVAL; @@ -6461,22 +6519,21 @@ static int sdla_te_polling(sdla_fe_t* fe) u_int8_t pending = 0; wan_smp_flag_t smp_flags; - WAN_ASSERT(fe->write_fe_reg == NULL); - WAN_ASSERT(fe->read_fe_reg == NULL); + WAN_ASSERT_RC(fe->write_fe_reg == NULL, 0); + WAN_ASSERT_RC(fe->read_fe_reg == NULL, 0); - wan_spin_lock_irq(&fe->lock,&smp_flags); + wan_spin_lock_irq(&fe->lockirq,&smp_flags); if (WAN_LIST_EMPTY(&fe->event)){ - wan_spin_unlock_irq(&fe->lock,&smp_flags); + wan_spin_unlock_irq(&fe->lockirq,&smp_flags); DEBUG_EVENT("%s: WARNING: No FE events in a queue!\n", fe->name); - sdla_te_add_timer(fe, HZ); - return 0; + return HZ; } fe_event = WAN_LIST_FIRST(&fe->event); WAN_LIST_REMOVE(fe_event, next); - wan_spin_unlock_irq(&fe->lock,&smp_flags); + wan_spin_unlock_irq(&fe->lockirq,&smp_flags); - DEBUG_TEST("%s: %s Polling State=%s Cmd=0x%X!\n", + DEBUG_TE1("%s: %s Polling State=%s Cmd=0x%X!\n", fe->name, FE_MEDIA_DECODE(fe), fe->fe_status==FE_CONNECTED?"Con":"Disconn", fe_event->type); @@ -6517,7 +6574,7 @@ static int sdla_te_polling(sdla_fe_t* fe) break; case TE_LINKDOWN_TIMER: - sdla_te_read_alarms(fe, WAN_FE_ALARM_READ); + sdla_te_read_alarms(fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE); sdla_te_pmon(fe, WAN_FE_PMON_UPDATE); sdla_te_set_status(fe, fe->fe_alarm); if (fe->fe_status == FE_CONNECTED){ @@ -6567,7 +6624,7 @@ static int sdla_te_polling(sdla_fe_t* fe) if (sdla_te_chip_config(fe)){ DEBUG_EVENT("%s: Failed to re-configuring Front-End chip!\n", fe->name); - return -EINVAL; + break; } fe_event->type = TE_LINKDOWN_TIMER; fe_event->delay = POLLING_TE1_TIMER; @@ -6575,14 +6632,16 @@ static int sdla_te_polling(sdla_fe_t* fe) break; case TE_POLL_READ: - DEBUG_EVENT("%s: Reading %s Front-End register: Reg[%04X]=%02X\n", + fe->te_param.reg_dbg_value = READ_REG(fe_event->te_event.reg); + DEBUG_TE1("%s: Read %s Front-End Reg:%04X=%02X\n", fe->name, FE_MEDIA_DECODE(fe), fe_event->te_event.reg, - READ_REG(fe_event->te_event.value)); + fe->te_param.reg_dbg_value); + fe->te_param.reg_dbg_ready = 1; break; case TE_POLL_WRITE: - DEBUG_EVENT("%s: Writting %s Front-End register: Reg[%04X]=%02X\n", + DEBUG_TE1("%s: Write %s Front-End Reg:%04X=%02X\n", fe->name, FE_MEDIA_DECODE(fe), fe_event->te_event.reg, fe_event->te_event.value); @@ -6599,11 +6658,9 @@ static int sdla_te_polling(sdla_fe_t* fe) /* Add fe timer */ fe_event = WAN_LIST_FIRST(&fe->event); if (fe_event){ - sdla_te_add_timer(fe, fe_event->delay); - }else{ - sdla_te_add_timer(fe, HZ); + return fe_event->delay; } - return 0; + return HZ; } /* @@ -6688,8 +6745,17 @@ static int sdla_te_udp(sdla_fe_t *fe, void* p_udp_cmd, unsigned char* data) #if 0 *(unsigned long *)&data[0] = fe->fe_alarm; #endif - /* TE1 Update T1/E1 perfomance counters */ + sdla_te_pmon(fe, WAN_FE_PMON_READ); memcpy(&data[0], &fe->fe_stats, sizeof(sdla_fe_stats_t)); + if (udp_cmd->wan_cmd_fe_force){ + sdla_fe_stats_t *fe_stats = (sdla_fe_stats_t*)&data[0]; + /* force to read FE alarms */ + DEBUG_EVENT("%s: Force to read Front-End alarms\n", + fe->name); + fe_stats->alarms = + sdla_te_read_alarms(fe, WAN_FE_ALARM_READ); + } + /* TE1 Update T1/E1 perfomance counters */ udp_cmd->wan_cmd_return_code = WAN_CMD_OK; udp_cmd->wan_cmd_data_len = sizeof(sdla_fe_stats_t); break; @@ -6814,13 +6880,27 @@ static int sdla_te_udp(sdla_fe_t *fe, void* p_udp_cmd, unsigned char* data) break; case WAN_FE_DEBUG_REG: + if (fe->te_param.reg_dbg_busy){ + if (fe_debug->fe_debug_reg.read == 2 && fe->te_param.reg_dbg_ready){ + /* Poll the register value */ + fe_debug->fe_debug_reg.value = fe->te_param.reg_dbg_value; + udp_cmd->wan_cmd_return_code = WAN_CMD_OK; + fe->te_param.reg_dbg_busy = 0; + } + break; + } fe_event.type = (fe_debug->fe_debug_reg.read) ? - TE_POLL_READ : TE_POLL_WRITE; - fe_event.te_event.reg = fe_debug->fe_debug_reg.reg; + TE_POLL_READ : TE_POLL_WRITE; + fe_event.te_event.reg = (u_int16_t)fe_debug->fe_debug_reg.reg; fe_event.te_event.value = fe_debug->fe_debug_reg.value; fe_event.delay = POLLING_TE1_TIMER; + if (fe_debug->fe_debug_reg.read){ + fe->te_param.reg_dbg_busy = 1; + fe->te_param.reg_dbg_ready = 0; + } sdla_te_add_event(fe, &fe_event); udp_cmd->wan_cmd_return_code = WAN_CMD_OK; + break; default: udp_cmd->wan_cmd_return_code = WAN_UDP_INVALID_CMD; break; diff --git a/patches/kdrivers/src/net/sdla_te3.c b/patches/kdrivers/src/net/sdla_te3.c index 2a7f91a..c7c0733 100644 --- a/patches/kdrivers/src/net/sdla_te3.c +++ b/patches/kdrivers/src/net/sdla_te3.c @@ -52,27 +52,18 @@ ** DEFINES AND MACROS ******************************************************************************/ -#if defined(DEBUG) -# define WRITE_CPLD(reg,val) \ - DEBUG_EVENT("%s: Write to CPLD reg %d value %X\n", \ - fe->name, reg, val); +#define WRITE_CPLD(reg,val) \ + fe->write_cpld(fe->card, (reg), (val)) -# define WRITE_REG(reg,val) \ - DEBUG_EVENT("%s: Write to Framer off %X value %X\n", \ - fe->name, reg, val); -#else +#define WRITE_EXAR_CPLD(reg,val) \ + fe->write_fe_cpld(fe->card, (reg), (val)) -# define WRITE_CPLD(reg,val) \ - (fe->write_cpld) ? fe->write_cpld(fe->card, reg, val) : -EINVAL - -# define WRITE_EXAR_CPLD(reg,val) \ - (fe->write_fe_cpld) ? fe->write_fe_cpld(fe->card, reg, val) : -EINVAL - -# define WRITE_REG(reg,val) \ - (fe->write_framer) ? fe->write_framer(fe->card, reg, val) : -EINVAL -# define READ_REG(reg) \ - (fe->read_framer) ? fe->read_framer(fe->card, reg) : 0 -#endif +#define WRITE_REG(reg,val) \ + fe->write_fe_reg( \ + ((sdla_t*)fe->card)->hw,(int)(reg),(int)(val)); +#define READ_REG(reg) \ + fe->read_fe_reg( \ + ((sdla_t*)fe->card)->hw,(int)(reg)); #define WAN_FE_SWAP_BIT(value, mask) \ if ((value) & mask){ \ @@ -105,8 +96,9 @@ static int sdla_ds3_isr(sdla_fe_t *fe); static int sdla_e3_isr(sdla_fe_t *fe); static int sdla_te3_isr(sdla_fe_t *fe); static int sdla_te3_udp(sdla_fe_t *fe, void*, unsigned char*); -static unsigned int sdla_te3_alarm(sdla_fe_t *fe, int); +static unsigned int sdla_te3_read_alarms(sdla_fe_t *fe, int); static int sdla_te3_read_pmon(sdla_fe_t *fe, int); +static int sdla_te3_flush_pmon(sdla_fe_t *fe); static int sdla_te3_update_alarm_info(sdla_fe_t* fe, struct seq_file* m, int* stop_cnt); static int sdla_te3_update_pmon_info(sdla_fe_t* fe, struct seq_file* m, int* stop_cnt); @@ -221,6 +213,8 @@ static int sdla_ds3_tx_isr(sdla_fe_t *fe) { unsigned char value; + WAN_ASSERT(fe->write_fe_reg == NULL); + WAN_ASSERT(fe->read_fe_reg == NULL); value = READ_REG(REG_TxDS3_LAPD_STATUS); if (value & BIT_TxDS3_LAPD_STATUS_INT){ DEBUG_EVENT("%s: LAPD Interrupt!\n", @@ -240,43 +234,35 @@ static int sdla_ds3_rx_isr(sdla_fe_t *fe) { unsigned char value, status; + WAN_ASSERT(fe->write_fe_reg == NULL); + WAN_ASSERT(fe->read_fe_reg == NULL); /* RxDS3 Interrupt status register (0x13) */ value = READ_REG(REG_RxDS3_INT_STATUS); status = READ_REG(REG_RxDS3_CFG_STATUS); if (fe->fe_cfg.frame == WAN_FR_DS3_Cbit && value & BIT_RxDS3_INT_STATUS_CPBIT_ERR){ - if (WAN_NET_RATELIMIT()){ - DEBUG_TE3("%s: CP Bit Error interrupt detected!\n", + DEBUG_TE3("%s: CP Bit Error interrupt detected!\n", fe->name); - } } if (value & BIT_RxDS3_INT_STATUS_LOS){ if (status & BIT_RxDS3_CFG_STATUS_RxLOS){ - if (WAN_NET_RATELIMIT()){ DEBUG_EVENT("%s: LOS Status ON!\n", fe->name); - } fe->fe_alarm |= WAN_TE3_BIT_LOS_ALARM; }else{ - if (WAN_NET_RATELIMIT()){ DEBUG_EVENT("%s: LOS Status OFF!\n", fe->name); - } fe->fe_alarm &= ~WAN_TE3_BIT_LOS_ALARM; } } if (value & BIT_RxDS3_INT_STATUS_AIS){ - if (WAN_NET_RATELIMIT()){ DEBUG_EVENT("%s: AIS status %s!\n", fe->name, (status & BIT_RxDS3_CFG_STATUS_RxAIS) ? "ON" : "OFF"); - } } if (value & BIT_RxDS3_INT_STATUS_IDLE){ - if (WAN_NET_RATELIMIT()){ - DEBUG_TE3("%s: IDLE condition status %s!\n", + DEBUG_EVENT("%s: IDLE condition status %s!\n", fe->name, (status & BIT_RxDS3_CFG_STATUS_RxIDLE) ? "ON" : "OFF"); - } } if (value & BIT_RxDS3_INT_STATUS_OOF){ if (status & BIT_RxDS3_CFG_STATUS_RxLOS){ @@ -302,27 +288,23 @@ static int sdla_ds3_rx_isr(sdla_fe_t *fe) } } if (fe->fe_cfg.frame == WAN_FR_DS3_Cbit && value & BIT_RxDS3_INT_STATUS_AIC){ - if (WAN_NET_RATELIMIT()){ DEBUG_TE3("%s: AIC bit-field status %s!\n", fe->name, (status & BIT_RxDS3_STATUS_RxAIC) ? "ON" : "OFF"); - } } if (value & BIT_RxDS3_INT_STATUS_PBIT_ERR){ - if (WAN_NET_RATELIMIT()){ DEBUG_TE3("%s: P-Bit error interrupt!\n", fe->name); - } } /* RxDS3 FEAC Interrupt (0x17) */ value = READ_REG(REG_RxDS3_FEAC_INT); if (value & BIT_RxDS3_FEAC_REMOVE_INT_STATUS){ - DEBUG_TE3("%s: RxFEAC Remove Interrupt!\n", + DEBUG_EVENT("%s: RxFEAC Remove Interrupt!\n", fe->name); } if (value & BIT_RxDS3_FEAC_VALID_INT_STATUS){ - DEBUG_TE3("%s: RxFEAC Valid Interrupt!\n", + DEBUG_EVENT("%s: RxFEAC Valid Interrupt!\n", fe->name); } @@ -340,6 +322,8 @@ static int sdla_ds3_isr(sdla_fe_t *fe) { unsigned char value; + WAN_ASSERT(fe->write_fe_reg == NULL); + WAN_ASSERT(fe->read_fe_reg == NULL); value = READ_REG(REG_BLOCK_INT_STATUS); if (value & BIT_BLOCK_INT_STATUS_RxDS3_E3){ sdla_ds3_rx_isr(fe); @@ -379,6 +363,9 @@ static int sdla_e3_rx_isr(sdla_fe_t *fe) unsigned char int_status1, int_status2; unsigned char status; + WAN_ASSERT(fe->write_fe_reg == NULL); + WAN_ASSERT(fe->read_fe_reg == NULL); + int_status1 = READ_REG(REG_RxE3_INT_STATUS_1); int_status2 = READ_REG(REG_RxE3_INT_STATUS_2); status = READ_REG(REG_RxE3_CFG_STATUS_2); @@ -457,6 +444,9 @@ static int sdla_e3_isr(sdla_fe_t *fe) { unsigned char value; + WAN_ASSERT(fe->write_fe_reg == NULL); + WAN_ASSERT(fe->read_fe_reg == NULL); + value = READ_REG(REG_BLOCK_INT_STATUS); if (value & BIT_BLOCK_INT_STATUS_RxDS3_E3){ sdla_e3_rx_isr(fe); @@ -478,10 +468,8 @@ static int sdla_e3_isr(sdla_fe_t *fe) static int sdla_te3_isr(sdla_fe_t *fe) { sdla_fe_cfg_t *fe_cfg = &fe->fe_cfg; - unsigned char value; int err = 0; - value = READ_REG(REG_BLOCK_INT_STATUS); switch(fe_cfg->media){ case WAN_MEDIA_DS3: err = sdla_ds3_isr(fe); @@ -490,113 +478,135 @@ static int sdla_te3_isr(sdla_fe_t *fe) err = sdla_e3_isr(fe); break; } - fe->fe_alarm = sdla_te3_alarm(fe, 1); + sdla_te3_set_status(fe); return err; } /****************************************************************************** - * sdla_te3_alarm() + * sdla_te3_read_alarms() * * Description: * Arguments: * Returns: ****************************************************************************** */ -static unsigned int sdla_te3_alarm(sdla_fe_t *fe, int update) +static unsigned int sdla_te3_read_framer_alarms(sdla_fe_t *fe) { sdla_fe_cfg_t *fe_cfg = &fe->fe_cfg; - unsigned int alarm = 0; + unsigned int alarms = 0; unsigned char value; - + + WAN_ASSERT(fe->write_fe_reg == NULL); + WAN_ASSERT(fe->read_fe_reg == NULL); + if (fe_cfg->media == WAN_MEDIA_DS3){ value = READ_REG(REG_RxDS3_CFG_STATUS); if (value & BIT_RxDS3_CFG_STATUS_RxAIS){ - alarm |= WAN_TE3_BIT_AIS_ALARM; - DEBUG_TE3("%s: (T3/E3) AIS Alarm is ON\n", fe->name); + alarms |= WAN_TE3_BIT_AIS_ALARM; }else{ - alarm &= ~WAN_TE3_BIT_AIS_ALARM; - DEBUG_TE3("%s: (T3/E3) AIS Alarm is OFF\n", fe->name); + alarms &= ~WAN_TE3_BIT_AIS_ALARM; } if (value & BIT_RxDS3_CFG_STATUS_RxLOS){ - alarm |= WAN_TE3_BIT_LOS_ALARM; - DEBUG_TE3("%s: (T3/E3) LOS Alarm is ON\n", fe->name); + alarms |= WAN_TE3_BIT_LOS_ALARM; }else{ - alarm &= ~WAN_TE3_BIT_LOS_ALARM; - DEBUG_TE3("%s: (T3/E3) LOS Alarm is OFF\n", fe->name); + alarms &= ~WAN_TE3_BIT_LOS_ALARM; } if (value & BIT_RxDS3_CFG_STATUS_RxOOF){ - alarm |= WAN_TE3_BIT_OOF_ALARM; - DEBUG_TE3("%s: (T3/E3) OOF Alarm is ON\n", fe->name); + alarms |= WAN_TE3_BIT_OOF_ALARM; }else{ - alarm &= ~WAN_TE3_BIT_OOF_ALARM; - DEBUG_TE3("%s: (T3/E3) OOF Alarm is OFF\n", fe->name); + alarms &= ~WAN_TE3_BIT_OOF_ALARM; } value = READ_REG(REG_RxDS3_STATUS); if (value & BIT_RxDS3_STATUS_RxFERF){ - alarm |= WAN_TE3_BIT_YEL_ALARM; - DEBUG_TE3("%s: (T3/E3) YEL Alarm is ON\n", fe->name); + alarms |= WAN_TE3_BIT_YEL_ALARM; }else{ - alarm &= ~WAN_TE3_BIT_YEL_ALARM; - DEBUG_TE3("%s: (T3/E3) YEL Alarm is OFF\n", fe->name); + alarms &= ~WAN_TE3_BIT_YEL_ALARM; } }else{ value = READ_REG(REG_RxE3_CFG_STATUS_2); if (value & BIT_RxE3_CFG_STATUS_RxOOF){ - DEBUG_TE3("%s: (T3/E3) OOF Alarm ON!\n", - fe->name); - alarm |= WAN_TE3_BIT_OOF_ALARM; + alarms |= WAN_TE3_BIT_OOF_ALARM; }else{ - DEBUG_TE3("%s: (T3/E3) OOF Alarm OFF!\n", - fe->name); - alarm &= ~WAN_TE3_BIT_OOF_ALARM; + alarms &= ~WAN_TE3_BIT_OOF_ALARM; } if (value & BIT_RxE3_CFG_STATUS_RxLOF){ - DEBUG_TE3("%s: (T3/E3) LOF Alarm ON!\n", - fe->name); - alarm |= WAN_TE3_BIT_LOF_ALARM; + alarms |= WAN_TE3_BIT_LOF_ALARM; }else{ - DEBUG_TE3("%s: (T3/E3) LOF Alarm OFF!\n", - fe->name); - alarm &= ~WAN_TE3_BIT_LOF_ALARM; + alarms &= ~WAN_TE3_BIT_LOF_ALARM; } if (value & BIT_RxE3_CFG_STATUS_RxLOS){ - DEBUG_TE3("%s: (T3/E3) LOS Alarm ON!\n", - fe->name); - alarm |= WAN_TE3_BIT_LOS_ALARM; + alarms |= WAN_TE3_BIT_LOS_ALARM; }else{ - DEBUG_TE3("%s: (T3/E3) LOS Alarm OFF!\n", - fe->name); - alarm &= ~WAN_TE3_BIT_LOS_ALARM; + alarms &= ~WAN_TE3_BIT_LOS_ALARM; } if (value & BIT_RxE3_CFG_STATUS_RxAIS){ - DEBUG_TE3("%s: (T3/E3) AIS Alarm ON!\n", - fe->name); - alarm |= WAN_TE3_BIT_AIS_ALARM; + alarms |= WAN_TE3_BIT_AIS_ALARM; }else{ - DEBUG_TE3("%s: (T3/E3) AIS Alarm OFF!\n", - fe->name); - alarm &= ~WAN_TE3_BIT_AIS_ALARM; + alarms &= ~WAN_TE3_BIT_AIS_ALARM; } if (value & BIT_RxE3_CFG_STATUS_RxFERF){ - DEBUG_TE3("%s: (T3/E3) Rx FERF status is ON (YELLOW)!\n", - fe->name); - alarm |= WAN_TE3_BIT_YEL_ALARM; + alarms |= WAN_TE3_BIT_YEL_ALARM; }else{ - DEBUG_TE3("%s: (T3/E3) Rx FERF status is OFF!\n", - fe->name); - alarm &= ~WAN_TE3_BIT_YEL_ALARM; + alarms &= ~WAN_TE3_BIT_YEL_ALARM; } } + return alarms; +} - fe->fe_alarm = alarm; - if (update){ - sdla_te3_set_status(fe); +static int sdla_te3_print_alarms(sdla_fe_t *fe, unsigned int alarms) +{ + + DEBUG_EVENT("%s: %s Framer Alarms status (%X):\n", + fe->name, + FE_MEDIA_DECODE(fe), + alarms); + + if (!alarms){ + DEBUG_EVENT("%s: %s Alarms status: No alarms detected!\n", + fe->name, + FE_MEDIA_DECODE(fe)); + return 0; } - return alarm; + if (alarms & WAN_TE3_BIT_AIS_ALARM){ + DEBUG_EVENT("%s: AIS Alarm is ON\n", fe->name); + } + if (alarms & WAN_TE3_BIT_LOS_ALARM){ + DEBUG_EVENT("%s: LOS Alarm is ON\n", fe->name); + } + if (alarms & WAN_TE3_BIT_OOF_ALARM){ + DEBUG_EVENT("%s: OOF Alarm is ON\n", fe->name); + } + if (alarms & WAN_TE3_BIT_YEL_ALARM){ + DEBUG_EVENT("%s: YEL Alarm is ON\n", fe->name); + } + if (alarms & WAN_TE3_BIT_LOF_ALARM){ + DEBUG_EVENT("%s: LOF Alarm OFF!\n", fe->name); + } + + return 0; +} + +static unsigned int sdla_te3_read_alarms(sdla_fe_t *fe, int action) +{ + unsigned int alarms = 0; + + if (IS_FE_ALARM_READ(action)){ + alarms = sdla_te3_read_framer_alarms(fe); + } + + if (IS_FE_ALARM_PRINT(action)){ + sdla_te3_print_alarms(fe, alarms); + } + + if (IS_FE_ALARM_UPDATE(action)){ + fe->fe_alarm = alarms; + sdla_te3_set_status(fe); + } + return alarms; } @@ -616,18 +626,20 @@ static int sdla_te3_set_alarm(sdla_fe_t *fe, unsigned int alarm) } /****************************************************************************** - * sdla_te3_read_pmon() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ +* sdla_te3_read_pmon() +* +* Description: +* Arguments: +* Returns: +******************************************************************************/ static int sdla_te3_read_pmon(sdla_fe_t *fe, int action) { sdla_te3_pmon_t *pmon = (sdla_te3_pmon_t*)&fe->fe_stats.u.te3_pmon; unsigned char value_msb, value_lsb; + WAN_ASSERT(fe->write_fe_reg == NULL); + WAN_ASSERT(fe->read_fe_reg == NULL); + value_msb = READ_REG(REG_PMON_LCV_MSB); value_lsb = READ_REG(REG_PMON_LCV_LSB); pmon->pmon_lcv += ((value_msb << 8) | value_lsb); @@ -650,8 +662,6 @@ static int sdla_te3_read_pmon(sdla_fe_t *fe, int action) return 0; } - - /****************************************************************************** * sdla_te3_flush_pmon() * @@ -721,6 +731,8 @@ sdla_te3_set_lb_modes(sdla_fe_t *fe, unsigned char type, unsigned char mode) { unsigned char data = 0x00; + WAN_ASSERT(fe->write_fe_reg == NULL); + WAN_ASSERT(fe->read_fe_reg == NULL); DEBUG_EVENT("%s: %s %s mode...\n", fe->name, WAN_TE3_LB_MODE_DECODE(mode), @@ -756,7 +768,6 @@ sdla_te3_set_lb_modes(sdla_fe_t *fe, unsigned char type, unsigned char mode) return 0; } - /****************************************************************************** * sdla_te3_udp() * @@ -772,7 +783,6 @@ static int sdla_te3_udp(sdla_fe_t *fe, void *pudp_cmd, unsigned char *data) int err = -EINVAL; switch(udp_cmd->wan_cmd_command){ - case WAN_GET_MEDIA_TYPE: data[0] = fe->fe_cfg.media; udp_cmd->wan_cmd_return_code = WAN_CMD_OK; @@ -792,14 +802,14 @@ static int sdla_te3_udp(sdla_fe_t *fe, void *pudp_cmd, unsigned char *data) break; case WAN_FE_GET_STAT: - /* Read T3/E3 alarms */ + /* TE1_56K Read T1/E1/56K alarms */ sdla_te3_read_pmon(fe, 0); if (udp_cmd->wan_cmd_fe_force){ /* force to read FE alarms */ DEBUG_EVENT("%s: Force to read Front-End alarms\n", fe->name); fe->fe_stats.alarms = - sdla_te3_alarm(fe, 1); + sdla_te3_read_alarms(fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE); } memcpy(&data[0], &fe->fe_stats, sizeof(sdla_fe_stats_t)); udp_cmd->wan_cmd_return_code = WAN_CMD_OK; @@ -829,11 +839,13 @@ static int sdla_te3_udp(sdla_fe_t *fe, void *pudp_cmd, unsigned char *data) return 0; } - static int sdla_te3_set_intr(sdla_fe_t *fe) { sdla_fe_cfg_t *fe_cfg = &fe->fe_cfg; + WAN_ASSERT(fe->write_fe_reg == NULL); + WAN_ASSERT(fe->read_fe_reg == NULL); + DEBUG_EVENT("%s: Enabling interrupts for %s (%d)!\n", fe->name, FE_MEDIA_DECODE(fe), IS_DS3(fe_cfg)); /* Enable Framer Interrupts */ @@ -896,6 +908,7 @@ sdla_te3_liu_config(sdla_fe_t *fe, sdla_te3_liu_cfg_t *liu, char *name) sdla_fe_cfg_t *fe_cfg = &fe->fe_cfg; unsigned char data = 0x00; + WAN_ASSERT(fe->write_cpld == NULL); if (fe_cfg->media == WAN_MEDIA_E3){ data |= BIT_CPLD_CNTRL_E3; } @@ -930,33 +943,7 @@ sdla_te3_liu_config(sdla_fe_t *fe, sdla_te3_liu_cfg_t *liu, char *name) name); data &= ~BIT_CPLD_STATUS_TAOS; } - switch(liu->lb_mode){ - case WAN_TE3_LIU_LB_NORMAL: - break; - case WAN_TE3_LIU_LB_ANALOG: - DEBUG_TE3("%s: (T3/E3) Enable Analog Loopback mode!\n", - name); - data |= BIT_CPLD_STATUS_LLB; - data &= ~BIT_CPLD_STATUS_RLB; - break; - case WAN_TE3_LIU_LB_REMOTE: - DEBUG_TE3("%s: (T3/E3) Enable Remote Loopback mode!\n", - name); - data &= ~BIT_CPLD_STATUS_LLB; - data |= BIT_CPLD_STATUS_RLB; - break; - case WAN_TE3_LIU_LB_DIGITAL: - DEBUG_TE3("%s: (T3/E3) Enable Digital Loopback mode!\n", - name); - data |= BIT_CPLD_STATUS_LLB; - data |= BIT_CPLD_STATUS_RLB; - break; - default : - DEBUG_EVENT("%s: (T3/E3) Unknown loopback mode!\n", - name); - break; - } - /* Write value to CPLD Status/Control register */ + /* Write value to CPLD Status register */ WRITE_CPLD(REG_CPLD_STATUS, data); return 0; } @@ -975,11 +962,13 @@ sdla_te3_shark_liu_config(sdla_fe_t *fe, sdla_te3_liu_cfg_t *liu, char *name) sdla_fe_cfg_t *fe_cfg = &fe->fe_cfg; unsigned char data = 0x00; + WAN_ASSERT(fe->write_fe_cpld == NULL); + fe->te3_param.cpld_cntrl = 0x00; if (fe_cfg->media == WAN_MEDIA_E3){ - data |= BIT_EXAR_CPLD_CNTRL_E3; + fe->te3_param.cpld_cntrl |= BIT_EXAR_CPLD_CNTRL_E3; } /* Write value to CPLD Control register */ - WRITE_EXAR_CPLD(REG_EXAR_CPLD_CNTRL, data); + WRITE_EXAR_CPLD(REG_EXAR_CPLD_CNTRL, fe->te3_param.cpld_cntrl); data = 0x00; if (liu->rx_equal == WAN_TRUE){ @@ -1010,33 +999,6 @@ sdla_te3_shark_liu_config(sdla_fe_t *fe, sdla_te3_liu_cfg_t *liu, char *name) data &= ~BIT_LINE_INTERFACE_DRIVE_TAOS; } - switch(liu->lb_mode){ - case WAN_TE3_LIU_LB_NORMAL: - break; - case WAN_TE3_LIU_LB_ANALOG: - DEBUG_TE3("%s: (T3/E3) Enable Analog Loopback mode!\n", - name); - data |= BIT_LINE_INTERFACE_DRIVE_LLOOP; - data &= ~BIT_LINE_INTERFACE_DRIVE_RLOOP; - break; - case WAN_TE3_LIU_LB_REMOTE: - DEBUG_TE3("%s: (T3/E3) Enable Remote Loopback mode!\n", - name); - data &= ~BIT_LINE_INTERFACE_DRIVE_LLOOP; - data |= BIT_LINE_INTERFACE_DRIVE_RLOOP; - break; - case WAN_TE3_LIU_LB_DIGITAL: - DEBUG_TE3("%s: (T3/E3) Enable Digital Loopback mode!\n", - name); - data |= BIT_LINE_INTERFACE_DRIVE_LLOOP; - data |= BIT_LINE_INTERFACE_DRIVE_RLOOP; - break; - default : - DEBUG_EVENT("%s: (T3/E3) Unknown loopback mode!\n", - name); - break; - } - WRITE_REG(REG_LINE_INTERFACE_DRIVE, data); return 0; } @@ -1052,8 +1014,9 @@ int sdla_te3_iface_init(void *p_fe_iface) fe_iface->polling = &sdla_te3_polling; fe_iface->isr = &sdla_te3_isr; fe_iface->process_udp = &sdla_te3_udp; - fe_iface->read_alarm = &sdla_te3_alarm; + fe_iface->read_alarm = &sdla_te3_read_alarms; fe_iface->read_pmon = &sdla_te3_read_pmon; + fe_iface->flush_pmon = &sdla_te3_flush_pmon; fe_iface->set_fe_alarm = &sdla_te3_set_alarm; fe_iface->get_fe_status = &sdla_te3_get_fe_status; fe_iface->get_fe_media = &sdla_te3_get_fe_media; @@ -1072,6 +1035,9 @@ static int sdla_te3_config(void *p_fe) u16 adptr_subtype; unsigned char data = 0x00; + WAN_ASSERT(fe->write_fe_reg == NULL); + WAN_ASSERT(fe->read_fe_reg == NULL); + card->hw_iface.getcfg(card->hw, SDLA_ADAPTERSUBTYPE, &adptr_subtype); data = READ_REG(0x02); @@ -1185,7 +1151,7 @@ static int sdla_te3_config(void *p_fe) fe->fe_status = FE_DISCONNECTED; DEBUG_EVENT("%s: %s disconnected!\n", fe->name, FE_MEDIA_DECODE(fe)); - sdla_te3_alarm(fe, 1); + sdla_te3_read_alarms(fe, 1); sdla_te3_set_intr(fe); return 0; diff --git a/patches/kdrivers/src/net/sdla_te3.c~ b/patches/kdrivers/src/net/sdla_te3.c~ deleted file mode 100644 index 3da0120..0000000 --- a/patches/kdrivers/src/net/sdla_te3.c~ +++ /dev/null @@ -1,1268 +0,0 @@ -/****************************************************************************** - * - * sdla_te3.c Sangoma T3/E3 front end. - * - * Alex Feldman - * - * Copyright Sangoma Technologies Inc. 1999, 2000,2001, 2002, 2003, 2004 - * - * This program is provided subject to the Software License included in - * this package in the file license.txt. By using this program you agree - * to be bound bythe terms of this license. - * - * Should you not have a copy of the file license.txt, or wish to obtain - * a hard copy of the Software License, please contact Sangoma - * technologies Corporation. - * - * Contact: Sangoma Technologies Inc. 905-474-1990, info@sangoma.com - * - *****************************************************************************/ - - -/****************************************************************************** -** INCLUDE FILES -******************************************************************************/ - -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) -# include -# if !defined(CONFIG_PRODUCT_WANPIPE_GENERIC) -# include -# endif -# include -# include -# include -# include /* WANPIPE common user API definitions */ -# include -#elif (defined __LINUX__) || (defined __KERNEL__) -# include -# include -# include -# include -# include -# include /* WANPIPE common user API definitions */ -#else -# error "No OS Defined" -#endif - -/****************************************************************************** -** DEFINES AND MACROS -******************************************************************************/ - -/****************************************************************************** -** DEFINES AND MACROS -******************************************************************************/ - -#if defined(DEBUG) -# define WRITE_CPLD(reg,val) \ - DEBUG_EVENT("%s: Write to CPLD reg %d value %X\n", \ - fe->name, reg, val); - -# define WRITE_REG(reg,val) \ - DEBUG_EVENT("%s: Write to Framer off %X value %X\n", \ - fe->name, reg, val); -#else - -# define WRITE_CPLD(reg,val) \ - (fe->write_cpld) ? fe->write_cpld(fe->card, reg, val) : -EINVAL - -# define WRITE_EXAR_CPLD(reg,val) \ - (fe->write_fe_cpld) ? fe->write_fe_cpld(fe->card, reg, val) : -EINVAL - -# define WRITE_REG(reg,val) \ - (fe->write_framer) ? fe->write_framer(fe->card, reg, val) : -EINVAL -# define READ_REG(reg) \ - (fe->read_framer) ? fe->read_framer(fe->card, reg) : 0 -#endif - -#define WAN_FE_SWAP_BIT(value, mask) \ - if ((value) & mask){ \ - (value) &= ~mask; \ - }else{ \ - (value) |= mask; \ - } - -/* DS3: Define DS3 alarm states: LOS OOF YEL */ -#define IS_DS3_ALARM(alarm) ((alarm) & \ - (WAN_TE3_BIT_LOS_ALARM | \ - WAN_TE3_BIT_YEL_ALARM | \ - WAN_TE3_BIT_OOF_ALARM)) - -/* DS3: Define E3 alarm states: LOS OOF YEL */ -#define IS_E3_ALARM(alarm) ((alarm) & \ - (WAN_TE3_BIT_LOS_ALARM | \ - WAN_TE3_BIT_YEL_ALARM | \ - WAN_TE3_BIT_OOF_ALARM)) - -/****************************************************************************** -** FUNCTION DEFINITIONS -******************************************************************************/ - -static int sdla_te3_config(void *p_fe); -static int sdla_te3_unconfig(void *p_fe); -static int sdla_te3_get_fe_status(sdla_fe_t *fe, unsigned char *status); -static int sdla_te3_polling(sdla_fe_t *fe); -static int sdla_ds3_isr(sdla_fe_t *fe); -static int sdla_e3_isr(sdla_fe_t *fe); -static int sdla_te3_isr(sdla_fe_t *fe); -static int sdla_te3_udp(sdla_fe_t *fe, void*, unsigned char*); -static unsigned int sdla_te3_alarm(sdla_fe_t *fe, int); -static int sdla_te3_read_pmon(sdla_fe_t *fe, int); - -static int sdla_te3_update_alarm_info(sdla_fe_t* fe, struct seq_file* m, int* stop_cnt); -static int sdla_te3_update_pmon_info(sdla_fe_t* fe, struct seq_file* m, int* stop_cnt); - -/****************************************************************************** - * sdla_te3_get_fe_status() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ -static char* sdla_te3_get_fe_media_string(void) -{ - return ("AFT T3/E3"); -} - -/****************************************************************************** - * sdla_te3_get_fe_status() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ -static unsigned char sdla_te3_get_fe_media(sdla_fe_t *fe) -{ - return fe->fe_cfg.media; -} - -/****************************************************************************** - * sdla_te3_get_fe_status() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ -static int sdla_te3_get_fe_status(sdla_fe_t *fe, unsigned char *status) -{ - *status = fe->fe_status; - return 0; -} - -/****************************************************************************** - * sdla_te3_polling() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ -static int sdla_te3_polling(sdla_fe_t *fe) -{ - DEBUG_EVENT("%s: %s: This function is still not supported!\n", - fe->name, __FUNCTION__); - return -EINVAL; -} - -/****************************************************************************** - * sdla_te3_set_status() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ -static int sdla_te3_set_status(sdla_fe_t *fe) -{ - if (IS_DS3(&fe->fe_cfg)){ - if (IS_DS3_ALARM(fe->fe_alarm)){ - if (fe->fe_status != FE_DISCONNECTED){ - DEBUG_EVENT("%s: DS3 disconnected!\n", - fe->name); - fe->fe_status = FE_DISCONNECTED; - } - }else{ - if (fe->fe_status != FE_CONNECTED){ - DEBUG_EVENT("%s: DS3 connected!\n", - fe->name); - fe->fe_status = FE_CONNECTED; - } - } - }else if (IS_E3(&fe->fe_cfg)){ - if (IS_E3_ALARM(fe->fe_alarm)){ - if (fe->fe_status != FE_DISCONNECTED){ - DEBUG_EVENT("%s: E3 disconnected!\n", - fe->name); - fe->fe_status = FE_DISCONNECTED; - } - }else{ - if (fe->fe_status != FE_CONNECTED){ - DEBUG_EVENT("%s: E3 connected!\n", - fe->name); - fe->fe_status = FE_CONNECTED; - } - } - }else{ - return -EINVAL; - } - return 0; -} - -/****************************************************************************** -** sdla_ds3_tx_isr() -** -** Description: -** Arguments: -** Returns: -******************************************************************************/ -static int sdla_ds3_tx_isr(sdla_fe_t *fe) -{ - unsigned char value; - - value = READ_REG(REG_TxDS3_LAPD_STATUS); - if (value & BIT_TxDS3_LAPD_STATUS_INT){ - DEBUG_EVENT("%s: LAPD Interrupt!\n", - fe->name); - } - return 0; -} - -/****************************************************************************** -** sdla_ds3_rx_isr() -** -** Description: -** Arguments: -** Returns: -******************************************************************************/ -static int sdla_ds3_rx_isr(sdla_fe_t *fe) -{ - unsigned char value, status; - - /* RxDS3 Interrupt status register (0x13) */ - value = READ_REG(REG_RxDS3_INT_STATUS); - status = READ_REG(REG_RxDS3_CFG_STATUS); - if (fe->fe_cfg.frame == WAN_FR_DS3_Cbit && value & BIT_RxDS3_INT_STATUS_CPBIT_ERR){ - if (WAN_NET_RATELIMIT()){ - DEBUG_TE3("%s: CP Bit Error interrupt detected!\n", - fe->name); - } - } - if (value & BIT_RxDS3_INT_STATUS_LOS){ - if (status & BIT_RxDS3_CFG_STATUS_RxLOS){ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: LOS Status ON!\n", - fe->name); - } - fe->fe_alarm |= WAN_TE3_BIT_LOS_ALARM; - }else{ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: LOS Status OFF!\n", - fe->name); - } - fe->fe_alarm &= ~WAN_TE3_BIT_LOS_ALARM; - } - } - if (value & BIT_RxDS3_INT_STATUS_AIS){ - if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: AIS status %s!\n", - fe->name, - (status & BIT_RxDS3_CFG_STATUS_RxAIS) ? "ON" : "OFF"); - } - } - if (value & BIT_RxDS3_INT_STATUS_IDLE){ - if (WAN_NET_RATELIMIT()){ - DEBUG_TE3("%s: IDLE condition status %s!\n", - fe->name, - (status & BIT_RxDS3_CFG_STATUS_RxIDLE) ? "ON" : "OFF"); - } - } - if (value & BIT_RxDS3_INT_STATUS_OOF){ - if (status & BIT_RxDS3_CFG_STATUS_RxLOS){ - DEBUG_EVENT("%s: OOF Alarm ON!\n", - fe->name); - fe->fe_alarm |= WAN_TE3_BIT_OOF_ALARM; - }else{ - DEBUG_EVENT("%s: OOF Alarm OFF!\n", - fe->name); - fe->fe_alarm &= ~WAN_TE3_BIT_OOF_ALARM; - } - } - status = READ_REG(REG_RxDS3_STATUS); - if (value & BIT_RxDS3_INT_STATUS_FERF){ - if (status & BIT_RxDS3_STATUS_RxFERF){ - DEBUG_EVENT("%s: Rx FERF status is ON (YELLOW)!\n", - fe->name); - fe->fe_alarm |= WAN_TE3_BIT_YEL_ALARM; - }else{ - DEBUG_EVENT("%s: Rx FERF status is OFF!\n", - fe->name); - fe->fe_alarm &= ~WAN_TE3_BIT_YEL_ALARM; - } - } - if (fe->fe_cfg.frame == WAN_FR_DS3_Cbit && value & BIT_RxDS3_INT_STATUS_AIC){ - if (WAN_NET_RATELIMIT()){ - DEBUG_TE3("%s: AIC bit-field status %s!\n", - fe->name, - (status & BIT_RxDS3_STATUS_RxAIC) ? "ON" : "OFF"); - } - } - if (value & BIT_RxDS3_INT_STATUS_PBIT_ERR){ - if (WAN_NET_RATELIMIT()){ - DEBUG_TE3("%s: P-Bit error interrupt!\n", - fe->name); - } - } - - /* RxDS3 FEAC Interrupt (0x17) */ - value = READ_REG(REG_RxDS3_FEAC_INT); - if (value & BIT_RxDS3_FEAC_REMOVE_INT_STATUS){ - DEBUG_TE3("%s: RxFEAC Remove Interrupt!\n", - fe->name); - } - if (value & BIT_RxDS3_FEAC_VALID_INT_STATUS){ - DEBUG_TE3("%s: RxFEAC Valid Interrupt!\n", - fe->name); - } - - return 0; -} - -/****************************************************************************** -** sdla_ds3_isr() -** -** Description: -** Arguments: -** Returns: -******************************************************************************/ -static int sdla_ds3_isr(sdla_fe_t *fe) -{ - unsigned char value; - - value = READ_REG(REG_BLOCK_INT_STATUS); - if (value & BIT_BLOCK_INT_STATUS_RxDS3_E3){ - sdla_ds3_rx_isr(fe); - } - if (value & BIT_BLOCK_INT_STATUS_TxDS3_E3){ - sdla_ds3_tx_isr(fe); - } - - return 0; -} - -/****************************************************************************** -** sdla_e3_tx_isr() -** -** Description: -** Arguments: -** Returns: -******************************************************************************/ -static int sdla_e3_tx_isr(sdla_fe_t *fe) -{ - DEBUG_EVENT("%s: %s: This function is still not supported!\n", - fe->name, __FUNCTION__); - - return 0; -} - - -/****************************************************************************** -** sdla_e3_rx_isr() -** -** Description: -** Arguments: -** Returns: -******************************************************************************/ -static int sdla_e3_rx_isr(sdla_fe_t *fe) -{ - unsigned char int_status1, int_status2; - unsigned char status; - - int_status1 = READ_REG(REG_RxE3_INT_STATUS_1); - int_status2 = READ_REG(REG_RxE3_INT_STATUS_2); - status = READ_REG(REG_RxE3_CFG_STATUS_2); - if (int_status1 & BIT_RxE3_INT_STATUS_OOF){ - if (status & BIT_RxE3_CFG_STATUS_RxOOF){ - DEBUG_EVENT("%s: OOF Alarm ON!\n", - fe->name); - fe->fe_alarm |= WAN_TE3_BIT_OOF_ALARM; - }else{ - DEBUG_EVENT("%s: OOF Alarm OFF!\n", - fe->name); - fe->fe_alarm &= ~WAN_TE3_BIT_OOF_ALARM; - } - } - - if (int_status1 & BIT_RxE3_INT_STATUS_LOF){ - if (status & BIT_RxE3_CFG_STATUS_RxLOF){ - DEBUG_EVENT("%s: LOF Alarm ON!\n", - fe->name); - fe->fe_alarm |= WAN_TE3_BIT_LOF_ALARM; - }else{ - DEBUG_EVENT("%s: LOF Alarm OFF!\n", - fe->name); - fe->fe_alarm &= ~WAN_TE3_BIT_LOF_ALARM; - } - } - - if (int_status1 & BIT_RxE3_INT_STATUS_LOS){ - if (status & BIT_RxE3_CFG_STATUS_RxLOS){ - DEBUG_EVENT("%s: LOS Alarm ON!\n", - fe->name); - fe->fe_alarm |= WAN_TE3_BIT_LOS_ALARM; - }else{ - DEBUG_EVENT("%s: LOS Alarm OFF!\n", - fe->name); - fe->fe_alarm &= ~WAN_TE3_BIT_LOS_ALARM; - } - } - - if (int_status1 & BIT_RxE3_INT_STATUS_AIS){ - if (status & BIT_RxE3_CFG_STATUS_RxAIS){ - DEBUG_EVENT("%s: AIS Alarm ON!\n", - fe->name); - fe->fe_alarm |= WAN_TE3_BIT_AIS_ALARM; - }else{ - DEBUG_EVENT("%s: AIS Alarm OFF!\n", - fe->name); - fe->fe_alarm &= ~WAN_TE3_BIT_AIS_ALARM; - } - } - - if (int_status2 & BIT_RxE3_INT_STATUS_FERF){ - if (status & BIT_RxE3_CFG_STATUS_RxFERF){ - DEBUG_EVENT("%s: Rx FERF status is ON (YELLOW)!\n", - fe->name); - fe->fe_alarm |= WAN_TE3_BIT_YEL_ALARM; - }else{ - DEBUG_EVENT("%s: Rx FERF status is OFF!\n", - fe->name); - fe->fe_alarm &= ~WAN_TE3_BIT_YEL_ALARM; - } - } - - return 0; -} - -/****************************************************************************** - * sdla_e3_isr() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ -static int sdla_e3_isr(sdla_fe_t *fe) -{ - unsigned char value; - - value = READ_REG(REG_BLOCK_INT_STATUS); - if (value & BIT_BLOCK_INT_STATUS_RxDS3_E3){ - sdla_e3_rx_isr(fe); - } - if (value & BIT_BLOCK_INT_STATUS_TxDS3_E3){ - sdla_e3_tx_isr(fe); - } - return -EINVAL; -} - -/****************************************************************************** - * sdla_te3_isr() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ -static int sdla_te3_isr(sdla_fe_t *fe) -{ - sdla_fe_cfg_t *fe_cfg = &fe->fe_cfg; - unsigned char value; - int err = 0; - - value = READ_REG(REG_BLOCK_INT_STATUS); - switch(fe_cfg->media){ - case WAN_MEDIA_DS3: - err = sdla_ds3_isr(fe); - break; - case WAN_MEDIA_E3: - err = sdla_e3_isr(fe); - break; - } - fe->fe_alarm = sdla_te3_alarm(fe, 1); - return err; -} - -/****************************************************************************** - * sdla_te3_alarm() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ -static unsigned int sdla_te3_alarm(sdla_fe_t *fe, int update) -{ - sdla_fe_cfg_t *fe_cfg = &fe->fe_cfg; - unsigned int alarm = 0; - unsigned char value; - - if (fe_cfg->media == WAN_MEDIA_DS3){ - value = READ_REG(REG_RxDS3_CFG_STATUS); - if (value & BIT_RxDS3_CFG_STATUS_RxAIS){ - alarm |= WAN_TE3_BIT_AIS_ALARM; - DEBUG_TE3("%s: (T3/E3) AIS Alarm is ON\n", fe->name); - }else{ - alarm &= ~WAN_TE3_BIT_AIS_ALARM; - DEBUG_TE3("%s: (T3/E3) AIS Alarm is OFF\n", fe->name); - } - if (value & BIT_RxDS3_CFG_STATUS_RxLOS){ - alarm |= WAN_TE3_BIT_LOS_ALARM; - DEBUG_TE3("%s: (T3/E3) LOS Alarm is ON\n", fe->name); - }else{ - alarm &= ~WAN_TE3_BIT_LOS_ALARM; - DEBUG_TE3("%s: (T3/E3) LOS Alarm is OFF\n", fe->name); - } - if (value & BIT_RxDS3_CFG_STATUS_RxOOF){ - alarm |= WAN_TE3_BIT_OOF_ALARM; - DEBUG_TE3("%s: (T3/E3) OOF Alarm is ON\n", fe->name); - }else{ - alarm &= ~WAN_TE3_BIT_OOF_ALARM; - DEBUG_TE3("%s: (T3/E3) OOF Alarm is OFF\n", fe->name); - } - value = READ_REG(REG_RxDS3_STATUS); - if (value & BIT_RxDS3_STATUS_RxFERF){ - alarm |= WAN_TE3_BIT_YEL_ALARM; - DEBUG_TE3("%s: (T3/E3) YEL Alarm is ON\n", fe->name); - }else{ - alarm &= ~WAN_TE3_BIT_YEL_ALARM; - DEBUG_TE3("%s: (T3/E3) YEL Alarm is OFF\n", fe->name); - } - }else{ - value = READ_REG(REG_RxE3_CFG_STATUS_2); - if (value & BIT_RxE3_CFG_STATUS_RxOOF){ - DEBUG_TE3("%s: (T3/E3) OOF Alarm ON!\n", - fe->name); - alarm |= WAN_TE3_BIT_OOF_ALARM; - }else{ - DEBUG_TE3("%s: (T3/E3) OOF Alarm OFF!\n", - fe->name); - alarm &= ~WAN_TE3_BIT_OOF_ALARM; - } - - if (value & BIT_RxE3_CFG_STATUS_RxLOF){ - DEBUG_TE3("%s: (T3/E3) LOF Alarm ON!\n", - fe->name); - alarm |= WAN_TE3_BIT_LOF_ALARM; - }else{ - DEBUG_TE3("%s: (T3/E3) LOF Alarm OFF!\n", - fe->name); - alarm &= ~WAN_TE3_BIT_LOF_ALARM; - } - - if (value & BIT_RxE3_CFG_STATUS_RxLOS){ - DEBUG_TE3("%s: (T3/E3) LOS Alarm ON!\n", - fe->name); - alarm |= WAN_TE3_BIT_LOS_ALARM; - }else{ - DEBUG_TE3("%s: (T3/E3) LOS Alarm OFF!\n", - fe->name); - alarm &= ~WAN_TE3_BIT_LOS_ALARM; - } - - if (value & BIT_RxE3_CFG_STATUS_RxAIS){ - DEBUG_TE3("%s: (T3/E3) AIS Alarm ON!\n", - fe->name); - alarm |= WAN_TE3_BIT_AIS_ALARM; - }else{ - DEBUG_TE3("%s: (T3/E3) AIS Alarm OFF!\n", - fe->name); - alarm &= ~WAN_TE3_BIT_AIS_ALARM; - } - - if (value & BIT_RxE3_CFG_STATUS_RxFERF){ - DEBUG_TE3("%s: (T3/E3) Rx FERF status is ON (YELLOW)!\n", - fe->name); - alarm |= WAN_TE3_BIT_YEL_ALARM; - }else{ - DEBUG_TE3("%s: (T3/E3) Rx FERF status is OFF!\n", - fe->name); - alarm &= ~WAN_TE3_BIT_YEL_ALARM; - } - } - - fe->fe_alarm = alarm; - if (update){ - sdla_te3_set_status(fe); - } - return alarm; -} - - -/****************************************************************************** - * sdla_te3_set_alarm() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ -static int sdla_te3_set_alarm(sdla_fe_t *fe, unsigned int alarm) -{ - DEBUG_EVENT("%s: %s: This function is still not supported!\n", - fe->name, __FUNCTION__); - return -EINVAL; -} - -/****************************************************************************** - * sdla_te3_read_pmon() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ -static int sdla_te3_read_pmon(sdla_fe_t *fe, int action) -{ - sdla_te3_pmon_t *pmon = (sdla_te3_pmon_t*)&fe->fe_stats.u.te3_pmon; - unsigned char value_msb, value_lsb; - - value_msb = READ_REG(REG_PMON_LCV_MSB); - value_lsb = READ_REG(REG_PMON_LCV_LSB); - pmon->pmon_lcv += ((value_msb << 8) | value_lsb); - - value_msb = READ_REG(REG_PMON_FRAMING_ERR_CNT_MSB); - value_lsb = READ_REG(REG_PMON_FRAMING_ERR_CNT_LSB); - pmon->pmon_framing += ((value_msb << 8) | value_lsb); - - value_msb = READ_REG(REG_PMON_PARITY_ERR_CNT_MSB); - value_lsb = READ_REG(REG_PMON_PARITY_ERR_CNT_LSB); - pmon->pmon_parity += ((value_msb << 8) | value_lsb); - - value_msb = READ_REG(REG_PMON_FEBE_EVENT_CNT_MSB); - value_lsb = READ_REG(REG_PMON_FEBE_EVENT_CNT_LSB); - pmon->pmon_febe += ((value_msb << 8) | value_lsb); - - value_msb = READ_REG(REG_PMON_CPBIT_ERROR_CNT_MSB); - value_lsb = READ_REG(REG_PMON_CPBIT_ERROR_CNT_LSB); - pmon->pmon_cpbit += ((value_msb << 8) | value_lsb); - return 0; -} - - - -/****************************************************************************** -* sdla_te3_flush_pmon() -* -* Description: -* Arguments: -* Returns: -******************************************************************************/ -static int sdla_te3_flush_pmon(sdla_fe_t *fe) -{ - sdla_te3_pmon_t *pmon = (sdla_te3_pmon_t*)&fe->fe_stats.u.te3_pmon; - - pmon->pmon_lcv = 0; - pmon->pmon_framing = 0; - pmon->pmon_parity = 0; - pmon->pmon_febe = 0; - pmon->pmon_cpbit = 0; - return 0; -} - -/****************************************************************************** -* sdla_te3_old_set_lb_modes() -* -* Description: -* Arguments: -* Returns: -******************************************************************************/ -static int -sdla_te3_old_set_lb_modes(sdla_fe_t *fe, unsigned char type, unsigned char mode) -{ - - WAN_ASSERT(fe->write_cpld == NULL); - DEBUG_EVENT("%s: %s %s mode...\n", - fe->name, - WAN_TE3_LB_MODE_DECODE(mode), - WAN_TE3_LB_TYPE_DECODE(type)); - - if (mode == WAN_TE3_DEACTIVATE_LB){ - fe->te3_param.cpld_status &= ~BIT_CPLD_STATUS_LLB; - fe->te3_param.cpld_status &= ~BIT_CPLD_STATUS_RLB; - }else{ - switch(type){ - case WAN_TE3_LIU_LB_ANALOG: - fe->te3_param.cpld_status |= BIT_CPLD_STATUS_LLB; - fe->te3_param.cpld_status &= ~BIT_CPLD_STATUS_RLB; - break; - case WAN_TE3_LIU_LB_REMOTE: - fe->te3_param.cpld_status &= ~BIT_CPLD_STATUS_LLB; - fe->te3_param.cpld_status |= BIT_CPLD_STATUS_RLB; - break; - case WAN_TE3_LIU_LB_DIGITAL: - fe->te3_param.cpld_status |= BIT_CPLD_STATUS_LLB; - fe->te3_param.cpld_status |= BIT_CPLD_STATUS_RLB; - break; - default : - DEBUG_EVENT("%s: (T3/E3) Unknown loopback mode!\n", - fe->name); - break; - } - } - /* Write value to CPLD Status/Control register */ - WRITE_CPLD(REG_CPLD_STATUS, fe->te3_param.cpld_status); - return 0; -} - -static int -sdla_te3_set_lb_modes(sdla_fe_t *fe, unsigned char type, unsigned char mode) -{ - unsigned char data = 0x00; - - WAN_ASSERT(fe->write_fe_reg == NULL); - WAN_ASSERT(fe->read_fe_reg == NULL); - DEBUG_EVENT("%s: %s %s mode...\n", - fe->name, - WAN_TE3_LB_MODE_DECODE(mode), - WAN_TE3_LB_TYPE_DECODE(type)); - - data = READ_REG(REG_LINE_INTERFACE_DRIVE); - if (mode == WAN_TE3_DEACTIVATE_LB){ - data &= ~BIT_LINE_INTERFACE_DRIVE_LLOOP; - data &= ~BIT_LINE_INTERFACE_DRIVE_RLOOP; - }else{ - switch(type){ - case WAN_TE3_LIU_LB_NORMAL: - break; - case WAN_TE3_LIU_LB_ANALOG: - data |= BIT_LINE_INTERFACE_DRIVE_LLOOP; - data &= ~BIT_LINE_INTERFACE_DRIVE_RLOOP; - break; - case WAN_TE3_LIU_LB_REMOTE: - data &= ~BIT_LINE_INTERFACE_DRIVE_LLOOP; - data |= BIT_LINE_INTERFACE_DRIVE_RLOOP; - break; - case WAN_TE3_LIU_LB_DIGITAL: - data |= BIT_LINE_INTERFACE_DRIVE_LLOOP; - data |= BIT_LINE_INTERFACE_DRIVE_RLOOP; - break; - default : - DEBUG_EVENT("%s: (T3/E3) Unknown loopback mode!\n", - fe->name); - break; - } - } - WRITE_REG(REG_LINE_INTERFACE_DRIVE, data); - return 0; -} - - -/****************************************************************************** - * sdla_te3_udp() - * - * Description: - * Arguments: - * Returns: - ****************************************************************************** - */ -static int sdla_te3_udp(sdla_fe_t *fe, void *pudp_cmd, unsigned char *data) -{ - sdla_t *card = (sdla_t*)fe->card; - wan_cmd_t *udp_cmd = (wan_cmd_t*)pudp_cmd; - int err = -EINVAL; - - switch(udp_cmd->wan_cmd_command){ - - case WAN_GET_MEDIA_TYPE: - data[0] = fe->fe_cfg.media; - udp_cmd->wan_cmd_return_code = WAN_CMD_OK; - udp_cmd->wan_cmd_data_len = sizeof(unsigned char); - break; - - case WAN_FE_SET_LB_MODE: - /* Activate/Deactivate Line Loopback modes */ - if (card->adptr_subtype == AFT_SUBTYPE_NORMAL){ - err = sdla_te3_old_set_lb_modes(fe, data[0], data[1]); - }else if (card->adptr_subtype == AFT_SUBTYPE_SHARK){ - err = sdla_te3_set_lb_modes(fe, data[0], data[1]); - } - udp_cmd->wan_cmd_return_code = - (!err) ? WAN_CMD_OK : WAN_UDP_FAILED_CMD; - udp_cmd->wan_cmd_data_len = 0x00; - break; - - case WAN_FE_GET_STAT: - /* TE1_56K Read T1/E1/56K alarms */ - sdla_te3_read_pmon(fe, 0); - if (udp_cmd->wan_cmd_fe_force){ - /* force to read FE alarms */ - DEBUG_EVENT("%s: Force to read Front-End alarms\n", - fe->name); - fe->fe_stats.alarms = - sdla_te3_alarm(fe, 1); - } - memcpy(&data[0], &fe->fe_stats, sizeof(sdla_fe_stats_t)); - udp_cmd->wan_cmd_return_code = WAN_CMD_OK; - udp_cmd->wan_cmd_data_len = sizeof(sdla_fe_stats_t); - break; - - case WAN_FE_FLUSH_PMON: - /* TE1 Flush T1/E1 pmon counters */ - sdla_te3_flush_pmon(fe); - udp_cmd->wan_cmd_return_code = WAN_CMD_OK; - break; - - case WAN_FE_GET_CFG: - /* Read T1/E1 configuration */ - memcpy(&data[0], - &fe->fe_cfg, - sizeof(sdla_fe_cfg_t)); - udp_cmd->wan_cmd_return_code = WAN_CMD_OK; - udp_cmd->wan_cmd_data_len = sizeof(sdla_te_cfg_t); - break; - - default: - udp_cmd->wan_cmd_return_code = WAN_UDP_INVALID_CMD; - udp_cmd->wan_cmd_data_len = 0; - break; - } - return 0; -} - - -static int sdla_te3_set_intr(sdla_fe_t *fe) -{ - sdla_fe_cfg_t *fe_cfg = &fe->fe_cfg; - - DEBUG_EVENT("%s: Enabling interrupts for %s (%d)!\n", - fe->name, FE_MEDIA_DECODE(fe), IS_DS3(fe_cfg)); - /* Enable Framer Interrupts */ - /* 1. Block Interrupt Enable */ - WRITE_REG(REG_BLOCK_INT_ENABLE, - BIT_BLOCK_INT_ENABLE_RxDS3_E3 | - BIT_BLOCK_INT_ENABLE_TxDS3_E3); - if (IS_DS3(fe_cfg)){ - /* 1. RxDS3 Interrupt Enable */ - WRITE_REG(REG_RxDS3_INT_ENABLE, - BIT_RxDS3_INT_ENABLE_CPBIT_ERR | - BIT_RxDS3_INT_ENABLE_LOS | - BIT_RxDS3_INT_ENABLE_OOF | - BIT_RxDS3_INT_ENABLE_AIS | - BIT_RxDS3_INT_ENABLE_IDLE | - BIT_RxDS3_INT_ENABLE_FERF | - BIT_RxDS3_INT_ENABLE_AIC | - BIT_RxDS3_INT_ENABLE_PBIT_ERR ); - - /* RxDS3 FEAC */ - WRITE_REG(REG_RxDS3_FEAC_INT, - BIT_RxDS3_FEAC_REMOVE_INT_EN | - BIT_RxDS3_FEAC_VALID_INT_EN); - - /* RxDS3 LAPD */ - WRITE_REG(REG_TxDS3_LAPD_STATUS, - BIT_TxDS3_LAPD_STATUS_INT_EN); - - }else if (IS_E3(fe_cfg)){ - /* RxE3 Interrupt Enable 1 (0x12) */ - WRITE_REG(REG_RxE3_INT_ENABLE_1, - BIT_RxE3_INT_ENABLE_OOF | - BIT_RxE3_INT_ENABLE_LOS | - BIT_RxE3_INT_ENABLE_LOF | - BIT_RxE3_INT_ENABLE_AIS); - - /* RxE3 Interrupt Enable 2 (0x13) */ - WRITE_REG(REG_RxE3_INT_ENABLE_2, - BIT_RxE3_INT_ENABLE_FERF | - BIT_RxE3_INT_ENABLE_FRAMING); - }else{ - return -EINVAL; - } - - return 0; -} - - -/****************************************************************************** - * sdla_te3_liu_config() - * - * Description: Configure Sangoma TE3 board - * Arguments: - * Returns: WAN_TRUE - TE3 configred successfully, otherwise WAN_FALSE. - ****************************************************************************** - */ -static int -sdla_te3_liu_config(sdla_fe_t *fe, sdla_te3_liu_cfg_t *liu, char *name) -{ - sdla_fe_cfg_t *fe_cfg = &fe->fe_cfg; - unsigned char data = 0x00; - - if (fe_cfg->media == WAN_MEDIA_E3){ - data |= BIT_CPLD_CNTRL_E3; - } - if (liu->rx_equal == WAN_TRUE){ - DEBUG_TE3("%s: (T3/E3) Enable Receive Equalizer\n", - name); - data |= BIT_CPLD_CNTRL_REQEN; - }else{ - DEBUG_TE3("%s: (T3/E3) Disable Receive Equalizer\n", - name); - data &= ~BIT_CPLD_CNTRL_REQEN; - } - if (liu->tx_lbo == WAN_TRUE){ - DEBUG_TE3("%s: (T3/E2) Enable Transmit Build-out\n", - name); - data |= BIT_CPLD_CNTRL_TxLEV; - }else{ - DEBUG_TE3("%s: (T3/E3) Disable Transmit Build-out\n", - name); - data &= ~BIT_CPLD_CNTRL_TxLEV; - } - /* Write value to CPLD Control register */ - WRITE_CPLD(REG_CPLD_CNTRL, data); - - data = 0x00; - if (liu->taos == WAN_TRUE){ - DEBUG_TE3("%s: (T3/E3) Enable Transmit All Ones\n", - name); - data |= BIT_CPLD_STATUS_TAOS; - }else{ - DEBUG_TE3("%s: (T3/E3) Disable Transmit All Ones\n", - name); - data &= ~BIT_CPLD_STATUS_TAOS; - } - switch(liu->lb_mode){ - case WAN_TE3_LIU_LB_NORMAL: - break; - case WAN_TE3_LIU_LB_ANALOG: - DEBUG_TE3("%s: (T3/E3) Enable Analog Loopback mode!\n", - name); - data |= BIT_CPLD_STATUS_LLB; - data &= ~BIT_CPLD_STATUS_RLB; - break; - case WAN_TE3_LIU_LB_REMOTE: - DEBUG_TE3("%s: (T3/E3) Enable Remote Loopback mode!\n", - name); - data &= ~BIT_CPLD_STATUS_LLB; - data |= BIT_CPLD_STATUS_RLB; - break; - case WAN_TE3_LIU_LB_DIGITAL: - DEBUG_TE3("%s: (T3/E3) Enable Digital Loopback mode!\n", - name); - data |= BIT_CPLD_STATUS_LLB; - data |= BIT_CPLD_STATUS_RLB; - break; - default : - DEBUG_EVENT("%s: (T3/E3) Unknown loopback mode!\n", - name); - break; - } - /* Write value to CPLD Status/Control register */ - WRITE_CPLD(REG_CPLD_STATUS, data); - return 0; -} - -/****************************************************************************** - * sdla_te3_shark_liu_config() - * - * Description: Configure Sangoma TE3 Shark board - * Arguments: - * Returns: WAN_TRUE - TE3 configred successfully, otherwise WAN_FALSE. - ****************************************************************************** - */ -static int -sdla_te3_shark_liu_config(sdla_fe_t *fe, sdla_te3_liu_cfg_t *liu, char *name) -{ - sdla_fe_cfg_t *fe_cfg = &fe->fe_cfg; - unsigned char data = 0x00; - - if (fe_cfg->media == WAN_MEDIA_E3){ - data |= BIT_EXAR_CPLD_CNTRL_E3; - } - /* Write value to CPLD Control register */ - WRITE_EXAR_CPLD(REG_EXAR_CPLD_CNTRL, data); - - data = 0x00; - if (liu->rx_equal == WAN_TRUE){ - DEBUG_TE3("%s: (T3/E3) Enable Receive Equalizer\n", - name); - data |= BIT_LINE_INTERFACE_DRIVE_REQB; - }else{ - DEBUG_TE3("%s: (T3/E3) Disable Receive Equalizer\n", - name); - data &= ~BIT_LINE_INTERFACE_DRIVE_REQB; - } - if (liu->tx_lbo == WAN_TRUE){ - DEBUG_TE3("%s: (T3/E2) Enable Transmit Build-out\n", - name); - data |= BIT_LINE_INTERFACE_DRIVE_TxLEV; - }else{ - DEBUG_TE3("%s: (T3/E3) Disable Transmit Build-out\n", - name); - data &= ~BIT_LINE_INTERFACE_DRIVE_TxLEV; - } - if (liu->taos == WAN_TRUE){ - DEBUG_TE3("%s: (T3/E3) Enable Transmit All Ones\n", - name); - data |= BIT_LINE_INTERFACE_DRIVE_TAOS; - }else{ - DEBUG_TE3("%s: (T3/E3) Disable Transmit All Ones\n", - name); - data &= ~BIT_LINE_INTERFACE_DRIVE_TAOS; - } - - switch(liu->lb_mode){ - case WAN_TE3_LIU_LB_NORMAL: - break; - case WAN_TE3_LIU_LB_ANALOG: - DEBUG_TE3("%s: (T3/E3) Enable Analog Loopback mode!\n", - name); - data |= BIT_LINE_INTERFACE_DRIVE_LLOOP; - data &= ~BIT_LINE_INTERFACE_DRIVE_RLOOP; - break; - case WAN_TE3_LIU_LB_REMOTE: - DEBUG_TE3("%s: (T3/E3) Enable Remote Loopback mode!\n", - name); - data &= ~BIT_LINE_INTERFACE_DRIVE_LLOOP; - data |= BIT_LINE_INTERFACE_DRIVE_RLOOP; - break; - case WAN_TE3_LIU_LB_DIGITAL: - DEBUG_TE3("%s: (T3/E3) Enable Digital Loopback mode!\n", - name); - data |= BIT_LINE_INTERFACE_DRIVE_LLOOP; - data |= BIT_LINE_INTERFACE_DRIVE_RLOOP; - break; - default : - DEBUG_EVENT("%s: (T3/E3) Unknown loopback mode!\n", - name); - break; - } - WRITE_REG(REG_LINE_INTERFACE_DRIVE, data); - - return 0; -} - - -int sdla_te3_iface_init(void *p_fe_iface) -{ - sdla_fe_iface_t *fe_iface = (sdla_fe_iface_t*)p_fe_iface; - - /* Inialize Front-End interface functions */ - fe_iface->config = &sdla_te3_config; - fe_iface->unconfig = &sdla_te3_unconfig; - fe_iface->polling = &sdla_te3_polling; - fe_iface->isr = &sdla_te3_isr; - fe_iface->process_udp = &sdla_te3_udp; - fe_iface->read_alarm = &sdla_te3_alarm; - fe_iface->read_pmon = &sdla_te3_read_pmon; - fe_iface->set_fe_alarm = &sdla_te3_set_alarm; - fe_iface->get_fe_status = &sdla_te3_get_fe_status; - fe_iface->get_fe_media = &sdla_te3_get_fe_media; - fe_iface->get_fe_media_string = &sdla_te3_get_fe_media_string; - fe_iface->update_alarm_info = &sdla_te3_update_alarm_info; - fe_iface->update_pmon_info = &sdla_te3_update_pmon_info; - - return 0; -} -static int sdla_te3_config(void *p_fe) -{ - sdla_fe_t *fe = (sdla_fe_t*)p_fe; - sdla_t* card = (sdla_t*)fe->card; - sdla_fe_cfg_t *fe_cfg = &fe->fe_cfg; - sdla_te3_cfg_t *te3_cfg = &fe_cfg->cfg.te3_cfg; - u16 adptr_subtype; - unsigned char data = 0x00; - - card->hw_iface.getcfg(card->hw, SDLA_ADAPTERSUBTYPE, &adptr_subtype); - - data = READ_REG(0x02); - - /* configure Line Interface Unit */ - if (card->adptr_subtype == AFT_SUBTYPE_NORMAL){ - sdla_te3_liu_config(fe, &te3_cfg->liu_cfg, fe->name); - }else if (card->adptr_subtype == AFT_SUBTYPE_SHARK){ - sdla_te3_shark_liu_config(fe, &te3_cfg->liu_cfg, fe->name); - }else{ - DEBUG_EVENT("%s: Unknown Adapter Subtype (%X)\n", - fe->name, card->adptr_subtype); - return -EINVAL; - } - - switch(fe_cfg->media){ - case WAN_MEDIA_DS3: - DEBUG_TE3("%s: (T3/E3) Media type DS3\n", - fe->name); - data |= BIT_OPMODE_DS3; - break; - case WAN_MEDIA_E3: - DEBUG_TE3("%s: (T3/E3) Media type E3\n", - fe->name); - data &= ~BIT_OPMODE_DS3; - break; - default: - DEBUG_EVENT("%s: Invalid Media type 0x%X\n", - fe->name,fe_cfg->media); - return -EINVAL; - } - - switch(fe_cfg->frame){ - case WAN_FR_E3_G751: - if (fe_cfg->media != WAN_MEDIA_E3){ - DEBUG_EVENT("%s: (T3/E3) Invalid Frame Format!\n", - fe->name); - return -EINVAL; - } - DEBUG_TE3("%s: (T3/E3) Frame type G.751\n", - fe->name); - data &= ~BIT_OPMODE_FRAME_FRMT; - break; - case WAN_FR_E3_G832: - if (fe_cfg->media != WAN_MEDIA_E3){ - DEBUG_EVENT("%s: (T3/E3) Invalid Frame Format!\n", - fe->name); - return -EINVAL; - } - DEBUG_TE3("%s: (T3/E3) Frame type G.832\n", - fe->name); - data |= BIT_OPMODE_FRAME_FRMT; - break; - case WAN_FR_DS3_Cbit: - if (fe_cfg->media != WAN_MEDIA_DS3){ - DEBUG_EVENT("%s: (T3/E3) Invalid Frame Format!\n", - fe->name); - return -EINVAL; - } - DEBUG_TE3("%s: (T3/E3) Frame type C-bit Parity\n", - fe->name); - data &= ~BIT_OPMODE_FRAME_FRMT; - break; - case WAN_FR_DS3_M13: - if (fe_cfg->media != WAN_MEDIA_DS3){ - DEBUG_EVENT("%s: (T3/E3) Invalid Frame Format!\n", - fe->name); - return -EINVAL; - } - DEBUG_TE3("%s: (T3/E3) Frame type M13\n", - fe->name); - data |= BIT_OPMODE_FRAME_FRMT; - break; - default: - DEBUG_EVENT("%s: Invalid Frame type 0x%X\n", - fe->name,fe_cfg->frame); - return -EINVAL; - } - data |= BIT_OPMODE_INTERNAL_LOS; - data |= (BIT_OPMODE_TIMREFSEL1 | BIT_OPMODE_TIMREFSEL0); - WRITE_REG(REG_OPMODE, data); - - data = 0x00; - switch(fe_cfg->lcode){ - case WAN_LCODE_AMI: - DEBUG_TE3("%s: (T3/E3) Line code AMI\n", - fe->name); - data |= BIT_IO_CONTROL_AMI; - break; - case WAN_LCODE_HDB3: - DEBUG_TE3("%s: (T3/E3) Line code HDB3\n", - fe->name); - data &= ~BIT_IO_CONTROL_AMI; - break; - case WAN_LCODE_B3ZS: - DEBUG_TE3("%s: (T3/E3) Line code B3ZS\n", - fe->name); - data &= ~BIT_IO_CONTROL_AMI; - break; - default: - DEBUG_EVENT("%s: Invalid Lcode 0x%X\n", - fe->name,fe_cfg->lcode); - return -EINVAL; - } - data |= BIT_IO_CONTROL_DISABLE_TXLOC; - data |= BIT_IO_CONTROL_DISABLE_RXLOC; - data |= BIT_IO_CONTROL_RxLINECLK; - WRITE_REG(REG_IO_CONTROL, data); - - /* Initialize Front-End parameters */ - fe->fe_status = FE_DISCONNECTED; - DEBUG_EVENT("%s: %s disconnected!\n", - fe->name, FE_MEDIA_DECODE(fe)); - sdla_te3_alarm(fe, 1); - - sdla_te3_set_intr(fe); - return 0; -} - -static int sdla_te3_unconfig(void *p_fe) -{ - sdla_fe_t *fe = (sdla_fe_t*)p_fe; - DEBUG_EVENT("%s: Unconfiguring T3/E3 interface\n", - fe->name); - return 0; -} - -static int -sdla_te3_update_alarm_info(sdla_fe_t* fe, struct seq_file* m, int* stop_cnt) -{ - if (IS_DS3(&fe->fe_cfg)){ - PROC_ADD_LINE(m, - "=============================== DS3 Alarms ===============================\n"); - PROC_ADD_LINE(m, - PROC_STATS_ALARM_FORMAT, - "AIS", WAN_TE3_AIS_ALARM(fe->fe_alarm), - "LOS", WAN_TE3_LOS_ALARM(fe->fe_alarm)); - PROC_ADD_LINE(m, - PROC_STATS_ALARM_FORMAT, - "OOF", WAN_TE3_OOF_ALARM(fe->fe_alarm), - "YEL", WAN_TE3_YEL_ALARM(fe->fe_alarm)); - }else{ - PROC_ADD_LINE(m, - "=============================== E3 Alarms ===============================\n"); - PROC_ADD_LINE(m, - PROC_STATS_ALARM_FORMAT, - "AIS", WAN_TE3_AIS_ALARM(fe->fe_alarm), - "LOS", WAN_TE3_LOS_ALARM(fe->fe_alarm)); - PROC_ADD_LINE(m, - PROC_STATS_ALARM_FORMAT, - "OFF", WAN_TE3_OOF_ALARM(fe->fe_alarm), - "YEL", WAN_TE3_YEL_ALARM(fe->fe_alarm)); - PROC_ADD_LINE(m, - PROC_STATS_ALARM_FORMAT, - "LOF", WAN_TE3_LOF_ALARM(fe->fe_alarm), - "", ""); - } - - return m->count; -} - -static int sdla_te3_update_pmon_info(sdla_fe_t* fe, struct seq_file* m, int* stop_cnt) -{ - PROC_ADD_LINE(m, - "=========================== %s PMON counters ============================\n", - (IS_DS3(&fe->fe_cfg)) ? "DS3" : "E3"); - PROC_ADD_LINE(m, - PROC_STATS_PMON_FORMAT, - "Line Code Violation", fe->fe_stats.u.te3_pmon.pmon_lcv, - "Framing Bit/Byte Error", fe->fe_stats.u.te3_pmon.pmon_framing); - if (IS_DS3(&fe->fe_cfg)){ - if (fe->fe_cfg.frame == WAN_FR_DS3_Cbit){ - PROC_ADD_LINE(m, - PROC_STATS_PMON_FORMAT, - "Parity Error", fe->fe_stats.u.te3_pmon.pmon_parity, - "CP-Bit Error Event", fe->fe_stats.u.te3_pmon.pmon_cpbit); - }else{ - PROC_ADD_LINE(m, - PROC_STATS_PMON_FORMAT, - "Parity Error", fe->fe_stats.u.te3_pmon.pmon_parity, - "FEBE Event", fe->fe_stats.u.te3_pmon.pmon_febe); - - } - }else{ - PROC_ADD_LINE(m, - PROC_STATS_PMON_FORMAT, - "Parity Error", fe->fe_stats.u.te3_pmon.pmon_parity, - "FEBE Event", fe->fe_stats.u.te3_pmon.pmon_febe); - } - - return m->count; -} diff --git a/patches/kdrivers/src/net/sdla_x25.c b/patches/kdrivers/src/net/sdla_x25.c index b583103..e3b4e32 100644 --- a/patches/kdrivers/src/net/sdla_x25.c +++ b/patches/kdrivers/src/net/sdla_x25.c @@ -343,9 +343,7 @@ typedef struct x25_channel /* FIXME Take this out */ #pragma pack(1) - #ifdef NEX_OLD_CALL_INFO - typedef struct x25_call_info { char dest[17]; ;/* ASCIIZ destination address */ @@ -371,8 +369,9 @@ typedef struct x25_call_info unsigned short lcn ; } x25_call_info_t; #endif - #pragma pack() + + /*=============================================== * Private Function Prototypes @@ -731,7 +730,7 @@ int wpx_init (sdla_t* card, wandev_conf_t* conf) u.cfg.station = 0; /* DCE mode */ } - if (conf->interface != WANOPT_RS232 ){ + if (conf->electrical_interface != WANOPT_RS232 ){ u.cfg.hdlcOptions |= 0x80; /* V35 mode */ } @@ -927,7 +926,7 @@ int wpx_init (sdla_t* card, wandev_conf_t* conf) /* Initialize protocol-specific fields of adapter data space */ card->wandev.bps = conf->bps; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; card->wandev.clocking = conf->clocking; card->wandev.station = conf->u.x25.station; card->isr = &wpx_isr; @@ -1049,7 +1048,7 @@ static int update (wan_device_t* wandev) int err=0; /* sanity checks */ - if ((wandev == NULL) || (wandev->private == NULL)) + if ((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if (wandev->state == WAN_UNCONFIGURED) @@ -1062,7 +1061,7 @@ static int update (wan_device_t* wandev) if (dev == NULL) return -ENODEV; - card = wandev->private; + card = wandev->priv; spin_lock_irqsave(&card->wandev.lock, smp_flags); @@ -1108,7 +1107,7 @@ static int update (wan_device_t* wandev) */ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; x25_channel_t* chan; int err = 0; @@ -1265,7 +1264,7 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) static int del_if (wan_device_t* wandev, netdevice_t* dev) { unsigned long smp_flags; - sdla_t *card=wandev->private; + sdla_t *card=wandev->priv; x25_channel_t* chan = dev->priv; /* Delete interface name from proc fs. */ @@ -1339,7 +1338,8 @@ static int if_init (netdevice_t* dev) /* Initialize device driver entry points */ dev->open = &if_open; dev->stop = &if_close; - + dev->hard_header = NULL; + dev->rebuild_header = NULL; dev->hard_start_xmit = &if_send; dev->get_stats = &if_stats; dev->do_ioctl = &x25_ioctl; @@ -6797,7 +6797,7 @@ static int x25_set_dev_config(struct file *file, if (wandev == NULL) return count; - card = (sdla_t*)wandev->private; + card = (sdla_t*)wandev->priv; printk(KERN_INFO "%s: New device config (%s)\n", wandev->name, buffer); diff --git a/patches/kdrivers/src/net/sdla_xilinx.c b/patches/kdrivers/src/net/sdla_xilinx.c index 2b68335..089146e 100644 --- a/patches/kdrivers/src/net/sdla_xilinx.c +++ b/patches/kdrivers/src/net/sdla_xilinx.c @@ -245,11 +245,11 @@ static int del_if(wan_device_t *wandev, netdevice_t *dev); static int if_init (netdevice_t* dev); static int wanpipe_xilinx_open (netdevice_t* dev); static int wanpipe_xilinx_close (netdevice_t* dev); -static int wanpipe_xilinx_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd); -static struct net_device_stats* wanpipe_xilinx_ifstats (netdevice_t* dev); +static int wanpipe_xilinx_ioctl(netdevice_t*, struct ifreq*, wan_ioctl_cmd_t); #if defined(__LINUX__) static int wanpipe_xilinx_send (netskb_t* skb, netdevice_t* dev); +static struct net_device_stats* wanpipe_xilinx_ifstats (netdevice_t* dev); #else static int wan_aft_output(netdevice_t*, netskb_t*, struct sockaddr*, struct rtentry*); @@ -394,7 +394,6 @@ static int aft_tdmv_free(sdla_t *card); static int aft_tdmv_if_init(sdla_t *card, private_area_t *chan, wanif_conf_t *conf); static int aft_tdmv_if_free(sdla_t *card, private_area_t *chan); static void aft_critical_shutdown (sdla_t *card); -static int digital_loop_test(sdla_t* card,wan_udp_pkt_t* wan_udp_pkt); #ifdef AFT_TDM_API_SUPPORT static int aft_read_rbs_bits(void *chan_ptr, u32 ch, u8 *rbs_bits); @@ -405,6 +404,8 @@ static int aft_tdm_api_update_state_channelized(sdla_t *card, private_area_t *ch static int aft_tdm_api_free_channelized(sdla_t *card, private_area_t *chan); #endif +static void wanpipe_wake_stack(private_area_t* chan); + static void xilinx_delay(int sec) { #if 0 @@ -484,16 +485,12 @@ int wp_xilinx_init (sdla_t* card, wandev_conf_t* conf) return -EINVAL; } -#if defined(WAN_DEBUG_MEM) - DEBUG_EVENT("%s: Total Mem %d\n", - __FUNCTION__,wan_atomic_read(&wan_debug_mem)); -#endif /* Obtain hardware configuration parameters */ card->wandev.clocking = conf->clocking; card->wandev.ignore_front_end_status = conf->ignore_front_end_status; card->wandev.ttl = conf->ttl; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; card->wandev.comm_port = conf->comm_port; card->wandev.udp_port = conf->udp_port; card->wandev.new_if_cnt = 0; @@ -534,11 +531,11 @@ int wp_xilinx_init (sdla_t* card, wandev_conf_t* conf) } memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - sdla_te_iface_init(&card->wandev.fe_iface); + sdla_te_iface_init(&card->fe, &card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; - card->fe.write_fe_reg = write_front_end_reg; - card->fe.read_fe_reg = read_front_end_reg; + card->fe.write_fe_reg = card->hw_iface.fe_write; //write_front_end_reg; + card->fe.read_fe_reg = card->hw_iface.fe_read; //read_front_end_reg; card->wandev.te_report_rbsbits = aft_report_rbsbits; card->wandev.fe_enable_timer = enable_timer; @@ -550,7 +547,7 @@ int wp_xilinx_init (sdla_t* card, wandev_conf_t* conf) card->fe.fe_cfg.cfg.te_cfg.te_ref_clock = WAN_TE1_REFCLK_OSC; } - conf->interface = + conf->electrical_interface = IS_T1_CARD(card) ? WANOPT_V35 : WANOPT_RS232; if (card->wandev.comm_port == WANOPT_PRI){ @@ -739,13 +736,13 @@ int wp_xilinx_init (sdla_t* card, wandev_conf_t* conf) */ static int update (wan_device_t* wandev) { - sdla_t *card = wandev->private; + sdla_t *card = wandev->priv; netdevice_t *dev; volatile private_area_t *chan; wan_smp_flag_t smp_flags; /* sanity checks */ - if((wandev == NULL) || (wandev->private == NULL)) + if((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if(wandev->state == WAN_UNCONFIGURED) @@ -815,7 +812,7 @@ static int aft_tdm_api_init(sdla_t *card, private_area_t *chan, int logic_ch, wa /* Initilaize TDM API Parameters */ wp_tdm_api_dev->chan = chan; wp_tdm_api_dev->card = card; - wan_spin_lock_init(&wp_tdm_api_dev->lock); + wan_spin_lock_init(&wp_tdm_api_dev->lock, "wan_tdmapi_lock"); strncpy(wp_tdm_api_dev->name,chan->if_name,WAN_IFNAME_SZ); if (conf->hdlc_streaming) { @@ -931,6 +928,23 @@ static int aft_tdm_api_free_channelized(sdla_t *card, private_area_t *chan) #endif + + +static void wanpipe_wake_stack(private_area_t* chan) +{ + WAN_NETIF_WAKE_QUEUE(chan->common.dev); +#if !defined(CONFIG_PRODUCT_WANPIPE_GENERIC) + if (chan->common.usedby == API){ +# if defined(__LINUX__) + wan_wakeup_api(chan); +# endif + }else if (chan->common.usedby == STACK){ + wanpipe_lip_kick(chan,0); + } +#endif +} + + /*============================================================================ * new_if - Create new logical channel. * @@ -967,7 +981,7 @@ static int aft_tdm_api_free_channelized(sdla_t *card, private_area_t *chan) */ static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf, int channelized) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; private_area_t* chan; int err = 0; @@ -1481,7 +1495,6 @@ static int new_if_private (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* chan->common.iface.close = &wanpipe_xilinx_close; chan->common.iface.output = &wan_aft_output; chan->common.iface.ioctl = &wanpipe_xilinx_ioctl; - chan->common.iface.get_stats = &wanpipe_xilinx_ifstats; chan->common.iface.tx_timeout= &wanpipe_xilinx_tx_timeout; if (wan_iface.attach){ wan_iface.attach(dev, NULL, chan->common.is_netdev); @@ -1512,7 +1525,7 @@ new_if_error: static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) { int err=-EINVAL; - sdla_t *card=wandev->private; + sdla_t *card=wandev->priv; wan_netif_set_priv(dev, NULL); @@ -1871,6 +1884,8 @@ static int if_init (netdevice_t* dev) } dev->hard_header_len = 0; + dev->hard_header = NULL; + dev->rebuild_header = NULL; /* Enable Mulitcasting if user selected */ if (chan->mc == WANOPT_YES){ @@ -2017,11 +2032,7 @@ static int wanpipe_xilinx_open (netdevice_t* dev) set_chan_state(card, dev, WAN_CONNECTED); WAN_NETIF_WAKE_QUEUE(dev); WAN_NETIF_CARRIER_ON(dev); - if (chan->common.usedby == API){ - wan_wakeup_api(chan); - }else if (chan->common.usedby == STACK){ - wanpipe_lip_kick(chan,0); - } + wanpipe_wake_stack(chan); } wan_spin_unlock_irq(&card->wandev.lock,&flags); @@ -2188,15 +2199,8 @@ static void wanpipe_xilinx_tx_timeout (netdevice_t* dev) xilinx_tx_fifo_under_recover(card,chan); - WAN_NETIF_WAKE_QUEUE(dev); /*netif_wake_queue (dev);*/ + wanpipe_wake_stack(chan); - if (chan->common.usedby == API){ -# if defined(__LINUX__) - wan_wakeup_api(chan); -# endif - }else if (chan->common.usedby == STACK){ - wanpipe_lip_kick(chan,0); - } } @@ -2334,8 +2338,13 @@ static int wanpipe_xilinx_send (netskb_t* skb, netdevice_t* dev) goto xilinx_tx_dma; } else if (wan_skb_queue_len(&chan->wp_tx_pending_list) > chan->max_tx_bufs){ - WAN_NETIF_STOP_QUEUE(dev); /*stop_net_queue(dev);*/ - xilinx_dma_tx(card,chan); + wan_smp_flag_t smp_flags; + wan_spin_lock_irq(&card->wandev.lock, &smp_flags); + WAN_NETIF_STOP_QUEUE(dev); /*stop_net_queue(dev);*/ + wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + if (chan->hdlc_eng) { + xilinx_dma_tx(card,chan); + } return 1; }else{ xilinx_tx_dma: @@ -2364,7 +2373,9 @@ xilinx_tx_dma: } wan_skb_queue_tail(&chan->wp_tx_pending_list,skb); - xilinx_dma_tx(card,chan); + if (chan->hdlc_eng) { + xilinx_dma_tx(card,chan); + } wan_netif_set_ticks(dev, SYSTEM_TICKS); } } @@ -2394,6 +2405,7 @@ if_send_exit_crit: } +#if defined(__LINUX__) /*============================================================================ * if_stats * @@ -2416,9 +2428,7 @@ static struct net_device_stats* wanpipe_xilinx_ifstats (netdevice_t* dev) return &chan->if_stats; } - - - +#endif /*======================================================================== * @@ -2440,7 +2450,7 @@ static struct net_device_stats* wanpipe_xilinx_ifstats (netdevice_t* dev) * */ static int -wanpipe_xilinx_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) +wanpipe_xilinx_ioctl(netdevice_t *dev, struct ifreq *ifr, wan_ioctl_cmd_t cmd) { private_area_t* chan; sdla_t *card; @@ -3942,16 +3952,7 @@ tx_post_ok: tx_post_exit: if (WAN_NETIF_QUEUE_STOPPED(chan->common.dev)){ - WAN_NETIF_WAKE_QUEUE(chan->common.dev); -#if !defined(CONFIG_PRODUCT_WANPIPE_GENERIC) - if (chan->common.usedby == API){ -# if defined(__LINUX__) - wan_wakeup_api(chan); -# endif - }else if (chan->common.usedby == STACK){ - wanpipe_lip_kick(chan,0); - } -#endif + wanpipe_wake_stack(chan); } #ifdef AFT_TDM_API_SUPPORT @@ -4439,10 +4440,13 @@ static void enable_timer (void* card_id) WAN_TASKQ_SCHEDULE((&card->u.aft.port_task)); #else wan_smp_flag_t smp_flags; - int err = 0; + int delay = 0; wan_spin_lock_irq(&card->wandev.lock, &smp_flags); - err = card->wandev.fe_iface.polling(&card->fe); + delay = card->wandev.fe_iface.polling(&card->fe); wan_spin_unlock_irq(&card->wandev.lock, &smp_flags); + if (delay){ + card->wandev.fe_iface.add_timer(&card->fe, delay); + } #endif DEBUG_TEST("%s: %s Sdla Polling End!\n", @@ -4545,7 +4549,9 @@ static void wp_bh(void *data, int pending) continue; } new_skb->protocol = htons(PVC_PROT); + wan_skb_reset_mac_header(new_skb); + new_skb->dev = chan->common.dev; new_skb->pkt_type = WAN_PACKET_DATA; @@ -4671,7 +4677,7 @@ static void wp_bh(void *data, int pending) chan->if_stats.rx_bytes+=len; } - while((skb=wan_skb_dequeue(&chan->wp_tx_complete_list)) != NULL){ + while(chan->hdlc_eng && (skb=wan_skb_dequeue(&chan->wp_tx_complete_list)) != NULL){ xilinx_tx_post_complete (chan->common.card,chan,skb); wan_skb_free(skb); } @@ -5146,10 +5152,11 @@ static int process_udp_mgmt_pkt(sdla_t* card, netdevice_t* dev, break; case DIGITAL_LOOPTEST: - wan_udp_pkt->wan_udp_return_code = - digital_loop_test(card,wan_udp_pkt); + wan_udp_pkt->wan_udp_return_code = 0; + DEBUG_EVENT("Ready to send some data!!!\n"); break; + case AFT_MODEM_STATUS: wan_udp_pkt->wan_udp_return_code = 0; if (card->wandev.state == WAN_CONNECTED){ @@ -6115,7 +6122,7 @@ static int update_comms_stats(sdla_t* card) if (IS_TE1_CARD(card)) { wan_smp_flag_t smp_flags; card->hw_iface.hw_lock(card->hw,&smp_flags); - card->wandev.fe_iface.read_alarm(&card->fe, 0); + card->wandev.fe_iface.read_alarm(&card->fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE); /* TE1 Update T1/E1 perfomance counters */ card->wandev.fe_iface.read_pmon(&card->fe, 0); card->hw_iface.hw_unlock(card->hw,&smp_flags); @@ -6193,20 +6200,18 @@ static void xilinx_tx_fifo_under_recover (sdla_t *card, private_area_t *chan) if (chan->tx_dma_skb){ wan_skb_queue_head(&chan->wp_tx_pending_list, chan->tx_dma_skb); chan->tx_dma_skb=NULL; + if (chan->lip_atm) { + netskb_t *tmpskb = chan->tx_dma_skb; + chan->tx_dma_skb=NULL; + wan_skb_free(tmpskb); + } else { + wan_skb_queue_head(&chan->wp_tx_pending_list, chan->tx_dma_skb); + chan->tx_dma_skb=NULL; + } } - /* Wake up the stack, because tx dma interrupt - * failed */ -#if defined(__LINUX__) - if (WAN_NETIF_QUEUE_STOPPED(chan->common.dev)){ - WAN_NETIF_WAKE_QUEUE(chan->common.dev); - if (chan->common.usedby == API){ -#ifndef CONFIG_PRODUCT_WANPIPE_GENERIC - wan_wakeup_api(chan); -#endif - } - } -#endif + /* Wake up the stack, because tx dma interrupt failed */ + wanpipe_wake_stack(chan); if (!chan->hdlc_eng){ if (wan_test_bit(0,&chan->idle_start)){ @@ -6227,9 +6232,9 @@ static void xilinx_tx_fifo_under_recover (sdla_t *card, private_area_t *chan) static int xilinx_write_ctrl_hdlc(sdla_t *card, u32 timeslot, u8 reg_off, u32 data) { - u32 reg; - u32 ts_orig=timeslot; - unsigned long timeout=SYSTEM_TICKS; + u32 reg; + u32 ts_orig=timeslot; + wan_ticks_t timeout=SYSTEM_TICKS; if (timeslot == 0){ timeslot=card->u.aft.num_of_time_slots-2; @@ -6311,7 +6316,6 @@ static int set_chan_state(sdla_t* card, netdevice_t* dev, int state) wan_update_api_state(chan); } #endif - if (chan->common.usedby == STACK){ if (state == WAN_CONNECTED){ wanpipe_lip_connect(chan,0); @@ -6664,7 +6668,7 @@ void protocol_recv(sdla_t *card, private_area_t *chan, netskb_t *skb) if (chan->common.protocol == WANCONFIG_GENERIC){ skb->protocol = htons(ETH_P_HDLC); skb->dev = chan->common.dev; - wan_skb_reset_mac_header(skb); + wan_skb_reset_mac_header(skb); netif_rx(skb); return 0; } @@ -6673,7 +6677,7 @@ void protocol_recv(sdla_t *card, private_area_t *chan, netskb_t *skb) #if defined(__LINUX__) skb->protocol = htons(ETH_P_IP); skb->dev = chan->common.dev; - wan_skb_reset_mac_header(skb); + wan_skb_reset_mac_header(skb); netif_rx(skb); #else if (wan_iface.input){ @@ -6783,6 +6787,7 @@ This conversion is done in te1 sources. skb->pkt_type = WAN_PACKET_ERR; skb->protocol=htons(PVC_PROT); skb->dev=chan->common.dev; + DEBUG_TEST("%s: Sending OOB message len=%i\n", chan->if_name, wan_skb_len(skb)); @@ -7047,11 +7052,15 @@ static void aft_port_task (struct work_struct *work) static void aft_port_task (void * card_ptr, int arg) #endif { -#if defined(__LINUX__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) +#if defined(__LINUX__) +# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)) sdla_t *card = (sdla_t *)container_of(work, sdla_t, u.aft.port_task); +# else + sdla_t *card = (sdla_t *)card_ptr; +# endif #else sdla_t *card = (sdla_t *)card_ptr; -#endif +#endif wan_smp_flag_t smp_flags; if (wan_test_bit(CARD_DOWN,&card->wandev.critical)){ @@ -7076,10 +7085,12 @@ static void aft_port_task (void * card_ptr, int arg) aft_fe_intr_ctrl(card, 0); if (card->wandev.fe_iface.polling){ wan_smp_flag_t smp_flags; - int err = 0; - - err = card->wandev.fe_iface.polling(&card->fe); + int delay = 0; + delay = card->wandev.fe_iface.polling(&card->fe); + if (delay){ + card->wandev.fe_iface.add_timer(&card->fe, delay); + } wan_spin_lock_irq(&card->wandev.lock,&smp_flags); handle_front_end_state(card); wan_spin_unlock_irq(&card->wandev.lock,&smp_flags); @@ -7577,75 +7588,5 @@ static void aft_critical_shutdown (sdla_t *card) -static int digital_loop_test(sdla_t* card,wan_udp_pkt_t* wan_udp_pkt) -{ - netskb_t* skb; - netdevice_t* dev; - char* buf; - private_area_t *chan; - - dev = WAN_DEVLE2DEV(WAN_LIST_FIRST(&card->wandev.dev_head)); - if (dev == NULL) { - return 1; - } - chan = wan_netif_priv(dev); - if (chan == NULL) { - return 1; - } - - if (chan->common.state != WAN_CONNECTED) { - DEBUG_EVENT("%s: Loop test failed: dev not connected!\n", - card->devname); - return 2; - } - - skb = wan_skb_alloc(wan_udp_pkt->wan_udp_data_len+100); - if (skb == NULL) { - return 3; - } - - switch (chan->common.usedby) { - - case API: - wan_skb_push(skb, sizeof(api_rx_hdr_t)); - break; - - case STACK: - case WANPIPE: - break; - - case TDM_VOICE: - case TDM_VOICE_API: - case TDM_VOICE_DCHAN: - if (card->u.aft.tdmv_dchan) { - break; - } else { - DEBUG_EVENT("%s: Loop test failed: no dchan in TDMV mode!\n", - card->devname); - } - /* Fall into the default case */ - - default: - DEBUG_EVENT("%s: Loop test failed: invalid operation mode!\n", - card->devname); - wan_skb_free(skb); - return 4; - } - - buf = wan_skb_put(skb, wan_udp_pkt->wan_udp_data_len); - memcpy(buf, wan_udp_pkt->wan_udp_data, wan_udp_pkt->wan_udp_data_len); - - - skb->next = skb->prev = NULL; - skb->dev = dev; - skb->protocol = htons(ETH_P_IP); - wan_skb_reset_mac_header(skb); - dev_queue_xmit(skb); - - return 0; -} - - - /****** End ****************************************************************/ diff --git a/patches/kdrivers/src/net/sdladrv.c b/patches/kdrivers/src/net/sdladrv.c index 3bb30e0..1707e42 100644 --- a/patches/kdrivers/src/net/sdladrv.c +++ b/patches/kdrivers/src/net/sdladrv.c @@ -4,7 +4,7 @@ * This module is a library of common hardware-specific functions * used by all Sangoma drivers. * -* Author: Alex Feldman, Nenad Corbic, Gideon Hack +* Authors: Alex Feldman, Nenad Corbic, Gideon Hack, David Rokhvarg * * Copyright: (c) 1995-2003 Sangoma Technologies Inc. * @@ -13,6 +13,9 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * ============================================================================ +* Jan 14, 2008 Alex Feldman Add AUTO PCI probe for FreeBSD +* Support FreeBSD-7 +* Jul 06, 2007 David Rokhvarg Added detection of A500 - ISDN BRI modules. * Apr 04, 2007 Alex Feldman Add support T3/E3 SHART cards * Mar 04, 2007 Alex Feldman Add support ISDN/BRI cards * Dec 15. 2003 Nenad Corbic Redesigned hw abstraction layer to @@ -112,7 +115,6 @@ # undef WANDEBUG /* Uncomment this line for debug purpose */ #endif - /*************************************************************************** **** I N C L U D E F I L E S **** ***************************************************************************/ @@ -125,7 +127,17 @@ # include # include # include +# if defined(SDLA_AUTO_PROBE) +# include +# endif # include +#elif defined(__WINDOWS__) +# include +# include +# include /* SDLA firmware module definitions */ +# include /* SDLA PCI hardware definitions */ +# include +# include /* API definitions */ #elif defined(__LINUX__)||defined(__KERNEL__) # define _K22X_MODULE_FIX_ # include @@ -141,15 +153,20 @@ # error "Unsupported Operating System!" #endif +#if !defined(__WINDOWS__) #if 1 #define AFT_FUNC_DEBUG() #else #define AFT_FUNC_DEBUG() DEBUG_EVENT("%s:%d\n",__FUNCTION__,__LINE__) #endif +#endif /*************************************************************************** **** M A C R O S / D E F I N E S **** ***************************************************************************/ +#define SDLA_HWPROBE_NAME "sdladrv" +#define SDLA_HWEC_NAME "wanec" + #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) # define EXPORT_SYMBOL(symbol) #endif @@ -164,9 +181,10 @@ * EXEC_TIMEOUT=EXEC_DELAY*2000 = 40000 * 40000 ~= 80 jiffies = EXEC_TIMEOUT */ -#define EXEC_HZ_DIVISOR 8/10 /* We don't want to wait a full second on sdla_exec - * timeout, thus use HZ * EXEC_HZ_DIVISOR to get - * the number of jiffies we would like to wait */ +#define EXEC_HZ_DIVISOR 8/10 /* We don't want to wait a full second on + * sdla_exec timeout, thus use + * HZ * EXEC_HZ_DIVISOR to get the number of + * jiffies we would like to wait */ /* I/O port address range */ @@ -202,8 +220,6 @@ #define SDLA_PCI_CARD 1 #define SDLA_PCI_EXP_CARD 2 -#define SDLA_MAGIC(hw) WAN_ASSERT(hw->magic != SDLADRV_MAGIC) - /****** Function Prototypes *************************************************/ /* Hardware-specific functions */ @@ -221,7 +237,10 @@ static int sdla_intr (sdlahw_t* hw); #endif static int sdla_mapmem (void* phw, unsigned long addr); static int sdla_check_mismatch(void* phw, unsigned char media); + static int sdla_getcfg(void* phw, int type, void*); +static int sdla_setcfg(void* phw, int type, void* value); + #if defined(WAN_ISA_SUPPORT) static int sdla_isa_read_1(void* phw, unsigned int offset, u8*); static int sdla_isa_write_1(void* phw, unsigned int offset, u8); @@ -241,8 +260,10 @@ static int sdla_pci_read_config_byte(void*, int, u8*); static int sdla_pci_read_config_word(void*, int, u16*); static int sdla_pci_read_config_dword(void*, int, u32*); -static int sdla_pci_bridge_write_config_dword(void*, int, u32); -static int sdla_pci_bridge_read_config_dword(void*, int, u32*); +int sdla_pci_bridge_write_config_dword(void*, int, u_int32_t); +static int sdla_pci_bridge_write_config_byte(void*, int, u_int8_t); +int sdla_pci_bridge_read_config_dword(void*, int, u_int32_t*); +static int sdla_pci_bridge_read_config_byte(void*, int, u_int8_t*); static int sdla_cmd (void* phw, unsigned long offset, wan_mbox_t* mbox); @@ -265,12 +286,8 @@ static int sdla_memory_map(sdlahw_t* hw, int cpu_no); static int sdla_memory_unmap(sdlahw_t* hw); static int sdla_detect (sdlahw_t* hw); -static int sdla_autodpm (sdlahw_t* hw); -static int sdla_setdpm (sdlahw_t* hw); static int sdla_start(sdlahw_t* hw, unsigned addr); /*ALEXstatic int sdla_load (sdlahw_t* hw, sfm_t* sfm, unsigned len);*/ -static int sdla_init (sdlahw_t* hw); -static unsigned long sdla_memtest (sdlahw_t* hw); static int sdla_bootcfg (sdlahw_t* hw, sfm_info_t* sfminfo); static unsigned char sdla_make_config_byte (sdlahw_t* hw); @@ -285,6 +302,13 @@ static int sdla_detect_s502e (sdlahw_t* hw); static int sdla_detect_s503 (sdlahw_t* hw); static int sdla_detect_s507 (sdlahw_t* hw); static int sdla_detect_s508 (sdlahw_t* hw); + +static int sdla_autodpm (sdlahw_t* hw); +static int sdla_setdpm (sdlahw_t* hw); +static int sdla_init (sdlahw_t* hw); +static unsigned long sdla_memtest (sdlahw_t* hw); +static unsigned sdla_check_memregion (sdlahw_t* hw); +static int sdla_get_option_index (unsigned* optlist, unsigned optval); #endif static int sdla_detect_s514 (sdlahw_t* hw); @@ -297,8 +321,6 @@ static int sdla_is_56k(void* phw); static sdlahw_t* sdla_find_adapter(wandev_conf_t* conf, char* devname); /* Miscellaneous functions */ -static int sdla_get_option_index (unsigned* optlist, unsigned optval); -static unsigned sdla_check_memregion (sdlahw_t* hw); static unsigned sdla_test_memregion (sdlahw_t* hw, unsigned len); static unsigned short sdla_checksum (unsigned char* buf, unsigned len); static int sdla_init_pci_slot(sdlahw_t *); @@ -307,27 +329,58 @@ static int sdla_init_pci_slot(sdlahw_t *); static sdlahw_card_t* sdla_card_register(unsigned char hw_type, int slot_no, int bus_no, int ioport); static int sdla_card_unregister (unsigned char hw_type, int slot_no, int bus_no, int ioport); static sdlahw_card_t* sdla_card_search(unsigned char hw_type, int slot_no, int bus_no, int ioport); +static int sdla_card_info(sdlahw_card_t*); -static sdlahw_t* sdla_hw_register(sdlahw_card_t* card, int cpu_no, int irq, void*); -static int sdla_hw_unregister(sdlahw_card_t* card, int cpu_no); -static sdlahw_t* sdla_hw_search(unsigned char hw_type, int slot_no, int bus_no, int ioport, int cpu_no); +static sdlahw_cpu_t* sdla_hwcpu_register(sdlahw_card_t* card, int cpu_no, int irq, void*); +static int sdla_hwcpu_unregister(sdlahw_cpu_t*); +static sdlahw_cpu_t* sdla_hwcpu_search(unsigned char hw_type, int slot_no, int bus_no, int ioport, int cpu_no); +static int sdla_hwcpu_info(sdlahw_cpu_t*); -static int sdla_s514_hw_select (sdlahw_card_t* card, int cpu_no, int irq, void*); -static int sdla_adsl_hw_select (sdlahw_card_t* card, int cpu_no, int irq, void*); -static int sdla_aft_hw_select (sdlahw_card_t* card, int cpu_no, int irq, void*); -static void sdla_save_hw_probe (sdlahw_t* hw, int port); -static int sdla_save_Remora_hw_probe_verbose(sdlahw_t* hw, int port); +static sdlahw_t* sdla_hw_register(sdlahw_cpu_t* hwcpu, int port_no); +static int sdla_hw_unregister(sdlahw_t*); +static sdlahw_t* sdla_hw_search(sdlahw_cpu_t* hwcpu, int port_no); +static int sdla_hw_info(sdlahw_t*); + +static int sdla_hwport_unregister(sdlahw_cpu_t*); +static sdlahw_t* sdla_hwport_register(sdlahw_cpu_t* hwcpu, int); +static sdlahw_t* sdla_hwport_te1_register(sdlahw_cpu_t*, int); +static sdlahw_t* sdla_hwport_Remora_register(sdlahw_cpu_t*, int*); +static sdlahw_t* sdla_hwport_ISDN_register(sdlahw_cpu_t*, int*); + +static int sdla_s514_hw_select (sdlahw_card_t*, int, int, void*); +static int sdla_adsl_hw_select (sdlahw_card_t*, int, int, void*); +static int sdla_aft_hw_select (sdlahw_card_t*, int, int, void*); +static void sdla_save_hw_probe (sdlahw_t* hw); static int sdla_hw_lock(void *phw, wan_smp_flag_t *flag); static int sdla_hw_unlock(void *phw, wan_smp_flag_t *flag); +static int sdla_hw_ec_trylock(void *phw, wan_smp_flag_t *flag); static int sdla_hw_ec_lock(void *phw, wan_smp_flag_t *flag); static int sdla_hw_ec_unlock(void *phw, wan_smp_flag_t *flag); +static wan_dma_descr_t *sdla_busdma_descr_alloc(void *phw, int num); +static void sdla_busdma_descr_free(void *phw, wan_dma_descr_t *dma_descr); +#if defined(__FreeBSD__) +static void sdla_busdma_callback(void *arg, bus_dma_segment_t *seg, int nseg, int error); +#endif +static int sdla_busdma_tag_create(void *phw, wan_dma_descr_t*, u32, u32,int); +static int sdla_busdma_tag_destroy(void *phw, wan_dma_descr_t*, int); +static int sdla_busdma_create(void *phw, wan_dma_descr_t*); +static int sdla_busdma_destroy(void *phw, wan_dma_descr_t*); +static int sdla_busdma_alloc(void *phw, wan_dma_descr_t*); +static void sdla_busdma_free(void *phw, wan_dma_descr_t*); +static int sdla_busdma_load(void *phw, wan_dma_descr_t*, u32); +static void sdla_busdma_unload(void *phw, wan_dma_descr_t*); +static void sdla_busdma_map(void *phw, wan_dma_descr_t*, void *buf, int len, int map_len, int dir); +static void sdla_busdma_unmap(void *phw, wan_dma_descr_t*, int dir); +static void sdla_busdma_sync(void *phw, wan_dma_descr_t*, int ndescr, int single, int dir); + static sdla_dma_addr_t sdla_pci_map_dma(void *phw, void *buf, int len, int ctrl); static int sdla_pci_unmap_dma(void *phw, sdla_dma_addr_t buf, int len, int ctrl); static int sdla_is_same_hwcard(void* phw1, void *phw2); +static int sdla_is_same_hwcpu(void* phw1, void *phw2); int sdla_hw_fe_test_and_set_bit(void *phw,int value); int sdla_hw_fe_test_bit(void *phw,int value); int sdla_hw_fe_set_bit(void *phw,int value); @@ -340,21 +393,38 @@ extern int sdla_te1_write_fe(void* phw, ...); extern u_int8_t sdla_te1_read_fe (void* phw, ...); extern int sdla_shark_te1_write_fe(void *phw, ...); +extern u_int8_t __sdla_shark_te1_read_fe (void *phw, ...); extern u_int8_t sdla_shark_te1_read_fe (void *phw, ...); extern int sdla_shark_rm_write_fe (void* phw, ...); +extern u_int8_t __sdla_shark_rm_read_fe (void* phw, ...); extern u_int8_t sdla_shark_rm_read_fe (void* phw, ...); +extern int sdla_shark_bri_write_fe (void* phw, ...); +extern u_int8_t sdla_shark_bri_read_fe (void* phw, ...); +static int sdla_scan_isdn_bri_modules(sdlahw_t* hw, int *rm_mod_type, u_int8_t rm_no); + extern int sdla_shark_56k_write_fe(void *phw, ...); +extern u_int8_t __sdla_shark_56k_read_fe (void *phw, ...); extern u_int8_t sdla_shark_56k_read_fe (void *phw, ...); +extern int sdla_shark_serial_write_fe (void* phw, ...); +extern u_int8_t sdla_shark_serial_read_fe (void* phw, ...); + +extern int sdla_te3_write_fe(void *phw, ...); +extern u_int8_t sdla_te3_read_fe(void *phw, ...); + +extern int sdla_plxctrl_read8(void *phw, short, unsigned char*); +extern int sdla_plxctrl_write8(void *phw, short, unsigned char); + #if defined(__LINUX__) -#if defined(WAN_DEBUG_MEM) - atomic_t wan_debug_mem; - EXPORT_SYMBOL(wan_debug_mem); -#endif + static int sdla_pci_probe(sdlahw_t*); #endif + +static int sdla_is_pciexpress(void *phw); +static int sdla_get_hwec_index(void *phw); + /****** Global Data ********************************************************** * Note: All data must be explicitly initialized!!! */ @@ -370,8 +440,10 @@ extern int Sangoma_cards_no; /* total number of SDLA cards */ extern int Sangoma_devices_no; /* Max number of Sangoma dev */ extern int Sangoma_PCI_cards_no; /* total number of S514 cards */ -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#if !defined(SDLA_AUTO_PROBE) +# if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) extern sdladev_t sdladev[]; /* SDLA info structure */ +# endif #endif /* private data */ @@ -386,18 +458,29 @@ static char *wan_fullname = "WANPIPE(tm) Hardware Support Module"; /* Array of already initialized PCI slots */ static int pci_slot_ar[MAX_S514_CARDS]; -WAN_LIST_HEAD(, sdlahw_card) sdlahw_card_head = +WAN_LIST_HEAD(NAME_PLACEHOLDER, sdlahw_card) sdlahw_card_head = WAN_LIST_HEAD_INITIALIZER(&sdlahw_card_head); -WAN_LIST_HEAD(, sdlahw) sdlahw_head = +WAN_LIST_HEAD(NAME_PLACEHOLDER1, sdlahw_cpu) sdlahw_cpu_head = + WAN_LIST_HEAD_INITIALIZER(&sdlahw_cpu_head); +WAN_LIST_HEAD(NAME_PLACEHOLDER2, sdlahw_port) sdlahw_head = WAN_LIST_HEAD_INITIALIZER(&sdlahw_head); -WAN_LIST_HEAD(, sdla_hw_probe) sdlahw_probe_head = +WAN_LIST_HEAD(NAME_PLACEHOLDER3, sdla_hw_probe) sdlahw_probe_head = WAN_LIST_HEAD_INITIALIZER(&sdlahw_probe_head); -static sdla_hw_type_cnt_t sdla_adapter_cnt; -#if defined(__LINUX__) + +static sdla_hw_type_cnt_t sdla_adapter_cnt; +static int sdla_hwec_no = 0; + +#if defined(__LINUX__) || defined(__WINDOWS__) static unsigned long EXEC_TIMEOUT; #endif +#if defined(__WINDOWS__) +extern int get_usage_counter(sdla_t *card); +extern wan_spinlock_t* get_card_spin_lock(sdla_t *card); +extern u32 get_card_serial_number(sdla_t *card); +#endif + /* Hardware configuration options. * These are arrays of configuration options used by verification routines. * The first element of each array is its size (i.e. number of options). @@ -492,22 +575,167 @@ static unsigned char s507_irqmask[] = /* Entry Point for Low-Level function */ int sdladrv_init(void*); int sdladrv_exit(void*); +#if 0 +int sdladrv_shutdown(void*); +int sdladrv_ready_unload(void*); +#endif /*****************************************************************************/ /* Loadable kernel module function interface */ -#if !defined(CONFIG_PRODUCT_WANPIPE_GENERIC) +#if !defined(CONFIG_PRODUCT_WANPIPE_GENERIC) && !defined(__WINDOWS__) # if !defined(__OpenBSD__) && !defined(__NetBSD__) WAN_MODULE_DEFINE( sdladrv, "sdladrv", "Alex Feldman ", "Sangoma WANPIPE: HW Layer", "GPL", - sdladrv_init, sdladrv_exit, NULL); + sdladrv_init, sdladrv_exit, + NULL); WAN_MODULE_VERSION(sdladrv, SDLADRV_MAJOR_VER); # endif #endif +/*****************************************************************************/ +/* Memory Debug Code +*/ + +# if defined(WAN_DEBUG_MEM) + +static int wan_debug_mem; + +wan_spinlock_t wan_debug_mem_lock; +EXPORT_SYMBOL(wan_debug_mem_lock); + +WAN_LIST_HEAD(NAME_PLACEHOLDER_MEM, sdla_memdbg_el) sdla_memdbg_head = + WAN_LIST_HEAD_INITIALIZER(&sdla_memdbg_head); + +typedef struct sdla_memdbg_el +{ + unsigned int len; + unsigned int line; + char cmd_func[128]; + void *mem; + WAN_LIST_ENTRY(sdla_memdbg_el) next; +}sdla_memdbg_el_t; + +int sdla_memdbg_init(void) +{ + wan_spin_lock_init(&wan_debug_mem_lock,"wan_debug_mem_lock"); + WAN_LIST_INIT(&sdla_memdbg_head); + return 0; +} + + +int sdla_memdbg_push(void *mem, char *func_name, int line, int len) +{ + sdla_memdbg_el_t *sdla_mem_el; + wan_smp_flag_t flags; + + sdla_mem_el = kmalloc(sizeof(sdla_memdbg_el_t),GFP_ATOMIC); + if (!sdla_mem_el) { + DEBUG_EVENT("%s:%d Critical failed to allocate memory!\n", + __FUNCTION__,__LINE__); + return -ENOMEM; + } + + memset(sdla_mem_el,0,sizeof(sdla_memdbg_el_t)); + + sdla_mem_el->len=len; + sdla_mem_el->line=line; + sdla_mem_el->mem=mem; + strncpy(sdla_mem_el->cmd_func,func_name,sizeof(sdla_mem_el->cmd_func)-1); + + + wan_spin_lock_irq(&wan_debug_mem_lock,&flags); + wan_debug_mem+=sdla_mem_el->len; + WAN_LIST_INSERT_HEAD(&sdla_memdbg_head, sdla_mem_el, next); + wan_spin_unlock_irq(&wan_debug_mem_lock,&flags); + + DEBUG_EVENT("%s:%d: Alloc %p Len=%i Total=%i\n", + sdla_mem_el->cmd_func,sdla_mem_el->line, + sdla_mem_el->mem, sdla_mem_el->len,wan_debug_mem); + + return 0; + +} +EXPORT_SYMBOL(sdla_memdbg_push); + +int sdla_memdbg_pull(void *mem, char *func_name, int line) +{ + sdla_memdbg_el_t *sdla_mem_el; + wan_smp_flag_t flags; + int err=-1; + + wan_spin_lock_irq(&wan_debug_mem_lock,&flags); + + WAN_LIST_FOREACH(sdla_mem_el, &sdla_memdbg_head, next){ + if (sdla_mem_el->mem == mem) { + break; + } + } + + if (sdla_mem_el) { + + WAN_LIST_REMOVE(sdla_mem_el, next); + wan_debug_mem-=sdla_mem_el->len; + wan_spin_unlock_irq(&wan_debug_mem_lock,&flags); + + DEBUG_EVENT("%s:%d: DeAlloc %p Len=%i Total=%i (From %s:%d)\n", + func_name,line, + sdla_mem_el->mem, sdla_mem_el->len, wan_debug_mem, + sdla_mem_el->cmd_func,sdla_mem_el->line); + + kfree(sdla_mem_el); + err=0; + } else { + wan_spin_unlock_irq(&wan_debug_mem_lock,&flags); + } + + if (err) { + DEBUG_EVENT("%s:%d: Critical Error: Unknows Memeory %p\n", + __FUNCTION__,__LINE__,mem); + } + + return err; +} +EXPORT_SYMBOL(sdla_memdbg_pull); + +int sdla_memdbg_free(void) +{ + sdla_memdbg_el_t *sdla_mem_el; + int total=0; + + DEBUG_EVENT("sdladrv: Memory Still Allocated=%i \n", + wan_debug_mem); + + DEBUG_EVENT("=====================BEGIN================================\n"); + + sdla_mem_el = WAN_LIST_FIRST(&sdla_memdbg_head); + while(sdla_mem_el){ + sdla_memdbg_el_t *tmp = sdla_mem_el; + + DEBUG_EVENT("%s:%d: Mem Leak %p Len=%i \n", + sdla_mem_el->cmd_func,sdla_mem_el->line, + sdla_mem_el->mem, sdla_mem_el->len); + total+=sdla_mem_el->len; + + sdla_mem_el = WAN_LIST_NEXT(sdla_mem_el, next); + WAN_LIST_REMOVE(tmp, next); + kfree(tmp); + } + + DEBUG_EVENT("=====================END==================================\n"); + DEBUG_EVENT("sdladrv: Memory Still Allocated=%i Leaks Found=%i Missing=%i\n", + wan_debug_mem,total,wan_debug_mem-total); + + return 0; +} + +# endif + + + /*============================================================================ * Module init point. */ @@ -536,9 +764,27 @@ int sdladrv_init(void* arg) memset(&sdla_adapter_cnt,0,sizeof(sdla_hw_type_cnt_t)); +#ifdef WAN_DEBUG_MEM + sdla_memdbg_init(); +#endif + return 0; } +#if 0 +int sdladrv_shutdown(void *arg) +{ + DEBUG_EVENT("Shutting down SDLADRV module ...\n"); + return 0; +} + +int sdladrv_ready_unload(void *arg) +{ + DEBUG_EVENT("Is SDLADRV module ready to unload...\n"); + return 0; +} +#endif + /*============================================================================ * Module deinit point. * o release all remaining system resources @@ -546,24 +792,29 @@ int sdladrv_init(void* arg) int sdladrv_exit (void *arg) { sdla_hw_probe_t *elm_hw_probe; - sdlahw_t *elm_hw; + sdlahw_cpu_t *elm_hw_cpu; sdlahw_card_t *elm_hw_card; + + DEBUG_MOD("Unloading SDLADRV module ...\n"); - elm_hw = WAN_LIST_FIRST(&sdlahw_head); - while(elm_hw){ - sdlahw_t *tmp = elm_hw; - elm_hw = WAN_LIST_NEXT(elm_hw, next); - if (sdla_hw_unregister(tmp->hwcard, tmp->cpu_no) == -EBUSY){ + elm_hw_cpu = WAN_LIST_FIRST(&sdlahw_cpu_head); + while(elm_hw_cpu){ + sdlahw_cpu_t *tmp = elm_hw_cpu; + elm_hw_cpu = WAN_LIST_NEXT(elm_hw_cpu, next); + if (sdla_hwport_unregister(tmp) == -EBUSY){ + return -EBUSY; + } + if (sdla_hwcpu_unregister(tmp) == -EBUSY){ return -EBUSY; } } - WAN_LIST_INIT(&sdlahw_head); + WAN_LIST_INIT(&sdlahw_cpu_head); elm_hw_card = WAN_LIST_FIRST(&sdlahw_card_head); - while(elm_hw){ + while(elm_hw_card){ sdlahw_card_t *tmp = elm_hw_card; elm_hw_card = WAN_LIST_NEXT(elm_hw_card, next); - if (sdla_card_unregister(tmp->hw_type, + if (sdla_card_unregister((u8)tmp->hw_type, tmp->slot_no, tmp->bus_no, tmp->ioport) == -EBUSY){ @@ -576,7 +827,7 @@ int sdladrv_exit (void *arg) while(elm_hw_probe){ sdla_hw_probe_t *tmp = elm_hw_probe; elm_hw_probe = WAN_LIST_NEXT(elm_hw_probe, next); - if (tmp->used){ + if (tmp->internal_used){ DEBUG_EVENT("sdladrv: HW probe info is in used (%s)\n", tmp->hw_info); return -EBUSY; @@ -585,9 +836,11 @@ int sdladrv_exit (void *arg) wan_free(tmp); } + #if defined(WAN_DEBUG_MEM) - DEBUG_EVENT("sdladrv: Total Mem %d\n",wan_atomic_read(&wan_debug_mem)); -#endif + sdla_memdbg_free(); +#endif + return 0; } @@ -615,207 +868,321 @@ G*** S A N G O M A H A R D W A R E P R O B E ***** "%-10s : SLOT=%d : BUS=%d : IRQ=%d : CPU=%c : PORT=%d : HWEC=%d : V=%02X" #define SDLA_HWPROBE_A200_SH_FORMAT \ "%-10s : SLOT=%d : BUS=%d : IRQ=%d : CPU=%c : PORT=%s : HWEC=%d : V=%02X" - +#define SDLA_HWPROBE_A500_SH_FORMAT \ + "%-10s : SLOT=%d : BUS=%d : IRQ=%d : PORT=%d : HWEC=%d : V=%02X" static void -sdla_save_hw_probe (sdlahw_t* hw, int port) +sdla_save_hw_probe (sdlahw_t* hw) { - sdla_hw_probe_t *tmp_hw_probe, *tmp; - unsigned char id_str[50]; + sdlahw_cpu_t *hwcpu; + sdla_hw_probe_t *hwprobe; - memset(id_str,0,sizeof(id_str)); + WAN_ASSERT_VOID(hw == NULL); + WAN_ASSERT_VOID(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + hwprobe = hw->hwprobe; - tmp_hw_probe = wan_malloc(sizeof(sdla_hw_probe_t)); - if (!tmp_hw_probe) - return; - - memset(tmp_hw_probe,0,sizeof(sdla_hw_probe_t)); - - if (hw->hwcard->hw_type == SDLA_PCI_CARD){ - switch(hw->hwcard->adptr_type){ + if (hwcpu->hwcard->hw_type == SDLA_PCI_CARD){ + switch(hwcpu->hwcard->adptr_type){ case A101_ADPTR_1TE1: case A101_ADPTR_2TE1: - if (hw->hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ - snprintf(tmp_hw_probe->hw_info, - sizeof(tmp_hw_probe->hw_info), + if (hwcpu->hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ + snprintf(hwprobe->hw_info, + sizeof(hwprobe->hw_info), SDLA_HWPROBE_AFT_SH_FORMAT, - hw->hwcard->adptr_name, - hw->hwcard->slot_no, - hw->hwcard->bus_no, - hw->irq, - SDLA_GET_CPU(hw->cpu_no), - port+1, /* line_no */ - hw->hwcard->hwec_chan_no, - hw->hwcard->core_rev); + hwcpu->hwcard->adptr_name, + hwcpu->hwcard->slot_no, + hwcpu->hwcard->bus_no, + hwcpu->irq, + SDLA_GET_CPU(hwcpu->cpu_no), + hw->port_no+1, /* line_no */ + hwcpu->hwcard->hwec_chan_no, + hwcpu->hwcard->core_rev); }else{ /*sprintf(tmp_hw_probe->hw_info,*/ - snprintf(tmp_hw_probe->hw_info, - sizeof(tmp_hw_probe->hw_info), + snprintf(hwprobe->hw_info, + sizeof(hwprobe->hw_info), SDLA_HWPROBE_AFT_1_2_FORMAT, - hw->hwcard->adptr_name, - hw->hwcard->slot_no, - hw->hwcard->bus_no, - hw->irq, - SDLA_GET_CPU(hw->cpu_no), - port ? "SEC" : "PRI", - hw->hwcard->core_rev); + hwcpu->hwcard->adptr_name, + hwcpu->hwcard->slot_no, + hwcpu->hwcard->bus_no, + hwcpu->irq, + SDLA_GET_CPU(hwcpu->cpu_no), + hw->port_no ? "SEC" : "PRI", + hwcpu->hwcard->core_rev); } - - if (hw->hwcard->core_id == AFT_DS_FE_CORE_ID) { - strcpy(id_str,"DS26521"); - } else { - strcpy(id_str,"PMC4351"); - } - sprintf(&tmp_hw_probe->hw_info_verbose[0], "\n+%02d:%s:%s", - port+1, id_str, - AFT_PCITYPE_DECODE(hw->hwcard)); - - - break; + break; case A104_ADPTR_4TE1: case A108_ADPTR_8TE1: - if (hw->hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ - snprintf(tmp_hw_probe->hw_info, - sizeof(tmp_hw_probe->hw_info), + if (hwcpu->hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ + snprintf(hwprobe->hw_info, + sizeof(hwprobe->hw_info), SDLA_HWPROBE_AFT_SH_FORMAT, - hw->hwcard->adptr_name, - hw->hwcard->slot_no, - hw->hwcard->bus_no, - hw->irq, - SDLA_GET_CPU(hw->cpu_no), - port+1, /* line_no */ - hw->hwcard->hwec_chan_no, - hw->hwcard->core_rev); + hwcpu->hwcard->adptr_name, + hwcpu->hwcard->slot_no, + hwcpu->hwcard->bus_no, + hwcpu->irq, + SDLA_GET_CPU(hwcpu->cpu_no), + hw->port_no+1, /* line_no */ + hwcpu->hwcard->hwec_chan_no, + hwcpu->hwcard->core_rev); }else{ - snprintf(tmp_hw_probe->hw_info, - sizeof(tmp_hw_probe->hw_info), + snprintf(hwprobe->hw_info, + sizeof(hwprobe->hw_info), SDLA_HWPROBE_AFT_FORMAT, - hw->hwcard->adptr_name, - hw->hwcard->slot_no, - hw->hwcard->bus_no, - hw->irq, - SDLA_GET_CPU(hw->cpu_no), - port+1, - hw->hwcard->core_rev + hwcpu->hwcard->adptr_name, + hwcpu->hwcard->slot_no, + hwcpu->hwcard->bus_no, + hwcpu->irq, + SDLA_GET_CPU(hwcpu->cpu_no), + hw->port_no+1, + hwcpu->hwcard->core_rev ); /* line_no */ } - - if (hw->hwcard->core_id == AFT_DS_FE_CORE_ID) { - if (hw->hwcard->adptr_type == A108_ADPTR_8TE1) { - strcpy(id_str,"DS26528"); - } else { - strcpy(id_str,"DS26524"); - } - } else { - strcpy(id_str,"PMC4354"); - } - - sprintf(&tmp_hw_probe->hw_info_verbose[0], "\n+%02d:%s:%s", - port+1, id_str, - AFT_PCITYPE_DECODE(hw->hwcard)); break; case A200_ADPTR_ANALOG: case A400_ADPTR_ANALOG: /*sprintf(tmp_hw_probe->hw_info,*/ - snprintf(tmp_hw_probe->hw_info, - sizeof(tmp_hw_probe->hw_info), + snprintf(hwprobe->hw_info, + sizeof(hwprobe->hw_info), SDLA_HWPROBE_A200_SH_FORMAT, - hw->hwcard->adptr_name, - hw->hwcard->slot_no, - hw->hwcard->bus_no, - hw->irq, - SDLA_GET_CPU(hw->cpu_no), - port ? "SEC" : "PRI", - hw->hwcard->hwec_chan_no, - hw->hwcard->core_rev); + hwcpu->hwcard->adptr_name, + hwcpu->hwcard->slot_no, + hwcpu->hwcard->bus_no, + hwcpu->irq, + SDLA_GET_CPU(hwcpu->cpu_no), + hw->port_no ? "SEC" : "PRI", + hwcpu->hwcard->hwec_chan_no, + hwcpu->hwcard->core_rev); break; case A300_ADPTR_U_1TE3: - if (hw->hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ - snprintf(tmp_hw_probe->hw_info, - sizeof(tmp_hw_probe->hw_info), + case AFT_ADPTR_56K: + if (hwcpu->hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ + snprintf(hwprobe->hw_info, + sizeof(hwprobe->hw_info), SDLA_HWPROBE_AFT_FORMAT, - hw->hwcard->adptr_name, - hw->hwcard->slot_no, - hw->hwcard->bus_no, - hw->irq, - SDLA_GET_CPU(hw->cpu_no), - port+1, - hw->hwcard->core_rev); /* line_no */ + hwcpu->hwcard->adptr_name, + hwcpu->hwcard->slot_no, + hwcpu->hwcard->bus_no, + hwcpu->irq, + SDLA_GET_CPU(hwcpu->cpu_no), + hw->port_no+1, + hwcpu->hwcard->core_rev); /* line_no */ }else{ - snprintf(tmp_hw_probe->hw_info, - sizeof(tmp_hw_probe->hw_info), + snprintf(hwprobe->hw_info, + sizeof(hwprobe->hw_info), SDLA_HWPROBE_PCI_FORMAT, - hw->hwcard->adptr_name, - hw->hwcard->slot_no, - hw->hwcard->bus_no, - hw->irq, - SDLA_GET_CPU(hw->cpu_no), - port ? "SEC" : "PRI"); + hwcpu->hwcard->adptr_name, + hwcpu->hwcard->slot_no, + hwcpu->hwcard->bus_no, + hwcpu->irq, + SDLA_GET_CPU(hwcpu->cpu_no), + hw->port_no ? "SEC" : "PRI"); } break; + + case AFT_ADPTR_ISDN: + snprintf(hwprobe->hw_info, + sizeof(hwprobe->hw_info), + SDLA_HWPROBE_A500_SH_FORMAT, + hwcpu->hwcard->adptr_name, + hwcpu->hwcard->slot_no, + hwcpu->hwcard->bus_no, + hwcpu->irq, + hw->port_no+1, /* Physical line number */ + hwcpu->hwcard->hwec_chan_no, + hwcpu->hwcard->core_rev); + break; + + case AFT_ADPTR_2SERIAL_V35X21: + case AFT_ADPTR_4SERIAL_V35X21: + case AFT_ADPTR_2SERIAL_RS232: + case AFT_ADPTR_4SERIAL_RS232: + snprintf(hwprobe->hw_info, + sizeof(hwprobe->hw_info), + SDLA_HWPROBE_AFT_FORMAT, + hwcpu->hwcard->adptr_name, + hwcpu->hwcard->slot_no, + hwcpu->hwcard->bus_no, + hwcpu->irq, + SDLA_GET_CPU(hwcpu->cpu_no), + hw->port_no+1, + hwcpu->hwcard->core_rev); /* line_no */ + break; default: /*sprintf(tmp_hw_probe->hw_info,*/ - snprintf(tmp_hw_probe->hw_info, - sizeof(tmp_hw_probe->hw_info), + snprintf(hwprobe->hw_info, + sizeof(hwprobe->hw_info), SDLA_HWPROBE_PCI_FORMAT, - hw->hwcard->adptr_name, - hw->hwcard->slot_no, - hw->hwcard->bus_no, - hw->irq, - SDLA_GET_CPU(hw->cpu_no), - port ? "SEC" : "PRI"); + hwcpu->hwcard->adptr_name, + hwcpu->hwcard->slot_no, + hwcpu->hwcard->bus_no, + hwcpu->irq, + SDLA_GET_CPU(hwcpu->cpu_no), + hw->port_no ? "SEC" : "PRI"); break; } }else{ /*sprintf(tmp_hw_probe->hw_info, */ - snprintf(tmp_hw_probe->hw_info, sizeof(tmp_hw_probe->hw_info), - SDLA_HWPROBE_ISA_FORMAT, - "S508-ISA",hw->hwcard->ioport, port ? "SEC" : "PRI"); + snprintf(hwprobe->hw_info, sizeof(hwprobe->hw_info), + SDLA_HWPROBE_ISA_FORMAT, + "S508-ISA", + hwcpu->hwcard->ioport, + hw->port_no ? "SEC" : "PRI"); } + return; +} - hw->hwport[port].hwprobe = tmp_hw_probe; - hw->max_ports++; - tmp_hw_probe->used++; +static void sdla_get_hwcard_name(sdlahw_card_t* hwcard) +{ + WAN_ASSERT_VOID(hwcard == NULL); + sprintf(hwcard->adptr_name, "%s%s%s", + SDLA_ADPTR_NAME(hwcard->adptr_type), + AFT_SUBTYPE(hwcard->adptr_subtype), + AFT_SECURITY(hwcard->adptr_security)); + return; +} - WAN_LIST_FOREACH(tmp, &sdlahw_probe_head, next){ - if (!WAN_LIST_NEXT(tmp, next)){ - break; + +static sdlahw_t* sdla_hwport_register(sdlahw_cpu_t* hwcpu, int max_ports_no) +{ + sdlahw_t *hw = NULL, *first_hw = NULL; + int port; + + for(port = 0; port < max_ports_no; port++){ + if ((hw = sdla_hw_register(hwcpu, port)) == NULL){ + sdla_hwport_unregister(hwcpu); + return NULL; + } + if (first_hw == NULL){ + first_hw = hw; } } - if (tmp){ - WAN_LIST_INSERT_AFTER(tmp, tmp_hw_probe, next); - }else{ - WAN_LIST_INSERT_HEAD(&sdlahw_probe_head, tmp_hw_probe, next); + return first_hw; +} +static int sdla_hwport_unregister(sdlahw_cpu_t* hwcpu) +{ + sdlahw_t *hw, *tmp_hw; + + WAN_ASSERT(hwcpu == NULL); + hw = WAN_LIST_FIRST(&sdlahw_head); + while(hw){ + + tmp_hw = hw; + hw = WAN_LIST_NEXT(hw, next); + + if (tmp_hw->hwcpu == hwcpu){ + if (sdla_hw_unregister(tmp_hw)){ + return -EBUSY; + } + } } - return; + return 0; } -static void sdla_get_adptr_name(sdlahw_t* hw) +static sdlahw_t* sdla_hwport_serial_register(sdlahw_cpu_t* hwcpu, int max_ports_no) { - sprintf(hw->hwcard->adptr_name, "%s%s%s", - SDLA_ADPTR_NAME(hw->hwcard->adptr_type), - AFT_SUBTYPE(hw->hwcard->adptr_subtype), - AFT_SECURITY(hw->hwcard->adptr_security)); - return; + sdlahw_t *hw = NULL, *first_hw = NULL; + int port; + unsigned char id_str[50]; + + memset(id_str, 0x00, 50); + for(port = 0; port < max_ports_no; port++){ + switch(hwcpu->hwcard->adptr_type){ + case AFT_ADPTR_2SERIAL_V35X21: + strcpy(id_str, "AFT-A142 2 Port V.35/X.21"); + break; + case AFT_ADPTR_4SERIAL_V35X21: + strcpy(id_str, "AFT-A144 4 Port V.35/X.21"); + break; + case AFT_ADPTR_2SERIAL_RS232: + strcpy(id_str, "AFT-A142 2 Port RS232"); + break; + case AFT_ADPTR_4SERIAL_RS232: + strcpy(id_str, "AFT-A144 4 Port RS232"); + break; + } + + if ((hw = sdla_hw_register(hwcpu, port)) == NULL){ + sdla_hwport_unregister(hwcpu); + return NULL; + } + if (first_hw == NULL){ + first_hw = hw; + } + sprintf(&hw->hwprobe->hw_info_verbose[0], "\n+%02d:%s:%s", + port+1, id_str, + AFT_PCITYPE_DECODE(hwcpu->hwcard)); + } + return first_hw; } - -static int sdla_save_Remora_hw_probe_verbose(sdlahw_t* hw, int port) +static sdlahw_t* sdla_hwport_te1_register(sdlahw_cpu_t* hwcpu, int max_ports_no) { + sdlahw_t *hw = NULL, *first_hw = NULL; + int port; + unsigned char id_str[50]; + + memset(id_str, 0x00, 50); + for(port = 0; port < max_ports_no; port++){ + if (hwcpu->hwcard->type == SDLA_S514){ + strcpy(id_str, "PMC4351"); + }else if (hwcpu->hwcard->type == SDLA_AFT){ + if (hwcpu->hwcard->cfg_type == WANOPT_AFT){ + strcpy(id_str, "PMC4351"); + }else if (hwcpu->hwcard->cfg_type == WANOPT_AFT101){ + strcpy(id_str, "DS26521"); + }else if (hwcpu->hwcard->cfg_type == WANOPT_AFT102){ + strcpy(id_str, "DS26521"); + }else if (hwcpu->hwcard->cfg_type == WANOPT_AFT104){ + if (hwcpu->hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ + strcpy(id_str, "DS26524"); + }else{ + strcpy(id_str, "PMC4354"); + } + }else if (hwcpu->hwcard->cfg_type == WANOPT_AFT108){ + strcpy(id_str, "DS26528"); + } + }else{ + continue; + } + + if ((hw = sdla_hw_register(hwcpu, port)) == NULL){ + sdla_hwport_unregister(hwcpu); + return NULL; + } + if (first_hw == NULL){ + first_hw = hw; + } + sprintf(&hw->hwprobe->hw_info_verbose[0], "\n+%02d:%s:%s", + port+1, id_str, + AFT_PCITYPE_DECODE(hwcpu->hwcard)); + } + return first_hw; +} + +static sdlahw_t *sdla_hwport_Remora_register(sdlahw_cpu_t* hwcpu, int *max_ports_no) +{ + sdlahw_t *hw; u32 reg; - int mod_no, off = 0; + int mod_no, off = 0, port_cnt = 0; + int rm_mod_type[MAX_REMORA_MODULES+2]; + u_int32_t port_map = 0; unsigned char value, str[50]; - WAN_ASSERT(hw == NULL); - - memset(hw->hwport[port].hwprobe->hw_info_verbose, '\0', 500); + WAN_ASSERT_RC(hwcpu == NULL, NULL); + *max_ports_no = 0; + if ((hw = sdla_hw_register(hwcpu, 0)) == NULL){ + return NULL; + } if (sdla_memory_map(hw, SDLA_CPU_A)){ - return -EINVAL; + sdla_hw_unregister(hw); + return NULL; } /* A200 clear reset */ @@ -837,15 +1204,15 @@ static int sdla_save_Remora_hw_probe_verbose(sdlahw_t* hw, int port) WP_DELAY(1000); sdla_bus_write_4(hw,SPI_INTERFACE_REG,0x00000000); WP_DELAY(1000); - - for(mod_no = 0; mod_no < MAX_REMORA_MODULES; mod_no += 2){ - + + for(mod_no = 0; mod_no < MAX_REMORA_MODULES; mod_no ++){ + rm_mod_type[mod_no] = MOD_TYPE_NONE; + //rm_mod_type[mod_no+1] = MOD_TYPE_NONE; value = sdla_shark_rm_read_fe(hw, mod_no, MOD_TYPE_FXS, 0, 0); if ((value & 0x0F) == 0x05){ - hw->hwcard->rm_mod_type[mod_no] = MOD_TYPE_FXS; - hw->hwcard->rm_mod_type[mod_no+1] = MOD_TYPE_FXS; + rm_mod_type[mod_no] = MOD_TYPE_FXS; + // rm_mod_type[mod_no+1] = MOD_TYPE_FXS; } - } /* Reset SPI bus */ @@ -853,26 +1220,31 @@ static int sdla_save_Remora_hw_probe_verbose(sdlahw_t* hw, int port) WP_DELAY(1000); sdla_bus_write_4(hw,SPI_INTERFACE_REG,0x00000000); WP_DELAY(1000); - for(mod_no = 0; mod_no < MAX_REMORA_MODULES; mod_no += 2){ + for(mod_no = 0; mod_no < MAX_REMORA_MODULES; mod_no ++){ - if (hw->hwcard->rm_mod_type[mod_no] != MOD_TYPE_NONE) continue; + if (rm_mod_type[mod_no] != MOD_TYPE_NONE) continue; value = sdla_shark_rm_read_fe(hw, mod_no, MOD_TYPE_FXO, 1, 2); if (value == 0x03){ - hw->hwcard->rm_mod_type[mod_no] = MOD_TYPE_FXO; - hw->hwcard->rm_mod_type[mod_no+1] = MOD_TYPE_FXO; + rm_mod_type[mod_no] = MOD_TYPE_FXO; + //rm_mod_type[mod_no+1] = MOD_TYPE_FXO; } } + port_map = 0; for(mod_no = 0; mod_no < MAX_REMORA_MODULES; mod_no ++){ - if (hw->hwcard->rm_mod_type[mod_no] == MOD_TYPE_FXS){ - sprintf(str, "\n+%02d:FXS:%s", mod_no+1,AFT_PCITYPE_DECODE(hw->hwcard)); - }else if (hw->hwcard->rm_mod_type[mod_no] == MOD_TYPE_FXO){ - sprintf(str, "\n+%02d:FXO:%s", mod_no+1,AFT_PCITYPE_DECODE(hw->hwcard)); + if (rm_mod_type[mod_no] == MOD_TYPE_FXS){ + sprintf(str, "\n+%02d:FXS", mod_no+1); + port_cnt++; + port_map |= (1 << (mod_no+1)); + }else if (rm_mod_type[mod_no] == MOD_TYPE_FXO){ + sprintf(str, "\n+%02d:FXO", mod_no+1); + port_cnt++; + port_map |= (1 << (mod_no+1)); }else{ sprintf(str, "\n+%02d:EMPTY", mod_no+1); } - memcpy(&hw->hwport[0].hwprobe->hw_info_verbose[off], + memcpy(&hw->hwprobe->hw_info_verbose[off], str, strlen(str)); off += strlen(str); } @@ -889,33 +1261,242 @@ static int sdla_save_Remora_hw_probe_verbose(sdlahw_t* hw, int port) sdla_bus_write_4(hw,0x40,reg); sdla_memory_unmap(hw); - return 0; + *max_ports_no = port_cnt; + hwcpu->max_ports = port_cnt; /* overwrite with real port number */ + hwcpu->port_map = port_map; + + return hw; } -static int sdla_save_ISDN_hw_probe_verbose(sdlahw_t* hw, int port) +static sdlahw_t *sdla_hwport_ISDN_register(sdlahw_cpu_t* hwcpu, int *ports_no) { + sdlahw_t *hw, *first_hw = NULL; + int port_cnt = 0, mod_no, rm_no; + u32 reg, port_map=0; + int rm_mod_type[MAX_REMORA_MODULES+2]; + unsigned char str[50]; + + WAN_ASSERT_RC(hwcpu == NULL, NULL); + + if ((hw = sdla_hw_register(hwcpu, 0)) == NULL){ + return NULL; + } + + if (sdla_memory_map(hw, SDLA_CPU_A)){ + sdla_hw_unregister(hw); + return NULL; + } - /* FIXME: Add code for ISDN card for module detection */ - return 0; + /* A500 clear reset. Disable Global Chip/FrontEnd/CPLD Reset. */ + sdla_bus_read_4(hw, 0x40,®); + wan_set_bit(1,®); + wan_set_bit(2,®); + sdla_bus_write_4(hw,0x40,reg); + + WP_DELAY(10); + + wan_clear_bit(1,®); + wan_clear_bit(2,®); + sdla_bus_write_4(hw,0x40,reg); + + WP_DELAY(10); + + /* Reset SPI bus */ + sdla_bus_write_4(hw,SPI_INTERFACE_REG,MOD_SPI_RESET); + WP_DELAY(1000); + sdla_bus_write_4(hw,SPI_INTERFACE_REG,0x00000000); + WP_DELAY(1000); + + for(mod_no = 0; mod_no < MAX_BRI_LINES; mod_no++){ + rm_mod_type[mod_no] = MOD_TYPE_NONE; + } + + for(rm_no = 0; rm_no < MAX_BRI_REMORAS; rm_no++){ + port_cnt += sdla_scan_isdn_bri_modules(hw, rm_mod_type, (u8)rm_no); + } + + /* The sdla_scan_isdn_bri_modules() call returns number of PHYSICAL modules. + But sdla_save_ISDN_hw_probe() must return number of LOGICAL modules, + which is actually number of BRI ports. + */ + port_cnt *= BRI_MAX_PORTS_PER_CHIP; + + /* A500 has a hwport for each BRI port */ + for(mod_no = 0; mod_no < MAX_BRI_LINES; mod_no ++){ + + if (rm_mod_type[mod_no] == MOD_TYPE_TE){ + sprintf(str, "\n+%02d:TE", mod_no+1); + port_map |= (1 << (mod_no+1)); + }else if (rm_mod_type[mod_no] == MOD_TYPE_NT){ + sprintf(str, "\n+%02d:NT", mod_no+1); + port_map |= (1 << (mod_no+1)); + }else{ + /* EMPTY */ + continue; + } + + if (first_hw == NULL){ + sdla_hwport_unregister(hwcpu); + } + if ((hw = sdla_hw_register(hwcpu, mod_no)) == NULL){ + sdla_memory_unmap(hw); + sdla_hwport_unregister(hwcpu); + return NULL; + } + if (first_hw == NULL){ + first_hw = hw; + } + memcpy(&hw->hwprobe->hw_info_verbose[0], + str, strlen(str)); + } + + /* Reset SPI bus */ + sdla_bus_write_4(hw,SPI_INTERFACE_REG,MOD_SPI_RESET); + WP_DELAY(1000); + sdla_bus_write_4(hw,SPI_INTERFACE_REG,0x00000000); + WP_DELAY(1000); + + WP_DELAY(10); + + wan_set_bit(1,®); + wan_set_bit(2,®); + sdla_bus_write_4(hw,0x40,reg); + + sdla_memory_unmap(hw); + *ports_no = port_cnt; + hwcpu->max_ports = port_cnt; /* overwrite with real port number */ + hwcpu->port_map = port_map; + return first_hw; +} + +/****************************************************************************** + * sdla_scan_isdn_bri_modules() + * + * Description : Scan for installed modules. + * + * Arguments : pfe - pointer to Front End structure. + * Returns : number of discovered modules. + *******************************************************************************/ + +static int sdla_scan_isdn_bri_modules(sdlahw_t* hw, int *rm_mod_type, u_int8_t rm_no) +{ + u_int8_t mod_no = 0x3; /* to read remora status register ALWAYS put 0x3 into mod_addr. */ + u_int8_t value, ind, mod_counter = 0; + u_int8_t mod_no_index; /* index in the array of ALL modules (NOT lines) on ALL remoras. From 0 to 11 */ + + /* format of remora status register: + bit 0 == 1 - module 1 active (exist) + bit 1 - type of module 1 (0 - NT, 1 - TE) + + bit 2 == 1 - module 2 active (exist) + bit 3 - type of module 1 (0 - NT, 1 - TE) + + bit 4 == 1 - module 3 active (exist) + bit 5 - type of module 1 (0 - NT, 1 - TE) + + bit 6,7 - has to be zeros for active remora. if non-zero, remora does not exist. + */ + + value = sdla_shark_bri_read_fe( hw, + mod_no, + MOD_TYPE_NONE, + rm_no, + 0); + +#define MODULE1 0 +#define MODULE2 2 +#define MODULE3 4 + + DEBUG_TEST("remora number: %d, remora status register: 0x%02X\n", rm_no, value); + + if(((value >> 7) & 0x01) || ((value >> 8) & 0x01)){ + DEBUG_EVENT("%s: Remora number %d does not exist.\n", hw->devname, rm_no); + return 0; + } + + for(ind = 0; ind < 6; ind++){ + + switch(ind){ + + case MODULE1: + case MODULE2: + case MODULE3: + DEBUG_TEST("module Number on REMORA (0-2): %d\n", ind / 2); + + /* 0-11, all (even and odd) numbers */ + mod_no_index = rm_no * MAX_BRI_MODULES_PER_REMORA + ind / 2; + DEBUG_TEST("mod_no_index on CARD (should be 0-11): %d\n", mod_no_index); + + /* 0-23, only even numbers */ + mod_no_index = mod_no_index * 2;//???? + DEBUG_TEST("mod_no_index (line number) on CARD (should be 0-23): %d\n", mod_no_index); + + if(mod_no_index >= MAX_BRI_LINES){ + DEBUG_EVENT("%s: Error: Module %d/%d exceeds maximum (%d)\n", + hw->devname, mod_no_index, mod_no_index, MAX_BRI_LINES); + return 0; + } + + if((value >> ind) & 0x01){ + + mod_counter++; + + if((value >> (ind + 1)) & 0x01){ + + DEBUG_TEST("%s: Module %d type is: TE\n", + hw->devname, mod_no_index); + + rm_mod_type[mod_no_index] = MOD_TYPE_TE; + rm_mod_type[mod_no_index+1] = MOD_TYPE_TE; + + }else{ + DEBUG_TEST("%s: Module %d type is: NT\n", + hw->devname, mod_no_index); + + rm_mod_type[mod_no_index] = MOD_TYPE_NT; + rm_mod_type[mod_no_index+1] = MOD_TYPE_NT; + } + + }else{ + DEBUG_TEST("%s: Module %d is not installed\n", + hw->devname, mod_no_index); + } + DEBUG_TEST("=================================\n\n"); + break; + }/* switch() */ + }/* for() */ + + return mod_counter; } #define AFT_CHIP_CFG_REG 0x40 #define AFT_CHIPCFG_SFR_IN_BIT 2 #define AFT_CHIPCFG_SFR_EX_BIT 1 -static int sdla_get_cpld_info(sdlahw_t* hw) +#if !defined(__WINDOWS__) +static +#endif +int sdla_get_hw_info(sdlahw_t* hw) { + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; unsigned int reg, reg1; unsigned short cpld_off; - unsigned char status = 0, tmp = 0, adptr_sec = 0; + unsigned char status = 0, tmp = 0, adptr_sec = 0; AFT_FUNC_DEBUG(); + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + if (sdla_memory_map(hw, SDLA_CPU_A)){ return -EINVAL; } - if (hw->hwcard->adptr_subtype == AFT_SUBTYPE_NORMAL){ - switch(hw->hwcard->adptr_type){ + if (hwcard->adptr_subtype == AFT_SUBTYPE_NORMAL){ + switch(hwcard->adptr_type){ case A101_ADPTR_1TE1: case A101_ADPTR_2TE1: cpld_off = AFT_SECURITY_CPLD_REG; @@ -924,11 +1505,11 @@ static int sdla_get_cpld_info(sdlahw_t* hw) switch(adptr_sec){ case AFT_SECURITY_1LINE_UNCH: case AFT_SECURITY_2LINE_UNCH: - hw->hwcard->adptr_security = AFT_SECURITY_UNCHAN; + hwcard->adptr_security = AFT_SECURITY_UNCHAN; break; case AFT_SECURITY_1LINE_CH: case AFT_SECURITY_2LINE_CH: - hw->hwcard->adptr_security = AFT_SECURITY_CHAN; + hwcard->adptr_security = AFT_SECURITY_CHAN; break; default: DEBUG_EVENT( @@ -950,12 +1531,12 @@ static int sdla_get_cpld_info(sdlahw_t* hw) sdla_hw_read_cpld(hw, cpld_off, &tmp); adptr_sec = AFT_GET_SECURITY(tmp); if (adptr_sec == AFT_SECURITY_1LINE_UNCH){ - hw->hwcard->adptr_security = AFT_SECURITY_UNCHAN; + hwcard->adptr_security = AFT_SECURITY_UNCHAN; }else if (adptr_sec == AFT_SECURITY_1LINE_CH){ - hw->hwcard->adptr_security = AFT_SECURITY_CHAN; + hwcard->adptr_security = AFT_SECURITY_CHAN; }else if (adptr_sec == 0x02){ /*FIXME: ALEX CHANGE HARDCODED VALUE FOR SHARK */ - hw->hwcard->adptr_security = AFT_SECURITY_CHAN; + hwcard->adptr_security = AFT_SECURITY_CHAN; }else{ DEBUG_EVENT( "%s: AFT-A104 Critical error: Unknown Security ID (%02X)!\n", @@ -967,10 +1548,10 @@ static int sdla_get_cpld_info(sdlahw_t* hw) break; } - }else if (hw->hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ - switch(hw->hwcard->core_id){ + }else if (hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ + switch(hwcard->core_id){ case AFT_PMC_FE_CORE_ID: - switch(hw->hwcard->adptr_type){ + switch(hwcard->adptr_type){ case A104_ADPTR_4TE1: /* Enable memory access */ sdla_bus_read_4(hw, AFT_CHIP_CFG_REG, ®1); @@ -981,19 +1562,19 @@ static int sdla_get_cpld_info(sdlahw_t* hw) cpld_off = AFT_SH_CPLD_BOARD_STATUS_REG; sdla_hw_read_cpld(hw, cpld_off, &status); - hw->hwcard->hwec_chan_no = A104_ECCHAN(AFT_SH_SECURITY(status)); + hwcard->hwec_chan_no = A104_ECCHAN(AFT_SH_SECURITY(status)); /* Restore original value */ sdla_bus_write_4(hw, AFT_CHIP_CFG_REG, reg1); break; case A300_ADPTR_U_1TE3: /* By default, AFT-A300 is unchannelized! */ - hw->hwcard->adptr_security = AFT_SECURITY_UNCHAN; + hwcard->adptr_security = AFT_SECURITY_UNCHAN; break; } break; case AFT_DS_FE_CORE_ID: - switch(hw->hwcard->adptr_type){ + switch(hwcard->adptr_type){ case A101_ADPTR_1TE1: case A101_ADPTR_2TE1: case A104_ADPTR_4TE1: @@ -1007,7 +1588,7 @@ static int sdla_get_cpld_info(sdlahw_t* hw) cpld_off = AFT_SH_CPLD_BOARD_STATUS_REG; sdla_hw_read_cpld(hw, cpld_off, &status); - hw->hwcard->hwec_chan_no = A108_ECCHAN(AFT_SH_SECURITY(status)); + hwcard->hwec_chan_no = A108_ECCHAN(AFT_SH_SECURITY(status)); /* Restore original value */ sdla_bus_write_4(hw, AFT_CHIP_CFG_REG, reg1); @@ -1015,7 +1596,7 @@ static int sdla_get_cpld_info(sdlahw_t* hw) } break; default: - switch(hw->hwcard->adptr_type){ + switch(hwcard->adptr_type){ case A200_ADPTR_ANALOG: case A400_ADPTR_ANALOG: /* Enable memory access */ @@ -1027,9 +1608,9 @@ static int sdla_get_cpld_info(sdlahw_t* hw) cpld_off = A200_SH_CPLD_BOARD_STATUS_REG; sdla_hw_read_cpld(hw, cpld_off, &status); - hw->hwcard->hwec_chan_no = AFT_RM_ECCHAN(AFT_SH_SECURITY(status)); + hwcard->hwec_chan_no = AFT_RM_ECCHAN(AFT_SH_SECURITY(status)); - if (hw->hwcard->hwec_chan_no){ + if (hwcard->hwec_chan_no){ /* Check EC access */ /* Clear octasic reset */ @@ -1043,8 +1624,40 @@ static int sdla_get_cpld_info(sdlahw_t* hw) /* Restore original value */ sdla_bus_write_4(hw, AFT_CHIP_CFG_REG, reg1); - break; + + case AFT_ADPTR_ISDN: + AFT_FUNC_DEBUG(); + /* Enable memory access */ + sdla_bus_read_4(hw, AFT_CHIP_CFG_REG, ®1); + reg = reg1; + wan_clear_bit(AFT_CHIPCFG_SFR_IN_BIT, ®); + wan_clear_bit(AFT_CHIPCFG_SFR_EX_BIT, ®); + sdla_bus_write_4(hw, AFT_CHIP_CFG_REG, reg); + + /* Restore original value */ + //sdla_bus_write_4(hw, AFT_CHIP_CFG_REG, reg1); + cpld_off = A200_SH_CPLD_BOARD_STATUS_REG; + sdla_hw_read_cpld(hw, cpld_off, &status); + + DEBUG_BRI("at A200_SH_CPLD_BOARD_STATUS_REG: 0x%X\n", status); + + hwcard->hwec_chan_no = A500_ECCHAN(AFT_SH_SECURITY(status)); + + DEBUG_BRI("hwcard->hwec_chan_no: %d\n", hwcard->hwec_chan_no); + + if (hwcard->hwec_chan_no){ + /* Check EC access */ + /* Clear octasic reset */ + cpld_off = 0x00; + sdla_hw_write_cpld(hw, cpld_off, 0x01); + + /* Set octasic reset */ + cpld_off = 0x00; + sdla_hw_write_cpld(hw, cpld_off, 0x00); + } + break; + case AFT_ADPTR_56K: AFT_FUNC_DEBUG(); /* Enable memory access */ @@ -1056,12 +1669,49 @@ static int sdla_get_cpld_info(sdlahw_t* hw) cpld_off = AFT_SH_CPLD_BOARD_STATUS_REG; sdla_hw_read_cpld(hw, cpld_off, &status); - hw->hwcard->hwec_chan_no = 0; - + hwcard->hwec_chan_no = 0; + break; + case AFT_ADPTR_2SERIAL_V35X21: + case AFT_ADPTR_4SERIAL_V35X21: + case AFT_ADPTR_2SERIAL_RS232: + case AFT_ADPTR_4SERIAL_RS232: + /* AFT-SERIAL: Add code here */ break; } break; } + /* Only for those cards that have PLX PCI Express chip as master */ + if (hwcard->pci_bridge_dev){ + u_int16_t vendor_id; + u_int8_t val; + + sdla_plxctrl_read8(hw, 0x00, &val); + /* For now, all PLX with blank EEPROM is our new + ** cards from production. */ + if (val == PLX_EEPROM_ENABLE){ + + sdla_plxctrl_read8(hw, PLX_EEPROM_VENDOR_OFF, &val); + vendor_id = val << 8; + sdla_plxctrl_read8(hw, PLX_EEPROM_VENDOR_OFF+1, &val); + vendor_id |= val; + if (vendor_id != SANGOMA_PCI_VENDOR){ + hwcard->pci_bridge_dev = NULL; + hwcard->pci_bridge_bus = 0; + hwcard->pci_bridge_slot = 0; + } + } + } + } + if (hwcard->hwec_chan_no){ + /* These card has Echo Cancellation module */ +#if defined(__WINDOWS__) + /* Special case for Windows driver: + ** Serial number of the physical card, NOT changing + ** when a port is restarted. */ + hwcard->hwec_ind = get_card_serial_number(hw->p_sdla); +#else + hwcard->hwec_ind = ++sdla_hwec_no; +#endif } sdla_memory_unmap(hw); return 0; @@ -1072,53 +1722,62 @@ static int sdla_get_cpld_info(sdlahw_t* hw) ** sdla_hw_select ***************************************************************************** */ -static int sdla_s514_hw_select (sdlahw_card_t* hwcard, int cpu_no, int irq, void* dev) +static int +sdla_s514_hw_select (sdlahw_card_t* hwcard, int cpu_no, int irq, void* dev) { - sdlahw_t* hw=NULL; + sdlahw_cpu_t *hwcpu=NULL; + sdlahw_t *hw=NULL; int number_of_cards = 0; hwcard->cfg_type = WANOPT_S51X; hwcard->type = SDLA_S514; + sdla_get_hwcard_name(hwcard); sdla_adapter_cnt.s514x_adapters++; switch(hwcard->adptr_type){ case S5144_ADPTR_1_CPU_T1E1: - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ return -EINVAL; } - sdla_get_adptr_name(hw); + if ((hw = sdla_hwport_te1_register(hwcpu, 2)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } + number_of_cards += 2; DEBUG_EVENT( "%s: %s T1/E1 card found, cpu(s) 1, bus #%d, slot #%d, irq #%d\n", wan_drvname, hwcard->adptr_name, hwcard->bus_no, hwcard->slot_no, irq); - sdla_save_hw_probe(hw, 0); - sdla_save_hw_probe(hw, 1); - number_of_cards += 2; break; case S5145_ADPTR_1_CPU_56K: - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ return -EINVAL; } - sdla_get_adptr_name(hw); + if ((hw = sdla_hwport_register(hwcpu, 2)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } + number_of_cards += 2; DEBUG_EVENT( "%s: %s 56K card found, cpu(s) 1, bus #%d, slot #%d, irq #%d\n", wan_drvname, hwcard->adptr_name, hwcard->bus_no, hwcard->slot_no, irq); - sdla_save_hw_probe(hw, 0); - sdla_save_hw_probe(hw, 1); - number_of_cards += 2; break; case S5142_ADPTR_2_CPU_SERIAL: - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ return -EINVAL; } - sdla_get_adptr_name(hw); + if ((hw = sdla_hwport_register(hwcpu, 2)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } + number_of_cards += 2; /* Print the message only for CPU A. ** BSD calls this function for both CPUs */ if (cpu_no == SDLA_CPU_A){ @@ -1128,45 +1787,54 @@ static int sdla_s514_hw_select (sdlahw_card_t* hwcard, int cpu_no, int irq, void hwcard->adptr_name, hwcard->bus_no, hwcard->slot_no, irq); }else{ -#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) +#if !defined(SDLA_AUTO_PROBE) +# if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) sdla_adapter_cnt.s514x_adapters--; +# endif #endif } - sdla_save_hw_probe(hw, 0); - sdla_save_hw_probe(hw, 1); - number_of_cards += 2; -#if defined(__LINUX__) - if ((hw = sdla_hw_register(hwcard, SDLA_CPU_B, irq, dev)) == NULL){ +#if defined(__LINUX__) || defined(SDLA_AUTO_PROBE) + if ((hwcpu = sdla_hwcpu_register(hwcard, SDLA_CPU_B, irq, dev)) == NULL){ return -EINVAL; } - sdla_save_hw_probe(hw, 0); - sdla_save_hw_probe(hw, 1); + /* Aug 10, 2007 + ** Do not overwrite first hw for this Serial card */ + if (sdla_hwport_register(hwcpu, 2) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } number_of_cards += 2; #endif break; case S5143_ADPTR_1_CPU_FT1: - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ return -EINVAL; } - sdla_get_adptr_name(hw); + if ((hw = sdla_hwport_te1_register(hwcpu, 1)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } + number_of_cards += 1; DEBUG_EVENT( "%s: %s FT1 card found, cpu(s) 1, bus #%d, slot #%d, irq #%d\n", wan_drvname, hwcard->adptr_name, hwcard->bus_no, hwcard->slot_no, irq); - sdla_save_hw_probe(hw, 0); - number_of_cards += 1; break; case S5147_ADPTR_2_CPU_T1E1: - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ return -EINVAL; } - sdla_get_adptr_name(hw); + if ((hw = sdla_hwport_te1_register(hwcpu, 1)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } + number_of_cards += 1; /* Print the message only for CPU A. ** BSD calls this function for both CPUs */ if (cpu_no == SDLA_CPU_A){ @@ -1181,67 +1849,83 @@ static int sdla_s514_hw_select (sdlahw_card_t* hwcard, int cpu_no, int irq, void #endif } - sdla_save_hw_probe(hw, 0); - number_of_cards += 1; #if defined(__LINUX__) - if ((hw = sdla_hw_register(hwcard, SDLA_CPU_B, irq, dev)) == NULL){ + if ((hwcpu = sdla_hwcpu_register(hwcard, SDLA_CPU_B, irq, dev)) == NULL){ return -EINVAL; } - sdla_save_hw_probe(hw, 0); + /* Aug 10, 2007 + ** Do not overwrite first hw for this Serial card */ + if (sdla_hwport_te1_register(hwcpu, 1) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } number_of_cards += 1; #endif break; case S5148_ADPTR_1_CPU_T1E1: hwcard->adptr_type = S5144_ADPTR_1_CPU_T1E1; - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ + sdla_get_hwcard_name(hwcard); + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ return -EINVAL; } - sdla_get_adptr_name(hw); + if ((hw = sdla_hwport_te1_register(hwcpu, 1)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } + number_of_cards += 1; DEBUG_EVENT( "%s: S514-8-PCI T1/E1 card found, cpu(s) 1, bus #%d, slot #%d, irq #%d\n", wan_drvname, hwcard->bus_no, hwcard->slot_no, irq); - sdla_save_hw_probe(hw, 0); - number_of_cards += 1; break; default: - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ return -EINVAL; } - sdla_get_adptr_name(hw); + if ((hw = sdla_hwport_register(hwcpu, 2)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } + number_of_cards += 2; DEBUG_EVENT( "%s: S514-1-PCI V35/RS232/FT1 card found, cpu(s) 1, bus #%d, slot #%d, irq #%d\n", wan_drvname, hwcard->bus_no, hwcard->slot_no, irq); - sdla_save_hw_probe(hw, 0); - sdla_save_hw_probe(hw, 1); - number_of_cards += 2; break; } + while(hw){ + sdla_save_hw_probe(hw); + hw = WAN_LIST_NEXT(hw, next); + } return number_of_cards; } -static int sdla_adsl_hw_select (sdlahw_card_t* hwcard, int cpu_no, int irq, void* dev) +static int +sdla_adsl_hw_select (sdlahw_card_t* hwcard, int cpu_no, int irq, void* dev) { - sdlahw_t* hw=NULL; + sdlahw_cpu_t *hwcpu = NULL; + sdlahw_t *hw=NULL; int number_of_cards = 0; hwcard->cfg_type = WANOPT_ADSL; hwcard->type = SDLA_ADSL; + sdla_get_hwcard_name(hwcard); switch(hwcard->adptr_type){ case S518_ADPTR_1_CPU_ADSL: sdla_adapter_cnt.s518_adapters++; - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ - return -EINVAL; + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ + return 0; } - sdla_get_adptr_name(hw); + if ((hw = sdla_hwport_register(hwcpu, 1)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } + number_of_cards += 1; DEBUG_EVENT( "%s: %s ADSL card found, cpu(s) 1, bus #%d, slot #%d, irq #%d\n", wan_drvname, hwcard->adptr_name, hwcard->bus_no, hwcard->slot_no, irq); - sdla_save_hw_probe(hw, 0); - number_of_cards += 1; break; default: @@ -1251,85 +1935,122 @@ static int sdla_adsl_hw_select (sdlahw_card_t* hwcard, int cpu_no, int irq, void break; } + while(hw){ + sdla_save_hw_probe(hw); + hw = WAN_LIST_NEXT(hw, next); + } return number_of_cards; } - static int sdla_aft_hw_select (sdlahw_card_t* hwcard, int cpu_no, int irq, void* dev) { - sdlahw_t* hw=NULL; - int number_of_cards = 0; + sdlahw_cpu_t *hwcpu=NULL; + sdlahw_t *hw=NULL; +#if defined(__LINUX__) || defined(SDLA_AUTO_PROBE) + sdlahw_cpu_t *hwcpu2=NULL; + sdlahw_t *hw2= NULL; +#endif + int number_of_cards = 0, ports_no = 1; hwcard->type = SDLA_AFT; + sdla_get_hwcard_name(hwcard); switch(hwcard->adptr_type){ case A101_ADPTR_1TE1: hwcard->cfg_type = WANOPT_AFT; sdla_adapter_cnt.aft101_adapters++; - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ - return -EINVAL; - } - sdla_get_cpld_info(hw); - sdla_get_adptr_name(hw); - sdla_save_hw_probe(hw, 0); - number_of_cards += 1; if (hwcard->adptr_subtype == AFT_SUBTYPE_NORMAL){ hwcard->cfg_type = WANOPT_AFT; }else if (hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ hwcard->cfg_type = WANOPT_AFT101; } + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ + return 0; + } + if ((hw = sdla_hwport_te1_register(hwcpu, 1)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } + sdla_get_hw_info(hw); + sdla_get_hwcard_name(hwcard); + number_of_cards += 1; DEBUG_EVENT( "%s: %s%s T1/E1 card found (%s rev.%X), cpu(s) 1, bus #%d, slot #%d, irq #%d\n", wan_drvname, hwcard->adptr_name, - AFT_PCIEXPRESS_DECODE(hwcard), + AFT_PCITYPE_DECODE(hwcard), AFT_CORE_ID_DECODE(hwcard->core_id), hwcard->core_rev, hwcard->bus_no, hwcard->slot_no, irq); break; case A101_ADPTR_2TE1: - sdla_adapter_cnt.aft101_adapters++; - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ - return -EINVAL; - } - sdla_get_cpld_info(hw); - sdla_get_adptr_name(hw); - sdla_save_hw_probe(hw, 0); - number_of_cards += 1; if (hwcard->adptr_subtype == AFT_SUBTYPE_NORMAL){ hwcard->cfg_type = WANOPT_AFT; + sdla_adapter_cnt.aft101_adapters++; + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ + return 0; + } + if ((hw = sdla_hwport_te1_register(hwcpu, 1)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } + sdla_get_hw_info(hw); + sdla_get_hwcard_name(hwcard); + number_of_cards += 1; #if defined(__LINUX__) if (hwcard->pci_dev->resource[1].flags){ - if ((hw = sdla_hw_register(hwcard, SDLA_CPU_B, irq, dev)) == NULL){ - return -EINVAL; + if ((hwcpu2 = sdla_hwcpu_register(hwcard, SDLA_CPU_B, irq, dev)) == NULL){ + return 0; + } + if ((hw2 = sdla_hwport_te1_register(hwcpu2, 1)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; } - sdla_save_hw_probe(hw, 0); number_of_cards += 1; } +#elif defined(__FreeBSD__) && defined(SDLA_AUTO_PROBE) + if ((hwcpu2 = sdla_hwcpu_register(hwcard, SDLA_CPU_B, irq, dev)) == NULL){ + return 0; + } + if ((hw2 = sdla_hwport_te1_register(hwcpu2, 1)) == NULL){ + sdla_hwcpu_unregister(hwcpu2); + return 0; + } + number_of_cards += 1; #endif if (cpu_no == SDLA_CPU_A){ DEBUG_EVENT( "%s: %s%s T1/E1 card found (%s rev.%X), cpu(s) 2, bus #%d, slot #%d, irq #%d\n", wan_drvname, hwcard->adptr_name, - AFT_PCIEXPRESS_DECODE(hwcard), + AFT_PCITYPE_DECODE(hwcard), AFT_CORE_ID_DECODE(hwcard->core_id), hwcard->core_rev, hwcard->bus_no, hwcard->slot_no, irq); }else{ +#if !defined(SDLA_AUTO_PROBE) #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) sdla_adapter_cnt.aft101_adapters--; +#endif #endif } }else if (hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ hwcard->cfg_type = WANOPT_AFT102; - sdla_save_hw_probe(hw, 1); - number_of_cards += 1; + sdla_adapter_cnt.aft101_adapters++; + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ + return 0; + } + if ((hw = sdla_hwport_te1_register(hwcpu, 2)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } + sdla_get_hw_info(hw); + number_of_cards += 2; DEBUG_EVENT( "%s: %s%s T1/E1 card found (%s rev.%X), cpu(s) 1, line(s) 2, bus #%d, slot #%d, irq #%d\n", wan_drvname, hwcard->adptr_name, - AFT_PCIEXPRESS_DECODE(hwcard), + AFT_PCITYPE_DECODE(hwcard), AFT_CORE_ID_DECODE(hwcard->core_id), hwcard->core_rev, hwcard->bus_no, hwcard->slot_no, irq); @@ -1339,24 +2060,22 @@ static int sdla_aft_hw_select (sdlahw_card_t* hwcard, int cpu_no, int irq, void* case A104_ADPTR_4TE1: hwcard->cfg_type = WANOPT_AFT104; sdla_adapter_cnt.aft104_adapters++; - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ - return -EINVAL; + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ + return 0; } - sdla_get_cpld_info(hw); - sdla_get_adptr_name(hw); - sdla_save_hw_probe(hw, 0); - number_of_cards ++; - sdla_save_hw_probe(hw, 1); - number_of_cards ++; - sdla_save_hw_probe(hw, 2); - number_of_cards ++; - sdla_save_hw_probe(hw, 3); - number_of_cards ++; + if ((hw = sdla_hwport_te1_register(hwcpu, 4)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } + sdla_get_hw_info(hw); + sdla_get_hwcard_name(hwcard); + number_of_cards += 4; + DEBUG_EVENT( "%s: %s%s T1/E1 card found (%s rev.%X), cpu(s) 1, line(s) 4, bus #%d, slot #%d, irq #%d\n", wan_drvname, hwcard->adptr_name, - AFT_PCIEXPRESS_DECODE(hwcard), + AFT_PCITYPE_DECODE(hwcard), AFT_CORE_ID_DECODE(hwcard->core_id), hwcard->core_rev, hwcard->bus_no, hwcard->slot_no, irq); @@ -1365,32 +2084,20 @@ static int sdla_aft_hw_select (sdlahw_card_t* hwcard, int cpu_no, int irq, void* case A108_ADPTR_8TE1: hwcard->cfg_type = WANOPT_AFT108; sdla_adapter_cnt.aft108_adapters++; - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ - return -EINVAL; + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ + return 0; } - sdla_get_cpld_info(hw); - sdla_get_adptr_name(hw); - sdla_save_hw_probe(hw, 0); - number_of_cards ++; - sdla_save_hw_probe(hw, 1); - number_of_cards ++; - sdla_save_hw_probe(hw, 2); - number_of_cards ++; - sdla_save_hw_probe(hw, 3); - number_of_cards ++; - sdla_save_hw_probe(hw, 4); - number_of_cards ++; - sdla_save_hw_probe(hw, 5); - number_of_cards ++; - sdla_save_hw_probe(hw, 6); - number_of_cards ++; - sdla_save_hw_probe(hw, 7); - number_of_cards ++; + if ((hw = sdla_hwport_te1_register(hwcpu, 8)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } + number_of_cards += 8; + sdla_get_hw_info(hw); DEBUG_EVENT( "%s: %s%s T1/E1 card found (%s rev.%X), cpu(s) 1, line(s) 8, bus #%d, slot #%d, irq #%d\n", wan_drvname, hwcard->adptr_name, - AFT_PCIEXPRESS_DECODE(hwcard), + AFT_PCITYPE_DECODE(hwcard), AFT_CORE_ID_DECODE(hwcard->core_id), hwcard->core_rev, hwcard->bus_no, hwcard->slot_no, irq); @@ -1400,18 +2107,20 @@ static int sdla_aft_hw_select (sdlahw_card_t* hwcard, int cpu_no, int irq, void* hwcard->cfg_type = WANOPT_AFT300; sdla_adapter_cnt.aft300_adapters++; - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ - return -EINVAL; + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ + return 0; + } + if ((hw = sdla_hw_register(hwcpu, 0)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; } - sdla_get_cpld_info(hw); - sdla_get_adptr_name(hw); - sdla_save_hw_probe(hw, 0); number_of_cards += 1; + sdla_get_hw_info(hw); DEBUG_EVENT( "%s: %s%s T3/E3 card found (%s rev.%X), cpu(s) 1, bus #%d, slot #%d, irq #%d\n", wan_drvname, hwcard->adptr_name, - AFT_PCIEXPRESS_DECODE(hwcard), + AFT_PCITYPE_DECODE(hwcard), AFT_CORE_ID_DECODE(hwcard->core_id), hwcard->core_rev, hwcard->bus_no, hwcard->slot_no, irq); @@ -1422,21 +2131,21 @@ static int sdla_aft_hw_select (sdlahw_card_t* hwcard, int cpu_no, int irq, void* hwcard->cfg_type = WANOPT_AFT_ANALOG; sdla_adapter_cnt.aft200_adapters++; - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ - return -EINVAL; + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ + return 0; } - sdla_get_cpld_info(hw); - sdla_get_adptr_name(hw); - sdla_save_hw_probe(hw, 0); - /* Verify FXS/FXO modules */ - sdla_save_Remora_hw_probe_verbose(hw, 0); + if ((hw = sdla_hwport_Remora_register(hwcpu, &ports_no)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } + number_of_cards ++; + sdla_get_hw_info(hw); - number_of_cards += 1; DEBUG_EVENT( "%s: %s%s FXO/FXS card found (%s rev.%X), cpu(s) 1, bus #%d, slot #%d, irq #%d\n", wan_drvname, hwcard->adptr_name, - AFT_PCIEXPRESS_DECODE(hwcard), + AFT_PCITYPE_DECODE(hwcard), AFT_CORE_ID_DECODE(hwcard->core_id), hwcard->core_rev, hwcard->bus_no, hwcard->slot_no, irq); @@ -1446,21 +2155,23 @@ static int sdla_aft_hw_select (sdlahw_card_t* hwcard, int cpu_no, int irq, void* hwcard->cfg_type = WANOPT_AFT_ISDN; sdla_adapter_cnt.aft_isdn_adapters++; - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ - return -EINVAL; + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ + return 0; } - sdla_get_cpld_info(hw); - sdla_get_adptr_name(hw); - sdla_save_hw_probe(hw, 0); - /* Verify FXS/FXO modules */ - sdla_save_ISDN_hw_probe_verbose(hw, 0); + if ((hw = sdla_hwport_ISDN_register(hwcpu, &ports_no)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } + sdla_get_hw_info(hw); + + /* Verify BRI TE/NT modules */ + number_of_cards += ports_no; - number_of_cards += 1; DEBUG_EVENT( "%s: %s%s ISDN BRI card found (%s rev.%X), cpu(s) 1, bus #%d, slot #%d, irq #%d\n", wan_drvname, hwcard->adptr_name, - AFT_PCIEXPRESS_DECODE(hwcard), + AFT_PCITYPE_DECODE(hwcard), AFT_CORE_ID_DECODE(hwcard->core_id), hwcard->core_rev, hwcard->bus_no, hwcard->slot_no, irq); @@ -1470,44 +2181,60 @@ static int sdla_aft_hw_select (sdlahw_card_t* hwcard, int cpu_no, int irq, void* hwcard->cfg_type = WANOPT_AFT_56K; sdla_adapter_cnt.aft_56k_adapters++; - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ - return -EINVAL; + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ + return 0; + } + if ((hw = sdla_hwport_register(hwcpu, 1)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; } - sdla_get_cpld_info(hw); - sdla_get_adptr_name(hw); - sdla_save_hw_probe(hw, 0); - number_of_cards += 1; + sdla_get_hw_info(hw); + DEBUG_EVENT( "%s: %s%s 56K card found (%s rev.%X), cpu(s) 1, bus #%d, slot #%d, irq #%d\n", wan_drvname, hwcard->adptr_name, - AFT_PCIEXPRESS_DECODE(hwcard), + AFT_PCITYPE_DECODE(hwcard), AFT_CORE_ID_DECODE(hwcard->core_id), hwcard->core_rev, hwcard->bus_no, hwcard->slot_no, irq); break; - default: -#if 0 - hwcard->cfg_type = WANOPT_AFT104; - sdla_adapter_cnt.aft_x_adapters++; - - if ((hw = sdla_hw_register(hwcard, cpu_no, irq, dev)) == NULL){ - return -EINVAL; + case AFT_ADPTR_2SERIAL_V35X21: + case AFT_ADPTR_4SERIAL_V35X21: + case AFT_ADPTR_2SERIAL_RS232: + case AFT_ADPTR_4SERIAL_RS232: + if (hwcard->adptr_type == AFT_ADPTR_2SERIAL_V35X21 || + hwcard->adptr_type == AFT_ADPTR_2SERIAL_RS232){ + ports_no = 2; + }else{ + ports_no = 4; } - sdla_get_cpld_info(hw); - sdla_get_adptr_name(hw); - sdla_save_hw_probe(hw, 0); - number_of_cards += 1; + hwcard->cfg_type = WANOPT_AFT_SERIAL; + sdla_adapter_cnt.aft_serial_adapters++; + + if ((hwcpu = sdla_hwcpu_register(hwcard, cpu_no, irq, dev)) == NULL){ + return 0; + } + if ((hw = sdla_hwport_serial_register(hwcpu, ports_no)) == NULL){ + sdla_hwcpu_unregister(hwcpu); + return 0; + } + number_of_cards += ports_no; + sdla_get_hw_info(hw); + DEBUG_EVENT( - "%s: %s PCI-X card found (%s rev.%X), cpu(s) 1, bus #%d, slot #%d, irq #%d\n", + "%s: %s%s Serial card found (%s rev.%X), cpu(s) %d, bus #%d, slot #%d, irq #%d\n", wan_drvname, hwcard->adptr_name, + AFT_PCITYPE_DECODE(hwcard), AFT_CORE_ID_DECODE(hwcard->core_id), - hwcard->core_rev, + hwcard->core_rev, ports_no, hwcard->bus_no, hwcard->slot_no, irq); -#else + break; + + default: DEBUG_EVENT( "%s: Unknown adapter %04X (bus #%d, slot #%d, irq #%d)!\n", wan_drvname, @@ -1515,10 +2242,12 @@ static int sdla_aft_hw_select (sdlahw_card_t* hwcard, int cpu_no, int irq, void* hwcard->bus_no, hwcard->slot_no, irq); -#endif break; } - + while(hw){ + sdla_save_hw_probe(hw); + hw = WAN_LIST_NEXT(hw, next); + } return number_of_cards; } @@ -1527,442 +2256,522 @@ static int sdla_aft_hw_select (sdlahw_card_t* hwcard, int cpu_no, int irq, void* ** sdla_pci_probe ***************************************************************************** */ +static int +sdla_pci_probe_S(sdlahw_t *hw, int slot, int bus, int irq) +{ + sdlahw_card_t *hwcard = NULL, *tmp_hwcard = NULL; + sdlahw_cpu_t *hwcpu; + u16 PCI_subsys_vendor; + u16 pci_subsystem_id; + + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + tmp_hwcard = hwcpu->hwcard; + + sdla_pci_read_config_word(hw,PCI_SUBSYS_VENDOR_WORD,&PCI_subsys_vendor); + + if(PCI_subsys_vendor != SANGOMA_SUBSYS_VENDOR) return 0; + + sdla_pci_read_config_word(hw,PCI_SUBSYS_ID_WORD,&pci_subsystem_id); + + hwcard = sdla_card_register(SDLA_PCI_CARD, slot, bus, 0); + if (hwcard == NULL) return 0; + + hwcard->adptr_type = pci_subsystem_id & 0xFF; + hwcard->pci_dev = tmp_hwcard->pci_dev; + + /* A dual cpu card can support up to 4 physical connections, + * where a single cpu card can support up to 2 physical + * connections. The FT1 card can only support a single + * connection, however we cannot distinguish between a Single + * CPU card and an FT1 card. */ + return sdla_s514_hw_select(hwcard, SDLA_CPU_A, irq, NULL); +} + +static int +sdla_pci_probe_adsl(sdlahw_t *hw, int slot, int bus, int irq) +{ + sdlahw_card_t *hwcard = NULL, *tmp_hwcard = NULL; + sdlahw_cpu_t *hwcpu; + u16 pci_subsystem_id; + + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + tmp_hwcard = hwcpu->hwcard; + + sdla_pci_read_config_word(hw, PCI_SUBSYS_ID_WORD, &pci_subsystem_id); + +#if 0 + if ((pci_subsystem_id & 0xFF) != S518_ADPTR_1_CPU_ADSL){ + continue; + } +#else + pci_subsystem_id=S518_ADPTR_1_CPU_ADSL; +#endif + + hwcard = sdla_card_register(SDLA_PCI_CARD, slot, bus, 0); + if (hwcard == NULL) return 0; + + hwcard->adptr_type = pci_subsystem_id & 0xFF; + hwcard->pci_dev = tmp_hwcard->pci_dev; + + return sdla_adsl_hw_select(hwcard, SDLA_CPU_A, irq, NULL); +} + +static int +sdla_pci_probe_adsl_2(sdlahw_t *hw, int slot, int bus, int irq) +{ + sdlahw_card_t *hwcard = NULL, *tmp_hwcard = NULL; + sdlahw_cpu_t *hwcpu; + u16 pci_subsystem_id; + + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + tmp_hwcard = hwcpu->hwcard; + + sdla_pci_read_config_word(hw, PCI_SUBSYS_ID_WORD, &pci_subsystem_id); + + pci_subsystem_id=S518_ADPTR_1_CPU_ADSL; + + hwcard = sdla_card_register(SDLA_PCI_CARD, slot, bus, 0); + if (hwcard == NULL){ + return 0; + } + hwcard->adptr_type = pci_subsystem_id & 0xFF; + hwcard->pci_dev = tmp_hwcard->pci_dev; + + return sdla_adsl_hw_select(hwcard, SDLA_CPU_A, irq, NULL); +} + +static int +sdla_pci_probe_aft(sdlahw_t *hw, int slot_no, int bus_no, int irq) +{ + sdlahw_card_t *hwcard = NULL, *tmp_hwcard = NULL; + sdlahw_cpu_t *hwcpu; + u16 pci_device_id; + u16 PCI_subsys_vendor; + u16 pci_subsystem_id; +#if defined(__LINUX__) + struct pci_dev* pci_bridge_dev = NULL; + struct pci_bus* bus = NULL; +#endif + + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + WAN_ASSERT(hw->hwcpu->hwcard->pci_dev == NULL); + hwcpu = hw->hwcpu; + tmp_hwcard = hwcpu->hwcard; + + /* ALEX 11/18 + * Supporting different aft cards */ + sdla_pci_read_config_word(hw, + PCI_DEVICE_ID_WORD, + &pci_device_id); + if (pci_device_id == SANGOMA_PCI_DEVICE || pci_device_id == SANGOMA_PCI_4_DEVICE){ + /* Old A-series cards, keep original sequence */ + return 0; + } + sdla_pci_read_config_word(hw, + PCI_SUBSYS_VENDOR_WORD, + &PCI_subsys_vendor); + sdla_pci_read_config_word(hw, + PCI_SUBSYS_ID_WORD, + &pci_subsystem_id); + + hwcard = sdla_card_register(SDLA_PCI_CARD, slot_no, bus_no, 0); + if (hwcard == NULL){ + return 0; + } + + switch(PCI_subsys_vendor){ + case A101_1TE1_SUBSYS_VENDOR: + hwcard->adptr_type = A101_ADPTR_1TE1; + break; + case A101_2TE1_SUBSYS_VENDOR: + hwcard->adptr_type = A101_ADPTR_2TE1; + break; + case A104_4TE1_SUBSYS_VENDOR: + hwcard->adptr_type = A104_ADPTR_4TE1; + break; + case AFT_1TE1_SHARK_SUBSYS_VENDOR: + hwcard->adptr_type = A101_ADPTR_1TE1; + hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; + break; + case AFT_2TE1_SHARK_SUBSYS_VENDOR: + hwcard->adptr_type = A101_ADPTR_2TE1; + hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; + break; + case AFT_4TE1_SHARK_SUBSYS_VENDOR: + hwcard->adptr_type = A104_ADPTR_4TE1; + hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; + break; + case AFT_8TE1_SHARK_SUBSYS_VENDOR: + hwcard->adptr_type = A108_ADPTR_8TE1; + hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; + break; + case A300_UTE3_SHARK_SUBSYS_VENDOR: + hwcard->adptr_type = A300_ADPTR_U_1TE3; + hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; + break; + case A305_CTE3_SHARK_SUBSYS_VENDOR: + hwcard->adptr_type = A305_ADPTR_C_1TE3; + hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; + break; + case A200_REMORA_SHARK_SUBSYS_VENDOR: + hwcard->adptr_type = A200_ADPTR_ANALOG; + hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; + break; + case A400_REMORA_SHARK_SUBSYS_VENDOR: + hwcard->adptr_type = A400_ADPTR_ANALOG; + hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; + break; + case AFT_ISDN_BRI_SHARK_SUBSYS_VENDOR: + hwcard->adptr_type = AFT_ADPTR_ISDN; + hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; + break; + case AFT_56K_SHARK_SUBSYS_VENDOR: + hwcard->adptr_type = AFT_ADPTR_56K; + hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; + break; + case AFT_2SERIAL_V35X21_SUBSYS_VENDOR: + hwcard->adptr_type = AFT_ADPTR_2SERIAL_V35X21; + hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; + break; + case AFT_4SERIAL_V35X21_SUBSYS_VENDOR: + hwcard->adptr_type = AFT_ADPTR_4SERIAL_V35X21; + hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; + break; + case AFT_2SERIAL_RS232_SUBSYS_VENDOR: + hwcard->adptr_type = AFT_ADPTR_2SERIAL_RS232; + hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; + break; + case AFT_4SERIAL_RS232_SUBSYS_VENDOR: + hwcard->adptr_type = AFT_ADPTR_4SERIAL_RS232; + hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; + break; + default: + DEBUG_EVENT( + "%s: Unsupported SubVendor ID:%04X (bus=%d, slot=%d)\n", + wan_drvname, + PCI_subsys_vendor, slot_no, bus_no); + sdla_card_unregister(SDLA_PCI_CARD, slot_no, bus_no, 0); + return 0; + } +#if defined(__LINUX__) + /* Detect PCI Express cards (only valid for production test) */ + switch(PCI_subsys_vendor){ + case A200_REMORA_SHARK_SUBSYS_VENDOR: + case A400_REMORA_SHARK_SUBSYS_VENDOR: + case AFT_1TE1_SHARK_SUBSYS_VENDOR: + case AFT_2TE1_SHARK_SUBSYS_VENDOR: + case AFT_4TE1_SHARK_SUBSYS_VENDOR: + case AFT_8TE1_SHARK_SUBSYS_VENDOR: + case AFT_ISDN_BRI_SHARK_SUBSYS_VENDOR: + case AFT_56K_SHARK_SUBSYS_VENDOR: + case AFT_2SERIAL_V35X21_SUBSYS_VENDOR: + case AFT_4SERIAL_V35X21_SUBSYS_VENDOR: + case AFT_2SERIAL_RS232_SUBSYS_VENDOR: + case AFT_4SERIAL_RS232_SUBSYS_VENDOR: + if (tmp_hwcard->pci_dev->bus == NULL) break; + bus = tmp_hwcard->pci_dev->bus; + if (bus->self == NULL) break; + pci_bridge_dev = bus->self; + if (pci_bridge_dev->vendor == PLX_VENDOR_ID && + (pci_bridge_dev->device == PLX_DEVICE_ID || + pci_bridge_dev->device == PLX2_DEVICE_ID)){ + hwcard->pci_bridge_dev = pci_bridge_dev; + hwcard->pci_bridge_bus = bus_no; + hwcard->pci_bridge_slot = slot_no; + DEBUG_TEST("%s: PCI-Express card (bus:%d, slot:%d)\n", + wan_drvname, bus_no, slot_no); + } + break; + } +#endif + + hwcard->core_id = AFT_CORE_ID(pci_subsystem_id); + hwcard->core_rev= AFT_CORE_REV(pci_subsystem_id); + if (hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ + switch(hwcard->core_id){ + case AFT_ANALOG_FE_CORE_ID: + case AFT_PMC_FE_CORE_ID: + case AFT_DS_FE_CORE_ID: + break; + default: + DEBUG_EVENT("%s: Unsupported core id (%X)\n", + wan_drvname, hwcard->core_id); + sdla_card_unregister(SDLA_PCI_CARD, slot_no, bus_no, 0); + return 0; + break; + } + } + hwcard->pci_dev = tmp_hwcard->pci_dev; + return sdla_aft_hw_select(hwcard, SDLA_CPU_A, irq, NULL); +} + +static int +sdla_pci_probe_aft_v2(sdlahw_t *hw, int slot_no, int bus_no, int irq) +{ + sdlahw_card_t *hwcard = NULL, *tmp_hwcard = NULL; + sdlahw_cpu_t *hwcpu; + u16 PCI_subsys_vendor; + u16 pci_subsystem_id; + + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + tmp_hwcard = hwcpu->hwcard; + + /* ALEX 11/18 + * Supporting different aft cards */ + sdla_pci_read_config_word(hw, + PCI_SUBSYS_VENDOR_WORD, + &PCI_subsys_vendor); + + hwcard = sdla_card_register(SDLA_PCI_CARD, slot_no, bus_no, 0); + if (hwcard == NULL){ + return 0; + } + + switch(PCI_subsys_vendor){ + case A101_1TE1_SUBSYS_VENDOR: + hwcard->adptr_type = A101_ADPTR_1TE1; + break; + case A101_2TE1_SUBSYS_VENDOR: + hwcard->adptr_type = A101_ADPTR_2TE1; + break; + case A300_UTE3_SUBSYS_VENDOR: + hwcard->adptr_type = A300_ADPTR_U_1TE3; + break; + default: + DEBUG_EVENT("%s: Unsupported subsystem vendor id %04X (bus=%d, slot=%d)\n", + wan_drvname, PCI_subsys_vendor, bus_no, slot_no); + return 0; + } + + sdla_pci_read_config_word(hw, + PCI_SUBSYS_ID_WORD, + &pci_subsystem_id); + hwcard->core_id = AFT_CORE_ID(pci_subsystem_id); + hwcard->core_rev= AFT_CORE_REV(pci_subsystem_id); + hwcard->pci_dev = tmp_hwcard->pci_dev; + return sdla_aft_hw_select(hwcard, SDLA_CPU_A, irq, NULL); +} + +static int +sdla_pci_probe_aft_v1(sdlahw_t *hw, int slot_no, int bus_no, int irq) +{ + sdlahw_card_t *hwcard = NULL, *tmp_hwcard = NULL; + sdlahw_cpu_t *hwcpu; + u16 PCI_subsys_vendor; + u16 pci_subsystem_id; + + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + tmp_hwcard = hwcpu->hwcard; + + /* ALEX 11/18 + * Supporting different aft cards */ + sdla_pci_read_config_word(hw, + PCI_SUBSYS_VENDOR_WORD, + &PCI_subsys_vendor); + sdla_pci_read_config_word(hw, + PCI_SUBSYS_ID_WORD, + &pci_subsystem_id); + hwcard = sdla_card_register(SDLA_PCI_CARD, slot_no, bus_no, 0); + if (hwcard == NULL){ + return 0; + } + + switch(PCI_subsys_vendor){ + case A101_1TE1_SUBSYS_VENDOR: + hwcard->adptr_type = A101_ADPTR_1TE1; + break; + case A101_2TE1_SUBSYS_VENDOR: + hwcard->adptr_type = A101_ADPTR_2TE1; + break; + case A104_4TE1_SUBSYS_VENDOR: + hwcard->adptr_type = A104_ADPTR_4TE1; + break; + case AFT_4TE1_SHARK_SUBSYS_VENDOR: + hwcard->adptr_type = A104_ADPTR_4TE1; + hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; + break; + default: + DEBUG_EVENT("%s: Unsupported subsystem vendor id %04X (bus=%d, slot=%d)\n", + wan_drvname, PCI_subsys_vendor, bus_no, slot_no); + return 0; + } + + hwcard->core_id = AFT_CORE_ID(pci_subsystem_id); + hwcard->core_rev= AFT_CORE_REV(pci_subsystem_id); + hwcard->pci_dev = tmp_hwcard->pci_dev; + return sdla_aft_hw_select(hwcard, SDLA_CPU_A, irq, NULL); +} + +static int +sdla_pci_probe_aft_old(sdlahw_t *hw, int slot_no, int bus_no, int irq) +{ + sdlahw_card_t *hwcard = NULL, *tmp_hwcard = NULL; + sdlahw_cpu_t *hwcpu; + u16 PCI_subsys_vendor; + u16 pci_subsystem_id; + + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + tmp_hwcard = hwcpu->hwcard; + + /* ALEX 11/18 + * Supporting different aft cards */ + sdla_pci_read_config_word(hw, + PCI_SUBSYS_VENDOR_WORD, + &PCI_subsys_vendor); + hwcard = sdla_card_register(SDLA_PCI_CARD, slot_no, bus_no, 0); + if (hwcard == NULL) return 0; + + switch(PCI_subsys_vendor){ + case A101_1TE1_SUBSYS_VENDOR: + hwcard->adptr_type = A101_ADPTR_1TE1; + break; + case A101_2TE1_SUBSYS_VENDOR: + hwcard->adptr_type = A101_ADPTR_2TE1; + break; + case A300_UTE3_SUBSYS_VENDOR: + hwcard->adptr_type = A300_ADPTR_U_1TE3; + break; + default: + DEBUG_EVENT("%s: Unsupported subsystem vendor id %04X (bus=%d, slot=%d)\n", + wan_drvname, PCI_subsys_vendor, bus_no, slot_no); + return 0; + } + + sdla_pci_read_config_word(hw, + PCI_SUBSYS_ID_WORD, + &pci_subsystem_id); + hwcard->core_id = AFT_CORE_ID(pci_subsystem_id); + hwcard->core_rev= AFT_CORE_REV(pci_subsystem_id); + hwcard->pci_dev = tmp_hwcard->pci_dev; + return sdla_aft_hw_select(hwcard, SDLA_CPU_A, irq, NULL); +} + #if defined(__LINUX__) static int sdla_pci_probe(sdlahw_t *hw) { - sdlahw_card_t* tmp_hwcard = NULL; - sdlahw_card_t* hwcard = NULL; +// sdlahw_card_t *hwcard = NULL; + sdlahw_card_t *tmp_hwcard = NULL; + sdlahw_cpu_t *hwcpu; int number_pci_cards = 0; - u16 pci_device_id; - u16 PCI_subsys_vendor; - u16 pci_subsystem_id; - struct pci_dev* pci_dev = NULL, *pci_bridge_dev = NULL; - struct pci_bus* bus = NULL; +// u16 pci_device_id; +// u16 PCI_subsys_vendor; +// u16 pci_subsystem_id; + struct pci_dev *pci_dev = NULL; +// struct pci_dev *pci_bridge_dev = NULL; +// struct pci_bus* bus = NULL; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - tmp_hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + tmp_hwcard = hwcpu->hwcard; while ((pci_dev = pci_get_device(V3_VENDOR_ID, V3_DEVICE_ID, pci_dev)) != NULL) { - tmp_hwcard->pci_dev = pci_dev; - sdla_pci_read_config_word(hw, - PCI_SUBSYS_VENDOR_WORD, - &PCI_subsys_vendor); - - if(PCI_subsys_vendor != SANGOMA_SUBSYS_VENDOR) - continue; - - sdla_pci_read_config_word(hw, - PCI_SUBSYS_ID_WORD, - &pci_subsystem_id); - - hwcard = sdla_card_register(SDLA_PCI_CARD, - ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK), - pci_dev->bus->number, - 0); - if (hwcard == NULL){ - continue; - } - hwcard->adptr_type = pci_subsystem_id & 0xFF; - hwcard->pci_dev = pci_dev; - - /* A dual cpu card can support up to 4 physical connections, - * where a single cpu card can support up to 2 physical - * connections. The FT1 card can only support a single - * connection, however we cannot distinguish between a Single - * CPU card and an FT1 card. */ - number_pci_cards += - sdla_s514_hw_select(hwcard, SDLA_CPU_A, pci_dev->irq, NULL); - + tmp_hwcard->pci_dev = pci_dev; + number_pci_cards += sdla_pci_probe_S( + hw, + ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK), + pci_dev->bus->number, + pci_dev->irq); } /* Search for Pulsar PCI cards */ pci_dev = NULL; - while ((pci_dev = pci_get_device(PCI_VENDOR_ID_GSI, PCI_DEVICE_ID_GSI_ADSL, pci_dev)) != NULL) { - tmp_hwcard->pci_dev = pci_dev; - sdla_pci_read_config_word(hw, PCI_SUBSYS_ID_WORD, &pci_subsystem_id); - - if ((pci_subsystem_id & 0xFF) != S518_ADPTR_1_CPU_ADSL){ - continue; - } - - hwcard = sdla_card_register(SDLA_PCI_CARD, - ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK), - pci_dev->bus->number, - 0); - if (hwcard == NULL){ - continue; - } - hwcard->adptr_type = pci_subsystem_id & 0xFF; - hwcard->pci_dev = pci_dev; - - number_pci_cards += - sdla_adsl_hw_select(hwcard, SDLA_CPU_A, pci_dev->irq, NULL); - + tmp_hwcard->pci_dev = pci_dev; + number_pci_cards += sdla_pci_probe_adsl( + hw, + ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK), + pci_dev->bus->number, + pci_dev->irq); } - /* Search for Pulsar PCI cards */ pci_dev = NULL; - while ((pci_dev = pci_get_device(PCI_VENDOR_ID_GSI, PCI_ANY_ID, pci_dev)) + while ((pci_dev = pci_get_device(PCI_VENDOR_ID_GSI, PCI_DEVICE_ID_GSI_ADSL_V2, pci_dev)) != NULL) { tmp_hwcard->pci_dev = pci_dev; - sdla_pci_read_config_word(hw, PCI_SUBSYS_ID_WORD, &pci_subsystem_id); - - pci_subsystem_id=S518_ADPTR_1_CPU_ADSL; - - hwcard = sdla_card_register(SDLA_PCI_CARD, - ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK), - pci_dev->bus->number, - 0); - if (hwcard == NULL){ - continue; - } - hwcard->adptr_type = pci_subsystem_id & 0xFF; - hwcard->pci_dev = pci_dev; - - number_pci_cards += - sdla_adsl_hw_select(hwcard, SDLA_CPU_A, pci_dev->irq, NULL); - + number_pci_cards += sdla_pci_probe_adsl_2( + hw, + ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK), + pci_dev->bus->number, + pci_dev->irq); } - pci_dev=NULL; while((pci_dev = pci_get_device(SANGOMA_PCI_VENDOR, PCI_ANY_ID, pci_dev)) != NULL){ - bus = pci_dev->bus; - tmp_hwcard->pci_dev = pci_dev; - /* ALEX 11/18 - * Supporting different aft cards */ - sdla_pci_read_config_word(hw, - PCI_DEVICE_ID_WORD, - &pci_device_id); - if (pci_device_id == SANGOMA_PCI_DEVICE || pci_device_id == SANGOMA_PCI_4_DEVICE){ - /* Old A-series cards, keep original sequence */ - continue; - } - sdla_pci_read_config_word(hw, - PCI_SUBSYS_VENDOR_WORD, - &PCI_subsys_vendor); - sdla_pci_read_config_word(hw, - PCI_SUBSYS_ID_WORD, - &pci_subsystem_id); - - hwcard = sdla_card_register(SDLA_PCI_CARD, - ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK), - pci_dev->bus->number, - 0); - if (hwcard == NULL){ - continue; - } - - switch(PCI_subsys_vendor){ - case A101_1TE1_SUBSYS_VENDOR: - hwcard->adptr_type = A101_ADPTR_1TE1; - break; - - case A101_2TE1_SUBSYS_VENDOR: - hwcard->adptr_type = A101_ADPTR_2TE1; - break; - - case A104_4TE1_SUBSYS_VENDOR: - hwcard->adptr_type = A104_ADPTR_4TE1; - break; - - case AFT_1TE1_SHARK_SUBSYS_VENDOR: - hwcard->adptr_type = A101_ADPTR_1TE1; - hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; - break; - - case AFT_2TE1_SHARK_SUBSYS_VENDOR: - hwcard->adptr_type = A101_ADPTR_2TE1; - hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; - break; - - case AFT_4TE1_SHARK_SUBSYS_VENDOR: - hwcard->adptr_type = A104_ADPTR_4TE1; - hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; - break; - - case AFT_8TE1_SHARK_SUBSYS_VENDOR: - hwcard->adptr_type = A108_ADPTR_8TE1; - hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; - break; - - case A300_UTE3_SHARK_SUBSYS_VENDOR: - hwcard->adptr_type = A300_ADPTR_U_1TE3; - hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; - break; - - case A305_CTE3_SHARK_SUBSYS_VENDOR: - hwcard->adptr_type = A305_ADPTR_C_1TE3; - hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; - break; - - case A200_REMORA_SHARK_SUBSYS_VENDOR: - hwcard->adptr_type = A200_ADPTR_ANALOG; - hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; - break; - - case A400_REMORA_SHARK_SUBSYS_VENDOR: - hwcard->adptr_type = A400_ADPTR_ANALOG; - hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; - break; - - case AFT_ISDN_BRI_SHARK_SUBSYS_VENDOR: - hwcard->adptr_type = AFT_ADPTR_ISDN; - hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; - break; - - case AFT_56K_SHARK_SUBSYS_VENDOR: - hwcard->adptr_type = AFT_ADPTR_56K; - hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; - break; - - default: - DEBUG_EVENT("%s: Unsupported subsystem vendor id %04X (bus=%d, slot=%d)\n", - wan_drvname, - PCI_subsys_vendor, - pci_dev->bus->number, - ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK)); - continue; - } - /* Detect PCI Express cards (only valid for production test) */ - switch(PCI_subsys_vendor){ - case A200_REMORA_SHARK_SUBSYS_VENDOR: - case A400_REMORA_SHARK_SUBSYS_VENDOR: - case AFT_1TE1_SHARK_SUBSYS_VENDOR: - case AFT_2TE1_SHARK_SUBSYS_VENDOR: - case AFT_4TE1_SHARK_SUBSYS_VENDOR: - case AFT_8TE1_SHARK_SUBSYS_VENDOR: - case AFT_ISDN_BRI_SHARK_SUBSYS_VENDOR: - case AFT_56K_SHARK_SUBSYS_VENDOR: - if (pci_dev->bus == NULL) break; - bus = pci_dev->bus; - if (bus->self == NULL) break; - pci_bridge_dev = bus->self; - - if (pci_bridge_dev->vendor == PLX_VENDOR_ID && - (pci_bridge_dev->device == PLX_DEVICE_ID || - pci_bridge_dev->device == PLX2_DEVICE_ID)){ - - hwcard->pci_bridge_dev = pci_bridge_dev; - DEBUG_TEST("%s: PCI-Express PLX card (bus:%d, slot:%d)\n", - wan_drvname, - pci_bridge_dev->bus->number, - ((pci_bridge_dev->devfn >> 3) & PCI_DEV_SLOT_MASK)); - - }else if (pci_bridge_dev->vendor == TUNDRA_VENDOR_ID && - pci_bridge_dev->device == TUNDRA_DEVICE_ID){ - - hwcard->pci_bridge_dev = pci_bridge_dev; - DEBUG_TEST("%s: PCI-Express card (TUNDRA PCI Bridge, bus:%d, slot:%d)\n", - wan_drvname, hwcard->bus_no, hwcard->slot_no); - } - - break; - } - - hwcard->core_id = AFT_CORE_ID(pci_subsystem_id); - hwcard->core_rev= AFT_CORE_REV(pci_subsystem_id); - if (hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ - switch(hwcard->core_id){ - case AFT_ANALOG_FE_CORE_ID: - case AFT_PMC_FE_CORE_ID: - case AFT_DS_FE_CORE_ID: - break; - default: - DEBUG_EVENT("%s: Unsupported core id (%X)\n", - wan_drvname, hwcard->core_id); - sdla_card_unregister(SDLA_PCI_CARD, - ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK), - pci_dev->bus->number, - 0); - continue; - break; - } - } - hwcard->pci_dev = pci_dev; - number_pci_cards += - sdla_aft_hw_select(hwcard, SDLA_CPU_A, pci_dev->irq, NULL); - /* ALEX sdla_adapter_cnt.AFT_adapters++; */ + number_pci_cards += sdla_pci_probe_aft( + hw, + ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK), + pci_dev->bus->number, + pci_dev->irq); } pci_dev=NULL; while((pci_dev = pci_get_device(SANGOMA_PCI_VENDOR, SANGOMA_PCI_DEVICE, pci_dev)) != NULL){ - bus = pci_dev->bus; - tmp_hwcard->pci_dev = pci_dev; - /* ALEX 11/18 - * Supporting different aft cards */ - sdla_pci_read_config_word(hw, - PCI_SUBSYS_VENDOR_WORD, - &PCI_subsys_vendor); - - hwcard = sdla_card_register(SDLA_PCI_CARD, - ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK), - pci_dev->bus->number, - 0); - if (hwcard == NULL){ - continue; - } - - switch(PCI_subsys_vendor){ - case A101_1TE1_SUBSYS_VENDOR: - hwcard->adptr_type = A101_ADPTR_1TE1; - break; - - case A101_2TE1_SUBSYS_VENDOR: - hwcard->adptr_type = A101_ADPTR_2TE1; - break; - - case A300_UTE3_SUBSYS_VENDOR: - hwcard->adptr_type = A300_ADPTR_U_1TE3; - break; - - default: - DEBUG_EVENT("%s: Unsupported subsystem vendor id %04X (bus=%d, slot=%d)\n", - wan_drvname, - PCI_subsys_vendor, - pci_dev->bus->number, - ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK)); - continue; - } - - sdla_pci_read_config_word(hw, - PCI_SUBSYS_ID_WORD, - &pci_subsystem_id); - hwcard->core_id = AFT_CORE_ID(pci_subsystem_id); - hwcard->core_rev= AFT_CORE_REV(pci_subsystem_id); - hwcard->pci_dev = pci_dev; - number_pci_cards += - sdla_aft_hw_select(hwcard, SDLA_CPU_A, pci_dev->irq, NULL); - /*ALEX sdla_adapter_cnt.AFT_adapters++; */ + number_pci_cards += sdla_pci_probe_aft_v2( + hw, + ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK), + pci_dev->bus->number, + pci_dev->irq); } pci_dev=NULL; while((pci_dev = pci_get_device(SANGOMA_PCI_VENDOR, SANGOMA_PCI_4_DEVICE, pci_dev)) != NULL){ - bus = pci_dev->bus; - tmp_hwcard->pci_dev = pci_dev; - /* ALEX 11/18 - * Supporting different aft cards */ - sdla_pci_read_config_word(hw, - PCI_SUBSYS_VENDOR_WORD, - &PCI_subsys_vendor); - sdla_pci_read_config_word(hw, - PCI_SUBSYS_ID_WORD, - &pci_subsystem_id); - - hwcard = sdla_card_register(SDLA_PCI_CARD, - ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK), - pci_dev->bus->number, - 0); - if (hwcard == NULL){ - continue; - } - - switch(PCI_subsys_vendor){ - case A101_1TE1_SUBSYS_VENDOR: - hwcard->adptr_type = A101_ADPTR_1TE1; - break; - - case A101_2TE1_SUBSYS_VENDOR: - hwcard->adptr_type = A101_ADPTR_2TE1; - break; - - case A104_4TE1_SUBSYS_VENDOR: - hwcard->adptr_type = A104_ADPTR_4TE1; - break; - - case AFT_4TE1_SHARK_SUBSYS_VENDOR: - hwcard->adptr_type = A104_ADPTR_4TE1; - hwcard->adptr_subtype = AFT_SUBTYPE_SHARK; - break; - - default: - DEBUG_EVENT("%s: Unsupported subsystem vendor id %04X (bus=%d, slot=%d)\n", - wan_drvname, - PCI_subsys_vendor, - pci_dev->bus->number, - ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK)); - continue; - } - - hwcard->core_id = AFT_CORE_ID(pci_subsystem_id); - hwcard->core_rev= AFT_CORE_REV(pci_subsystem_id); - hwcard->pci_dev = pci_dev; - number_pci_cards += - sdla_aft_hw_select(hwcard, SDLA_CPU_A, pci_dev->irq, NULL); - /* ALEX sdla_adapter_cnt.AFT_adapters++; */ + number_pci_cards += sdla_pci_probe_aft_v1( + hw, + ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK), + pci_dev->bus->number, + pci_dev->irq); } pci_dev=NULL; while ((pci_dev = pci_get_device(SANGOMA_PCI_VENDOR_OLD, SANGOMA_PCI_DEVICE, pci_dev)) != NULL) { - bus = pci_dev->bus; - - tmp_hwcard->pci_dev = pci_dev; - /* ALEX 11/18 - * Supporting different aft cards */ - sdla_pci_read_config_word(hw, - PCI_SUBSYS_VENDOR_WORD, - &PCI_subsys_vendor); - - hwcard = sdla_card_register(SDLA_PCI_CARD, - ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK), - pci_dev->bus->number, - 0); - if (hwcard == NULL){ - continue; - } - - switch(PCI_subsys_vendor){ - case A101_1TE1_SUBSYS_VENDOR: - hwcard->adptr_type = A101_ADPTR_1TE1; - break; - - case A101_2TE1_SUBSYS_VENDOR: - hwcard->adptr_type = A101_ADPTR_2TE1; - break; - - case A300_UTE3_SUBSYS_VENDOR: - hwcard->adptr_type = A300_ADPTR_U_1TE3; - break; - - default: - DEBUG_EVENT("%s: Unsupported subsystem vendor id %04X (bus=%d, slot=%d)\n", - wan_drvname, - PCI_subsys_vendor, - pci_dev->bus->number, - ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK)); - continue; - } - - sdla_pci_read_config_word(hw, - PCI_SUBSYS_ID_WORD, - &pci_subsystem_id); - hwcard->core_id = AFT_CORE_ID(pci_subsystem_id); - hwcard->core_rev= AFT_CORE_REV(pci_subsystem_id); - hwcard->pci_dev = pci_dev; - number_pci_cards += - sdla_aft_hw_select(hwcard, SDLA_CPU_A, pci_dev->irq, NULL); - /* ALEX sdla_adapter_cnt.AFT_adapters++; */ + tmp_hwcard->pci_dev = pci_dev; + number_pci_cards += sdla_pci_probe_aft_old( + hw, + ((pci_dev->devfn >> 3) & PCI_DEV_SLOT_MASK), + pci_dev->bus->number, + pci_dev->irq); } - + return number_pci_cards; } + EXPORT_SYMBOL(sdla_hw_bridge_probe); unsigned int sdla_hw_bridge_probe(void) { @@ -2040,6 +2849,119 @@ unsigned int sdla_hw_bridge_probe(void) } return number_pci_x_bridges; } + +#elif defined(__FreeBSD__) +# if defined(SDLA_AUTO_PROBE) +static int sdla_pci_auto_probe(sdlahw_t *hw) +{ + struct pci_devinfo *dinfo = NULL; + sdlahw_card_t *tmp_hwcard = NULL; + sdlahw_cpu_t *hwcpu = NULL; + int number_pci_cards = 0, cards = 0; + + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + tmp_hwcard = hwcpu->hwcard; + + STAILQ_FOREACH(dinfo, &pci_devq, pci_links){ + + if (dinfo->cfg.vendor == V3_VENDOR_ID && dinfo->cfg.device == V3_DEVICE_ID){ + + tmp_hwcard->pci_dev = dinfo->cfg.dev; + cards = sdla_pci_probe_S( + hw, + pci_get_slot(dinfo->cfg.dev), + pci_get_bus(dinfo->cfg.dev), + dinfo->cfg.intline); + if (cards){ + number_pci_cards += cards; + continue; + } + } + if (dinfo->cfg.vendor == PCI_VENDOR_ID_GSI && dinfo->cfg.device == PCI_DEVICE_ID_GSI_ADSL){ + + tmp_hwcard->pci_dev = dinfo->cfg.dev; + cards += sdla_pci_probe_adsl( + hw, + pci_get_slot(dinfo->cfg.dev), + pci_get_bus(dinfo->cfg.dev), + dinfo->cfg.intline); + if (cards){ + number_pci_cards += cards; + continue; + } + } + if (dinfo->cfg.vendor == PCI_VENDOR_ID_GSI && dinfo->cfg.device == PCI_DEVICE_ID_GSI_ADSL_V2){ + + tmp_hwcard->pci_dev = dinfo->cfg.dev; + cards = sdla_pci_probe_adsl_2( + hw, + pci_get_slot(dinfo->cfg.dev), + pci_get_bus(dinfo->cfg.dev), + dinfo->cfg.intline); + if (cards){ + number_pci_cards += cards; + continue; + } + } + if (dinfo->cfg.vendor == SANGOMA_PCI_VENDOR){ + + tmp_hwcard->pci_dev = dinfo->cfg.dev; + cards = sdla_pci_probe_aft( + hw, + pci_get_slot(dinfo->cfg.dev), + pci_get_bus(dinfo->cfg.dev), + dinfo->cfg.intline); + if (cards){ + number_pci_cards += cards; + continue; + } + } + if (dinfo->cfg.vendor == SANGOMA_PCI_VENDOR && dinfo->cfg.device == SANGOMA_PCI_DEVICE){ + + tmp_hwcard->pci_dev = dinfo->cfg.dev; + cards = sdla_pci_probe_aft_v2( + hw, + pci_get_slot(dinfo->cfg.dev), + pci_get_bus(dinfo->cfg.dev), + dinfo->cfg.intline); + if (cards){ + number_pci_cards += cards; + continue; + } + } + if (dinfo->cfg.vendor == SANGOMA_PCI_VENDOR && dinfo->cfg.device == SANGOMA_PCI_4_DEVICE){ + + tmp_hwcard->pci_dev = dinfo->cfg.dev; + cards = sdla_pci_probe_aft_v1( + hw, + pci_get_slot(dinfo->cfg.dev), + pci_get_bus(dinfo->cfg.dev), + dinfo->cfg.intline); + if (cards){ + number_pci_cards += cards; + continue; + } + } + if (dinfo->cfg.vendor == SANGOMA_PCI_VENDOR_OLD && dinfo->cfg.device == SANGOMA_PCI_DEVICE){ + + tmp_hwcard->pci_dev = dinfo->cfg.dev; + cards = sdla_pci_probe_aft_old( + hw, + pci_get_slot(dinfo->cfg.dev), + pci_get_bus(dinfo->cfg.dev), + dinfo->cfg.intline); + if (cards){ + number_pci_cards += cards; + continue; + } + } + } + return number_pci_cards; +} +# endif #endif /* @@ -2049,15 +2971,14 @@ unsigned int sdla_hw_bridge_probe(void) */ EXPORT_SYMBOL(sdla_hw_probe); +#if defined(__LINUX__) unsigned int sdla_hw_probe(void) { sdlahw_card_t* hwcard; -#if defined(__LINUX__) sdlahw_card_t tmp_hwcard; + sdlahw_cpu_t tmp_hwcpu, *hwcpu; sdlahw_t tmp_hw; -#if defined(WAN_ISA_SUPPORT) unsigned* opt = s508_port_options; -#endif unsigned int cardno=0; int i; @@ -2068,15 +2989,16 @@ unsigned int sdla_hw_probe(void) //} memset(&tmp_hw, 0, sizeof(tmp_hw)); - tmp_hw.hwcard = &tmp_hwcard; + memset(&tmp_hwcpu, 0, sizeof(tmp_hwcpu)); + memset(&tmp_hwcard, 0, sizeof(tmp_hwcard)); + tmp_hwcpu.hwcard = &tmp_hwcard; + tmp_hw.hwcpu = &tmp_hwcpu; tmp_hw.magic = SDLADRV_MAGIC; -#if defined(WAN_ISA_SUPPORT) for (i = 1; i <= opt[0]; i++) { tmp_hwcard.hw_type = SDLA_ISA_CARD; tmp_hwcard.ioport = opt[i]; if (!sdla_detect_s508(&tmp_hw)){ - sdlahw_t* hw; DEBUG_EVENT("%s: S508-ISA card found, port 0x%x\n", wan_drvname, tmp_hwcard.ioport); hwcard = sdla_card_register(SDLA_ISA_CARD, @@ -2090,8 +3012,8 @@ unsigned int sdla_hw_probe(void) hwcard->pci_dev = NULL; hwcard->cfg_type = WANOPT_S50X; - hw = sdla_hw_register(hwcard, SDLA_CPU_A, 0, NULL); - if (hw == NULL){ + hwcpu = sdla_hwcpu_register(hwcard, SDLA_CPU_A, 0, NULL); + if (hwcpu == NULL){ sdla_card_unregister ( SDLA_ISA_CARD, 0, @@ -2099,8 +3021,8 @@ unsigned int sdla_hw_probe(void) tmp_hwcard.ioport); continue; } - sdla_save_hw_probe(hw, 1); - sdla_save_hw_probe(hw, 0); + sdla_hw_register(hwcpu, 1); + sdla_hw_register(hwcpu, 2); /* S508 card can support up to two physical links */ cardno += 2; @@ -2109,7 +3031,6 @@ unsigned int sdla_hw_probe(void) } tmp_hwcard.ioport = 0x00; } -#endif # ifdef CONFIG_PCI tmp_hwcard.hw_type = SDLA_PCI_CARD; @@ -2120,19 +3041,61 @@ unsigned int sdla_hw_probe(void) DEBUG_EVENT( "Warning, Kernel not compiled for PCI support!\n"); DEBUG_EVENT( "PCI Hardware Probe Failed!\n"); # endif - return cardno; -#else - sdladev_t* dev = NULL; - sdla_pci_dev_t pci_dev = NULL; - int cnt = 0; +} +#elif defined(__WINDOWS__) +unsigned int sdla_hw_probe(void) +{ + sdlahw_card_t* hwcard; + sdlahw_card_t tmp_hwcard; + sdlahw_cpu_t tmp_hwcpu, *hwcpu; + sdlahw_t tmp_hw; + unsigned int cardno=0; + int i; + + //if (!WAN_LIST_EMPTY(&sdlahw_card_head)){ + // DEBUG_EVENT("ADBG> SDLA_HW_PROBE: Number configured cards %d\n", + // cardno); + // return cardno; + //} + + memset(&tmp_hw, 0, sizeof(tmp_hw)); + memset(&tmp_hwcpu, 0, sizeof(tmp_hwcpu)); + memset(&tmp_hwcard, 0, sizeof(tmp_hwcard)); + tmp_hwcpu.hwcard = &tmp_hwcard; + tmp_hw.hwcpu = &tmp_hwcpu; + tmp_hw.magic = SDLADRV_MAGIC; + +# ifdef CONFIG_PCI + tmp_hwcard.hw_type = SDLA_PCI_CARD; + tmp_hwcard.slot_no = 0; + tmp_hwcard.bus_no = 0; + cardno += sdla_pci_probe(&tmp_hw); +# else + DEBUG_EVENT( "Warning, Kernel not compiled for PCI support!\n"); + DEBUG_EVENT( "PCI Hardware Probe Failed!\n"); +# endif + return cardno; +} +#else /* !LINUX */ +unsigned int sdla_hw_probe(void) +{ +#if !defined(SDLA_AUTO_PROBE) + sdlahw_card_t *hwcard; + int cnt = 0; +#endif + /* Probe ISA card */ +#if defined(WAN_ISA_SUPPORT) for(cnt=0; cnt< Sangoma_cards_no; cnt++){ + sdladev_t *dev = NULL; + sdla_pci_dev_t pci_dev = NULL; dev = &sdladev[cnt]; if (dev->type == SDLA_S508){ -#if defined(WAN_ISA_SUPPORT) - sdlahw_t* hw; + sdlahw_card_t *hwcard; + sdlahw_cpu_t *hwcpu; + sdlahw_t *hw; DEBUG_EVENT( "%s: S508-ISA card found, port 0x%x\n", wan_drvname, sdladev_ioport(dev)); hwcard = sdla_card_register( @@ -2146,8 +3109,8 @@ unsigned int sdla_hw_probe(void) hwcard->pci_dev = NULL; hwcard->cfg_type = WANOPT_S50X; - hw = sdla_hw_register(hwcard, SDLA_CPU_A, 0, dev); - if (hw == NULL){ + hwcpu = sdla_hwcpu_register(hwcard, SDLA_CPU_A, 0, dev); + if (hwcpu == NULL){ sdla_card_unregister ( SDLA_ISA_CARD, 0, @@ -2155,30 +3118,54 @@ unsigned int sdla_hw_probe(void) sdladev_ioport(dev)); continue; } - hw->irq = sdladev_irq(dev); - hw->dpmbase = sdladev_maddr(dev); + hwcpu->irq = sdladev_irq(dev); + hwcpu->dpmbase = sdladev_maddr(dev); #if defined(__NetBSD__) || defined(__OpenBSD__) - hw->ioh = dev->u.isa.ioh; + hwcpu->ioh = dev->u.isa.ioh; hwcard->iot = dev->sc->ia.ia_iot; hwcard->memt = dev->sc->ia.ia_memt; -#endif - sdla_save_hw_probe(hw, 1); - sdla_save_hw_probe(hw, 0); +#endif /* __NetBSD__ || __OpenBSD__ */ + sdla_hw_register(hwcpu, 1); + sdla_hw_register(hwcpu, 0); + card_no += 2; sdla_adapter_cnt.s508_adapters++; -# else - DEBUG_EVENT( "%s: S508-ISA card is not supported!\n", - wan_drvname); -# endif - continue; } + } +#endif + + +#if defined(SDLA_AUTO_PROBE) + sdlahw_card_t tmp_hwcard; + sdlahw_cpu_t tmp_hwcpu; + sdlahw_t tmp_hw; + unsigned int cardno=0; + + memset(&tmp_hw, 0, sizeof(tmp_hw)); + tmp_hwcpu.hwcard = &tmp_hwcard; + tmp_hw.hwcpu = &tmp_hwcpu; + tmp_hw.magic = SDLADRV_MAGIC; + + tmp_hwcard.hw_type = SDLA_PCI_CARD; + tmp_hwcard.slot_no = 0; + tmp_hwcard.bus_no = 0; + + cardno += sdla_pci_auto_probe(&tmp_hw); + return cardno; +#else + /* Probe PCI/PCI-Exp cards */ + for(cnt=0; cnt 400000) pci_dev = dev->sc->dev; # else pci_dev = dev->u.pci.pci_dev; -# endif +# endif /* __FreeBSD_version */ # else pci_dev = &dev->sc->pa; # endif @@ -2253,6 +3240,7 @@ unsigned int sdla_hw_probe(void) return Sangoma_devices_no; #endif } +#endif /* ***************************************************************************** @@ -2277,28 +3265,38 @@ void *sdla_get_hw_adptr_cnt (void) return &sdla_adapter_cnt; } -/* -***************************************************************************** -** sdla_card_register -***************************************************************************** -*/ -static sdlahw_card_t* -sdla_card_register(unsigned char hw_type, int slot_no, int bus_no, int ioport) + +/***************************************************************************** +** Hardware structure interface per Physical Card +*****************************************************************************/ +static int sdla_card_info(sdlahw_card_t *hwcard) +{ + WAN_ASSERT(hwcard == NULL); + if (hwcard->hw_type == SDLA_PCI_CARD){ + DEBUG_EVENT("%s: Card info: slot=%d,bus=%d!\n", + __FUNCTION__, + hwcard->slot_no, + hwcard->bus_no); + }else{ + DEBUG_EVENT("%s: Card info: ioport=%d!\n", + __FUNCTION__, + hwcard->ioport); + } + return 0; +} + +static sdlahw_card_t* sdla_card_register( unsigned char hw_type, + int slot_no, + int bus_no, + int ioport) { sdlahw_card_t *new_hwcard, *last_hwcard; new_hwcard = sdla_card_search(hw_type, slot_no, bus_no, ioport); if (new_hwcard){ - if (hw_type == SDLA_PCI_CARD){ - DEBUG_EVENT("%s: Card is already exists (slot=%d,bus=%d)!\n", - __FUNCTION__, - slot_no, - bus_no); - }else{ - DEBUG_EVENT("%s: Card is already exists (ioport=%d)!\n", - __FUNCTION__, - ioport); - } + + DEBUG_EVENT("%s: Card is already exists!\n", __FUNCTION__); + sdla_card_info(new_hwcard); return NULL; } new_hwcard = wan_malloc(sizeof(sdlahw_card_t)); @@ -2312,8 +3310,8 @@ sdla_card_register(unsigned char hw_type, int slot_no, int bus_no, int ioport) new_hwcard->slot_no = slot_no; new_hwcard->bus_no = bus_no; new_hwcard->ioport = ioport; - wan_spin_lock_init(&new_hwcard->pcard_lock); - wan_spin_lock_init(&new_hwcard->pcard_ec_lock); + wan_spin_lock_init(&new_hwcard->pcard_lock,"wan_hwcard_lock"); + wan_spin_lock_init(&new_hwcard->pcard_ec_lock,"wan_hwcard_ec_lock"); WAN_LIST_FOREACH(last_hwcard, &sdlahw_card_head, next){ if (!WAN_LIST_NEXT(last_hwcard, next)){ @@ -2329,13 +3327,10 @@ sdla_card_register(unsigned char hw_type, int slot_no, int bus_no, int ioport) return new_hwcard; } -/* -***************************************************************************** -** sdla_card_unregister -***************************************************************************** -*/ -static int -sdla_card_unregister (unsigned char hw_type, int slot_no, int bus_no, int ioport) +static int sdla_card_unregister( unsigned char hw_type, + int slot_no, + int bus_no, + int ioport) { sdlahw_card_t* tmp_card; @@ -2364,32 +3359,22 @@ sdla_card_unregister (unsigned char hw_type, int slot_no, int bus_no, int ioport } return -EFAULT; } - if (tmp_card->used){ - if (hw_type == SDLA_PCI_CARD){ - DEBUG_EVENT("%s: Error: This card is still in used (slot=%d,bus=%d,used=%d)\n", + if (tmp_card->internal_used){ + DEBUG_EVENT("%s: Error: This card is still in used (used=%d)!\n", __FUNCTION__, - slot_no, - bus_no, - tmp_card->used); - }else{ - DEBUG_EVENT("%s: Error: This card is still in used (ioport=%d,used=%d)\n", - __FUNCTION__, - ioport, - tmp_card->used); - } + tmp_card->internal_used); + sdla_card_info(tmp_card); return -EBUSY; } WAN_LIST_REMOVE(tmp_card, next); wan_free(tmp_card); return 0; } -/* -***************************************************************************** -** sdla_card_search -***************************************************************************** -*/ -static sdlahw_card_t* -sdla_card_search(unsigned char hw_type, int slot_no, int bus_no, int ioport) + +static sdlahw_card_t* sdla_card_search( unsigned char hw_type, + int slot_no, + int bus_no, + int ioport) { sdlahw_card_t* tmp_card; @@ -2413,45 +3398,200 @@ sdla_card_search(unsigned char hw_type, int slot_no, int bus_no, int ioport) return NULL; } +/***************************************************************************** +** Hardware structure interface per CPU +*****************************************************************************/ +static int sdla_hwcpu_info(sdlahw_cpu_t *hwcpu) +{ + + WAN_ASSERT(hwcpu == NULL); + WAN_ASSERT(hwcpu->hwcard == NULL); + if (hwcpu->hwcard->hw_type == SDLA_PCI_CARD){ + DEBUG_TEST("%s: HW Card Cpu info: slot=%d,bus=%d,cpu=%c!\n", + __FUNCTION__, + hwcpu->hwcard->slot_no, + hwcpu->hwcard->bus_no, + SDLA_GET_CPU(hwcpu->cpu_no)); + }else{ + DEBUG_TEST("%s: HW Card Cpu info: ioport=%d!\n", + __FUNCTION__, + hwcpu->hwcard->ioport); + } + return 0; +} + +static sdlahw_cpu_t* sdla_hwcpu_register( sdlahw_card_t *hwcard, + int cpu_no, + int irq, + void *sdla_dev) +{ + sdlahw_cpu_t *new_hwcpu, *last_hwcpu; + + new_hwcpu = sdla_hwcpu_search( (u8)hwcard->hw_type, + hwcard->slot_no, + hwcard->bus_no, + hwcard->ioport, + cpu_no); + if (new_hwcpu){ + DEBUG_TEST("%s: HW Card CPU is already exists!\n", + __FUNCTION__); + sdla_hwcpu_info(new_hwcpu); + return NULL; + } + new_hwcpu = wan_malloc(sizeof(sdlahw_cpu_t)); + if (!new_hwcpu) + return NULL; + + memset(new_hwcpu,0,sizeof(sdlahw_cpu_t)); + new_hwcpu->cpu_no = cpu_no; + new_hwcpu->irq = irq; + new_hwcpu->hwcard = hwcard; +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) + new_hwcpu->sdla_dev = sdla_dev; /* Internal kernel BSD structure */ +#endif + new_hwcpu->magic = SDLADRV_MAGIC; + hwcard->internal_used++; + + + WAN_LIST_FOREACH(last_hwcpu, &sdlahw_cpu_head, next){ + if (!WAN_LIST_NEXT(last_hwcpu, next)){ + break; + } + } + if (last_hwcpu){ + WAN_LIST_INSERT_AFTER(last_hwcpu, new_hwcpu, next); + }else{ + WAN_LIST_INSERT_HEAD(&sdlahw_cpu_head, new_hwcpu, next); + } + return new_hwcpu; +} + +static int sdla_hwcpu_unregister(sdlahw_cpu_t *hwcpu) +{ + + WAN_ASSERT(hwcpu == NULL); + if (hwcpu->internal_used){ + DEBUG_EVENT("%s: Error: HW Card Cpu is still in used (used=%d)\n", + __FUNCTION__, + hwcpu->internal_used); + sdla_hwcpu_info(hwcpu); + return -EBUSY; + } + if (hwcpu == WAN_LIST_FIRST(&sdlahw_cpu_head)){ + WAN_LIST_FIRST(&sdlahw_cpu_head) = WAN_LIST_NEXT(hwcpu, next); + }else{ + WAN_LIST_REMOVE(hwcpu, next); + } + + hwcpu->hwcard->internal_used--; /* Decrement card usage */ + hwcpu->hwcard = NULL; + wan_free(hwcpu); + return 0; +} + +static sdlahw_cpu_t* sdla_hwcpu_search( unsigned char hw_type, + int slot_no, + int bus_no, + int ioport, + int cpu_no) +{ + sdlahw_cpu_t* tmp_hwcpu; + + WAN_LIST_FOREACH(tmp_hwcpu, &sdlahw_cpu_head, next){ + WAN_ASSERT_RC(tmp_hwcpu->hwcard == NULL, NULL); + if (tmp_hwcpu->hwcard->hw_type != hw_type){ + continue; + } + switch(hw_type){ + case SDLA_PCI_CARD: + if (tmp_hwcpu->hwcard->slot_no == slot_no && + tmp_hwcpu->hwcard->bus_no == bus_no && + tmp_hwcpu->cpu_no == cpu_no){ + return tmp_hwcpu; + } + break; + case SDLA_ISA_CARD: + if (tmp_hwcpu->hwcard->ioport == ioport){ + return tmp_hwcpu; + } + break; + } + } + return NULL; +} + /* ***************************************************************************** -** sdla_cpu_register +** Hardware structure interface per Port ***************************************************************************** */ -static sdlahw_t* -sdla_hw_register(sdlahw_card_t* hwcard, int cpu_no, int irq, void* dev) +static int sdla_hw_info(sdlahw_t *hw) +{ + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + + if (hw->hwcpu->hwcard->hw_type == SDLA_PCI_CARD){ + DEBUG_TEST("%s: HW Port info: slot=%d,bus=%d,cpu=%c,port=%d!\n", + __FUNCTION__, + hw->hwcpu->hwcard->slot_no, + hw->hwcpu->hwcard->bus_no, + SDLA_GET_CPU(hw->hwcpu->cpu_no), + hw->port_no); + }else{ + DEBUG_TEST("%s: HW Port info: ioport=%d,port=%d!\n", + __FUNCTION__, + hw->hwcpu->hwcard->ioport, + hw->port_no); + } + return 0; +} + +static sdlahw_t* sdla_hw_register( sdlahw_cpu_t *hwcpu, + int port_no) { sdlahw_t *new_hw, *last_hw; + sdla_hw_probe_t *hwprobe, *tmp_hwprobe; - new_hw = sdla_hw_search(hwcard->hw_type, hwcard->slot_no, hwcard->bus_no, hwcard->ioport, cpu_no); + new_hw = sdla_hw_search(hwcpu, port_no); if (new_hw){ - if (hwcard->hw_type == SDLA_PCI_CARD){ - DEBUG_TEST("%s: CPU is already exists (slot=%d,bus=%d,cpu=%c)!\n", + DEBUG_TEST( + "%s: Port is already exists (slot=%d,bus=%d,cpu=%c,port=%d)!\n", __FUNCTION__, - hwcard->slot_no, - hwcard->bus_no, - SDLA_GET_CPU(cpu_no)); - }else{ - DEBUG_TEST("%s: CPU is already exists (ioport=%d)!\n", - __FUNCTION__, - hwcard->ioport); - } + hwcpu->hwcard->slot_no, + hwcpu->hwcard->bus_no, + hwcpu->cpu_no, + port_no); + sdla_hw_info(new_hw); return NULL; } new_hw = wan_malloc(sizeof(sdlahw_t)); if (!new_hw) return NULL; + + hwprobe = wan_malloc(sizeof(sdla_hw_probe_t)); + if (!hwprobe){ + wan_free(new_hw); + return NULL; + } + memset(hwprobe,0,sizeof(sdla_hw_probe_t)); + memset(hwprobe->hw_info, '\0', 100); + memset(hwprobe->hw_info_verbose, '\0', 500); memset(new_hw,0,sizeof(sdlahw_t)); - new_hw->devname = NULL; - new_hw->cpu_no = cpu_no; - new_hw->irq = irq; - new_hw->hwcard = hwcard; - new_hw->dev = dev; + new_hw->devname = SDLA_HWPROBE_NAME; + new_hw->hwcpu = hwcpu; new_hw->magic = SDLADRV_MAGIC; - hwcard->used++; + new_hw->port_no = port_no; - + hwcpu->internal_used++; + hwcpu->max_ports++; + hwcpu->hwport[port_no] = new_hw; + + new_hw->hwprobe = hwprobe; + hwprobe->internal_used++; + + /* Link new hw port */ WAN_LIST_FOREACH(last_hw, &sdlahw_head, next){ if (!WAN_LIST_NEXT(last_hw, next)){ break; @@ -2461,113 +3601,85 @@ sdla_hw_register(sdlahw_card_t* hwcard, int cpu_no, int irq, void* dev) WAN_LIST_INSERT_AFTER(last_hw, new_hw, next); }else{ WAN_LIST_INSERT_HEAD(&sdlahw_head, new_hw, next); - } - return new_hw; -} -/* -***************************************************************************** -** sdla_hw_unregister -***************************************************************************** -*/ -static int -sdla_hw_unregister (sdlahw_card_t* hwcard, int cpu_no) -{ - sdlahw_t* tmp_hw; - int i; - - WAN_LIST_FOREACH(tmp_hw, &sdlahw_head, next){ - if (tmp_hw->hwcard != hwcard){ - continue; - } - if (tmp_hw->cpu_no == cpu_no){ + /* Link new hw probe */ + WAN_LIST_FOREACH(tmp_hwprobe, &sdlahw_probe_head, next){ + if (!WAN_LIST_NEXT(tmp_hwprobe, next)){ break; } } - if (tmp_hw == NULL){ - if (hwcard->hw_type == SDLA_PCI_CARD){ - DEBUG_EVENT("%s: Error: Devive didn't find (slot=%d,bus=%d,cpu=%c)\n", - __FUNCTION__, - hwcard->slot_no, - hwcard->bus_no, - SDLA_GET_CPU(cpu_no)); - }else{ - DEBUG_EVENT("%s: Error: Device didn't find (ioport=%d,cpu=%c)\n", - __FUNCTION__, - hwcard->ioport, - SDLA_GET_CPU(cpu_no)); - } - return -EFAULT; + if (tmp_hwprobe){ + WAN_LIST_INSERT_AFTER(tmp_hwprobe, hwprobe, next); + }else{ + WAN_LIST_INSERT_HEAD(&sdlahw_probe_head, hwprobe, next); } - if (tmp_hw->used){ - if (hwcard->hw_type == SDLA_PCI_CARD){ - DEBUG_EVENT("%s: Error: This cpu is still in used (slot=%d,bus=%d,cpu=%c,used=%d)\n", + + return new_hw; +} + +static int sdla_hw_unregister (sdlahw_t* hw) +{ + sdla_hw_probe_t *hwprobe; + + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + + if (hw->internal_used){ + DEBUG_EVENT( + "%s: Error: HW Port is still in used (used=%d)\n", __FUNCTION__, - hwcard->slot_no, - hwcard->bus_no, - SDLA_GET_CPU(cpu_no), - hwcard->used); - }else{ - DEBUG_EVENT("%s: Error: This cpu is still in used (ioport=%d, used=%d)\n", - __FUNCTION__, - hwcard->ioport, - hwcard->used); - } + hw->internal_used); + sdla_hw_info(hw); return -EBUSY; } - for(i = 0; i < SDLA_MAX_PORTS; i++){ - if (tmp_hw->hwport[i].hwprobe){ - tmp_hw->hwport[i].hwprobe->used--; - tmp_hw->hwport[i].hwprobe = NULL; - } - } - tmp_hw->hwcard = NULL; - hwcard->used--; /* Decrement card usage */ - WAN_LIST_REMOVE(tmp_hw, next); - wan_free(tmp_hw); + hwprobe = hw->hwprobe; + hwprobe->internal_used--; + hw->hwprobe = NULL; + + hw->hwcpu->hwport[hw->port_no] = NULL; + + hw->hwcpu->internal_used--; /* Decrement card usage */ + hw->hwcpu = NULL; + + if (hw == WAN_LIST_FIRST(&sdlahw_head)){ + WAN_LIST_FIRST(&sdlahw_head) = WAN_LIST_NEXT(hw, next); + }else{ + WAN_LIST_REMOVE(hw, next); + } + wan_free(hw); + + if (hwprobe->internal_used == 0){ + if (hwprobe == WAN_LIST_FIRST(&sdlahw_probe_head)){ + WAN_LIST_FIRST(&sdlahw_probe_head) = WAN_LIST_NEXT(hwprobe, next); + }else{ + WAN_LIST_REMOVE(hwprobe, next); + } + wan_free(hwprobe); + }else{ + DEBUG_EVENT("%s: Error: HWPROBE is still in used %d\n", + __FUNCTION__, hwprobe->internal_used); + } + return 0; } -/* -***************************************************************************** -** sdla_cpu_search -***************************************************************************** -*/ -static sdlahw_t* -sdla_hw_search(unsigned char hw_type, int slot_no, int bus_no, int ioport, int cpu_no) +static sdlahw_t* sdla_hw_search(sdlahw_cpu_t *hwcpu, int port_no) { sdlahw_t* tmp_hw; WAN_LIST_FOREACH(tmp_hw, &sdlahw_head, next){ - if (tmp_hw->hwcard == NULL){ - DEBUG_EVENT("%s: Critical Error: line %d\n", - __FUNCTION__,__LINE__); + WAN_ASSERT_RC(tmp_hw->hwcpu == NULL, NULL); + if (tmp_hw->hwcpu != hwcpu || tmp_hw->port_no != port_no){ continue; } - if (tmp_hw->hwcard->hw_type != hw_type){ - continue; - } - switch(hw_type){ - case SDLA_PCI_CARD: - if (tmp_hw->hwcard->slot_no == slot_no && - tmp_hw->hwcard->bus_no == bus_no && - tmp_hw->cpu_no == cpu_no){ - return tmp_hw; - } - break; - case SDLA_ISA_CARD: - if (tmp_hw->hwcard->ioport == ioport){ - return tmp_hw; - } - break; - } + return tmp_hw; } return NULL; } - /* ***************************************************************************** ***************************************************************************** @@ -2584,21 +3696,28 @@ EXPORT_SYMBOL(sdla_register); void* sdla_register(sdlahw_iface_t* hw_iface, wandev_conf_t* conf, char* devname) { - sdlahw_card_t* hwcard = NULL; - sdlahw_t* hw = NULL; - + sdlahw_card_t *hwcard = NULL; + sdlahw_cpu_t *hwcpu; + sdlahw_t *hw = NULL; + +#if defined(__WINDOWS__) + hw = hw_iface->hw; +#else if (sdla_register_check(conf, devname)){ return NULL; } - hw = sdla_find_adapter(conf, devname); - if (hw == NULL || hw->hwcard == NULL || hw->used >= hw->max_ports){ +#endif + if (hw == NULL || hw->used){ return NULL; } - hwcard = hw->hwcard; + WAN_ASSERT_RC(hw->hwcpu == NULL, NULL); + WAN_ASSERT_RC(hw->hwcpu->hwcard == NULL, NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; hw_iface->setup = sdla_setup; - hw_iface->hw_down = sdla_down; + hw_iface->hw_down = sdla_down; #if defined(CONFIG_PRODUCT_WANPIPE_GENERIC) hw_iface->load = sdla_load; #endif @@ -2610,6 +3729,7 @@ void* sdla_register(sdlahw_iface_t* hw_iface, wandev_conf_t* conf, char* devname hw_iface->poke = sdla_poke; hw_iface->poke_byte = sdla_poke_byte; hw_iface->getcfg = sdla_getcfg; + hw_iface->setcfg = sdla_setcfg; #if defined(WAN_ISA_SUPPORT) hw_iface->isa_read_1 = sdla_isa_read_1; hw_iface->isa_write_1 = sdla_isa_write_1; @@ -2632,11 +3752,13 @@ void* sdla_register(sdlahw_iface_t* hw_iface, wandev_conf_t* conf, char* devname hw_iface->get_hwprobe = sdla_get_hwprobe; hw_iface->hw_lock = sdla_hw_lock; hw_iface->hw_unlock = sdla_hw_unlock; + hw_iface->hw_ec_trylock = sdla_hw_ec_trylock; hw_iface->hw_ec_lock = sdla_hw_ec_lock; hw_iface->hw_ec_unlock = sdla_hw_ec_unlock; hw_iface->pci_map_dma = sdla_pci_map_dma; hw_iface->pci_unmap_dma = sdla_pci_unmap_dma; hw_iface->hw_same = sdla_is_same_hwcard; + hw_iface->hwcpu_same = sdla_is_same_hwcpu; hw_iface->fe_test_and_set_bit = sdla_hw_fe_test_and_set_bit; hw_iface->fe_set_bit = sdla_hw_fe_set_bit; hw_iface->fe_test_bit = sdla_hw_fe_test_bit; @@ -2652,7 +3774,7 @@ void* sdla_register(sdlahw_iface_t* hw_iface, wandev_conf_t* conf, char* devname devname, SDLA_DECODE_CARDTYPE(hwcard->cfg_type), hwcard->ioport, - hw->irq); + hwcpu->irq); break; case WANOPT_S51X: @@ -2672,7 +3794,7 @@ void* sdla_register(sdlahw_iface_t* hw_iface, wandev_conf_t* conf, char* devname DEBUG_EVENT("%s: Found: %s card, CPU %c, PciSlot=%d, PciBus=%d\n", devname, SDLA_DECODE_CARDTYPE(hwcard->cfg_type), - SDLA_GET_CPU(hw->cpu_no), + SDLA_GET_CPU(hwcpu->cpu_no), hwcard->slot_no, hwcard->bus_no); break; @@ -2688,7 +3810,7 @@ void* sdla_register(sdlahw_iface_t* hw_iface, wandev_conf_t* conf, char* devname DEBUG_EVENT("%s: Found: %s card, CPU %c, PciSlot=%d, PciBus=%d\n", devname, SDLA_DECODE_CARDTYPE(hwcard->cfg_type), - SDLA_GET_CPU(hw->cpu_no), + SDLA_GET_CPU(hwcpu->cpu_no), hwcard->slot_no, hwcard->bus_no); break; @@ -2702,6 +3824,8 @@ void* sdla_register(sdlahw_iface_t* hw_iface, wandev_conf_t* conf, char* devname case WANOPT_AFT_ANALOG: case WANOPT_AFT_ISDN: case WANOPT_AFT_56K: + case WANOPT_AFT_SERIAL: + hwcard->type = SDLA_AFT; hw_iface->set_bit = sdla_set_bit; hw_iface->clear_bit = sdla_clear_bit; @@ -2713,41 +3837,82 @@ void* sdla_register(sdlahw_iface_t* hw_iface, wandev_conf_t* conf, char* devname hw_iface->pci_write_config_dword = sdla_pci_write_config_dword; hw_iface->pci_bridge_read_config_dword = sdla_pci_bridge_read_config_dword; + hw_iface->pci_bridge_read_config_byte = sdla_pci_bridge_read_config_byte; hw_iface->pci_bridge_write_config_dword = sdla_pci_bridge_write_config_dword; + hw_iface->pci_bridge_write_config_byte = sdla_pci_bridge_write_config_byte; hw_iface->read_cpld = sdla_hw_read_cpld; hw_iface->write_cpld = sdla_hw_write_cpld; - switch(hw->hwcard->adptr_type){ + /* PCI DMA interface access */ + hw_iface->busdma_descr_alloc = sdla_busdma_descr_alloc; + hw_iface->busdma_descr_free = sdla_busdma_descr_free; + hw_iface->busdma_tag_create = sdla_busdma_tag_create; + hw_iface->busdma_tag_destroy = sdla_busdma_tag_destroy; + hw_iface->busdma_create = sdla_busdma_create; + hw_iface->busdma_destroy = sdla_busdma_destroy; + hw_iface->busdma_alloc = sdla_busdma_alloc; + hw_iface->busdma_free = sdla_busdma_free; + hw_iface->busdma_load = sdla_busdma_load; + hw_iface->busdma_unload = sdla_busdma_unload; + hw_iface->busdma_map = sdla_busdma_map; + hw_iface->busdma_unmap = sdla_busdma_unmap; + hw_iface->busdma_sync = sdla_busdma_sync; + /* Old PCI DMA interface access */ + hw_iface->pci_map_dma = sdla_pci_map_dma; + hw_iface->pci_unmap_dma = sdla_pci_unmap_dma; + + hw_iface->get_hwec_index = sdla_get_hwec_index; + + switch(hwcard->adptr_type){ case A101_ADPTR_1TE1: case A101_ADPTR_2TE1: - if (hw->hwcard->adptr_subtype == AFT_SUBTYPE_NORMAL){ + if (hwcard->adptr_subtype == AFT_SUBTYPE_NORMAL){ hw_iface->fe_read = sdla_te1_read_fe; hw_iface->fe_write = sdla_te1_write_fe; }else{ hw_iface->fe_read = sdla_shark_te1_read_fe; + hw_iface->__fe_read = __sdla_shark_te1_read_fe; hw_iface->fe_write = sdla_shark_te1_write_fe; } break; case A104_ADPTR_4TE1: case A108_ADPTR_8TE1: hw_iface->fe_read = sdla_shark_te1_read_fe; + hw_iface->__fe_read = __sdla_shark_te1_read_fe; hw_iface->fe_write = sdla_shark_te1_write_fe; break; case AFT_ADPTR_56K: hw_iface->fe_read = sdla_shark_56k_read_fe; + hw_iface->__fe_read = __sdla_shark_56k_read_fe; hw_iface->fe_write = sdla_shark_56k_write_fe; break; case A200_ADPTR_ANALOG: case A400_ADPTR_ANALOG: hw_iface->fe_read = sdla_shark_rm_read_fe; + hw_iface->__fe_read = __sdla_shark_rm_read_fe; hw_iface->fe_write = sdla_shark_rm_write_fe; - case AFT_ADPTR_ISDN: - DEBUG_EVENT("%s: Front-End interface functions are not defined!\n", - devname); break; + case A300_ADPTR_U_1TE3: + hw_iface->fe_read = sdla_te3_read_fe; + hw_iface->fe_write = sdla_te3_write_fe; + break; +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_BRI) + case AFT_ADPTR_ISDN: + hw_iface->fe_read = sdla_shark_bri_read_fe; + hw_iface->fe_write = sdla_shark_bri_write_fe; + break; +#endif + case AFT_ADPTR_2SERIAL_V35X21: + case AFT_ADPTR_4SERIAL_V35X21: + case AFT_ADPTR_2SERIAL_RS232: + case AFT_ADPTR_4SERIAL_RS232: + hw_iface->fe_read = sdla_shark_serial_read_fe; + hw_iface->fe_write = sdla_shark_serial_write_fe; + break; + } - switch(hw->hwcard->adptr_type){ + switch(hwcard->adptr_type){ case A101_ADPTR_1TE1: case A101_ADPTR_2TE1: case A104_ADPTR_4TE1: @@ -2756,10 +3921,14 @@ void* sdla_register(sdlahw_iface_t* hw_iface, wandev_conf_t* conf, char* devname case A400_ADPTR_ANALOG: case AFT_ADPTR_ISDN: case AFT_ADPTR_56K: + case AFT_ADPTR_2SERIAL_V35X21: + case AFT_ADPTR_4SERIAL_V35X21: + case AFT_ADPTR_2SERIAL_RS232: + case AFT_ADPTR_4SERIAL_RS232: DEBUG_EVENT("%s: Found: %s card, CPU %c, PciSlot=%d, PciBus=%d, Port=%d\n", devname, SDLA_DECODE_CARDTYPE(hwcard->cfg_type), - SDLA_GET_CPU(hw->cpu_no), + SDLA_GET_CPU(hwcpu->cpu_no), hwcard->slot_no, hwcard->bus_no, (conf) ? conf->comm_port : hw->used); @@ -2768,7 +3937,7 @@ void* sdla_register(sdlahw_iface_t* hw_iface, wandev_conf_t* conf, char* devname DEBUG_EVENT("%s: Found: %s card, CPU %c, PciSlot=%d, PciBus=%d\n", devname, SDLA_DECODE_CARDTYPE(hwcard->cfg_type), - SDLA_GET_CPU(hw->cpu_no), + SDLA_GET_CPU(hwcpu->cpu_no), hwcard->slot_no, hwcard->bus_no); break; @@ -2776,9 +3945,10 @@ void* sdla_register(sdlahw_iface_t* hw_iface, wandev_conf_t* conf, char* devname break; default: - DEBUG_EVENT("%s: ERROR, invalid card type! 0x%X\n", - devname, - hwcard->cfg_type); + DEBUG_EVENT("%s:%d: %s: (2) ERROR, invalid card type! 0x%X\n", + __FUNCTION__,__LINE__, + devname, + hwcard->cfg_type); return NULL; } @@ -2786,13 +3956,23 @@ void* sdla_register(sdlahw_iface_t* hw_iface, wandev_conf_t* conf, char* devname /* NC: * Increment the usage count when we know * for sure that the hw has been taken */ - hw->hwport[(conf)?conf->comm_port:hw->used].used++; - hw->hwport[(conf)?conf->comm_port:hw->used].devname = devname; - if (!hw->used){ - hw->devname = devname; - } hw->used++; + hw->hwcpu->used++; + hw->devname = devname; + /* ISDN-BRI logial used cnt */ + if (hwcard->adptr_type == AFT_ADPTR_ISDN){ + int port; + /* Add special code for BRI */ + port = hw->port_no / 2; + port *= 2; + hw->hwcpu->reg_port[port]++; + hw->hwcpu->reg_port[port+1]++; + }else{ + hw->hwcpu->reg_port[0]++; + } + /* Set bit for specific port */ + wan_set_bit(hw->port_no, &hw->hwcpu->reg_port_map); return hw; } @@ -2806,24 +3986,31 @@ EXPORT_SYMBOL(sdla_unregister); int sdla_unregister(void** p_hw, char* devname) { sdlahw_t* hw = *(sdlahw_t**)p_hw; - int port; + sdlahw_cpu_t *hwcpu; - if (hw){ - for(port = 0; port < SDLA_MAX_PORTS; port++){ - if (hw->hwport[port].devname == devname){ - hw->hwport[port].devname = NULL; - hw->hwport[port].used--; - break; - } - } + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; - hw->used--; - if (!hw->used){ - hw->devname = NULL; - } - - *p_hw = NULL; + /* ISDN-BRI logial used cnt */ + if (hwcpu->hwcard->adptr_type == AFT_ADPTR_ISDN){ + int port; + /* Add special code for BRI */ + port = hw->port_no / 2; + port *= 2; + hw->hwcpu->reg_port[port]--; + hw->hwcpu->reg_port[port+1]--; + }else{ + hw->hwcpu->reg_port[0]--; } + /* Clear bit for specific port */ + wan_clear_bit(hw->port_no, &hw->hwcpu->reg_port_map); + + hw->used--; + hw->hwcpu->used--; + hw->devname = SDLA_HWPROBE_NAME; + *p_hw = NULL; return 0; } @@ -2935,6 +4122,16 @@ static int sdla_register_check (wandev_conf_t* conf, char* devname) } break; + case WANOPT_AFT_ISDN: + if (conf->auto_pci_cfg && sdla_adapter_cnt.aft200_adapters > 1){ + DEBUG_EVENT( "%s: HW Auto PCI failed: Multiple AFT-ISDN BRI cards found! \n" + "%s: Disable the Autodetect feature and supply\n" + "%s: the PCI Slot and Bus numbers for each card.\n", + devname,devname,devname); + return -EINVAL; + } + break; + case WANOPT_AFT300: if (conf->auto_pci_cfg && sdla_adapter_cnt.aft300_adapters > 1){ DEBUG_EVENT( "%s: HW Auto PCI failed: Multiple AFT-300 cards found! \n" @@ -2956,6 +4153,16 @@ static int sdla_register_check (wandev_conf_t* conf, char* devname) } break; + case WANOPT_AFT_SERIAL: + if (conf->auto_pci_cfg && sdla_adapter_cnt.aft_serial_adapters > 1){ + DEBUG_EVENT( "%s: HW Auto PCI failed: Multiple AFT-SERIAL cards found! \n" + "%s: Disable the Autodetect feature and supply\n" + "%s: the PCI Slot and Bus numbers for each card.\n", + devname,devname,devname); + return -EINVAL; + } + break; + default: DEBUG_EVENT("%s: Unsupported Sangoma Card (0x%X) requested by user!\n", devname,conf->card_type); @@ -2980,16 +4187,21 @@ static int sdla_register_check (wandev_conf_t* conf, char* devname) static int sdla_setup (void* phw, wandev_conf_t* conf) { sdlahw_card_t* hwcard = NULL; + sdlahw_cpu_t* hwcpu = NULL; sdlahw_t* hw = (sdlahw_t*)phw; +#if defined(WAN_ISA_SUPPORT) unsigned* irq_opt = NULL; /* IRQ options */ unsigned* dpmbase_opt = NULL; /* DPM window base options */ unsigned* pclk_opt = NULL; /* CPU clock rate options */ +#endif int err=0; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; /* ALEX VVVV*/ /* for an S514 adapter, pass the CPU number and the slot number read */ /* from 'router.conf' to the 'sdla_setup()' function via the 'port' */ @@ -3031,9 +4243,9 @@ static int sdla_setup (void* phw, wandev_conf_t* conf) #if 0 hw->port = conf->ioport; #endif - hw->irq = (conf && conf->irq == 9) ? 2 : conf->irq; + hwcpu->irq = (conf && conf->irq == 9) ? 2 : conf->irq; if(conf && conf->maddr){ - hw->dpmbase = (sdla_mem_handle_t)phys_to_virt(conf->maddr); + hwcpu->dpmbase = (sdla_mem_handle_t)phys_to_virt(conf->maddr); } break; @@ -3055,37 +4267,42 @@ static int sdla_setup (void* phw, wandev_conf_t* conf) } hw->dpmbase = (sdla_mem_handle_t)conf->maddr; #endif - hw->fwid = SFID_ADSL; + hwcpu->fwid = SFID_ADSL; break; case SDLA_AFT: - switch(hw->hwcard->adptr_type){ + switch(hwcard->adptr_type){ case A101_ADPTR_1TE1: case A101_ADPTR_2TE1: case A104_ADPTR_4TE1: case A108_ADPTR_8TE1: case A200_ADPTR_ANALOG: case A400_ADPTR_ANALOG: + case AFT_ADPTR_ISDN: case AFT_ADPTR_56K: - if (hw->used > 1){ - if (conf) conf->irq = hw->irq; + case AFT_ADPTR_2SERIAL_V35X21: + case AFT_ADPTR_4SERIAL_V35X21: + case AFT_ADPTR_2SERIAL_RS232: + case AFT_ADPTR_4SERIAL_RS232: + if (hwcpu->used > 1){ + if (conf) conf->irq = hwcpu->irq; return 0; } break; } - hw->fwid = SFID_AFT; + hwcpu->fwid = SFID_AFT; break; default: DEBUG_EVENT("%s: Invalid card type %x\n", - hw->devname, hw->hwcard->type); + hw->devname, hwcard->type); return -EINVAL; } - hw->dpmsize = SDLA_WINDOWSIZE; - hw->pclk = (conf) ? conf->hw_opt[1] : 0; + hwcpu->dpmsize = SDLA_WINDOWSIZE; + hwcpu->pclk = (conf) ? conf->hw_opt[1] : 0; if (sdla_detect(hw) != 0) { return -ENODEV; @@ -3100,45 +4317,44 @@ static int sdla_setup (void* phw, wandev_conf_t* conf) DEBUG_EVENT("%s: found S%04u card at port 0x%X.\n", hw->devname, hwcard->type, hwcard->ioport); - hw->dpmsize = SDLA_WINDOWSIZE; + hwcpu->dpmsize = SDLA_WINDOWSIZE; - switch(hwcard->type){ #if defined(WAN_ISA_SUPPORT) + switch(hwcard->type){ case SDLA_S502A: - hw->io_range = S502A_IORANGE; + hwcpu->io_range = S502A_IORANGE; irq_opt = s502a_irq_options; dpmbase_opt = s502a_dpmbase_options; pclk_opt = s502a_pclk_options; break; case SDLA_S502E: - hw->io_range = S502E_IORANGE; + hwcpu->io_range = S502E_IORANGE; irq_opt = s502e_irq_options; dpmbase_opt = s508_dpmbase_options; pclk_opt = s502e_pclk_options; break; case SDLA_S503: - hw->io_range = S503_IORANGE; + hwcpu->io_range = S503_IORANGE; irq_opt = s503_irq_options; dpmbase_opt = s508_dpmbase_options; pclk_opt = s503_pclk_options; break; case SDLA_S507: - hw->io_range = S507_IORANGE; + hwcpu->io_range = S507_IORANGE; irq_opt = s508_irq_options; dpmbase_opt = s507_dpmbase_options; pclk_opt = s507_pclk_options; break; case SDLA_S508: - hw->io_range = S508_IORANGE; + hwcpu->io_range = S508_IORANGE; irq_opt = s508_irq_options; dpmbase_opt = s508_dpmbase_options; pclk_opt = s508_pclk_options; break; -#endif default: DEBUG_EVENT("%s: Unknown card type (%02X)!\n", hw->devname, hwcard->type); @@ -3146,26 +4362,26 @@ static int sdla_setup (void* phw, wandev_conf_t* conf) } /* Verify IRQ configuration options */ - if (!sdla_get_option_index(irq_opt, hw->irq)) { + if (!sdla_get_option_index(irq_opt, hwcpu->irq)) { DEBUG_EVENT("%s: IRQ %d is illegal!\n", - hw->devname, hw->irq); + hw->devname, hwcpu->irq); return -EINVAL; } /* Verify CPU clock rate configuration options */ - if (hw->pclk == 0) - hw->pclk = pclk_opt[1]; /* use default */ + if (hwcpu->pclk == 0) + hwcpu->pclk = pclk_opt[1]; /* use default */ - else if (!sdla_get_option_index(pclk_opt, hw->pclk)) { + else if (!sdla_get_option_index(pclk_opt, hwcpu->pclk)) { DEBUG_EVENT("%s: CPU clock %u is illegal!\n", - hw->devname, hw->pclk); + hw->devname, hwcpu->pclk); return -EINVAL; } DEBUG_EVENT("%s: assuming CPU clock rate of %u kHz.\n", - hw->devname, hw->pclk); + hw->devname, hwcpu->pclk); /* Setup adapter dual-port memory window and test memory */ - if (hw->dpmbase == 0) { + if (hwcpu->dpmbase == 0) { err = sdla_autodpm(hw); if (err) { DEBUG_EVENT("%s: can't find available memory region!\n", @@ -3174,60 +4390,61 @@ static int sdla_setup (void* phw, wandev_conf_t* conf) } } else if (!sdla_get_option_index(dpmbase_opt, - virt_to_phys((void*)hw->dpmbase))) { + virt_to_phys((void*)hwcpu->dpmbase))) { DEBUG_EVENT("%s: memory address 0x%lX is illegal!\n", hw->devname, - (unsigned long)virt_to_phys((void*)hw->dpmbase)); + (unsigned long)virt_to_phys((void*)hwcpu->dpmbase)); return -EINVAL; } else if (sdla_setdpm(hw)) { DEBUG_EVENT("%s: 8K memory region at 0x%lX is not available!\n", hw->devname, - (unsigned long)virt_to_phys((void*)hw->dpmbase)); + (unsigned long)virt_to_phys((void*)hwcpu->dpmbase)); return -EINVAL; } DEBUG_EVENT("%s: dual-port memory window is set at 0x%lX.\n", - hw->devname, (unsigned long)virt_to_phys((void*)hw->dpmbase)); + hw->devname, (unsigned long)virt_to_phys((void*)hwcpu->dpmbase)); /* If we find memory in 0xE**** Memory region, * warn the user to disable the SHADOW RAM. * Since memory corruption can occur if SHADOW is * enabled. This can causes random crashes ! */ - if (virt_to_phys((void*)hw->dpmbase) >= 0xE0000){ + if (virt_to_phys((void*)hwcpu->dpmbase) >= 0xE0000){ DEBUG_EVENT("\n(WARNING) %s: !!!!!!!! WARNING !!!!!!!!\n",hw->devname); DEBUG_EVENT("(WANRINIG) %s: WANPIPE is using 0x%lX memory region !!!\n", hw->devname, - (unsigned long)virt_to_phys((void*)hw->dpmbase)); + (unsigned long)virt_to_phys((void*)hwcpu->dpmbase)); DEBUG_EVENT("(WARNING) Please disable the SHADOW RAM, otherwise\n"); DEBUG_EVENT("(WARNING) your system might crash randomly from time to time !\n"); DEBUG_EVENT("(WARNING) %s: !!!!!!!! WARNING !!!!!!!!\n\n",hw->devname); } +#endif break; case SDLA_S514: - if (conf) conf->irq = hw->irq; + if (conf) conf->irq = hwcpu->irq; if (conf && conf->config_id == WANCONFIG_DEBUG){ - hw->memory = MAX_SIZEOF_S514_MEMORY; + hwcpu->memory = MAX_SIZEOF_S514_MEMORY; return 0; } - hw->memory = sdla_test_memregion(hw, MAX_SIZEOF_S514_MEMORY); - if(hw->memory < (256 * 1024)) { + hwcpu->memory = sdla_test_memregion(hw, MAX_SIZEOF_S514_MEMORY); + if(hwcpu->memory < (256 * 1024)) { DEBUG_EVENT("%s: error in testing S514 memory (0x%lX)\n", - hw->devname, hw->memory); + hw->devname, hwcpu->memory); sdla_down(hw); return -EINVAL; } break; case SDLA_ADSL: - if (conf) conf->irq = hw->irq; + if (conf) conf->irq = hwcpu->irq; return 0; break; case SDLA_AFT: - if (conf) conf->irq = hw->irq; + if (conf) conf->irq = hwcpu->irq; return 0; break; @@ -3238,7 +4455,7 @@ static int sdla_setup (void* phw, wandev_conf_t* conf) } DEBUG_EVENT("%s: found %luK bytes of on-board memory\n", - hw->devname, hw->memory / 1024); + hw->devname, hwcpu->memory / 1024); /* Load firmware. If loader fails then shut down adapter */ if (conf){ @@ -3258,13 +4475,16 @@ static int sdla_setup (void* phw, wandev_conf_t* conf) */ static unsigned char sdla_make_config_byte (sdlahw_t* hw) { - sdlahw_card_t* card = NULL; + sdlahw_card_t *hwcard = NULL; + sdlahw_cpu_t *hwcpu; unsigned char byte = 0; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; - switch (hw->pclk) { + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + switch (hwcpu->pclk) { case 5000: byte = 0x01; break; case 7200: byte = 0x02; break; case 8000: byte = 0x03; break; @@ -3272,7 +4492,7 @@ static unsigned char sdla_make_config_byte (sdlahw_t* hw) case 16000: byte = 0x05; break; } - switch (card->type) { + switch (hwcard->type) { case SDLA_S502E: byte |= 0x80; break; case SDLA_S503: byte |= 0x40; break; } @@ -3287,11 +4507,14 @@ static unsigned char sdla_make_config_byte (sdlahw_t* hw) static int sdla_bootcfg (sdlahw_t* hw, sfm_info_t* sfminfo) { sdlahw_card_t* card = NULL; + sdlahw_cpu_t *hwcpu; unsigned int offset = 0; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + card = hwcpu->hwcard; if (!sfminfo->datasize) return 0; /* nothing to do */ if (sdla_mapmem(hw, sfminfo->dataoffs) != 0) @@ -3300,7 +4523,7 @@ static int sdla_bootcfg (sdlahw_t* hw, sfm_info_t* sfminfo) if (card->type == SDLA_S514){ offset = sfminfo->dataoffs; }else{ - offset = sfminfo->dataoffs - (unsigned long)hw->vector; + offset = sfminfo->dataoffs - (unsigned long)hwcpu->vector; } sdla_bus_set_region_1(hw, 0x00, 0x00, sfminfo->datasize); @@ -3331,7 +4554,8 @@ static int sdla_bootcfg (sdlahw_t* hw, sfm_info_t* sfminfo) */ static int sdla_start (sdlahw_t* hw, unsigned addr) { - sdlahw_card_t* card = NULL; + sdlahw_card_t* hwcard = NULL; + sdlahw_cpu_t* hwcpu; unsigned int offset = 0; int err; #if defined(WAN_ISA_SUPPORT) @@ -3341,11 +4565,13 @@ static int sdla_start (sdlahw_t* hw, unsigned addr) WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; - if (!card->ioport && (card->type != SDLA_S514)) return -EFAULT; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + if (!hwcard->ioport && (hwcard->type != SDLA_S514)) return -EFAULT; - switch (card->type) { + switch (hwcard->type) { #if defined(WAN_ISA_SUPPORT) case SDLA_S502A: offset = 0x66; @@ -3367,18 +4593,18 @@ static int sdla_start (sdlahw_t* hw, unsigned addr) if (err) return err; sdla_bus_write_1(hw, offset, 0xC3); - sdla_bus_write_2(hw, offset + 1, addr); + sdla_bus_write_2(hw, offset + 1, (u16)addr); - switch (card->type) { + switch (hwcard->type) { #if defined(WAN_ISA_SUPPORT) case SDLA_S502A: sdla_isa_write_1(hw, 0x00, 0x10); /* issue NMI to CPU */ - hw->regs[0] = 0x10; + hwcpu->regs[0] = 0x10; break; case SDLA_S502E: sdla_isa_write_1(hw, 0x03, 0x01); /* start CPU */ - hw->regs[3] = 0x01; + hwcpu->regs[3] = 0x01; for (i = 0; i < SDLA_IODELAY; ++i); sdla_isa_read_1(hw, 0x00, &tmp); if (tmp & 0x01) { /* verify */ @@ -3388,15 +4614,15 @@ static int sdla_start (sdlahw_t* hw, unsigned addr) * mirror. */ sdla_isa_write_1(hw, 0x00, 0); /* disable interrupts */ - hw->regs[0] = 0; + hwcpu->regs[0] = 0; } else return -EIO; break; case SDLA_S503: - tmp = hw->regs[0] | 0x09; /* set bits 0 and 3 */ + tmp = hwcpu->regs[0] | 0x09; /* set bits 0 and 3 */ sdla_isa_write_1(hw, 0x00, tmp); - hw->regs[0] = tmp; /* update mirror */ + hwcpu->regs[0] = tmp; /* update mirror */ for (i = 0; i < SDLA_IODELAY; ++i); sdla_isa_read_1(hw, 0x00, &tmp); if (!(tmp & 0x01)) /* verify */ @@ -3404,9 +4630,9 @@ static int sdla_start (sdlahw_t* hw, unsigned addr) break; case SDLA_S507: - tmp = hw->regs[0] | 0x02; + tmp = hwcpu->regs[0] | 0x02; sdla_isa_write_1(hw, 0x00, tmp); - hw->regs[0] = tmp; /* update mirror */ + hwcpu->regs[0] = tmp; /* update mirror */ for (i = 0; i < SDLA_IODELAY; ++i); sdla_isa_read_1(hw, 0x00, &tmp); if (!(tmp & 0x04)) /* verify */ @@ -3414,9 +4640,9 @@ static int sdla_start (sdlahw_t* hw, unsigned addr) break; case SDLA_S508: - tmp = hw->regs[0] | 0x02; + tmp = hwcpu->regs[0] | 0x02; sdla_isa_write_1(hw, 0x00, tmp); - hw->regs[0] = tmp; /* update mirror */ + hwcpu->regs[0] = tmp; /* update mirror */ for (i = 0; i < SDLA_IODELAY; ++i); sdla_isa_read_1(hw, 0x01, &tmp); if (!(tmp & 0x02)) /* verify */ @@ -3442,6 +4668,7 @@ static int sdla_start (sdlahw_t* hw, unsigned addr) static int sdla_load (void* phw, void* psfm, unsigned len) { sdlahw_card_t* hwcard = NULL; + sdlahw_cpu_t* hwcpu = NULL; sdlahw_t* hw = (sdlahw_t*)phw; sfm_t* sfm = (sfm_t*)psfm; unsigned char test[256]; @@ -3449,8 +4676,10 @@ static int sdla_load (void* phw, void* psfm, unsigned len) WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; /* Verify firmware signature */ if (strcmp(sfm->signature, SFM_SIGNATURE)) { @@ -3481,7 +4710,7 @@ static int sdla_load (void* phw, void* psfm, unsigned len) if (hwcard->type == SDLA_S514){ DEBUG_EVENT("%s: loading S514 adapter, CPU %c\n", - hw->devname, SDLA_GET_CPU(hw->cpu_no)); + hw->devname, SDLA_GET_CPU(hwcpu->cpu_no)); } /* Scan through the list of compatible adapters and make sure our @@ -3499,7 +4728,7 @@ static int sdla_load (void* phw, void* psfm, unsigned len) /* Make sure there is enough on-board memory */ - if (hw->memory < sfm->info.memsize){ + if (hwcpu->memory < sfm->info.memsize){ DEBUG_EVENT("%s: firmware needs %u bytes of on-board memory!\n", hw->devname, sfm->info.memsize); return -EINVAL; @@ -3540,7 +4769,7 @@ static int sdla_load (void* phw, void* psfm, unsigned len) return -EIO; } - hw->fwid = sfm->info.codeid; /* set firmware ID */ + hwcpu->fwid = sfm->info.codeid; /* set firmware ID */ return 0; } @@ -3551,35 +4780,39 @@ static int sdla_load (void* phw, void* psfm, unsigned len) */ static int sdla_halt (void* phw) { - sdlahw_card_t* card = NULL; - sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_card_t *hwcard = NULL; + sdlahw_cpu_t *hwcpu = NULL; + sdlahw_t *hw = (sdlahw_t*)phw; #if defined(WAN_ISA_SUPPORT) int i; #endif WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; - if(!card->ioport && (card->type != SDLA_S514)) + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + + if(!hwcard->ioport && (hwcard->type != SDLA_S514)) return -EFAULT; - switch (card->type) { + switch (hwcard->type) { #if defined(WAN_ISA_SUPPORT) case SDLA_S502A: sdla_isa_write_1(hw, 0x00, 0x08); /* halt CPU */ sdla_isa_write_1(hw, 0x00, 0x08); sdla_isa_write_1(hw, 0x00, 0x08); - hw->regs[0] = 0x08; + hwcpu->regs[0] = 0x08; sdla_isa_write_1(hw, 0x01, 0xFF); /* close memory window */ - hw->regs[1] = 0xFF; + hwcpu->regs[1] = 0xFF; break; case SDLA_S502E: sdla_isa_write_1(hw, 0x03, 0); /* stop CPU */ sdla_isa_write_1(hw, 0x00, 0); /* reset board */ for (i = 0; i < S502E_IORANGE; ++i) - hw->regs[i] = 0 + hwcpu->regs[i] = 0 ; break; @@ -3587,7 +4820,7 @@ static int sdla_halt (void* phw) case SDLA_S507: case SDLA_S508: sdla_isa_write_1(hw, 0x00, 0); /* reset board logic */ - hw->regs[0] = 0; + hwcpu->regs[0] = 0; break; #endif case SDLA_S514: @@ -3606,8 +4839,9 @@ static int sdla_halt (void* phw) */ static int sdla_down (void* phw) { - sdlahw_card_t* card = NULL; - sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_card_t *hwcard = NULL; + sdlahw_cpu_t *hwcpu = NULL; + sdlahw_t *hw = (sdlahw_t*)phw; unsigned int CPU_no; u32 int_config, int_status; #if defined(WAN_ISA_SUPPORT) @@ -3616,34 +4850,36 @@ static int sdla_down (void* phw) WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; - switch (card->type) { + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + switch (hwcard->type) { #if defined(WAN_ISA_SUPPORT) case SDLA_S502A: - if (!card->ioport){ + if (!hwcard->ioport){ return -EFAULT; } sdla_isa_write_1(hw, 0x00, 0x08); /* halt CPU */ sdla_isa_write_1(hw, 0x00, 0x08); sdla_isa_write_1(hw, 0x00, 0x08); - hw->regs[0] = 0x08; + hwcpu->regs[0] = 0x08; sdla_isa_write_1(hw, 0x01, 0xFF); /* close memory window */ - hw->regs[1] = 0xFF; + hwcpu->regs[1] = 0xFF; break; case SDLA_S502E: - if (!card->ioport){ + if (!hwcard->ioport){ return -EFAULT; } sdla_isa_write_1(hw, 0x03, 0); /* stop CPU */ sdla_isa_write_1(hw, 0x00, 0); /* reset board */ for (i = 0; i < S502E_IORANGE; ++i) - hw->regs[i] = 0 + hwcpu->regs[i] = 0 ; break; @@ -3651,42 +4887,42 @@ static int sdla_down (void* phw) case SDLA_S507: case SDLA_S508: - if (!card->ioport){ + if (!hwcard->ioport){ return -EFAULT; } sdla_isa_write_1(hw, 0x00, 0); /* reset board logic */ - hw->regs[0] = 0; + hwcpu->regs[0] = 0; break; #endif case SDLA_S514: /* halt the adapter */ sdla_io_write_1(hw, 0x00, S514_CPU_HALT); - CPU_no = hw->cpu_no; + CPU_no = hwcpu->cpu_no; /* disable the PCI IRQ and disable memory access */ sdla_pci_read_config_dword(hw, PCI_INT_CONFIG, &int_config); - int_config &= (hw->cpu_no == SDLA_CPU_A) ? ~PCI_DISABLE_IRQ_CPU_A : ~PCI_DISABLE_IRQ_CPU_B; + int_config &= (hwcpu->cpu_no == SDLA_CPU_A) ? ~PCI_DISABLE_IRQ_CPU_A : ~PCI_DISABLE_IRQ_CPU_B; sdla_pci_write_config_dword(hw, PCI_INT_CONFIG, int_config); sdla_read_int_stat(hw, &int_status); sdla_intack(hw, int_status); - if (hw->cpu_no == SDLA_CPU_A){ + if (hwcpu->cpu_no == SDLA_CPU_A){ sdla_pci_write_config_dword(hw, PCI_MAP0_DWORD, PCI_CPU_A_MEM_DISABLE); }else{ sdla_pci_write_config_dword(hw, PCI_MAP1_DWORD, PCI_CPU_B_MEM_DISABLE); } /* free up the allocated virtual memory */ - if (hw->status & SDLA_MEM_MAPPED){ - sdla_bus_space_unmap(hw, hw->dpmbase, MAX_SIZEOF_S514_MEMORY); - hw->status &= ~SDLA_MEM_MAPPED; + if (hwcpu->status & SDLA_MEM_MAPPED){ + sdla_bus_space_unmap(hw, hwcpu->dpmbase, MAX_SIZEOF_S514_MEMORY); + hwcpu->status &= ~SDLA_MEM_MAPPED; } - if (hw->status & SDLA_IO_MAPPED){ - sdla_bus_space_unmap(hw, hw->vector, 16); - hw->status &= ~SDLA_IO_MAPPED; + if (hwcpu->status & SDLA_IO_MAPPED){ + sdla_bus_space_unmap(hw, hwcpu->vector, 16); + hwcpu->status &= ~SDLA_IO_MAPPED; } break; @@ -3711,15 +4947,20 @@ static int sdla_down (void* phw) case SDLA_AFT: - switch(hw->hwcard->adptr_type){ + switch(hwcard->adptr_type){ case A101_ADPTR_1TE1: case A101_ADPTR_2TE1: case A104_ADPTR_4TE1: case A108_ADPTR_8TE1: case A200_ADPTR_ANALOG: case A400_ADPTR_ANALOG: + case AFT_ADPTR_ISDN: case AFT_ADPTR_56K: - if (hw->used > 1){ + case AFT_ADPTR_2SERIAL_V35X21: + case AFT_ADPTR_4SERIAL_V35X21: + case AFT_ADPTR_2SERIAL_RS232: + case AFT_ADPTR_4SERIAL_RS232: + if (hwcpu->used > 1){ break; } /* fall throught */ @@ -3740,16 +4981,19 @@ static int sdla_down (void* phw) */ static int sdla_inten (sdlahw_t* hw) { - sdlahw_card_t* card = NULL; + sdlahw_card_t *hwcard = NULL; + sdlahw_cpu_t *hwcpu = NULL; #if defined(WAN_ISA_SUPPORT) int i; u8 tmp; #endif WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; - switch (card->type) { + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + switch (hwcard->type) { #if defined(WAN_ISA_SUPPORT) case SDLA_S502E: /* Note thar interrupt control operations on S502E are allowed @@ -3759,15 +5003,15 @@ static int sdla_inten (sdlahw_t* hw) if (tmp & 0x01) { sdla_isa_write_1(hw, 0x00, 0x02); /* bit1 = 1, bit2 = 0 */ sdla_isa_write_1(hw, 0x00, 0x06); /* bit1 = 1, bit2 = 1 */ - hw->regs[0] = 0x06; + hwcpu->regs[0] = 0x06; } else return -EIO; break; case SDLA_S503: - tmp = hw->regs[0] | 0x04; + tmp = hwcpu->regs[0] | 0x04; sdla_isa_write_1(hw, 0x00, tmp); - hw->regs[0] = tmp; /* update mirror */ + hwcpu->regs[0] = tmp; /* update mirror */ for (i = 0; i < SDLA_IODELAY; ++i); /* delay */ sdla_isa_read_1(hw, 0x00, &tmp); if (!(tmp & 0x02)) /* verify */ @@ -3775,9 +5019,9 @@ static int sdla_inten (sdlahw_t* hw) break; case SDLA_S508: - tmp = hw->regs[0] | 0x10; + tmp = hwcpu->regs[0] | 0x10; sdla_isa_write_1(hw, 0x00, tmp); - hw->regs[0] = tmp; /* update mirror */ + hwcpu->regs[0] = tmp; /* update mirror */ for (i = 0; i < SDLA_IODELAY; ++i); /* delay */ sdla_isa_read_1(hw, 0x01, &tmp); if (!(tmp & 0x10)) /* verify */ @@ -3865,14 +5109,18 @@ static int sdla_intde (sdlahw_t* hw) */ static int sdla_read_int_stat (void* phw, u32* int_status) { - sdlahw_card_t* card = NULL; - sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_card_t *hwcard = NULL; + sdlahw_cpu_t *hwcpu = NULL; + sdlahw_t *hw = (sdlahw_t*)phw; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; - switch(card->type){ + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + + switch(hwcard->type){ case SDLA_S514: case SDLA_ADSL: case SDLA_AFT: @@ -3886,17 +5134,21 @@ static int sdla_read_int_stat (void* phw, u32* int_status) */ static int sdla_intack (void* phw, u32 int_status) { - sdlahw_card_t* card = NULL; - sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_card_t *hwcard = NULL; + sdlahw_cpu_t *hwcpu = NULL; + sdlahw_t *hw = (sdlahw_t*)phw; #if defined(WAN_ISA_SUPPORT) u8 tmp; #endif WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; - switch (card->type){ + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + + switch (hwcard->type){ #if defined(WAN_ISA_SUPPORT) case SDLA_S502E: /* To acknoledge hardware interrupt we have to toggle bit 3 of @@ -3906,11 +5158,11 @@ static int sdla_intack (void* phw, u32 int_status) */ sdla_isa_read_1(hw, 0x00, &tmp); if (tmp & 0x01) { - tmp = hw->regs[0] & ~0x04; + tmp = hwcpu->regs[0] & ~0x04; sdla_isa_write_1(hw, 0x00, tmp); tmp |= 0x04; sdla_isa_write_1(hw, 0x00, tmp); - hw->regs[0] = tmp; + hwcpu->regs[0] = tmp; } else return -EIO; break; @@ -3918,11 +5170,11 @@ static int sdla_intack (void* phw, u32 int_status) case SDLA_S503: sdla_isa_read_1(hw, 0x00, &tmp); if (tmp & 0x04) { - tmp = hw->regs[0] & ~0x08; + tmp = hwcpu->regs[0] & ~0x08; sdla_isa_write_1(hw, 0x00, tmp); tmp |= 0x08; sdla_isa_write_1(hw, 0x00, tmp); - hw->regs[0] = tmp; + hwcpu->regs[0] = tmp; } break; @@ -3993,13 +5245,18 @@ static int sdla_intr (sdlahw_t* hw) static int sdla_cmd (void* phw, unsigned long offset, wan_mbox_t* mbox) { sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_cpu_t* hwcpu = NULL; int len = sizeof(wan_cmd_t); int err = 0; u8 value; SDLA_MAGIC(hw); + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; len += mbox->wan_data_len; + DEBUG_CMD("%s: Executing %02X command...\n", + hw->devname,mbox->wan_command); /* Sangoma ISA card -> sdla_bus_read_1(hw, offset, &value); */ sdla_peek(hw, offset, (void*)&value, 1); if (value != 0x00){ @@ -4026,6 +5283,8 @@ static int sdla_cmd (void* phw, unsigned long offset, wan_mbox_t* mbox) return WAN_CMD_TIMEOUT; } + DEBUG_CMD("%s: Executing %02X command...done!\n", + hw->devname,mbox->wan_command); return mbox->wan_return_code; } @@ -4037,9 +5296,9 @@ static int sdla_cmd (void* phw, unsigned long offset, wan_mbox_t* mbox) */ static int sdla_exec (sdlahw_t* hw, unsigned long offset) { - volatile unsigned long tstop; - volatile unsigned long nloops; - u8 value; + volatile wan_ticks_t tstop = 0; + volatile int nloops = 0; + u8 value, buf[10]; #if 0 /* Sangoma ISA card -> sdla_bus_read_1(hw, offset, &value); */ @@ -4060,11 +5319,12 @@ static int sdla_exec (sdlahw_t* hw, unsigned long offset) for (nloops = 1; value == 0x01; ++ nloops){ WP_DELAY(EXEC_DELAY); if (SYSTEM_TICKS > tstop || nloops > MAX_NLOOPS){ - DEBUG_EVENT("%s: Timeout %lu (%lu>%lu) Ticks (max=%lu) Loops %lu (max=%u)\n", + DEBUG_EVENT( + "%s: Timeout %ld (%lu>%lu) Ticks (max=%lu) Loops %u (max=%u)\n", __FUNCTION__, - (SYSTEM_TICKS-tstop+EXEC_TIMEOUT), + (unsigned long)(SYSTEM_TICKS-tstop+EXEC_TIMEOUT), (unsigned long)SYSTEM_TICKS, - tstop, + (unsigned long)tstop, (unsigned long)EXEC_TIMEOUT, nloops, MAX_NLOOPS); @@ -4081,7 +5341,9 @@ static int sdla_exec (sdlahw_t* hw, unsigned long offset) } /* Sangoma ISA card -> sdla_bus_read_1(hw, offset, &value); */ - sdla_peek(hw, offset, (void*)&value, 1); + buf[0] = 0; + sdla_peek(hw, offset, (void*)&buf[0], 1); + value = buf[0]; } return nloops; @@ -4099,7 +5361,8 @@ static int sdla_exec (sdlahw_t* hw, unsigned long offset) */ static int sdla_peek (void* phw, unsigned long addr, void* pbuf, unsigned len) { - sdlahw_card_t* card = NULL; + sdlahw_card_t *hwcard = NULL; + sdlahw_cpu_t *hwcpu = NULL; sdlahw_t* hw = (sdlahw_t*)phw; unsigned char* buf = (unsigned char*)pbuf; int err = 0; @@ -4107,18 +5370,21 @@ static int sdla_peek (void* phw, unsigned long addr, void* pbuf, unsigned len) WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; - if (addr + len > hw->memory) /* verify arguments */ + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + + if (addr + len > hwcpu->memory) /* verify arguments */ return -EINVAL; - switch(card->type){ + switch(hwcard->type){ case SDLA_S508: { - unsigned long oldvec = (unsigned long)hw->vector; + unsigned long oldvec = (unsigned long)hwcpu->vector; unsigned long curvec; /* current DPM window vector */ - unsigned winsize = hw->dpmsize; + unsigned winsize = hwcpu->dpmsize; unsigned curpos, curlen; /* current offset and block size */ while (len && !err) { @@ -4147,7 +5413,7 @@ static int sdla_peek (void* phw, unsigned long addr, void* pbuf, unsigned len) default: DEBUG_EVENT("%s: Invalid card type 0x%X\n", - __FUNCTION__,card->type); + __FUNCTION__,hwcard->type); err = -EINVAL; break; } @@ -4200,26 +5466,30 @@ static void sdla_peek_by_4 (sdlahw_t* hw, unsigned long offset, void* pbuf, unsi */ static int sdla_poke (void* phw, unsigned long addr, void* pbuf, unsigned len) { - sdlahw_card_t* card = NULL; + sdlahw_card_t *hwcard = NULL; + sdlahw_cpu_t *hwcpu = NULL; sdlahw_t* hw = (sdlahw_t*)phw; - unsigned char * buf = pbuf; + unsigned char *buf = pbuf; int err = 0; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; - if (addr + len > hw->memory){ /* verify arguments */ + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + + if (addr + len > hwcpu->memory){ /* verify arguments */ return -EINVAL; } - switch (card->type){ + switch (hwcard->type){ case SDLA_S508: { - unsigned long oldvec = (unsigned long)hw->vector; + unsigned long oldvec = (unsigned long)hwcpu->vector; unsigned long curvec; /* current DPM window vector */ - unsigned winsize = hw->dpmsize; + unsigned winsize = hwcpu->dpmsize; unsigned curpos, curlen; /* current offset and block size */ while (len && !err) { @@ -4247,7 +5517,7 @@ static int sdla_poke (void* phw, unsigned long addr, void* pbuf, unsigned len) default: DEBUG_EVENT("%s: Invalid card type 0x%X\n", - __FUNCTION__,card->type); + __FUNCTION__,hwcard->type); err = -EINVAL; break; } @@ -4340,21 +5610,24 @@ static int sdla_clear_bit (void* phw, unsigned long offset, u8 value) */ static int sdla_init_pci_slot(sdlahw_t *hw) { - sdlahw_card_t* card = NULL; + sdlahw_card_t *hwcard = NULL; + sdlahw_cpu_t *hwcpu; u32 int_status; int volatile found=0; int i=0; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; /* Check if this is a very first load for a specific * pci card. If it is, clear the interrput bits, and * set the flag indicating that this card was initialized. */ for (i=0; (islot_no){ + if (pci_slot_ar[i] == hwcard->slot_no){ found=1; break; } @@ -4374,12 +5647,12 @@ static int sdla_init_pci_slot(sdlahw_t *hw) DEBUG_EVENT( "Please contact Sangoma Technologies\n"); return 1; } - pci_slot_ar[i] = card->slot_no; + pci_slot_ar[i] = hwcard->slot_no; } return 0; } - +#if defined(WAN_ISA_SUPPORT) /* * ============================================================================ * Check memory region to see if it's available. @@ -4387,10 +5660,15 @@ static int sdla_init_pci_slot(sdlahw_t *hw) */ static unsigned int sdla_check_memregion(sdlahw_t* hw) { + sdlahw_cpu_t *hwcpu; unsigned int offset = 0x0; - unsigned int len = hw->dpmsize; + unsigned int len = 0; u8 value; + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + len = hwcpu->dpmsize; sdla_bus_read_1(hw, offset, &value); for(; len && (value == 0xFF); --len){ /* attempt to write 0 */ @@ -4407,22 +5685,26 @@ static unsigned int sdla_check_memregion(sdlahw_t* hw) return len; } +#endif +#if defined(WAN_ISA_SUPPORT) /*============================================================================ * Autoselect memory region. * o try all available DMP address options from the top down until success. */ static int sdla_autodpm (sdlahw_t* hw) { - sdlahw_card_t* card; + sdlahw_card_t *hwcard; + sdlahw_cpu_t *hwcpu; int i, err = -EINVAL; unsigned* opt; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; - switch (card->type){ -#if defined(WAN_ISA_SUPPORT) + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + switch (hwcard->type){ case SDLA_S502A: opt = s502a_dpmbase_options; break; @@ -4436,7 +5718,6 @@ static int sdla_autodpm (sdlahw_t* hw) case SDLA_S507: opt = s507_dpmbase_options; break; -#endif default: return -EINVAL; } @@ -4446,45 +5727,50 @@ static int sdla_autodpm (sdlahw_t* hw) * We don't want to test A**** addresses, since * they are usually used for Video */ for (i = 8; i <= opt[0] && err; i++) { - hw->dpmbase = (sdla_mem_handle_t)phys_to_virt(opt[i]); + hwcpu->dpmbase = (sdla_mem_handle_t)phys_to_virt(opt[i]); err = sdla_setdpm(hw); } return err; } +#endif +#if defined(WAN_ISA_SUPPORT) /*============================================================================ * Initialize SDLA hardware: setup memory window, IRQ, etc. */ static int sdla_init (sdlahw_t* hw) { - sdlahw_card_t* card = NULL; + sdlahw_card_t *hwcard = NULL; + sdlahw_cpu_t *hwcpu; int i; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; for (i = 0; i < SDLA_MAXIORANGE; ++i){ - hw->regs[i] = 0; + hwcpu->regs[i] = 0; } - switch (card->type) { -#if defined(WAN_ISA_SUPPORT) + switch (hwcard->type) { case SDLA_S502A: return sdla_init_s502a(hw); case SDLA_S502E: return sdla_init_s502e(hw); case SDLA_S503: return sdla_init_s503(hw); case SDLA_S507: return sdla_init_s507(hw); case SDLA_S508: return sdla_init_s508(hw); -#endif } return -EINVAL; } +#endif /*============================================================================ * Map shared memory window into SDLA address space. */ static int sdla_mapmem (void* phw, unsigned long addr) { - sdlahw_card_t* card = NULL; + sdlahw_card_t *hwcard = NULL; + sdlahw_cpu_t* hwcpu = NULL; sdlahw_t* hw = (sdlahw_t*)phw; #if defined(WAN_ISA_SUPPORT) u8 tmp; @@ -4492,25 +5778,27 @@ static int sdla_mapmem (void* phw, unsigned long addr) WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; - switch (card->type){ + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + switch (hwcard->type){ #if defined(WAN_ISA_SUPPORT) case SDLA_S502A: case SDLA_S502E: if (addr < S502_MAXMEM) { /* verify parameter */ tmp = addr >> 13; /* convert to register mask */ sdla_isa_write_1(hw, 0x02, tmp); - hw->regs[2] = tmp; + hwcpu->regs[2] = tmp; } else return -EINVAL; break; case SDLA_S503: if (addr < S503_MAXMEM) { /* verify parameter */ - tmp = (hw->regs[0] & 0x8F) | ((addr >> 9) & 0x70); + tmp = (hwcpu->regs[0] & 0x8F) | ((addr >> 9) & 0x70); sdla_isa_write_1(hw, 0x00, tmp); - hw->regs[0] = tmp; + hwcpu->regs[0] = tmp; } else return -EINVAL; break; @@ -4522,7 +5810,7 @@ static int sdla_mapmem (void* phw, unsigned long addr) return -EIO; tmp = addr >> 13; /* convert to register mask */ sdla_isa_write_1(hw, 0x02, tmp); - hw->regs[2] = tmp; + hwcpu->regs[2] = tmp; } else return -EINVAL; break; @@ -4531,7 +5819,7 @@ static int sdla_mapmem (void* phw, unsigned long addr) if (addr < S508_MAXMEM) { tmp = addr >> 13; /* convert to register mask */ sdla_isa_write_1(hw, 0x02, tmp); - hw->regs[2] = tmp; + hwcpu->regs[2] = tmp; } else return -EINVAL; break; @@ -4544,7 +5832,7 @@ static int sdla_mapmem (void* phw, unsigned long addr) default: return -EINVAL; } - hw->vector = (sdla_mem_handle_t)(addr & 0xFFFFE000L); + hwcpu->vector = (sdla_mem_handle_t)(addr & 0xFFFFE000L); return 0; } @@ -4618,6 +5906,7 @@ static unsigned sdla_test_memregion (sdlahw_t* hw, unsigned len) #endif } +#if defined(WAN_ISA_SUPPORT) /*============================================================================ * Test adapter on-board memory. * o slide DPM window from the bottom up and test adapter memory segment by @@ -4626,20 +5915,25 @@ static unsigned sdla_test_memregion (sdlahw_t* hw, unsigned len) */ static unsigned long sdla_memtest (sdlahw_t* hw) { + sdlahw_cpu_t *hwcpu; unsigned long memsize; unsigned winsize; - for (memsize = 0, winsize = hw->dpmsize; + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + for (memsize = 0, winsize = hwcpu->dpmsize; !sdla_mapmem(hw, memsize) && (sdla_test_memregion(hw, winsize) == winsize) ; memsize += winsize) ; - hw->memory = memsize; + hwcpu->memory = memsize; return memsize; } +#endif - +#if defined(WAN_ISA_SUPPORT) /*============================================================================ * Set up adapter dual-port memory window. * o shut down adapter @@ -4651,8 +5945,12 @@ static unsigned long sdla_memtest (sdlahw_t* hw) */ static int sdla_setdpm (sdlahw_t* hw) { + sdlahw_cpu_t *hwcpu; int err; + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; /* Shut down card and verify memory region */ sdla_down(hw); if (sdla_check_memregion(hw)) @@ -4665,7 +5963,7 @@ static int sdla_setdpm (sdlahw_t* hw) err = sdla_init(hw); if (err) return err; - if (sdla_memtest(hw) < hw->dpmsize) { /* less than window size */ + if (sdla_memtest(hw) < hwcpu->dpmsize) {/* less than window size */ sdla_down(hw); return -EIO; } @@ -4673,6 +5971,7 @@ static int sdla_setdpm (sdlahw_t* hw) sdla_mapmem(hw, 0L); /* set window vector at bottom */ return 0; } +#endif /*============================================================================ * Detect S502A adapter. @@ -4691,14 +5990,17 @@ static int sdla_setdpm (sdlahw_t* hw) #if defined(WAN_ISA_SUPPORT) static int sdla_detect_s502a (sdlahw_t* hw) { - sdlahw_card_t* card; + sdlahw_card_t* hwcard; + sdlahw_cpu_t* hwcpu; int i, j; u8 tmp; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; - if (!sdla_get_option_index(s502_port_options, card->ioport)) + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + if (!sdla_get_option_index(s502_port_options, hwcard->ioport)) return 0; for (j = 1; j < SDLA_MAXIORANGE; ++j) { @@ -4742,21 +6044,25 @@ static int sdla_detect_s502a (sdlahw_t* hw) #if defined(WAN_ISA_SUPPORT) static int sdla_init_s502a (sdlahw_t* hw) { + sdlahw_cpu_t *hwcpu; int tmp, i; + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; if (!sdla_detect_s502a(hw)) return -ENODEV; - hw->regs[0] = 0x08; - hw->regs[1] = 0xFF; + hwcpu->regs[0] = 0x08; + hwcpu->regs[1] = 0xFF; /* Verify configuration options */ - i = sdla_get_option_index(s502a_dpmbase_options, virt_to_phys((void*)hw->dpmbase)); + i = sdla_get_option_index(s502a_dpmbase_options, virt_to_phys((void*)hwcpu->dpmbase)); if (i == 0) return -EINVAL; tmp = s502a_hmcr[i - 1]; - switch (hw->dpmsize) { + switch (hwcpu->dpmsize) { case 0x2000: tmp |= 0x01; break; @@ -4770,8 +6076,8 @@ static int sdla_init_s502a (sdlahw_t* hw) /* Setup dual-port memory window (this also enables memory access) */ sdla_isa_write_1(hw, 0x01, tmp); - hw->regs[1] = tmp; - hw->regs[0] = 0x08; + hwcpu->regs[1] = tmp; + hwcpu->regs[0] = 0x08; return 0; } #endif @@ -4791,12 +6097,15 @@ static int sdla_init_s502a (sdlahw_t* hw) static int sdla_detect_s502e (sdlahw_t* hw) { sdlahw_card_t* card; + sdlahw_cpu_t* hwcpu; int i, j; u8 tmp; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + card = hwcpu->hwcard; if (!sdla_get_option_index(s502_port_options, card->ioport)) return 0; for (j = 1; j < SDLA_MAXIORANGE; ++j) { @@ -4829,19 +6138,23 @@ static int sdla_detect_s502e (sdlahw_t* hw) #if defined(WAN_ISA_SUPPORT) static int sdla_init_s502e (sdlahw_t* hw) { + sdlahw_cpu_t *hwcpu; int i; u8 tmp; + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; if (!sdla_detect_s502e(hw)) return -ENODEV; /* Verify configuration options */ - i = sdla_get_option_index(s508_dpmbase_options, virt_to_phys((void*)hw->dpmbase)); + i = sdla_get_option_index(s508_dpmbase_options, virt_to_phys((void*)hwcpu->dpmbase)); if (i == 0) return -EINVAL; tmp = s502e_hmcr[i - 1]; - switch (hw->dpmsize) { + switch (hwcpu->dpmsize) { case 0x2000: tmp |= 0x01; break; @@ -4855,11 +6168,11 @@ static int sdla_init_s502e (sdlahw_t* hw) /* Setup dual-port memory window */ sdla_isa_write_1(hw, 0x01, tmp); - hw->regs[1] = tmp; + hwcpu->regs[1] = tmp; /* Enable memory access */ sdla_isa_write_1(hw, 0x00, 0x02); - hw->regs[0] = 0x02; + hwcpu->regs[0] = 0x02; for (i = 0; i < SDLA_IODELAY; ++i); /* delay */ sdla_isa_read_1(hw, 0x00, &tmp); return (tmp & 0x02) ? 0 : -EIO; @@ -4881,14 +6194,18 @@ static int sdla_init_s502e (sdlahw_t* hw) #if defined(WAN_ISA_SUPPORT) static int sdla_detect_s503 (sdlahw_t* hw) { - sdlahw_card_t* card; + sdlahw_card_t *hwcard; + sdlahw_cpu_t *hwcpu; int i, j; u8 tmp; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; - if (!sdla_get_option_index(s503_port_options, card->ioport)) + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + + if (!sdla_get_option_index(s503_port_options, hwcard->ioport)) return 0; for (j = 1; j < SDLA_MAXIORANGE; ++j) { sdla_isa_read_1(hw, j, &tmp); @@ -4921,18 +6238,22 @@ static int sdla_detect_s503 (sdlahw_t* hw) #if defined(WAN_ISA_SUPPORT) static int sdla_init_s503 (sdlahw_t* hw) { + sdlahw_cpu_t *hwcpu; int tmp, i; + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; if (!sdla_detect_s503(hw)) return -ENODEV; /* Verify configuration options */ - i = sdla_get_option_index(s508_dpmbase_options, virt_to_phys((void*)hw->dpmbase)); + i = sdla_get_option_index(s508_dpmbase_options, virt_to_phys((void*)hwcpu->dpmbase)); if (i == 0) return -EINVAL; tmp = s502e_hmcr[i - 1]; - switch (hw->dpmsize) { + switch (hwcpu->dpmsize) { case 0x2000: tmp |= 0x01; break; @@ -4946,11 +6267,11 @@ static int sdla_init_s503 (sdlahw_t* hw) /* Setup dual-port memory window */ sdla_isa_write_1(hw, 0x01, tmp); - hw->regs[1] = tmp; + hwcpu->regs[1] = tmp; /* Enable memory access */ sdla_isa_write_1(hw, 0x00, 0x02); - hw->regs[0] = 0x02; /* update mirror */ + hwcpu->regs[0] = 0x02; /* update mirror */ return 0; } #endif @@ -4970,14 +6291,18 @@ static int sdla_init_s503 (sdlahw_t* hw) #if defined(WAN_ISA_SUPPORT) static int sdla_detect_s507 (sdlahw_t* hw) { - sdlahw_card_t* card; + sdlahw_card_t* hwcard; + sdlahw_cpu_t *hwcpu; int i, j; u8 tmp, tmp1; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; - if (!sdla_get_option_index(s508_port_options, card->ioport)) + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + + if (!sdla_get_option_index(s508_port_options, hwcard->ioport)) return 0; sdla_isa_read_1(hw, 0x00, &tmp); for (j = 1; j < S507_IORANGE; ++j) { @@ -5010,19 +6335,25 @@ static int sdla_detect_s507 (sdlahw_t* hw) #if defined(WAN_ISA_SUPPORT) static int sdla_init_s507 (sdlahw_t* hw) { + sdlahw_cpu_t *hwcpu; int i; u8 tmp; + + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + if (!sdla_detect_s507(hw)) return -ENODEV; /* Verify configuration options */ - i = sdla_get_option_index(s507_dpmbase_options, virt_to_phys((void*)hw->dpmbase)); + i = sdla_get_option_index(s507_dpmbase_options, virt_to_phys((void*)hwcpu->dpmbase)); if (i == 0) return -EINVAL; tmp = s507_hmcr[i - 1]; - switch (hw->dpmsize) { + switch (hwcpu->dpmsize) { case 0x2000: tmp |= 0x01; break; @@ -5036,7 +6367,7 @@ static int sdla_init_s507 (sdlahw_t* hw) /* Enable adapter's logic */ sdla_isa_write_1(hw, 0x00, 0x01); - hw->regs[0] = 0x01; + hwcpu->regs[0] = 0x01; for (i = 0; i < SDLA_IODELAY; ++i); /* delay */ sdla_isa_read_1(hw, 0x00, &tmp); if (!(tmp & 0x20)) @@ -5044,16 +6375,16 @@ static int sdla_init_s507 (sdlahw_t* hw) /* Setup dual-port memory window */ sdla_isa_write_1(hw, 0x01, tmp); - hw->regs[1] = tmp; + hwcpu->regs[1] = tmp; /* Enable memory access */ - tmp = hw->regs[0] | 0x04; - if (hw->irq) { - i = sdla_get_option_index(s508_irq_options, hw->irq); + tmp = hwcpu->regs[0] | 0x04; + if (hwcpu->irq) { + i = sdla_get_option_index(s508_irq_options, hwcpu->irq); if (i) tmp |= s507_irqmask[i - 1]; } sdla_isa_write_1(hw, 0x00, tmp); - hw->regs[0] = tmp; /* update mirror */ + hwcpu->regs[0] = tmp; /* update mirror */ for (i = 0; i < SDLA_IODELAY; ++i); /* delay */ sdla_isa_read_1(hw, 0x00, &tmp); return (tmp & 0x08) ? 0 : -EIO; @@ -5067,15 +6398,20 @@ static int sdla_init_s507 (sdlahw_t* hw) #if defined(WAN_ISA_SUPPORT) static int sdla_init_s508 (sdlahw_t* hw) { - int i; - u8 tmp; + sdlahw_cpu_t *hwcpu; + int i; + u8 tmp; + + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; if (sdla_detect_s508(hw)){ return -ENODEV; } /* Verify configuration options */ - i = sdla_get_option_index(s508_dpmbase_options, virt_to_phys((void*)hw->dpmbase)); + i = sdla_get_option_index(s508_dpmbase_options, virt_to_phys((void*)hwcpu->dpmbase)); if (i == 0){ return -EINVAL; } @@ -5083,11 +6419,11 @@ static int sdla_init_s508 (sdlahw_t* hw) /* Setup memory configuration */ tmp = s508_hmcr[i - 1]; sdla_isa_write_1(hw, 0x01, tmp); - hw->regs[1] = tmp; + hwcpu->regs[1] = tmp; /* Enable memory access */ sdla_isa_write_1(hw, 0x00, 0x04); - hw->regs[0] = 0x04; /* update mirror */ + hwcpu->regs[0] = 0x04; /* update mirror */ for (i = 0; i < SDLA_IODELAY; ++i); /* delay */ sdla_isa_read_1(hw, 0x01, &tmp); return (tmp & 0x04) ? 0 : -EIO; @@ -5109,17 +6445,20 @@ static int sdla_init_s508 (sdlahw_t* hw) #if defined(WAN_ISA_SUPPORT) static int sdla_detect_s508 (sdlahw_t* hw) { - sdlahw_card_t* card; + sdlahw_card_t *hwcard; + sdlahw_cpu_t *hwcpu; int i; u8 tmp; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; /* Sangoma ISa card */ - hw->status |= SDLA_MEM_MAPPED; - hw->status |= SDLA_IO_MAPPED; - if (!sdla_get_option_index(s508_port_options, card->ioport)){ + hwcpu->status |= SDLA_MEM_MAPPED; + hwcpu->status |= SDLA_IO_MAPPED; + if (!sdla_get_option_index(s508_port_options, hwcard->ioport)){ return -EINVAL; } sdla_isa_write_1(hw, 0x0, 0x00); @@ -5148,19 +6487,22 @@ static int sdla_detect_s508 (sdlahw_t* hw) */ static int sdla_detect_s514 (sdlahw_t* hw) { - sdlahw_card_t* card; + sdlahw_card_t *hwcard; + sdlahw_cpu_t *hwcpu; u32 ut_u32; u8 ut_u8; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; sdla_pci_read_config_dword(hw, - (hw->cpu_no == SDLA_CPU_A) ? PCI_MEM_BASE0_DWORD : - PCI_MEM_BASE1_DWORD, (u32*)&hw->mem_base_addr); - if (!hw->mem_base_addr){ - if(hw->cpu_no == SDLA_CPU_B){ + (hwcpu->cpu_no == SDLA_CPU_A) ? PCI_MEM_BASE0_DWORD : + PCI_MEM_BASE1_DWORD, (u32*)&hwcpu->mem_base_addr); + if (!hwcpu->mem_base_addr){ + if(hwcpu->cpu_no == SDLA_CPU_B){ DEBUG_EVENT( "%s: CPU #B not present on the card\n", hw->devname); }else{ @@ -5170,13 +6512,13 @@ static int sdla_detect_s514 (sdlahw_t* hw) return -EINVAL; } DEBUG_EVENT( "%s: S514 PCI memory at 0x%lX\n", - hw->devname, (unsigned long)hw->mem_base_addr); + hw->devname, (unsigned long)hwcpu->mem_base_addr); /* enable the PCI memory */ sdla_pci_read_config_dword(hw, - (hw->cpu_no == SDLA_CPU_A) ? PCI_MAP0_DWORD : PCI_MAP1_DWORD, &ut_u32); + (hwcpu->cpu_no == SDLA_CPU_A) ? PCI_MAP0_DWORD : PCI_MAP1_DWORD, &ut_u32); sdla_pci_write_config_dword(hw, - (hw->cpu_no == SDLA_CPU_A) ? PCI_MAP0_DWORD : PCI_MAP1_DWORD, + (hwcpu->cpu_no == SDLA_CPU_A) ? PCI_MAP0_DWORD : PCI_MAP1_DWORD, (ut_u32 | PCI_MEMORY_ENABLE)); /* check the IRQ allocated and enable IRQ usage */ @@ -5191,14 +6533,14 @@ static int sdla_detect_s514 (sdlahw_t* hw) return 0; } - sdla_pci_read_config_byte(hw, PCI_INT_LINE_BYTE, (u8*)&hw->irq); - if(hw->irq == PCI_IRQ_NOT_ALLOCATED) { + sdla_pci_read_config_byte(hw, PCI_INT_LINE_BYTE, (u8*)&hwcpu->irq); + if(hwcpu->irq == PCI_IRQ_NOT_ALLOCATED) { DEBUG_EVENT("%s: IRQ not allocated to S514 adapter\n", hw->devname); return -EINVAL; } #if defined(__LINUX__) - hw->irq = card->pci_dev->irq; + hwcpu->irq = hwcard->pci_dev->irq; #endif /* BUG FIX : Mar 6 2000 @@ -5214,7 +6556,7 @@ static int sdla_detect_s514 (sdlahw_t* hw) } sdla_pci_read_config_dword(hw, PCI_INT_CONFIG, &ut_u32); - ut_u32 |= (hw->cpu_no == SDLA_CPU_A) ? + ut_u32 |= (hwcpu->cpu_no == SDLA_CPU_A) ? PCI_ENABLE_IRQ_CPU_A : PCI_ENABLE_IRQ_CPU_B; sdla_pci_write_config_dword(hw, PCI_INT_CONFIG, ut_u32); @@ -5230,39 +6572,39 @@ static int sdla_detect_s514 (sdlahw_t* hw) * the value of the irq is not valid until pci_enable_device() * is executied */ #if defined(__LINUX__) - hw->irq = card->pci_dev->irq; + hwcpu->irq = hwcard->pci_dev->irq; #endif DEBUG_EVENT( "%s: IRQ %d allocated to the S514 card\n", - hw->devname, hw->irq); + hw->devname, hwcpu->irq); - hw->status |= SDLA_PCI_ENABLE; + hwcpu->status |= SDLA_PCI_ENABLE; /* map the physical PCI memory to virtual memory */ - sdla_bus_space_map(hw, 0x0, MAX_SIZEOF_S514_MEMORY, &hw->dpmbase); - if (!hw->dpmbase){ + sdla_bus_space_map(hw, 0x0, MAX_SIZEOF_S514_MEMORY, &hwcpu->dpmbase); + if (!hwcpu->dpmbase){ DEBUG_EVENT("%s: PCI virtual memory allocation failed\n", hw->devname); return -EINVAL; } /* map the physical control register memory to virtual memory */ - sdla_bus_space_map(hw, S514_CTRL_REG_BYTE, 16, &hw->vector); - if (!hw->vector){ - sdla_bus_space_unmap(hw, hw->dpmbase, MAX_SIZEOF_S514_MEMORY); + sdla_bus_space_map(hw, S514_CTRL_REG_BYTE, 16, &hwcpu->vector); + if (!hwcpu->vector){ + sdla_bus_space_unmap(hw, hwcpu->dpmbase, MAX_SIZEOF_S514_MEMORY); DEBUG_EVENT("%s: PCI virtual memory allocation failed\n", hw->devname); - hw->dpmbase=0; + hwcpu->dpmbase=0; return -EINVAL; } - hw->status |= SDLA_MEM_MAPPED; + hwcpu->status |= SDLA_MEM_MAPPED; #if defined(__NetBSD__) || defined(__OpenBSD__) - hw->ioh = hw->vector; + hwcpu->ioh = hw->vector; #endif - hw->status |= SDLA_IO_MAPPED; + hwcpu->status |= SDLA_IO_MAPPED; /* halt the adapter */ sdla_io_write_1(hw, 0x0, S514_CPU_HALT); @@ -5279,11 +6621,14 @@ static int sdla_detect_s514 (sdlahw_t* hw) static int sdla_detect_pulsar(sdlahw_t* hw) { sdlahw_card_t *hwcard; + sdlahw_cpu_t *hwcpu; int err; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; if ((err = sdla_memory_map(hw, SDLA_CPU_A))){ return err; @@ -5297,20 +6642,20 @@ static int sdla_detect_pulsar(sdlahw_t* hw) } #endif DEBUG_EVENT( "%s: ADSL PCI memory at 0x%lX\n", - hw->devname, (unsigned long)hw->mem_base_addr); + hw->devname, (unsigned long)hwcpu->mem_base_addr); - sdla_pci_read_config_byte(hw, PCI_INT_LINE_BYTE, (u8*)&hw->irq); - if(hw->irq == PCI_IRQ_NOT_ALLOCATED) { + sdla_pci_read_config_byte(hw, PCI_INT_LINE_BYTE, (u8*)&hwcpu->irq); + if(hwcpu->irq == PCI_IRQ_NOT_ALLOCATED) { DEBUG_EVENT( "%s: IRQ not allocated to S514 adapter\n", hw->devname); return -EINVAL; } #if defined(__LINUX__) - hw->irq = hwcard->pci_dev->irq; + hwcpu->irq = hwcard->pci_dev->irq; #endif DEBUG_EVENT( "%s: IRQ %d allocated to the ADSL card\n", - hw->devname, hw->irq); + hw->devname, hwcpu->irq); #if 0 if (sdla_pci_enable_device(hw)){ @@ -5354,15 +6699,16 @@ static int sdla_detect_pulsar(sdlahw_t* hw) static int sdla_memory_map(sdlahw_t* hw, int cpu_no) { sdlahw_card_t *hwcard; + sdlahw_cpu_t *hwcpu; void *presource; int err=-EINVAL; unsigned char reserve_name[50]; - - WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + hwcard = hwcpu->hwcard; presource =NULL; switch (hwcard->type){ @@ -5373,35 +6719,40 @@ static int sdla_memory_map(sdlahw_t* hw, int cpu_no) #endif case SDLA_ADSL: - hw->memory=GSI_PCI_MEMORY_SIZE; + hwcpu->memory=GSI_PCI_MEMORY_SIZE; cpu_no=SDLA_CPU_A; sprintf(reserve_name,"WANPIPE ADSL"); break; case SDLA_AFT: sprintf(reserve_name,"WANPIPE AFT"); - switch(hw->hwcard->adptr_type){ + switch(hwcard->adptr_type){ case A101_ADPTR_1TE1: case A101_ADPTR_2TE1: - if (hw->hwcard->adptr_subtype == AFT_SUBTYPE_NORMAL){ - hw->memory = AFT_PCI_MEM_SIZE; + if (hwcard->adptr_subtype == AFT_SUBTYPE_NORMAL){ + hwcpu->memory = AFT_PCI_MEM_SIZE; }else{ - hw->memory = AFT2_PCI_MEM_SIZE; + hwcpu->memory = AFT2_PCI_MEM_SIZE; } break; case A104_ADPTR_4TE1: case A200_ADPTR_ANALOG: case A400_ADPTR_ANALOG: - hw->memory = AFT4_PCI_MEM_SIZE; + case AFT_ADPTR_ISDN: + hwcpu->memory = AFT4_PCI_MEM_SIZE; break; + case AFT_ADPTR_2SERIAL_V35X21: + case AFT_ADPTR_4SERIAL_V35X21: + case AFT_ADPTR_2SERIAL_RS232: + case AFT_ADPTR_4SERIAL_RS232: case A108_ADPTR_8TE1: - hw->memory = AFT8_PCI_MEM_SIZE; + hwcpu->memory = AFT8_PCI_MEM_SIZE; break; case AFT_ADPTR_56K: - hw->memory = AFT2_PCI_MEM_SIZE; + hwcpu->memory = AFT2_PCI_MEM_SIZE; break; default: - hw->memory = AFT_PCI_MEM_SIZE; + hwcpu->memory = AFT_PCI_MEM_SIZE; break; } break; @@ -5419,16 +6770,16 @@ static int sdla_memory_map(sdlahw_t* hw, int cpu_no) hw->devname); return -EINVAL; } - hw->status |= SDLA_PCI_ENABLE; + hwcpu->status |= SDLA_PCI_ENABLE; - if (!(hw->status & SDLA_MEM_RESERVED)){ + if (!(hwcpu->status & SDLA_MEM_RESERVED)){ #if defined(__LINUX__) - err = pci_request_region(hw->hwcard->pci_dev, (cpu_no == SDLA_CPU_A)?0:1 ,reserve_name); + err = pci_request_region(hwcard->pci_dev, (cpu_no == SDLA_CPU_A)?0:1 ,reserve_name); #else err = sdla_request_mem_region( hw, - hw->mem_base_addr, - hw->memory, + hwcpu->mem_base_addr, + hwcpu->memory, reserve_name, &presource); #endif @@ -5440,11 +6791,11 @@ static int sdla_memory_map(sdlahw_t* hw, int cpu_no) err = -EINVAL; goto aft_pci_error; } - hw->status |= SDLA_MEM_RESERVED; + hwcpu->status |= SDLA_MEM_RESERVED; } #if defined(__LINUX__) && defined(DMA_32BIT_MASK) - if((err = pci_set_dma_mask(hw->hwcard->pci_dev, DMA_32BIT_MASK))) { + if((err = pci_set_dma_mask(hwcard->pci_dev, DMA_32BIT_MASK))) { DEBUG_EVENT("%s: Error: No usable DMA configuration, aborting.\n", hw->devname); err = -EINVAL; @@ -5455,9 +6806,9 @@ static int sdla_memory_map(sdlahw_t* hw, int cpu_no) (cpu_no == SDLA_CPU_A) ? PCI_IO_BASE_DWORD : PCI_MEM_BASE0_DWORD, - &hw->mem_base_addr); + &hwcpu->mem_base_addr); - if (!hw->mem_base_addr){ + if (!hwcpu->mem_base_addr){ if(cpu_no == SDLA_CPU_B){ DEBUG_EVENT( "%s: Error: CPU #B not present on adapter\n", hw->devname); @@ -5469,19 +6820,19 @@ static int sdla_memory_map(sdlahw_t* hw, int cpu_no) goto aft_pci_error; } - if (!(hw->status & SDLA_MEM_MAPPED)){ + if (!(hwcpu->status & SDLA_MEM_MAPPED)){ /* map the physical PCI memory to virtual memory */ sdla_bus_space_map(hw, 0x0, - hw->memory, - &hw->dpmbase); - if (!hw->dpmbase){ + hwcpu->memory, + &hwcpu->dpmbase); + if (!hwcpu->dpmbase){ DEBUG_EVENT( "%s: Error: AFT PCI virtual memory ioremap failed\n", hw->devname); err = -EINVAL; goto aft_pci_error; } - hw->status |= SDLA_MEM_MAPPED; + hwcpu->status |= SDLA_MEM_MAPPED; } sdla_pci_set_master(hw); @@ -5501,10 +6852,18 @@ aft_pci_error: static int sdla_memory_unmap(sdlahw_t* hw) { sdlahw_card_t *hwcard; + sdlahw_cpu_t *hwcpu; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + +#if defined(__WINDOWS__) + return 0; +#endif + switch (hwcard->type){ #if defined(WAN_ISA_SUPPORT) case SDLA_S508: @@ -5517,33 +6876,32 @@ static int sdla_memory_unmap(sdlahw_t* hw) DEBUG_TEST("NCDEBUG: MEMORY UNMAPPING AFT\n"); /* free up the allocated virtual memory */ - if (hw->status & SDLA_MEM_MAPPED){ + if (hwcpu->status & SDLA_MEM_MAPPED){ sdla_bus_space_unmap( hw, - hw->dpmbase, - hw->memory); - hw->status &= ~SDLA_MEM_MAPPED; + hwcpu->dpmbase, + hwcpu->memory); + hwcpu->status &= ~SDLA_MEM_MAPPED; } - if (hw->status & SDLA_MEM_RESERVED){ + if (hwcpu->status & SDLA_MEM_RESERVED){ #if defined(__LINUX__) - pci_release_region(hw->hwcard->pci_dev,(hw->cpu_no == SDLA_CPU_A)?0:1); + pci_release_region(hwcard->pci_dev,(hwcpu->cpu_no == SDLA_CPU_A)?0:1); #else sdla_release_mem_region( hw, - hw->mem_base_addr, - hw->memory); + hwcpu->mem_base_addr, + hwcpu->memory); #endif - hw->status &= ~SDLA_MEM_RESERVED; + hwcpu->status &= ~SDLA_MEM_RESERVED; } - if (hw->status & SDLA_PCI_ENABLE){ + if (hwcpu->status & SDLA_PCI_ENABLE){ /* FIXME: No allowed to do this because bar1 might * still be used. Need a pci dev counter */ /* sdla_pci_disable_device(hw); */ - hw->status &= ~SDLA_PCI_ENABLE; + hwcpu->status &= ~SDLA_PCI_ENABLE; } - break; } return 0; @@ -5555,25 +6913,28 @@ static int sdla_memory_unmap(sdlahw_t* hw) static int sdla_detect_aft(sdlahw_t* hw) { sdlahw_card_t *hwcard; + sdlahw_cpu_t *hwcpu; int err; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; - if ((err = sdla_memory_map(hw, hw->cpu_no))){ + if ((err = sdla_memory_map(hw, hwcpu->cpu_no))){ return err; } DEBUG_EVENT( "%s: AFT PCI memory at 0x%lX\n", - hw->devname, (unsigned long)hw->mem_base_addr); + hw->devname, (unsigned long)hwcpu->mem_base_addr); #if defined(__LINUX__) - hw->irq = hwcard->pci_dev->irq; + hwcpu->irq = hwcard->pci_dev->irq; #else - sdla_pci_read_config_byte(hw, PCI_INT_LINE_BYTE, (u8*)&hw->irq); + sdla_pci_read_config_byte(hw, PCI_INT_LINE_BYTE, (u8*)&hwcpu->irq); #endif - if(hw->irq == PCI_IRQ_NOT_ALLOCATED) { + if(hwcpu->irq == PCI_IRQ_NOT_ALLOCATED) { sdla_memory_unmap(hw); DEBUG_EVENT( "%s: IRQ not allocated to AFT adapter\n", hw->devname); @@ -5581,16 +6942,88 @@ static int sdla_detect_aft(sdlahw_t* hw) } DEBUG_EVENT( "%s: IRQ %d allocated to the AFT PCI card\n", - hw->devname, hw->irq); + hw->devname, hwcpu->irq); /* Set PCI Latency of 0xFF*/ - sdla_pci_write_config_dword(hw, XILINX_PCI_LATENCY_REG, XILINX_PCI_LATENCY); - + sdla_pci_write_config_dword(hw, XILINX_PCI_LATENCY_REG, XILINX_PCI_LATENCY); return 0; } +/*============================================================================ +** Compare current hw adapter for auto pci configuration. +**/ +static int sdla_cmp_adapter_auto(sdlahw_t *hw, wandev_conf_t* conf) +{ + sdlahw_cpu_t *hwcpu = NULL; + int cpu_no = SDLA_CPU_A; + + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + + switch(conf->card_type){ + case WANOPT_S51X: + case WANOPT_ADSL: + case WANOPT_AFT: + case WANOPT_AFT300: + case WANOPT_AFT_ANALOG: + case WANOPT_AFT_ISDN: + case WANOPT_AFT_56K: + case WANOPT_AFT101: + case WANOPT_AFT102: + case WANOPT_AFT104: + case WANOPT_AFT108: + + if (hwcpu->cpu_no == cpu_no && + conf->card_type == WANOPT_AFT && + hwcpu->hwcard->cfg_type == WANOPT_AFT101) { + /* Remap the card type to standard + A104 Shark style. We are allowing + and old config file for A101/2-SH */ + conf->config_id = WANCONFIG_AFT_TE1; + conf->card_type = WANOPT_AFT104; + conf->fe_cfg.line_no=1; + return 0; + } + + /* Allow old A102 config for A102 SHARK */ + if (hwcpu->cpu_no == cpu_no && + conf->card_type == WANOPT_AFT && + hwcpu->hwcard->cfg_type == WANOPT_AFT102) { + /* Remap the card type to standard + A104 Shark style. We are allowing + and old config file for A101/2-SH */ + conf->config_id = WANCONFIG_AFT_TE1; + conf->card_type = WANOPT_AFT104; + if (cpu_no == SDLA_CPU_A) { + conf->fe_cfg.line_no=1; + } else { + conf->fe_cfg.line_no=2; + } + return 0; + } + + if (conf->config_id == WANCONFIG_AFT_TE1){ + if (hwcpu->cpu_no == cpu_no && + hw->port_no == conf->fe_cfg.line_no-1 && + (hwcpu->hwcard->cfg_type == WANOPT_AFT101 || + hwcpu->hwcard->cfg_type == WANOPT_AFT102 || + hwcpu->hwcard->cfg_type == WANOPT_AFT104 || + hwcpu->hwcard->cfg_type == WANOPT_AFT108)) { + return 0; + } + }else{ + if (hwcpu->cpu_no == cpu_no && + hwcpu->hwcard->cfg_type == conf->card_type){ + return 0; + } + } + break; + } + return 1; +} + /*============================================================================ * Find the S514 PCI adapter in the PCI bus. * If conf argument is NULL, return fisrt not used adapter (CONFIG_PRODUCT_WANPIPE_GENERIC) @@ -5598,7 +7031,8 @@ static int sdla_detect_aft(sdlahw_t* hw) */ static sdlahw_t* sdla_find_adapter(wandev_conf_t* conf, char* devname) { - sdlahw_t* hw = NULL; + sdlahw_t *hw = NULL; + sdlahw_cpu_t *hwcpu = NULL; int cpu_no = SDLA_CPU_A; if (conf && conf->S514_CPU_no[0] == 'B'){ @@ -5609,180 +7043,156 @@ static sdlahw_t* sdla_find_adapter(wandev_conf_t* conf, char* devname) WAN_LIST_FOREACH(hw, &sdlahw_head, next){ + WAN_ASSERT_RC(hw->hwcpu == NULL, NULL); + hwcpu = hw->hwcpu; if (conf == NULL){ - if (hw->used < hw->max_ports){ + if (hw->used == 0/*hwcpu->used < hwcpu->max_ports*/){ return hw; } continue; } + if (conf->auto_pci_cfg){ + if (!sdla_cmp_adapter_auto(hw, conf)){ + goto adapter_found; + } + } switch(conf->card_type){ #if defined(WAN_ISA_SUPPORT) case WANOPT_S50X: - if (hw->hwcard->ioport == conf->ioport){ + if (hwcpu->hwcard->ioport == conf->ioport){ goto adapter_found; } break; #endif - case WANOPT_S51X: case WANOPT_ADSL: - case WANOPT_AFT: case WANOPT_AFT300: case WANOPT_AFT_ANALOG: case WANOPT_AFT_56K: - if (conf->auto_pci_cfg){ - /* Allow old A101 config for A101 SHARK */ - if (hw->cpu_no == cpu_no && - conf->card_type == WANOPT_AFT && - hw->hwcard->cfg_type == WANOPT_AFT101) { - /* Remap the card type to standard - A104 Shark style. We are allowing - and old config file for A101/2-SH */ - conf->config_id = WANCONFIG_AFT_TE1; - conf->card_type = WANOPT_AFT104; - conf->fe_cfg.line_no=1; - goto adapter_found; - } + if ((hwcpu->hwcard->slot_no == conf->PCI_slot_no) && + (hwcpu->hwcard->bus_no == conf->pci_bus_no) && + (hwcpu->hwcard->cfg_type == conf->card_type)){ + goto adapter_found; + } + break; - /* Allow old A102 config for A102 SHARK */ - if (hw->cpu_no == cpu_no && - conf->card_type == WANOPT_AFT && - hw->hwcard->cfg_type == WANOPT_AFT102) { - /* Remap the card type to standard - A104 Shark style. We are allowing - and old config file for A101/2-SH */ - conf->config_id = WANCONFIG_AFT_TE1; - conf->card_type = WANOPT_AFT104; - if (cpu_no == SDLA_CPU_A) { - conf->fe_cfg.line_no=1; - } else { - conf->fe_cfg.line_no=2; - } - goto adapter_found; - } + case WANOPT_AFT_SERIAL: - if (conf->card_type == WANOPT_S51X && - IS_56K_MEDIA(&conf->fe_cfg) && - hw->hwcard->cfg_type == WANOPT_AFT_56K) { - /* Remap the old 56K card type to standard - AFT 56K Shark style. We are allowing - and old config file for 56K */ - conf->card_type = WANOPT_AFT_56K; - conf->config_id = WANCONFIG_AFT_56K; - conf->fe_cfg.line_no=1; - goto adapter_found; - } + if ((hwcpu->hwcard->slot_no == conf->PCI_slot_no) && + (hwcpu->hwcard->bus_no == conf->pci_bus_no) && + (hwcpu->hwcard->cfg_type == conf->card_type) && + (hw->port_no == conf->fe_cfg.line_no-1)){ + goto adapter_found; + } + break; - if (hw->cpu_no == cpu_no && - hw->hwcard->cfg_type == conf->card_type){ + case WANOPT_S51X: + if (IS_56K_MEDIA(&conf->fe_cfg) && + hwcpu->hwcard->slot_no == conf->PCI_slot_no && + hwcpu->hwcard->bus_no == conf->pci_bus_no && + hwcpu->hwcard->cfg_type == WANOPT_AFT_56K) { + /* Remap the old 56K card type to standard + AFT 56K Shark style. We are allowing + and old config file for 56K */ + conf->card_type = WANOPT_AFT_56K; + conf->config_id = WANCONFIG_AFT_56K; + conf->fe_cfg.line_no=1; + goto adapter_found; + }else if ((hwcpu->hwcard->slot_no == conf->PCI_slot_no) && + (hwcpu->hwcard->bus_no == conf->pci_bus_no) && + (hwcpu->cpu_no == cpu_no) && + (hw->port_no == conf->comm_port) && + (hwcpu->hwcard->cfg_type == conf->card_type)){ goto adapter_found; - } - }else{ + } + break; - /* Allow old A101 config for A101 SHARK */ - if (conf->card_type == WANOPT_AFT && - hw->hwcard->slot_no == conf->PCI_slot_no && - hw->hwcard->bus_no == conf->pci_bus_no && - hw->hwcard->cfg_type == WANOPT_AFT101) { - /* Remap the card type to standard - A104 Shark style. We are allowing - and old config file for A101/2-SH */ - conf->config_id = WANCONFIG_AFT_TE1; - conf->card_type = WANOPT_AFT104; + case WANOPT_AFT: + /* Allow old A101 config for A101 SHARK */ + if (conf->card_type == WANOPT_AFT && + hwcpu->hwcard->slot_no == conf->PCI_slot_no && + hwcpu->hwcard->bus_no == conf->pci_bus_no && + hwcpu->hwcard->cfg_type == WANOPT_AFT101) { + /* Remap the card type to standard + A104 Shark style. We are allowing + and old config file for A101/2-SH */ + conf->config_id = WANCONFIG_AFT_TE1; + conf->card_type = WANOPT_AFT104; + conf->fe_cfg.line_no=1; + goto adapter_found; + } + + /* Allow old A102 config for A102 SHARK */ + if (conf->card_type == WANOPT_AFT && + hwcpu->hwcard->slot_no == conf->PCI_slot_no && + hwcpu->hwcard->bus_no == conf->pci_bus_no && + hwcpu->hwcard->cfg_type == WANOPT_AFT102) { + /* Remap the card type to standard + A104 Shark style. We are allowing + and old config file for A101/2-SH */ + conf->config_id = WANCONFIG_AFT_TE1; + conf->card_type = WANOPT_AFT104; + if (cpu_no == SDLA_CPU_A) { conf->fe_cfg.line_no=1; - goto adapter_found; - - } - - /* Allow old A102 config for A102 SHARK */ - if (conf->card_type == WANOPT_AFT && - hw->hwcard->slot_no == conf->PCI_slot_no && - hw->hwcard->bus_no == conf->pci_bus_no && - hw->hwcard->cfg_type == WANOPT_AFT102) { - /* Remap the card type to standard - A104 Shark style. We are allowing - and old config file for A101/2-SH */ - conf->config_id = WANCONFIG_AFT_TE1; - conf->card_type = WANOPT_AFT104; - if (cpu_no == SDLA_CPU_A) { - conf->fe_cfg.line_no=1; - } else { - conf->fe_cfg.line_no=2; - } - goto adapter_found; + } else { + conf->fe_cfg.line_no=2; } + goto adapter_found; + } - if (conf->card_type == WANOPT_S51X && - IS_56K_MEDIA(&conf->fe_cfg) && - hw->hwcard->slot_no == conf->PCI_slot_no && - hw->hwcard->bus_no == conf->pci_bus_no && - hw->hwcard->cfg_type == WANOPT_AFT_56K) { - /* Remap the old 56K card type to standard - AFT 56K Shark style. We are allowing - and old config file for 56K */ - conf->card_type = WANOPT_AFT_56K; - conf->config_id = WANCONFIG_AFT_56K; - conf->fe_cfg.line_no=1; - goto adapter_found; - - } + if (conf->card_type == WANOPT_S51X && + IS_56K_MEDIA(&conf->fe_cfg) && + hwcpu->hwcard->slot_no == conf->PCI_slot_no && + hwcpu->hwcard->bus_no == conf->pci_bus_no && + hwcpu->hwcard->cfg_type == WANOPT_AFT_56K) { + /* Remap the old 56K card type to standard + AFT 56K Shark style. We are allowing + and old config file for 56K */ + conf->card_type = WANOPT_AFT_56K; + conf->config_id = WANCONFIG_AFT_56K; + conf->fe_cfg.line_no=1; + goto adapter_found; + + } - - if ((hw->hwcard->slot_no == conf->PCI_slot_no) && - (hw->hwcard->bus_no == conf->pci_bus_no) && - (hw->cpu_no == cpu_no) && - (hw->hwcard->cfg_type == conf->card_type)){ - goto adapter_found; - } + if ((hwcpu->hwcard->slot_no == conf->PCI_slot_no) && + (hwcpu->hwcard->bus_no == conf->pci_bus_no) && + (hwcpu->cpu_no == cpu_no) && + (hwcpu->hwcard->cfg_type == conf->card_type)){ + goto adapter_found; } break; + case WANOPT_AFT_ISDN: + if ((hwcpu->hwcard->slot_no == conf->PCI_slot_no) && + (hwcpu->hwcard->bus_no == conf->pci_bus_no) && + (hw->port_no == conf->fe_cfg.line_no-1) && + (hwcpu->hwcard->cfg_type == conf->card_type)){ + goto adapter_found; + } + break; + case WANOPT_AFT101: case WANOPT_AFT102: case WANOPT_AFT104: case WANOPT_AFT108: - if (conf->auto_pci_cfg){ - - switch (hw->hwcard->cfg_type){ - case WANOPT_AFT101: - case WANOPT_AFT102: - case WANOPT_AFT104: - case WANOPT_AFT108: - goto adapter_found; - break; - default: - break; - } - }else{ - - if ((hw->hwcard->slot_no == conf->PCI_slot_no) && - (hw->hwcard->bus_no == conf->pci_bus_no)){ - - switch (hw->hwcard->cfg_type){ - case WANOPT_AFT101: - case WANOPT_AFT102: - case WANOPT_AFT104: - case WANOPT_AFT108: - goto adapter_found; - break; - default: - break; - } - } + if ((hwcpu->hwcard->slot_no == conf->PCI_slot_no) && + (hwcpu->hwcard->bus_no == conf->pci_bus_no) && + (hw->port_no == conf->fe_cfg.line_no-1)){ + goto adapter_found; } break; - default: DEBUG_EVENT("%s: Unknown card type (%x) requested by user!\n", devname, conf->card_type); return NULL; } - } + }/* WAN_LIST_FOREACH */ adapter_found: - if (hw){ - switch(hw->hwcard->adptr_type){ + if (hw && hwcpu){ + switch(hwcpu->hwcard->adptr_type){ case S5144_ADPTR_1_CPU_T1E1: case S5147_ADPTR_2_CPU_T1E1: case A101_ADPTR_1TE1: @@ -5792,8 +7202,19 @@ adapter_found: conf->comm_port = 0; conf->fe_cfg.line_no = 0; break; +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_BRI) + case AFT_ADPTR_ISDN: + if (conf->fe_cfg.line_no < 1 || conf->fe_cfg.line_no > MAX_BRI_LINES){ + DEBUG_EVENT("%s: Error, Invalid port selected %d (Min=1 Max=%d)\n", + devname, conf->fe_cfg.line_no, MAX_BRI_LINES); + return NULL; + } + conf->fe_cfg.line_no--; + conf->comm_port = conf->fe_cfg.line_no; + break; +#endif case A101_ADPTR_2TE1: - if (hw->hwcard->adptr_subtype == AFT_SUBTYPE_NORMAL){ + if (hwcpu->hwcard->adptr_subtype == AFT_SUBTYPE_NORMAL){ conf->comm_port = 0; conf->fe_cfg.line_no = 0; break; @@ -5824,8 +7245,28 @@ adapter_found: conf->fe_cfg.line_no--; conf->comm_port = conf->fe_cfg.line_no; break; + case AFT_ADPTR_2SERIAL_V35X21: + case AFT_ADPTR_2SERIAL_RS232: + if (conf->fe_cfg.line_no < 1 || conf->fe_cfg.line_no > 2){ + DEBUG_EVENT("%s: Error, Invalid port selected %d (Min=1 Max=2)\n", + devname, conf->fe_cfg.line_no); + return NULL; + } + conf->fe_cfg.line_no--; + conf->comm_port = conf->fe_cfg.line_no; + break; + case AFT_ADPTR_4SERIAL_V35X21: + case AFT_ADPTR_4SERIAL_RS232: + if (conf->fe_cfg.line_no < 1 || conf->fe_cfg.line_no > 4){ + DEBUG_EVENT("%s: Error, Invalid port selected %d (Min=1 Max=4)\n", + devname, conf->fe_cfg.line_no); + return NULL; + } + conf->fe_cfg.line_no--; + conf->comm_port = conf->fe_cfg.line_no; + break; } - if (hw->hwport[conf->comm_port].used == 0){ + if (hw->used == 0){ return hw; } switch(conf->card_type){ @@ -5846,11 +7287,14 @@ adapter_found: case WANOPT_AFT108: case WANOPT_AFT300: case WANOPT_AFT_ANALOG: + case WANOPT_AFT_ISDN: case WANOPT_AFT_56K: - switch(hw->hwcard->adptr_type){ + case WANOPT_AFT_SERIAL: + + switch(hwcpu->hwcard->adptr_type){ case A101_ADPTR_1TE1: case A101_ADPTR_2TE1: - if (hw->hwcard->adptr_subtype == AFT_SUBTYPE_NORMAL){ + if (hwcpu->hwcard->adptr_subtype == AFT_SUBTYPE_NORMAL){ DEBUG_EVENT( "%s: Error, %s resources busy: (bus #%d, slot #%d, cpu %c)\n", devname, @@ -5903,7 +7347,7 @@ adapter_found: break; } return NULL; - } + }/* if (hw) */ if (conf){ switch(conf->card_type){ @@ -5939,7 +7383,10 @@ adapter_found: case WANOPT_AFT108: case WANOPT_AFT300: case WANOPT_AFT_ANALOG: + case WANOPT_AFT_ISDN: case WANOPT_AFT_56K: + case WANOPT_AFT_SERIAL: + DEBUG_EVENT( "%s: Error, %s card not found on bus #%d, slot #%d, cpu %c, line %d\n", devname, @@ -5959,7 +7406,7 @@ adapter_found: }else{ DEBUG_EVENT("%s: Error, Failed to find new Sangoma card!\n", devname); - } + }/* if (conf) */ return NULL; } @@ -5978,11 +7425,14 @@ adapter_found: static int sdla_detect (sdlahw_t* hw) { sdlahw_card_t *hwcard = NULL; + sdlahw_cpu_t *hwcpu; int err = 0; WAN_ASSERT(hw == NULL); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; switch (hwcard->type){ #if defined(WAN_ISA_SUPPORT) case SDLA_S508: @@ -6020,13 +7470,17 @@ static int sdla_detect (sdlahw_t* hw) static int sdla_is_te1(void* phw) { - sdlahw_card_t* hwcard = NULL; - sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard = NULL; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + switch(hwcard->adptr_type){ case S5144_ADPTR_1_CPU_T1E1: case S5147_ADPTR_2_CPU_T1E1: @@ -6043,13 +7497,16 @@ static int sdla_is_te1(void* phw) } static int sdla_is_56k(void* phw) { - sdlahw_card_t* hwcard = NULL; - sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard = NULL; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; if (hwcard->adptr_type == S5145_ADPTR_1_CPU_56K){ return 0; } @@ -6062,12 +7519,16 @@ static int sdla_is_56k(void* phw) static int sdla_check_mismatch(void* phw, unsigned char media) { sdlahw_card_t* hwcard = NULL; + sdlahw_cpu_t* hwcpu = NULL; sdlahw_t* hw = (sdlahw_t*)phw; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + if (media == WAN_MEDIA_T1 || media == WAN_MEDIA_E1){ if (hwcard->adptr_type != S5144_ADPTR_1_CPU_T1E1 && @@ -6105,8 +7566,27 @@ static int sdla_is_same_hwcard(void* phw1, void *phw2) { sdlahw_t* hw1 = (sdlahw_t*)phw1; sdlahw_t* hw2 = (sdlahw_t*)phw2; + sdlahw_cpu_t *hwcpu1, *hwcpu2; - if (hw1->hwcard == hw2->hwcard){ + WAN_ASSERT_RC(hw1->hwcpu == NULL, 0); + WAN_ASSERT_RC(hw2->hwcpu == NULL, 0); + hwcpu1 = hw1->hwcpu; + hwcpu2 = hw2->hwcpu; + + if (hwcpu1->hwcard == hwcpu2->hwcard){ + return 1; + } + return 0; +} + +static int sdla_is_same_hwcpu(void* phw1, void *phw2) +{ + sdlahw_t* hw1 = (sdlahw_t*)phw1; + sdlahw_t* hw2 = (sdlahw_t*)phw2; + + WAN_ASSERT_RC(hw1 == NULL, 0); + WAN_ASSERT_RC(hw2 == NULL, 0); + if (hw1->hwcpu == hw2->hwcpu){ return 1; } return 0; @@ -6122,41 +7602,85 @@ static int sdla_is_same_hwcard(void* phw1, void *phw2) static int sdla_set_intrhand(void* phw, wan_pci_ifunc_t *isr_func, void* arg, int line_no) { + sdlahw_card_t *hwcard; + sdlahw_cpu_t *hwcpu; sdlahw_t* hw = (sdlahw_t*)phw; +#if defined(SDLA_AUTO_PROBE) + struct sdla_softc *adapter; +#else sdladev_t* adapter = NULL; +#endif #if defined(__FreeBSD__) && (__FreeBSD_version >= 450000) int error = 0; #endif + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; SDLA_MAGIC(hw); - adapter = (sdladev_t*)hw->dev; + +#if defined(SDLA_AUTO_PROBE) + adapter = device_get_softc(hwcard->pci_dev); +# if __FreeBSD_version < 700031 + error = bus_setup_intr( + hwcard->pci_dev, + adapter->irq_res, + INTR_TYPE_NET/*|INTR_MPSAFE*/, + isr_func, arg, &hwcpu->irqh[line_no]); +# else + error = bus_setup_intr( + hwcard->pci_dev, + adapter->irq_res, + INTR_TYPE_NET/*|INTR_MPSAFE*/,NULL, + isr_func, arg, &hwcpu->irqh[line_no]); +# endif + if (error){ + DEBUG_EVENT( + "%s: Failed set interrupt handler for Port %d (er=%d)!\n", + device_get_name(hwcard->pci_dev), line_no, + error); + return error; + } +#else + adapter = (sdladev_t*)hwcpu->sdla_dev; WAN_ASSERT(adapter == NULL); WAN_ASSERT(adapter->sc == NULL); -#if defined(__FreeBSD__) && (__FreeBSD_version >= 450000) +# if defined(__FreeBSD__) && (__FreeBSD_version >= 450000) +# if __FreeBSD_version < 700031 error = bus_setup_intr( adapter->dev, - adapter->sc->irq_res, - INTR_TYPE_NET, - isr_func, - arg, - &hw->irqh[line_no]); + adapter->sc->irq_res, + INTR_TYPE_NET, isr_func, arg, + &hwcpu->irqh[line_no]); +# else + error = bus_setup_intr( + adapter->dev, + adapter->sc->irq_res, + INTR_TYPE_NET, NULL, isr_func, arg, + &hwcpu->irqh[line_no]); +# endif if (error){ - DEBUG_EVENT("%s: Failed set interrupt handler for CPU A!\n", - device_get_name(adapter->dev)); + DEBUG_EVENT( + "%s: Failed set interrupt handler for Port %d (er=%d)!\n", + device_get_name(adapter->dev), line_no, + error); return error; } -#else +# else if (adapter->intr_arg[line_no].ready){ adapter->intr_arg[line_no].isr = isr_func; adapter->intr_arg[line_no].arg = arg; }else{ return -EINVAL; } +# endif #endif - return 0; + return 0; } #endif @@ -6169,26 +7693,57 @@ sdla_set_intrhand(void* phw, wan_pci_ifunc_t *isr_func, void* arg, int line_no) #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) static int sdla_restore_intrhand(void* phw, int line_no) { - sdlahw_t* hw = (sdlahw_t*)phw; - sdladev_t* adapter = NULL; - + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; +#if defined(SDLA_AUTO_PROBE) + struct sdla_softc *adapter; +#else + sdladev_t *adapter = NULL; +#endif +#if defined(__FreeBSD__) && (__FreeBSD_version >= 450000) + int error; +#endif + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard= hwcpu->hwcard; SDLA_MAGIC(hw); - adapter = (sdladev_t*)hw->dev; + +#if defined(SDLA_AUTO_PROBE) + adapter = device_get_softc(hwcard->pci_dev); + error = bus_teardown_intr( + hwcard->pci_dev,adapter->irq_res,hwcpu->irqh[line_no]); + if (error){ + DEBUG_EVENT( + "%s: Failed unregister interrupt handler for Port %d (%d)!\n", + device_get_name(hwcard->pci_dev), line_no, + error); + return -EINVAL; + } + hwcpu->irqh[line_no] = NULL; + +#else + + adapter = (sdladev_t*)hwcpu->sdla_dev; WAN_ASSERT(adapter == NULL); WAN_ASSERT(adapter->sc == NULL); -#if defined(__FreeBSD__) && (__FreeBSD_version >= 450000) - - if (bus_teardown_intr(adapter->dev, adapter->sc->irq_res, hw->irqh[line_no])){ - DEBUG_EVENT("%s: Failed unregister interrupt handler!\n", - device_get_name(adapter->dev)); +# if defined(__FreeBSD__) && (__FreeBSD_version >= 450000) + error = bus_teardown_intr(adapter->dev, adapter->sc->irq_res, hwcpu->irqh[line_no]); + if (error){ + DEBUG_EVENT( + "%s: Failed unregister interrupt handler for Port %d (%d)!\n", + device_get_name(adapter->dev), line_no, + error); return -EINVAL; - } -#else +# else /* Restore local vector */ adapter->intr_arg[line_no].isr = NULL; adapter->intr_arg[line_no].arg = NULL; +# endif #endif return 0; } @@ -6199,51 +7754,55 @@ static int sdla_restore_intrhand(void* phw, int line_no) static int sdla_getcfg(void* phw, int type, void* value) { sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_cpu_t* hwcpu; sdlahw_card_t* hwcard; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + switch(type){ case SDLA_HWTYPE: - *(u16*)value = hwcard->hw_type; + *(u16*)value = (u16)hwcard->hw_type; break; case SDLA_CARDTYPE: - *(u16*)value = hwcard->type; + *(u16*)value = (u16)hwcard->type; break; case SDLA_MEMBASE: - *(sdla_mem_handle_t*)value = hw->dpmbase; + *(sdla_mem_handle_t*)value = hwcpu->dpmbase; break; case SDLA_MEMEND: - *(u32*)value = ((unsigned long)hw->dpmbase + hw->dpmsize - 1); + *(u32*)value = ((unsigned long)hwcpu->dpmbase + hwcpu->dpmsize - 1); break; case SDLA_MEMSIZE: - *(u16*)value = hw->dpmsize; + *(u16*)value = (u16)hwcpu->dpmsize; break; case SDLA_MEMORY: - *(u32*)value = hw->memory; + *(u32*)value = hwcpu->memory; break; case SDLA_IRQ: - *(u16*)value = hw->irq; + *(u16*)value = (u16)hwcpu->irq; break; case SDLA_IOPORT: - *(u16*)value = hwcard->ioport; + *(u16*)value = (u16)hwcard->ioport; break; case SDLA_IORANGE: - *(u16*)value = hw->io_range; + *(u16*)value = (u16)hwcpu->io_range; break; case SDLA_ADAPTERTYPE: - *(u16*)value = hwcard->adptr_type; + *(u16*)value = (u16)hwcard->adptr_type; break; case SDLA_CPU: - *(u16*)value = hw->cpu_no; + *(u16*)value = (u16)hwcpu->cpu_no; break; case SDLA_SLOT: - *(u16*)value = hwcard->slot_no; + *(u16*)value = (u16)hwcard->slot_no; break; case SDLA_BUS: - *(u16*)value = hwcard->bus_no; + *(u16*)value = (u16)hwcard->bus_no; break; case SDLA_DMATAG: #if defined(__NetBSD__) || defined(__OpenBSD__) @@ -6256,7 +7815,7 @@ static int sdla_getcfg(void* phw, int type, void* value) *(u8*)value = hwcard->pci_extra_ver; break; case SDLA_BASEADDR: - *(u32*)value = hw->mem_base_addr; + *(u32*)value = hwcpu->mem_base_addr; break; case SDLA_COREREV: *(u8*)value = hwcard->core_rev; @@ -6264,8 +7823,12 @@ static int sdla_getcfg(void* phw, int type, void* value) case SDLA_COREID: *(u8*)value = hwcard->core_id; break; - case SDLA_USEDCNT: - *(u32*)value = hw->used; + case SDLA_HWCPU_USEDCNT: +#if defined(__WINDOWS__) + *(u32*)value = get_usage_counter(hw->p_sdla); +#else + *(u32*)value = hwcpu->used; +#endif break; case SDLA_ADAPTERSUBTYPE: *(u8*)value = hwcard->adptr_subtype; @@ -6273,19 +7836,65 @@ static int sdla_getcfg(void* phw, int type, void* value) case SDLA_HWEC_NO: *(u16*)value = hwcard->hwec_chan_no; break; + case SDLA_PCIEXPRESS: + *(u8*)value = (u8)sdla_is_pciexpress(hw); + break; + case SDLA_PORTS_NO: + *(u16*)value = (u16)hwcpu->max_ports; + break; + case SDLA_PORT_MAP: + *(u32*)value = hwcpu->port_map; + break; + case SDLA_HWPORTUSED: + *(u16*)value = (u16)hw->used; + DEBUG_BRI("SDLA_HWPORTUSED: %d\n", hw->used); + break; + case SDLA_HWPORTREG: + *(u16*)value = (u16)hw->hwcpu->reg_port[hw->port_no]; + break; + case SDLA_RECOVERY_CLOCK_FLAG: + *(u32*)value = hwcard->recovery_clock_flag; + break; + case SDLA_HWPORTREGMAP: + *(u32*)value = (u32)hw->hwcpu->reg_port_map; + break; } return 0; } -static int sdla_get_hwcard(void* phw, void** phwcard) +static int sdla_setcfg(void* phw, int type, void* value) { sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_cpu_t* hwcpu; + sdlahw_card_t* hwcard; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; - *phwcard = hw->hwcard; + switch(type){ + case SDLA_RECOVERY_CLOCK_FLAG: + hwcard->recovery_clock_flag = *(u32*)value; + break; + } + return 0; +} + +static int sdla_get_hwcard(void* phw, void** phwcard) +{ + sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + SDLA_MAGIC(hw); + + *phwcard = hwcpu->hwcard; return 0; } @@ -6297,8 +7906,8 @@ static int sdla_get_hwprobe(void* phw, int port, void** hwinfo) WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - if (hw->hwport[port].hwprobe){ - *hwinfo = hw->hwport[port].hwprobe->hw_info; + if (hw->hwprobe){ + *hwinfo = hw->hwprobe->hw_info; } return 0; } @@ -6311,6 +7920,7 @@ static int sdla_get_hwprobe(void* phw, int port, void** hwinfo) ***************************************************************************** */ +#if defined(WAN_ISA_SUPPORT) /*============================================================================ * Get option's index into the options list. * Return option's index (1 .. N) or zero if option is invalid. @@ -6324,6 +7934,7 @@ static int sdla_get_option_index (unsigned* optlist, unsigned optval) return i; return 0; } +#endif /*============================================================================ * Calculate 16-bit CRC using CCITT polynomial. @@ -6349,16 +7960,22 @@ static unsigned short sdla_checksum (unsigned char* buf, unsigned len) static int sdla_io_read_1(void* phw, unsigned int offset, u8* value) { - sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; WAN_ASSERT2(hw == NULL, 0); - if (!(hw->status & SDLA_IO_MAPPED)) return 0; + WAN_ASSERT2(hw->hwcpu == NULL, 0); + hwcpu = hw->hwcpu; + + if (!(hwcpu->status & SDLA_IO_MAPPED)) return 0; #if defined(__FreeBSD__) - *value = readb ((u8*)hw->vector + offset); + *value = readb ((u8*)hwcpu->vector + offset); #elif defined(__NetBSD__) || defined(__OpenBSD__) - *value = bus_space_read_1(hw->hwcard->memt, hw->vector, offset); + *value = bus_space_read_1(hwcpu->hwcard->memt, hwcpu->vector, offset); #elif defined(__LINUX__) - *value = wp_readb((hw->vector + offset)); + *value = wp_readb((hwcpu->vector + offset)); +#elif defined(__WINDOWS__) + *value = READ_REGISTER_UCHAR((PUCHAR)((PUCHAR)hwcpu->vector + offset)); #else # warning "sdla_io_read_1: Not supported yet!" #endif @@ -6367,16 +7984,22 @@ static int sdla_io_read_1(void* phw, unsigned int offset, u8* value) static int sdla_io_write_1(void* phw, unsigned int offset, u8 value) { - sdlahw_t* hw = (sdlahw_t*)phw; - + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + WAN_ASSERT(hw == NULL); - if (!(hw->status & SDLA_IO_MAPPED)) return 0; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + + if (!(hwcpu->status & SDLA_IO_MAPPED)) return 0; #if defined(__FreeBSD__) - writeb ((u8*)hw->vector+offset, value); + writeb ((u8*)hwcpu->vector+offset, value); #elif defined(__NetBSD__) || defined(__OpenBSD__) - bus_space_write_1(hw->hwcard->memt, hw->vector, offset, value); + bus_space_write_1(hwcpu->hwcard->memt, hwcpu->vector, offset, value); #elif defined(__LINUX__) - wp_writeb(value, hw->vector + offset); + wp_writeb(value, hwcpu->vector + offset); +#elif defined(__WINDOWS__) + WRITE_REGISTER_UCHAR((PUCHAR)((PUCHAR)hwcpu->vector + offset), value); #else # warning "sdla_io_write_1: Not supported yet!" #endif @@ -6386,16 +8009,23 @@ static int sdla_io_write_1(void* phw, unsigned int offset, u8 value) int sdla_bus_write_1(void* phw, unsigned int offset, u8 value) { sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - if (!(hw->status & SDLA_MEM_MAPPED)) return 0; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + + if (!(hwcpu->status & SDLA_MEM_MAPPED)) return 0; #if defined(__FreeBSD__) - writeb(((u8*)hw->dpmbase + offset), value); + writeb(((u8*)hwcpu->dpmbase + offset), value); #elif defined(__NetBSD__) || defined(__OpenBSD__) - bus_space_write_1(hw->hwcard->memt, hw->dpmbase, offset, value); + bus_space_write_1(hwcpu->hwcard->memt, hwcpu->dpmbase, offset, value); #elif defined(__LINUX__) - wp_writeb(value, hw->dpmbase + offset); + /*DEBUG_BRI("%s(): offset: 0x%X, value: 0x%X\n", __FUNCTION__, offset, value);*/ + wp_writeb(value, hwcpu->dpmbase + offset); +#elif defined(__WINDOWS__) + WRITE_REGISTER_UCHAR((PUCHAR)((PUCHAR)hwcpu->dpmbase + offset), value); #else # warning "sdla_bus_write_1: Not supported yet!" #endif @@ -6405,16 +8035,23 @@ int sdla_bus_write_1(void* phw, unsigned int offset, u8 value) int sdla_bus_write_2(void* phw, unsigned int offset, u16 value) { sdlahw_t* hw = (sdlahw_t*)phw; - + sdlahw_cpu_t *hwcpu; + WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - if (!(hw->status & SDLA_MEM_MAPPED)) return 0; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + + if (!(hwcpu->status & SDLA_MEM_MAPPED)) return 0; #if defined(__FreeBSD__) - writew(((u8*)hw->dpmbase + offset), value); + writew(((u8*)hwcpu->dpmbase + offset), value); #elif defined(__NetBSD__) || defined(__OpenBSD__) - bus_space_write_2(hw->hwcard->memt, hw->dpmbase, offset, value); + bus_space_write_2(hwcpu->hwcard->memt, hwcpu->dpmbase, offset, value); #elif defined(__LINUX__) - wp_writew(value,hw->dpmbase+offset); + /*DEBUG_BRI("%s(): offset: 0x%X, value: 0x%X\n", __FUNCTION__, offset, value);*/ + wp_writew(value,hwcpu->dpmbase+offset); +#elif defined(__WINDOWS__) + WRITE_REGISTER_USHORT((PUSHORT)((PUCHAR)hwcpu->dpmbase + offset), value); #else # warning "sdla_bus_write_2: Not supported yet!" #endif @@ -6424,16 +8061,27 @@ int sdla_bus_write_2(void* phw, unsigned int offset, u16 value) int sdla_bus_write_4(void* phw, unsigned int offset, u32 value) { sdlahw_t* hw = (sdlahw_t*)phw; - + sdlahw_cpu_t *hwcpu; + WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - if (!(hw->status & SDLA_MEM_MAPPED)) return 0; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + + if (!(hwcpu->status & SDLA_MEM_MAPPED)) return 0; + + DEBUG_TEST("%s(): Offset=0x%04X Data=0x%08X\n", __FUNCTION__, + offset, value); + #if defined(__FreeBSD__) - writel(((u8*)hw->dpmbase + offset), value); + writel(((u8*)hwcpu->dpmbase + offset), value); #elif defined(__NetBSD__) || defined(__OpenBSD__) - bus_space_write_4(hw->hwcard->memt, hw->dpmbase, offset, value); + bus_space_write_4(hwcpu->hwcard->memt, hwcpu->dpmbase, offset, value); #elif defined(__LINUX__) - wp_writel(value,(u8*)hw->dpmbase + offset); + /*DEBUG_BRI("%s(): offset: 0x%X, value: 0x%X\n", __FUNCTION__, offset, value);*/ + wp_writel(value,(u8*)hwcpu->dpmbase + offset); +#elif defined(__WINDOWS__) + WRITE_REGISTER_ULONG((PULONG)((PUCHAR)hwcpu->dpmbase + offset), value); #else # warning "sdla_bus_write_4: Not supported yet!" #endif @@ -6443,16 +8091,22 @@ int sdla_bus_write_4(void* phw, unsigned int offset, u32 value) int sdla_bus_read_1(void* phw, unsigned int offset, u8* value) { sdlahw_t* hw = (sdlahw_t*)phw; - + sdlahw_cpu_t *hwcpu; + WAN_ASSERT2(hw == NULL, 0); SDLA_MAGIC(hw); - if (!(hw->status & SDLA_MEM_MAPPED)) return 0; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + + if (!(hwcpu->status & SDLA_MEM_MAPPED)) return 0; #if defined(__FreeBSD__) - *value = readb(((u8*)hw->dpmbase + offset)); + *value = readb(((u8*)hwcpu->dpmbase + offset)); #elif defined(__NetBSD__) || defined(__OpenBSD__) - *value = bus_space_read_1(hw->hwcard->memt, hw->dpmbase, offset); + *value = bus_space_read_1(hwcpu->hwcard->memt, hwcpu->dpmbase, offset); #elif defined(__LINUX__) - *value = wp_readb((hw->dpmbase + offset)); + *value = wp_readb((hwcpu->dpmbase + offset)); +#elif defined(__WINDOWS__) + *value = READ_REGISTER_UCHAR((PUCHAR)((PUCHAR)hwcpu->dpmbase + offset)); #else # warning "sdla_bus_read_1: Not supported yet!" #endif @@ -6461,17 +8115,23 @@ int sdla_bus_read_1(void* phw, unsigned int offset, u8* value) int sdla_bus_read_2(void* phw, unsigned int offset, u16* value) { - sdlahw_t* hw = (sdlahw_t*)phw; - + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + WAN_ASSERT2(hw == NULL, 0); SDLA_MAGIC(hw); - if (!(hw->status & SDLA_MEM_MAPPED)) return 0; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + + if (!(hwcpu->status & SDLA_MEM_MAPPED)) return 0; #if defined(__FreeBSD__) - *value = readw(((u8*)hw->dpmbase + offset)); + *value = readw(((u8*)hwcpu->dpmbase + offset)); #elif defined(__NetBSD__) || defined(__OpenBSD__) - *value = bus_space_read_2(hw->hwcard->memt, hw->dpmbase, offset); + *value = bus_space_read_2(hwcpu->hwcard->memt, hwcpu->dpmbase, offset); #elif defined(__LINUX__) - *value = readw(((unsigned char*)hw->dpmbase+offset)); + *value = readw(((unsigned char*)hwcpu->dpmbase+offset)); +#elif defined(__WINDOWS__) + *value = READ_REGISTER_USHORT((PUSHORT)((PUCHAR)hwcpu->dpmbase + offset)); #else # warning "sdla_bus_read_2: Not supported yet!" #endif @@ -6481,34 +8141,42 @@ int sdla_bus_read_2(void* phw, unsigned int offset, u16* value) int sdla_bus_read_4(void* phw, unsigned int offset, u32* value) { sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; int retry=5; + WAN_ASSERT2(hw == NULL, 0); - WAN_ASSERT2(hw->dpmbase == 0, 0); SDLA_MAGIC(hw); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT2(hw->hwcpu->dpmbase == 0, 0); + hwcpu = hw->hwcpu; + if (!(hwcpu->status & SDLA_MEM_MAPPED)) return 0; do { #if defined(__FreeBSD__) - *value = readl(((u8*)hw->dpmbase + offset)); + *value = readl(((u8*)hw->hwcpu->dpmbase + offset)); #elif defined(__NetBSD__) || defined(__OpenBSD__) - *value = bus_space_read_4(hw->hwcard->memt, hwcpu->dpmbase, offset); + *value = bus_space_read_4(hw->hwcard->memt, hwcpu->hwcpu->dpmbase, offset); #elif defined(__LINUX__) - *value = wp_readl((unsigned char*)hw->dpmbase + offset); + *value = wp_readl((unsigned char*)hw->hwcpu->dpmbase + offset); +#elif defined(__WINDOWS__) + *value = READ_REGISTER_ULONG((PULONG)((PUCHAR)hwcpu->dpmbase + offset)); #else *value = 0; # warning "sdla_bus_read_4: Not supported yet!" #endif +#if 1 if (offset == 0x40 && *value == (u32)-1) { if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s:%d: Error: Illegal Register read: 0x%04X = 0x%08X\n", + DEBUG_EVENT("%s:%d: wanpipe PCI Error: Illegal Register read: 0x%04X = 0x%08X\n", __FUNCTION__,__LINE__,offset,*value); } } else { /* only check for register 0x40 */ break; } - +#endif }while(--retry); return 0; @@ -6518,11 +8186,14 @@ static int sdla_pci_read_config_dword(void* phw, int reg, u32* value) { sdlahw_t* hw = (sdlahw_t*)phw; sdlahw_card_t* card; + sdlahw_cpu_t* hwcpu; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + card = hwcpu->hwcard; #if defined(__FreeBSD__) # if (__FreeBSD_version > 400000) *value = pci_read_config(card->pci_dev, reg, 4); @@ -6533,6 +8204,8 @@ static int sdla_pci_read_config_dword(void* phw, int reg, u32* value) *value = pci_conf_read(card->pci_dev->pa_pc, card->pci_dev->pa_tag, reg); #elif defined(__LINUX__) pci_read_config_dword(card->pci_dev, reg, value); +#elif defined(__WINDOWS__) + pci_read_config_dword(card->pci_dev, reg, value); #else # warning "sdla_pci_read_config_dword: Not supported yet!" #endif @@ -6543,14 +8216,17 @@ static int sdla_pci_read_config_word(void* phw, int reg, u16* value) { sdlahw_t* hw = (sdlahw_t*)phw; sdlahw_card_t* card; + sdlahw_cpu_t* hwcpu; #if defined(__NetBSD__) || defined(__OpenBSD__) u32 tmp = 0x00; #endif WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + card = hwcpu->hwcard; #if defined(__FreeBSD__) # if (__FreeBSD_version > 400000) *value = pci_read_config(card->pci_dev, reg, 2); @@ -6562,6 +8238,8 @@ static int sdla_pci_read_config_word(void* phw, int reg, u16* value) *value = (u16)((tmp >> 16) & 0xFFFF); #elif defined(__LINUX__) pci_read_config_word(card->pci_dev, reg, value); +#elif defined(__WINDOWS__) + pci_read_config_word(card->pci_dev, reg, value); #else # warning "sdla_pci_read_config_word: Not supported yet!" #endif @@ -6570,27 +8248,32 @@ static int sdla_pci_read_config_word(void* phw, int reg, u16* value) static int sdla_pci_read_config_byte(void* phw, int reg, u8* value) { - sdlahw_t* hw = (sdlahw_t*)phw; - sdlahw_card_t* card; + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; #if defined(__NetBSD__) || defined(__OpenBSD__) u32 tmp = 0x00; #endif WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; #if defined(__FreeBSD__) # if (__FreeBSD_version > 400000) - *value = pci_read_config(card->pci_dev, reg, 1); + *value = pci_read_config(hwcard->pci_dev, reg, 1); # else - *value = pci_cfgread(card->pci_dev, reg, 1); + *value = pci_cfgread(hwcard->pci_dev, reg, 1); # endif #elif defined(__NetBSD__) || defined(__OpenBSD__) - tmp = pci_conf_read(card->pci_dev->pa_pc, card->pci_dev->pa_tag, reg); + tmp = pci_conf_read(hwcard->pci_dev->pa_pc, hwcard->pci_dev->pa_tag, reg); *value = (u8)(tmp & 0xFF); #elif defined(__LINUX__) - pci_read_config_byte(card->pci_dev, reg, value); + pci_read_config_byte(hwcard->pci_dev, reg, value); +#elif defined(__WINDOWS__) + pci_read_config_byte(hwcard->pci_dev, reg, value); #else # warning "sdla_pci_read_config_byte: Not supported yet!" #endif @@ -6599,23 +8282,28 @@ static int sdla_pci_read_config_byte(void* phw, int reg, u8* value) static int sdla_pci_write_config_dword(void* phw, int reg, u32 value) { - sdlahw_t* hw = (sdlahw_t*)phw; - sdlahw_card_t* card; + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; #if defined(__FreeBSD__) # if (__FreeBSD_version > 400000) - pci_write_config(card->pci_dev, reg, value, 4); + pci_write_config(hwcard->pci_dev, reg, value, 4); # else - pci_conf_write(card->pci_dev, reg, 4); + pci_conf_write(hwcard->pci_dev, reg, 4); # endif #elif defined(__NetBSD__) || defined(__OpenBSD__) - pci_conf_write(card->pci_dev->pa_pc, card->pci_dev->pa_tag, reg, value); + pci_conf_write(hwcard->pci_dev->pa_pc, hwcard->pci_dev->pa_tag, reg, value); #elif defined(__LINUX__) - pci_write_config_dword(card->pci_dev, reg, value); + pci_write_config_dword(hwcard->pci_dev, reg, value); +#elif defined(__WINDOWS__) + pci_write_config_dword(hwcard->pci_dev, reg, value); #else # warning "sdla_pci_write_config_dword: Not supported yet!" #endif @@ -6624,23 +8312,29 @@ static int sdla_pci_write_config_dword(void* phw, int reg, u32 value) static int sdla_pci_write_config_word(void* phw, int reg, u16 value) { - sdlahw_t* hw = (sdlahw_t*)phw; - sdlahw_card_t* card; + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + #if defined(__FreeBSD__) # if (__FreeBSD_version > 400000) - pci_write_config(card->pci_dev, reg, value, 2); + pci_write_config(hwcard->pci_dev, reg, value, 2); # else - pci_conf_write(card->pci_dev, reg, value, 2); + pci_conf_write(hwcard->pci_dev, reg, value, 2); # endif #elif defined(__NetBSD__) || defined(__OpenBSD__) - pci_conf_write(card->pci_dev->pa_pc, card->pci_dev->pa_tag, reg, value); + pci_conf_write(hwcard->pci_dev->pa_pc, hwcard->pci_dev->pa_tag, reg, value); #elif defined(__LINUX__) - pci_write_config_word(card->pci_dev, reg, value); + pci_write_config_word(hwcard->pci_dev, reg, value); +#elif defined(__WINDOWS__) + pci_write_config_word(hwcard->pci_dev, reg, value); #else # warning "sdla_pci_write_config_word: Not supported yet!" #endif @@ -6651,11 +8345,14 @@ static int sdla_pci_write_config_byte(void* phw, int reg, u8 value) { sdlahw_t* hw = (sdlahw_t*)phw; sdlahw_card_t* card; + sdlahw_cpu_t* hwcpu; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + card = hwcpu->hwcard; #if defined(__FreeBSD__) # if (__FreeBSD_version > 400000) pci_write_config(card->pci_dev, reg, value, 1); @@ -6666,25 +8363,31 @@ static int sdla_pci_write_config_byte(void* phw, int reg, u8 value) pci_conf_write(card->pci_dev->pa_pc, card->pci_dev->pa_tag, reg, value); #elif defined(__LINUX__) pci_write_config_byte(card->pci_dev, reg, value); +#elif defined(__WINDOWS__) + pci_write_config_byte(card->pci_dev, reg, value); #else # warning "sdla_pci_write_config_byte: Not supported yet!" #endif return 0; } -static int sdla_pci_bridge_read_config_dword(void* phw, int reg, u32* value) +int sdla_pci_bridge_read_config_dword(void* phw, int reg, u_int32_t* value) { sdlahw_t* hw = (sdlahw_t*)phw; sdlahw_card_t* card; + sdlahw_cpu_t* hwcpu; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - if (hw->hwcard->pci_bridge_dev == NULL){ + + if (!sdla_is_pciexpress(hw)){ *value = 0xFFFFFFFF; - return 0; + return 0; } - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + card = hwcpu->hwcard; #if defined(__FreeBSD__) # if (__FreeBSD_version > 400000) *value = pci_read_config(card->pci_bridge_dev, reg, 4); @@ -6695,56 +8398,140 @@ static int sdla_pci_bridge_read_config_dword(void* phw, int reg, u32* value) *value = pci_conf_read(card->pci_bridge_dev->pa_pc, card->pci_bridge_dev->pa_tag, reg); #elif defined(__LINUX__) pci_read_config_dword(card->pci_bridge_dev, reg, value); +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL #else # warning "sdla_pci_bridge_read_config_dword: Not supported yet!" #endif return 0; } -static int sdla_pci_bridge_write_config_dword(void* phw, int reg, u32 value) + +static int sdla_pci_bridge_read_config_byte(void* phw, int reg, u_int8_t* value) { sdlahw_t* hw = (sdlahw_t*)phw; sdlahw_card_t* card; + sdlahw_cpu_t* hwcpu; +#if defined(__NetBSD__) || defined(__OpenBSD__) + u32 tmp = 0x00; +#endif WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - if (hw->hwcard->pci_bridge_dev == NULL){ + + if (!sdla_is_pciexpress(hw)){ + *value = 0xFF; return 0; } - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + card = hwcpu->hwcard; #if defined(__FreeBSD__) # if (__FreeBSD_version > 400000) - pci_write_config(card->pci_bridge_dev, reg, value, 4); + *value = pci_read_config(card->pci_bridge_dev, reg, 1); # else - pci_conf_write(card->pci_bridge_dev, reg, 4); + *value = ci_cfgread(card->pci_bridge_dev, reg, 1); # endif #elif defined(__NetBSD__) || defined(__OpenBSD__) - pci_conf_write(card->pci_bridge_dev->pa_pc, card->pci_bridge_dev->pa_tag, reg, value); + tmp = pci_conf_read(card->pci_bridge_dev->pa_pc, card->pci_bridge_dev->pa_tag, reg); + *value = tmp & 0xFF; #elif defined(__LINUX__) - pci_write_config_dword(card->pci_bridge_dev, reg, value); + pci_read_config_byte(card->pci_bridge_dev, reg, value); +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL +#else +# warning "sdla_pci_bridge_read_config_byte: Not supported yet!" +#endif + return 0; +} + +int sdla_pci_bridge_write_config_dword(void* phw, int reg, u_int32_t value) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; + + WAN_ASSERT(hw == NULL); + SDLA_MAGIC(hw); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + + if (!sdla_is_pciexpress(hw)){ + return 0; + } +#if defined(__FreeBSD__) +# if (__FreeBSD_version > 400000) + pci_write_config(hwcard->pci_bridge_dev, reg, value, 4); +# else + pci_conf_write(hwcard->pci_bridge_dev, reg, 4); +# endif +#elif defined(__NetBSD__) || defined(__OpenBSD__) + pci_conf_write(hwcard->pci_bridge_dev->pa_pc, hwcard->pci_bridge_dev->pa_tag, reg, value); +#elif defined(__LINUX__) + pci_write_config_dword(hwcard->pci_bridge_dev, reg, value); +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL #else # warning "sdla_pci_bridge_write_config_dword: Not supported yet!" #endif return 0; } +static int sdla_pci_bridge_write_config_byte(void* phw, int reg, u_int8_t value) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; + + WAN_ASSERT(hw == NULL); + SDLA_MAGIC(hw); + + if (!sdla_is_pciexpress(hw)){ + return 0; + } + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; +#if defined(__FreeBSD__) +# if (__FreeBSD_version > 400000) + pci_write_config(hwcard->pci_bridge_dev, reg, value, 1); +# else + pci_conf_write(hwcard->pci_bridge_dev, reg, 1); +# endif +#elif defined(__NetBSD__) || defined(__OpenBSD__) + pci_conf_write(hwcard->pci_bridge_dev->pa_pc, hwcard->pci_bridge_dev->pa_tag, reg, value); +#elif defined(__LINUX__) + pci_write_config_byte(hwcard->pci_bridge_dev, reg, value); +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL +#else +# warning "sdla_pci_bridge_write_config_byte: Not supported yet!" +#endif + return 0; +} #if defined(WAN_ISA_SUPPORT) static int sdla_isa_read_1(void* phw, unsigned int offset, u8* value) { - sdlahw_t* hw = (sdlahw_t*)phw; - sdlahw_card_t* card; + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; #if defined(__FreeBSD__) - *value = inb (card->ioport + offset); + *value = inb (hwcard->ioport + offset); #elif defined(__NetBSD__) || defined(__OpenBSD__) - *value = bus_space_read_1(card->iot, hw->ioh, offset); + *value = bus_space_read_1(hwcard->iot, hw->ioh, offset); #elif defined(__LINUX__) - *value = inb(card->ioport + offset); + *value = inb(hwcard->ioport + offset); #else # warning "sdla_isa_read_1: Not supported yet!" #endif @@ -6755,20 +8542,24 @@ static int sdla_isa_read_1(void* phw, unsigned int offset, u8* value) #if defined(WAN_ISA_SUPPORT) static int sdla_isa_write_1(void* phw, unsigned int offset, u8 value) { - sdlahw_t* hw = (sdlahw_t*)phw; - sdlahw_card_t* card; + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - card = hw->hwcard; - hw->regs[offset] = value; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + + hwcpu->regs[offset] = value; #if defined(__FreeBSD__) - outb (card->ioport + offset, value); + outb (hwcard->ioport + offset, value); #elif defined(__NetBSD__) || defined(__OpenBSD__) - bus_space_write_1(card->iot, hw->ioh, offset, value); + bus_space_write_1(hwcard->iot, hwcpu->ioh, offset, value); #elif defined(__LINUX__) - outb(value, card->ioport + offset); + outb(value, hwcard->ioport + offset); #else # warning "sdla_isa_write_1: Not supported yet!" #endif @@ -6778,68 +8569,657 @@ static int sdla_isa_write_1(void* phw, unsigned int offset, u8 value) static int sdla_hw_lock(void *phw, wan_smp_flag_t *flag) { - sdlahw_t* hw = (sdlahw_t*)phw; - sdlahw_card_t* hwcard; + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; +#if defined(__WINDOWS__) + { + sdla_t *card = hw->p_sdla; + + DBG_FE_LOCK("%s():%s: p_sdla: 0x%p, card lock: 0x%p\n", + __FUNCTION__, card->devname, hw->p_sdla, get_card_spin_lock(hw->p_sdla)); + } + wan_spin_lock(get_card_spin_lock(hw->p_sdla)); +#else wan_spin_lock(&hwcard->pcard_lock); +#endif return 0; } static int sdla_hw_unlock(void *phw, wan_smp_flag_t *flag) { - sdlahw_t* hw = (sdlahw_t*)phw; - sdlahw_card_t* hwcard; + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; +#if defined(__WINDOWS__) + { + sdla_t *card = hw->p_sdla; + + DBG_FE_LOCK("%s():%s: p_sdla: 0x%p, card lock: 0x%p\n", + __FUNCTION__, card->devname, hw->p_sdla, get_card_spin_lock(hw->p_sdla)); + } + wan_spin_unlock(get_card_spin_lock(hw->p_sdla)); +#else wan_spin_unlock(&hwcard->pcard_lock); +#endif return 0; } +static int sdla_hw_ec_trylock(void *phw, wan_smp_flag_t *flag) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; + + WAN_ASSERT(hw == NULL); + SDLA_MAGIC(hw); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + return wan_spin_trylock(&hwcard->pcard_ec_lock); +} + static int sdla_hw_ec_lock(void *phw, wan_smp_flag_t *flag) { - sdlahw_t* hw = (sdlahw_t*)phw; - sdlahw_card_t* hwcard; + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; wan_spin_lock(&hwcard->pcard_ec_lock); return 0; } static int sdla_hw_ec_unlock(void *phw, wan_smp_flag_t *flag) { - sdlahw_t* hw = (sdlahw_t*)phw; - sdlahw_card_t* hwcard; + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; wan_spin_unlock(&hwcard->pcard_ec_lock); return 0; } -static sdla_dma_addr_t sdla_pci_map_dma(void *phw, void *buf, int len, int ctrl) +/***************************************************************************** +** BUS DMA Access +*****************************************************************************/ +static wan_dma_descr_t *sdla_busdma_descr_alloc(void *phw, int num) { - sdlahw_t* hw = (sdlahw_t*)phw; - sdlahw_card_t* hwcard; + sdlahw_t *hw = (sdlahw_t*)phw; + wan_dma_descr_t *dma_descr = NULL; + + WAN_ASSERT_RC(hw == NULL, NULL); + SDLA_MAGIC_RC(hw, NULL); + + return dma_descr; +} +static void sdla_busdma_descr_free(void *phw, wan_dma_descr_t *dma_descr) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + + WAN_ASSERT_VOID(hw == NULL); + SDLA_MAGIC_VOID(hw); + if (dma_descr) wan_free(dma_descr); + return; +} +#if defined(__FreeBSD__) +static void +sdla_busdma_callback(void *arg, bus_dma_segment_t *seg, int nseg, int error) +{ + wan_dma_descr_t *dma_descr; + sdla_dma_addr_t paddr; + bus_size_t plen; + + WAN_ASSERT_VOID(arg == NULL); + if (error){ + DEBUG_EVENT( + "ERROR [%s:%d]: Failed to load DMA buffer (nseg=%d:err=%d)!\n", + __FUNCTION__,__LINE__, nseg, error); + return; + } + dma_descr = (wan_dma_descr_t*)arg; + + paddr = seg->ds_addr; + plen = seg->ds_len; + if (paddr & (dma_descr->alignment-1)){ + dma_descr->dma_offset = + dma_descr->alignment - + (paddr & (dma_descr->alignment-1)); + DEBUG_EVENT( + "ERROR [%s:%d]: Invalid Phys DMA Addr %lX Shift dma paddr %d\n", + __FUNCTION__,__LINE__, + (unsigned long)paddr,dma_descr->dma_offset); + error = bus_dmamap_load( + dma_descr->dmat, + dma_descr->dmam, + (char*)dma_descr->dma_virt+dma_descr->dma_offset, + plen, + sdla_busdma_callback, dma_descr, + BUS_DMA_NOWAIT); + return; + } + dma_descr->dma_addr = paddr; + dma_descr->dma_len = plen; + wan_set_bit(SDLA_DMA_FLAG_READY, &dma_descr->flag); + DEBUG_DMA("%s:%d DMA Loaded paddr %X plen %d (dma_descr:%p)\n", + __FUNCTION__,__LINE__, + dma_descr->dma_addr, + dma_descr->dma_len, + dma_descr); + return; +} +#endif +/* + * + * dma_alignment - value should be multiple 2,4 + */ +static int +sdla_busdma_tag_create( void *phw, + wan_dma_descr_t *dma_descr, + u32 dma_alignment, + u32 dma_max_len, + int ndescr) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + wan_dma_descr_t *dma_descr_next = NULL; + int i; +#if defined(__FreeBSD__) + int err; +#endif + + WAN_ASSERT(hw == NULL); + WAN_ASSERT(dma_alignment == 0); + SDLA_MAGIC(hw); +#if defined(__FreeBSD__) + err = bus_dma_tag_create( + NULL, /* NULL */ + dma_alignment, /*alignemnt*/ + 512, /*boundary*/ +#ifdef __amd64__ + BUS_SPACE_MAXADDR, /*lowaddr*/ +#else + BUS_SPACE_MAXADDR_32BIT, /*lowaddr*/ +#endif + BUS_SPACE_MAXADDR, /*highaddr*/ + NULL, /*filter*/ + NULL, /*filterarg*/ + dma_max_len, /*maxsize*/ +# if (__FreeBSD_version >= 502000) + 10, /*nsegments*/ +# else + BUS_SPACE_UNRESTRICTED, /*nsegments*/ +# endif + dma_max_len, /*maxsegsz*/ + BUS_DMA_ALLOCNOW, /*flags*/ +# if (__FreeBSD_version >= 502000) + busdma_lock_mutex, /*lockfunc*/ + &Giant, /*lockfuncarg*/ +# endif + &dma_descr->dmat); + if (err) { + DEBUG_EVENT("%s: Failed to create DMA tag (%d:%d:err=%d)!\n", + hw->devname, + dma_max_len,dma_alignment, err); + return -EINVAL; + } +#elif defined(__LINUX__) +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL +#else +# warning "BUSDMA TAG Create is not defined!" +#endif + dma_descr_next = dma_descr; + for(i = 0; i < ndescr; i++){ +#if defined(__FreeBSD__) + dma_descr_next->dmat = dma_descr->dmat; +#endif + dma_descr_next->alignment = dma_alignment; + dma_descr_next->max_len = dma_max_len; + wan_set_bit(SDLA_DMA_FLAG_INIT, &dma_descr_next->flag); + dma_descr_next++; + } + return 0; +} +static int +sdla_busdma_tag_destroy(void *phw, wan_dma_descr_t *dma_descr, int ndescr) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + wan_dma_descr_t *dma_descr_next = NULL; + int i; +#if defined(__FreeBSD__) + int err; +#endif WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + if (!wan_test_bit(SDLA_DMA_FLAG_INIT, &dma_descr->flag)){ + DEBUG_DMA("%s: Internal Error: %s:%d!\n", + hw->devname, + __FUNCTION__,__LINE__); + return -EINVAL; + } +#if defined(__FreeBSD__) + err = bus_dma_tag_destroy(dma_descr->dmat); + if (err){ + DEBUG_EVENT("%s: Failed to destroy DMA tag (err=%d)!\n", + hw->devname, err); + return -EINVAL; + } +#elif defined(__LINUX__) +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL +#else +# warning "BUSDMA TAG Destroy is not defined!" +#endif + dma_descr_next = dma_descr; + for(i = 0; i < ndescr; i++){ +#if defined(__FreeBSD__) + dma_descr_next->dmat = 0; +#endif + dma_descr_next->alignment = 0; + dma_descr_next->max_len = 0; + wan_clear_bit(SDLA_DMA_FLAG_INIT, &dma_descr_next->flag); + dma_descr_next++; + } + return 0; +} +/* FIXME: This function is not in used (alignment is not support) */ +static int sdla_busdma_create(void *phw, wan_dma_descr_t *dma_descr) +{ + sdlahw_t *hw = (sdlahw_t*)phw; +#if defined(__FreeBSD__) + int err; +#endif + + WAN_ASSERT(hw == NULL); + SDLA_MAGIC(hw); +#if defined(__FreeBSD__) + err = bus_dmamap_create(dma_descr->dmat,0,&dma_descr->dmam); + if (err) { + DEBUG_EVENT( + "%s: Failed to allocate and initialize DMA map (err=%d))!\n", + hw->devname,err); + return -EINVAL; + } +#elif defined(__LINUX__) +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL +#else +# warning "BUSDMA Create is not defined!" +#endif + return 0; +} +/* FIXME: This function is not in used (alignment is not support) */ +static int sdla_busdma_destroy(void *phw, wan_dma_descr_t *dma_descr) +{ + sdlahw_t *hw = (sdlahw_t*)phw; +#if defined(__FreeBSD__) + int err; +#endif + + WAN_ASSERT(hw == NULL); + SDLA_MAGIC(hw); +#if defined(__FreeBSD__) + err = bus_dmamap_destroy(dma_descr->dmat,dma_descr->dmam); + if (err) { + DEBUG_EVENT("%s: Failed to free all DMA resources (err=%d))!\n", + hw->devname,err); + return -EINVAL; + } +#elif defined(__LINUX__) +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL +#else +# warning "BUSDMA Destroy is not defined!" +#endif + return 0; +} + +/* Allocate virtual buffer for DMA with dma_max_len */ +static int sdla_busdma_alloc(void *phw, wan_dma_descr_t *dma_descr) +{ + sdlahw_t *hw = (sdlahw_t*)phw; +#if defined(__FreeBSD__) + int err; +#endif + + WAN_ASSERT(hw == NULL); + SDLA_MAGIC(hw); + if (!wan_test_bit(SDLA_DMA_FLAG_INIT, &dma_descr->flag)){ + DEBUG_DMA("%s: Internal Error: %s:%d!\n", + hw->devname, __FUNCTION__,__LINE__); + return -EINVAL; + } +#if defined(__FreeBSD__) + err = bus_dmamem_alloc( dma_descr->dmat, + &dma_descr->dma_virt, + BUS_DMA_NOWAIT|BUS_DMA_ZERO/*BUS_DMA_NOWAIT*/, + &dma_descr->dmam); + if (err || dma_descr->dma_virt == NULL){ + DEBUG_EVENT( + "%s: Unable to allocate DMA virtual memory (err=%d)!\n", + hw->devname, err); + return -ENOMEM; + } + + err = bus_dmamap_load( dma_descr->dmat, + dma_descr->dmam, + dma_descr->dma_virt, + dma_descr->max_len, + sdla_busdma_callback, dma_descr, + BUS_DMA_NOWAIT); + if (err){ + DEBUG_EVENT("%s: Unable to load DMA buffer (%d:err=%d)!\n", + hw->devname, dma_descr->max_len, err); + bus_dmamem_free( + dma_descr->dmat, + dma_descr->dma_virt, + dma_descr->dmam); + return -EINVAL; + } + wan_set_bit(SDLA_DMA_FLAG_ALLOC, &dma_descr->flag); +#elif defined(__LINUX__) +# if 0 + dma_descr->dma_virt = pci_alloc_consistent( + NULL, + dma_descr->max_len, + (dma_addr_t*)&dma_descr->dma_addr); + if (dma_descr->dma_virt == NULL){ + DEBUG_EVENT( + "%s: Unable to allocate DMA virtual memory (err=%d)!\n", + hw->devname, err); + return -ENOMEM; + } + if (dma_descr->dma_addr & dma_descr->alignment){ + dma_descr->dma_offset = + dma_descr->alignment - + (dma_descr->dma_addr & dma_descr->alignment) + + 1; + (u8*)dma_descr->dma_virt += dma_descr->dma_offset; + dma_descr->dma_addr += dma_descr->dma_offset; + }else{ + dma_descr->dma_offset = 0; + } +# endif + wan_set_bit(SDLA_DMA_FLAG_ALLOC, &dma_descr->flag); + wan_set_bit(SDLA_DMA_FLAG_READY, &dma_descr->flag); +#elif defined(__OpenBSD__) +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL +#else +# warning "BUSDMA Alloc is not defined!" +#endif + return 0; +} +static void sdla_busdma_free(void *phw, wan_dma_descr_t *dma_descr) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + + WAN_ASSERT_VOID(hw == NULL); + SDLA_MAGIC_VOID(hw); + + if (!wan_test_bit(SDLA_DMA_FLAG_ALLOC, &dma_descr->flag)){ + DEBUG_DMA("%s: Internal Error: %s:%d!\n", + hw->devname, __FUNCTION__,__LINE__); + return; + } + wan_clear_bit(SDLA_DMA_FLAG_READY, &dma_descr->flag); +#if defined(__FreeBSD__) + bus_dmamap_unload(dma_descr->dmat,dma_descr->dmam); + bus_dmamem_free(dma_descr->dmat,dma_descr->dma_virt,dma_descr->dmam); +#elif defined(__LINUX__) +# if 0 + if (dma_descr->dma_offset){ + (u8*)dma_descr->dma_virt-= dma_descr->dma_offset; + dma_descr->dma_addr -= dma_descr->dma_offset; + } + pci_free_consistent( NULL, + dma_descr->max_len, + dma_descrdma_descr->dma_virt, + dma_descr->dma_addr); +# endif +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL +#else +# warning "BUSDMA Free is not defined!" +#endif + wan_clear_bit(SDLA_DMA_FLAG_ALLOC, &dma_descr->flag); + dma_descr->dma_virt = NULL; + dma_descr->dma_addr = 0; + return; +} + +/* FIXME: This function is not in used */ +static int sdla_busdma_load(void *phw, wan_dma_descr_t *dma_descr, u32 len) +{ + sdlahw_t *hw = (sdlahw_t*)phw; +#if defined(__FreeBSD__) + int err; +#endif + + WAN_ASSERT(hw == NULL); + SDLA_MAGIC(hw); +#if defined(__FreeBSD__) + err = bus_dmamap_load( dma_descr->dmat, + dma_descr->dmam, + dma_descr->dma_virt, + len, + sdla_busdma_callback, dma_descr, + BUS_DMA_NOWAIT); + if (err){ + DEBUG_EVENT("%s: Unable to load DMA buffer (%d:err=%d)!\n", + hw->devname, len, err); + return -EINVAL; + } +#elif defined(__LINUX__) +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL +#else +# warning "BUSDMA Load is not defined!" +#endif + return 0; +} + +/* FIXME: This function is not in used */ +static void sdla_busdma_unload(void *phw, wan_dma_descr_t *dma_descr) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + + WAN_ASSERT_VOID(hw == NULL); + SDLA_MAGIC_VOID(hw); +#if defined(__FreeBSD__) + bus_dmamap_unload(dma_descr->dmat, dma_descr->dmam); +#elif defined(__LINUX__) +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL +#else +# warning "BUSDMA Unload is not defined!" +#endif + return; +} +static void +sdla_busdma_map(void *phw, wan_dma_descr_t *dma_descr, void *buf, int buflen, int map_len, int dir) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_card_t *hwcard; + sdlahw_cpu_t *hwcpu; + + WAN_ASSERT_VOID(hw == NULL); + SDLA_MAGIC_VOID(hw); + WAN_ASSERT_VOID(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT_VOID(hwcpu->hwcard == NULL); + hwcard = hwcpu->hwcard; + + if (!wan_test_bit(SDLA_DMA_FLAG_READY, &dma_descr->flag)){ + DEBUG_DMA("%s: Internal Error: %s:%d: DMA is not ready!\n", + hw->devname, __FUNCTION__,__LINE__); + return; + } +#if defined(__FreeBSD__) + if (dir == SDLA_DMA_PREWRITE){ + bcopy(buf, dma_descr->dma_virt, buflen); + } +#elif defined(__LINUX__) + dma_descr->dma_offset = 0; + dma_descr->dma_addr = + cpu_to_le32(pci_map_single(hwcard->pci_dev,buf,map_len,dir)); + if (dma_descr->dma_addr & (dma_descr->alignment-1)){ + dma_descr->dma_offset = + dma_descr->alignment - + (dma_descr->dma_addr & (dma_descr->alignment-1)); + dma_descr->dma_virt = buf + dma_descr->dma_offset; + dma_descr->dma_addr += dma_descr->dma_offset; + }else{ + dma_descr->dma_virt = buf; + dma_descr->dma_offset = 0; + } +#elif defined(__OpenBSD__) + dma_descr->dma_addr = virt_to_phys(buf); + if (dma_descr->dma_addr & (dma_descr->alignment-1)){ + dma_descr->dma_offset = + dma_descr->alignment - + (dma_descr->dma_addr & (dma_descr->alignment-1)); + dma_descr->dma_virt = buf + dma_descr->dma_offset; + dma_descr->dma_addr = virt_to_phys(dma_descrt->dma_virt)); + } else { + dma_descr->dma_virt = buf; + dma_descr->dma_offset =0; + } +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL +#else +# warning "BUSDMA map is not defined!" +#endif + dma_descr->dma_len = buflen; + dma_descr->dma_map_len = map_len; + return; +} +static void sdla_busdma_unmap(void *phw, wan_dma_descr_t *dma_descr, int dir) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + sdlahw_card_t *hwcard; + sdlahw_cpu_t *hwcpu; + + WAN_ASSERT_VOID(hw == NULL); + SDLA_MAGIC_VOID(hw); + WAN_ASSERT_VOID(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT_VOID(hwcpu->hwcard == NULL); + hwcard = hwcpu->hwcard; + + if (!wan_test_bit(SDLA_DMA_FLAG_READY, &dma_descr->flag)){ + DEBUG_DMA("%s: Internal Error: %s:%d: DMA is not ready!\n", + hw->devname, __FUNCTION__,__LINE__); + return; + } +#if defined(__FreeBSD__) + if (dma_descr->skb && dir == SDLA_DMA_POSTREAD){ + caddr_t data = NULL; + + /* Apr 19, 2007 new line : + ** data = wan_skb_put(dma_descr->skb, dma_descr->dma_len);*/ + /* Nov 2, 2007 do not update anything in mbuf. The code + ** who called me will update all length of mbuf */ + data = wan_skb_tail(dma_descr->skb); + bcopy(dma_descr->dma_virt, data, dma_descr->dma_len); + } +#elif defined(__LINUX__) + if (dma_descr->dma_addr){ + dma_descr->dma_addr -= dma_descr->dma_offset; + pci_unmap_single( hwcard->pci_dev, + dma_descr->dma_addr, + dma_descr->dma_map_len, + dir); + } + dma_descr->dma_addr = 0; +#elif defined(__OpenBSD__) + dma_descr->dma_addr = 0; +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL +#else +# warning "BUSDMA Unmap is not defined!" +#endif + dma_descr->dma_len = 0; + dma_descr->dma_map_len = 0; + return; +} +static void +sdla_busdma_sync(void *phw, wan_dma_descr_t *dma_descr, int ndescr, int single, int dir) +{ + sdlahw_t *hw = (sdlahw_t*)phw; +#if defined(__FreeBSD__) + int cnt = 0; +#endif + + WAN_ASSERT_VOID(hw == NULL); + SDLA_MAGIC_VOID(hw); + if (!wan_test_bit(SDLA_DMA_FLAG_READY, &dma_descr->flag)){ + DEBUG_DMA("%s: Internal Error: %s:%d: DMA is not ready!\n", + hw->devname, __FUNCTION__,__LINE__); + return; + } +#if defined(__FreeBSD__) + for (cnt=0;cntdmat, dma_descr->dmam, dir); + if (single) break; + dma_descr++; + } +#elif defined(__LINUX__) +#elif defined(__OpenBSD__) +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL +#else +# warning "BUSDMA Sync is not defined!" +#endif + return; +} + + +static sdla_dma_addr_t sdla_pci_map_dma(void *phw, void *buf, int len, int ctrl) +{ + sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_card_t *hwcard; + sdlahw_cpu_t *hwcpu; + + WAN_ASSERT(hw == NULL); + SDLA_MAGIC(hw); + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + hwcard = hwcpu->hwcard; #if defined(__LINUX__) return cpu_to_le32(pci_map_single(hwcard->pci_dev, buf, len, ctrl)); +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL + return (sdla_dma_addr_t)NULL; #else return virt_to_phys(buf); #endif @@ -6849,28 +9229,43 @@ static int sdla_pci_unmap_dma(void *phw, sdla_dma_addr_t buf, int len, int ctrl) { sdlahw_t* hw = (sdlahw_t*)phw; sdlahw_card_t* hwcard; + sdlahw_cpu_t* hwcpu; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + hwcard = hwcpu->hwcard; #if defined(__LINUX__) pci_unmap_single(hwcard->pci_dev, buf, len, ctrl); #endif return 0; } +/*****************************************************************************/ int sdla_hw_fe_test_and_set_bit(void *phw, int value) { sdlahw_t* hw = (sdlahw_t*)phw; sdlahw_card_t* hwcard; + sdlahw_cpu_t* hwcpu; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + hwcard = hwcpu->hwcard; + +#if defined(__WINDOWS__) + { + sdla_t *card = hw->p_sdla; + DBG_FE_LOCK("%s():%s: bitNum: %i, &hwcard->fe_rw_flag: 0x%p, fe_rw_flag: 0x%X\n", + __FUNCTION__, card->devname, value, &hwcard->fe_rw_flag, hwcard->fe_rw_flag); + } +#endif return wan_test_and_set_bit(value, &hwcard->fe_rw_flag); } @@ -6878,11 +9273,21 @@ int sdla_hw_fe_test_bit(void *phw, int value) { sdlahw_t* hw = (sdlahw_t*)phw; sdlahw_card_t* hwcard; + sdlahw_cpu_t *hwcpu; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + hwcard = hwcpu->hwcard; +#if defined(__WINDOWS__) + { + sdla_t *card = hw->p_sdla; + DBG_FE_LOCK("%s():%s: bitNum: %i, &hwcard->fe_rw_flag: 0x%p, fe_rw_flag: 0x%X\n", + __FUNCTION__, card->devname, value, &hwcard->fe_rw_flag, hwcard->fe_rw_flag); + } +#endif return wan_test_bit(value, &hwcard->fe_rw_flag); } @@ -6890,12 +9295,22 @@ int sdla_hw_fe_clear_bit(void *phw, int value) { sdlahw_t* hw = (sdlahw_t*)phw; sdlahw_card_t* hwcard; + sdlahw_cpu_t *hwcpu; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + hwcard = hwcpu->hwcard; wan_clear_bit(value, &hwcard->fe_rw_flag); +#if defined(__WINDOWS__) + { + sdla_t *card = hw->p_sdla; + DBG_FE_LOCK("%s():%s: bitNum: %i, &hwcard->fe_rw_flag: 0x%p, fe_rw_flag: 0x%X\n", + __FUNCTION__, card->devname, value, &hwcard->fe_rw_flag, hwcard->fe_rw_flag); + } +#endif return 0; } @@ -6903,12 +9318,21 @@ int sdla_hw_fe_set_bit(void *phw, int value) { sdlahw_t* hw = (sdlahw_t*)phw; sdlahw_card_t* hwcard; - + sdlahw_cpu_t *hwcpu; WAN_ASSERT(hw == NULL); SDLA_MAGIC(hw); - WAN_ASSERT(hw->hwcard == NULL); - hwcard = hw->hwcard; + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + WAN_ASSERT(hwcpu->hwcard == NULL); + hwcard = hwcpu->hwcard; wan_set_bit(value, &hwcard->fe_rw_flag); +#if defined(__WINDOWS__) + { + sdla_t *card = hw->p_sdla; + DBG_FE_LOCK("%s():%s: bitNum: %i, &hwcard->fe_rw_flag: 0x%p, fe_rw_flag: 0x%X\n", + __FUNCTION__, card->devname, value, &hwcard->fe_rw_flag, hwcard->fe_rw_flag); + } +#endif return 0; } @@ -6916,11 +9340,14 @@ int sdla_hw_fe_set_bit(void *phw, int value) static int sdla_hw_read_cpld(void *phw, u16 off, u8 *data) { sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; u16 org_off; -#if 1 - if (hw->hwcard->adptr_subtype == AFT_SUBTYPE_NORMAL){ - switch(hw->hwcard->adptr_type){ + WAN_ASSERT(hw->hwcpu == NULL); + hwcpu = hw->hwcpu; + + if (hwcpu->hwcard->adptr_subtype == AFT_SUBTYPE_NORMAL){ + switch(hwcpu->hwcard->adptr_type){ case A101_ADPTR_1TE1: case A101_ADPTR_2TE1: off &= ~AFT_BIT_DEV_ADDR_CLEAR; @@ -6945,15 +9372,15 @@ static int sdla_hw_read_cpld(void *phw, u16 off, u8 *data) sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); break; default: - DEBUG_EVENT("%s: ERROR: Invalid read access to cpld!\n", + DEBUG_EVENT("%s: ERROR: Invalid read access to cpld (Normal)!\n", hw->devname); return -EINVAL; } - }else if (hw->hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ - switch(hw->hwcard->core_id){ + }else if (hwcpu->hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ + switch(hwcpu->hwcard->core_id){ case AFT_PMC_FE_CORE_ID: - switch(hw->hwcard->adptr_type){ + switch(hwcpu->hwcard->adptr_type){ case A104_ADPTR_4TE1: off &= ~AFT4_BIT_DEV_ADDR_CLEAR; off |= AFT4_BIT_DEV_ADDR_CPLD; @@ -6967,13 +9394,13 @@ static int sdla_hw_read_cpld(void *phw, u16 off, u8 *data) sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); break; default: - DEBUG_EVENT("%s: ERROR: Invalid read access to cpld!\n", + DEBUG_EVENT("%s: ERROR: Invalid read access to cpld (PMC)!\n", hw->devname); return -EINVAL; } break; case AFT_DS_FE_CORE_ID: - switch(hw->hwcard->adptr_type){ + switch(hwcpu->hwcard->adptr_type){ case A101_ADPTR_1TE1: case A101_ADPTR_2TE1: case A104_ADPTR_4TE1: @@ -6991,15 +9418,16 @@ static int sdla_hw_read_cpld(void *phw, u16 off, u8 *data) sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); break; default: - DEBUG_EVENT("%s: ERROR: Invalid read access to cpld!\n", + DEBUG_EVENT("%s: ERROR: Invalid read access to cpld (DS)!\n", hw->devname); return -EINVAL; } break; default: - switch(hw->hwcard->adptr_type){ + switch(hwcpu->hwcard->adptr_type){ case A200_ADPTR_ANALOG: case A400_ADPTR_ANALOG: + case AFT_ADPTR_ISDN: off &= ~AFT4_BIT_DEV_ADDR_CLEAR; off |= AFT4_BIT_DEV_ADDR_CPLD; /* Save current original address */ @@ -7017,9 +9445,29 @@ static int sdla_hw_read_cpld(void *phw, u16 off, u8 *data) sdla_bus_write_2(hw, AFT56K_MCPU_INTERFACE_ADDR, off); sdla_bus_read_1(hw, AFT56K_MCPU_INTERFACE, data); + break; + case AFT_ADPTR_2SERIAL_V35X21: + case AFT_ADPTR_2SERIAL_RS232: + case AFT_ADPTR_4SERIAL_V35X21: + case AFT_ADPTR_4SERIAL_RS232: + + + off &= ~AFT_SERIAL_BIT_DEV_ADDR_CLEAR; + off |= AFT_SERIAL_BIT_DEV_ADDR_CPLD; + + /* Save current original address */ + sdla_bus_read_2(hw, AFT_MCPU_INTERFACE_ADDR, &org_off); + WP_DELAY(5); + sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, off); + WP_DELAY(5); + sdla_bus_read_1(hw, AFT_MCPU_INTERFACE, data); + /* Restore the original address */ + sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); + + break; default: - DEBUG_EVENT("%s: ERROR: Invalid read access to cpld!\n", + DEBUG_EVENT("%s: ERROR: Invalid read access to cpld (SHARK)!\n", hw->devname); return -EINVAL; } @@ -7030,81 +9478,23 @@ static int sdla_hw_read_cpld(void *phw, u16 off, u8 *data) hw->devname); return -EINVAL; } -#else - switch(hw->hwcard->adptr_type){ - case A101_ADPTR_1TE1: - case A101_ADPTR_2TE1: - off &= ~AFT_BIT_DEV_ADDR_CLEAR; - off |= AFT_BIT_DEV_ADDR_CPLD; - /* Save current original address */ - sdla_bus_read_2(hw, AFT_MCPU_INTERFACE_ADDR, &org_off); - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, off); - sdla_bus_read_1(hw, AFT_MCPU_INTERFACE, data); - /* Restore the original address */ - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); - break; - - case A104_ADPTR_4TE1: - off &= ~AFT4_BIT_DEV_ADDR_CLEAR; - off |= AFT4_BIT_DEV_ADDR_CPLD; - /* Save current original address */ - sdla_bus_read_2(hw, AFT_MCPU_INTERFACE_ADDR, &org_off); - WP_DELAY(5); - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, off); - WP_DELAY(5); - sdla_bus_read_1(hw, AFT_MCPU_INTERFACE, data); - /* Restore the original address */ - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); - break; - - case A108_ADPTR_8TE1: - off &= ~AFT8_BIT_DEV_ADDR_CLEAR; - off |= AFT8_BIT_DEV_ADDR_CPLD; - - /* Save current original address */ - sdla_bus_read_2(hw, AFT_MCPU_INTERFACE_ADDR, &org_off); - WP_DELAY(5); - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, off); - WP_DELAY(5); - sdla_bus_read_1(hw, AFT_MCPU_INTERFACE, data); - /* Restore the original address */ - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); - break; - - case A200_ADPTR_ANALOG: - case A400_ADPTR_ANALOG: - off &= ~AFT4_BIT_DEV_ADDR_CLEAR; - off |= AFT4_BIT_DEV_ADDR_CPLD; - /* Save current original address */ - sdla_bus_read_2(hw, AFT_MCPU_INTERFACE_ADDR, &org_off); - WP_DELAY(5); - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, off); - WP_DELAY(5); - sdla_bus_read_1(hw, AFT_MCPU_INTERFACE, data); - /* Restore the original address */ - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); - break; - - default: - DEBUG_EVENT("%s: ERROR: Invalid read access to cpld!\n", - hw->devname); - return -EINVAL; - } -#endif return 0; } static int sdla_hw_write_cpld(void *phw, u16 off, u8 data) { sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; u16 org_off; - DEBUG_56K("%s: hw->hwcard->adptr_type: 0x%X\n", - hw->devname, hw->hwcard->adptr_type); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; -#if 1 - if (hw->hwcard->adptr_subtype == AFT_SUBTYPE_NORMAL){ - switch(hw->hwcard->adptr_type){ + if (hwcard->adptr_subtype == AFT_SUBTYPE_NORMAL){ + switch(hwcard->adptr_type){ case A101_ADPTR_1TE1: case A101_ADPTR_2TE1: off &= ~AFT_BIT_DEV_ADDR_CLEAR; @@ -7129,15 +9519,15 @@ static int sdla_hw_write_cpld(void *phw, u16 off, u8 data) sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); break; default: - DEBUG_EVENT("%s: ERROR: (1)Invalid write access to cpld!\n", - hw->devname); + DEBUG_EVENT("%s: (line: %d) ERROR: Invalid write access to cpld!\n", + hw->devname, __LINE__); return -EINVAL; } - }else if (hw->hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ - switch(hw->hwcard->core_id){ + }else if (hwcard->adptr_subtype == AFT_SUBTYPE_SHARK){ + switch(hwcard->core_id){ case AFT_PMC_FE_CORE_ID: - switch(hw->hwcard->adptr_type){ + switch(hwcard->adptr_type){ case A104_ADPTR_4TE1: off &= ~AFT4_BIT_DEV_ADDR_CLEAR; off |= AFT4_BIT_DEV_ADDR_CPLD; @@ -7151,13 +9541,14 @@ static int sdla_hw_write_cpld(void *phw, u16 off, u8 data) sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); break; default: - DEBUG_EVENT("%s: ERROR: (2)Invalid write access to cpld!\n", - hw->devname); + DEBUG_EVENT("%s: (%d)ERROR: Invalid write access to cpld!\n", + hw->devname, __LINE__); return -EINVAL; } break; + case AFT_DS_FE_CORE_ID: - switch(hw->hwcard->adptr_type){ + switch(hwcard->adptr_type){ case A101_ADPTR_1TE1: case A101_ADPTR_2TE1: case A104_ADPTR_4TE1: @@ -7173,16 +9564,19 @@ static int sdla_hw_write_cpld(void *phw, u16 off, u8 data) /* Restore the original address */ sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); break; + default: - DEBUG_EVENT("%s: ERROR: (3)Invalid write access to cpld!\n", + DEBUG_EVENT("%s: (1)ERROR: Invalid write access to cpld!\n", hw->devname); return -EINVAL; } break; + default: - switch(hw->hwcard->adptr_type){ + switch(hwcard->adptr_type){ case A200_ADPTR_ANALOG: case A400_ADPTR_ANALOG: + case AFT_ADPTR_ISDN://???? off &= ~AFT4_BIT_DEV_ADDR_CLEAR; off |= AFT4_BIT_DEV_ADDR_CPLD; /* Save current original address */ @@ -7200,77 +9594,66 @@ static int sdla_hw_write_cpld(void *phw, u16 off, u8 data) sdla_bus_write_2(hw, AFT56K_MCPU_INTERFACE_ADDR, off); sdla_bus_write_1(hw, AFT56K_MCPU_INTERFACE, data); break; + case AFT_ADPTR_2SERIAL_V35X21: + case AFT_ADPTR_2SERIAL_RS232: + case AFT_ADPTR_4SERIAL_V35X21: + case AFT_ADPTR_4SERIAL_RS232: + + off &= ~AFT_SERIAL_BIT_DEV_ADDR_CLEAR; + off |= AFT_SERIAL_BIT_DEV_ADDR_CPLD; + /* Save current original address */ + sdla_bus_read_2(hw, AFT_MCPU_INTERFACE_ADDR, &org_off); + WP_DELAY(5); + sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, off); + WP_DELAY(5); + sdla_bus_write_1(hw, AFT_MCPU_INTERFACE, data); + /* Restore the original address */ + sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); + break; + default: - DEBUG_EVENT("%s: ERROR: (4)Invalid write access to cpld!\n", - hw->devname); + DEBUG_EVENT("%s: (line: %d)ERROR: Invalid write access to cpld!\n", + hw->devname, __LINE__); return -EINVAL; } break; } }else{ - DEBUG_EVENT("%s: ERROR: (5)Invalid write access to cpld!\n", - hw->devname); + DEBUG_EVENT("%s: (line: %d)ERROR: Invalid write access to cpld!\n", + hw->devname, __LINE__); return -EINVAL; } -#else - switch(hw->hwcard->adptr_type){ - case A101_ADPTR_1TE1: - case A101_ADPTR_2TE1: - off &= ~AFT_BIT_DEV_ADDR_CLEAR; - off |= AFT_BIT_DEV_ADDR_CPLD; - /* Save current original address */ - sdla_bus_read_2(hw, AFT_MCPU_INTERFACE_ADDR, &org_off); - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, off); - sdla_bus_write_1(hw, AFT_MCPU_INTERFACE, data); - /* Restore the original address */ - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); - break; - - case A104_ADPTR_4TE1: - off &= ~AFT4_BIT_DEV_ADDR_CLEAR; - off |= AFT4_BIT_DEV_ADDR_CPLD; - /* Save current original address */ - sdla_bus_read_2(hw, AFT_MCPU_INTERFACE_ADDR, &org_off); - WP_DELAY(5); - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, off); - WP_DELAY(5); - sdla_bus_write_1(hw, AFT_MCPU_INTERFACE, data); - /* Restore the original address */ - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); - break; - - case A108_ADPTR_8TE1: - off &= ~AFT8_BIT_DEV_ADDR_CLEAR; - off |= AFT8_BIT_DEV_ADDR_CPLD; - /* Save current original address */ - sdla_bus_read_2(hw, AFT_MCPU_INTERFACE_ADDR, &org_off); - WP_DELAY(5); - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, off); - WP_DELAY(5); - sdla_bus_write_1(hw, AFT_MCPU_INTERFACE, data); - /* Restore the original address */ - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); - break; - - case A200_ADPTR_ANALOG: - case A400_ADPTR_ANALOG: - off &= ~AFT4_BIT_DEV_ADDR_CLEAR; - off |= AFT4_BIT_DEV_ADDR_CPLD; - /* Save current original address */ - sdla_bus_read_2(hw, AFT_MCPU_INTERFACE_ADDR, &org_off); - WP_DELAY(5); - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, off); - WP_DELAY(5); - sdla_bus_write_1(hw, AFT_MCPU_INTERFACE, data); - /* Restore the original address */ - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); - break; - - default: - DEBUG_EVENT("%s: ERROR: Invalid read access to cpld!\n", - hw->devname); - return -EINVAL; - } -#endif return 0; } + +static int sdla_is_pciexpress(void *phw) +{ + sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; + + WAN_ASSERT(hw == NULL); + SDLA_MAGIC(hw); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; + + if (hwcard->pci_bridge_dev == NULL) return 0; + return 1; +} + + +static int sdla_get_hwec_index(void *phw) +{ + sdlahw_t* hw = (sdlahw_t*)phw; + + WAN_ASSERT(hw == NULL); + SDLA_MAGIC(hw); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + + if (hw->hwcpu->hwcard->hwec_chan_no == 0) return -EINVAL; + return hw->hwcpu->hwcard->hwec_ind; +} + diff --git a/patches/kdrivers/src/net/sdladrv_fe.c b/patches/kdrivers/src/net/sdladrv_fe.c index 065fc5b..ee0f256 100644 --- a/patches/kdrivers/src/net/sdladrv_fe.c +++ b/patches/kdrivers/src/net/sdladrv_fe.c @@ -12,6 +12,8 @@ * 2 of the License, or (at your option) any later version. * ============================================================================ * Aug 10, 2006 Alex Feldman Initial version +* +* July 5, 2007 David Rokhvarg Added support of A500 - ISDN BRI card. *****************************************************************************/ /***************************************************************************** @@ -38,6 +40,16 @@ # include # include # include +#elif defined(__WINDOWS__) +# include +# include +# include +# include +# include +# include /* SDLA firmware module definitions */ +# include /* SDLA PCI hardware definitions */ +# include +# include /* API definitions */ #elif defined(__LINUX__)||defined(__KERNEL__) # define _K22X_MODULE_FIX_ # include @@ -53,6 +65,13 @@ # error "Unsupported Operating System!" #endif +#if defined(WAN_DEBUG_FE) +# warning "WAN_DEBUG_FE - Debugging Enabled" +#endif +#if defined(WAN_DEBUG_REG) +# warning "WAN_DEBUG_REG - Debugging Enabled" +#endif + /*************************************************************************** **** M A C R O S / D E F I N E S **** ***************************************************************************/ @@ -69,19 +88,32 @@ u_int8_t sdla_te1_read_fe (void* phw, ...); static int __sdla_shark_te1_write_fe(void *phw, ...); int sdla_shark_te1_write_fe(void *phw, ...); -static u_int8_t __sdla_shark_te1_read_fe (void *phw, ...); +u_int8_t __sdla_shark_te1_read_fe (void *phw, ...); u_int8_t sdla_shark_te1_read_fe (void *phw, ...); static int __sdla_shark_rm_write_fe (void* phw, ...); int sdla_shark_rm_write_fe (void* phw, ...); -static u_int8_t __sdla_shark_rm_read_fe (void* phw, ...); +u_int8_t __sdla_shark_rm_read_fe (void* phw, ...); u_int8_t sdla_shark_rm_read_fe (void* phw, ...); static int __sdla_shark_56k_write_fe(void *phw, ...); int sdla_shark_56k_write_fe(void *phw, ...); -static u_int8_t __sdla_shark_56k_read_fe (void *phw, ...); +u_int8_t __sdla_shark_56k_read_fe (void *phw, ...); u_int8_t sdla_shark_56k_read_fe (void *phw, ...); +static int __write_bri_fe_byte(void*,u_int8_t,u_int8_t,u_int8_t); +int sdla_shark_bri_write_fe (void* phw, ...); +static u_int8_t __read_bri_fe_byte(void*,u_int8_t,u_int8_t,u_int8_t,u_int8_t); +u_int8_t sdla_shark_bri_read_fe (void* phw, ...); + +static int __sdla_shark_serial_write_fe(void *phw, ...); +int sdla_shark_serial_write_fe(void *phw, ...); +u_int32_t __sdla_shark_serial_read_fe (void *phw, ...); +u_int32_t sdla_shark_serial_read_fe (void *phw, ...); + +int sdla_te3_write_fe(void *phw, ...); +u_int8_t sdla_te3_read_fe(void *phw, ...); + extern int sdla_bus_write_1(void* phw, unsigned int offset, u8 value); extern int sdla_bus_write_2(void* phw, unsigned int offset, u16 value); extern int sdla_bus_write_4(void* phw, unsigned int offset, u32 value); @@ -103,6 +135,52 @@ extern int sdla_hw_fe_set_bit(void *phw, int value); ***************************************************************************/ +/*************************************************************************** + Front End DS31/E3 interface +***************************************************************************/ +int sdla_te3_write_fe(void *phw, ...) +{ + sdlahw_t* hw = (sdlahw_t*)phw; + va_list args; + int off, value; + + WAN_ASSERT(phw == NULL); + va_start(args, phw); + off = va_arg(args, int); + value = va_arg(args, int); + va_end(args); + + off &= ~AFT_BIT_DEV_ADDR_CLEAR; + + DEBUG_TEST("%s: WRITE FRAMER OFFSET=0x%02X DATA=0x%02X\n", + hw->devname, framer_off,framer_data); + + sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, (u16)off); + sdla_bus_write_2(hw, AFT_MCPU_INTERFACE, (u16)value); + return 0; +} + +u_int8_t sdla_te3_read_fe(void *phw, ...) +{ + sdlahw_t* hw = (sdlahw_t*)phw; + va_list args; + int off; + u_int8_t value; + + WAN_ASSERT(phw == NULL); + va_start(args, phw); + off = va_arg(args, int); + va_end(args); + + off &= ~AFT_BIT_DEV_ADDR_CLEAR; + sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, (u16)off); + sdla_bus_read_1(hw,AFT_MCPU_INTERFACE, &value); + + DEBUG_TEST("%s: READ FRAMER OFFSET=0x%02X DATA=0x%02X\n", + hw->devname, off, value); + return value; +} + /*************************************************************************** Front End T1/E1 interface for Normal cards @@ -111,19 +189,19 @@ int sdla_te1_write_fe(void* phw, ...) { sdlahw_t* hw = (sdlahw_t*)phw; va_list args; - u16 qaccess, off, line_no; - u8 value; + int qaccess, off, line_no, value; + // u8 qaccess = card->wandev.state == WAN_CONNECTED ? 1 : 0; va_start(args, phw); - qaccess = (u16)va_arg(args, int); - line_no = (u16)va_arg(args, int); - off = (u16)va_arg(args, int); - value = (u8)va_arg(args, int); + qaccess = va_arg(args, int); + line_no = va_arg(args, int); + off = va_arg(args, int); + value = va_arg(args, int); va_end(args); off &= ~BIT_DEV_ADDR_CLEAR; - sdla_bus_write_2(hw, XILINX_MCPU_INTERFACE_ADDR, off); + sdla_bus_write_2(hw, XILINX_MCPU_INTERFACE_ADDR, (u16)off); /* AF: Sep 10, 2003 * IMPORTANT * This delays are required to avoid bridge optimization @@ -132,7 +210,7 @@ int sdla_te1_write_fe(void* phw, ...) if (!qaccess){ WP_DELAY(5); } - sdla_bus_write_1(hw, XILINX_MCPU_INTERFACE, value); + sdla_bus_write_1(hw, XILINX_MCPU_INTERFACE, (u8)value); if (!qaccess){ WP_DELAY(5); } @@ -147,18 +225,18 @@ u_int8_t sdla_te1_read_fe (void* phw, ...) { sdlahw_t* hw = (sdlahw_t*)phw; va_list args; - u_int16_t qaccess, line_no, off; + int qaccess, line_no, off; u_int8_t tmp; // u8 qaccess = card->wandev.state == WAN_CONNECTED ? 1 : 0; va_start(args, phw); - qaccess = (u_int16_t)va_arg(args, int); - line_no = (u_int16_t)va_arg(args, int); - off = (u_int8_t)va_arg(args, int); + qaccess = va_arg(args, int); + line_no = va_arg(args, int); + off = va_arg(args, int); va_end(args); off &= ~BIT_DEV_ADDR_CLEAR; - sdla_bus_write_2(hw, XILINX_MCPU_INTERFACE_ADDR, off); + sdla_bus_write_2(hw, XILINX_MCPU_INTERFACE_ADDR, (u16)off); sdla_bus_read_1(hw,XILINX_MCPU_INTERFACE, &tmp); if (!qaccess){ @@ -173,25 +251,32 @@ u_int8_t sdla_te1_read_fe (void* phw, ...) static int __sdla_shark_te1_write_fe (void *phw, ...) { sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; va_list args; - u_int16_t org_off, qaccess, line_no, off; - u_int8_t value; -// u8 qaccess = card->wandev.state == WAN_CONNECTED ? 1 : 0; + int org_off=0, qaccess=0, line_no=0, off=0, value=0; + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; va_start(args, phw); qaccess = (u_int16_t)va_arg(args, int); line_no = (u_int16_t)va_arg(args, int); off = (u_int16_t)va_arg(args, int); value = (u_int8_t)va_arg(args, int); va_end(args); + WAN_ASSERT(qaccess != 0 && qaccess != 1); - if (hw->hwcard->core_id == AFT_PMC_FE_CORE_ID){ - off &= ~AFT4_BIT_DEV_ADDR_CLEAR; - }else if (hw->hwcard->core_id == AFT_DS_FE_CORE_ID){ + if (hwcard->core_id == AFT_PMC_FE_CORE_ID){ + off &= ~AFT4_BIT_DEV_ADDR_CLEAR; + }else if (hwcard->core_id == AFT_DS_FE_CORE_ID){ if (off & 0x800) off |= 0x2000; if (off & 0x1000) off |= 0x4000; off &= ~AFT8_BIT_DEV_ADDR_CLEAR; - if (hw->hwcard->adptr_type == A101_ADPTR_2TE1 && line_no == 1){ + if ((hwcard->adptr_type == A101_ADPTR_2TE1 || + hwcard->adptr_type == A101_ADPTR_1TE1) && line_no == 1){ off |= AFT8_BIT_DEV_MAXIM_ADDR_CPLD; } } @@ -214,7 +299,7 @@ static int __sdla_shark_te1_write_fe (void *phw, ...) WP_DELAY(5); } - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, org_off); + sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, (u16)org_off); if (!qaccess){ WP_DELAY(5); @@ -226,9 +311,9 @@ int sdla_shark_te1_write_fe (void *phw, ...) { sdlahw_t* hw = (sdlahw_t*)phw; va_list args; - u_int16_t qaccess, line_no, off; - u_int8_t value; + int qaccess=0, line_no=0, off=0, value=0; + WAN_ASSERT(hw->magic != SDLADRV_MAGIC); if (sdla_hw_fe_test_and_set_bit(hw,0)){ if (WAN_NET_RATELIMIT()){ DEBUG_EVENT( @@ -238,53 +323,60 @@ int sdla_shark_te1_write_fe (void *phw, ...) } return -EINVAL; } - va_start(args, phw); - qaccess = (u_int16_t)va_arg(args, int); - line_no = (u_int16_t)va_arg(args, int); - off = (u_int16_t)va_arg(args, int); - value = (u_int8_t)va_arg(args, int); + qaccess = va_arg(args, int); + line_no = va_arg(args, int); + off = va_arg(args, int); + value = va_arg(args, int); va_end(args); + DEBUG_REG("%s: Writting T1/E1 Reg: Line:%d: %02X=%02X\n", + hw->devname, line_no, off, value); __sdla_shark_te1_write_fe(hw, qaccess, line_no, off, value); - sdla_hw_fe_clear_bit(hw,0); - return 0; + return 0; } /*============================================================================ * Read TE1 Front end registers */ -static u_int8_t __sdla_shark_te1_read_fe (void *phw, ...) +u_int8_t __sdla_shark_te1_read_fe (void *phw, ...) { sdlahw_t* hw = (sdlahw_t*)phw; + sdlahw_cpu_t *hwcpu; + sdlahw_card_t *hwcard; va_list args; - u_int16_t org_off, qaccess, line_no, off; - u_int8_t tmp; -// u8 qaccess = card->wandev.state == WAN_CONNECTED ? 1 : 0; + int org_off=0, qaccess=0, line_no=0, off=0, tmp=0; + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + hwcpu = hw->hwcpu; + hwcard = hwcpu->hwcard; va_start(args, phw); qaccess = (u_int16_t)va_arg(args, int); line_no = (u_int16_t)va_arg(args, int); - off = (u_int8_t)va_arg(args, int); + off = (u_int16_t)va_arg(args, int); va_end(args); + WAN_ASSERT(qaccess != 0 && qaccess != 1); - if (hw->hwcard->core_id == AFT_PMC_FE_CORE_ID){ + if (hwcard->core_id == AFT_PMC_FE_CORE_ID){ off &= ~AFT4_BIT_DEV_ADDR_CLEAR; - }else if (hw->hwcard->core_id == AFT_DS_FE_CORE_ID){ + }else if (hwcard->core_id == AFT_DS_FE_CORE_ID){ if (off & 0x800) off |= 0x2000; if (off & 0x1000) off |= 0x4000; off &= ~AFT8_BIT_DEV_ADDR_CLEAR; - if (hw->hwcard->adptr_type == A101_ADPTR_2TE1 && line_no == 1){ + if ((hwcard->adptr_type == A101_ADPTR_1TE1 || + hwcard->adptr_type == A101_ADPTR_2TE1) && line_no == 1){ off |= AFT8_BIT_DEV_MAXIM_ADDR_CPLD; } } sdla_bus_read_2(hw, AFT_MCPU_INTERFACE_ADDR, (u16*)&org_off); - sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, (u16)off); + sdla_bus_write_2(hw, AFT_MCPU_INTERFACE_ADDR, (u16)off); - sdla_bus_read_1(hw,AFT_MCPU_INTERFACE, (u8*)&tmp); + sdla_bus_read_1(hw,AFT_MCPU_INTERFACE, (u8*)&tmp); if (!qaccess){ WP_DELAY(5); } @@ -294,16 +386,17 @@ static u_int8_t __sdla_shark_te1_read_fe (void *phw, ...) if (!qaccess){ WP_DELAY(5); } - return tmp; + return (u8)tmp; } u_int8_t sdla_shark_te1_read_fe (void *phw, ...) { sdlahw_t* hw = (sdlahw_t*)phw; va_list args; - u_int16_t qaccess, line_no, off; + int qaccess=0, line_no=0, off=0; u_int8_t tmp; + WAN_ASSERT(hw->magic != SDLADRV_MAGIC); if (sdla_hw_fe_test_and_set_bit(hw,0)){ if (WAN_NET_RATELIMIT()){ DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", @@ -313,14 +406,15 @@ u_int8_t sdla_shark_te1_read_fe (void *phw, ...) } va_start(args, phw); - qaccess = (u_int16_t)va_arg(args, int); - line_no = (u_int16_t)va_arg(args, int); - off = (u_int16_t)va_arg(args, int); + qaccess = va_arg(args, int); + line_no = va_arg(args, int); + off = va_arg(args, int); va_end(args); tmp = __sdla_shark_te1_read_fe(hw, qaccess, line_no, off); - sdla_hw_fe_clear_bit(hw,0); + DEBUG_REG("%s: Reading T1/E1 Reg: Line:%d: %02X=%02X\n", + hw->devname, line_no, off, tmp); return tmp; } @@ -335,15 +429,13 @@ static int __sdla_shark_56k_write_fe (void *phw, ...) { sdlahw_t* hw = (sdlahw_t*)phw; va_list args; - u_int16_t qaccess, line_no, off; - u_int8_t value; -// u8 qaccess = card->wandev.state == WAN_CONNECTED ? 1 : 0; + int qaccess, line_no, off, value; va_start(args, phw); - qaccess = (u_int16_t)va_arg(args, int); - line_no = (u_int16_t)va_arg(args, int); - off = (u_int16_t)va_arg(args, int); - value = (u_int8_t)va_arg(args, int); + qaccess = va_arg(args, int); + line_no = va_arg(args, int); + off = va_arg(args, int); + value = va_arg(args, int); va_end(args); off &= ~AFT8_BIT_DEV_ADDR_CLEAR; @@ -363,9 +455,9 @@ int sdla_shark_56k_write_fe (void *phw, ...) { sdlahw_t* hw = (sdlahw_t*)phw; va_list args; - u_int16_t qaccess, line_no, off; - u_int8_t value; + int qaccess, line_no, off, value; + WAN_ASSERT(hw->magic != SDLADRV_MAGIC); if (sdla_hw_fe_test_and_set_bit(hw,0)){ if (WAN_NET_RATELIMIT()){ DEBUG_EVENT( @@ -377,40 +469,38 @@ int sdla_shark_56k_write_fe (void *phw, ...) } va_start(args, phw); - qaccess = (u_int16_t)va_arg(args, int); - line_no = (u_int16_t)va_arg(args, int); - off = (u_int16_t)va_arg(args, int); - value = (u_int8_t)va_arg(args, int); + qaccess = va_arg(args, int); + line_no = va_arg(args, int); + off = va_arg(args, int); + value = va_arg(args, int); va_end(args); __sdla_shark_56k_write_fe(hw, qaccess, line_no, off, value); sdla_hw_fe_clear_bit(hw,0); - return 0; + return 0; } /*============================================================================ * Read 56k Front end registers */ -static u_int8_t __sdla_shark_56k_read_fe (void *phw, ...) +u_int8_t __sdla_shark_56k_read_fe (void *phw, ...) { sdlahw_t* hw = (sdlahw_t*)phw; va_list args; - u_int16_t qaccess, line_no, off; - u_int32_t tmp; -// u8 qaccess = card->wandev.state == WAN_CONNECTED ? 1 : 0; + int qaccess, line_no, off, tmp; va_start(args, phw); - qaccess = (u_int16_t)va_arg(args, int); - line_no = (u_int16_t)va_arg(args, int); - off = (u_int8_t)va_arg(args, int); + qaccess = va_arg(args, int); + line_no = va_arg(args, int); + off = va_arg(args, int); va_end(args); off &= ~AFT8_BIT_DEV_ADDR_CLEAR; - sdla_bus_write_2(hw,0x46, (u16)off); + sdla_bus_write_2(hw, AFT56K_MCPU_INTERFACE_ADDR, (u16)off); - sdla_bus_read_4(hw,0x44, &tmp); + sdla_bus_read_4(hw, AFT56K_MCPU_INTERFACE, &tmp); if (!qaccess){ WP_DELAY(5); @@ -423,9 +513,9 @@ u_int8_t sdla_shark_56k_read_fe (void *phw, ...) { sdlahw_t* hw = (sdlahw_t*)phw; va_list args; - u_int16_t qaccess, line_no, off; - u_int8_t tmp; + int qaccess, line_no, off, tmp; + WAN_ASSERT(hw->magic != SDLADRV_MAGIC); if (sdla_hw_fe_test_and_set_bit(hw,0)){ if (WAN_NET_RATELIMIT()){ DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", @@ -435,15 +525,15 @@ u_int8_t sdla_shark_56k_read_fe (void *phw, ...) } va_start(args, phw); - qaccess = (u_int16_t)va_arg(args, int); - line_no = (u_int16_t)va_arg(args, int); - off = (u_int16_t)va_arg(args, int); + qaccess = va_arg(args, int); + line_no = va_arg(args, int); + off = va_arg(args, int); va_end(args); tmp = __sdla_shark_56k_read_fe(hw, qaccess, line_no, off); sdla_hw_fe_clear_bit(hw,0); - return tmp; + return (u8)tmp; } @@ -463,6 +553,10 @@ static int __sdla_shark_rm_write_fe (void* phw, ...) unsigned char cs = 0x00, ctrl_byte = 0x00; int i; + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + va_start(args, phw); mod_no = va_arg(args, int); type = va_arg(args, int); @@ -508,7 +602,7 @@ static int __sdla_shark_rm_write_fe (void* phw, ...) ** */ ctrl_byte = mod_no / 2; #if !defined(SPI2STEP) - if (hw->hwcard->core_rev > 3){ + if (hw->hwcpu->hwcard->core_rev > 3){ ctrl_byte |= MOD_SPI_CTRL_START; }else{ ctrl_byte |= MOD_SPI_CTRL_V3_START; @@ -545,7 +639,7 @@ static int __sdla_shark_rm_write_fe (void* phw, ...) ** */ ctrl_byte = mod_no / 2; #if !defined(SPI2STEP) - if (hw->hwcard->core_rev > 3){ + if (hw->hwcpu->hwcard->core_rev > 3){ ctrl_byte |= MOD_SPI_CTRL_START; }else{ ctrl_byte |= MOD_SPI_CTRL_V3_START; @@ -566,7 +660,7 @@ static int __sdla_shark_rm_write_fe (void* phw, ...) sdla_bus_write_4(hw, SPI_INTERFACE_REG, data); #if defined(SPI2STEP) WP_DELAY(1); - if (hw->hwcard->core_rev > 3){ + if (hw->hwcpu->hwcard->core_rev > 3){ data |= MOD_SPI_START; }else{ data |= MOD_SPI_V3_START; @@ -609,6 +703,7 @@ int sdla_shark_rm_write_fe (void* phw, ...) int fline; #endif + WAN_ASSERT(hw->magic != SDLADRV_MAGIC); va_start(args, phw); mod_no = va_arg(args, int); type = va_arg(args, int); @@ -632,13 +727,15 @@ int sdla_shark_rm_write_fe (void* phw, ...) return -EINVAL; } + DEBUG_REG("%s: Remora Direct Register %d = %02X\n", + hw->devname, reg, value); __sdla_shark_rm_write_fe(hw, mod_no, type, chain, reg, value); sdla_hw_fe_clear_bit(hw,0); return 0; } -static u_int8_t __sdla_shark_rm_read_fe (void* phw, ...) +u_int8_t __sdla_shark_rm_read_fe (void* phw, ...) { sdlahw_t *hw = (sdlahw_t*)phw; va_list args; @@ -647,6 +744,10 @@ static u_int8_t __sdla_shark_rm_read_fe (void* phw, ...) unsigned char cs = 0x00, ctrl_byte = 0x00; int i; + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + va_start(args, phw); mod_no = va_arg(args, int); type = va_arg(args, int); @@ -691,7 +792,7 @@ static u_int8_t __sdla_shark_rm_read_fe (void* phw, ...) ** */ ctrl_byte = mod_no / 2; #if !defined(SPI2STEP) - if (hw->hwcard->core_rev > 3){ + if (hw->hwcpu->hwcard->core_rev > 3){ ctrl_byte |= MOD_SPI_CTRL_START; }else{ ctrl_byte |= MOD_SPI_CTRL_V3_START; @@ -728,7 +829,7 @@ static u_int8_t __sdla_shark_rm_read_fe (void* phw, ...) ** */ ctrl_byte = mod_no / 2; #if !defined(SPI2STEP) - if (hw->hwcard->core_rev > 3){ + if (hw->hwcpu->hwcard->core_rev > 3){ ctrl_byte |= MOD_SPI_CTRL_START; }else{ ctrl_byte |= MOD_SPI_CTRL_V3_START; @@ -749,18 +850,20 @@ static u_int8_t __sdla_shark_rm_read_fe (void* phw, ...) sdla_bus_write_4(hw, SPI_INTERFACE_REG, data); #if defined(SPI2STEP) WP_DELAY(1); - if (hw->hwcard->core_rev > 3){ + if (hw->hwcpu->hwcard->core_rev > 3){ data |= MOD_SPI_START; }else{ data |= MOD_SPI_V3_START; } sdla_bus_write_4(hw, SPI_INTERFACE_REG, data); #endif - DEBUG_TEST("%s: %s: Module %d - Execute SPI command %08X\n", +#if 0 + DEBUG_EVENT("%s: %s: Module %d - Execute SPI command %08X\n", hw->devname, __FUNCTION__, mod_no, data); +#endif for (i=0;i<10;i++){ WP_DELAY(10); sdla_bus_read_4(hw, SPI_INTERFACE_REG, &data); @@ -770,9 +873,9 @@ static u_int8_t __sdla_shark_rm_read_fe (void* phw, ...) } if (data & MOD_SPI_BUSY){ - DEBUG_EVENT("%s: Module %d: Critical Error (%s:%d) Data=0x%0X!\n", + DEBUG_EVENT("%s: Module %d: Critical Error (%s:%d)!\n", hw->devname, mod_no, - __FUNCTION__,__LINE__,data); + __FUNCTION__,__LINE__); return 0xFF; } @@ -790,6 +893,7 @@ u_int8_t sdla_shark_rm_read_fe (void* phw, ...) int fline; #endif + WAN_ASSERT(hw->magic != SDLADRV_MAGIC); va_start(args, phw); mod_no = va_arg(args, int); type = va_arg(args, int); @@ -812,9 +916,460 @@ u_int8_t sdla_shark_rm_read_fe (void* phw, ...) return 0x00; } data = __sdla_shark_rm_read_fe (hw, mod_no, type, chain, reg); + //DEBUG_REG("%s: Remora Read Reg %X = %02X\n", + // hw->devname, reg, data); sdla_hw_fe_clear_bit(hw,0); return data; } +/*************************************************************************** + ISDN BRI Front End interface +***************************************************************************/ +#define SPI_DELAY if(1)WP_DELAY(10) + +#undef SPI_MAX_RETRY_COUNT +#define SPI_MAX_RETRY_COUNT 10000 + +#define SPI_BREAK if(1)break +#define FAST_SPI 0 +/*============================================================================ + * Write ISDN BRI Front end registers + */ +static +int +__write_bri_fe_byte ( + void* phw, + u_int8_t mod_no, + u_int8_t addr, + u_int8_t value) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + bri_reg_t data, dummy; + u_int32_t *data_ptr = (u_int32_t*)&data; + u_int32_t *dummy_ptr = (u_int32_t*)&dummy; + u_int32_t retry_counter; + u_int8_t rm_no=0xFF; + + WAN_ASSERT(hw == NULL); + + DEBUG_REG("%s():%s: mod_no:%d addr=0x%X (%d) value=0x%02X\n", + __FUNCTION__, + hw->devname, + mod_no, + addr, + addr, + value); + + /* Input mod_no is an even number between 0 and 22 (including). + Calculate rm_no - should be between 0 and 3 (including). + */ + rm_no = mod_no / (MAX_BRI_MODULES_PER_REMORA*2); +#if 0 + DEBUG_BRI("%s(input): rm_no: %d, mod_no: %d\n", __FUNCTION__, rm_no, mod_no); +#endif + /* Translate mod_no to be between 0 and 2 (including) */ + mod_no = (mod_no / 2) % MAX_BRI_MODULES_PER_REMORA; +#if 0 + DEBUG_BRI("%s(updated): rm_no: %d, mod_no: %d\n", __FUNCTION__, rm_no, mod_no); +#endif + if(rm_no > MAX_BRI_REMORAS - 1){ + DEBUG_EVENT("%s:%s(): Line:%d: invalid rm_no: %d!!(mod_no: %d)\n", + hw->devname, __FUNCTION__, __LINE__, rm_no, mod_no); + return 0; + } + + /* setup address offset for fe */ + data.reset = 0; + data.start = 1; + data.reserv1 = 0; + + data.remora_addr = rm_no; + data.mod_addr = mod_no; + + data.data = addr; + data.contrl = 0; + data.contrl |= ADDR_BIT; + + /* DEBUG_BRI("1. data: 0x%08X\n", *data_ptr); */ + /* check spi not busy */ + for (retry_counter = 0; retry_counter < SPI_MAX_RETRY_COUNT; retry_counter++){ + sdla_bus_read_4(hw, SPI_INTERFACE_REG, dummy_ptr); + if(dummy.start == 1){ + SPI_DELAY; + } else { + SPI_BREAK; + } + } + SPI_DELAY; + if(dummy.start == 1){ + DEBUG_EVENT("%s:%s(): Line:%d: SPI TIMEOUT!!\n", hw->devname, __FUNCTION__, __LINE__); + return 0; + } + + sdla_bus_write_4(hw, SPI_INTERFACE_REG, *data_ptr); + + /* start read spi operation */ + data.reset=0; + data.start=1; + data.reserv1=0; + + data.remora_addr = rm_no; + data.mod_addr = mod_no; + + data.data = value; + data.contrl = 0; + + /* DEBUG_BRI("2. data: 0x%08X\n", *data_ptr); */ +#if FAST_SPI + SPI_DELAY; +#else + /* wait for end of spi operation */ + for (retry_counter = 0; retry_counter < SPI_MAX_RETRY_COUNT; retry_counter++){ + sdla_bus_read_4(hw, SPI_INTERFACE_REG, dummy_ptr); + if(dummy.start == 1){SPI_DELAY;}else{SPI_BREAK;} + } + SPI_DELAY; + if(dummy.start == 1){ + DEBUG_EVENT("%s:%s(): Line:%d: SPI TIMEOUT!!\n", hw->devname, __FUNCTION__, __LINE__); + return 0; + } +#endif + + /* write the actual data */ + sdla_bus_write_4(hw, SPI_INTERFACE_REG, *data_ptr); + return 0; +} + +int sdla_shark_bri_write_fe (void* phw, ...) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + va_list args; + int mod_no, reg, value; +#if defined(WAN_DEBUG_FE) + char *fname; + int fline; +#endif + + va_start(args, phw); + mod_no = va_arg(args, int); + reg = va_arg(args, int); + value = va_arg(args, int); +#if defined(WAN_DEBUG_FE) + fname = va_arg(args, char*); + fline = va_arg(args, int); +#endif + va_end(args); + + if (sdla_hw_fe_test_and_set_bit(hw,0)){ +#if defined(WAN_DEBUG_FE) + DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE (%s:%d)!\n", + hw->devname, __FUNCTION__,__LINE__, fname, fline); +#else + DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", + hw->devname, __FUNCTION__,__LINE__); +#endif + return -EINVAL; + } + + __write_bri_fe_byte(hw, (u8)mod_no, (u8)reg, (u8)value); + + sdla_hw_fe_clear_bit(hw,0); + return 0; +} + +/*============================================================================ + * Read ISDN BRI Front end registers + */ +static +u_int8_t +__read_bri_fe_byte( + void* phw, + u_int8_t mod_no, + u_int8_t reg, + u_int8_t type, + u_int8_t optional_arg) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + bri_reg_t data, dummy; + u_int32_t *data_ptr = (u_int32_t*)&data; + u_int32_t *dummy_ptr = (u_int32_t*)&dummy; + u_int32_t retry_counter; + u_int8_t rm_no=0xFF; + u_int8_t value; + + WAN_ASSERT(hw == NULL); + + DEBUG_REG("%s():%s\n", __FUNCTION__, hw->devname); + + if(type != MOD_TYPE_NT && type != MOD_TYPE_TE){ + DEBUG_BRI("%s(): Warning: unknown module type! (%d)\n", __FUNCTION__, type); + } + + /* setup address offset for fe */ + data.reset = 0; + data.start = 1; + data.reserv1= 0; + + if(type == MOD_TYPE_NONE){ + /* the only case we get here is if running module detection code. */ + rm_no = optional_arg; + }else{ + /* Input mod_no is an even number between 0 and 22 (including). + Calculate rm_no - should be between 0 and 3 (including). + */ + if(mod_no % 2){ + DEBUG_BRI("%s(): Warning: module number (%d) is not even!!\n", + __FUNCTION__, mod_no); + } + rm_no = mod_no / (MAX_BRI_MODULES_PER_REMORA*2); +#if 0 + DEBUG_BRI("%s(input): rm_no: %d, mod_no: %d\n", __FUNCTION__, rm_no, mod_no); +#endif + /* Translate mod_no to be between 0 and 2 (including) */ + mod_no = (mod_no / 2) % MAX_BRI_MODULES_PER_REMORA; + } +#if 0 + DEBUG_BRI("%s(updated): rm_no: %d, mod_no: %d\n", __FUNCTION__, rm_no, mod_no); +#endif + if(rm_no > MAX_BRI_REMORAS - 1){ + DEBUG_EVENT("%s:%s(): Line:%d: invalid rm_no: %d!!(mod_no: %d)\n", + hw->devname, __FUNCTION__, __LINE__, rm_no, mod_no); + return 0; + } + + data.remora_addr = rm_no; + data.mod_addr = mod_no; + + data.data = reg; + data.contrl = 0; + data.contrl |= ADDR_BIT; + + /* check spi not busy */ + for (retry_counter = 0; retry_counter < SPI_MAX_RETRY_COUNT; retry_counter++){ + sdla_bus_read_4(hw, SPI_INTERFACE_REG, dummy_ptr); + if(dummy.start == 1){SPI_DELAY;}else{SPI_BREAK;} + } + if(dummy.start == 1){ + DEBUG_EVENT("%s:%s(): Line:%d: SPI TIMEOUT!!\n", hw->devname, __FUNCTION__, __LINE__); + return 0; + } + + /* DEBUG_BRI("1. data: 0x%08X\n", *data_ptr); */ + /* setup the address */ + sdla_bus_write_4(hw, SPI_INTERFACE_REG, *data_ptr); + + /* DEBUG_BRI("2. data: 0x%08X\n", *data_ptr); */ + /* wait for end of spi operation */ +#if !FAST_SPI + for (retry_counter = 0; retry_counter < SPI_MAX_RETRY_COUNT; retry_counter++){ + sdla_bus_read_4(hw, SPI_INTERFACE_REG, dummy_ptr); + if(dummy.start == 1){SPI_DELAY;}else{SPI_BREAK;} + } + SPI_DELAY; + if(dummy.start == 1){ + DEBUG_EVENT("%s:%s(): Line:%d: SPI TIMEOUT!!\n", hw->devname, __FUNCTION__, __LINE__); + return 0; + } +#endif + + /* setup data for read spi operation */ + data.reset=0; + data.start=1; + data.reserv1=0; + + data.remora_addr = rm_no; + data.mod_addr = mod_no; + + data.data = 0; + data.contrl = 0; + data.contrl |= READ_BIT; + +#if FAST_SPI + SPI_DELAY; +#else + for (retry_counter = 0; retry_counter < SPI_MAX_RETRY_COUNT; retry_counter++){ + sdla_bus_read_4(hw, SPI_INTERFACE_REG, dummy_ptr); + if(dummy.start == 1){SPI_DELAY;}else{SPI_BREAK;} + } + SPI_DELAY; + if(dummy.start == 1){ + DEBUG_EVENT("%s:%s(): Line:%d: SPI TIMEOUT!!\n", hw->devname, __FUNCTION__, __LINE__); + return 0; + } +#endif + /* start read spi operation */ + sdla_bus_write_4(hw, SPI_INTERFACE_REG, *data_ptr); + +#if FAST_SPI + SPI_DELAY; +#else + /* wait for end of spi operation */ + for (retry_counter = 0; retry_counter < SPI_MAX_RETRY_COUNT; retry_counter++){ + sdla_bus_read_4(hw, SPI_INTERFACE_REG, data_ptr); + if(data.start == 1){ SPI_DELAY; }else{ SPI_BREAK; } + } + SPI_DELAY; + if(data.start == 1){ + DEBUG_EVENT("%s:%s(): Line:%d: SPI TIMEOUT!!\n", hw->devname, __FUNCTION__, __LINE__); + return 0; + } +#endif + //DEBUG_BRI("3. data: 0x%08X\n", *data_ptr); + + value = (u_int8_t)data.data; + + DEBUG_REG("%s():%s: mod_no:%d reg=0x%X (%d) value=0x%02X\n", + __FUNCTION__, + hw->devname, + mod_no, + reg, + reg, + value); + return value; +} + +u_int8_t sdla_shark_bri_read_fe (void* phw, ...) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + va_list args; + int mod_no, type, optional_arg, reg; + u_int8_t data = 0; +#if defined(WAN_DEBUG_FE) + char *fname; + int fline; +#endif + + va_start(args, phw); + mod_no = va_arg(args, int); + type = va_arg(args, int); + optional_arg = va_arg(args, int); + reg = va_arg(args, int); +#if defined(WAN_DEBUG_FE) + fname = va_arg(args, char*); + fline = va_arg(args, int); +#endif + va_end(args); + + if (sdla_hw_fe_test_and_set_bit(hw,0)){ +#if defined(WAN_DEBUG_FE) + DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE (%s:%d)!\n", + hw->devname, __FUNCTION__,__LINE__,fname,fline); +#else + DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", + hw->devname, __FUNCTION__,__LINE__); +#endif + return 0x00; + } + + data = __read_bri_fe_byte (hw, (u8)mod_no, (u8)reg, (u8)type, (u8)optional_arg); + + sdla_hw_fe_clear_bit(hw,0); + return data; +} + +/*************************************************************************** + Front End AFT Serial interface for Shark subtype cards +***************************************************************************/ +#define AFT_SERIAL_FE_INTERFACE_ADDR 0x210 +#define AFT_SERIAL_PORT_REG(line,reg) (reg+(0x4000*line)) +/*============================================================================ + * Read AFT Serial Front end registers + */ +static int __sdla_shark_serial_write_fe (void *phw, ...) +{ + sdlahw_t* hw = (sdlahw_t*)phw; + va_list args; + unsigned int addr; + int line_no, off, value; + + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + va_start(args, phw); + line_no = (int)va_arg(args, int); + off = (int)va_arg(args, int); + value = (int)va_arg(args, int); + va_end(args); + + addr = AFT_SERIAL_PORT_REG(line_no,AFT_SERIAL_FE_INTERFACE_ADDR); + sdla_bus_write_4(hw, addr, value); + return 0; +} + +int sdla_shark_serial_write_fe (void *phw, ...) +{ + sdlahw_t* hw = (sdlahw_t*)phw; + va_list args; + int line_no, off, value; + + if (sdla_hw_fe_test_and_set_bit(hw,0)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT( + "%s: %s:%d: Critical Error: Re-entry in FE!\n", + hw->devname, + __FUNCTION__,__LINE__); + } + return -EINVAL; + } + + va_start(args, phw); + line_no = (int)va_arg(args, int); + off = (int)va_arg(args, int); + value = (int)va_arg(args, int); + va_end(args); + + __sdla_shark_serial_write_fe(hw, line_no, off, value); + + sdla_hw_fe_clear_bit(hw,0); + return 0; +} + +/*============================================================================ + * Read AFT Serial Front end registers + */ +u_int32_t __sdla_shark_serial_read_fe (void *phw, ...) +{ + sdlahw_t* hw = (sdlahw_t*)phw; + va_list args; + unsigned int addr; + int off, line_no, value; + + WAN_ASSERT(hw == NULL); + WAN_ASSERT(hw->hwcpu == NULL); + WAN_ASSERT(hw->hwcpu->hwcard == NULL); + va_start(args, phw); + line_no = (int)va_arg(args, int); + off = (int)va_arg(args, int); + va_end(args); + + addr = AFT_SERIAL_PORT_REG(line_no,AFT_SERIAL_FE_INTERFACE_ADDR); + sdla_bus_read_4(hw, addr, (u32*)&value); + return value; +} + +u_int32_t sdla_shark_serial_read_fe(void *phw, ...) +{ + sdlahw_t* hw = (sdlahw_t*)phw; + va_list args; + int line_no, off, value; + + if (sdla_hw_fe_test_and_set_bit(hw,0)){ + if (WAN_NET_RATELIMIT()){ + DEBUG_EVENT("%s: %s:%d: Critical Error: Re-entry in FE!\n", + hw->devname, __FUNCTION__,__LINE__); + } + return 0x00; + } + + va_start(args, phw); + line_no = va_arg(args, int); + off = va_arg(args, int); + va_end(args); + + value = __sdla_shark_serial_read_fe(hw, line_no, off); + + sdla_hw_fe_clear_bit(hw,0); + return value; +} diff --git a/patches/kdrivers/src/net/sdladrv_utils.c b/patches/kdrivers/src/net/sdladrv_utils.c new file mode 100644 index 0000000..fcd11b2 --- /dev/null +++ b/patches/kdrivers/src/net/sdladrv_utils.c @@ -0,0 +1,295 @@ +/***************************************************************************** +* sdladrv_utils.c SDLADRV utils functions. +* +* +* Author: Alex Feldman +* +* Copyright: (c) 2007 Sangoma Technologies 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. +* ============================================================================ +* Jan 20, 2007 Alex Feldman Initial version +* +*****************************************************************************/ + + +/*************************************************************************** +**** I N C L U D E F I L E S **** +***************************************************************************/ +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#elif defined(__WINDOWS__) +# include +# include +# include +# include +# include +# include /* SDLA firmware module definitions */ +# include /* SDLA PCI hardware definitions */ +# include +# include /* API definitions */ +#elif defined(__LINUX__)||defined(__KERNEL__) +# define _K22X_MODULE_FIX_ +# include +# include +# include +# include +# include +# include /* SDLA firmware module definitions */ +# include /* SDLA PCI hardware definitions */ +# include +# include /* API definitions */ +#else +# error "Unsupported Operating System!" +#endif + +/*************************************************************************** +**** M A C R O S / D E F I N E S **** +***************************************************************************/ +//This is the address of the ECCTL register , page 149 of PEX8111 datasheet. +#define SDLA_PLX_EECTL 0x1004 + +//Change this accordingly.!!! +#define SDLA_PLX_EEPROM_SIZE 0xFF + +#define SDLA_PLX_EEPROM_BUSY 19 +#define SDLA_PLX_EEPROM_CS_ENABLE 18 +#define SDLA_PLX_EEPROM_BYTE_READ_START 17 +#define SDLA_PLX_EEPROM_READ_DATA 8 +#define SDLA_PLX_EEPROM_WRITE_DATA 0 +#define SDLA_PLX_EEPROM_BYTE_WRITE_START 16 + +//EEPROM COMMANDS +#define SDLA_PLX_READ_STATUS_EE_OPCODE 0x05 +#define SDLA_PLX_WREN_EE_OPCODE 0x06 +#define SDLA_PLX_WRITE_EE_OPCODE 0x02 +#define SDLA_PLX_READ_EE_OPCODE 0x03 + + +/*************************************************************************** +**** F U N C T I O N P R O T O T Y P E S **** +***************************************************************************/ + +/*************************************************************************** +**** G L O B A L D A T A **** +***************************************************************************/ + +/*************************************************************************** +**** F U N C T I O N D E F I N I T I O N **** +***************************************************************************/ +static void sdla_plx_8111Read(void *phw, int addr, int *data); +static void sdla_plx_8111Write(void *phw, int addr, int data); +static int sdla_plx_EE_waitidle(void *phw); +static int sdla_plx_EE_off(void *phw); +static unsigned char sdla_plx_EE_readbyte(void *phw); +static int sdla_plx_EE_writebyte(void *phw, unsigned char); + +unsigned char sdla_plxctrl_status(void *phw); +unsigned char sdla_plxctrl_read8(void *phw, short); +void sdla_plxctrl_write8(void *phw, short, unsigned char); +void sdla_plxctrl_erase(void *phw); + +extern int sdla_pci_bridge_read_config_dword(void*, int, u_int32_t*); +extern int sdla_pci_bridge_write_config_dword(void*, int, u_int32_t); + +/************************************************************************/ +/* GLOBAL VARIABLES */ +/************************************************************************/ + +/************************************************************************/ +/* FUNCTION PROTOTYPES */ +/************************************************************************/ + +/////////////////////////////////////////////////////////////////// +//Write the value read into the dst pointer. +static void sdla_plx_8111Read(void *phw, int addr, int *data) +{ + WAN_ASSERT_VOID(phw == NULL); + if (addr < 0x1000){ + sdla_pci_bridge_read_config_dword(phw, addr, data); + }else if (addr >= 0x1000 && addr <= 0x1FFF){ + sdla_pci_bridge_write_config_dword(phw, 0x84, addr); + sdla_pci_bridge_read_config_dword(phw, 0x88, data); + } +} + +/////////////////////////////////////////////////////////////////// +static void sdla_plx_8111Write(void *phw, int addr, int data) +{ + WAN_ASSERT_VOID(phw == NULL); + if (addr < 0x1000){ + sdla_pci_bridge_write_config_dword(phw, addr, data); + }else if (addr >= 0x1000 && addr <= 0x1FFF){ + sdla_pci_bridge_write_config_dword(phw, 0x84, addr); + sdla_pci_bridge_write_config_dword(phw, 0x88, data); + } +} + +/////////////////////////////////////////////////////////////////// +static int sdla_plx_EE_waitidle(void *phw) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + int eeCtl, ii; + + WAN_ASSERT(phw == NULL); + for (ii = 0; ii < 100; ii++){ + /* read current value in EECTL */ + sdla_plx_8111Read(phw, SDLA_PLX_EECTL, &eeCtl); + /* loop until idle */ + if ((eeCtl & (1 << SDLA_PLX_EEPROM_BUSY)) == 0){ + return(eeCtl); + } + } + DEBUG_EVENT("%s: ERROR: EEPROM Busy timeout!\n", + hw->devname); + return -EINVAL; +} + +/////////////////////////////////////////////////////////////////// +static int sdla_plx_EE_off(void *phw) +{ + + WAN_ASSERT(phw == NULL); + /* make sure EEPROM is idle */ + sdla_plx_EE_waitidle(phw); + /* turn off everything (especially SDLA_PLX_EEPROM_CS_ENABLE)*/ + sdla_plx_8111Write(phw, SDLA_PLX_EECTL, 0); + return 0; +} + +/////////////////////////////////////////////////////////////////// +static unsigned char sdla_plx_EE_readbyte(void *phw) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + int i, eeCtl = 0x00; + unsigned char data = 0x00; + + WAN_ASSERT_RC(phw == NULL, 0xFF); + eeCtl = sdla_plx_EE_waitidle(phw); + + eeCtl = 0; + eeCtl |= (1 << SDLA_PLX_EEPROM_CS_ENABLE) | + (1 << SDLA_PLX_EEPROM_BYTE_READ_START); + sdla_plx_8111Write(phw, SDLA_PLX_EECTL, eeCtl); /* start reading */ + for (i=0;i<1000;i++){ + sdla_plx_8111Read(phw, SDLA_PLX_EECTL, &eeCtl); + if ((eeCtl & (1 << SDLA_PLX_EEPROM_BYTE_READ_START)) == 0){ + break; + } + } + if ((eeCtl & (1 << SDLA_PLX_EEPROM_BYTE_READ_START)) != 0){ + DEBUG_EVENT("%s: Timeout on PLX READ!\n", + hw->devname); + return 0xFF; + } + + eeCtl = sdla_plx_EE_waitidle(phw); /* wait until read is done */ + sdla_plx_8111Read(phw, SDLA_PLX_EECTL, &eeCtl); + data = (eeCtl >> SDLA_PLX_EEPROM_READ_DATA) & 0xFF; + + /* extract read data from EECTL */ + return data; +} + +/////////////////////////////////////////////////////////////////// +static int sdla_plx_EE_writebyte(void *phw, unsigned char val) +{ + sdlahw_t *hw = (sdlahw_t*)phw; + int i, eeCtl = 0; /* make sure EEPROM is idle */ + + WAN_ASSERT(phw == NULL); + eeCtl = sdla_plx_EE_waitidle(phw); /* make sure EEPROM is idle */ + /* clear current WRITE value */ + eeCtl = 0; + eeCtl &= ~(0xff << SDLA_PLX_EEPROM_WRITE_DATA); + eeCtl |= (1 << SDLA_PLX_EEPROM_CS_ENABLE) | + (1 << SDLA_PLX_EEPROM_BYTE_WRITE_START) | + ((val & 0xff) << SDLA_PLX_EEPROM_WRITE_DATA); + sdla_plx_8111Write(phw, SDLA_PLX_EECTL, eeCtl); + + for (i=0;i<1000;i++){ + sdla_plx_8111Read(phw, SDLA_PLX_EECTL, &eeCtl); + if ((eeCtl & (1 << SDLA_PLX_EEPROM_BYTE_WRITE_START)) == 0){ + break; + } + } + if ((eeCtl & (1 << SDLA_PLX_EEPROM_BYTE_WRITE_START)) != 0){ + DEBUG_EVENT("%s: Timeout on PLX write!\n", + hw->devname); + return -EINVAL; + } + return 0; +} + + +/*************************************************************************** +**** These are the high level functions **** +***************************************************************************/ + +/////////////////////////////////////////////////////////////////// +unsigned char sdla_plxctrl_status(void *phw) +{ + unsigned char status = 0; + + WAN_ASSERT_RC(phw == NULL, 0xFF); + sdla_plx_EE_writebyte(phw, SDLA_PLX_READ_STATUS_EE_OPCODE); + status = sdla_plx_EE_readbyte(phw); /* get EEPROM status */ + sdla_plx_EE_off(phw); /* turn off EEPROM */ + + return status; +} + +void sdla_plxctrl_write8(void *phw, short addr, unsigned char data) +{ + + WAN_ASSERT_VOID(phw == NULL); + sdla_plx_EE_writebyte(phw, SDLA_PLX_WREN_EE_OPCODE); /* must first write-enable */ + sdla_plx_EE_off(phw); /* turn off EEPROM */ + sdla_plx_EE_writebyte(phw, SDLA_PLX_WRITE_EE_OPCODE); /* opcode to write bytes */ + + /* Send low byte of address */ + sdla_plx_EE_writebyte(phw, (unsigned char)(addr & 0xFF)); + + sdla_plx_EE_writebyte(phw, 0xFF & data); /* send data to be written */ + + sdla_plx_EE_off(phw); /* turn off EEPROM */ + return; +} + +/////////////////////////////////////////////////////////////////// +unsigned char sdla_plxctrl_read8(void *phw, short addr) +{ + unsigned char ch; + + WAN_ASSERT_RC(phw == NULL, 0xFF); + sdla_plx_EE_writebyte(phw, SDLA_PLX_READ_EE_OPCODE); + sdla_plx_EE_writebyte(phw, (unsigned char)(addr & 0xFF)); + + ch = sdla_plx_EE_readbyte(phw); + sdla_plx_EE_off(phw); + return ch; +} + +void sdla_plxctrl_erase(void *phw) +{ + int t; + + WAN_ASSERT_VOID(phw == NULL); + for(t = 0; t < SDLA_PLX_EEPROM_SIZE; t++){ + sdla_plxctrl_write8(phw, t, 0xFF); + } + return; +} + diff --git a/patches/kdrivers/src/net/sdlamain.c b/patches/kdrivers/src/net/sdlamain.c index 5025e06..c87e3ae 100644 --- a/patches/kdrivers/src/net/sdlamain.c +++ b/patches/kdrivers/src/net/sdlamain.c @@ -184,10 +184,24 @@ #define wp_xilinx_init(card,conf) (-EPROTONOSUPPORT) #endif +#ifndef CONFIG_PRODUCT_WANPIPE_AFT_BRI + #define wp_aft_bri_init(card,conf) (-EPROTONOSUPPORT) +#endif + +#ifndef CONFIG_PRODUCT_WANPIPE_AFT_SERIAL + #define wp_aft_serial_init(card,conf) (-EPROTONOSUPPORT) +#endif + #ifndef CONFIG_PRODUCT_WANPIPE_AFT_TE1 #define wp_aft_te1_init(card,conf) (-EPROTONOSUPPORT) +#endif + +#ifndef CONFIG_PRODUCT_WANPIPE_AFT_RM #define wp_aft_analog_init(card,conf) (-EPROTONOSUPPORT) - #define aft_global_hw_device_init() +#endif + +#ifndef CONFIG_PRODUCT_WANPIPE_AFT_56K + #define wp_aft_56k_init(card,conf) (-EPROTONOSUPPORT) #endif #ifndef CONFIG_PRODUCT_WANPIPE_AFT_TE3 @@ -378,6 +392,7 @@ int __init wanpipe_init(void) ncards=0; + if (WANPIPE_VERSION_BETA){ DEBUG_EVENT("%s Beta %s.%s %s %s\n", fullname, WANPIPE_VERSION, WANPIPE_SUB_VERSION, @@ -403,12 +418,12 @@ int __init wanpipe_init(void) wanpipe_debug=NULL; for (i=0;ilist; - kfree(tmpcard); + wan_free(tmpcard); tmpcard=tmp; } card_list=NULL; @@ -429,7 +444,7 @@ int __init wanpipe_init(void) sprintf(card->devname, "%s%d", drvname, ++cnt); wandev->magic = ROUTER_MAGIC; wandev->name = card->devname; - wandev->private = card; + wandev->priv = card; wandev->enable_tx_int = 0; wandev->setup = &setup; wandev->shutdown = &shutdown; @@ -449,7 +464,7 @@ int __init wanpipe_init(void) for (tmpcard=card_list;tmpcard;){ unregister_wan_device(tmpcard->devname); tmp=tmpcard->list; - kfree(tmpcard); + wan_free(tmpcard); tmpcard=tmp; } card_list=NULL; @@ -474,11 +489,14 @@ int __init wanpipe_init(void) wanpipe_globals_util_init(); +#if defined(CONFIG_PRODUCT_WANPIPE_AFT_CORE) aft_global_hw_device_init(); +#endif #if 0 wp_tasklet_per_cpu_init(); #endif + return err; } @@ -492,6 +510,7 @@ void __exit wanpipe_exit(void) { sdla_t *tmpcard, *tmp; + wanpipe_unregister_fw_from_api(); if (!card_list) @@ -500,7 +519,7 @@ void __exit wanpipe_exit(void) for (tmpcard=card_list;tmpcard;){ unregister_wan_device(tmpcard->devname); tmp=tmpcard->list; - kfree(tmpcard); + wan_free(tmpcard); tmpcard=tmp; } @@ -511,9 +530,6 @@ void __exit wanpipe_exit(void) DEBUG_EVENT("\n"); DEBUG_EVENT("wanpipe: WANPIPE Modules Unloaded.\n"); -#if defined(WAN_DEBUG_MEM) - DEBUG_EVENT("wanpipe: Total Mem %d\n",atomic_read(&wan_debug_mem)); -#endif } module_init(wanpipe_init); @@ -544,18 +560,19 @@ static int setup (wan_device_t* wandev, wandev_conf_t* conf) int err = 0; int irq=0; + /* Sanity checks */ - if ((wandev == NULL) || (wandev->private == NULL) || (conf == NULL)){ + if ((wandev == NULL) || (wandev->priv == NULL) || (conf == NULL)){ DEBUG_EVENT("%s: Failed Sdlamain Setup wandev %p, card %p, conf %p !\n", wandev->name, - wandev,wandev->private, + wandev,wandev->priv, conf); return -EFAULT; } DEBUG_EVENT("%s: Starting WAN Setup\n", wandev->name); - card = wandev->private; + card = wandev->priv; if (wandev->state != WAN_UNCONFIGURED){ DEBUG_EVENT("%s: Device already configured\n", wandev->name); @@ -590,14 +607,23 @@ static int setup (wan_device_t* wandev, wandev_conf_t* conf) conf->card_type = WANOPT_AFT300; conf->S514_CPU_no[0] = 'A'; break; + case WANCONFIG_AFT_ISDN_BRI: + conf->card_type = WANOPT_AFT_ISDN; + conf->S514_CPU_no[0] = 'A'; + break; case WANCONFIG_AFT_56K: conf->card_type = WANOPT_AFT_56K; conf->S514_CPU_no[0] = 'A'; break; + case WANCONFIG_AFT_SERIAL: + conf->card_type = WANOPT_AFT_SERIAL; + conf->S514_CPU_no[0] = 'A'; + break; } wandev->card_type = conf->card_type; + card->hw = sdla_register(&card->hw_iface, conf, card->devname); if (card->hw == NULL){ return -EINVAL; @@ -654,8 +680,11 @@ static int setup (wan_device_t* wandev, wandev_conf_t* conf) case WANOPT_AFT: case WANOPT_AFT104: case WANOPT_AFT300: + case WANOPT_AFT_ISDN: case WANOPT_AFT_ANALOG: case WANOPT_AFT_56K: + case WANOPT_AFT_SERIAL: + err=0; if ((err=check_aft_conflicts(card,conf,&irq)) != 0){ sdla_unregister(&card->hw, card->devname); @@ -664,7 +693,7 @@ static int setup (wan_device_t* wandev, wandev_conf_t* conf) break; default: - DEBUG_EVENT("%s: ERROR, invalid card type 0x%0X!\n", + DEBUG_EVENT("%s: (1) ERROR, invalid card type 0x%0X!\n", card->devname,conf->card_type); sdla_unregister(&card->hw, card->devname); return -EINVAL; @@ -909,6 +938,18 @@ static int setup (wan_device_t* wandev, wandev_conf_t* conf) err = wp_aft_analog_init(card,conf); break; + case WANCONFIG_AFT_ISDN_BRI: + DEBUG_EVENT("%s: Starting AFT ISDN BRI Hardware Init.\n", + card->devname); + err = wp_aft_bri_init(card,conf); + break; + + case WANCONFIG_AFT_SERIAL: + DEBUG_EVENT("%s: Starting AFT Serial (V32/RS232) Hardware Init.\n", + card->devname); + err = wp_aft_serial_init(card,conf); + break; + case WANCONFIG_AFT_TE3: DEBUG_EVENT("%s: Starting AFT TE3 Hardware Init.\n", card->devname); @@ -1354,7 +1395,7 @@ static int shutdown (wan_device_t* wandev, wandev_conf_t* conf) int err=0; /* sanity checks */ - if ((wandev == NULL) || (wandev->private == NULL)){ + if ((wandev == NULL) || (wandev->priv == NULL)){ return -EFAULT; } @@ -1362,7 +1403,7 @@ static int shutdown (wan_device_t* wandev, wandev_conf_t* conf) return 0; } - card = wandev->private; + card = wandev->priv; if (card->tty_opt){ if (card->tty_open){ @@ -1509,13 +1550,13 @@ static int ioctl (wan_device_t* wandev, unsigned cmd, unsigned long arg) int err; /* sanity checks */ - if ((wandev == NULL) || (wandev->private == NULL)) + if ((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; //ALEX-HWABSTR // if (wandev->state == WAN_UNCONFIGURED) // return -ENODEV; - card = wandev->private; + card = wandev->priv; if (test_bit(SEND_CRIT, (void*)&wandev->critical)) { return -EAGAIN; @@ -1523,11 +1564,11 @@ static int ioctl (wan_device_t* wandev, unsigned cmd, unsigned long arg) switch (cmd) { case WANPIPE_DUMP: - err = ioctl_dump(wandev->private, (void*)arg); + err = ioctl_dump(wandev->priv, (void*)arg); break; case WANPIPE_EXEC: - err = ioctl_exec(wandev->private, (void*)arg, cmd); + err = ioctl_exec(wandev->priv, (void*)arg, cmd); break; default: err = -EINVAL; @@ -1565,7 +1606,7 @@ static int ioctl_dump (sdla_t* card, sdla_dump_t* u_dump) return -EINVAL; } - data = kmalloc(dump.length, GFP_KERNEL); + data = wan_kmalloc(dump.length); if (data == NULL){ return -ENOMEM; } @@ -1575,7 +1616,7 @@ static int ioctl_dump (sdla_t* card, sdla_dump_t* u_dump) if(copy_to_user((void *)dump.ptr, data, dump.length)){ err = -EFAULT; } - kfree(data); + wan_free(data); return err; } @@ -1935,7 +1976,7 @@ void add_gateway(sdla_t *card, netdevice_t *dev) static int debugging (wan_device_t* wandev) { - sdla_t* card = (sdla_t*)wandev->private; + sdla_t* card = (sdla_t*)wandev->priv; if (wandev->state == WAN_UNCONFIGURED){ return 0; diff --git a/patches/kdrivers/src/net/wanpipe_abstr.c b/patches/kdrivers/src/net/wanpipe_abstr.c index 0aeb5a5..40168af 100644 --- a/patches/kdrivers/src/net/wanpipe_abstr.c +++ b/patches/kdrivers/src/net/wanpipe_abstr.c @@ -32,6 +32,9 @@ # include # include # include +#elif defined(__WINDOWS__) +# include +# include #elif defined(__KERNEL__) # include # include @@ -140,7 +143,11 @@ void wpabs_skb_free(void* skb) /* ** wpabs_skb_copyback() - */ +#if defined(__WINDOWS__) || defined(__FreeBSD__) +void wpabs_skb_copyback(void* skb, int off, int len, caddr_t cp) +#else void wpabs_skb_copyback(void* skb, int off, int len, unsigned long cp) +#endif { wan_skb_copyback(skb, off, len, (caddr_t)cp); } @@ -304,7 +311,7 @@ void *wpabs_netif_alloc(unsigned char *dev_name,int ifType, int *err) void wpabs_netif_free(void *dev) { - return wan_netif_free(dev); + wan_netif_free(dev); } @@ -318,7 +325,7 @@ unsigned char* wpabs_netif_name(void *dev) */ int wpabs_netif_queue_stopped(void* dev) { - return WAN_NETIF_QUEUE_STOPPED((netdevice_t*)dev); + return WAN_NETIF_QUEUE_STOPPED(((netdevice_t*)dev)); } /* @@ -358,7 +365,12 @@ void wpabs_add_timer(void* timer_info, unsigned long delay) /* ** wpabs_init_timer */ -void wpabs_init_timer(void* timer_info, void* timer_func, unsigned long data) +void wpabs_init_timer(void* timer_info, void* timer_func, +#if defined(__WINDOWS__) + wan_timer_arg_t data) +#else + unsigned long data) +#endif { wan_timer_t* timer = (wan_timer_t*)timer_info; @@ -385,12 +397,20 @@ void wpabs_del_timer(void* timer_info) unsigned long* wpabs_dma_get_vaddr(void* pcard, void* dma_descr) { +#if defined(__WINDOWS__) + return ((wan_dma_descr_t*)dma_descr)->vAddr; +#else return wan_dma_get_vaddr(pcard,dma_descr); +#endif } unsigned long wpabs_dma_get_paddr(void* pcard, void* dma_descr) { +#if defined(__WINDOWS__) + return ((wan_dma_descr_t*)dma_descr)->physicalAddr.u.LowPart; +#else return wan_dma_get_paddr(pcard,dma_descr); +#endif } void* wpabs_malloc(int size) @@ -481,7 +501,7 @@ void* wpabs_spinlock_alloc(void) } void wpabs_spinlock_free(void* lock) { - return wan_free(lock); + wan_free(lock); } /* @@ -508,12 +528,12 @@ void wpabs_spin_unlock_irqrestore(void* lock,unsigned long *flags) /* ** */ -void wpabs_spin_lock_init(void* lock) +void wpabs_spin_lock_init(void* lock, char *name) { wan_spinlock_t* SpinLock = (wan_spinlock_t*)lock; WAN_ASSERT1(SpinLock == NULL); - wan_spin_lock_init(SpinLock); + wan_spin_lock_irq_init(SpinLock, name); } @@ -570,7 +590,6 @@ void wpabs_write_rw_unlock_irq(void* lock,unsigned long *flags) /* ** */ - void wpabs_debug_event(const char * fmt, ...) { #ifdef WAN_DEBUG_EVENT @@ -710,6 +729,8 @@ int wpabs_test_and_set_bit(int bit, void *ptr) } wan_set_bit(bit,ptr); return 0; +#elif defined(__WINDOWS__) + return test_and_set_bit(bit,ptr); #else # error "Error: wpabs_test_and_set_bit() not implemented!" #endif @@ -733,11 +754,11 @@ int wpabs_clear_bit(int bit, void *ptr) return 0; } -unsigned long wpabs_get_systemticks(void) +wan_ticks_t wpabs_get_systemticks(void) { return SYSTEM_TICKS; } - + unsigned long wpabs_get_hz(void) { return HZ; @@ -935,6 +956,9 @@ unsigned long wan_get_ip_addr(void* dev, int option) #elif defined(__NetBSD__) || defined(__OpenBSD__) addr = (struct sockaddr_in *)ifa->ifa_addr; return htonl(addr->sin_addr.s_addr); +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL + return 0; #else return ifaddr->ifa_local; #endif @@ -948,6 +972,9 @@ unsigned long wan_get_ip_addr(void* dev, int option) return addr->sin_addr.s_addr; #elif defined(__NetBSD__) || defined(__OpenBSD__) return 0; +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL + return 0; #else return ifaddr->ifa_address; #endif @@ -956,6 +983,9 @@ unsigned long wan_get_ip_addr(void* dev, int option) case WAN_NETMASK_IP: #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) return 0; +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL + return 0; #else return ifaddr->ifa_mask; #endif @@ -964,6 +994,9 @@ unsigned long wan_get_ip_addr(void* dev, int option) case WAN_BROADCAST_IP: #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) return 0; +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL + return 0; #else return ifaddr->ifa_broadcast; #endif @@ -1061,6 +1094,8 @@ int wpabs_net_ratelimit(void) ** For these OS always print all messages. */ return 1; +#elif defined(__WINDOWS__) + return 1; #else # error "wpabs_netrate_limit not supported" #endif @@ -1074,6 +1109,8 @@ void wpabs_get_random_bytes(void *ptr, int len) read_random(ptr,len); #elif defined(__OpenBSD__) get_random_bytes(ptr,len); +#elif defined(__WINDOWS__) + FUNC_NOT_IMPL #else # error "wpabs_get_random_bytes not supported" #endif diff --git a/patches/kdrivers/src/net/wanpipe_codec.c b/patches/kdrivers/src/net/wanpipe_codec.c index 13c1f03..566c809 100644 --- a/patches/kdrivers/src/net/wanpipe_codec.c +++ b/patches/kdrivers/src/net/wanpipe_codec.c @@ -26,7 +26,7 @@ # include # include # include -#elif (defined __WINDOWS__) +#elif defined(__WINDOWS__) # include # include # include @@ -44,6 +44,8 @@ wanpipe_codec_ops_t *WANPIPE_CODEC_OPS[WP_TDM_HW_CODING_MAX][WP_TDM_CODEC_MAX]; #ifdef __LINUX__ __init int wanpipe_codec_init(void) +#elif defined(__WINDOWS__) +int wanpipe_codec_init(void) #else __init int wanpipe_codec_init(void) #endif diff --git a/patches/kdrivers/src/net/wanpipe_codec_law.c b/patches/kdrivers/src/net/wanpipe_codec_law.c index a764c82..6f508c1 100644 --- a/patches/kdrivers/src/net/wanpipe_codec_law.c +++ b/patches/kdrivers/src/net/wanpipe_codec_law.c @@ -28,13 +28,11 @@ # include #elif (defined __WINDOWS__) # include -# include -# include -# include # include # include #define __init +#define inline __inline #define DBG_LAW if(1)DbgPrint diff --git a/patches/kdrivers/src/net/wanpipe_linux_iface.c b/patches/kdrivers/src/net/wanpipe_linux_iface.c index 97d8ff9..8450848 100644 --- a/patches/kdrivers/src/net/wanpipe_linux_iface.c +++ b/patches/kdrivers/src/net/wanpipe_linux_iface.c @@ -58,7 +58,6 @@ static int wan_iface_send(netskb_t*, netdevice_t*); static int wan_iface_ioctl(netdevice_t*, struct ifreq*, int); static struct net_device_stats* wan_iface_get_stats (netdevice_t*); static void wan_iface_tx_timeout (netdevice_t*); -static int wan_iface_change_mtu (netdevice_t *dev, int new_mtu); #ifdef CONFIG_PRODUCT_WANPIPE_GENERIC static int wan_iface_hdlc_attach(hdlc_device*, unsigned short,unsigned short); @@ -224,11 +223,11 @@ static int wan_iface_init(netdevice_t* dev) dev->open = &wan_iface_open; dev->stop = &wan_iface_close; + dev->hard_header = NULL; + dev->rebuild_header = NULL; dev->hard_start_xmit = &wan_iface_send; dev->get_stats = &wan_iface_get_stats; dev->tx_timeout = &wan_iface_tx_timeout; - dev->change_mtu = &wan_iface_change_mtu; - dev->watchdog_timeo = HZ*2; dev->hard_header_len = 32; dev->set_config = NULL; @@ -267,6 +266,9 @@ static int wan_iface_eth_init(netdevice_t* dev) dev->do_ioctl = &wan_iface_ioctl; dev->open = &wan_iface_open; dev->stop = &wan_iface_close; + + dev->hard_header = NULL; + dev->rebuild_header = NULL; dev->hard_start_xmit = &wan_iface_send; dev->get_stats = &wan_iface_get_stats; dev->tx_timeout = &wan_iface_tx_timeout; @@ -416,13 +418,12 @@ On shutdown, this is possible common = wan_netif_priv(dev); if (common && common->iface.get_stats){ return common->iface.get_stats(dev); + }else{ + return &gif_stats; } - return &gif_stats; + return NULL; } - - - /*============================================================================ * Handle transmit timeout event from netif watchdog */ @@ -443,25 +444,6 @@ static void wan_iface_tx_timeout (netdevice_t *dev) return; } - -static int wan_iface_change_mtu (netdevice_t *dev, int new_mtu) -{ - wanpipe_common_t *common; - - WAN_ASSERT(wan_netif_priv(dev) == NULL); - common = wan_netif_priv(dev); - /* If our device stays busy for at least 5 seconds then we will - * kick start the device by making dev->tbusy = 0. We expect - * that our device never stays busy more than 5 seconds. So this - * is only used as a last resort. - */ - if (common->iface.change_mtu){ - return common->iface.change_mtu(dev,new_mtu); - } - - return 0; -} - static int wan_iface_input(netdevice_t* dev, netskb_t* skb) { wanpipe_common_t *common; diff --git a/patches/kdrivers/src/net/wanpipe_multppp.c b/patches/kdrivers/src/net/wanpipe_multppp.c index bbe10ee..f02ab00 100644 --- a/patches/kdrivers/src/net/wanpipe_multppp.c +++ b/patches/kdrivers/src/net/wanpipe_multppp.c @@ -326,7 +326,7 @@ int wp_mprot_init (sdla_t* card, wandev_conf_t* conf) if (IS_TE1_MEDIA(&conf->fe_cfg)){ memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - sdla_te_iface_init(&card->wandev.fe_iface); + sdla_te_iface_init(&card->fe, &card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; card->fe.write_fe_reg = write_front_end_reg; @@ -334,7 +334,7 @@ int wp_mprot_init (sdla_t* card, wandev_conf_t* conf) card->wandev.fe_enable_timer = chdlc_enable_timer; card->wandev.te_link_state = handle_front_end_state; - conf->interface = + conf->electrical_interface = (IS_T1_CARD(card)) ? WANOPT_V35 : WANOPT_RS232; if (card->u.c.comm_port == WANOPT_PRI){ @@ -344,7 +344,7 @@ int wp_mprot_init (sdla_t* card, wandev_conf_t* conf) }else if (IS_56K_MEDIA(&conf->fe_cfg)){ memcpy(&card->fe.fe_cfg, &conf->fe_cfg, sizeof(sdla_fe_cfg_t)); - sdla_56k_iface_init(&card->wandev.fe_iface); + sdla_56k_iface_init(&card->fe, &card->wandev.fe_iface); card->fe.name = card->devname; card->fe.card = card; card->fe.write_fe_reg = write_front_end_reg; @@ -411,9 +411,9 @@ int wp_mprot_init (sdla_t* card, wandev_conf_t* conf) card->u.c.update_call_count = 0; card->wandev.ttl = conf->ttl; - card->wandev.interface = conf->interface; + card->wandev.electrical_interface = conf->electrical_interface; - if ((card->u.c.comm_port == WANOPT_SEC && conf->interface == WANOPT_V35)&& + if ((card->u.c.comm_port == WANOPT_SEC && conf->electrical_interface == WANOPT_V35)&& card->type != SDLA_S514){ printk(KERN_INFO "%s: ERROR - V35 Interface not supported on S508 %s port \n", card->devname, PORT(card->u.c.comm_port)); @@ -571,13 +571,13 @@ int wp_mprot_init (sdla_t* card, wandev_conf_t* conf) */ static int update (wan_device_t* wandev) { - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; netdevice_t* dev; private_area_t* chan; unsigned long smp_flags; /* sanity checks */ - if((wandev == NULL) || (wandev->private == NULL)) + if((wandev == NULL) || (wandev->priv == NULL)) return -EFAULT; if(wandev->state == WAN_UNCONFIGURED) @@ -621,7 +621,7 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf) struct ppp_device *pppdev=NULL; struct sppp *sp=NULL; - sdla_t* card = wandev->private; + sdla_t* card = wandev->priv; private_area_t* chan; int err = 0; @@ -927,7 +927,7 @@ static int del_if (wan_device_t* wandev, netdevice_t* dev) { private_area_t *chan = dev->priv; sdla_t *card = chan->card; - unsigned long smp_flags; + unsigned long smp_flags=0; #ifdef CONFIG_PRODUCT_WANPIPE_ANNEXG if (chan->common.usedby == ANNEXG && chan->annexg_dev){ @@ -974,6 +974,8 @@ static int del_if (wan_device_t* wandev, netdevice_t* dev) * since in some cases (mrouted) daemons continue * to call ioctl() after the device has gone down */ dev->do_ioctl = NULL; + dev->hard_header = NULL; + dev->rebuild_header = NULL; if (chan->common.prot_ptr){ kfree(chan->common.prot_ptr); @@ -990,15 +992,12 @@ static int del_if (wan_device_t* wandev, netdevice_t* dev) port_set_state(card, WAN_DISCONNECTED); - wan_unreg_api(chan, card->devname); + if (chan->common.usedby == API){ + wan_unreg_api(chan, card->devname); + } /* TE1 - Unconfiging, only on shutdown */ if (IS_TE1_CARD(card)) { - - if (card->wandev.fe_iface.pre_release){ - card->wandev.fe_iface.pre_release(&card->fe); - } - if (card->wandev.fe_iface.unconfig){ card->wandev.fe_iface.unconfig(&card->fe); } @@ -1044,7 +1043,8 @@ static int if_init (netdevice_t* dev) dev->type = ARPHRD_PPP; dev->mtu = card->wandev.mtu; dev->hard_header_len = 0; - + dev->hard_header = NULL; + dev->rebuild_header = NULL; } /* Overwrite the sppp ioctl, because we need to run @@ -1292,7 +1292,7 @@ static int if_send (struct sk_buff* skb, netdevice_t* dev) } else { err=1; stop_net_queue(dev); - } + } }else{ ++card->wandev.stats.tx_packets; card->wandev.stats.tx_bytes += skb->len; @@ -1743,7 +1743,12 @@ STATIC WAN_IRQ_RETVAL wsppp_isr (sdla_t* card) start_net_queue(dev); wan_wakeup_api(chan); break; - } + } + + if (chan->common.usedby == API){ + WAN_NETIF_WAKE_QUEUE(dev); + wan_wakeup_api(chan); + } #ifdef CONFIG_PRODUCT_WANPIPE_ANNEXG if (chan->common.usedby == ANNEXG && @@ -1967,7 +1972,7 @@ static void rx_intr (sdla_t* card) if (chan->annexg_dev){ skb->protocol = htons(ETH_P_X25); skb->dev = chan->annexg_dev; - wan_skb_reset_mac_header(skb); + wan_skb_reset_mac_header(skb); if (wan_skb_queue_len(&chan->rx_queue) > MAX_RX_QUEUE){ wan_skb_free(skb); @@ -1989,7 +1994,7 @@ static void rx_intr (sdla_t* card) } }else if (chan->common.usedby == STACK){ skb->dev = chan->annexg_dev; - wan_skb_reset_mac_header(skb); + wan_skb_reset_mac_header(skb); if (wan_skb_queue_len(&chan->rx_queue) > MAX_RX_QUEUE){ wan_skb_free(skb); @@ -2019,7 +2024,7 @@ static void rx_intr (sdla_t* card) /* Pass it up the protocol stack */ skb->protocol = htons(ETH_P_WAN_PPP); skb->dev = dev; - wan_skb_reset_mac_header(skb); + wan_skb_reset_mac_header(skb); wan_skb_queue_tail(&chan->rx_queue,skb); WAN_TASKLET_SCHEDULE((&chan->tasklet)); @@ -2097,7 +2102,7 @@ static int set_asy_config(sdla_t* card) if(card->wandev.clocking) cfg.baud_rate = card->wandev.bps; - cfg.line_config_options = (card->wandev.interface == WANOPT_RS232) ? + cfg.line_config_options = (card->wandev.electrical_interface == WANOPT_RS232) ? INTERFACE_LEVEL_RS232 : INTERFACE_LEVEL_V35; cfg.modem_config_options = 0; @@ -2173,7 +2178,7 @@ static int set_chdlc_config(sdla_t* card) if(card->wandev.clocking) cfg.baud_rate = card->wandev.bps; - cfg.line_config_options = (card->wandev.interface == WANOPT_RS232) ? + cfg.line_config_options = (card->wandev.electrical_interface == WANOPT_RS232) ? INTERFACE_LEVEL_RS232 : INTERFACE_LEVEL_V35; cfg.modem_config_options = 0; @@ -2886,7 +2891,7 @@ dflt_1: /* Decapsulate pkt and pass it up the protocol stack */ new_skb->protocol = htons(ETH_P_IP); new_skb->dev = dev; - wan_skb_reset_mac_header(new_skb); + wan_skb_reset_mac_header(new_skb); netif_rx(new_skb); } else { @@ -3208,9 +3213,6 @@ static int config_chdlc (sdla_t *card) (IS_T1_CARD(card))?"T1":"E1"); return -EINVAL; } - if (card->wandev.fe_iface.post_init){ - err=card->wandev.fe_iface.post_init(&card->fe); - } } if (IS_56K_CARD(card)) { @@ -3225,9 +3227,6 @@ static int config_chdlc (sdla_t *card) card->devname); return -EINVAL; } - if (card->wandev.fe_iface.post_init){ - err=card->wandev.fe_iface.post_init(&card->fe); - } } @@ -3259,7 +3258,7 @@ static int config_chdlc (sdla_t *card) port_set_state(card, WAN_DISCONNECTED); return 0; } - } else { + }else{ if (chdlc_comm_enable(card) != 0) { printk(KERN_INFO "%s: Failed to enable chdlc communications!\n", card->devname); @@ -3387,7 +3386,7 @@ static int chdlc_set_dev_config(struct file *file, if (wandev == NULL) return cnt; - card = (sdla_t*)wandev->private; + card = (sdla_t*)wandev->priv; printk(KERN_INFO "%s: New device config (%s)\n", wandev->name, buffer); @@ -3505,7 +3504,7 @@ static void wp_bh (unsigned long data) memset(rx_hdr,0,sizeof(api_rx_hdr_t)); }else{ if (WAN_NET_RATELIMIT()){ - DEBUG_EVENT("%s: Error Rx pkt headroom %d < %u\n", + DEBUG_EVENT("%s: Error Rx pkt headroom %d < %d\n", chan->if_name, wan_skb_headroom(skb), sizeof(api_rx_hdr_t)); @@ -3592,7 +3591,7 @@ static netdevice_t * un_bind_annexg(wan_device_t *wandev, netdevice_t *annexg_de struct wan_dev_le *devle; netdevice_t *dev; unsigned long smp_flags=0; - sdla_t *card = wandev->private; + sdla_t *card = wandev->priv; WAN_LIST_FOREACH(devle, &card->wandev.dev_head, dev_link){ private_area_t* chan; @@ -3713,7 +3712,7 @@ static int digital_loop_test(sdla_t* card,wan_udp_pkt_t* wan_udp_pkt) skb->next = skb->prev = NULL; skb->dev = dev; skb->protocol = htons(ETH_P_IP); - wan_skb_reset_mac_header(skb); + wan_skb_reset_mac_header(skb); dev_queue_xmit(skb); return 0; diff --git a/patches/kdrivers/src/net/wanpipe_syncppp.c b/patches/kdrivers/src/net/wanpipe_syncppp.c index 3cea80d..423cd9c 100644 --- a/patches/kdrivers/src/net/wanpipe_syncppp.c +++ b/patches/kdrivers/src/net/wanpipe_syncppp.c @@ -35,8 +35,8 @@ * Version 2.0, Fri Aug 30 09:59:07 EDT 2002 * Version 2.1, Wed Mar 26 10:03:00 EDT 2003 * - * $Id: wanpipe_syncppp.c,v 1.29 2007/02/28 02:01:05 sangoma Exp $ - * $Id: wanpipe_syncppp.c,v 1.29 2007/02/28 02:01:05 sangoma Exp $ + * $Id: wanpipe_syncppp.c,v 1.31 2008/01/02 15:26:22 sangoma Exp $ + * $Id: wanpipe_syncppp.c,v 1.31 2008/01/02 15:26:22 sangoma Exp $ */ /* @@ -1398,19 +1398,8 @@ sppp_phase_name(enum ppp_phase phase) * Handle transmit packets. */ - - - - -#ifdef LINUX_FEAT_2624 -static int sppp_hard_header(struct sk_buff *skb, - struct net_device *dev, __u16 type, - const void *daddr, const void *saddr, - unsigned int len) -#else static int sppp_hard_header(struct sk_buff *skb, struct net_device *dev, __u16 type, void *daddr, void *saddr, unsigned int len) -#endif { struct sppp *sp = (struct sppp *)sppp_of(dev); struct ppp_header *h; @@ -1453,13 +1442,10 @@ static int sppp_hard_header(struct sk_buff *skb, struct net_device *dev, __u16 t return sizeof(struct ppp_header); } -#ifdef LINUX_FEAT_2624 -static const struct header_ops sppp_header_ops = { - .create = sppp_hard_header, -}; -#endif - - +static int sppp_rebuild_header(struct sk_buff *skb) +{ + return 0; +} /* * Send keepalive packets, every 10 seconds. @@ -2302,12 +2288,9 @@ void wp_sppp_attach(struct ppp_device *pd) * Device specific setup. All but interrupt handler and * hard_start_xmit. */ -#ifdef LINUX_FEAT_2624 - dev->header_ops = &sppp_header_ops; -#else + dev->hard_header = sppp_hard_header; -#endif - + dev->rebuild_header = sppp_rebuild_header; dev->tx_queue_len = 100; dev->type = ARPHRD_HDLC; dev->addr_len = 0; @@ -2323,7 +2306,8 @@ void wp_sppp_attach(struct ppp_device *pd) dev->stop = wp_sppp_close; #endif dev->change_mtu = wp_sppp_change_mtu; - + dev->hard_header_cache = NULL; + dev->header_cache_update = NULL; dev->flags = IFF_MULTICAST|IFF_POINTOPOINT|IFF_NOARP; #if 0 @@ -3150,8 +3134,8 @@ static int __init sync_ppp_init(void) #if 0 dev_add_pack(&sppp_packet_type); #endif - wan_spin_lock_init(&spppq_lock); - wan_spin_lock_init(&authenticate_lock); + wan_spin_lock_init(&spppq_lock,"spppq_lock"); + wan_spin_lock_init(&authenticate_lock,"authenticate_lock"); sppp_keepalive_interval=10; sppp_max_keepalive_count=MAXALIVECNT; diff --git a/patches/kdrivers/src/net/wanpipe_tdm_api.c b/patches/kdrivers/src/net/wanpipe_tdm_api.c index 0949492..a7194a7 100644 --- a/patches/kdrivers/src/net/wanpipe_tdm_api.c +++ b/patches/kdrivers/src/net/wanpipe_tdm_api.c @@ -5,7 +5,7 @@ * * Authors: Nenad Corbic * -* Copyright: (c) 2003-2007 Sangoma Technologies Inc. +* Copyright: (c) 2003-2005 Sangoma Technologies Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,6 +16,7 @@ * Jul 27, 2006 David Rokhvarg Ported to Windows. *****************************************************************************/ + #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) # include # include @@ -24,14 +25,12 @@ # include #elif defined(__WINDOWS__) # include -# include -# include # include int aft_te1_insert_tdm_api_event_in_to_rx_queue( wanpipe_tdm_api_dev_t *tdm_api_dev, - wp_tdm_api_rx_hdr_t *tdm_api_rx_hdr + wp_tdm_api_event_t *pevent ); int @@ -40,8 +39,10 @@ queue_tdm_api_rx_dpc( ); #define DBG_TDMCODEC if(0)DbgPrint -#define DBG_TDM_RX if(0)DbgPrint -#define DBG_RBS if(0)DbgPrint +#define DBG_TDM_RX if(0)DbgPrint +#define DBG_RBS if(0)DbgPrint + +#define BUILD_TDMV_API #elif defined(__LINUX__) # include @@ -52,7 +53,6 @@ queue_tdm_api_rx_dpc( # include #endif -#include /*============================================================== Defines @@ -62,8 +62,8 @@ queue_tdm_api_rx_dpc( #define WP_TDMAPI_MINOR_OFFSET 0 #define WP_TDMAPI_MAX_MINORS 1024 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) || defined(__WINDOWS__) - +#if !defined(__WINDOWS__) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) #define WP_CLASS_DEV_CREATE(class, devt, device, name) \ @@ -84,6 +84,12 @@ static struct class_simple *wp_tdmapi_class = NULL; #endif #define UNIT(file) MINOR(file->f_dentry->d_inode->i_rdev) +#define BUILD_TDMV_API + +#endif/* #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */ +#endif/* #if !defined(__WINDOWS__) */ + +#if defined(BUILD_TDMV_API) #define WP_TDMAPI_SPAN_MASK 0xFFFF #define WP_TMDAPI_SPAN_SHIFT 5 //8 @@ -145,6 +151,7 @@ int wanpipe_tdm_api_ioctl(wanpipe_tdm_api_dev_t *tdm_api, struct ifreq *ifr); static unsigned int wp_tdmapi_poll(struct file *file, struct poll_table_struct *wait_table); static int wanpipe_tdm_api_ioctl(wanpipe_tdm_api_dev_t *tdm_api, struct ifreq *ifr); #endif +static int wanpipe_tdm_api_event_ioctl(wanpipe_tdm_api_dev_t*, wanpipe_tdm_api_cmd_t*); /*============================================================== Global Variables @@ -220,15 +227,12 @@ static void wp_wakeup_tdmapi(wanpipe_tdm_api_dev_t *tdm_api) wake_up_interruptible(&tdm_api->poll_wait); } } -#endif static struct cdev wptdm_cdev = { -#ifndef LINUX_FEAT_2624 .kobj = {.name = "wptdm", }, -#endif .owner = THIS_MODULE, }; - +#endif static int wp_tdmapi_reg_globals(void) { @@ -236,8 +240,8 @@ static int wp_tdmapi_reg_globals(void) rx_gains=NULL; tx_gains=NULL; - wan_spin_lock_init(&wp_tdmapi_hash_lock); - DEBUG_TEST("%s: Registering Wanpipe TDM Device!\n",__FUNCTION__); + wan_spin_lock_init(&wp_tdmapi_hash_lock, "wan_tdmapi_hash_lock"); + DEBUG_TDMAPI("%s: Registering Wanpipe TDM Device!\n",__FUNCTION__); #if !defined(__WINDOWS__) { #ifdef LINUX_2_4 @@ -334,7 +338,9 @@ int wanpipe_tdm_api_reg(wanpipe_tdm_api_dev_t *tdm_api) tdm_api->cfg.ec_tap =0; tdm_api->cfg.rbs_rx_bits =-1; tdm_api->cfg.hdlc =1; - tdm_api->tx_q_len = WP_TDM_MAX_HDLC_TX_Q_LEN; + + /* We are expecting tx_q_len for hdlc + * to be configured from upper layer */ } else { tdm_api->cfg.hw_mtu_mru =8; @@ -373,17 +379,27 @@ int wanpipe_tdm_api_reg(wanpipe_tdm_api_dev_t *tdm_api) } return err; } - wan_spin_lock_init(&tdm_api->lock); + wan_spin_lock_init(&tdm_api->lock, "wan_tdmapi_lock"); sprintf(tmp_name,"wptdm_s%dc%d",tdm_api->tdm_span,tdm_api->tdm_chan); + DEBUG_TDMAPI("%s: Configuring TDM API NAME=%s Qlen=%i\n", + card->devname,tmp_name, tdm_api->tx_q_len); + /* Initialize Event Callback functions */ card->wandev.event_callback.rbsbits = wp_tdmapi_rbsbits; card->wandev.event_callback.alarms = wp_tdmapi_alarms; - card->wandev.event_callback.dtmf = wp_tdmapi_dtmf; card->wandev.event_callback.hook = wp_tdmapi_hook; card->wandev.event_callback.ringdetect = wp_tdmapi_ringdetect; card->wandev.event_callback.ringtrip = wp_tdmapi_ringtrip; - + +#if defined(__WINDOWS__) + /* Analog always supports DTMF detection */ + tdm_api->dtmfsupport = WANOPT_YES; +#endif + + /* Always initialize the callback pointer */ + card->wandev.event_callback.dtmf = wp_tdmapi_dtmf; + if (tdm_api->cfg.rbs_tx_bits) { DEBUG_EVENT("%s: Setting Tx RBS/CAS Idle Bits = 0x%02X\n", tmp_name, @@ -461,16 +477,15 @@ int wanpipe_tdm_api_kick(wanpipe_tdm_api_dev_t *tdm_api) if (tdm_api == NULL || !wan_test_bit(0,&tdm_api->init)){ return -ENODEV; } - - if (is_tdm_api_stopped(tdm_api)){ + + if (is_tdm_api_stopped(tdm_api) || (unsigned)wan_skb_queue_len(&tdm_api->wp_tx_list) > tdm_api->tx_q_len){ wp_tdm_api_start(tdm_api); if (wan_test_bit(0,&tdm_api->used)) { - DEBUG_TEST("%s: KICK API\n",tdm_api->name); #if !defined(__WINDOWS__) wp_wakeup_tdmapi(tdm_api); #endif - } - } + } + } return 0; } @@ -530,7 +545,7 @@ static int wp_tdmapi_open(struct inode *inode, struct file *file) wan_spin_unlock_irq(&wp_tdmapi_hash_lock,&flags); - DEBUG_TEST ("%s: DRIVER OPEN S/C(%i/%i) API Ptr=%p\n", + DEBUG_TDMAPI ("%s: DRIVER OPEN S/C(%i/%i) API Ptr=%p\n", __FUNCTION__, tdm_span, tdm_chan, tdm_api); return 0; @@ -579,9 +594,9 @@ static ssize_t wp_tdmapi_read_msg(struct file *file, struct msghdr *msg, size_t if (count < wan_skb_len(skb) || wan_skb_len(skb) < sizeof(wp_tdm_api_rx_hdr_t)){ + DEBUG_TDMAPI("%s:%d TDMAPI READ: Error: Count=%i < Skb=%i < HDR=%i Critical Error\n", + __FUNCTION__,__LINE__,count,wan_skb_len(skb),sizeof(wp_tdm_api_rx_hdr_t)); wan_skb_free(skb); - DEBUG_EVENT("%s:%d TDMAPI READ: Critical Error\n", - __FUNCTION__,__LINE__); return -EFAULT; } @@ -752,15 +767,12 @@ static ssize_t wp_tdmapi_write_msg(struct file *file, struct msghdr *msg, size_t return -EINVAL; } #endif - if (count > (WP_TDM_API_MAX_LEN+sizeof(wp_tdm_api_tx_hdr_t))) { - DEBUG_TEST("%s: Error: TDM API Tx packet too big %d\n", - tdm_api->name,count); - return -EFBIG; - } - - skb_len=WP_TDM_API_MAX_LEN+sizeof(wp_tdm_api_tx_hdr_t); + skb_len=WP_TDM_API_MAX_LEN; } - + + DEBUG_TEST("%s: TX FRAME List=%i\n", + tdm_api->name, wan_skb_queue_len(&tdm_api->wp_tx_list)); + if (wan_skb_queue_len(&tdm_api->wp_tx_list) > tdm_api->tx_q_len){ wp_tdm_api_stop(tdm_api); return -EBUSY; @@ -1010,6 +1022,7 @@ static unsigned int wp_tdmapi_poll(struct file *file, struct poll_table_struct * !is_tdm_api_stopped(tdm_api)) { wp_tdmapi_tx(tdm_api); } + if (wan_skb_queue_len(&tdm_api->wp_tx_list) <= tdm_api->tx_q_len) { ret |= POLLOUT | POLLWRNORM; @@ -1038,11 +1051,11 @@ static unsigned int wp_tdmapi_poll(struct file *file, struct poll_table_struct * static void wanpipe_tdm_api_rbs_poll(wanpipe_tdm_api_dev_t *tdm_api) { - u8 rbs_bits; - netskb_t *skb; - wp_tdm_api_rx_hdr_t *rx_hdr = NULL; + u8 rbs_bits; + netskb_t *skb; + wp_tdm_api_event_t *pevent = NULL; #if defined(__WINDOWS__) - wp_tdm_api_rx_hdr_t tdm_api_hdr; + wp_tdm_api_event_t event; #endif if (!tdm_api->cfg.rbs_poll) { @@ -1063,36 +1076,32 @@ static void wanpipe_tdm_api_rbs_poll(wanpipe_tdm_api_dev_t *tdm_api) #endif tdm_api->read_rbs_bits( tdm_api->chan, -#if defined(__WINDOWS__) - tdm_api->tdm_chan + 1, -#else tdm_api->tdm_chan, -#endif &rbs_bits); if (tdm_api->cfg.rbs_rx_bits == rbs_bits) { return; } - DEBUG_TEST("%s: RBS BITS CHANGED O=0x%X N=0x%X\n", + DEBUG_TDMAPI("%s: RBS BITS CHANGED O=0x%X N=0x%X\n", tdm_api->name, tdm_api->cfg.rbs_rx_bits, rbs_bits); tdm_api->cfg.rbs_rx_bits = rbs_bits; #if defined(__WINDOWS__) - rx_hdr = &tdm_api_hdr; + pevent = &event; #else if (wan_skb_queue_len(&tdm_api->wp_event_list) > WP_TDM_MAX_EVENT_Q_LEN) { return; } - skb=wan_skb_alloc(sizeof(wp_tdm_api_rx_hdr_t)); + skb=wan_skb_alloc(sizeof(wp_tdm_api_event_t)); if (skb == NULL) return; - rx_hdr=(wp_tdm_api_rx_hdr_t*)wan_skb_put(skb,sizeof(wp_tdm_api_rx_hdr_t)); + pevent = (wp_tdm_api_event_t*)wan_skb_put(skb,sizeof(wp_tdm_api_event_t)); #endif/* #if !defined(__WINDOWS__) */ - memset(rx_hdr,0,sizeof(wp_tdm_api_rx_hdr_t)); - rx_hdr->wp_tdm_api_event_rbs_rx_bits = (u8)tdm_api->cfg.rbs_rx_bits; - rx_hdr->wp_tdm_api_event_type = WP_TDM_EVENT_RBS; + memset(pevent,0,sizeof(wp_tdm_api_event_t)); + pevent->wp_tdm_api_event_type = WP_TDMAPI_EVENT_RBS; + pevent->wp_tdm_api_event_rbs_bits = (u8)tdm_api->cfg.rbs_rx_bits; #if 0 /* FIXME: NENAD TO ADD Timestamp */ @@ -1100,8 +1109,8 @@ static void wanpipe_tdm_api_rbs_poll(wanpipe_tdm_api_dev_t *tdm_api) #endif #if defined(__WINDOWS__) - rx_hdr->wp_tdm_api_event_channel = (u_int16_t)tdm_api->tdm_chan + 1; - aft_te1_insert_tdm_api_event_in_to_rx_queue(tdm_api, rx_hdr); + pevent->channel = (u_int16_t)tdm_api->tdm_chan; + aft_te1_insert_tdm_api_event_in_to_rx_queue(tdm_api, pevent); queue_tdm_api_rx_dpc(tdm_api); #else wan_skb_queue_tail(&tdm_api->wp_event_list,skb); @@ -1111,42 +1120,40 @@ static void wanpipe_tdm_api_rbs_poll(wanpipe_tdm_api_dev_t *tdm_api) static void wanpipe_tdm_api_fe_alarm_event(wanpipe_tdm_api_dev_t *tdm_api, int state) { netskb_t *skb; - wp_tdm_api_rx_hdr_t *rx_hdr = NULL; + wp_tdm_api_event_t *pevent = NULL; #if defined(__WINDOWS__) - wp_tdm_api_rx_hdr_t tdm_api_hdr; + wp_tdm_api_event_t event; #endif - DEBUG_TEST("%s: TDM API State Event State=%i\n", + DEBUG_TDMAPI("%s: TDM API State Event State=%i\n", tdm_api->name, tdm_api->state); #if defined(__WINDOWS__) - rx_hdr = &tdm_api_hdr; + pevent = &event; #else if (wan_skb_queue_len(&tdm_api->wp_event_list) > WP_TDM_MAX_EVENT_Q_LEN) { return; } - skb=wan_skb_alloc(sizeof(wp_tdm_api_rx_hdr_t)); + skb=wan_skb_alloc(sizeof(wp_tdm_api_event_t)); if (skb == NULL) { return; } - rx_hdr=(wp_tdm_api_rx_hdr_t*)wan_skb_put(skb,sizeof(wp_tdm_api_rx_hdr_t)); + pevent = (wp_tdm_api_event_t*)wan_skb_put(skb,sizeof(wp_tdm_api_event_t)); #endif/* #if !defined(__WINDOWS__) */ - memset(rx_hdr,0,sizeof(wp_tdm_api_rx_hdr_t)); - if (state == WAN_CONNECTED) { - rx_hdr->wp_tdm_api_event_fe_alarm = 0; - } else { - rx_hdr->wp_tdm_api_event_fe_alarm = 1; - } - rx_hdr->wp_tdm_api_event_type = WP_TDM_EVENT_FE_ALARM; + memset(pevent,0,sizeof(wp_tdm_api_event_t)); + pevent->wp_tdm_api_event_type = WP_TDMAPI_EVENT_ALARM; + pevent->wp_tdm_api_event_alarm = (state == WAN_CONNECTED) ? 0 : 1; #if 0 /* FIXME: NENAD TO ADD Timestamp */ rx_hdr->event_time_stamp = gettimeofday(); #endif - rx_hdr->wp_tdm_api_event_channel = (u_int16_t)tdm_api->tdm_chan + 1; + + pevent->channel = (u_int16_t)tdm_api->tdm_chan; + #if defined(__WINDOWS__) - aft_te1_insert_tdm_api_event_in_to_rx_queue(tdm_api, rx_hdr); + aft_te1_insert_tdm_api_event_in_to_rx_queue(tdm_api, pevent); queue_tdm_api_rx_dpc(tdm_api); #else wan_skb_queue_tail(&tdm_api->wp_event_list,skb); @@ -1163,8 +1170,7 @@ int wanpipe_tdm_api_ioctl(wanpipe_tdm_api_dev_t *tdm_api, struct ifreq *ifr) u32 cmd; wanpipe_codec_ops_t *wp_codec_ops; netskb_t *skb; - wan_event_ctrl_t event_ctrl; - sdla_t *card = (sdla_t*)tdm_api->card; + sdla_t *card = (sdla_t*)tdm_api->card; utdmapi = (wanpipe_tdm_api_cmd_t*)ifr->ifr_data; @@ -1197,7 +1203,12 @@ int wanpipe_tdm_api_ioctl(wanpipe_tdm_api_dev_t *tdm_api, struct ifreq *ifr) case SIOC_WP_TDM_GET_USR_MTU_MRU: case SIOC_WP_TDM_GET_STATS: case SIOC_WP_TDM_GET_FULL_CFG: - case SIOC_WP_TDM_READ_EVENT: +#if !defined(__WINDOWS__) + case SIOC_WP_TDM_GET_FE_STATUS: + case SIOC_WP_TDM_SET_FE_STATUS: +#endif + case SIOC_WP_TDM_READ_EVENT: + case SIOC_WP_TDM_GET_FE_ALARMS: break; default: DEBUG_EVENT("%s: Invalid TDM API HDLC CMD %i\n", tdm_api->name,cmd); @@ -1308,24 +1319,6 @@ int wanpipe_tdm_api_ioctl(wanpipe_tdm_api_dev_t *tdm_api, struct ifreq *ifr) } break; - case SIOC_WP_TDM_ENABLE_HWEC: - if (card->wandev.ec_enable) { - wan_smp_flag_t smp_flags1; - card->hw_iface.hw_lock(card->hw,&smp_flags1); - card->wandev.ec_enable(card, 1, tdm_api->tdm_chan-1); - card->hw_iface.hw_unlock(card->hw,&smp_flags1); - } - break; - - case SIOC_WP_TDM_DISABLE_HWEC: - if (card->wandev.ec_enable) { - wan_smp_flag_t smp_flags1; - card->hw_iface.hw_lock(card->hw,&smp_flags1); - card->wandev.ec_enable(card, 0, tdm_api->tdm_chan-1); - card->hw_iface.hw_unlock(card->hw,&smp_flags1); - } - break; - case SIOC_WP_TDM_SET_EC_TAP: switch (usr_tdm_api.ec_tap){ @@ -1347,6 +1340,25 @@ int wanpipe_tdm_api_ioctl(wanpipe_tdm_api_dev_t *tdm_api, struct ifreq *ifr) case SIOC_WP_TDM_GET_EC_TAP: usr_tdm_api.ec_tap = tdm_api->cfg.ec_tap; break; + + + case SIOC_WP_TDM_ENABLE_HWEC: + if (card->wandev.ec_enable) { + wan_smp_flag_t smp_flags1; + card->hw_iface.hw_lock(card->hw,&smp_flags1); + card->wandev.ec_enable(card, 1, tdm_api->tdm_chan); + card->hw_iface.hw_unlock(card->hw,&smp_flags1); + } + break; + + case SIOC_WP_TDM_DISABLE_HWEC: + if (card->wandev.ec_enable) { + wan_smp_flag_t smp_flags1; + card->hw_iface.hw_lock(card->hw,&smp_flags1); + card->wandev.ec_enable(card, 0, tdm_api->tdm_chan); + card->hw_iface.hw_unlock(card->hw,&smp_flags1); + } + break; case SIOC_WP_TDM_GET_STATS: memcpy(&usr_tdm_api.stats,&tdm_api->cfg.stats,sizeof(tdm_api->cfg.stats)); @@ -1357,6 +1369,7 @@ int wanpipe_tdm_api_ioctl(wanpipe_tdm_api_dev_t *tdm_api, struct ifreq *ifr) break; case SIOC_WP_TDM_ENABLE_RBS_EVENTS: + /* 'usr_tdm_api.rbs_poll' is the user provided 'number of polls per second' */ if (usr_tdm_api.rbs_poll < 20 || usr_tdm_api.rbs_poll > 100) { DEBUG_EVENT("%s: Error: Invalid RBS Poll Count Min=20 Max=100\n", tdm_api->name); @@ -1365,271 +1378,62 @@ int wanpipe_tdm_api_ioctl(wanpipe_tdm_api_dev_t *tdm_api, struct ifreq *ifr) usr_tdm_api.rbs_poll=HZ/usr_tdm_api.rbs_poll; tdm_api->cfg.rbs_poll = usr_tdm_api.rbs_poll; + if (card->wandev.fe_iface.set_fe_sigctrl){ + card->wandev.fe_iface.set_fe_sigctrl( + &card->fe, + WAN_TE_SIG_POLL, + ENABLE_ALL_CHANNELS, + WAN_ENABLE); + } break; case SIOC_WP_TDM_DISABLE_RBS_EVENTS: tdm_api->cfg.rbs_poll=0; + if (card->wandev.fe_iface.set_fe_sigctrl){ + card->wandev.fe_iface.set_fe_sigctrl( + &card->fe, + WAN_TE_SIG_POLL, + ENABLE_ALL_CHANNELS, + WAN_DISABLE); + } break; - case SIOC_WP_TDM_ENABLE_DTMF_EVENTS: - // Octasic DTMF event - DEBUG_TDMAPI("%s: Enable HW EC DTMF event %X!\n", - tdm_api->name, tdm_api->active_ch); - memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); - event_ctrl.type = WAN_EVENT_EC_DTMF; - event_ctrl.mode = WAN_EVENT_ENABLE; - event_ctrl.ts_map = tdm_api->active_ch; - if (tdm_api->event_ctrl){ - err = tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); - } - break; - - case SIOC_WP_TDM_DISABLE_DTMF_EVENTS: - // Octasic DTMF event - DEBUG_TDMAPI("%s: Disable HW EC DTMF event!\n", - tdm_api->name); - memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); - event_ctrl.type = WAN_EVENT_EC_DTMF; - event_ctrl.mode = WAN_EVENT_DISABLE; - event_ctrl.ts_map = tdm_api->active_ch; - if (tdm_api->event_ctrl){ - err = tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); - } - break; - - case SIOC_WP_TDM_ENABLE_RM_DTMF_EVENTS: - // A200-Remora DTMF event - DEBUG_TDMAPI("%s: Enable A200-Remora DTMF event!\n", - tdm_api->name); - memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); - event_ctrl.type = WAN_EVENT_RM_DTMF; - event_ctrl.mode = WAN_EVENT_ENABLE; - event_ctrl.mod_no = tdm_api->tdm_chan-1; - if (tdm_api->event_ctrl){ - err = tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); - } - break; - case SIOC_WP_TDM_DISABLE_RM_DTMF_EVENTS: - // A200-Remora DTMF event - DEBUG_TDMAPI("%s: Disable A200-Remora DTMF event!\n", - tdm_api->name); - memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); - event_ctrl.type = WAN_EVENT_RM_DTMF; - event_ctrl.mode = WAN_EVENT_DISABLE; - event_ctrl.mod_no = tdm_api->tdm_chan-1; - if (tdm_api->event_ctrl){ - err = tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); - } - break; - - - case SIOC_WP_TDM_ENABLE_RXHOOK_EVENTS: - DEBUG_TDMAPI("%s: Enable A200-Remora Loop Closure event!\n", - tdm_api->name); - memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); - event_ctrl.type = WAN_EVENT_RM_LC; - event_ctrl.mode = WAN_EVENT_ENABLE; - event_ctrl.mod_no = tdm_api->tdm_chan-1; - if (tdm_api->event_ctrl){ - err = tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); - } else { - DEBUG_EVENT("%s: Error: event_ctrl not supported!\n", - tdm_api->name); - err = -EINVAL; - } - break; - - case SIOC_WP_TDM_DISABLE_RXHOOK_EVENTS: - DEBUG_TDMAPI("%s: Disable A200-Remora Loop Closure event!\n", - tdm_api->name); - memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); - event_ctrl.type = WAN_EVENT_RM_LC; - event_ctrl.mode = WAN_EVENT_DISABLE; - event_ctrl.mod_no = tdm_api->tdm_chan-1; - if (tdm_api->event_ctrl){ - err = tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); - } else { - DEBUG_EVENT("%s: Error: event_ctrl not supported!\n", - tdm_api->name); - err = -EINVAL; - } - break; - - case SIOC_WP_TDM_ENABLE_RING_DETECT_EVENTS: - DEBUG_TDMAPI("%s: Enable Ring Detection Event on module %d!\n", - tdm_api->name, - tdm_api->tdm_chan); - memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); - event_ctrl.type = WAN_EVENT_RM_RING_DETECT; - event_ctrl.mode = WAN_EVENT_ENABLE; - event_ctrl.mod_no = tdm_api->tdm_chan-1; - if (tdm_api->event_ctrl){ - err = tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); - } else { - DEBUG_EVENT("%s: Error: event_ctrl not supported!\n", - tdm_api->name); - err = -EINVAL; - } - break; - case SIOC_WP_TDM_DISABLE_RING_DETECT_EVENTS: - DEBUG_TDMAPI("%s: Disable Ring Detection Event on module %d!\n", - tdm_api->name, - tdm_api->tdm_chan); - memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); - event_ctrl.type = WAN_EVENT_RM_RING_DETECT; - event_ctrl.mode = WAN_EVENT_DISABLE; - event_ctrl.mod_no = tdm_api->tdm_chan-1; - if (tdm_api->event_ctrl){ - err = tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); - } else { - DEBUG_EVENT("%s: Error: event_ctrl not supported!\n", - tdm_api->name); - err = -EINVAL; - } - break; - - case SIOC_WP_TDM_ENABLE_RING_TRIP_DETECT_EVENTS: - DEBUG_TDMAPI("%s: Enable Ring Trip Detection Event on module %d!\n", - tdm_api->name, - tdm_api->tdm_chan); - memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); - event_ctrl.type = WAN_EVENT_RM_RING_TRIP; - event_ctrl.mode = WAN_EVENT_ENABLE; - event_ctrl.mod_no = tdm_api->tdm_chan-1; - if (tdm_api->event_ctrl){ - err = tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); - } else { - DEBUG_EVENT("%s: Error: event_ctrl not supported!\n", - tdm_api->name); - err = -EINVAL; - } - break; - case SIOC_WP_TDM_DISABLE_RING_TRIP_DETECT_EVENTS: - DEBUG_TDMAPI("%s: Disable Ring Trip Detection Event on module %d!\n", - tdm_api->name, - tdm_api->tdm_chan); - memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); - event_ctrl.type = WAN_EVENT_RM_RING_TRIP; - event_ctrl.mode = WAN_EVENT_DISABLE; - event_ctrl.mod_no = tdm_api->tdm_chan-1; - if (tdm_api->event_ctrl){ - err = tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); - } else { - DEBUG_EVENT("%s: Error: event_ctrl not supported!\n", - tdm_api->name); - err = -EINVAL; - } - break; - - case SIOC_WP_TDM_TXSIG_KEWL: - DEBUG_TDMAPI("%s: TX Signalling KEWL on module %d!\n", - tdm_api->name, - tdm_api->tdm_chan); - memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); - event_ctrl.type = WAN_EVENT_RM_TXSIG_KEWL; - event_ctrl.mod_no = tdm_api->tdm_chan-1; - if (tdm_api->event_ctrl){ - err = tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); - } else { - DEBUG_EVENT("%s: Error: event_ctrl not supported!\n", - tdm_api->name); - err = -EINVAL; - } - break; - - case SIOC_WP_TDM_EVENT_TXSIG_START: - DEBUG_TDMAPI("%s: TX Signalling START for module %d!\n", - tdm_api->name, - tdm_api->tdm_chan); - memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); - event_ctrl.type = WAN_EVENT_RM_TXSIG_START; - event_ctrl.mod_no = tdm_api->tdm_chan-1; - if (tdm_api->event_ctrl){ - err = tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); - } else { - DEBUG_EVENT("%s: Error: event_ctrl not supported!\n", - tdm_api->name); - err = -EINVAL; - } - break; - case SIOC_WP_TDM_EVENT_TXSIG_OFFHOOK: - DEBUG_TDMAPI("%s: TX Signalling OFFHOOK for module %d!\n", - tdm_api->name, - tdm_api->tdm_chan); - memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); - event_ctrl.type = WAN_EVENT_RM_TXSIG_OFFHOOK; - event_ctrl.mod_no = tdm_api->tdm_chan-1; - if (tdm_api->event_ctrl){ - err = tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); - } else { - DEBUG_EVENT("%s: Error: event_ctrl not supported!\n", - tdm_api->name); - err = -EINVAL; - } - break; - case SIOC_WP_TDM_EVENT_TXSIG_ONHOOK: - DEBUG_TDMAPI("%s: TX Signalling ONHOOK for module %d!\n", - tdm_api->name, - tdm_api->tdm_chan); - memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); - event_ctrl.type = WAN_EVENT_RM_TXSIG_ONHOOK; - event_ctrl.mod_no = tdm_api->tdm_chan-1; - if (tdm_api->event_ctrl){ - err = tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); - } else { - DEBUG_EVENT("%s: Error: event_ctrl not supported!\n", - tdm_api->name); - err = -EINVAL; - } - break; - case SIOC_WP_TDM_EVENT_ONHOOKTRANSFER: - DEBUG_TDMAPI("%s: RM ONHOOKTRANSFER for module %d!\n", - tdm_api->name, - tdm_api->tdm_chan); - memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); - event_ctrl.type = WAN_EVENT_RM_ONHOOKTRANSFER; - event_ctrl.mod_no = tdm_api->tdm_chan-1; - event_ctrl.ohttimer = usr_tdm_api.event.wp_tdm_api_event_ohttimer; - if (tdm_api->event_ctrl){ - err = tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); - } else { - DEBUG_EVENT("%s: Error: event_ctrl not supported!\n", - tdm_api->name); - err = -EINVAL; - } - break; - case SIOC_WP_TDM_EVENT_SETPOLARITY: - DEBUG_EVENT("%s: RM SETPOLARITY for module %d!\n", - tdm_api->name, - tdm_api->tdm_chan); - event_ctrl.type = WAN_EVENT_RM_SETPOLARITY; - event_ctrl.mod_no = tdm_api->tdm_chan-1; - event_ctrl.polarity = usr_tdm_api.event.wp_tdm_api_event_polarity; - if (tdm_api->event_ctrl){ - err = tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); - } else { - DEBUG_EVENT("%s: Error: event_ctrl not supported!\n", - tdm_api->name); - err = -EINVAL; - } - break; - case SIOC_WP_TDM_WRITE_RBS_BITS: wan_spin_unlock(&tdm_api->lock); err=tdm_api->write_rbs_bits( tdm_api->chan, -#if defined(__WINDOWS__) - tdm_api->tdm_chan + 1, -#else tdm_api->tdm_chan, -#endif (u8)usr_tdm_api.rbs_tx_bits); if (err) { DEBUG_EVENT("%s: WRITE RBS Error (%i)\n",tdm_api->name,err); } goto tdm_api_unlocked_exit; break; +#if !defined(__WINDOWS__) + case SIOC_WP_TDM_GET_FE_STATUS: + if (card->wandev.fe_iface.get_fe_status){ + wan_smp_flag_t smp_flags1; + card->hw_iface.hw_lock(card->hw,&smp_flags1); + card->wandev.fe_iface.get_fe_status( + &card->fe, &usr_tdm_api.fe_status); + card->hw_iface.hw_unlock(card->hw,&smp_flags1); + } + break; + + case SIOC_WP_TDM_SET_FE_STATUS: + if (card->wandev.fe_iface.set_fe_status){ + wan_smp_flag_t smp_flags1; + card->hw_iface.hw_lock(card->hw,&smp_flags1); + card->wandev.fe_iface.set_fe_status( + &card->fe, usr_tdm_api.fe_status); + card->hw_iface.hw_unlock(card->hw,&smp_flags1); + } + break; +#endif + case SIOC_WP_TDM_SET_EVENT: + err = wanpipe_tdm_api_event_ioctl(tdm_api, &usr_tdm_api); + break; case SIOC_WP_TDM_READ_EVENT: skb=wan_skb_dequeue(&tdm_api->wp_event_list); @@ -1637,7 +1441,7 @@ int wanpipe_tdm_api_ioctl(wanpipe_tdm_api_dev_t *tdm_api, struct ifreq *ifr) err=-ENOBUFS; break; } - memcpy(&usr_tdm_api.event,wan_skb_data(skb),sizeof(wp_tdm_api_rx_hdr_t)); + memcpy(&usr_tdm_api.event,wan_skb_data(skb),sizeof(wp_tdm_api_event_t)); wan_skb_free(skb); break; @@ -1650,7 +1454,6 @@ int wanpipe_tdm_api_ioctl(wanpipe_tdm_api_dev_t *tdm_api, struct ifreq *ifr) if (usr_tdm_api.data_len && utdmapi->data) { if (usr_tdm_api.data_len != 256) { err=-EINVAL; - break; } @@ -1665,7 +1468,8 @@ int wanpipe_tdm_api_ioctl(wanpipe_tdm_api_dev_t *tdm_api, struct ifreq *ifr) } #if defined(__WINDOWS__) - memcpy(&usr_tdm_api, ifr, sizeof(wanpipe_tdm_api_cmd_t)); + /*FIXME: test the memcpy() here + memcpy(rx_gains, utdmapi->data, usr_tdm_api.data_len);*/ #else if (WAN_COPY_FROM_USER(rx_gains, utdmapi->data, @@ -1707,9 +1511,8 @@ int wanpipe_tdm_api_ioctl(wanpipe_tdm_api_dev_t *tdm_api, struct ifreq *ifr) } #if defined(__WINDOWS__) -//FIXME: implement -//#error "FIX API CMD" -// memcpy(&_api, ifr, sizeof(wanpipe_tdm_api_cmd_t)); + /*FIXME: test the memcpy() here + memcpy(tx_gains, utdmapi->data, usr_tdm_api.data_len);*/ #else if (WAN_COPY_FROM_USER(tx_gains, utdmapi->data, @@ -1759,7 +1562,202 @@ tdm_api_unlocked_exit: return err; } +static int +wanpipe_tdm_api_event_ioctl(wanpipe_tdm_api_dev_t *tdm_api, wanpipe_tdm_api_cmd_t *tdm_cmd) +{ + wp_tdm_api_event_t *tdm_event; + wan_event_ctrl_t event_ctrl; + if (tdm_api->event_ctrl == NULL){ + DEBUG_EVENT("%s: Error: Event control interface doesn't initialized!\n", + tdm_api->name); + return -EINVAL; + } + + tdm_event = &tdm_cmd->event; + memset(&event_ctrl, 0, sizeof(wan_event_ctrl_t)); + + switch(tdm_event->wp_tdm_api_event_type){ + case WP_TDMAPI_EVENT_DTMF: + // Octasic DTMF event + DEBUG_TDMAPI("%s: %s HW EC DTMF event %X!\n", + tdm_api->name, + WP_TDMAPI_EVENT_MODE_DECODE(tdm_event->wp_tdm_api_event_mode), + tdm_api->active_ch); + event_ctrl.type = WAN_EVENT_EC_DTMF; + if (tdm_event->wp_tdm_api_event_mode == WP_TDMAPI_EVENT_ENABLE){ + event_ctrl.mode = WAN_EVENT_ENABLE; + }else{ + event_ctrl.mode = WAN_EVENT_DISABLE; + } +#if defined(__WINDOWS__) + if(tdm_event->channel < 1 || tdm_event->channel > NUM_OF_E1_CHANNELS - 1/* 31 */){ + DEBUG_TDMAPI("%s(): %s: Warning: DTMF control requested on invalid channel %u!\n", + __FUNCTION__, tdm_api->name, tdm_event->channel); + tdm_event->channel = 1;/* */ + } + event_ctrl.channel = tdm_event->channel; +#else + event_ctrl.channel = tdm_api->tdm_chan; +#endif + break; + + case WP_TDMAPI_EVENT_RM_DTMF: + // A200-Remora DTMF event + DEBUG_TDMAPI("%s: %s A200-Remora DTMF event!\n", + tdm_api->name, + WP_TDMAPI_EVENT_MODE_DECODE(tdm_event->wp_tdm_api_event_mode)); + event_ctrl.type = WAN_EVENT_RM_DTMF; + if (tdm_event->wp_tdm_api_event_mode == WP_TDMAPI_EVENT_ENABLE){ + event_ctrl.mode = WAN_EVENT_ENABLE; + }else{ + event_ctrl.mode = WAN_EVENT_DISABLE; + } + event_ctrl.mod_no = tdm_api->tdm_chan; + break; + + case WP_TDMAPI_EVENT_RXHOOK: + DEBUG_TDMAPI("%s: %s A200-Remora Loop Closure event!\n", + tdm_api->name, + WP_TDMAPI_EVENT_MODE_DECODE(tdm_event->wp_tdm_api_event_mode)); + event_ctrl.type = WAN_EVENT_RM_LC; + if (tdm_event->wp_tdm_api_event_mode == WP_TDMAPI_EVENT_ENABLE){ + event_ctrl.mode = WAN_EVENT_ENABLE; + }else{ + event_ctrl.mode = WAN_EVENT_DISABLE; + } + event_ctrl.mod_no = tdm_api->tdm_chan; + break; + + case WP_TDMAPI_EVENT_RING: + DEBUG_TDMAPI("%s: %s Ring Event on module %d!\n", + tdm_api->name, + WP_TDMAPI_EVENT_MODE_DECODE(tdm_event->wp_tdm_api_event_mode), + tdm_api->tdm_chan); + event_ctrl.type = WAN_EVENT_RM_RING; + if (tdm_event->wp_tdm_api_event_mode == WP_TDMAPI_EVENT_ENABLE){ + event_ctrl.mode = WAN_EVENT_ENABLE; + }else{ + event_ctrl.mode = WAN_EVENT_DISABLE; + } + event_ctrl.mod_no = tdm_api->tdm_chan; + break; + + case WP_TDMAPI_EVENT_RING_DETECT: + DEBUG_TDMAPI("%s: %s Ring Detection Event on module %d!\n", + tdm_api->name, + WP_TDMAPI_EVENT_MODE_DECODE(tdm_event->wp_tdm_api_event_mode), + tdm_api->tdm_chan); + event_ctrl.type = WAN_EVENT_RM_RING_DETECT; + if (tdm_event->wp_tdm_api_event_mode == WP_TDMAPI_EVENT_ENABLE){ + event_ctrl.mode = WAN_EVENT_ENABLE; + }else{ + event_ctrl.mode = WAN_EVENT_DISABLE; + } + event_ctrl.mod_no = tdm_api->tdm_chan; + break; + + case WP_TDMAPI_EVENT_RING_TRIP_DETECT: + DEBUG_TDMAPI("%s: %s Ring Trip Detection Event on module %d!\n", + tdm_api->name, + WP_TDMAPI_EVENT_MODE_DECODE(tdm_event->wp_tdm_api_event_mode), + tdm_api->tdm_chan); + event_ctrl.type = WAN_EVENT_RM_RING_TRIP; + if (tdm_event->wp_tdm_api_event_mode == WP_TDMAPI_EVENT_ENABLE){ + event_ctrl.mode = WAN_EVENT_ENABLE; + }else{ + event_ctrl.mode = WAN_EVENT_DISABLE; + } + event_ctrl.mod_no = tdm_api->tdm_chan; + break; + + case WP_TDMAPI_EVENT_TONE: + + DEBUG_TDMAPI("%s: %s Tone Event (%d)on module %d!\n", + tdm_api->name, + WP_TDMAPI_EVENT_MODE_DECODE(tdm_event->wp_tdm_api_event_mode), + tdm_event->wp_tdm_api_event_tone_type, + tdm_api->tdm_chan); + event_ctrl.type = WAN_EVENT_RM_TONE; + if (tdm_event->wp_tdm_api_event_mode == WP_TDMAPI_EVENT_ENABLE){ + event_ctrl.mode = WAN_EVENT_ENABLE; + switch(tdm_event->wp_tdm_api_event_tone_type){ + case WP_TDMAPI_EVENT_TONE_DIAL: + event_ctrl.tone = WAN_EVENT_TONE_DIAL; + break; + case WP_TDMAPI_EVENT_TONE_BUSY: + event_ctrl.tone = WAN_EVENT_TONE_BUSY; + break; + case WP_TDMAPI_EVENT_TONE_RING: + event_ctrl.tone = WAN_EVENT_TONE_RING; + break; + case WP_TDMAPI_EVENT_TONE_CONGESTION: + event_ctrl.tone = WAN_EVENT_TONE_CONGESTION; + break; + default: + DEBUG_EVENT("%s: Unsupported TDM API Tone Type %d!\n", + tdm_api->name, + tdm_event->wp_tdm_api_event_tone_type); + return -EINVAL; + } + }else{ + event_ctrl.mode = WAN_EVENT_DISABLE; + } + event_ctrl.mod_no = tdm_api->tdm_chan; + break; + + case WP_TDMAPI_EVENT_TXSIG_KEWL: + DEBUG_TDMAPI("%s: TX Signalling KEWL on module %d!\n", + tdm_api->name, tdm_api->tdm_chan); + event_ctrl.type = WAN_EVENT_RM_TXSIG_KEWL; + event_ctrl.mod_no = tdm_api->tdm_chan; + break; + + case WP_TDMAPI_EVENT_TXSIG_START: + DEBUG_TDMAPI("%s: TX Signalling START for module %d!\n", + tdm_api->name, tdm_api->tdm_chan); + event_ctrl.type = WAN_EVENT_RM_TXSIG_START; + event_ctrl.mod_no = tdm_api->tdm_chan; + break; + + case WP_TDMAPI_EVENT_TXSIG_OFFHOOK: + DEBUG_TDMAPI("%s: TX Signalling OFFHOOK for module %d!\n", + tdm_api->name, tdm_api->tdm_chan); + event_ctrl.type = WAN_EVENT_RM_TXSIG_OFFHOOK; + event_ctrl.mod_no = tdm_api->tdm_chan; + break; + + case WP_TDMAPI_EVENT_TXSIG_ONHOOK: + DEBUG_TDMAPI("%s: TX Signalling ONHOOK for module %d!\n", + tdm_api->name, tdm_api->tdm_chan); + event_ctrl.type = WAN_EVENT_RM_TXSIG_ONHOOK; + event_ctrl.mod_no = tdm_api->tdm_chan; + break; + + case WP_TDMAPI_EVENT_ONHOOKTRANSFER: + DEBUG_TDMAPI("%s: RM ONHOOKTRANSFER for module %d!\n", + tdm_api->name, tdm_api->tdm_chan); + event_ctrl.type = WAN_EVENT_RM_ONHOOKTRANSFER; + event_ctrl.mod_no = tdm_api->tdm_chan; + event_ctrl.ohttimer = tdm_event->wp_tdm_api_event_ohttimer; + break; + + case WP_TDMAPI_EVENT_SETPOLARITY: + DEBUG_EVENT("%s: RM SETPOLARITY for module %d!\n", + tdm_api->name, tdm_api->tdm_chan); + event_ctrl.type = WAN_EVENT_RM_SETPOLARITY; + event_ctrl.mod_no = tdm_api->tdm_chan; + event_ctrl.polarity = tdm_event->wp_tdm_api_event_polarity; + break; + default: + DEBUG_EVENT("%s: Unknown TDM API Event Type %02X!\n", + tdm_api->name, + tdm_event->type); + return -EINVAL; + } + + return tdm_api->event_ctrl(tdm_api->chan, &event_ctrl); +} static int wanpipe_tdm_api_tx (wanpipe_tdm_api_dev_t *tdm_api, u8 *tx_data, int len) { @@ -1947,6 +1945,8 @@ int wanpipe_tdm_api_rx_hdlc (wanpipe_tdm_api_dev_t *tdm_api, netskb_t *skb) return -EBUSY; } + DEBUG_TDMAPI("%s: TDM API RX HDLC FRAME %i\n",tdm_api->name, wan_skb_len(skb)); + wan_skb_queue_tail(&tdm_api->wp_rx_list,skb); wp_wakeup_tdmapi(tdm_api); tdm_api->cfg.stats.rx_packets++; @@ -1960,7 +1960,10 @@ static wanpipe_tdm_api_dev_t *wp_tdmapi_search(sdla_t *card, int fe_chan) int i = 0; #if defined(__WINDOWS__) - if(fe_chan >= MAX_TDM_API_CHANNELS){ + + DEBUG_TDMAPI("%s(): fe_chan: %d\n", __FUNCTION__, fe_chan); + + if(fe_chan < 0 || fe_chan >= MAX_TDM_API_CHANNELS){ DEBUG_EVENT("%s(): TDM API Error: Invalid Channel Number=%i!\n", __FUNCTION__, fe_chan); return NULL; @@ -2007,62 +2010,57 @@ static void wp_tdmapi_alarms(void* card_id, unsigned long alarams) static void wp_tdmapi_dtmf (void* card_id, wan_event_t *event) { - netskb_t *skb = NULL; + netskb_t *skb = NULL; wanpipe_tdm_api_dev_t *tdm_api = NULL; - sdla_t *card = (sdla_t*)card_id; - wp_tdm_api_rx_hdr_t *rx_hdr = NULL; + sdla_t *card = (sdla_t*)card_id; + wp_tdm_api_event_t *p_tdmapi_event = NULL; #if defined(__WINDOWS__) - wp_tdm_api_rx_hdr_t tdm_api_hdr; + wp_tdm_api_event_t tdmapi_event; #endif if (event->type == WAN_EVENT_EC_DTMF){ - DEBUG_TEST("%s: Received DTMF Event at TDM API (%d:%c:%s:%s)!\n", + DEBUG_TDMAPI("%s: Received DTMF Event at TDM API (%d:%c:%s:%s)!\n", card->devname, event->channel, event->digit, (event->dtmf_port == WAN_EC_CHANNEL_PORT_ROUT)?"ROUT":"SOUT", (event->dtmf_type == WAN_EC_TONE_PRESENT)?"PRESENT":"STOP"); }else if (event->type == WAN_EVENT_RM_DTMF){ - DEBUG_TEST("%s: Received DTMF Event at TDM API (%d:%c)!\n", + DEBUG_TDMAPI("%s: Received DTMF Event at TDM API (%d:%c)!\n", card->devname, event->channel, event->digit); } - tdm_api = wp_tdmapi_search(card, -#if defined(__WINDOWS__) - event->channel - 1); -#else - event->channel); -#endif + tdm_api = wp_tdmapi_search(card, event->channel); if (tdm_api == NULL){ return; } #if defined(__WINDOWS__) - rx_hdr = &tdm_api_hdr; + p_tdmapi_event = &tdmapi_event; #else if (wan_skb_queue_len(&tdm_api->wp_event_list) > WP_TDM_MAX_EVENT_Q_LEN) { return; } - skb=wan_skb_alloc(sizeof(wp_tdm_api_rx_hdr_t)); + skb=wan_skb_alloc(sizeof(wp_tdm_api_event_t)); if (skb == NULL) return; - rx_hdr=(wp_tdm_api_rx_hdr_t*)wan_skb_put(skb,sizeof(wp_tdm_api_rx_hdr_t)); + p_tdmapi_event = (wp_tdm_api_event_t*)wan_skb_put(skb,sizeof(wp_tdm_api_event_t)); #endif - memset(rx_hdr,0,sizeof(wp_tdm_api_rx_hdr_t)); - rx_hdr->wp_tdm_api_event_type = WP_TDM_EVENT_DTMF; - rx_hdr->wp_tdm_api_event_dtmf_digit = event->digit; - rx_hdr->wp_tdm_api_event_dtmf_type = event->dtmf_type; - rx_hdr->wp_tdm_api_event_dtmf_port = event->dtmf_port; + memset(p_tdmapi_event,0,sizeof(wp_tdm_api_event_t)); + p_tdmapi_event->type = WP_TDMAPI_EVENT_DTMF; + p_tdmapi_event->wp_tdm_api_event_dtmf_digit = event->digit; + p_tdmapi_event->wp_tdm_api_event_dtmf_type = event->dtmf_type; + p_tdmapi_event->wp_tdm_api_event_dtmf_port = event->dtmf_port; #if 0 rx_hdr->event_time_stamp = gettimeofday(); #endif #if defined(__WINDOWS__) - rx_hdr->wp_tdm_api_event_channel = (u_int16_t)event->channel; - aft_te1_insert_tdm_api_event_in_to_rx_queue(tdm_api, rx_hdr); + p_tdmapi_event->channel = (u_int16_t)event->channel; + aft_te1_insert_tdm_api_event_in_to_rx_queue(tdm_api, p_tdmapi_event); queue_tdm_api_rx_dpc(tdm_api); #else wan_skb_queue_tail(&tdm_api->wp_event_list,skb); @@ -2076,50 +2074,53 @@ static void wp_tdmapi_hook (void* card_id, wan_event_t *event) netskb_t *skb; wanpipe_tdm_api_dev_t *tdm_api = NULL; sdla_t *card = (sdla_t*)card_id; - wp_tdm_api_rx_hdr_t *rx_hdr = NULL; + wp_tdm_api_event_t *p_tdmapi_event = NULL; #if defined(__WINDOWS__) - wp_tdm_api_rx_hdr_t tdm_api_hdr; + wp_tdm_api_event_t tdmapi_event; #endif DEBUG_TDMAPI("%s: Received RM LC Event at TDM_API (%d:%s)!\n", card->devname, event->channel, (event->rxhook==WAN_EVENT_RXHOOK_OFF)?"OFF-HOOK":"ON-HOOK"); - - tdm_api = wp_tdmapi_search(card, -#if defined(__WINDOWS__) - event->channel - 1); -#else - event->channel); -#endif + tdm_api = wp_tdmapi_search(card, event->channel); if (tdm_api == NULL){ return; } #if defined(__WINDOWS__) - rx_hdr = &tdm_api_hdr; + p_tdmapi_event = &tdmapi_event; #else if (wan_skb_queue_len(&tdm_api->wp_event_list) > WP_TDM_MAX_EVENT_Q_LEN) { return; } - skb=wan_skb_alloc(sizeof(wp_tdm_api_rx_hdr_t)); + skb=wan_skb_alloc(sizeof(wp_tdm_api_event_t)); if (skb == NULL) return; - rx_hdr=(wp_tdm_api_rx_hdr_t*)wan_skb_put(skb,sizeof(wp_tdm_api_rx_hdr_t)); + p_tdmapi_event = (wp_tdm_api_event_t*)wan_skb_put(skb,sizeof(wp_tdm_api_event_t)); #endif - memset(rx_hdr,0,sizeof(wp_tdm_api_rx_hdr_t)); - rx_hdr->wp_tdm_api_event_type = WP_TDM_EVENT_RXHOOK; - rx_hdr->wp_tdm_api_event_channel = (u_int16_t)event->channel; - rx_hdr->wp_tdm_api_event_rxhook_state = event->rxhook; + memset(p_tdmapi_event, 0, sizeof(wp_tdm_api_event_t)); + p_tdmapi_event->type = WP_TDMAPI_EVENT_RXHOOK; + p_tdmapi_event->channel = (u_int16_t)event->channel; + switch(event->rxhook){ + case WAN_EVENT_RXHOOK_ON: + p_tdmapi_event->wp_tdm_api_event_hook_state = + WP_TDMAPI_EVENT_RXHOOK_ON; + break; + case WAN_EVENT_RXHOOK_OFF: + p_tdmapi_event->wp_tdm_api_event_hook_state = + WP_TDMAPI_EVENT_RXHOOK_OFF; + break; + } #if 0 rx_hdr->event_time_stamp = gettimeofday(); #endif #if defined(__WINDOWS__) - aft_te1_insert_tdm_api_event_in_to_rx_queue(tdm_api, rx_hdr); + aft_te1_insert_tdm_api_event_in_to_rx_queue(tdm_api, p_tdmapi_event); queue_tdm_api_rx_dpc(tdm_api); #else wan_skb_queue_tail(&tdm_api->wp_event_list,skb); @@ -2137,52 +2138,53 @@ call was answered. */ static void wp_tdmapi_ringtrip (void* card_id, wan_event_t *event) { - netskb_t *skb; + netskb_t *skb; wanpipe_tdm_api_dev_t *tdm_api = NULL; - sdla_t *card = (sdla_t*)card_id; - wp_tdm_api_rx_hdr_t *rx_hdr = NULL; + sdla_t *card = (sdla_t*)card_id; + wp_tdm_api_event_t *p_tdmapi_event = NULL; #if defined(__WINDOWS__) - wp_tdm_api_rx_hdr_t tdm_api_hdr; + wp_tdm_api_event_t tdmapi_event; #endif DEBUG_TDMAPI("%s: Received RM RING TRIP Event at TDM_API (%d:%s)!\n", card->devname, event->channel, - WAN_EVENT_RING_TRIP_DECODE(event->rxhook)); + WAN_EVENT_RING_TRIP_DECODE(event->ring_mode)); - tdm_api = wp_tdmapi_search(card, -#if defined(__WINDOWS__) - event->channel - 1); -#else - event->channel); -#endif + tdm_api = wp_tdmapi_search(card, event->channel); if (tdm_api == NULL){ return; } #if defined(__WINDOWS__) - rx_hdr = &tdm_api_hdr; + p_tdmapi_event = &tdmapi_event; #else if (wan_skb_queue_len(&tdm_api->wp_event_list) > WP_TDM_MAX_EVENT_Q_LEN) { return; } - skb=wan_skb_alloc(sizeof(wp_tdm_api_rx_hdr_t)); + skb=wan_skb_alloc(sizeof(wp_tdm_api_event_t)); if (skb == NULL) return; - rx_hdr=(wp_tdm_api_rx_hdr_t*)wan_skb_put(skb,sizeof(wp_tdm_api_rx_hdr_t)); + p_tdmapi_event = (wp_tdm_api_event_t*)wan_skb_put(skb,sizeof(wp_tdm_api_event_t)); #endif - memset(rx_hdr,0,sizeof(wp_tdm_api_rx_hdr_t)); - rx_hdr->wp_tdm_api_event_type = WP_TDM_EVENT_RING_TRIP; - rx_hdr->wp_tdm_api_event_channel = (u_int16_t)event->channel; - rx_hdr->wp_tdm_api_event_ring_state = event->rxhook; + memset(p_tdmapi_event, 0, sizeof(wp_tdm_api_event_t)); + p_tdmapi_event->type = WP_TDMAPI_EVENT_RING_TRIP_DETECT; + p_tdmapi_event->channel = (u_int16_t)event->channel; + if (event->ring_mode == WAN_EVENT_RING_TRIP_STOP){ + p_tdmapi_event->wp_tdm_api_event_ring_state = + WP_TDMAPI_EVENT_RING_TRIP_STOP; + }else if (event->ring_mode == WAN_EVENT_RING_TRIP_PRESENT){ + p_tdmapi_event->wp_tdm_api_event_ring_state = + WP_TDMAPI_EVENT_RING_TRIP_PRESENT; + } #if 0 rx_hdr->event_time_stamp = gettimeofday(); #endif #if defined(__WINDOWS__) - aft_te1_insert_tdm_api_event_in_to_rx_queue(tdm_api, rx_hdr); + aft_te1_insert_tdm_api_event_in_to_rx_queue(tdm_api, p_tdmapi_event); queue_tdm_api_rx_dpc(tdm_api); #else wan_skb_queue_tail(&tdm_api->wp_event_list,skb); @@ -2200,50 +2202,54 @@ static void wp_tdmapi_ringdetect (void* card_id, wan_event_t *event) netskb_t *skb; wanpipe_tdm_api_dev_t *tdm_api = NULL; sdla_t *card = (sdla_t*)card_id; - wp_tdm_api_rx_hdr_t *rx_hdr = NULL; + wp_tdm_api_event_t *p_tdmapi_event = NULL; #if defined(__WINDOWS__) - wp_tdm_api_rx_hdr_t tdm_api_hdr; + wp_tdm_api_event_t tdmapi_event; #endif DEBUG_TDMAPI("%s: Received RM RING DETECT Event at TDM_API (%d:%s)!\n", card->devname, event->channel, - WAN_EVENT_RING_DECODE(event->rxhook)); + WAN_EVENT_RING_DECODE(event->ring_mode)); - tdm_api = wp_tdmapi_search(card, -#if defined(__WINDOWS__) - event->channel - 1); -#else - event->channel); -#endif + tdm_api = wp_tdmapi_search(card, event->channel); if (tdm_api == NULL){ return; } #if defined(__WINDOWS__) - rx_hdr = &tdm_api_hdr; + p_tdmapi_event = &tdmapi_event; #else if (wan_skb_queue_len(&tdm_api->wp_event_list) > WP_TDM_MAX_EVENT_Q_LEN) { return; } - skb=wan_skb_alloc(sizeof(wp_tdm_api_rx_hdr_t)); + skb=wan_skb_alloc(sizeof(wp_tdm_api_event_t)); if (skb == NULL) return; - rx_hdr=(wp_tdm_api_rx_hdr_t*)wan_skb_put(skb,sizeof(wp_tdm_api_rx_hdr_t)); + p_tdmapi_event = (wp_tdm_api_event_t*)wan_skb_put(skb,sizeof(wp_tdm_api_event_t)); #endif - memset(rx_hdr,0,sizeof(wp_tdm_api_rx_hdr_t)); + memset(p_tdmapi_event, 0, sizeof(wp_tdm_api_event_t)); - rx_hdr->wp_tdm_api_event_type = WP_TDM_EVENT_RING_DETECT; - rx_hdr->wp_tdm_api_event_channel = (u_int16_t)event->channel; - rx_hdr->wp_tdm_api_event_ring_state = event->ring_mode; + p_tdmapi_event->type = WP_TDMAPI_EVENT_RING_DETECT; + p_tdmapi_event->channel = (u_int16_t)event->channel; + switch(event->ring_mode){ + case WAN_EVENT_RING_PRESENT: + p_tdmapi_event->wp_tdm_api_event_ring_state = + WP_TDMAPI_EVENT_RING_PRESENT; + break; + case WAN_EVENT_RING_STOP: + p_tdmapi_event->wp_tdm_api_event_ring_state = + WP_TDMAPI_EVENT_RING_STOP; + break; + } #if 0 rx_hdr->event_time_stamp = gettimeofday(); #endif #if defined(__WINDOWS__) - aft_te1_insert_tdm_api_event_in_to_rx_queue(tdm_api, rx_hdr); + aft_te1_insert_tdm_api_event_in_to_rx_queue(tdm_api, p_tdmapi_event); queue_tdm_api_rx_dpc(tdm_api); #else wan_skb_queue_tail(&tdm_api->wp_event_list,skb); @@ -2258,49 +2264,29 @@ static int store_tdm_api_pointer_in_card(sdla_t *card, wanpipe_tdm_api_dev_t *td { int i; - TDM_FUNC_DBG + TDM_FUNC_DBG(); - if (IS_TE1_CARD(card)) { - DEBUG_TDMAPI("TE1 card: original_active_ch: 0x%X\n", tdm_api->original_active_ch); + DEBUG_TDMAPI("%s(): original_active_ch: 0x%X\n", __FUNCTION__, tdm_api->original_active_ch); - for(i = 0; i < NUM_OF_E1_CHANNELS; i++){ - if(tdm_api->original_active_ch & (1 << i)){ + for(i = 0; i < NUM_OF_E1_CHANNELS; i++){ + if(tdm_api->original_active_ch & (1 << i)){ - DEBUG_TDMAPI("%s(): setting channel: %d\n", __FUNCTION__, i); + DEBUG_TDMAPI("%s(): setting channel: %d\n", __FUNCTION__, i); - if(i >= MAX_TDM_API_CHANNELS){ - DEBUG_EVENT("%s(): TDM API Error (TE1): Invalid Channel Number=%i (Span=%d)!\n", - __FUNCTION__, i, tdm_api->tdm_span); - return 1; - } + if(i >= MAX_TDM_API_CHANNELS){ + DEBUG_EVENT("%s(): TDM API Error (TE1): Invalid Channel Number=%i (Span=%d)!\n", + __FUNCTION__, i, tdm_api->tdm_span); + return 1; + } - if(card->wp_tdmapi_hash[i] != NULL){ - DEBUG_EVENT("%s(): TDM API Error (TE1): device SPAN=%i CHAN=%i already in use!\n", - __FUNCTION__, tdm_api->tdm_span, i); - return 1; - } - card->wp_tdmapi_hash[i] = tdm_api; - }//if() - }//for() - - }else{ - DEBUG_TDMAPI("Not a TE1 card\n"); - - DEBUG_TDMAPI("%s(): tdm_api->tdm_chan: %d\n", __FUNCTION__, tdm_api->tdm_chan); - - if(tdm_api->tdm_chan >= MAX_TDM_API_CHANNELS){ - DEBUG_EVENT("%s(): TDM API Error (Analog): Invalid Channel Number=%i (Span=%d)!\n", - __FUNCTION__, tdm_api->tdm_chan, tdm_api->tdm_span); - return 1; - } - - if(card->wp_tdmapi_hash[tdm_api->tdm_chan] != NULL){ - DEBUG_EVENT("%s(): TDM API Error (Analog): device SPAN=%i CHAN=%i already in use!\n", - __FUNCTION__, tdm_api->tdm_span, tdm_api->tdm_chan); - return 1; - } - card->wp_tdmapi_hash[tdm_api->tdm_chan] = tdm_api; - } + if(card->wp_tdmapi_hash[i] != NULL){ + DEBUG_EVENT("%s(): TDM API Error (TE1): device SPAN=%i CHAN=%i already in use!\n", + __FUNCTION__, tdm_api->tdm_span, i); + return 1; + } + card->wp_tdmapi_hash[i] = tdm_api; + }//if() + }//for() return 0; } @@ -2309,7 +2295,7 @@ static int remove_tdm_api_pointer_from_card(wanpipe_tdm_api_dev_t *tdm_api) sdla_t *card = NULL; int i; - TDM_FUNC_DBG + TDM_FUNC_DBG(); WAN_ASSERT(tdm_api == NULL); card = (sdla_t*)tdm_api->card; @@ -2320,41 +2306,27 @@ static int remove_tdm_api_pointer_from_card(wanpipe_tdm_api_dev_t *tdm_api) return 1; } - if (IS_TE1_CARD(card)) { + DEBUG_TDMAPI("%s(): original_active_ch: 0x%X\n", __FUNCTION__, tdm_api->original_active_ch); - DEBUG_TDMAPI("TE1 card: original_active_ch: 0x%X\n", tdm_api->original_active_ch); + for(i = 0; i < NUM_OF_E1_CHANNELS; i++){ + if(tdm_api->original_active_ch & (1 << i)){ - for(i = 0; i < NUM_OF_E1_CHANNELS; i++){ - if(tdm_api->original_active_ch & (1 << i)){ + DEBUG_TDMAPI("%s(): RE-setting channel: %d\n", __FUNCTION__, i); - DEBUG_TDMAPI("%s(): RE-setting channel: %d\n", __FUNCTION__, i); + if(i >= MAX_TDM_API_CHANNELS){ + DEBUG_EVENT("%s(): TDM API Error (TE1): Invalid Channel Number=%i (Span=%d)!\n", + __FUNCTION__, i, tdm_api->tdm_span); + return 1; + } - if(i >= MAX_TDM_API_CHANNELS){ - DEBUG_EVENT("%s(): TDM API Error (TE1): Invalid Channel Number=%i (Span=%d)!\n", - __FUNCTION__, i, tdm_api->tdm_span); - return 1; - } + if(card->wp_tdmapi_hash[i] == NULL){ + DEBUG_EVENT("%s: TDM API Warning (TE1): device SPAN=%i CHAN=%i was NOT in use!\n", + __FUNCTION__, tdm_api->tdm_span, tdm_api->tdm_chan); + } + card->wp_tdmapi_hash[i] = NULL; + }//if() + }//for() - if(card->wp_tdmapi_hash[i] == NULL){ - DEBUG_EVENT("%s: TDM API Warning (TE1): device SPAN=%i CHAN=%i was NOT in use!\n", - __FUNCTION__, tdm_api->tdm_span, tdm_api->tdm_chan); - } - card->wp_tdmapi_hash[i] = NULL; - }//if() - }//for() - }else{ - if(tdm_api->tdm_chan >= MAX_TDM_API_CHANNELS){ - DEBUG_EVENT("%s(): TDM API Error (Analog): Invalid Channel Number=%i (Span=%d)!\n", - __FUNCTION__, tdm_api->tdm_chan, tdm_api->tdm_span); - return 1; - } - - if(card->wp_tdmapi_hash[tdm_api->tdm_chan] == NULL){ - DEBUG_EVENT("%s: TDM API Warning (Analog): device SPAN=%i CHAN=%i was NOT in use!\n", - __FUNCTION__, tdm_api->tdm_span, tdm_api->tdm_chan); - } - card->wp_tdmapi_hash[tdm_api->tdm_chan] = NULL; - } return 0; } @@ -2515,4 +2487,4 @@ int wanpipe_tdm_api_rx_tx (wanpipe_tdm_api_dev_t *tdm_api, u8 *rx_data, u8 *tx_d return -EINVAL; } -#endif +#endif /* #if defined(BUILD_TDMV_API) */ diff --git a/patches/kdrivers/src/net/wanpipe_utils.c b/patches/kdrivers/src/net/wanpipe_utils.c index 176462f..ab5d887 100644 --- a/patches/kdrivers/src/net/wanpipe_utils.c +++ b/patches/kdrivers/src/net/wanpipe_utils.c @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: wanpipe_utils.c,v 1.93 2006/11/23 22:00:58 sangoma Exp $ + * $Id: wanpipe_utils.c,v 1.101 2008/02/04 18:02:20 sangoma Exp $ */ /* @@ -48,6 +48,7 @@ # if !defined(CONFIG_PRODUCT_WANPIPE_GENERIC) # include # endif +# include # include # include /* WANPIPE common user API definitions */ #elif (defined __WINDOWS__) @@ -86,7 +87,7 @@ static void wanpipe_debug_timer(unsigned long arg); extern sdla_t* wanpipe_debug; int wan_get_dbg_msg(wan_device_t* wandev, void* u_dbg_msg); - +void wanpipe_set_dev_carrier_state(sdla_t* card, int state); unsigned char wp_brt[256]; @@ -184,6 +185,21 @@ void wanpipe_set_baud (void* card_id, unsigned int baud) card->wandev.bps=baud*1000; } +void wanpipe_set_dev_carrier_state(sdla_t* card, int state) +{ + netdevice_t *dev; + dev = WAN_DEVLE2DEV(WAN_LIST_FIRST(&card->wandev.dev_head)); + if (dev && WAN_NETIF_UP(dev)) { + if (state == WAN_CONNECTED) { + WAN_NETIF_CARRIER_ON(dev); + WAN_NETIF_WAKE_QUEUE(dev); + } else { + WAN_NETIF_CARRIER_OFF(dev); + WAN_NETIF_STOP_QUEUE(dev); + } + } +} + /* * ============================================================================ @@ -208,6 +224,10 @@ void wanpipe_set_state (void* card_id, int state) break; } card->wandev.state = state; + + if (card->wandev.config_id == WANCONFIG_ADSL) { + wanpipe_set_dev_carrier_state(card,state); + } } card->state_tick = SYSTEM_TICKS; } @@ -363,7 +383,6 @@ int wan_reply_udp(void* card_id, unsigned char *data, unsigned int mbox_len) - #if defined(__LINUX__) /* * =========================================================================== @@ -533,10 +552,10 @@ void wanpipe_debugging (unsigned long data) /* Sangoma T1/E1/56K cards */ /* Check Tv attributes */ if (card->wandev.fe_iface.read_alarm){ - card->wandev.fe_iface.read_alarm(&card->fe, 0); + card->wandev.fe_iface.read_alarm(&card->fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE); } if (card->wandev.fe_iface.read_alarm && - (status = card->wandev.fe_iface.read_alarm(&card->fe, 0))){ + (status = card->wandev.fe_iface.read_alarm(&card->fe, WAN_FE_ALARM_READ|WAN_FE_ALARM_UPDATE))){ DEBUG_DBG("%s: WAN_DBG: T1/E1/56K is not in Service, print Alarms!\n", card->devname); /* Not in service, Alarms */ @@ -1273,9 +1292,9 @@ void wpabs_set_baud (void* card_id, unsigned int baud) void* wpabs_dma_alloc(void* pcard, unsigned long max_length) { sdla_t* card = (sdla_t*)pcard; - wan_dma_descr_t* dma_descr = NULL; + wan_dma_descr_org_t *dma_descr = NULL; - dma_descr = wan_malloc(sizeof(wan_dma_descr_t)); + dma_descr = wan_malloc(sizeof(wan_dma_descr_org_t)); if (dma_descr == NULL){ return NULL; } @@ -1283,7 +1302,7 @@ void* wpabs_dma_alloc(void* pcard, unsigned long max_length) #if defined(__NetBSD__) || defined(__OpenBSD__) card->hw_iface.getcfg(card->hw, SDLA_DMATAG, &dma_descr->dmat); #endif - if (wan_dma_alloc(card->hw, dma_descr)){ + if (wan_dma_alloc_org(card->hw, dma_descr)){ wan_free(dma_descr); return NULL; } @@ -1294,7 +1313,7 @@ int wpabs_dma_free(void* pcard, void* dma_descr) { int err=0; sdla_t* card = (sdla_t*)pcard; - err=wan_dma_free(card->hw, (wan_dma_descr_t*)dma_descr); + err=wan_dma_free_org(card->hw, (wan_dma_descr_org_t*)dma_descr); wan_free(dma_descr); return err; } @@ -1338,7 +1357,13 @@ int init_atm_idle_buffer(unsigned char *buff, int buff_len, char *if_name, char int atm_add_data_to_skb(void* skb, void *data, int data_len, char *if_name) { unsigned char *skb_data_ptr; - + + if (data_len != ATM_CELL_SIZE) { + DEBUG_EVENT("%s: %s(): Error, invalid datalen=%i\n", + if_name, __FUNCTION__, data_len); + return 1; + } + DEBUG_ATM("%s(): data_len=%d, skb tail room=%d\n", __FUNCTION__, data_len, wan_skb_tailroom(skb)); @@ -1388,10 +1413,14 @@ int atm_pad_idle_cells_in_tx_skb(void *skb, void *tx_idle_skb, char *if_name) return 0; } + + + void *atm_tx_skb_dequeue(void* wp_tx_pending_list, void *tx_idle_skb, char *if_name) { void *tx_skb, *single_cell_skb; int max_num_of_cells_fit_in_tx_buffer, i; + int err; if(wan_skb_queue_len(wp_tx_pending_list) == 0){ return NULL; @@ -1418,16 +1447,25 @@ void *atm_tx_skb_dequeue(void* wp_tx_pending_list, void *tx_idle_skb, char *if_n break; } - atm_add_data_to_skb( tx_skb, + err=atm_add_data_to_skb(tx_skb, wan_skb_data(single_cell_skb), wan_skb_len (single_cell_skb), if_name); wan_skb_free(single_cell_skb); + if (err) { + wan_skb_free(tx_skb); + return NULL; + } } - /* try to add idle cells, if no space it won't do anything */ - atm_pad_idle_cells_in_tx_skb(tx_skb, tx_idle_skb, if_name); + /* try to add idle cells, if no space it won't do anything */ + err=atm_pad_idle_cells_in_tx_skb(tx_skb, tx_idle_skb, if_name); + if (err) { + wan_skb_free(tx_skb); + return NULL; + } + return tx_skb; } diff --git a/patches/kdrivers/src/wan_aften/wan_aften.c b/patches/kdrivers/src/wan_aften/wan_aften.c index 12d573c..d719b8b 100644 --- a/patches/kdrivers/src/wan_aften/wan_aften.c +++ b/patches/kdrivers/src/wan_aften/wan_aften.c @@ -28,12 +28,16 @@ extern wan_iface_t wan_iface; static int wan_aften_init(void*); static int wan_aften_exit(void*); +#if 0 +static int wan_aften_shutdown(void*); +static int wan_aften_ready_unload(void*); +#endif static int wan_aften_setup(sdla_t *card, netdevice_t *dev); -static int wan_aften_shutdown(sdla_t *card); +static int wan_aften_release(sdla_t *card); static int wan_aften_update_ports(void); -static int wan_aften_open(netdevice_t *dev); -static int wan_aften_close(netdevice_t *dev); -static int wan_aften_ioctl (netdevice_t *dev, struct ifreq *ifr, int cmd); +static int wan_aften_open(netdevice_t*); +static int wan_aften_close(netdevice_t*); +static int wan_aften_ioctl (netdevice_t*, struct ifreq*, wan_ioctl_cmd_t); #if defined(__OpenBSD__) struct cdevsw wan_aften_devsw = { @@ -43,7 +47,7 @@ WAN_MODULE_DEFINE( "Alex Feldman ", "WAN AFT Enable", "GPL", - wan_aften_init, wan_aften_exit, + wan_aften_init, wan_aften_exit,/* wan_aften_shutdown, wan_aften_ready_unload,*/ &wan_aften_devsw); #else WAN_MODULE_DEFINE( @@ -51,7 +55,7 @@ WAN_MODULE_DEFINE( "Alex Feldman ", "WAN AFT Enable", "GPL", - wan_aften_init, wan_aften_exit, + wan_aften_init, wan_aften_exit,/*wan_aften_shutdown, wan_aften_ready_unload,*/ NULL); #endif WAN_MODULE_DEPEND(wan_aften, sdladrv, 1, SDLADRV_MAJOR_VER, SDLADRV_MAJOR_VER); @@ -137,7 +141,7 @@ static int wan_aften_init(void *arg) wandev = &card->wandev; wandev->magic = ROUTER_MAGIC; wandev->name = card->devname; - wandev->private = card; + wandev->priv = card; devle->dev = dev; /* Set device pointer */ @@ -198,8 +202,8 @@ static int wan_aften_exit(void *arg) WAN_LIST_REMOVE(devle, dev_link); wan_free(devle); } - DEBUG_EVENT("%s: Shutdown device\n", card->devname); - wan_aften_shutdown(card); + DEBUG_EVENT("%s: Release device\n", card->devname); + wan_aften_release(card); card_list = card->list; wan_free(card); card = card_list; @@ -212,13 +216,23 @@ static int wan_aften_exit(void *arg) DEBUG_EVENT("\n"); DEBUG_EVENT("%s Unloaded.\n", wan_fullname); -#if defined(WAN_DEBUG_MEM) - DEBUG_EVENT("%s: Total Mem %d\n", - wan_drvname, wan_atomic_read(&wan_debug_mem)); -#endif return err; } +#if 0 +int wan_aften_shutdown(void *arg) +{ + DEBUG_EVENT("Shutting down WAN_AFTEN module ...\n"); + return 0; +} + +int wan_aften_ready_unload(void *arg) +{ + DEBUG_EVENT("Is WAN_AFTEN module ready to unload...\n"); + return 0; +} +#endif + static int wan_aften_setup(sdla_t *card, netdevice_t *dev) { struct wan_aften_priv *priv = wan_netif_priv(dev); @@ -250,11 +264,38 @@ static int wan_aften_setup(sdla_t *card, netdevice_t *dev) WAN_HWCALL(pci_read_config_dword, (card->hw, PCI_MEM_BASE0_DWORD, &priv->base_addr1)); - DEBUG_TEST("%s: BaseClass %X BaseAddr 0x%X IRQ %d\n", + DEBUG_EVENT("%s: BaseClass %X BaseAddr %X:%X IRQ %d\n", wan_netif_name(dev), priv->base_class, priv->base_addr0, + priv->base_addr1, priv->irq); + + /* Save pci bridge config (if needed) */ + WAN_HWCALL(getcfg, (card->hw, SDLA_PCIEXPRESS, &priv->pci_express_bridge)); + if (priv->pci_express_bridge){ + int off = 0; + + WAN_HWCALL(pci_bridge_read_config_dword, + (card->hw, 0x04, &priv->pci_bridge_base_class)); + WAN_HWCALL(pci_bridge_read_config_dword, + (card->hw, PCI_IO_BASE_DWORD, &priv->pci_bridge_base_addr0)); + WAN_HWCALL(pci_bridge_read_config_dword, + (card->hw, PCI_MEM_BASE0_DWORD, &priv->pci_bridge_base_addr1)); + WAN_HWCALL(pci_bridge_read_config_byte, + (card->hw, PCI_INT_LINE_BYTE, &priv->pci_bridge_irq)); + for(off=0;off<=15;off++){ + WAN_HWCALL(pci_bridge_read_config_dword, + (card->hw, off*4, &priv->pci_bridge_cfg[off])); + } + DEBUG_EVENT("%s: PCI_ExpressBridge: BaseClass %X BaseAddr %X:%X IRQ %d\n", + wan_netif_name(dev), + priv->pci_bridge_base_class, + priv->pci_bridge_base_addr0, + priv->pci_bridge_base_addr1, + priv->pci_bridge_irq); + } + #if defined(ENABLED_IRQ) if(request_irq(irq, wan_aften_isr, SA_SHIRQ, card->devname, card)){ DEBUG_EVENT("%s: Can't reserve IRQ %d!\n", @@ -270,7 +311,7 @@ wan_aften_setup_error: } -static int wan_aften_shutdown(sdla_t *card) +static int wan_aften_release(sdla_t *card) { #if defined(ENABLED_IRQ) struct wan_aften_priv *priv = wan_netif_priv(dev); @@ -503,6 +544,21 @@ static int wan_aften_set_pci_bios(sdla_t *card) priv->base_addr1, priv->irq); + if (priv->pci_express_bridge){ + int off = 0; + WAN_HWCALL(pci_bridge_write_config_dword, + (card->hw, 0x04, priv->pci_bridge_base_class)); + WAN_HWCALL(pci_bridge_write_config_dword, + (card->hw, PCI_IO_BASE_DWORD, priv->pci_bridge_base_addr0)); + WAN_HWCALL(pci_bridge_write_config_dword, + (card->hw, PCI_MEM_BASE0_DWORD, priv->pci_bridge_base_addr1)); + WAN_HWCALL(pci_bridge_write_config_byte, + (card->hw, PCI_INT_LINE_BYTE, priv->pci_bridge_irq)); + for(off=0;off<=15;off++){ + WAN_HWCALL(pci_bridge_write_config_dword, + (card->hw, off*4, priv->pci_bridge_cfg[off])); + } + } WP_DELAY(200); card->hw_iface.pci_write_config_dword( card->hw, 0x04, priv->base_class); @@ -692,7 +748,8 @@ static int wan_aften_close(netdevice_t *dev) return 0; } -static int wan_aften_ioctl (netdevice_t *dev, struct ifreq *ifr, int cmd) +static int +wan_aften_ioctl (netdevice_t *dev, struct ifreq *ifr, wan_ioctl_cmd_t cmd) { sdla_t *card; struct wan_aften_priv *priv= wan_netif_priv(dev); diff --git a/patches/kdrivers/src/wan_aften/wan_aften.h b/patches/kdrivers/src/wan_aften/wan_aften.h index 68305b8..01c92c8 100644 --- a/patches/kdrivers/src/wan_aften/wan_aften.h +++ b/patches/kdrivers/src/wan_aften/wan_aften.h @@ -36,6 +36,17 @@ struct wan_aften_priv { unsigned int irq; unsigned int slot; unsigned int bus; + + u_int8_t pci_express_bridge; + + unsigned int pci_bridge_base_class; + unsigned int pci_bridge_base_addr0; + unsigned int pci_bridge_base_addr1; + u_int8_t pci_bridge_irq; + unsigned int pci_bridge_slot; + unsigned int pci_bridge_bus; + u_int32_t pci_bridge_cfg[16]; + }; #endif diff --git a/patches/kdrivers/src/wan_aften/wan_aften_src.o b/patches/kdrivers/src/wan_aften/wan_aften_src.o index bb39aff..51246ed 100644 Binary files a/patches/kdrivers/src/wan_aften/wan_aften_src.o and b/patches/kdrivers/src/wan_aften/wan_aften_src.o differ diff --git a/patches/kdrivers/src/wan_aften/wanpipe_linux_iface.o b/patches/kdrivers/src/wan_aften/wanpipe_linux_iface.o index 0143388..b67ddf6 100644 Binary files a/patches/kdrivers/src/wan_aften/wanpipe_linux_iface.o and b/patches/kdrivers/src/wan_aften/wanpipe_linux_iface.o differ diff --git a/patches/kdrivers/src/wanrouter/.af_wanpipe_src.o.d b/patches/kdrivers/src/wanrouter/.af_wanpipe_src.o.d new file mode 100644 index 0000000..fdb8fcd --- /dev/null +++ b/patches/kdrivers/src/wanrouter/.af_wanpipe_src.o.d @@ -0,0 +1,186 @@ +af_wanpipe_src.o: \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/src/net/../wanrouter/af_wanpipe_src.c \ + include/linux/autoconf.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/wanpipe_includes.h \ + include/linux/init.h include/linux/compiler.h \ + include/linux/compiler-gcc4.h include/linux/compiler-gcc.h \ + include/linux/version.h include/linux/module.h include/linux/list.h \ + include/linux/stddef.h include/linux/poison.h include/linux/prefetch.h \ + include/linux/types.h include/linux/posix_types.h \ + include/asm/posix_types.h include/asm/posix_types_32.h \ + include/asm/types.h include/asm/processor.h include/asm/processor_32.h \ + include/asm/vm86.h include/asm/ptrace.h include/asm/ptrace-abi.h \ + include/asm/segment.h include/asm/segment_32.h include/asm/math_emu.h \ + include/asm/sigcontext.h include/asm/page.h include/asm/page_32.h \ + include/asm-generic/pgtable-nopmd.h include/asm-generic/pgtable-nopud.h \ + include/asm-generic/memory_model.h include/asm-generic/page.h \ + include/asm/cpufeature.h include/asm/cpufeature_32.h \ + include/linux/bitops.h include/asm/bitops.h include/asm/bitops_32.h \ + include/asm/alternative.h include/asm/alternative_32.h \ + include/asm-generic/bitops/sched.h include/asm-generic/bitops/hweight.h \ + include/asm-generic/bitops/fls64.h \ + include/asm-generic/bitops/ext2-non-atomic.h \ + include/asm-generic/bitops/le.h include/asm/byteorder.h \ + include/linux/byteorder/little_endian.h include/linux/byteorder/swab.h \ + include/linux/byteorder/generic.h include/asm-generic/bitops/minix.h \ + include/asm/required-features.h include/asm/msr.h \ + include/asm/msr-index.h include/asm/errno.h include/asm-generic/errno.h \ + include/asm-generic/errno-base.h include/linux/errno.h \ + include/asm/system.h include/asm/system_32.h include/linux/kernel.h \ + /usr/lib/gcc/i386-redhat-linux/4.1.1/include/stdarg.h \ + include/linux/linkage.h include/asm/linkage.h include/asm/linkage_32.h \ + include/linux/log2.h include/asm/bug.h include/asm-generic/bug.h \ + include/asm/div64.h include/asm/cmpxchg.h include/asm/cmpxchg_32.h \ + include/linux/irqflags.h include/asm/irqflags.h \ + include/asm/irqflags_32.h include/asm/processor-flags.h \ + include/linux/cache.h include/asm/cache.h include/linux/threads.h \ + include/asm/percpu.h include/asm/percpu_32.h include/linux/cpumask.h \ + include/linux/bitmap.h include/linux/string.h include/asm/string.h \ + include/asm/string_32.h include/linux/stat.h include/asm/stat.h \ + include/linux/time.h include/linux/seqlock.h include/linux/spinlock.h \ + include/linux/preempt.h include/linux/thread_info.h \ + include/asm/thread_info.h include/asm/thread_info_32.h \ + include/linux/stringify.h include/linux/bottom_half.h \ + include/linux/spinlock_types.h include/asm/spinlock_types.h \ + include/linux/lockdep.h include/asm/spinlock.h \ + include/asm/spinlock_32.h include/asm/atomic.h include/asm/atomic_32.h \ + include/asm-generic/atomic.h include/asm/rwlock.h \ + include/linux/spinlock_api_smp.h include/linux/kmod.h \ + include/linux/elf.h include/linux/elf-em.h include/asm/elf.h \ + include/asm/user.h include/asm/user_32.h include/asm/auxvec.h \ + include/asm/desc.h include/asm/desc_32.h include/asm/ldt.h \ + include/linux/smp.h include/asm/smp.h include/asm/smp_32.h \ + include/asm/mpspec.h include/asm/mpspec_32.h include/asm/mpspec_def.h \ + include/asm-x86/mach-generic/mach_mpspec.h include/asm/apic.h \ + include/asm/apic_32.h include/linux/pm.h include/linux/delay.h \ + include/asm/delay.h include/asm/fixmap.h include/asm/fixmap_32.h \ + include/asm/acpi.h include/asm/acpi_32.h include/acpi/pdc_intel.h \ + include/asm/apicdef.h include/asm/apicdef_32.h include/asm/kmap_types.h \ + include/asm/io_apic.h include/asm/io_apic_32.h \ + include/asm-x86/mach-generic/mach_apicdef.h include/asm/genapic.h \ + include/asm/genapic_32.h include/linux/percpu.h include/linux/slab.h \ + include/linux/gfp.h include/linux/mmzone.h include/linux/wait.h \ + include/asm/current.h include/asm/current_32.h include/linux/numa.h \ + include/linux/nodemask.h include/linux/pageblock-flags.h \ + include/linux/memory_hotplug.h include/linux/notifier.h \ + include/linux/mutex.h include/linux/rwsem.h include/asm/rwsem.h \ + include/linux/srcu.h include/linux/topology.h include/asm/topology.h \ + include/asm/topology_32.h include/asm-generic/topology.h \ + include/linux/slub_def.h include/linux/workqueue.h \ + include/linux/timer.h include/linux/ktime.h include/linux/jiffies.h \ + include/linux/calc64.h include/linux/timex.h include/asm/param.h \ + include/asm/timex.h include/asm/tsc.h include/linux/kobject.h \ + include/linux/sysfs.h include/linux/kref.h include/asm/mmu.h \ + include/linux/moduleparam.h include/linux/marker.h include/asm/local.h \ + include/asm/local_32.h include/asm/module.h include/asm/module_32.h \ + include/linux/sched.h include/linux/capability.h include/linux/rbtree.h \ + include/linux/mm_types.h include/linux/auxvec.h \ + include/linux/prio_tree.h include/linux/completion.h \ + include/asm/semaphore.h include/asm/semaphore_32.h \ + include/asm/cputime.h include/asm-generic/cputime.h include/linux/sem.h \ + include/linux/ipc.h include/asm/ipcbuf.h include/asm/sembuf.h \ + include/linux/signal.h include/asm/signal.h \ + include/asm-generic/signal.h include/asm/siginfo.h \ + include/asm-generic/siginfo.h include/linux/securebits.h \ + include/linux/fs_struct.h include/linux/pid.h include/linux/rcupdate.h \ + include/linux/proportions.h include/linux/percpu_counter.h \ + include/linux/seccomp.h include/asm/seccomp.h include/asm/seccomp_32.h \ + include/linux/unistd.h include/asm/unistd.h include/asm/unistd_32.h \ + include/linux/futex.h include/linux/rtmutex.h include/linux/plist.h \ + include/linux/param.h include/linux/resource.h include/asm/resource.h \ + include/asm-generic/resource.h include/linux/hrtimer.h \ + include/linux/task_io_accounting.h include/linux/aio.h \ + include/linux/aio_abi.h include/linux/uio.h include/linux/mm.h \ + include/linux/debug_locks.h include/linux/security.h include/linux/fs.h \ + include/linux/limits.h include/linux/ioctl.h include/asm/ioctl.h \ + include/asm-generic/ioctl.h include/linux/kdev_t.h \ + include/linux/dcache.h include/linux/namei.h include/linux/radix-tree.h \ + include/linux/quota.h include/linux/dqblk_xfs.h \ + include/linux/dqblk_v1.h include/linux/dqblk_v2.h \ + include/linux/nfs_fs_i.h include/linux/nfs.h \ + include/linux/sunrpc/msg_prot.h include/linux/fcntl.h \ + include/asm/fcntl.h include/asm-generic/fcntl.h include/linux/err.h \ + include/linux/binfmts.h include/linux/shm.h include/asm/shmparam.h \ + include/asm/shmbuf.h include/linux/msg.h include/asm/msgbuf.h \ + include/linux/key.h include/linux/xfrm.h include/net/flow.h \ + include/linux/in6.h include/asm/pgtable.h include/asm/pgtable_32.h \ + include/asm/paravirt.h include/asm/pgtable-2level-defs.h \ + include/asm/pgtable-2level.h include/asm-generic/pgtable.h \ + include/linux/page-flags.h include/linux/vmstat.h include/linux/ctype.h \ + include/net/ip.h include/linux/ip.h include/linux/skbuff.h \ + include/linux/net.h include/asm/socket.h include/asm/sockios.h \ + include/linux/random.h include/linux/sysctl.h \ + include/linux/textsearch.h include/net/checksum.h include/asm/uaccess.h \ + include/asm/uaccess_32.h include/asm/checksum.h \ + include/asm/checksum_32.h include/linux/dmaengine.h \ + include/linux/device.h include/linux/ioport.h include/linux/klist.h \ + include/asm/device.h include/linux/dma-mapping.h \ + include/asm/dma-mapping.h include/asm/dma-mapping_32.h \ + include/linux/scatterlist.h include/asm/scatterlist.h \ + include/asm/scatterlist_32.h include/asm/io.h include/asm/io_32.h \ + include/asm-generic/iomap.h include/linux/vmalloc.h include/linux/in.h \ + include/linux/socket.h include/linux/sockios.h include/net/inet_sock.h \ + include/linux/jhash.h include/net/sock.h include/linux/netdevice.h \ + include/linux/if.h include/linux/hdlc/ioctl.h include/linux/if_ether.h \ + include/linux/if_packet.h include/net/net_namespace.h \ + include/linux/interrupt.h include/linux/irqreturn.h \ + include/linux/hardirq.h include/linux/smp_lock.h include/asm/hardirq.h \ + include/asm/hardirq_32.h include/linux/irq.h include/asm/irq.h \ + include/asm/irq_32.h include/asm-x86/mach-default/irq_vectors.h \ + include/asm-x86/mach-default/irq_vectors_limits.h \ + include/asm/irq_regs.h include/asm/irq_regs_32.h include/asm/hw_irq.h \ + include/asm/hw_irq_32.h include/linux/profile.h include/asm/sections.h \ + include/asm-generic/sections.h include/linux/irq_cpustat.h \ + include/linux/filter.h include/net/dst.h include/linux/rtnetlink.h \ + include/linux/netlink.h include/linux/if_link.h include/linux/if_addr.h \ + include/linux/neighbour.h include/net/neighbour.h \ + include/linux/seq_file.h include/net/rtnetlink.h include/net/netlink.h \ + include/net/request_sock.h include/net/route.h include/net/inetpeer.h \ + include/linux/in_route.h include/linux/route.h include/net/snmp.h \ + include/linux/snmp.h include/linux/ipv6.h include/linux/icmpv6.h \ + include/linux/tcp.h include/net/inet_connection_sock.h \ + include/linux/poll.h include/asm/poll.h include/asm-generic/poll.h \ + include/net/inet_timewait_sock.h include/net/tcp_states.h \ + include/net/timewait_sock.h include/linux/udp.h include/net/protocol.h \ + include/linux/wireless.h include/linux/inet.h include/linux/pci.h \ + include/linux/pci_regs.h include/linux/mod_devicetable.h \ + include/linux/pci_ids.h include/linux/dmapool.h include/asm/pci.h \ + include/asm/pci_32.h include/asm-generic/pci-dma-compat.h \ + include/asm-generic/pci.h include/linux/if_arp.h \ + include/linux/pkt_sched.h include/linux/etherdevice.h \ + include/linux/inetdevice.h include/net/inet_common.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/wanpipe_defines.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/wanpipe_version.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/wanpipe_kernel.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/wanpipe_abstr_types.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/wanpipe.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/wanpipe_debug.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/wanpipe_common.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/wanpipe_events.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/wanpipe_cfg.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/sdla_56k.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/sdla_te1.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/sdla_te3.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/sdla_remora.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/sdla_remora_proslic.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/sdla_bri.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/xhfc24succ.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/sdla_serial.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/sdla_front_end.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/wanrouter.h \ + include/linux/proc_fs.h include/linux/magic.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/sdla_tdmv.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/sdlasfm.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/sdladrv.h \ + include/linux/serial.h include/linux/serialP.h include/linux/termios.h \ + include/asm/termios.h include/asm/termbits.h include/asm/ioctls.h \ + include/linux/circ_buf.h include/linux/serial_reg.h \ + include/asm/serial.h include/linux/tty.h include/linux/major.h \ + include/linux/tty_driver.h include/linux/cdev.h \ + include/linux/tty_ldisc.h include/linux/tty_flip.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/if_wanpipe_kernel.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/if_wanpipe.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/if_wanpipe_common.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/wanpipe_x25_kernel.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/wanpipe_dsp_kernel.h \ + /root/development/3.3/wanpipe-3.3.2.p16/patches/kdrivers/include/linux/wanpipe_x25_kernel.h diff --git a/patches/kdrivers/src/wanrouter/af_wanpipe.c b/patches/kdrivers/src/wanrouter/af_wanpipe.c index 0ec28ae..f1803f6 100644 --- a/patches/kdrivers/src/wanrouter/af_wanpipe.c +++ b/patches/kdrivers/src/wanrouter/af_wanpipe.c @@ -142,7 +142,7 @@ static atomic_t af_skb_alloc; atomic_t wanpipe_socks_nr; extern struct proto_ops wanpipe_ops; -static struct sock *wanpipe_alloc_socket(struct sock *, void *net); +static struct sock *wanpipe_alloc_socket(void); static void check_write_queue(struct sock *); @@ -305,6 +305,8 @@ dev_private_ioctl: /*NOTREACHED*/ } + + /*============================================================ * wanpipe_make_new * @@ -325,7 +327,7 @@ struct sock *wanpipe_make_new(struct sock *osk) if (osk->sk_type != SOCK_RAW) return NULL; - if ((sk = wanpipe_alloc_socket(osk,NULL)) == NULL) + if ((sk = wanpipe_alloc_socket()) == NULL) return NULL; sk->sk_family = osk->sk_family; @@ -711,10 +713,8 @@ static int wanpipe_api_sock_rcv(struct sk_buff *skb, netdevice_t *dev, struct s sll->sll_ifindex = dev->ifindex; sll->sll_halen = 0; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23) if (dev->hard_header_parse) sll->sll_halen = dev->hard_header_parse(skb, sll->sll_addr); -#endif /* * WAN_PACKET_DATA : Data which should be passed up the receive queue. @@ -770,7 +770,8 @@ static int wanpipe_api_sock_rcv(struct sk_buff *skb, netdevice_t *dev, struct s } break; default: - printk(KERN_INFO "af_wanpipe: BH Illegal Packet Type Dropping\n"); + printk(KERN_INFO "af_wanpipe: BH Illegal Packet Type Dropping %i\n",skb->pkt_type); + WARN_ON(1); KFREE_SKB(skb); break; } @@ -788,39 +789,22 @@ static int wanpipe_api_sock_rcv(struct sk_buff *skb, netdevice_t *dev, struct s * *===========================================================*/ -static struct sock *wanpipe_alloc_socket(struct sock *osk, void *net) +static struct sock *wanpipe_alloc_socket(void) { struct sock *sk; struct wanpipe_opt *wan_opt; #ifdef LINUX_2_6 - -# if defined(LINUX_FEAT_2624) - if (!osk && !net) { - DEBUG_EVENT("%s:%d ASSERT osk net pointer = NULL! \n", - __FUNCTION__,__LINE__); - return NULL; - } - - if (osk) { - net=osk->sk_net; - } - - sk = sk_alloc((struct net*)net, PF_WANPIPE, GFP_ATOMIC, &packet_proto); - -# elif defined(AF_WANPIPE_2612_UPDATE) - sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, &packet_proto,1); -# else - sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, 1,NULL); -# endif +#ifdef AF_WANPIPE_2612_UPDATE + if ((sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, &packet_proto,1)) == NULL) #else - sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, 1); + if ((sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, 1,NULL)) == NULL) +#endif +#else + if ((sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, 1)) == NULL) #endif - - if (sk == NULL) { return NULL; - } if ((wan_opt = kmalloc(sizeof(struct wanpipe_opt), GFP_ATOMIC)) == NULL) { sk_free(sk); @@ -949,7 +933,6 @@ static int wanpipe_sendmsg(struct socket *sock, struct msghdr *msg, int len, goto out_free; } -#ifndef LINUX_FEAT_2624 if (dev->hard_header) { int res; err = -EINVAL; @@ -958,7 +941,6 @@ static int wanpipe_sendmsg(struct socket *sock, struct msghdr *msg, int len, goto out_free; } } -#endif skb->protocol = proto; skb->priority = sk->sk_priority; @@ -1328,7 +1310,7 @@ static int wanpipe_bind(struct socket *sock, struct sockaddr *uaddr, int addr_le * we are finshed with the device we should run * dev_put() to release it */ #if defined(LINUX_2_4)||defined(LINUX_2_6) - dev = wan_dev_get_by_name(name); + dev = dev_get_by_name(name); #else dev = dev_get(name); #endif @@ -1369,7 +1351,7 @@ wanpipe_svc_connect_skip: err=-EINVAL; }else{ sk->sk_state = WANSOCK_DISCONNECTED; - SK_PRIV(sk)->dev=wan_dev_get_by_index(sk->sk_bound_dev_if); + SK_PRIV(sk)->dev=dev_get_by_index(sk->sk_bound_dev_if); if (SK_PRIV(sk)->dev){ err=0; }else{ @@ -1395,7 +1377,7 @@ wanpipe_svc_connect_skip: * dev_put() to release it */ #if defined(LINUX_2_4)||defined(LINUX_2_6) - dev = wan_dev_get_by_name(name); + dev = dev_get_by_name(name); #else dev = dev_get(name); #endif @@ -1439,7 +1421,7 @@ wanpipe_svc_listen_skip: name[14]=0; #if defined(LINUX_2_4)||defined(LINUX_2_6) - dev = wan_dev_get_by_name(name); + dev = dev_get_by_name(name); #else dev = dev_get(name); #endif @@ -1509,26 +1491,17 @@ wanpipe_svc_listen_skip: * Crates AF_WANPIPE socket. *===========================================================*/ -#ifdef LINUX_FEAT_2624 -int wanpipe_create(struct net *net, struct socket *sock, int protocol) -#else int wanpipe_create(struct socket *sock, int protocol) -#endif { struct sock *sk; unsigned long flags; - -#ifndef LINUX_FEAT_2624 - /* Used to fake the net structure for lower kernels */ - void *net = NULL; -#endif - + if (sock->type != SOCK_RAW) return -ESOCKTNOSUPPORT; sock->state = SS_UNCONNECTED; - if ((sk = wanpipe_alloc_socket(NULL, net)) == NULL){ + if ((sk = wanpipe_alloc_socket()) == NULL){ return -ENOMEM; } diff --git a/patches/kdrivers/src/wanrouter/af_wanpipe_datascope.o b/patches/kdrivers/src/wanrouter/af_wanpipe_datascope.o index 7466552..a4a8955 100644 Binary files a/patches/kdrivers/src/wanrouter/af_wanpipe_datascope.o and b/patches/kdrivers/src/wanrouter/af_wanpipe_datascope.o differ diff --git a/patches/kdrivers/src/wanrouter/af_wanpipe_src.o b/patches/kdrivers/src/wanrouter/af_wanpipe_src.o deleted file mode 100644 index efcf4a7..0000000 Binary files a/patches/kdrivers/src/wanrouter/af_wanpipe_src.o and /dev/null differ diff --git a/patches/kdrivers/src/wanrouter/waniface.o b/patches/kdrivers/src/wanrouter/waniface.o index 9d2fcac..df33f9d 100644 Binary files a/patches/kdrivers/src/wanrouter/waniface.o and b/patches/kdrivers/src/wanrouter/waniface.o differ diff --git a/patches/kdrivers/src/wanrouter/wanmain.c b/patches/kdrivers/src/wanrouter/wanmain.c index 72d5c81..5b8eee6 100644 --- a/patches/kdrivers/src/wanrouter/wanmain.c +++ b/patches/kdrivers/src/wanrouter/wanmain.c @@ -254,7 +254,7 @@ int __init wanrouter_init (void) } WAN_LIST_INIT(&wan_devlist); - wan_spin_lock_init(&wan_devlist_lock); + wan_spin_lock_init(&wan_devlist_lock,"wan_devlist_lock"); err = wanrouter_proc_init(); @@ -360,7 +360,7 @@ int register_wan_device(wan_device_t *wandev) wandev->ndev = 0; WAN_LIST_INIT(&wandev->dev_head); - wan_spin_lock_init(&wandev->dev_head_lock); + wan_spin_lock_init(&wandev->dev_head_lock, "wan_dev_head_lock"); wan_spin_lock(&wan_devlist_lock); WAN_LIST_INSERT_HEAD(&wan_devlist, wandev, next); @@ -885,7 +885,7 @@ static int wan_device_new_if (wan_device_t *wandev, wanif_conf_t *u_conf) } - if ((dev=wan_dev_get_by_name(conf->name))){ + if ((dev=dev_get_by_name(conf->name))){ dev_put(dev); dev=NULL; err = -EEXIST; /* name already exists */ @@ -917,7 +917,7 @@ static int wan_device_new_if (wan_device_t *wandev, wanif_conf_t *u_conf) if (dev->name == NULL){ err = -EINVAL; - }else if ((tmp_dev=wan_dev_get_by_name(dev->name))){ + }else if ((tmp_dev=dev_get_by_name(dev->name))){ dev_put(tmp_dev); err = -EEXIST; /* name already exists */ }else if (dev->priv){ @@ -990,8 +990,8 @@ static int wan_device_del_if (wan_device_t *wandev, char *u_name) } if (devle == NULL || dev == NULL){ - if ((dev = wan_dev_get_by_name(name)) == NULL){ - printk(KERN_INFO "%s: wan_dev_get_by_name failed\n", name); + if ((dev = dev_get_by_name(name)) == NULL){ + printk(KERN_INFO "%s: dev_get_by_name failed\n", name); return err; } @@ -1522,7 +1522,7 @@ static int wan_device_new_if_lapb (wan_device_t *wandev, wanif_conf_t *u_conf) goto wan_device_new_if_lapb_exit; } - if ((tmp_dev=wan_dev_get_by_name(conf->name)) != NULL){ + if ((tmp_dev=dev_get_by_name(conf->name)) != NULL){ printk(KERN_INFO "%s: Device already exists!\n", conf->name); dev_put(tmp_dev); @@ -1662,7 +1662,7 @@ static int wan_device_new_if_x25 (wan_device_t *wandev, wanif_conf_t *u_conf) goto wan_device_new_if_x25_exit; } - if ((tmp_dev=wan_dev_get_by_name(conf->name)) != NULL){ + if ((tmp_dev=dev_get_by_name(conf->name)) != NULL){ printk(KERN_INFO "%s: Device already exists!\n", conf->name); dev_put(tmp_dev); @@ -1686,7 +1686,7 @@ static int wan_device_new_if_x25 (wan_device_t *wandev, wanif_conf_t *u_conf) } //Find a master device for our x25 lcn - if ((dev = wan_dev_get_by_name(conf->master)) == NULL){ + if ((dev = dev_get_by_name(conf->master)) == NULL){ printk(KERN_INFO "%s: Master device %s used by X25 SVC %s no found!\n", wandev->name,conf->master,conf->name); goto wan_device_new_if_x25_exit; @@ -1773,7 +1773,7 @@ static int wan_device_new_if_dsp (wan_device_t *wandev, wanif_conf_t *u_conf) goto wan_device_new_if_dsp_exit; } - if ((tmp_dev=wan_dev_get_by_name(conf->name)) != NULL){ + if ((tmp_dev=dev_get_by_name(conf->name)) != NULL){ printk(KERN_INFO "%s: Device already exists!\n", conf->name); dev_put(tmp_dev); @@ -1792,7 +1792,7 @@ static int wan_device_new_if_dsp (wan_device_t *wandev, wanif_conf_t *u_conf) } //Find a master device for our x25 lcn - if ((dev = wan_dev_get_by_name(conf->master)) == NULL){ + if ((dev = dev_get_by_name(conf->master)) == NULL){ printk(KERN_INFO "%s: Master device %s, no found for %s\n", wandev->name, conf->master,conf->name); goto wan_device_new_if_dsp_exit; @@ -1918,7 +1918,7 @@ static int wan_device_new_if_lip (wan_device_t *wandev, wanif_conf_t *u_conf) goto wan_device_new_if_lip_exit; } - if ((tmp_dev=wan_dev_get_by_name(conf->name)) != NULL){ + if ((tmp_dev=dev_get_by_name(conf->name)) != NULL){ printk(KERN_INFO "%s: Device already exists!\n", conf->name); dev_put(tmp_dev); @@ -1936,7 +1936,7 @@ static int wan_device_new_if_lip (wan_device_t *wandev, wanif_conf_t *u_conf) } //Find a master device lip device - if ((dev = wan_dev_get_by_name(conf->master)) == NULL){ + if ((dev = dev_get_by_name(conf->master)) == NULL){ printk(KERN_INFO "%s: Master device %s used by LIP %s no found!\n", wandev->name,conf->master,conf->name); goto wan_device_new_if_lip_exit; @@ -2033,12 +2033,12 @@ void unregister_wanec_iface (void) return; } -void *wanpipe_ec_register(void *pcard, int max_channels) +void *wanpipe_ec_register(void *pcard, u_int32_t fe_port_mask, int max_line_no, int max_channels, void *conf) { if (!IS_PROTOCOL_FUNC(wanec_iface)) return NULL; if (wanec_iface.reg){ - return wanec_iface.reg(pcard, max_channels); + return wanec_iface.reg(pcard, fe_port_mask, max_line_no, max_channels, conf); } return NULL; } @@ -2060,11 +2060,11 @@ int wanpipe_ec_event_ctrl(void *arg, void *pcard, wan_event_ctrl_t *event_ctrl) return 0; } -int wanpipe_ec_isr(void *arg, void *pcard) +int wanpipe_ec_isr(void *arg) { if (!IS_PROTOCOL_FUNC(wanec_iface)) return 0; if (wanec_iface.isr){ - return wanec_iface.isr(arg, pcard); + return wanec_iface.isr(arg); } return 0; } @@ -2120,14 +2120,12 @@ int wan_run_wanrouter(char * hwdevname, char *devname, char *action) __FUNCTION__); return -EINVAL; } - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) + if (!current->fs->root) { /* statically linked USB is initted rather early */ DEBUG_EVENT ("%s: Error: no FS yet",__FUNCTION__); return -ENODEV; } -#endif if (!(envp = (char **) kmalloc (20 * sizeof (char *), GFP_KERNEL))) { DEBUG_EVENT ("%s: Error: no memory!",__FUNCTION__); diff --git a/patches/kdrivers/src/wanrouter/wanmain.o b/patches/kdrivers/src/wanrouter/wanmain.o index ac610ad..ce3aa32 100644 Binary files a/patches/kdrivers/src/wanrouter/wanmain.o and b/patches/kdrivers/src/wanrouter/wanmain.o differ diff --git a/patches/kdrivers/src/wanrouter/wanproc.c b/patches/kdrivers/src/wanrouter/wanproc.c index f08d97c..2c122b8 100644 --- a/patches/kdrivers/src/wanrouter/wanproc.c +++ b/patches/kdrivers/src/wanrouter/wanproc.c @@ -114,10 +114,6 @@ typedef struct wan_proc_entry #endif /****** Function Prototypes *************************************************/ -#ifdef WAN_DEBUG_MEM -extern atomic_t wan_debug_mem; -#endif - extern wan_spinlock_t wan_devlist_lock; extern struct wan_devlist_ wan_devlist; @@ -531,7 +527,7 @@ static int config_get_info(char* buf, char** start, off_t offs, int len, int dum wan_spin_lock(&wan_devlist_lock); WAN_LIST_FOREACH(wandev, &wan_devlist, next){ /*for (wandev = router_devlist; wandev; wandev = wandev->next){*/ - sdla_t* card = (sdla_t*)wandev->private; + sdla_t* card = (sdla_t*)wandev->priv; u16 arg = 0; if (!wandev->state) continue; @@ -700,9 +696,7 @@ static int interfaces_get_info(char* buf, char** start, off_t offs, int len, int WAN_LIST_FOREACH(devle, &wandev->dev_head, dev_link){ dev = WAN_DEVLE2DEV(devle); - if (!dev || - !(wan_netif_flags(dev)&IFF_UP) || - !wan_netif_priv(dev)){ + if (!dev || !WAN_NETIF_UP(dev) || !wan_netif_priv(dev)){ continue; } @@ -760,7 +754,7 @@ static int probe_get_info(char* buf, char** start, off_t offs, int len, int dumm hw_cnt=(sdla_hw_type_cnt_t*)sdla_get_hw_adptr_cnt(); PROC_ADD_LINE(m, - "\nCard Cnt: S508=%-2d S514X=%-2d S518=%-2d A101-2=%-2d A104=%-2d A300=%-2d A200=%-2d A108=%-2d A056=%-2d\n", + "\nCard Cnt: S508=%d S514X=%d S518=%d A101-2=%d A104=%d A300=%d A200=%d A108=%d A056=%d\n A500=%d A14x=%d\n", hw_cnt->s508_adapters, hw_cnt->s514x_adapters, hw_cnt->s518_adapters, @@ -769,13 +763,10 @@ static int probe_get_info(char* buf, char** start, off_t offs, int len, int dumm hw_cnt->aft300_adapters, hw_cnt->aft200_adapters, hw_cnt->aft108_adapters, - hw_cnt->aft_56k_adapters); - -#ifdef WAN_DEBUG_MEM - PROC_ADD_LINE(m, - - "Total Memory = %d\n", atomic_read(&wan_debug_mem)); -#endif + hw_cnt->aft_56k_adapters, + hw_cnt->aft_isdn_adapters, + hw_cnt->aft_serial_adapters + ); PROC_ADD_RET(m); } @@ -783,13 +774,13 @@ static int probe_get_info(char* buf, char** start, off_t offs, int len, int dumm #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(LINUX_2_4) STATIC int probe_get_info_verbose(char* buf, char** start, off_t offs, int len) #else -#if defined(LINUX_2_6) +# if defined(LINUX_2_6) static int probe_get_info_verbose(struct seq_file *m, void *v) -#elif defined(LINUX_2_4) +# elif defined(LINUX_2_4) static int probe_get_info_verbose(char* buf, char** start, off_t offs, int len) -#else +# else static int probe_get_info_verbose(char* buf, char** start, off_t offs, int len, int dummy) -#endif +# endif #endif { int i=0; @@ -818,7 +809,7 @@ static int probe_get_info_verbose(char* buf, char** start, off_t offs, int len, hw_cnt=(sdla_hw_type_cnt_t*)sdla_get_hw_adptr_cnt(); PROC_ADD_LINE(m, - "\nCard Cnt: S508=%-2d S514X=%-2d S518=%-2d A101-2=%-2d A104=%-2d A300=%-2d A200=%-2d A108=%-2d\n", + "\nCard Cnt: S508=%d S514X=%d S518=%d A101-2=%d A104=%d A300=%d A200=%d A108=%d A056=%d\n A500=%d A14x=%d\n", hw_cnt->s508_adapters, hw_cnt->s514x_adapters, hw_cnt->s518_adapters, @@ -826,12 +817,11 @@ static int probe_get_info_verbose(char* buf, char** start, off_t offs, int len, hw_cnt->aft104_adapters, hw_cnt->aft300_adapters, hw_cnt->aft200_adapters, - hw_cnt->aft108_adapters); -#ifdef WAN_DEBUG_MEM - PROC_ADD_LINE(m, - - "Total Memory = %d\n", atomic_read(&wan_debug_mem)); -#endif + hw_cnt->aft108_adapters, + hw_cnt->aft_56k_adapters, + hw_cnt->aft_isdn_adapters, + hw_cnt->aft_serial_adapters + ); PROC_ADD_RET(m); } @@ -942,7 +932,7 @@ static int wandev_get_info(char* buf, char** start, off_t offs, int len, int dum /* Update Front-End information (alarms, performance monitor counters */ if (wandev->get_info){ m->count = wandev->get_info( - wandev->private, + wandev->priv, m, M_STOP_CNT(m)); } @@ -962,7 +952,7 @@ wandev_get_info_end: int wanrouter_proc_init (void) { struct proc_dir_entry *p; - proc_router = proc_mkdir(ROUTER_NAME, wan_init_net(proc_net)); + proc_router = proc_mkdir(ROUTER_NAME, proc_net); if (!proc_router) goto fail; @@ -1092,7 +1082,7 @@ fail_probe_verbose: fail_stat: remove_proc_entry("config", proc_router); fail_config: - remove_proc_entry(ROUTER_NAME, wan_init_net(proc_net)); + remove_proc_entry(ROUTER_NAME, proc_net); fail: return -ENOMEM; } @@ -1117,7 +1107,7 @@ void wanrouter_proc_cleanup (void) remove_proc_entry("map", proc_router); remove_proc_entry("interfaces", proc_router); remove_proc_entry("dev_map",proc_router); - remove_proc_entry(ROUTER_NAME,wan_init_net(proc_net)); + remove_proc_entry(ROUTER_NAME,proc_net); } /* @@ -1129,7 +1119,7 @@ int wanrouter_proc_add (wan_device_t* wandev) int err=0; struct proc_dir_entry *p; - spin_lock_init(&wandev->get_map_lock); + wan_spin_lock_init(&wandev->get_map_lock, "wan_proc_lock"); if (wandev->magic != ROUTER_MAGIC) return -EINVAL; diff --git a/patches/kdrivers/src/wanrouter/wanproc.o b/patches/kdrivers/src/wanrouter/wanproc.o index adafec9..2f55ba8 100644 Binary files a/patches/kdrivers/src/wanrouter/wanproc.o and b/patches/kdrivers/src/wanrouter/wanproc.o differ diff --git a/patches/kdrivers/wanec/.#wanec_cmd.c.1.49 b/patches/kdrivers/wanec/.#wanec_cmd.c.1.49 new file mode 100644 index 0000000..1edfe89 --- /dev/null +++ b/patches/kdrivers/wanec/.#wanec_cmd.c.1.49 @@ -0,0 +1,2176 @@ +/************************************************************* + * wanec_cmd.c WANPIPE Echo Canceller Layer (WANEC_LIP) + * + * + * + * =========================================================== + * + * May 10 2006 Alex Feldman Initial Version + * + * March 19, 2006 Alex Feldman Enable Sout Adaptive Noise + * Reduction for all channel by + * default. + */ + + +/*============================================================= + * Includes + */ + +#if defined(__FreeBSD__) || defined(__OpenBSD__) +# include +# include +# include +#elif defined(__LINUX__) +# include +# include +# include +# include +#elif defined(__WINDOWS__) +# include +# include +# include +#endif + +int verbose; + +#include "oct6100_api.h" +#include "oct6100_version.h" + +#include "wanec_iface.h" +#include "wanec_tones.h" + +/*============================================================= + * Definitions + */ +#define WANEC_MAX_PORT_RANGE 32 +#define WANEC_MAX_BRI_PORT_RANGE 2 +#define WANEC_READ_LIMIT 0x10000 + +#define WANEC_MAX_CONFBRIDGE_DEF 32 +#define WANEC_MAC_PLAYOUT_BUFFERS 20 + +//FIXME: Take this out +#warning "WAN_MEDIA_BRI is localy defined to 0: do not commit" +#define WAN_MEDIA_BRI 0 +/*============================================================= + * Global Parameters + */ +UINT32 DetectedSoutToneNumbers[WAN_NUM_DTMF_TONES] = +{ + SOUT_DTMF_0, + SOUT_DTMF_1, + SOUT_DTMF_2, + SOUT_DTMF_3, + SOUT_DTMF_4, + SOUT_DTMF_5, + SOUT_DTMF_6, + SOUT_DTMF_7, + SOUT_DTMF_8, + SOUT_DTMF_9, + SOUT_DTMF_A, + SOUT_DTMF_B, + SOUT_DTMF_C, + SOUT_DTMF_D, + SOUT_DTMF_STAR, + SOUT_DTMF_POUND, +}; +UINT32 DetectedRoutToneNumbers[WAN_NUM_DTMF_TONES] = +{ + ROUT_DTMF_0, + ROUT_DTMF_1, + ROUT_DTMF_2, + ROUT_DTMF_3, + ROUT_DTMF_4, + ROUT_DTMF_5, + ROUT_DTMF_6, + ROUT_DTMF_7, + ROUT_DTMF_8, + ROUT_DTMF_9, + ROUT_DTMF_A, + ROUT_DTMF_B, + ROUT_DTMF_C, + ROUT_DTMF_D, + ROUT_DTMF_STAR, + ROUT_DTMF_POUND +}; + +/*============================================================= + * Function prototype +*/ + +int wanec_ChipOpenPrep(wan_ec_dev_t *ec_dev, char *devname, wanec_config_t *config, int verbose); +int wanec_ChipOpen(wan_ec_dev_t*, int); +int wanec_ChipClose(wan_ec_dev_t*, int verbose); +int wanec_ChipStats(wan_ec_dev_t *ec_dev, wanec_chip_stats_t *chip_stats, int reset, int verbose); + +int wanec_ChannelOpen(wan_ec_dev_t*, int); +int wanec_ChannelClose(wan_ec_dev_t*, int); +int wanec_ChannelModify(wan_ec_dev_t*, INT, wanec_chan_modify_t*, int verbose); +int wanec_ChannelStats(wan_ec_dev_t*, INT channel, wanec_chan_stats_t *chan_stats, int reset); + +int wanec_ChannelMute(wan_ec_dev_t*, INT channel, unsigned char port_mask, int); +int wanec_ChannelUnMute(wan_ec_dev_t*, INT channel, unsigned char port_mask, int); + +int wanec_TonesEnable(wan_ec_t *ec, int channel, unsigned char port, int verbose); +int wanec_TonesDisable(wan_ec_t *ec, int channel, unsigned char port, int verbose); + +int wanec_DebugChannel(wan_ec_dev_t*, INT channel, int verbose); +int wanec_DebugGetData(wan_ec_dev_t*, wanec_chan_monitor_t *chan_monitor, int verbose); + +int wanec_BufferLoad(wan_ec_dev_t *ec_dev, wanec_tone_config_t *tone_config, int verbose); +int wanec_BufferUnload(wan_ec_dev_t *ec_dev, wanec_tone_config_t *tone_config, int verbose); +int wanec_BufferPlayoutAdd(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose); +int wanec_BufferPlayoutStart(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose); +int wanec_BufferPlayoutStop(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose); + +int wanec_ConfBridgeOpen(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose); +int wanec_ConfBridgeClose(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose); + +int wanec_EventTone(wan_ec_t *ec, int verbose); +int wanec_ISR(wan_ec_t *ec, int verbose); + +int wanec_fe2ec_channel(wan_ec_dev_t*, int); +static int wanec_hndl2ec_channel(wan_ec_t *ec, UINT32 ChannelHndl); +static int wanec_ec2fe_channel(wan_ec_t*, int, wan_ec_dev_t**); + +extern int wanec_ChipParam(wan_ec_t*,tPOCT6100_CHIP_OPEN, wan_custom_conf_t*, int); +extern int wanec_ChanParam(wan_ec_t*,tPOCT6100_CHANNEL_MODIFY, wan_custom_conf_t*, int); +extern int wanec_ChanParamList(wan_ec_t *ec); + +u32 wanec_req_write(void*, u32 write_addr, u16 write_data); +u32 wanec_req_write_smear(void*, u32 addr, u16 data, u32 len); +u32 wanec_req_write_burst(void*, u32 addr, u16 *data, u32 len); +u32 wanec_req_read(void*, u32 addr, u16 *data); +u32 wanec_req_read_burst(void*, u32 addr, u16 *data, u32 len); + +extern int wan_ec_write_internal_dword(wan_ec_dev_t *ec_dev, u32 addr1, u32 data); +extern int wan_ec_read_internal_dword(wan_ec_dev_t *ec_dev, u32 addr1, u32 *data); + +/*============================================================= + * Function definition +*/ +static int wanec_hndl2ec_channel(wan_ec_t *ec, UINT32 ChannelHndl) +{ + int channel = 0; + + for(channel = 0; channel < ec->max_channels; channel++){ + if (ec->pEchoChannelHndl[channel] == ChannelHndl){ + return channel; + } + } + return 0; +} +int wanec_fe2ec_channel(wan_ec_dev_t *ec_dev, int fe_channel) +{ + int ec_channel = 0; + + if (ec_dev->fe_media == WAN_MEDIA_BRI){ + if (ec_dev->fe_lineno >= 12){ + ec_channel = WANEC_MAX_PORT_RANGE; + } + ec_channel += (ec_dev->fe_lineno * WANEC_MAX_BRI_PORT_RANGE + (fe_channel-1)); + }else{ + /*ec_channel = ec_dev->fe_lineno * ec_dev->fe_max_channels + channel;*/ + ec_channel = ec_dev->fe_lineno * WANEC_MAX_PORT_RANGE + fe_channel; + } + return ec_channel; +} + +static int wanec_ec2fe_channel(wan_ec_t *ec, int ec_chan, wan_ec_dev_t **ec_dev) +{ + int fe_chan; + + *ec_dev = ec->pEcDevMap[ec_chan]; + if (*ec_dev == NULL) return 0; + + fe_chan = ec_chan % WANEC_MAX_PORT_RANGE; + if ((*ec_dev)->fe_media == WAN_MEDIA_BRI){ + fe_chan = fe_chan % WANEC_MAX_BRI_PORT_RANGE; + fe_chan++; + }else{ + if ((*ec_dev)->fe_media == WAN_MEDIA_T1 || + (*ec_dev)->fe_media == WAN_MEDIA_FXOFXS){ + fe_chan++; + } + } + return fe_chan; +} + + +/****************************************************************** +** +** +*******************************************************************/ +tOCT6100_CHIP_IMAGE_INFO f_ChipImageInfo; +#if 0 +tOCT6100_GET_HW_REVISION f_Revision; +#endif +int wanec_ChipStats(wan_ec_dev_t *ec_dev, wanec_chip_stats_t *chip_stats, int reset, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHIP_STATS f_ChipStats; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + if (chip_stats){ + PRINT1(verbose, "%s: Reading chip statistics...\n", + ec->name); + } + Oct6100ChipGetStatsDef( &f_ChipStats ); + f_ChipStats.fResetChipStats = reset; + ulResult = Oct6100ChipGetStats( + ec->pChipInstance, + &f_ChipStats); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "%s: Reading chip statistics...\tFailed (err=0x%X)\n", + ec->name, ulResult); + return -EINVAL; + } + if (chip_stats){ + memcpy( &chip_stats->f_ChipStats, + &f_ChipStats, + sizeof(tOCT6100_CHIP_STATS)); + } + + if (chip_stats){ + PRINT1(verbose, "%s: Reading chip image info...\n", + ec->name); + } + + Oct6100ChipGetImageInfoDef( &f_ChipImageInfo ); + ulResult = Oct6100ChipGetImageInfo( + ec->pChipInstance, + &f_ChipImageInfo); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "%s: Reading chip image info...\tFailed (err=0x%X)\n", + ec->name, ulResult); + return -EINVAL; + } + if (chip_stats){ + if (chip_stats->f_ChipImageInfo){ + int err; + err = WAN_COPY_TO_USER( + &f_ChipImageInfo, + chip_stats->f_ChipImageInfo, + sizeof(tOCT6100_CHIP_IMAGE_INFO)); + if (err){ + DEBUG_EVENT( + "%s: Failed to copy chip image info to user space [%s:%d]!\n", + ec->name, __FUNCTION__,__LINE__); + return -EINVAL; + } + }else{ + PRINT1(verbose, + "%s: Echo Canceller image description:\n%s\n", + ec->name, f_ChipImageInfo.szVersionNumber); + PRINT1(verbose, + "%s: Echo Canceller image build ID\t\t\t%08X\n", + ec->name, f_ChipImageInfo.ulBuildId); + PRINT1(verbose, + "%s: Echo Canceller maximum number of channels\t%d\n", + ec->name, f_ChipImageInfo.ulMaxChannels); +#if 0 + PRINT1(verbose, + "%s: Echo Canceller maximum tail displacement\t\t%d\n", + ec->name, f_ChipImageInfo.ulMaxTailDisplacement); + PRINT1(verbose, + "%s: Echo Canceller per channel tail displacement\t%s\n", + ec->name, + (f_ChipImageInfo.fPerChannelTailDisplacement == TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller per channel tail length\t\t%s\n", + ec->name, + (f_ChipImageInfo.fPerChannelTailLength == TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller maximum tail length\t\t%d\n", + ec->name, f_ChipImageInfo.ulMaxTailLength); + PRINT1(verbose, + "%s: Echo Canceller buffer Playout support\t\t%s\n", + ec->name, + (f_ChipImageInfo.fBufferPlayout == TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller adaptive noise reduction\t\t%s\n", + ec->name, + (f_ChipImageInfo.fAdaptiveNoiseReduction==TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller SOUT noise bleaching\t\t%s\n", + ec->name, + (f_ChipImageInfo.fSoutNoiseBleaching==TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller ROUT noise reduction\t\t%s\n", + ec->name, + (f_ChipImageInfo.fRoutNoiseReduction==TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller ROUT noise reduction level\t\t%s\n", + ec->name, + (f_ChipImageInfo.fRoutNoiseReductionLevel==TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller automatic level control\t\t%s\n", + ec->name, + (f_ChipImageInfo.fAutoLevelControl==TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller acoustic echo cancellation\t\t%s\n", + ec->name, + (f_ChipImageInfo.fAcousticEcho==TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller conferencing\t\t%s\n", + ec->name, + (f_ChipImageInfo.fConferencing==TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller conferencing noise reduction\t\t%s\n", + ec->name, + (f_ChipImageInfo.fConferencingNoiseReduction==TRUE)?"TRUE":"FALSE"); +#endif + } + } + if (f_ChipImageInfo.ulMaxChannels < (unsigned int)ec->max_channels){ + ec->max_channels = f_ChipImageInfo.ulMaxChannels-1; + } + +// DEBUG_EVENT(verbose, "%s: Reading hw revision...\n", +// ec->name); +#if 0 + DEBUG_EVENT(verbose, "%s: Reading hw revision...\n", + ec->name); + ec->f_Revision.ulUserChipId = 0; + ec->f_Revision.pProcessContext = &ec->f_Context; + ulResult = Oct6100GetHwRevision(&ec->f_Revision); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "%s: Reading hw revision...\tFailed (err=0x%X)\n", + ec->name, ulResult); + return EINVAL; + } +#endif + return 0; +} + +int wanec_ChipOpenPrep(wan_ec_dev_t *ec_dev, char *devname, wanec_config_t *config, int verbose) +{ + tOCT6100_GET_INSTANCE_SIZE InstanceSize; + wan_ec_t *ec; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + WAN_ASSERT(config->imageData == NULL); + ec = ec_dev->ec; + + ulResult = Oct6100ChipOpenDef( &ec->f_OpenChip ); + + /*==============================================================*/ + /* Configure clocks */ + + /* upclk oscillator is at 33.33 Mhz */ + ec->f_OpenChip.ulUpclkFreq = cOCT6100_UPCLK_FREQ_33_33_MHZ; + + /* mclk will be generated by internal PLL at 133 Mhz */ + ec->f_OpenChip.fEnableMemClkOut = TRUE; +#if 1 + ec->f_OpenChip.ulMemClkFreq = cOCT6100_MCLK_FREQ_133_MHZ; +#else + ec->f_OpenChip.ulMemClkFreq = cOCT6100_MCLK_FREQ_125_MHZ; /*125*/ +#endif + + /*==============================================================*/ + + /*==============================================================*/ + /* General parameters */ + + /* Chip ID.*/ + ec->f_OpenChip.ulUserChipId = ec->chip_no; + + /* Set the max number of accesses to 1024 to speed things up */ + ec->f_OpenChip.ulMaxRwAccesses = 1024; + + /* Set the maximums that the chip needs to support for this test */ + ec->f_OpenChip.ulMaxChannels = config->max_channels; + + ec->f_OpenChip.ulMaxBiDirChannels = 0; + ec->f_OpenChip.ulMaxConfBridges = 0; //WANEC_MAX_CONFBRIDGE_DEF; + ec->f_OpenChip.ulMaxPhasingTssts = 0; + ec->f_OpenChip.ulMaxTdmStreams = 32; + ec->f_OpenChip.ulMaxTsiCncts = 2; + + /*==============================================================*/ + + /*==============================================================*/ + /* External Memory Settings */ + + /* Use DDR memory.*/ +#if 1 + ec->f_OpenChip.ulMemoryType = cOCT6100_MEM_TYPE_SDR; +#else + ec->f_OpenChip.ulMemoryType = cOCT6100_MEM_TYPE_DDR; +#endif + + ec->f_OpenChip.ulNumMemoryChips = 2; + + /* + **f_OpenChip.ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_8MB; + **f_OpenChip.ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_16MB;*/ + ec->f_OpenChip.ulMemoryChipSize = config->memory_chip_size; + + ec->f_OpenChip.fEnableChannelRecording = TRUE; + +#if defined(ENABLE_ACOUSTICECHO) + ec->f_OpenChip.fEnableAcousticEcho = TRUE; +#endif + +#if defined(ENABLE_PRODBIST) + /* Enable production bist mode */ + ec->f_OpenChip.fEnableProductionBist = TRUE; + ec->f_OpenChip.ulNumProductionBistLoops = 0x1; +#endif + + ec->f_OpenChip.ulMaxPlayoutBuffers = WANEC_MAC_PLAYOUT_BUFFERS; + + ec->f_OpenChip.pbyImageFile = ec->pImageData; + ec->f_OpenChip.ulImageSize = ec->ImageSize; + + /* Assign board index (0). */ + ec->f_Context.ulBoardId = ec->chip_no; + + /* Handle to driver */ + ec->f_Context.ec_dev = ec_dev; + + /* Interface name to driver */ + strlcpy(ec->f_Context.devname, devname, WAN_DRVNAME_SZ); + + ulResult = Oct6100GetInstanceSize(&ec->f_OpenChip, &InstanceSize); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to get EC chip instance size (err=0x%X)!\n", + ec->name, ulResult); + return -EINVAL; + } + + /* Allocate memory needed for API instance. */ + ec->pChipInstance = + (tPOCT6100_INSTANCE_API)wan_vmalloc(InstanceSize.ulApiInstanceSize); + if (ec->pChipInstance == NULL){ + DEBUG_EVENT( + "ERROR: %s: Failed to allocate memory for EC chip (%d bytes)!\n", + ec->name,InstanceSize.ulApiInstanceSize); + return -EINVAL; + } + + /* Open the OCT6100 on the evaluation board. */ + ec->f_OpenChip.pProcessContext = (PVOID)&ec->f_Context; + + /* parse advanced params (global custom configuration) */ + if (ec->custom_conf.param_no){ + wanec_ChipParam(ec, &ec->f_OpenChip, &ec->custom_conf, verbose); + } + /* parse advanced params (command line custom configuration) */ + if (config->custom_conf.param_no){ + wanec_ChipParam(ec, &ec->f_OpenChip, &config->custom_conf, verbose); + } + + ec->ulDebugChannelHndl = cOCT6100_INVALID_HANDLE; + ec->ulDebugDataMode = config->debug_data_mode; + return 0; +} + +int wanec_ChipOpen(wan_ec_dev_t *ec_dev, int verbose) +{ + wan_ec_t *ec; + UINT32 ulResult, i = 0; + INT ec_chan = 0; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + PRINT1(verbose, + "%s: Opening Echo Canceller Chip ...\n", + ec->name); + if (ec->f_OpenChip.pbyImageFile == NULL){ + DEBUG_EVENT( + "ERROR: %s: Invalid EC image pointer\n", + ec->name); + return -EINVAL; + } + ulResult = Oct6100ChipOpen( + ec->pChipInstance, /* API instance memory. */ + &ec->f_OpenChip ); /* Open chip structure. */ + if ( ulResult != cOCT6100_ERR_OK ){ + if (ec->imageLast == WANOPT_YES || + ulResult != cOCT6100_ERR_OPEN_INVALID_FIRMWARE_OR_CAPACITY_PINS){ + DEBUG_EVENT( + "ERROR: %s: Failed to open Echo Canceller Chip (err=0x%X)\n", + ec->name, ulResult); + } + return -EINVAL; + } + + if (wanec_ChipStats(ec_dev, NULL, TRUE, verbose)){ + DEBUG_EVENT( + "ERROR: %s: Failed to read EC chip statistics!\n", + ec->name); + wanec_ChipClose(ec_dev, verbose); + return EINVAL; + } + + ec->pToneBufferIndexes = + wan_malloc(sizeof(UINT32) * ec->f_OpenChip.ulMaxPlayoutBuffers); + if (ec->pToneBufferIndexes == NULL){ + DEBUG_EVENT( + "ERROR: %s: Failed allocate memory for playout handles!\n", + ec->name); + wanec_ChipClose(ec_dev, verbose); + return EINVAL; + } + i = 0; + while(i < ec->f_OpenChip.ulMaxPlayoutBuffers){ + ec->pToneBufferIndexes[i++] = cOCT6100_INVALID_VALUE; + } + ec->pEchoChannelHndl = + wan_malloc(sizeof(UINT32) * ec->max_channels); + if (ec->pEchoChannelHndl == NULL){ + DEBUG_EVENT( + "ERROR: %s: Failed allocate memory for channel handle!\n", + ec->name); + wan_free(ec->pToneBufferIndexes); + wanec_ChipClose(ec_dev, verbose); + return EINVAL; + } + ec->pEcDevMap = wan_malloc(sizeof(wan_ec_dev_t*) * ec->max_channels); + if (ec->pEcDevMap == NULL){ + DEBUG_EVENT( + "ERROR: %s: Failed allocate memory for ec channel map!\n", + ec->name); + wan_free(ec->pToneBufferIndexes); + wan_free(ec->pEchoChannelHndl); + wanec_ChipClose(ec_dev, verbose); + return -EINVAL; + } + for(ec_chan = 0; ec_chan < ec->max_channels; ec_chan++){ + ec->pEchoChannelHndl[ec_chan] = cOCT6100_INVALID_HANDLE; + ec->pEcDevMap[ec_chan] = NULL; + } + return 0; +} + +int wanec_ChipClose(wan_ec_dev_t *ec_dev, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHIP_CLOSE f_CloseChip; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + PRINT1(verbose, + "%s: Closing Echo Canceller Chip ...\n", + ec->name); + Oct6100ChipCloseDef( &f_CloseChip ); + ulResult = Oct6100ChipClose( + ec->pChipInstance, + &f_CloseChip ); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to close Echo Canceller chip (err=0x%X)!\n", + ec->name, ulResult); + return -EINVAL; + } + if (ec->pChipInstance){ + wan_vfree(ec->pChipInstance); + ec->pChipInstance = NULL; + } + if (ec->pToneBufferIndexes){ + wan_free(ec->pToneBufferIndexes); + ec->pToneBufferIndexes = NULL; + } + if (ec->pEchoChannelHndl){ + wan_free(ec->pEchoChannelHndl); + ec->pEchoChannelHndl = NULL; + } + if (ec->pEcDevMap){ + wan_free(ec->pEcDevMap); + ec->pEcDevMap = NULL; + } + return 0; +} + +int wanec_ChannelOpen(wan_ec_dev_t *ec_dev, int verbose) +{ + tOCT6100_CHANNEL_OPEN EchoChannelOpen; + wan_ec_t *ec; + sdla_t *card; + UINT32 ulResult; + UINT32 stream = 0,timeslot=0; + INT channel, pcm_law_type; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + WAN_ASSERT(ec_dev->card == NULL); + ec = ec_dev->ec; + card = (sdla_t*)ec_dev->card; + + pcm_law_type = (WAN_FE_TDMV_LAW(&card->fe) == WAN_TDMV_MULAW) ? + cOCT6100_PCM_U_LAW : cOCT6100_PCM_A_LAW; + PRINT1(verbose, + "%s: Openning all Echo Canceller channels (%s)...\n", + ec->name, + (pcm_law_type == cOCT6100_PCM_U_LAW) ? + "MULAW":"ALAW"); + + for(channel = 0; channel < ec->max_channels; channel++){ + Oct6100ChannelOpenDef( &EchoChannelOpen ); + + /* Assign the handle memory.*/ + EchoChannelOpen.pulChannelHndl = &ec->pEchoChannelHndl[channel]; + + /* Make sure the channel does not perform echo cancellation */ +#if defined(WANEC_BYDEFAULT_NORMAL) + EchoChannelOpen.ulEchoOperationMode = + cOCT6100_ECHO_OP_MODE_NORMAL; +#else + EchoChannelOpen.ulEchoOperationMode = + cOCT6100_ECHO_OP_MODE_POWER_DOWN; +#endif + EchoChannelOpen.fEnableToneDisabler = TRUE; + + stream = (channel % 2 == 1) ? 4 : 0; + timeslot = channel / 2; + + /* Configure the TDM interface.*/ + EchoChannelOpen.TdmConfig.ulRinPcmLaw = pcm_law_type; + EchoChannelOpen.TdmConfig.ulRoutPcmLaw = pcm_law_type; + EchoChannelOpen.TdmConfig.ulSinPcmLaw = pcm_law_type; + EchoChannelOpen.TdmConfig.ulSoutPcmLaw = pcm_law_type; + + EchoChannelOpen.TdmConfig.ulRinStream = stream + 0; + EchoChannelOpen.TdmConfig.ulRinTimeslot = timeslot; + EchoChannelOpen.TdmConfig.ulRoutStream = stream + 1; + EchoChannelOpen.TdmConfig.ulRoutTimeslot = timeslot; + EchoChannelOpen.TdmConfig.ulSinStream = stream + 2; + EchoChannelOpen.TdmConfig.ulSinTimeslot = timeslot; + EchoChannelOpen.TdmConfig.ulSoutStream = stream + 3; + EchoChannelOpen.TdmConfig.ulSoutTimeslot = timeslot; + + /* Set the desired VQE features (TRUE/FALSE).*/ + EchoChannelOpen.VqeConfig.fEnableNlp = TRUE; + EchoChannelOpen.VqeConfig.fRinDcOffsetRemoval = TRUE; + EchoChannelOpen.VqeConfig.fSinDcOffsetRemoval = TRUE; +#if defined(ENABLE_ACOUSTICECHO) + EchoChannelOpen.VqeConfig.fAcousticEcho = TRUE; +#endif + + EchoChannelOpen.VqeConfig.fSoutAdaptiveNoiseReduction = TRUE; + EchoChannelOpen.VqeConfig.ulComfortNoiseMode = + cOCT6100_COMFORT_NOISE_NORMAL; + /* cOCT6100_COMFORT_NOISE_NORMAL + ** cOCT6100_COMFORT_NOISE_EXTENDED, + ** cOCT6100_COMFORT_NOISE_OFF, + ** cOCT6100_COMFORT_NOISE_FAST_LATCH */ + + PRINT1(verbose, + "%s: Openning Echo Canceller channel %d (%s)...\n", + ec->name, + channel, + (pcm_law_type == cOCT6100_PCM_U_LAW) ? + "MULAW":"ALAW"); + /* Open the channel.*/ + ulResult = Oct6100ChannelOpen( ec->pChipInstance, + &EchoChannelOpen ); + if (ulResult != cOCT6100_ERR_OK){ + DEBUG_EVENT( + "ERROR: %s: Failed to open Echo Canceller channel %d (err=0x%X)!\n", + ec->name, + channel, + ulResult); + return ulResult; + } + } + + /* Init debug channel handle */ + ec->ulDebugChannelHndl = cOCT6100_INVALID_HANDLE; + + return 0; +} + +int wanec_ChannelClose(wan_ec_dev_t *ec_dev, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_CLOSE EchoChannelClose; + UINT32 ulResult, channel; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + PRINT1(verbose, + "%s: Closing all Echo Canceller channels ...\n", + ec->name); + for(channel = 0; channel < (UINT32)ec->max_channels; channel++){ + Oct6100ChannelCloseDef( &EchoChannelClose ); + EchoChannelClose.ulChannelHndl = + ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ChannelClose( ec->pChipInstance, + &EchoChannelClose ); + if (ulResult != cOCT6100_ERR_OK){ + DEBUG_EVENT( + "ERROR: %s: Failed to close Echo Canceller channel %d (err=0x%X)!\n", + ec->name, + channel, + ulResult); + return -EINVAL; + } + ec->pEchoChannelHndl[channel] = cOCT6100_INVALID_HANDLE; + } + return 0; +} + +int wanec_ChannelModify( wan_ec_dev_t *ec_dev, + INT channel, + wanec_chan_modify_t *chan_modify, + int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_MODIFY EchoChannelModify; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + Oct6100ChannelModifyDef( &EchoChannelModify ); + + /* Assign the handle memory.*/ + EchoChannelModify.ulChannelHndl = ec->pEchoChannelHndl[channel]; + + /* parse advianced params */ + if (chan_modify->custom_conf.param_no){ + int err; + err = wanec_ChanParam(ec, &EchoChannelModify, &chan_modify->custom_conf, verbose); + if (err){ + DEBUG_EVENT( + "%s: WARNING: Unsupported parameter for channel %d!\n", + ec->name, channel); + return -EINVAL; + } + }else{ + + /* Echo Channel Operation Mode */ + EchoChannelModify.ulEchoOperationMode = chan_modify->opmode; + + if (chan_modify->mute != WANEC_IGNORE){ + EchoChannelModify.fVqeConfigModified = TRUE; + if (chan_modify->mute){ + EchoChannelModify.VqeConfig.fDtmfToneRemoval = TRUE; + }else{ + EchoChannelModify.VqeConfig.fDtmfToneRemoval = FALSE; + } + } + } + + /* Open the channel.*/ + ulResult = Oct6100ChannelModify( + ec->pChipInstance, + &EchoChannelModify ); + if (ulResult != cOCT6100_ERR_OK){ + PRINT1(verbose, + "%s: Failed to modify Channel config parameters for channel %d (err=0x%X)\n", + ec->name, + channel, + ulResult); + return EINVAL; + } + return 0; +} + +/****************************************************************************** +** CONFERENCE BRIDGE FUNCTIONS +******************************************************************************/ +int wanec_ChannelMute(wan_ec_dev_t* ec_dev, INT channel, unsigned char port_mask, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_MUTE f_ChannelMute; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + PRINT1(verbose, "%s: Muting channel %d on port %X...\n", + ec->name, channel, port_mask); + Oct6100ChannelMuteDef( &f_ChannelMute ); + f_ChannelMute.ulChannelHndl = ec->pEchoChannelHndl[channel]; + f_ChannelMute.ulPortMask = cOCT6100_CHANNEL_MUTE_PORT_NONE; + if (port_mask & WAN_EC_CHANNEL_PORT_SOUT) + f_ChannelMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_SOUT; + if (port_mask & WAN_EC_CHANNEL_PORT_SIN) + f_ChannelMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_SIN; + if (port_mask & WAN_EC_CHANNEL_PORT_ROUT) + f_ChannelMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_ROUT; + if (port_mask & WAN_EC_CHANNEL_PORT_RIN) + f_ChannelMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_RIN; + ulResult = Oct6100ChannelMute( + ec->pChipInstance, + &f_ChannelMute); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to mute channel %d on port %X (%08X)!\n", + ec->name, channel, port_mask, ulResult); + return EINVAL; + } + return 0; +} +int wanec_ChannelUnMute(wan_ec_dev_t *ec_dev, INT channel, unsigned char port_mask, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_UNMUTE f_ChannelUnMute; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + PRINT1(verbose, "%s: Un-muting channel %d on port %X...\n", + ec->name, channel, port_mask); + Oct6100ChannelUnMuteDef( &f_ChannelUnMute ); + f_ChannelUnMute.ulChannelHndl = ec->pEchoChannelHndl[channel]; + f_ChannelUnMute.ulPortMask = cOCT6100_CHANNEL_MUTE_PORT_NONE; + if (port_mask & WAN_EC_CHANNEL_PORT_SOUT) + f_ChannelUnMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_SOUT; + if (port_mask & WAN_EC_CHANNEL_PORT_SIN) + f_ChannelUnMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_SIN; + if (port_mask & WAN_EC_CHANNEL_PORT_ROUT) + f_ChannelUnMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_ROUT; + if (port_mask & WAN_EC_CHANNEL_PORT_RIN) + f_ChannelUnMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_RIN; + ulResult = Oct6100ChannelUnMute( + ec->pChipInstance, + &f_ChannelUnMute); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to un-mute channel %d on port %X (%08X)!\n", + ec->name, channel, port_mask, ulResult); + return EINVAL; + } + return 0; +} + +int wanec_ChannelStats(wan_ec_dev_t *ec_dev, INT channel, wanec_chan_stats_t *chan_stats, int reset) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_STATS f_ChannelStats; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + PRINT1(verbose, "%s: Reading EC statistics for channel %d...\n", + ec->name, channel); + Oct6100ChannelGetStatsDef( &f_ChannelStats ); + f_ChannelStats.ulChannelHndl = ec->pEchoChannelHndl[channel]; + f_ChannelStats.fResetStats = reset; + ulResult = Oct6100ChannelGetStats( + ec->pChipInstance, + &f_ChannelStats); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to read EC stats for channel %d (%08X)!\n", + ec->name, channel, ulResult); + return EINVAL; + } + if (chan_stats){ + memcpy( &chan_stats->f_ChannelStats, + &f_ChannelStats, + sizeof(tOCT6100_CHANNEL_STATS)); + } + return 0; +} + +int wanec_TonesEnable(wan_ec_t *ec, int channel, unsigned char type, int verbose) +{ + tOCT6100_TONE_DETECTION_ENABLE f_ToneDetectionEnable; + UINT32 ulResult; + int i; + + PRINT1(verbose, "%s: Enable tone detection on ec chan %d ...\n", + ec->name, + channel); + + if (type & WAN_EC_CHANNEL_PORT_ROUT){ + for(i = 0; i < WAN_NUM_DTMF_TONES; i++){ + + Oct6100ToneDetectionEnableDef( &f_ToneDetectionEnable ); + f_ToneDetectionEnable.ulChannelHndl = + ec->pEchoChannelHndl[channel]; + f_ToneDetectionEnable.ulToneNumber = + DetectedRoutToneNumbers[i]; + ulResult = Oct6100ToneDetectionEnable ( + ec->pChipInstance, + &f_ToneDetectionEnable); + if ( ulResult == cOCT6100_ERR_OK ){ + continue; + }else if (ulResult == cOCT6100_ERR_TONE_DETECTION_TONE_ACTIVATED){ + PRINT1(verbose, + "%s: Tone detection is already enabled on channel %d for port ROUT!\n", + ec->name, channel); + continue; /* already activated */ + }else{ + DEBUG_EVENT( + "ERROR: %s: Failed to enable tone detection on ec chan %d!\n", + ec->name, channel); + DEBUG_EVENT( + "ERROR: %s: (err=0x%X,i=%d)!\n", + ec->name, + (unsigned int)ulResult, i); + return -EINVAL; + } + } + } + if (type & WAN_EC_CHANNEL_PORT_SOUT){ + for(i = 0; i < WAN_NUM_DTMF_TONES; i++){ + + Oct6100ToneDetectionEnableDef( &f_ToneDetectionEnable ); + f_ToneDetectionEnable.ulChannelHndl = + ec->pEchoChannelHndl[channel]; + f_ToneDetectionEnable.ulToneNumber = + DetectedSoutToneNumbers[i]; + ulResult = Oct6100ToneDetectionEnable ( + ec->pChipInstance, + &f_ToneDetectionEnable); + if ( ulResult == cOCT6100_ERR_OK ){ + continue; + }else if (ulResult == cOCT6100_ERR_TONE_DETECTION_TONE_ACTIVATED){ + PRINT1(verbose, + "%s: Tone detection is already enabled on channel %d for port SOUT!\n", + ec->name, channel); + continue; /* already activated */ + }else{ + DEBUG_EVENT( + "ERROR: %s: Failed to enable tone detection on channel %d!\n", + ec->name, channel); + DEBUG_EVENT( + "ERROR: %s: (err=0x%X,i=%d)!\n", + ec->name, + (unsigned int)ulResult, i); + return -EINVAL; + } + } + } + + return 0; +} + +int wanec_TonesDisable(wan_ec_t *ec, int channel, unsigned char type, int verbose) +{ + tOCT6100_TONE_DETECTION_DISABLE f_ToneDetectionDisable; + UINT32 ulResult; + INT i; + + PRINT1(verbose, "%s: Disable tone detection on channel %d ...\n", + ec->name, + channel); + if (type & WAN_EC_CHANNEL_PORT_ROUT){ + + for(i = 0; i < WAN_NUM_DTMF_TONES; i++){ + + Oct6100ToneDetectionDisableDef( &f_ToneDetectionDisable ); + f_ToneDetectionDisable.ulChannelHndl = + ec->pEchoChannelHndl[channel]; + if (channel >= 0){ + f_ToneDetectionDisable.ulToneNumber = + DetectedRoutToneNumbers[i]; + }else{ + f_ToneDetectionDisable.fDisableAll = TRUE; + } + ulResult = Oct6100ToneDetectionDisable ( + ec->pChipInstance, + &f_ToneDetectionDisable); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to disable tone detection for channel %d (err=0x%X,i=%d)!\n", + ec->name, channel, + (unsigned int)ulResult, i); + return -EINVAL; + } + } + } + if (type & WAN_EC_CHANNEL_PORT_SOUT){ + + for(i = 0; i < WAN_NUM_DTMF_TONES; i++){ + + Oct6100ToneDetectionDisableDef( &f_ToneDetectionDisable ); + f_ToneDetectionDisable.ulChannelHndl = + ec->pEchoChannelHndl[channel]; + if (channel >= 0){ + f_ToneDetectionDisable.ulToneNumber = + DetectedSoutToneNumbers[i]; + }else{ + f_ToneDetectionDisable.fDisableAll = TRUE; + } + ulResult = Oct6100ToneDetectionDisable ( + ec->pChipInstance, + &f_ToneDetectionDisable); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to disable tone detection for channel %d (err=0x%X,i=%d)!\n", + ec->name, channel, + (unsigned int)ulResult, i); + return -EINVAL; + } + } + } + return 0; +} + +//#if defined(WAN_DEBUG_HWEC) +#if 1 +static CHAR* wanec_ToneId2Str(UINT32 f_ulToneId) +{ + switch (f_ulToneId){ + /* DTMF Section */ + case ROUT_DTMF_0: return "ROUT_DTMF_0"; + case ROUT_DTMF_1: return "ROUT_DTMF_1"; + case ROUT_DTMF_2: return "ROUT_DTMF_2"; + case ROUT_DTMF_3: return "ROUT_DTMF_3"; + case ROUT_DTMF_4: return "ROUT_DTMF_4"; + case ROUT_DTMF_5: return "ROUT_DTMF_5"; + case ROUT_DTMF_6: return "ROUT_DTMF_6"; + case ROUT_DTMF_7: return "ROUT_DTMF_7"; + case ROUT_DTMF_8: return "ROUT_DTMF_8"; + case ROUT_DTMF_9: return "ROUT_DTMF_9"; + case ROUT_DTMF_A: return "ROUT_DTMF_A"; + case ROUT_DTMF_B: return "ROUT_DTMF_B"; + case ROUT_DTMF_C: return "ROUT_DTMF_C"; + case ROUT_DTMF_D: return "ROUT_DTMF_D"; + case ROUT_DTMF_STAR: return "ROUT_DTMF_STAR"; + case ROUT_DTMF_POUND: return "ROUT_DTMF_POUND"; + case SOUT_DTMF_0: return "SOUT_DTMF_0"; + case SOUT_DTMF_1: return "SOUT_DTMF_1"; + case SOUT_DTMF_2: return "SOUT_DTMF_2"; + case SOUT_DTMF_3: return "SOUT_DTMF_3"; + case SOUT_DTMF_4: return "SOUT_DTMF_4"; + case SOUT_DTMF_5: return "SOUT_DTMF_5"; + case SOUT_DTMF_6: return "SOUT_DTMF_6"; + case SOUT_DTMF_7: return "SOUT_DTMF_7"; + case SOUT_DTMF_8: return "SOUT_DTMF_8"; + case SOUT_DTMF_9: return "SOUT_DTMF_9"; + case SOUT_DTMF_A: return "SOUT_DTMF_A"; + case SOUT_DTMF_B: return "SOUT_DTMF_B"; + case SOUT_DTMF_C: return "SOUT_DTMF_C"; + case SOUT_DTMF_D: return "SOUT_DTMF_D"; + case SOUT_DTMF_STAR: return "SOUT_DTMF_STAR"; + case SOUT_DTMF_POUND: return "SOUT_DTMF_POUND"; + + /* System 5/6/7 Section */ + case SIN_SYSTEM5_2400: return "SIN_SYSTEM5_2400"; + case SIN_SYSTEM5_2600: return "SIN_SYSTEM5_2600"; + case SIN_SYSTEM5_2400_2600: return "SIN_SYSTEM5_2400_2600"; + case SIN_SYSTEM7_2000: return "SIN_SYSTEM7_2000"; + case SIN_SYSTEM7_1780: return "SIN_SYSTEM7_1780"; + + default: return "INVALID TONE ID!"; + } +} +#endif + +static unsigned char wanec_ConvertToneId(UINT32 f_ulToneId, unsigned char *ec_dtmf_port) +{ + switch (f_ulToneId){ + /* DTMF Section */ + case ROUT_DTMF_0: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '0'; + case ROUT_DTMF_1: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '1'; + case ROUT_DTMF_2: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '2'; + case ROUT_DTMF_3: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '3'; + case ROUT_DTMF_4: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '4'; + case ROUT_DTMF_5: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '5'; + case ROUT_DTMF_6: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '6'; + case ROUT_DTMF_7: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '7'; + case ROUT_DTMF_8: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '8'; + case ROUT_DTMF_9: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '9'; + case ROUT_DTMF_A: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return 'A'; + case ROUT_DTMF_B: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return 'B'; + case ROUT_DTMF_C: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return 'C'; + case ROUT_DTMF_D: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return 'D'; + case ROUT_DTMF_STAR: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '*'; + case ROUT_DTMF_POUND: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '#'; + case SOUT_DTMF_0: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '0'; + case SOUT_DTMF_1: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '1'; + case SOUT_DTMF_2: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '2'; + case SOUT_DTMF_3: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '3'; + case SOUT_DTMF_4: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '4'; + case SOUT_DTMF_5: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '5'; + case SOUT_DTMF_6: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '6'; + case SOUT_DTMF_7: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '7'; + case SOUT_DTMF_8: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '8'; + case SOUT_DTMF_9: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '9'; + case SOUT_DTMF_A: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return 'A'; + case SOUT_DTMF_B: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return 'B'; + case SOUT_DTMF_C: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return 'C'; + case SOUT_DTMF_D: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return 'D'; + case SOUT_DTMF_STAR: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '*'; + case SOUT_DTMF_POUND: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '#'; + } + return 0x00000000; +} + +#if 1 +//#if defined(WAN_DEBUG_HWEC) +static CHAR* wanec_ToneType2Str(UINT32 f_ulToneType) +{ + switch (f_ulToneType){ + case cOCT6100_TONE_PRESENT: return "cOCT6100_TONE_PRESENT"; + case cOCT6100_TONE_STOP: return "cOCT6100_TONE_STOP"; + default: return "INVALID TONE TYPE!"; + } +} +#endif +static unsigned char wanec_ConvertToneType(UINT32 f_ulToneType) +{ + switch (f_ulToneType){ + case cOCT6100_TONE_PRESENT: return WAN_EC_TONE_PRESENT; + case cOCT6100_TONE_STOP: return WAN_EC_TONE_STOP; + } + return 0x00; +} + + +/* +** wanec_EventTone() +** +** Return: 0 - on success +** <0 - on error +** 1 - pending dtmf events +**/ +int wanec_EventTone(wan_ec_t *ec, int verbose) +{ + tOCT6100_EVENT_GET_TONE f_GetToneEvent; + tOCT6100_TONE_EVENT ToneEvent[32]; + UINT32 ulResult; + wan_ec_dev_t *ec_dev; + sdla_t *card; + UINT32 i; + int ec_chan,fe_chan; + + PRINT1(verbose, "%s: Getting Tone events ...\n", + ec->name); + Oct6100EventGetToneDef( &f_GetToneEvent ); + f_GetToneEvent.fResetBufs = FALSE; + f_GetToneEvent.ulMaxToneEvent = 32; + f_GetToneEvent.pToneEvent = ToneEvent; + ulResult = Oct6100EventGetTone( + ec->pChipInstance, + &f_GetToneEvent); + if ( ulResult != cOCT6100_ERR_OK ){ + if ( ulResult != cOCT6100_ERR_EVENTS_TONE_BUF_EMPTY ){ + PRINT1(verbose, "%s: There are not tone events!\n", + ec->name); + return 0; + } + DEBUG_EVENT( + "ERROR: %s: Failed to get tone events (err=0x%X)!\n", + ec->name, ulResult); + return -EINVAL; + } + + /* No dtmf tone event returned */ + if (!f_GetToneEvent.ulNumValidToneEvent) return 0; + + for(i = 0; i < f_GetToneEvent.ulNumValidToneEvent; i++){ + ec_chan = wanec_hndl2ec_channel(ec, ToneEvent[i].ulChannelHndl); + ec_dev = ec->pEcDevMap[ec_chan]; + fe_chan = wanec_ec2fe_channel(ec, ec_chan, &ec_dev); + if (ec_dev == NULL || ec_dev->card == NULL){ + DEBUG_EVENT( + "%s: Internal Error: Failed to find fe channel (ec_chan=%d)\n", + ec->name, ec_chan); + continue; + } + + PRINT1(verbose, + "%s: Tone event %s %s on fe_chan=%d ec_chan=%d\n", + ec_dev->devname, + wanec_ToneId2Str(ToneEvent[i].ulToneDetected), + wanec_ToneType2Str(f_GetToneEvent.pToneEvent[i].ulEventType), + fe_chan, ec_chan); + + card = (sdla_t*)ec_dev->card; + if (card->wandev.event_callback.dtmf){ + wan_event_t event; + unsigned char dtmf_port = WAN_EC_CHANNEL_PORT_ROUT, dtmf_type; + + event.type = WAN_EVENT_EC_DTMF; + event.channel = fe_chan; + event.digit = wanec_ConvertToneId( + ToneEvent[i].ulToneDetected, + &dtmf_port); + dtmf_type = wanec_ConvertToneType(ToneEvent[i].ulEventType); + event.dtmf_type = dtmf_type; + event.dtmf_port = dtmf_port; + card->wandev.event_callback.dtmf(card, &event); + } + } + + /* Return 1 if more dtmf event are present, otherwise - 0 */ + return (f_GetToneEvent.fMoreEvents == TRUE) ? 1 : 0; +} + +/* +** wanec_ISR() +** +** Return: 0 - on success +** <0 - on error +** 1 - pending dtmf events +**/ +int wanec_ISR(wan_ec_t *ec, int verbose) +{ + UINT32 ulResult; + int ret = 0; + + WAN_ASSERT(ec == NULL); + + Oct6100InterruptServiceRoutineDef(&ec->f_InterruptFlag); + + ulResult = Oct6100InterruptServiceRoutine( + ec->pChipInstance, + &ec->f_InterruptFlag ); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to execute interrupt Service Routine (err=%08X)!\n", + ec->name, + ulResult); + return -EINVAL; + } + /* Critical errors */ + if (ec->f_InterruptFlag.fFatalGeneral == TRUE){ + DEBUG_EVENT( + "%s: An internal fatal chip error detected (0x%X)!\n", + ec->name, + ec->f_InterruptFlag.ulFatalGeneralFlags); + } + if (ec->f_InterruptFlag.fFatalReadTimeout == TRUE){ + DEBUG_EVENT( + "%s: A read to the external memory has failed!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorRefreshTooLate == TRUE){ + DEBUG_EVENT( + "%s: Error Refresh Too Late!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorPllJitter == TRUE){ + DEBUG_EVENT( + "%s: Error Pll Jitter\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorH100OutOfSync == TRUE){ + DEBUG_EVENT( + "%s: The H100 slave has lost its framing on the bus!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorH100ClkA == TRUE){ + DEBUG_EVENT( + "%s: The CT_C8_A clock behavior does not conform to the H.100 spec!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorH100FrameA == TRUE){ + DEBUG_EVENT( + "%s: The CT_FRAME_A clock behavior does not comform to the H.100 spec!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorH100ClkB == TRUE){ + DEBUG_EVENT( + "%s: The CT_C8_B clock is not running a 16.384 MHz!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorOverflowToneEvents == TRUE){ + DEBUG_EVENT( + "%s: Error: Tone Event buffer has overflowed\n", + ec->name); + } + if (ec->f_InterruptFlag.fToneEventsPending == TRUE){ + PRINT1(verbose, "%s: Tone Event pending....\n", + ec->name); + ret = wanec_EventTone(ec, verbose); + } + if (ec->f_InterruptFlag.fBufferPlayoutEventsPending == TRUE){ + PRINT1(verbose, + "%s: Buffer Playout Events Pending\n", + ec->name); + } + if (ec->f_InterruptFlag.fApiSynch == TRUE){ + PRINT1(verbose, + "%s: The chip interrupted the API for purpose of maintaining sync!\n", + ec->name); + } + return ret; +} + +int wanec_DebugChannel(wan_ec_dev_t *ec_dev, INT channel, int verbose) +{ + wan_ec_t *ec = NULL; + tOCT6100_DEBUG_SELECT_CHANNEL DebugSelectChannel; + wanec_chan_stats_t chan_stats; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + /* Verify Echo Canceller Channel operation mode */ + ulResult = wanec_ChannelStats(ec_dev, channel, &chan_stats, 0); + if (chan_stats.f_ChannelStats.ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_POWER_DOWN){ + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Channel %d operation mode (POWER DOWN)!\n", + ec_dev->name, channel); + return -EINVAL; + } + + if (ec_dev->ec->ulDebugChannelHndl != cOCT6100_INVALID_HANDLE){ + DEBUG_EVENT( + "ERROR: %s: Echo Canceller daemon can monitor only one ec channel (%d)!\n", + ec_dev->name, channel); + return -EINVAL; + } + Oct6100DebugSelectChannelDef( &DebugSelectChannel ); + + PRINT1(verbose, "%s: Select ec channel %d for monitoring...\n", + ec_dev->name, + channel); + /* Set selected debug channel */ + ec->DebugChannel = channel; + ec->ulDebugChannelHndl = ec->pEchoChannelHndl[channel]; + DebugSelectChannel.ulChannelHndl= ec->pEchoChannelHndl[channel]; + + /* Select Debug channel */ + ulResult = Oct6100DebugSelectChannel( + ec->pChipInstance, + &DebugSelectChannel ); + if (ulResult != cOCT6100_ERR_OK){ + DEBUG_EVENT( + "ERROR: %s: Failed to select debug ec channel %d for monitoring (err=0x%X)\n", + ec->name, + channel, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_DebugGetData(wan_ec_dev_t *ec_dev, wanec_chan_monitor_t *chan_monitor, int verbose) +{ + wan_ec_t *ec = NULL; + tOCT6100_DEBUG_GET_DATA fDebugGetData; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + if (ec->ulDebugChannelHndl == cOCT6100_INVALID_HANDLE){ + PRINT( +#if !defined(__WINDOWS__) + verbose, +#endif + "ERROR: %s: No Debug channel was selected!\n", + ec->name); + return -EINVAL; + } + + Oct6100DebugGetDataDef( &fDebugGetData ); + + PRINT1(verbose, + "%s: Retrieves debug data for ec channel %d...\n", + ec->name, + ec->DebugChannel); + + memset(&chan_monitor->data[0], 0, + sizeof(UINT8) * (MAX_MONITOR_DATA_LEN+1)); + /* Set selected debug channel */ + fDebugGetData.ulGetDataMode = ec->ulDebugDataMode; + fDebugGetData.ulMaxBytes = chan_monitor->max_len; + fDebugGetData.pbyData = &chan_monitor->data[0]; + + /* Select Debug channel */ + ulResult = Oct6100DebugGetData( + ec->pChipInstance, + &fDebugGetData ); + if (ulResult != cOCT6100_ERR_OK){ + PRINT( +#if !defined(__WINDOWS__) + verbose, +#endif + "ERROR: %s: Failed to get debug data for ec channel %d (err=0x%X)\n", + ec->name, + ec->DebugChannel, + ulResult); + return -EINVAL; + } + chan_monitor->data_len = fDebugGetData.ulValidNumBytes; + chan_monitor->remain_len = fDebugGetData.ulRemainingNumBytes; + chan_monitor->channel = ec->DebugChannel; + + if (fDebugGetData.ulRemainingNumBytes == 0){ + /* Last read */ + ec->ulDebugChannelHndl = cOCT6100_INVALID_HANDLE; + } + + return 0; +} + +static PUINT32 wanec_search_bufferindex(wan_ec_t *ec, UINT32 index) +{ + UINT32 i = 0; + + while(i < ec->f_OpenChip.ulMaxPlayoutBuffers){ + if (ec->pToneBufferIndexes[i] == index){ + return &ec->pToneBufferIndexes[i]; + } + i++; + } + return NULL; +} + +int wanec_BufferLoad(wan_ec_dev_t *ec_dev, wanec_tone_config_t *tone_config, int verbose) +{ + wan_ec_t *ec; + tOCT6100_BUFFER_LOAD BufferLoad; + UINT32 size, ulResult; + PUINT8 pData = NULL; + int err; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + PRINT1(verbose, + "%s: Loading Tone buffer (%s) into OCT6100 Chip ...\n", + ec->name, tone_config->tone); + size = tone_config->size * sizeof(INT8); + pData = wan_vmalloc(size); + if (pData == NULL){ + DEBUG_EVENT( + "ERROR: %s: Failed to allocate memory for tone buffer!\n", + ec->name); + return -EINVAL; + } + err = WAN_COPY_FROM_USER(pData, tone_config->data, size); + if (err){ + DEBUG_EVENT( + "ERROR: %s: Failed to copy EC tone buffer from user space [%s:%d]!\n", + ec->name, + __FUNCTION__,__LINE__); + wan_vfree(pData); + return -EINVAL; + } + + Oct6100BufferPlayoutLoadDef( &BufferLoad ); + BufferLoad.pulBufferIndex = wanec_search_bufferindex(ec, cOCT6100_INVALID_VALUE); + /* FIXME: Can be alaw/mulaw */ + BufferLoad.ulBufferPcmLaw = + (ec_dev->fe_tdmv_law == WAN_TDMV_MULAW) ? + cOCT6100_PCM_U_LAW : + cOCT6100_PCM_A_LAW; + BufferLoad.pbyBufferPattern = pData; + BufferLoad.ulBufferSize = size; + ulResult = Oct6100BufferPlayoutLoad ( + ec->pChipInstance, + &BufferLoad); + if ( ulResult != cOCT6100_ERR_OK ){ + if (ulResult == cOCT6100_ERR_BUFFER_PLAYOUT_ALL_BUFFERS_OPEN){ + goto buffer_load_done; + } + DEBUG_EVENT( + "%s: ERROR: Failed to load tone buffer into EC Chip (err=0x%X)\n", + ec->name, ulResult); + wan_vfree(pData); + return -EINVAL; + } +buffer_load_done: + wan_vfree(pData); + tone_config->buffer_index = *BufferLoad.pulBufferIndex; + PRINT1(verbose, + "%s: Current tone index is %d\n", + ec->name, tone_config->buffer_index); + return 0; +} + +int wanec_BufferUnload(wan_ec_dev_t *ec_dev, wanec_tone_config_t *tone_config, int verbose) +{ + wan_ec_t *ec; + tOCT6100_BUFFER_UNLOAD BufferUnload; + PUINT32 pBufferIndex = NULL; + UINT32 index = 0, ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + PRINT1(verbose, + "%s: Unloading Tone buffer from EC chip ...\n", + ec->name); + +try_next_index: + Oct6100BufferPlayoutUnloadDef( &BufferUnload ); + if (tone_config->buffer_index != cOCT6100_INVALID_VALUE){ + pBufferIndex = wanec_search_bufferindex(ec, tone_config->buffer_index); + if (pBufferIndex == NULL){ + DEBUG_EVENT( + "ERROR: %s: Invalid tone buffer index %X!\n", + ec->name, tone_config->buffer_index); + return EINVAL; + } + }else{ + if (index > ec->f_OpenChip.ulMaxPlayoutBuffers){ + goto buffer_unload_done; + } + if (ec->pToneBufferIndexes[index] == cOCT6100_INVALID_VALUE){ + index++; + goto try_next_index; + } + pBufferIndex = &ec->pToneBufferIndexes[index]; + } + + BufferUnload.ulBufferIndex = *pBufferIndex; + ulResult = Oct6100BufferPlayoutUnload ( + ec->pChipInstance, + &BufferUnload); + if ( ulResult != cOCT6100_ERR_OK ){ + if (ulResult == cOCT6100_ERR_BUFFER_PLAYOUT_NOT_OPEN){ + goto buffer_unload_done; + } + DEBUG_EVENT( + "ERROR: %s: Failed to unload tone buffer from EC Chip (err=0x%X)!\n", + ec->name, (unsigned int)ulResult); + return EINVAL; + } + *pBufferIndex = 0; + if (!tone_config->buffer_index){ + index++; + goto try_next_index; + } + +buffer_unload_done: + return 0; +} + +int wanec_BufferPlayoutAdd(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose) +{ + tOCT6100_BUFFER_PLAYOUT_ADD BufferPlayoutAdd; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Add Tone buffer to ec channel %d...\n", + ec->name, channel); + if (playout->index == cOCT6100_INVALID_VALUE|| + wanec_search_bufferindex(ec, playout->index) == NULL){ + DEBUG_EVENT( + "ERROR: %s: Invalid playout buffer index for ec channel %d!\n", + ec->name, channel); + return -EINVAL; + } + Oct6100BufferPlayoutAddDef( &BufferPlayoutAdd ); + BufferPlayoutAdd.fRepeat = playout->repeat; + BufferPlayoutAdd.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; + BufferPlayoutAdd.ulMixingMode = cOCT6100_MIXING_MUTE; + BufferPlayoutAdd.ulChannelHndl = ec->pEchoChannelHndl[channel]; + BufferPlayoutAdd.ulBufferIndex = playout->index; + BufferPlayoutAdd.ulDuration = (playout->duration) ? + playout->duration : 5000; + BufferPlayoutAdd.ulBufferLength = (playout->buffer_length) ? + playout->buffer_length : + cOCT6100_AUTO_SELECT; + ulResult = Oct6100BufferPlayoutAdd( + ec->pChipInstance, + &BufferPlayoutAdd); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to add playout buffer to ec channel %d (err=%08X)\n", + ec->name, channel, ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_BufferPlayoutStart(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose) +{ + tOCT6100_BUFFER_PLAYOUT_START BufferPlayoutStart; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Active playout buffer on ec channel %d...\n", + ec->name, + channel); + Oct6100BufferPlayoutStartDef( &BufferPlayoutStart ); + BufferPlayoutStart.ulChannelHndl = ec->pEchoChannelHndl[channel]; + BufferPlayoutStart.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; + ulResult = Oct6100BufferPlayoutStart( + ec->pChipInstance, + &BufferPlayoutStart); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to active playout buffer on ec channel %d (err=%08X)\n", + ec->name, + channel, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_BufferPlayoutStop(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose) +{ + tOCT6100_BUFFER_PLAYOUT_STOP BufferPlayoutStop; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Deactive playout buffer on ec channel %d...\n", + ec->name, + channel); + Oct6100BufferPlayoutStopDef( &BufferPlayoutStop ); + BufferPlayoutStop.ulChannelHndl = ec->pEchoChannelHndl[channel]; + BufferPlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; + ulResult = Oct6100BufferPlayoutStop( + ec->pChipInstance, + &BufferPlayoutStop); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to deactive playout buffer on ec channel %d (err=%08X)\n", + ec->name, + channel, + ulResult); + return -EINVAL; + } + return 0; +} + + +/****************************************************************************** +** CONFERENCE BRIDGE FUNCTIONS +******************************************************************************/ +int wanec_ConfBridgeOpen(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose) +{ + tOCT6100_CONF_BRIDGE_OPEN ConfBridgeOpen; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Opening Conference Bridge...\n", ec->name); + + if (ec->confbridges_no >= ec->f_OpenChip.ulMaxConfBridges){ + DEBUG_EVENT( + "ERROR: %s: Trying to open too many conference bridges (%d:%d)\n", + ec->name, + ec->confbridges_no, + ec->f_OpenChip.ulMaxConfBridges); + return -EINVAL; + } + + Oct6100ConfBridgeOpenDef( &ConfBridgeOpen ); + ConfBridgeOpen.pulConfBridgeHndl = &confbridge->ulHndl; + ConfBridgeOpen.fFlexibleConferencing = FALSE; + ulResult = Oct6100ConfBridgeOpen( + ec->pChipInstance, + &ConfBridgeOpen); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to open new conference bridge (err=%08X)\n", + ec->name, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeClose(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose) +{ + tOCT6100_CONF_BRIDGE_CLOSE ConfBridgeClose; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Closing Conference Bridge...\n", ec->name); + + Oct6100ConfBridgeCloseDef( &ConfBridgeClose ); + ConfBridgeClose.ulConfBridgeHndl = confbridge->ulHndl; + ulResult = Oct6100ConfBridgeClose( + ec->pChipInstance, + &ConfBridgeClose); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to close conference bridge (%X, err=%08X)\n", + ec->name, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeChanAdd(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose) +{ + tOCT6100_CONF_BRIDGE_CHAN_ADD ConfBridgeChanAdd; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Add channel %d to Conference Bridge %X...\n", + ec->name, channel, confbridge->ulHndl); + + Oct6100ConfBridgeChanAddDef( &ConfBridgeChanAdd ); + ConfBridgeChanAdd.ulConfBridgeHndl = confbridge->ulHndl; + ConfBridgeChanAdd.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ConfBridgeChanAdd( + ec->pChipInstance, + &ConfBridgeChanAdd); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to add channel %d to conference bridge (%X, err=%08X)\n", + ec->name, channel, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeChanRemove(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose) +{ + tOCT6100_CONF_BRIDGE_CHAN_REMOVE ConfBridgeChanRemove; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Remove channel %d from Conference Bridge %X...\n", + ec->name, channel, confbridge->ulHndl); + + Oct6100ConfBridgeChanRemoveDef( &ConfBridgeChanRemove ); + ConfBridgeChanRemove.ulConfBridgeHndl = confbridge->ulHndl; + ConfBridgeChanRemove.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ConfBridgeChanRemove( + ec->pChipInstance, + &ConfBridgeChanRemove); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to remove channel %d from conference bridge (%X, err=%08X)\n", + ec->name, channel, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeChanMute(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose) +{ + tOCT6100_CONF_BRIDGE_CHAN_MUTE ConfBridgeChanMute; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Mute channel %d on a conference bridge %X...\n", + ec->name, channel, confbridge->ulHndl); + + Oct6100ConfBridgeChanMuteDef( &ConfBridgeChanMute ); + ConfBridgeChanMute.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ConfBridgeChanMute( + ec->pChipInstance, + &ConfBridgeChanMute); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to mute channel %d on a conference bridge (%X, err=%08X)\n", + ec->name, channel, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeChanUnMute(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose) +{ + tOCT6100_CONF_BRIDGE_CHAN_UNMUTE ConfBridgeChanUnMute; + UINT32 ulResult; + + PRINT1(verbose, + "%s: UnMute channel %d on a Conference Bridge %X...\n", + ec->name, channel, confbridge->ulHndl); + + Oct6100ConfBridgeChanUnMuteDef( &ConfBridgeChanUnMute ); + ConfBridgeChanUnMute.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ConfBridgeChanUnMute( + ec->pChipInstance, + &ConfBridgeChanUnMute); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to unmute channel %d from conference bridge (%X, err=%08X)\n", + ec->name, channel, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeDominantSpeakerSet(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int enable, int verbose) +{ + tOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET ConfBridgeDominantSpeaker; + UINT32 ulResult; + + PRINT1(verbose, + "%s: %s Dominant speaker (channel %d) to a Conference Bridge %X...\n", + ec->name, + (enable) ? "Enable":"Disable", + channel, + confbridge->ulHndl); + + Oct6100ConfBridgeDominantSpeakerSetDef( &ConfBridgeDominantSpeaker ); + ConfBridgeDominantSpeaker.ulConfBridgeHndl = confbridge->ulHndl; + if (enable){ + ConfBridgeDominantSpeaker.ulChannelHndl = ec->pEchoChannelHndl[channel]; + }else{ + ConfBridgeDominantSpeaker.ulChannelHndl = cOCT6100_CONF_NO_DOMINANT_SPEAKER_HNDL; + } + ulResult = Oct6100ConfBridgeDominantSpeakerSet( + ec->pChipInstance, + &ConfBridgeDominantSpeaker); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to %s dominant speaker to conference bridge (%X, err=%08X)\n", + ec->name, + (enable) ? "enable" : "disable", + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + + +int wanec_ConfBridgeMaskChange(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, UINT32 mask, int verbose) +{ + tOCT6100_CONF_BRIDGE_MASK_CHANGE ConfBridgeMaskChange; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Changing the listener (channel=%d) mask of bridge participant (%d)...\n", + ec->name, + channel, confbridge->ulHndl); + + Oct6100ConfBridgeMaskChangeDef( &ConfBridgeMaskChange ); + ConfBridgeMaskChange.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ConfBridgeMaskChange.ulNewListenerMask = mask; + ulResult = Oct6100ConfBridgeMaskChange( + ec->pChipInstance, + &ConfBridgeMaskChange); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to change the listener mask of bridge participant %d (err=%X)!\n", + ec->name, + channel, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeGetStats(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose) +{ + tOCT6100_CONF_BRIDGE_STATS ConfBridgeStats; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Getting bridge statistics %X...\n", + ec->name, confbridge->ulHndl); + + Oct6100ConfBridgeGetStatsDef( &ConfBridgeStats ); + ConfBridgeStats.ulConfBridgeHndl = confbridge->ulHndl; + ulResult = Oct6100ConfBridgeGetStats( + ec->pChipInstance, + &ConfBridgeStats); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to get conference bridge statistics (err=%X)!\n", + ec->name, + ulResult); + return -EINVAL; + } + return 0; +} + +/*===========================================================================*\ + Oct6100Read +\*===========================================================================*/ + +static int +wan_ec_read(wan_ec_dev_t *ec_dev, u32 read_addr, u16 *read_data) +{ + u32 data; + wan_ec_read_internal_dword(ec_dev, read_addr, &data); + *read_data = (u16)(data & 0xFFFF); + return 0; +} + +/*===========================================================================*\ + Oct6100Write +\*===========================================================================*/ + +static int +wan_ec_write(wan_ec_dev_t *ec_dev, u32 write_addr, u32 write_data) +{ + return wan_ec_write_internal_dword(ec_dev, write_addr, write_data); +} + + +/*===========================================================================*\ + Oct6100WriteSequenceSub +\*===========================================================================*/ +static u32 +wan_ec_write_seq(wan_ec_dev_t *ec_dev, u32 write_addr, u16 write_data) +{ + u32 ulResult; + u32 ulData; + u16 usData; + u32 ulWordAddress; + u32 i; + + /* Create the word address from the provided byte address. */ + ulWordAddress = write_addr >> 1; + + /* 16-bit indirect access. */ + + /* First write to the address indirection registers. */ + ulData = ( ulWordAddress >> 19 ) & 0x1FFF; + ulResult = wan_ec_write( ec_dev, 0x8, ulData ); + if (ulResult) + return ulResult; + + ulData = ( ulWordAddress >> 3 ) & 0xFFFF; + ulResult = wan_ec_write( ec_dev, 0xA, ulData ); + if (ulResult) + return ulResult; + + /* Next, write data word to read/write data registers. */ + ulData = write_data & 0xFFFF; + ulResult = wan_ec_write( ec_dev, 0x4, ulData ); + if ( ulResult ) + return ulResult; + + + /* Write the parities and write enables, as well as last three bits + ** of wadd and request the write access. */ + ulData = ( ( 0x0 & 0x3 ) << 14 ) | ( ( 0x3 & 0x3 ) << 12 ) | ( ( ulWordAddress & 0x7 ) << 9 ) | 0x0100; + ulResult = wan_ec_write( ec_dev, 0x0, ulData ); + if ( ulResult ) + return ulResult; + + /* Keep polling register contol0 for the access_req bit to go low. */ + for ( i = 0; i < WANEC_READ_LIMIT; i++ ) + { + ulResult = wan_ec_read( ec_dev, 0, &usData ); + if ( ulResult ) + return ulResult; + + if ( ( ( usData >> 8 ) & 0x1 ) == 0x0 ) + break; + } + + if ( i == WANEC_READ_LIMIT ){ + DEBUG_EVENT("%s: EC write command reached limit!\n", + ec_dev->name); + return WAN_EC_RC_CPU_INTERFACE_NO_RESPONSE; + } + return 0; +} + + +/*===========================================================================*\ + HandleReqWriteOct6100 +\*===========================================================================*/ +u32 wanec_req_write(void *arg, u32 write_addr, u16 write_data) +{ + wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; + u32 ulResult; + + DEBUG_TEST("%s: EC WRITE API addr=%X data=%X\n", + ec_dev->ec->name, write_addr, write_data); + ulResult = wan_ec_write_seq(ec_dev, write_addr, write_data); + if (ulResult){ + DEBUG_EVENT("%s: Failed to write %04X to addr %08X\n", + ec_dev->name, + write_addr, + write_data); + } + return ulResult; +} + + +/*===========================================================================*\ + HandleReqWriteSmearOct6100 +\*===========================================================================*/ +u32 wanec_req_write_smear(void *arg, u32 addr, u16 data, u32 len) +{ + wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; + u32 i, ulResult = WAN_EC_RC_OK; + + WAN_ASSERT(ec_dev == NULL); + for ( i = 0; i < len; i++ ){ + ulResult = wan_ec_write_seq(ec_dev, addr + (i*2), data); + if (ulResult){ + DEBUG_EVENT("%s: Failed to write %04X to addr %08X\n", + ec_dev->name, + addr + (i*2), + data); + break; + } + } + return ulResult; +} + + +/*===========================================================================*\ + HandleReqWriteBurstOct6100 +\*===========================================================================*/ +u32 wanec_req_write_burst(void *arg, u32 addr, u16 *data, u32 len) +{ + wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; + u32 i, ulResult = WAN_EC_RC_OK; + + WAN_ASSERT(ec_dev == NULL); + + for ( i = 0; i < len; i++ ){ + ulResult = wan_ec_write_seq(ec_dev, addr + (i * 2), data[i]); + if (ulResult){ + DEBUG_EVENT("%s: Failed to write %04X to addr %08X\n", + ec_dev->name, + addr + (i*2), + data[i]); + break; + } + } + return ulResult; +} + + +/*===========================================================================*\ + Oct6100ReadSequenceSub +\*===========================================================================*/ +static u32 +wan_ec_read_seq(wan_ec_dev_t *ec_dev, u32 read_addr, u16 *read_data, u32 read_len) +{ + u32 ulResult; + u32 ulData; + u32 ulWordAddress; + u32 ulReadBurstLength; + u16 usData; + u32 i; + + /* Create the word address from the provided byte address. */ + ulWordAddress = read_addr >> 1; + + /* Indirect accesses. */ + + /* First write to the address indirection registers. */ + ulData = ( ulWordAddress >> 19 ) & 0x1FFF; + ulResult = wan_ec_write( ec_dev, 0x8, ulData ); + if (ulResult) + return ulResult; + + ulData = ( ulWordAddress >> 3 ) & 0xFFFF; + ulResult = wan_ec_write( ec_dev, 0xA, ulData ); + if (ulResult) + return ulResult; + + /* Request access. */ + if ( read_len >= 128 ) + { + ulData = 0x100 | ( ( ulWordAddress & 0x7 ) << 9); + ulReadBurstLength = 0; + } + else + { + ulData = 0x100 | ( ( ulWordAddress & 0x7 ) << 9) | read_len; + ulReadBurstLength = read_len; + } + ulResult = wan_ec_write( ec_dev, 0x0, ulData ); + if (ulResult) + return ulResult; + + /* Keep polling register contol0 for the access_req bit to go low. */ + for ( i = 0; i < WANEC_READ_LIMIT; i++ ) + { + ulResult = wan_ec_read( ec_dev, 0x0, &usData ); + if (ulResult) + return ulResult; + + if ( ( ( usData >> 8 ) & 0x1 ) == 0x0 ) + break; + } + if ( i == WANEC_READ_LIMIT ){ + DEBUG_EVENT("%s: EC read command reached limit!\n", + ec_dev->name); + return WAN_EC_RC_CPU_INTERFACE_NO_RESPONSE; + } + + if ( ( usData & 0xFF ) == 0x1 ) + { + i = 0; + } + + /* Retrieve read data. */ + ulResult = wan_ec_read( ec_dev, 0x4, &usData ); + if (ulResult) + return ulResult; + + if ( ( usData & 0xFF ) == 0x1 ) + { + i = 0; + } + + *read_data = usData; + return 0; +} + +u32 wanec_req_read(void *arg, u32 addr, u16 *data) +{ + wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; + u32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + DEBUG_TEST("%s: EC READ API addr=%X data=????\n", + ec_dev->ec->name, addr); + ulResult = wan_ec_read_seq( + ec_dev, + addr, + data, + 1); + if (ulResult){ + DEBUG_EVENT("%s: Failed to read data from addr %08X\n", + ec_dev->name, + addr); + if (ec_dev->ec){ + wan_set_bit(WAN_EC_BIT_CRIT_ERROR, &ec_dev->ec->critical); + } + } + DEBUG_TEST("%s: EC READ API addr=%X data=%X\n", + ec_dev->ec->name, + addr, *data); + return ulResult; +} + +u32 wanec_req_read_burst(void *arg, u32 addr, u16 *data, u32 len) +{ + wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; + u32 i, ulResult = WAN_EC_RC_OK; + u16 read_data; + + for ( i = 0; i < len; i++ ){ + ulResult = wan_ec_read_seq(ec_dev, addr, &read_data, 1); + if (ulResult){ + DEBUG_EVENT("%s: Failed to read from addr %X\n", + ec_dev->name, + addr); + if (ec_dev->ec){ + wan_set_bit(WAN_EC_BIT_CRIT_ERROR, &ec_dev->ec->critical); + } + break; + } + data[i] = (u16)read_data; + addr += 2; + } + return ulResult; +} diff --git a/patches/kdrivers/wanec/.#wanec_cmd.c.1.62 b/patches/kdrivers/wanec/.#wanec_cmd.c.1.62 new file mode 100644 index 0000000..16bccc2 --- /dev/null +++ b/patches/kdrivers/wanec/.#wanec_cmd.c.1.62 @@ -0,0 +1,2332 @@ +/************************************************************* + * wanec_cmd.c WANPIPE Echo Canceller Layer (WANEC_LIP) + * + * + * + * =========================================================== + * + * May 10 2006 Alex Feldman Initial Version + * + * March 19, 2006 Alex Feldman Enable Sout Adaptive Noise + * Reduction for all channel by + * default. + * + * January 9, 2008 David Rokhvarg + * Added support for Sangoma MS Windows Driver + * + */ + + +/*============================================================= + * Includes + */ + +#if defined(__FreeBSD__) || defined(__OpenBSD__) +# include +# include +# include +#elif defined(__LINUX__) +# include +# include +# include +# include +#elif defined(__WINDOWS__) +# include +# include +# include +#endif + +int verbose; + +#include "oct6100_api.h" +#include "oct6100_version.h" + +#include "wanec_iface.h" +#include "wanec_tones.h" + +/*============================================================= + * Definitions + */ +#define WANEC_MAX_PORT_RANGE 32 +#define WANEC_MAX_BRI_PORT_RANGE 2 +#define WANEC_READ_LIMIT 0x10000 + +#define WANEC_MAX_CONFBRIDGE_DEF 32 +#define WANEC_MAC_PLAYOUT_BUFFERS 20 + +#define WANEC_MAX_TONEEVENTS 8 +#define WANEC_MAX_PLAYOUTEVENTS 8 + +/*============================================================= + * Global Parameters + */ +UINT32 DetectedSoutToneNumbers[WAN_NUM_DTMF_TONES] = +{ + SOUT_DTMF_0, + SOUT_DTMF_1, + SOUT_DTMF_2, + SOUT_DTMF_3, + SOUT_DTMF_4, + SOUT_DTMF_5, + SOUT_DTMF_6, + SOUT_DTMF_7, + SOUT_DTMF_8, + SOUT_DTMF_9, + SOUT_DTMF_A, + SOUT_DTMF_B, + SOUT_DTMF_C, + SOUT_DTMF_D, + SOUT_DTMF_STAR, + SOUT_DTMF_POUND, +}; +UINT32 DetectedRoutToneNumbers[WAN_NUM_DTMF_TONES] = +{ + ROUT_DTMF_0, + ROUT_DTMF_1, + ROUT_DTMF_2, + ROUT_DTMF_3, + ROUT_DTMF_4, + ROUT_DTMF_5, + ROUT_DTMF_6, + ROUT_DTMF_7, + ROUT_DTMF_8, + ROUT_DTMF_9, + ROUT_DTMF_A, + ROUT_DTMF_B, + ROUT_DTMF_C, + ROUT_DTMF_D, + ROUT_DTMF_STAR, + ROUT_DTMF_POUND +}; + +/*============================================================= + * Function prototype +*/ + +int wanec_ChipOpenPrep(wan_ec_dev_t *ec_dev, char *devname, wanec_config_t *config, int verbose); +int wanec_ChipOpen(wan_ec_dev_t*, int); +int wanec_ChipClose(wan_ec_dev_t*, int verbose); +int wanec_ChipStats(wan_ec_dev_t *ec_dev, wanec_chip_stats_t *chip_stats, int reset, int verbose); + +int wanec_ChannelOpen(wan_ec_dev_t*, int); +int wanec_ChannelClose(wan_ec_dev_t*, int); +int wanec_ChannelModifyOpmode(wan_ec_dev_t*, INT, UINT32, int verbose); +int wanec_ChannelModifyCustom(wan_ec_dev_t*, INT, wanec_chan_custom_t*, int verbose); +int wanec_ChannelStats(wan_ec_dev_t*, INT channel, wanec_chan_stats_t *chan_stats, int reset); + +int wanec_ChannelMute(wan_ec_dev_t*, INT channel, wanec_chan_mute_t*, int); +int wanec_ChannelUnMute(wan_ec_dev_t*, INT channel, wanec_chan_mute_t*, int); + +int wanec_TonesEnable(wan_ec_t *ec, int ec_chan, wanec_dtmf_config_t*, int verbose); +int wanec_TonesDisable(wan_ec_t *ec, int ec_chan, wanec_dtmf_config_t*, int verbose); + +int wanec_DebugChannel(wan_ec_dev_t*, INT channel, int verbose); +int wanec_DebugGetData(wan_ec_dev_t*, wanec_chan_monitor_t *chan_monitor, int verbose); + +int wanec_BufferLoad(wan_ec_dev_t *ec_dev, wanec_buffer_config_t *buffer_config, int verbose); +int wanec_BufferUnload(wan_ec_dev_t *ec_dev, wanec_buffer_config_t *buffer_config, int verbose); +int wanec_BufferPlayoutAdd(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose); +int wanec_BufferPlayoutStart(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose); +int wanec_BufferPlayoutStop(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose); + +int wanec_ConfBridgeOpen(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose); +int wanec_ConfBridgeClose(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose); +int wanec_ConfBridgeChanAdd(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose); +int wanec_ConfBridgeChanRemove(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose); +int wanec_ConfBridgeChanMute(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose); +int wanec_ConfBridgeChanUnMute(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose); +int wanec_ConfBridgeDominantSpeakerSet(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int enable, int verbose); +int wanec_ConfBridgeMaskChange(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, UINT32 mask, int verbose); +int wanec_ConfBridgeGetStats(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose); + +int wanec_ToneEvent(wan_ec_t *ec, int verbose); +int wanec_PlayoutEvent(wan_ec_t *ec, int verbose); +int wanec_ISR(wan_ec_t *ec, int verbose); + +int wanec_fe2ec_channel(wan_ec_dev_t*, int); +static int wanec_hndl2ec_channel(wan_ec_t *ec, UINT32 ChannelHndl); +static int wanec_ec2fe_channel(wan_ec_t*, int, wan_ec_dev_t**); + +extern int wanec_ChipParam(wan_ec_t*,tPOCT6100_CHIP_OPEN, wan_custom_conf_t*, int); +extern int wanec_ChanParam(wan_ec_t*,tPOCT6100_CHANNEL_MODIFY, wan_custom_conf_t*, int); +extern int wanec_ChanParamList(wan_ec_t *ec); + +u32 wanec_req_write(void*, u32 write_addr, u16 write_data); +u32 wanec_req_write_smear(void*, u32 addr, u16 data, u32 len); +u32 wanec_req_write_burst(void*, u32 addr, u16 *data, u32 len); +u32 wanec_req_read(void*, u32 addr, u16 *data); +u32 wanec_req_read_burst(void*, u32 addr, u16 *data, u32 len); + +extern int wan_ec_write_internal_dword(wan_ec_dev_t *ec_dev, u32 addr1, u32 data); +extern int wan_ec_read_internal_dword(wan_ec_dev_t *ec_dev, u32 addr1, u32 *data); + +/*============================================================= + * Function definition +*/ +static int wanec_hndl2ec_channel(wan_ec_t *ec, UINT32 ChannelHndl) +{ + int channel = 0; + + for(channel = 0; channel < ec->max_channels; channel++){ + if (ec->pEchoChannelHndl[channel] == ChannelHndl){ + return channel; + } + } + return 0; +} +int wanec_fe2ec_channel(wan_ec_dev_t *ec_dev, int fe_channel) +{ + int ec_channel = 0; + + if (ec_dev->fe_media == WAN_MEDIA_BRI){ + if (ec_dev->fe_lineno >= 12){ + ec_channel = WANEC_MAX_PORT_RANGE; + } + ec_channel += (ec_dev->fe_lineno * WANEC_MAX_BRI_PORT_RANGE + (fe_channel-1)); + }else if (ec_dev->fe_media == WAN_MEDIA_T1 || ec_dev->fe_media == WAN_MEDIA_FXOFXS){ + ec_channel = ec_dev->fe_lineno * WANEC_MAX_PORT_RANGE + (fe_channel-1); + }else{ + /*ec_channel = ec_dev->fe_lineno * ec_dev->fe_max_chans + channel;*/ + ec_channel = ec_dev->fe_lineno * WANEC_MAX_PORT_RANGE + fe_channel; + } + return ec_channel; +} + +static int wanec_ec2fe_channel(wan_ec_t *ec, int ec_chan, wan_ec_dev_t **ec_dev) +{ + wan_ec_dev_t *ec_dev_tmp; + int fe_chan; + + ec_dev_tmp = ec->pEcDevMap[ec_chan]; + if (ec_dev_tmp == NULL) return 0; + + fe_chan = ec_chan % WANEC_MAX_PORT_RANGE; + if (ec_dev_tmp->fe_media == WAN_MEDIA_BRI){ + fe_chan = fe_chan % WANEC_MAX_BRI_PORT_RANGE; + fe_chan++; + }else{ + if (ec_dev_tmp->fe_media == WAN_MEDIA_T1 || + ec_dev_tmp->fe_media == WAN_MEDIA_FXOFXS){ + fe_chan++; + } + } + if (ec_dev && *ec_dev) *ec_dev = ec_dev_tmp; + return fe_chan; +} + + +/****************************************************************** +** +** +*******************************************************************/ +tOCT6100_CHIP_IMAGE_INFO f_ChipImageInfo; +#if 0 +tOCT6100_GET_HW_REVISION f_Revision; +#endif +int wanec_ChipStats(wan_ec_dev_t *ec_dev, wanec_chip_stats_t *chip_stats, int reset, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHIP_STATS f_ChipStats; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + if (chip_stats){ + PRINT2(verbose, "%s: Reading chip statistics...\n", + ec->name); + } + Oct6100ChipGetStatsDef( &f_ChipStats ); + f_ChipStats.fResetChipStats = reset; + ulResult = Oct6100ChipGetStats( + ec->pChipInstance, + &f_ChipStats); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "%s: Reading chip statistics...\tFailed (err=0x%X)\n", + ec->name, ulResult); + return -EINVAL; + } + if (chip_stats){ + memcpy( &chip_stats->f_ChipStats, + &f_ChipStats, + sizeof(tOCT6100_CHIP_STATS)); + } + + if (chip_stats){ + PRINT2(verbose, "%s: Reading chip image info...\n", + ec->name); + } + + Oct6100ChipGetImageInfoDef( &f_ChipImageInfo ); + ulResult = Oct6100ChipGetImageInfo( + ec->pChipInstance, + &f_ChipImageInfo); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "%s: Reading chip image info...\tFailed (err=0x%X)\n", + ec->name, ulResult); + return -EINVAL; + } + if (chip_stats){ + if (chip_stats->f_ChipImageInfo){ + int err; + err = WAN_COPY_TO_USER( + &f_ChipImageInfo, + chip_stats->f_ChipImageInfo, + sizeof(tOCT6100_CHIP_IMAGE_INFO)); + if (err){ + DEBUG_EVENT( + "%s: Failed to copy chip image info to user space [%s:%d]!\n", + ec->name, __FUNCTION__,__LINE__); + return -EINVAL; + } + }else{ + PRINT2(verbose, + "%s: Echo Canceller image description:\n%s\n", + ec->name, f_ChipImageInfo.szVersionNumber); + PRINT2(verbose, + "%s: Echo Canceller image build ID\t\t\t%08X\n", + ec->name, f_ChipImageInfo.ulBuildId); + PRINT2(verbose, + "%s: Echo Canceller maximum number of channels\t%d\n", + ec->name, f_ChipImageInfo.ulMaxChannels); +#if 0 + PRINT2(verbose, + "%s: Echo Canceller maximum tail displacement\t\t%d\n", + ec->name, f_ChipImageInfo.ulMaxTailDisplacement); + PRINT2(verbose, + "%s: Echo Canceller per channel tail displacement\t%s\n", + ec->name, + (f_ChipImageInfo.fPerChannelTailDisplacement == TRUE)?"TRUE":"FALSE"); + PRINT2(verbose, + "%s: Echo Canceller per channel tail length\t\t%s\n", + ec->name, + (f_ChipImageInfo.fPerChannelTailLength == TRUE)?"TRUE":"FALSE"); + PRINT2(verbose, + "%s: Echo Canceller maximum tail length\t\t%d\n", + ec->name, f_ChipImageInfo.ulMaxTailLength); + PRINT2(verbose, + "%s: Echo Canceller buffer Playout support\t\t%s\n", + ec->name, + (f_ChipImageInfo.fBufferPlayout == TRUE)?"TRUE":"FALSE"); + PRINT2(verbose, + "%s: Echo Canceller adaptive noise reduction\t\t%s\n", + ec->name, + (f_ChipImageInfo.fAdaptiveNoiseReduction==TRUE)?"TRUE":"FALSE"); + PRINT2(verbose, + "%s: Echo Canceller SOUT noise bleaching\t\t%s\n", + ec->name, + (f_ChipImageInfo.fSoutNoiseBleaching==TRUE)?"TRUE":"FALSE"); + PRINT2(verbose, + "%s: Echo Canceller ROUT noise reduction\t\t%s\n", + ec->name, + (f_ChipImageInfo.fRoutNoiseReduction==TRUE)?"TRUE":"FALSE"); + PRINT2(verbose, + "%s: Echo Canceller ROUT noise reduction level\t\t%s\n", + ec->name, + (f_ChipImageInfo.fRoutNoiseReductionLevel==TRUE)?"TRUE":"FALSE"); + PRINT2(verbose, + "%s: Echo Canceller automatic level control\t\t%s\n", + ec->name, + (f_ChipImageInfo.fAutoLevelControl==TRUE)?"TRUE":"FALSE"); + PRINT2(verbose, + "%s: Echo Canceller acoustic echo cancellation\t\t%s\n", + ec->name, + (f_ChipImageInfo.fAcousticEcho==TRUE)?"TRUE":"FALSE"); + PRINT2(verbose, + "%s: Echo Canceller conferencing\t\t%s\n", + ec->name, + (f_ChipImageInfo.fConferencing==TRUE)?"TRUE":"FALSE"); + PRINT2(verbose, + "%s: Echo Canceller conferencing noise reduction\t\t%s\n", + ec->name, + (f_ChipImageInfo.fConferencingNoiseReduction==TRUE)?"TRUE":"FALSE"); +#endif + } + } + if (f_ChipImageInfo.ulMaxChannels < (unsigned int)ec->max_channels){ + ec->max_channels = f_ChipImageInfo.ulMaxChannels-1; + } + +// DEBUG_EVENT(verbose, "%s: Reading hw revision...\n", +// ec->name); +#if 0 + DEBUG_EVENT(verbose, "%s: Reading hw revision...\n", + ec->name); + ec->f_Revision.ulUserChipId = 0; + ec->f_Revision.pProcessContext = &ec->f_Context; + ulResult = Oct6100GetHwRevision(&ec->f_Revision); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "%s: Reading hw revision...\tFailed (err=0x%X)\n", + ec->name, ulResult); + return EINVAL; + } +#endif + return 0; +} + +int wanec_ChipOpenPrep(wan_ec_dev_t *ec_dev, char *devname, wanec_config_t *config, int verbose) +{ + tOCT6100_GET_INSTANCE_SIZE InstanceSize; + wan_ec_t *ec; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + WAN_ASSERT(config->imageData == NULL); + ec = ec_dev->ec; + + ulResult = Oct6100ChipOpenDef( &ec->f_OpenChip ); + + /*==============================================================*/ + /* Configure clocks */ + + /* upclk oscillator is at 33.33 Mhz */ + ec->f_OpenChip.ulUpclkFreq = cOCT6100_UPCLK_FREQ_33_33_MHZ; + + /* mclk will be generated by internal PLL at 133 Mhz */ + ec->f_OpenChip.fEnableMemClkOut = TRUE; +#if 1 + ec->f_OpenChip.ulMemClkFreq = cOCT6100_MCLK_FREQ_133_MHZ; +#else + ec->f_OpenChip.ulMemClkFreq = cOCT6100_MCLK_FREQ_125_MHZ; /*125*/ +#endif + + /*==============================================================*/ + + /*==============================================================*/ + /* General parameters */ + + /* Chip ID.*/ + ec->f_OpenChip.ulUserChipId = ec->chip_no; + + /* Set the max number of accesses to 1024 to speed things up */ + ec->f_OpenChip.ulMaxRwAccesses = 1024; + + /* Set the maximums that the chip needs to support for this test */ + ec->f_OpenChip.ulMaxChannels = config->max_channels; + + ec->f_OpenChip.ulMaxBiDirChannels = 0; + ec->f_OpenChip.ulMaxConfBridges = 0; //WANEC_MAX_CONFBRIDGE_DEF; + ec->f_OpenChip.ulMaxPhasingTssts = 0; + ec->f_OpenChip.ulMaxTdmStreams = 32; + ec->f_OpenChip.ulMaxTsiCncts = 2; + + /*==============================================================*/ + + /*==============================================================*/ + /* External Memory Settings */ + + /* Use DDR memory.*/ +#if 1 + ec->f_OpenChip.ulMemoryType = cOCT6100_MEM_TYPE_SDR; +#else + ec->f_OpenChip.ulMemoryType = cOCT6100_MEM_TYPE_DDR; +#endif + /* + **f_OpenChip.ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_8MB; + **f_OpenChip.ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_16MB;*/ + ec->f_OpenChip.ulMemoryChipSize = config->memory_chip_size; + ec->f_OpenChip.ulNumMemoryChips = 2; + + ec->f_OpenChip.ulSoftBufferPlayoutEventsBufSize = 2048; + + ec->f_OpenChip.fEnableChannelRecording = TRUE; + +#if defined(ENABLE_ACOUSTICECHO) + ec->f_OpenChip.fEnableAcousticEcho = TRUE; +#endif + +#if defined(ENABLE_PRODBIST) + /* Enable production bist mode */ + ec->f_OpenChip.fEnableProductionBist = TRUE; + ec->f_OpenChip.ulNumProductionBistLoops = 0x1; +#endif + + ec->f_OpenChip.ulMaxPlayoutBuffers = WANEC_MAC_PLAYOUT_BUFFERS; + + ec->f_OpenChip.pbyImageFile = ec->pImageData; + ec->f_OpenChip.ulImageSize = ec->ImageSize; + + /* Assign board index (0). */ + ec->f_Context.ulBoardId = ec->chip_no; + + /* Handle to driver */ + ec->f_Context.ec_dev = ec_dev; + + /* Interface name to driver */ + strlcpy(ec->f_Context.devname, devname, WAN_DRVNAME_SZ); + + ulResult = Oct6100GetInstanceSize(&ec->f_OpenChip, &InstanceSize); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to get EC chip instance size (err=0x%X)!\n", + ec->name, ulResult); + return -EINVAL; + } + + /* Allocate memory needed for API instance. */ + ec->pChipInstance = + (tPOCT6100_INSTANCE_API)wan_vmalloc(InstanceSize.ulApiInstanceSize); + if (ec->pChipInstance == NULL){ + DEBUG_EVENT( + "ERROR: %s: Failed to allocate memory for EC chip (%d bytes)!\n", + ec->name,InstanceSize.ulApiInstanceSize); + return -EINVAL; + } + + /* Open the OCT6100 on the evaluation board. */ + ec->f_OpenChip.pProcessContext = (PVOID)&ec->f_Context; + + /* parse advanced params (global custom configuration) */ + if (ec->custom_conf.param_no){ + wanec_ChipParam(ec, &ec->f_OpenChip, &ec->custom_conf, verbose); + } + /* parse advanced params (command line custom configuration) */ + if (config->custom_conf.param_no){ + wanec_ChipParam(ec, &ec->f_OpenChip, &config->custom_conf, verbose); + } + + ec->ulDebugChannelHndl = cOCT6100_INVALID_HANDLE; + ec->ulDebugDataMode = config->debug_data_mode; + return 0; +} + +int wanec_ChipOpen(wan_ec_dev_t *ec_dev, int verbose) +{ + wan_ec_t *ec; + UINT32 ulResult, i = 0; + INT ec_chan = 0; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + PRINT2(verbose, + "%s: Opening Echo Canceller Chip ...\n", + ec->name); + if (ec->f_OpenChip.pbyImageFile == NULL){ + DEBUG_EVENT( + "ERROR: %s: Invalid EC image pointer\n", + ec->name); + return -EINVAL; + } + ulResult = Oct6100ChipOpen( + ec->pChipInstance, /* API instance memory. */ + &ec->f_OpenChip ); /* Open chip structure. */ + if ( ulResult != cOCT6100_ERR_OK ){ + if (ec->imageLast == WANOPT_YES || + ulResult != cOCT6100_ERR_OPEN_INVALID_FIRMWARE_OR_CAPACITY_PINS){ + DEBUG_EVENT( + "ERROR: %s: Failed to open Echo Canceller Chip (err=0x%X)\n", + ec->name, ulResult); + } + return -EINVAL; + } + + if (wanec_ChipStats(ec_dev, NULL, TRUE, verbose)){ + DEBUG_EVENT( + "ERROR: %s: Failed to read EC chip statistics!\n", + ec->name); + wanec_ChipClose(ec_dev, verbose); + return EINVAL; + } + + ec->pToneBufferIndexes = + wan_malloc(sizeof(UINT32) * ec->f_OpenChip.ulMaxPlayoutBuffers); + if (ec->pToneBufferIndexes == NULL){ + DEBUG_EVENT( + "ERROR: %s: Failed allocate memory for playout handles!\n", + ec->name); + wanec_ChipClose(ec_dev, verbose); + return EINVAL; + } + i = 0; + while(i < ec->f_OpenChip.ulMaxPlayoutBuffers){ + ec->pToneBufferIndexes[i++] = cOCT6100_INVALID_VALUE; + } + ec->pEchoChannelHndl = + wan_malloc(sizeof(UINT32) * ec->max_channels); + if (ec->pEchoChannelHndl == NULL){ + DEBUG_EVENT( + "ERROR: %s: Failed allocate memory for channel handle!\n", + ec->name); + wan_free(ec->pToneBufferIndexes); + wanec_ChipClose(ec_dev, verbose); + return EINVAL; + } +#if !defined(__WINDOWS__) + ec->pEcDevMap = wan_malloc(sizeof(wan_ec_dev_t*) * ec->max_channels); +#endif + if (ec->pEcDevMap == NULL){ + DEBUG_EVENT( + "ERROR: %s: Failed allocate memory for ec channel map!\n", + ec->name); + wan_free(ec->pToneBufferIndexes); + wan_free(ec->pEchoChannelHndl); + wanec_ChipClose(ec_dev, verbose); + return -EINVAL; + } + for(ec_chan = 0; ec_chan < ec->max_channels; ec_chan++){ + ec->pEchoChannelHndl[ec_chan] = cOCT6100_INVALID_HANDLE; + ec->pEcDevMap[ec_chan] = NULL; + } + return 0; +} + +int wanec_ChipClose(wan_ec_dev_t *ec_dev, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHIP_CLOSE f_CloseChip; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + PRINT2(verbose, + "%s: Closing Echo Canceller Chip ...\n", + ec->name); + Oct6100ChipCloseDef( &f_CloseChip ); + ulResult = Oct6100ChipClose( + ec->pChipInstance, + &f_CloseChip ); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to close Echo Canceller chip (err=0x%X)!\n", + ec->name, ulResult); + return -EINVAL; + } + if (ec->pChipInstance){ + wan_vfree(ec->pChipInstance); + ec->pChipInstance = NULL; + } + if (ec->pToneBufferIndexes){ + wan_free(ec->pToneBufferIndexes); + ec->pToneBufferIndexes = NULL; + } + if (ec->pEchoChannelHndl){ + wan_free(ec->pEchoChannelHndl); + ec->pEchoChannelHndl = NULL; + } +#if !defined(__WINDOWS__) + if (ec->pEcDevMap){ + wan_free(ec->pEcDevMap); + ec->pEcDevMap = NULL; + } +#endif + return 0; +} + +int wanec_ChannelOpen(wan_ec_dev_t *ec_dev, int verbose) +{ + tOCT6100_CHANNEL_OPEN EchoChannelOpen; + wan_ec_t *ec; + sdla_t *card; + UINT32 ulResult; + UINT32 stream = 0,timeslot=0; + INT channel, pcm_law_type; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + WAN_ASSERT(ec_dev->card == NULL); + ec = ec_dev->ec; + card = (sdla_t*)ec_dev->card; + + pcm_law_type = (WAN_FE_TDMV_LAW(&card->fe) == WAN_TDMV_MULAW) ? + cOCT6100_PCM_U_LAW : cOCT6100_PCM_A_LAW; + PRINT2(verbose, + "%s: Openning all Echo Canceller channels (%s)...\n", + ec->name, + (pcm_law_type == cOCT6100_PCM_U_LAW) ? + "MULAW":"ALAW"); + + for(channel = 0; channel < ec->max_channels; channel++){ + Oct6100ChannelOpenDef( &EchoChannelOpen ); + + /* Assign the handle memory.*/ + EchoChannelOpen.pulChannelHndl = &ec->pEchoChannelHndl[channel]; + + /* Make sure the channel does not perform echo cancellation */ +#if defined(WANEC_BYDEFAULT_NORMAL) + EchoChannelOpen.ulEchoOperationMode = + cOCT6100_ECHO_OP_MODE_NORMAL; +#else + EchoChannelOpen.ulEchoOperationMode = + cOCT6100_ECHO_OP_MODE_POWER_DOWN; +#endif + EchoChannelOpen.fEnableToneDisabler = TRUE; + + stream = (channel % 2 == 1) ? 4 : 0; + timeslot = channel / 2; + + /* Configure the TDM interface.*/ + EchoChannelOpen.TdmConfig.ulRinPcmLaw = pcm_law_type; + EchoChannelOpen.TdmConfig.ulRoutPcmLaw = pcm_law_type; + EchoChannelOpen.TdmConfig.ulSinPcmLaw = pcm_law_type; + EchoChannelOpen.TdmConfig.ulSoutPcmLaw = pcm_law_type; + + EchoChannelOpen.TdmConfig.ulRinStream = stream + 0; + EchoChannelOpen.TdmConfig.ulRinTimeslot = timeslot; + EchoChannelOpen.TdmConfig.ulRoutStream = stream + 1; + EchoChannelOpen.TdmConfig.ulRoutTimeslot = timeslot; + EchoChannelOpen.TdmConfig.ulSinStream = stream + 2; + EchoChannelOpen.TdmConfig.ulSinTimeslot = timeslot; + EchoChannelOpen.TdmConfig.ulSoutStream = stream + 3; + EchoChannelOpen.TdmConfig.ulSoutTimeslot = timeslot; + + /* Set the desired VQE features (TRUE/FALSE).*/ + EchoChannelOpen.VqeConfig.fEnableNlp = TRUE; + EchoChannelOpen.VqeConfig.fRinDcOffsetRemoval = TRUE; + EchoChannelOpen.VqeConfig.fSinDcOffsetRemoval = TRUE; +#if defined(ENABLE_ACOUSTICECHO) + EchoChannelOpen.VqeConfig.fAcousticEcho = TRUE; +#endif + + EchoChannelOpen.VqeConfig.fSoutAdaptiveNoiseReduction = TRUE; + EchoChannelOpen.VqeConfig.ulComfortNoiseMode = + cOCT6100_COMFORT_NOISE_NORMAL; + /* cOCT6100_COMFORT_NOISE_NORMAL + ** cOCT6100_COMFORT_NOISE_EXTENDED, + ** cOCT6100_COMFORT_NOISE_OFF, + ** cOCT6100_COMFORT_NOISE_FAST_LATCH */ + + PRINT2(verbose, + "%s: Openning Echo Canceller channel %d (%s)...\n", + ec->name, + channel, + (pcm_law_type == cOCT6100_PCM_U_LAW) ? + "MULAW":"ALAW"); + /* Open the channel.*/ + ulResult = Oct6100ChannelOpen( ec->pChipInstance, + &EchoChannelOpen ); + if (ulResult != cOCT6100_ERR_OK){ + DEBUG_EVENT( + "ERROR: %s: Failed to open Echo Canceller channel %d (err=0x%X)!\n", + ec->name, + channel, + ulResult); + return ulResult; + } + } + + /* Init debug channel handle */ + ec->ulDebugChannelHndl = cOCT6100_INVALID_HANDLE; + + return 0; +} + +int wanec_ChannelClose(wan_ec_dev_t *ec_dev, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_CLOSE EchoChannelClose; + UINT32 ulResult, channel; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + PRINT2(verbose, + "%s: Closing all Echo Canceller channels ...\n", + ec->name); + for(channel = 0; channel < (UINT32)ec->max_channels; channel++){ + Oct6100ChannelCloseDef( &EchoChannelClose ); + EchoChannelClose.ulChannelHndl = + ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ChannelClose( ec->pChipInstance, + &EchoChannelClose ); + if (ulResult != cOCT6100_ERR_OK){ + DEBUG_EVENT( + "ERROR: %s: Failed to close Echo Canceller channel %d (err=0x%X)!\n", + ec->name, + channel, + ulResult); + return -EINVAL; + } + ec->pEchoChannelHndl[channel] = cOCT6100_INVALID_HANDLE; + } + return 0; +} + +int wanec_ChannelModifyOpmode( wan_ec_dev_t *ec_dev, + INT channel, + UINT32 opmode, + int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_MODIFY EchoChannelModify; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + PRINT2(verbose, "%s: Modifing EC Channel OPMODE to %d on ec_chan:%d...\n", + ec->name, opmode, channel); + + Oct6100ChannelModifyDef( &EchoChannelModify ); + /* Assign the handle memory.*/ + EchoChannelModify.ulChannelHndl = ec->pEchoChannelHndl[channel]; + + /* Echo Channel Operation Mode */ + EchoChannelModify.ulEchoOperationMode = opmode; + + /* Open the channel.*/ + ulResult = Oct6100ChannelModify( + ec->pChipInstance, + &EchoChannelModify ); + if (ulResult != cOCT6100_ERR_OK){ + DEBUG_EVENT( + "%s: Failed to modify EC Channel OPMOde for ec_chan:%d (err=0x%X)\n", + ec->name, channel, ulResult); + return EINVAL; + } + return 0; +} + +int wanec_ChannelModifyCustom( wan_ec_dev_t *ec_dev, + INT channel, + wanec_chan_custom_t *chan_custom, + int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_MODIFY EchoChannelModify; + UINT32 ulResult; + int err; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + WAN_ASSERT(chan_custom == NULL); + WAN_ASSERT(chan_custom->custom_conf.param_no == 0); + ec = ec_dev->ec; + + PRINT2(verbose, "%s: Modifing EC Channel Config parameters for ec_chan:%d...\n", + ec->name, channel); + + Oct6100ChannelModifyDef( &EchoChannelModify ); + /* Assign the handle memory.*/ + EchoChannelModify.ulChannelHndl = ec->pEchoChannelHndl[channel]; + /* parse advianced params */ + err = wanec_ChanParam(ec, &EchoChannelModify, &chan_custom->custom_conf, verbose); + if (err){ + DEBUG_EVENT( + "%s: WARNING: Unsupported parameter for channel %d!\n", + ec->name, channel); + return -EINVAL; + } + + /* Open the channel.*/ + ulResult = Oct6100ChannelModify( + ec->pChipInstance, + &EchoChannelModify ); + if (ulResult != cOCT6100_ERR_OK){ + DEBUG_EVENT( + "%s: Failed to modify EC channel config parameters for ec_chan:%d (err=0x%X)\n", + ec->name, channel, ulResult); + return EINVAL; + } + return 0; +} + +/****************************************************************************** +** CONFERENCE BRIDGE FUNCTIONS +******************************************************************************/ +int wanec_ChannelMute(wan_ec_dev_t* ec_dev, INT ec_chan, wanec_chan_mute_t *mute, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_MUTE f_ChannelMute; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + Oct6100ChannelMuteDef( &f_ChannelMute ); + f_ChannelMute.ulChannelHndl = ec->pEchoChannelHndl[ec_chan]; + f_ChannelMute.ulPortMask = cOCT6100_CHANNEL_MUTE_PORT_NONE; + if (mute == NULL || mute->port_map & WAN_EC_CHANNEL_PORT_SOUT) + f_ChannelMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_SOUT; + if (mute == NULL || mute->port_map & WAN_EC_CHANNEL_PORT_SIN) + f_ChannelMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_SIN; + if (mute == NULL || mute->port_map & WAN_EC_CHANNEL_PORT_ROUT) + f_ChannelMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_ROUT; + if (mute == NULL || mute->port_map & WAN_EC_CHANNEL_PORT_RIN) + f_ChannelMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_RIN; + PRINT2(verbose, "%s: Muting EC Channel %d on port:%X...\n", + ec->name, ec_chan, f_ChannelMute.ulPortMask); + ulResult = Oct6100ChannelMute( + ec->pChipInstance, + &f_ChannelMute); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to mute EC channel %d on port %X (%08X)!\n", + ec->name, ec_chan, f_ChannelMute.ulPortMask, ulResult); + return EINVAL; + } + return 0; +} +int wanec_ChannelUnMute(wan_ec_dev_t *ec_dev, INT ec_chan, wanec_chan_mute_t *mute, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_UNMUTE f_ChannelUnMute; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + Oct6100ChannelUnMuteDef( &f_ChannelUnMute ); + f_ChannelUnMute.ulChannelHndl = ec->pEchoChannelHndl[ec_chan]; + f_ChannelUnMute.ulPortMask = cOCT6100_CHANNEL_MUTE_PORT_NONE; + if (mute == NULL || mute->port_map & WAN_EC_CHANNEL_PORT_SOUT) + f_ChannelUnMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_SOUT; + if (mute == NULL || mute->port_map & WAN_EC_CHANNEL_PORT_SIN) + f_ChannelUnMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_SIN; + if (mute == NULL || mute->port_map & WAN_EC_CHANNEL_PORT_ROUT) + f_ChannelUnMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_ROUT; + if (mute == NULL || mute->port_map & WAN_EC_CHANNEL_PORT_RIN) + f_ChannelUnMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_RIN; + PRINT2(verbose, "%s: Un-Muting EC channel %d on port:%X...\n", + ec->name, ec_chan, f_ChannelUnMute.ulPortMask); + ulResult = Oct6100ChannelUnMute( + ec->pChipInstance, + &f_ChannelUnMute); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to un-mute channel %d on port %X (%08X)!\n", + ec->name, ec_chan, f_ChannelUnMute.ulPortMask, ulResult); + return EINVAL; + } + return 0; +} + +int wanec_ChannelStats(wan_ec_dev_t *ec_dev, INT channel, wanec_chan_stats_t *chan_stats, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_STATS f_ChannelStats; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + PRINT2(verbose, "%s: Reading EC statistics for channel %d...\n", + ec->name, channel); + Oct6100ChannelGetStatsDef( &f_ChannelStats ); + f_ChannelStats.ulChannelHndl = ec->pEchoChannelHndl[channel]; + f_ChannelStats.fResetStats = chan_stats->reset; + ulResult = Oct6100ChannelGetStats( + ec->pChipInstance, + &f_ChannelStats); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to read EC stats for channel %d (%08X)!\n", + ec->name, channel, ulResult); + return EINVAL; + } + if (chan_stats){ + memcpy( &chan_stats->f_ChannelStats, + &f_ChannelStats, + sizeof(tOCT6100_CHANNEL_STATS)); + } + return 0; +} + +int wanec_TonesEnable(wan_ec_t *ec, int ec_chan, wanec_dtmf_config_t *dtmf, int verbose) +{ + tOCT6100_TONE_DETECTION_ENABLE f_ToneDetectionEnable; + UINT32 ulResult; + int i; + + PRINT2(verbose, "%s: Enable EC tone detection on chan %d port %X ...\n", + ec->name, + ec_chan, + (dtmf == NULL) ? WAN_EC_CHANNEL_PORT_SOUT|WAN_EC_CHANNEL_PORT_ROUT:dtmf->port_map); + + if (dtmf == NULL || dtmf->port_map & WAN_EC_CHANNEL_PORT_ROUT){ + for(i = 0; i < WAN_NUM_DTMF_TONES; i++){ + + Oct6100ToneDetectionEnableDef( &f_ToneDetectionEnable ); + f_ToneDetectionEnable.ulChannelHndl = + ec->pEchoChannelHndl[ec_chan]; + f_ToneDetectionEnable.ulToneNumber = + DetectedRoutToneNumbers[i]; + ulResult = Oct6100ToneDetectionEnable ( + ec->pChipInstance, + &f_ToneDetectionEnable); + if ( ulResult == cOCT6100_ERR_OK ){ + continue; + }else if (ulResult == cOCT6100_ERR_TONE_DETECTION_TONE_ACTIVATED){ + PRINT2(verbose, + "%s: EC Tone detection is already enabled on channel %d for port ROUT!\n", + ec->name, ec_chan); + continue; /* already activated */ + }else{ + DEBUG_EVENT( + "ERROR: %s: Failed to enable EC tone detection on ec chan %d!\n", + ec->name, ec_chan); + DEBUG_EVENT( + "ERROR: %s: (err=0x%X,i=%d)!\n", + ec->name, + (unsigned int)ulResult, i); + return -EINVAL; + } + } + } + if (dtmf == NULL || dtmf->port_map & WAN_EC_CHANNEL_PORT_SOUT){ + for(i = 0; i < WAN_NUM_DTMF_TONES; i++){ + + Oct6100ToneDetectionEnableDef( &f_ToneDetectionEnable ); + f_ToneDetectionEnable.ulChannelHndl = + ec->pEchoChannelHndl[ec_chan]; + f_ToneDetectionEnable.ulToneNumber = + DetectedSoutToneNumbers[i]; + ulResult = Oct6100ToneDetectionEnable ( + ec->pChipInstance, + &f_ToneDetectionEnable); + if ( ulResult == cOCT6100_ERR_OK ){ + continue; + }else if (ulResult == cOCT6100_ERR_TONE_DETECTION_TONE_ACTIVATED){ + PRINT2(verbose, + "%s: EC Tone detection is already enabled on channel %d for port SOUT!\n", + ec->name, ec_chan); + continue; /* already activated */ + }else{ + DEBUG_EVENT( + "ERROR: %s: Failed to enable EC tone detection on channel %d!\n", + ec->name, ec_chan); + DEBUG_EVENT( + "ERROR: %s: (err=0x%X,i=%d)!\n", + ec->name, + (unsigned int)ulResult, i); + return -EINVAL; + } + } + } + + return 0; +} + +int wanec_TonesDisable(wan_ec_t *ec, int ec_chan, wanec_dtmf_config_t *dtmf, int verbose) +{ + tOCT6100_TONE_DETECTION_DISABLE f_ToneDetectionDisable; + UINT32 ulResult; + INT i; + + PRINT2(verbose, "%s: Disable EC tone detection on channel %d port %X...\n", + ec->name, + ec_chan, + (dtmf == NULL) ? WAN_EC_CHANNEL_PORT_SOUT|WAN_EC_CHANNEL_PORT_ROUT:dtmf->port_map); + if (dtmf == NULL || dtmf->port_map & WAN_EC_CHANNEL_PORT_ROUT){ + + for(i = 0; i < WAN_NUM_DTMF_TONES; i++){ + + Oct6100ToneDetectionDisableDef( &f_ToneDetectionDisable ); + f_ToneDetectionDisable.ulChannelHndl = + ec->pEchoChannelHndl[ec_chan]; + if (ec_chan >= 0){ + f_ToneDetectionDisable.ulToneNumber = + DetectedRoutToneNumbers[i]; + }else{ + f_ToneDetectionDisable.fDisableAll = TRUE; + } + ulResult = Oct6100ToneDetectionDisable ( + ec->pChipInstance, + &f_ToneDetectionDisable); + if ( ulResult != cOCT6100_ERR_OK ){ + if (ulResult != cOCT6100_ERR_TONE_DETECTION_TONE_NOT_ACTIVATED){ + DEBUG_EVENT( + "ERROR: %s: Failed to disable EC tone detection for channel %d (err=0x%X,i=%d)!\n", + ec->name, ec_chan, + (unsigned int)ulResult, i); + return -EINVAL; + } + } + } + } + if (dtmf == NULL || dtmf->port_map & WAN_EC_CHANNEL_PORT_SOUT){ + + for(i = 0; i < WAN_NUM_DTMF_TONES; i++){ + + Oct6100ToneDetectionDisableDef( &f_ToneDetectionDisable ); + f_ToneDetectionDisable.ulChannelHndl = + ec->pEchoChannelHndl[ec_chan]; + if (ec_chan >= 0){ + f_ToneDetectionDisable.ulToneNumber = + DetectedSoutToneNumbers[i]; + }else{ + f_ToneDetectionDisable.fDisableAll = TRUE; + } + ulResult = Oct6100ToneDetectionDisable ( + ec->pChipInstance, + &f_ToneDetectionDisable); + if ( ulResult != cOCT6100_ERR_OK ){ + if (ulResult != cOCT6100_ERR_TONE_DETECTION_TONE_NOT_ACTIVATED){ + DEBUG_EVENT( + "ERROR: %s: Failed to disable EC tone detection for channel %d (err=0x%X,i=%d)!\n", + ec->name, ec_chan, + (unsigned int)ulResult, i); + return -EINVAL; + } + } + } + } + return 0; +} + +//#if defined(WAN_DEBUG_HWEC) +#if 1 +static CHAR* wanec_ToneId2Str(UINT32 f_ulToneId) +{ + switch (f_ulToneId){ + /* DTMF Section */ + case ROUT_DTMF_0: return "ROUT_DTMF_0"; + case ROUT_DTMF_1: return "ROUT_DTMF_1"; + case ROUT_DTMF_2: return "ROUT_DTMF_2"; + case ROUT_DTMF_3: return "ROUT_DTMF_3"; + case ROUT_DTMF_4: return "ROUT_DTMF_4"; + case ROUT_DTMF_5: return "ROUT_DTMF_5"; + case ROUT_DTMF_6: return "ROUT_DTMF_6"; + case ROUT_DTMF_7: return "ROUT_DTMF_7"; + case ROUT_DTMF_8: return "ROUT_DTMF_8"; + case ROUT_DTMF_9: return "ROUT_DTMF_9"; + case ROUT_DTMF_A: return "ROUT_DTMF_A"; + case ROUT_DTMF_B: return "ROUT_DTMF_B"; + case ROUT_DTMF_C: return "ROUT_DTMF_C"; + case ROUT_DTMF_D: return "ROUT_DTMF_D"; + case ROUT_DTMF_STAR: return "ROUT_DTMF_STAR"; + case ROUT_DTMF_POUND: return "ROUT_DTMF_POUND"; + case SOUT_DTMF_0: return "SOUT_DTMF_0"; + case SOUT_DTMF_1: return "SOUT_DTMF_1"; + case SOUT_DTMF_2: return "SOUT_DTMF_2"; + case SOUT_DTMF_3: return "SOUT_DTMF_3"; + case SOUT_DTMF_4: return "SOUT_DTMF_4"; + case SOUT_DTMF_5: return "SOUT_DTMF_5"; + case SOUT_DTMF_6: return "SOUT_DTMF_6"; + case SOUT_DTMF_7: return "SOUT_DTMF_7"; + case SOUT_DTMF_8: return "SOUT_DTMF_8"; + case SOUT_DTMF_9: return "SOUT_DTMF_9"; + case SOUT_DTMF_A: return "SOUT_DTMF_A"; + case SOUT_DTMF_B: return "SOUT_DTMF_B"; + case SOUT_DTMF_C: return "SOUT_DTMF_C"; + case SOUT_DTMF_D: return "SOUT_DTMF_D"; + case SOUT_DTMF_STAR: return "SOUT_DTMF_STAR"; + case SOUT_DTMF_POUND: return "SOUT_DTMF_POUND"; + + /* System 5/6/7 Section */ + case SIN_SYSTEM5_2400: return "SIN_SYSTEM5_2400"; + case SIN_SYSTEM5_2600: return "SIN_SYSTEM5_2600"; + case SIN_SYSTEM5_2400_2600: return "SIN_SYSTEM5_2400_2600"; + case SIN_SYSTEM7_2000: return "SIN_SYSTEM7_2000"; + case SIN_SYSTEM7_1780: return "SIN_SYSTEM7_1780"; + + default: return "INVALID TONE ID!"; + } +} +#endif + +static unsigned char wanec_ConvertToneId(UINT32 f_ulToneId, unsigned char *ec_dtmf_port) +{ + switch (f_ulToneId){ + /* DTMF Section */ + case ROUT_DTMF_0: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '0'; + case ROUT_DTMF_1: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '1'; + case ROUT_DTMF_2: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '2'; + case ROUT_DTMF_3: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '3'; + case ROUT_DTMF_4: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '4'; + case ROUT_DTMF_5: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '5'; + case ROUT_DTMF_6: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '6'; + case ROUT_DTMF_7: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '7'; + case ROUT_DTMF_8: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '8'; + case ROUT_DTMF_9: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '9'; + case ROUT_DTMF_A: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return 'A'; + case ROUT_DTMF_B: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return 'B'; + case ROUT_DTMF_C: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return 'C'; + case ROUT_DTMF_D: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return 'D'; + case ROUT_DTMF_STAR: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '*'; + case ROUT_DTMF_POUND: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '#'; + case SOUT_DTMF_0: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '0'; + case SOUT_DTMF_1: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '1'; + case SOUT_DTMF_2: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '2'; + case SOUT_DTMF_3: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '3'; + case SOUT_DTMF_4: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '4'; + case SOUT_DTMF_5: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '5'; + case SOUT_DTMF_6: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '6'; + case SOUT_DTMF_7: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '7'; + case SOUT_DTMF_8: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '8'; + case SOUT_DTMF_9: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '9'; + case SOUT_DTMF_A: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return 'A'; + case SOUT_DTMF_B: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return 'B'; + case SOUT_DTMF_C: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return 'C'; + case SOUT_DTMF_D: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return 'D'; + case SOUT_DTMF_STAR: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '*'; + case SOUT_DTMF_POUND: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '#'; + } + return 0x00000000; +} + +#if 1 +//#if defined(WAN_DEBUG_HWEC) +static CHAR* wanec_ToneType2Str(UINT32 f_ulToneType) +{ + switch (f_ulToneType){ + case cOCT6100_TONE_PRESENT: return "cOCT6100_TONE_PRESENT"; + case cOCT6100_TONE_STOP: return "cOCT6100_TONE_STOP"; + default: return "INVALID TONE TYPE!"; + } +} +#endif +static unsigned char wanec_ConvertToneType(UINT32 f_ulToneType) +{ + switch (f_ulToneType){ + case cOCT6100_TONE_PRESENT: return WAN_EC_TONE_PRESENT; + case cOCT6100_TONE_STOP: return WAN_EC_TONE_STOP; + } + return 0x00; +} + +static CHAR* wanec_BufferPlayoutType2Str(UINT32 f_ulBufferPlayoutType) +{ + switch (f_ulBufferPlayoutType){ + case cOCT6100_BUFFER_PLAYOUT_EVENT_STOP: return "PLAYOUT_EVENT_STOP"; +#if 0 + case cOCT6100_BUFFER_PLAYOUT_EVENT_CALLER_ID_STOP: return "PLAYOUT_EVENT_CALLER_ID_STOP"; + case cOCT6100_BUFFER_PLAYOUT_EVENT_CALLER_ID_AS_STOP: return "PLAYOUT_EVENT_CALLER_ID_AS_STOP"; +#endif + default: return "INVALID BUFFER_PLAYOUT TYPE!"; + } +} + +/* +** wanec_ToneEvent() +** +** Return: 0 - on success +** <0 - on error +** 1 - pending dtmf events +**/ + +int wanec_ToneEvent(wan_ec_t *ec, int verbose) +{ + tOCT6100_EVENT_GET_TONE f_GetToneEvent; + tOCT6100_TONE_EVENT ToneEvent[32]; + UINT32 ulResult; + wan_ec_dev_t *ec_dev; + sdla_t *card; + UINT32 i; + int ec_chan,fe_chan; + + PRINT2(verbose, "%s: Getting Tone events ...\n", + ec->name); + Oct6100EventGetToneDef( &f_GetToneEvent ); + f_GetToneEvent.fResetBufs = FALSE; + f_GetToneEvent.ulMaxToneEvent = WANEC_MAX_TONEEVENTS; + f_GetToneEvent.pToneEvent = ToneEvent; + ulResult = Oct6100EventGetTone( + ec->pChipInstance, + &f_GetToneEvent); + if ( ulResult != cOCT6100_ERR_OK ){ + if ( ulResult != cOCT6100_ERR_EVENTS_TONE_BUF_EMPTY ){ + PRINT2(verbose, "%s: There are not tone events!\n", + ec->name); + return 0; + } + DEBUG_EVENT( + "ERROR: %s: Failed to get tone events (err=0x%X)!\n", + ec->name, ulResult); + return -EINVAL; + } + + /* No dtmf tone event returned */ + if (!f_GetToneEvent.ulNumValidToneEvent) return 0; + + for(i = 0; i < f_GetToneEvent.ulNumValidToneEvent; i++){ + ec_chan = wanec_hndl2ec_channel(ec, ToneEvent[i].ulChannelHndl); + ec_dev = ec->pEcDevMap[ec_chan]; + fe_chan = wanec_ec2fe_channel(ec, ec_chan, &ec_dev); + if (ec_dev == NULL || ec_dev->card == NULL){ + DEBUG_EVENT( + "%s: Internal Error: Failed to find fe channel (ec_chan=%d)\n", + ec->name, ec_chan); + continue; + } + + PRINT2(verbose, + "%s: Tone event %s %s on fe_chan=%d ec_chan=%d\n", + ec_dev->devname, + wanec_ToneId2Str(ToneEvent[i].ulToneDetected), + wanec_ToneType2Str(f_GetToneEvent.pToneEvent[i].ulEventType), + fe_chan, ec_chan); + + card = (sdla_t*)ec_dev->card; + if (card->wandev.event_callback.dtmf){ + wan_event_t event; + unsigned char dtmf_port = WAN_EC_CHANNEL_PORT_ROUT, dtmf_type; + + event.type = WAN_EVENT_EC_DTMF; + event.channel = fe_chan; + event.digit = wanec_ConvertToneId( + ToneEvent[i].ulToneDetected, + &dtmf_port); + dtmf_type = wanec_ConvertToneType(ToneEvent[i].ulEventType); + event.dtmf_type = dtmf_type; + event.dtmf_port = dtmf_port; + card->wandev.event_callback.dtmf(card, &event); + } + } + + /* Return 1 if more dtmf event are present, otherwise - 0 */ + return (f_GetToneEvent.fMoreEvents == TRUE) ? 1 : 0; +} + +/* +** wanec_PlayoutEvent() +** +** Return: 0 - on success +** <0 - on error +** 1 - pending dtmf events +**/ +int wanec_PlayoutEvent(wan_ec_t *ec, int verbose) +{ + tOCT6100_BUFFER_PLAYOUT_GET_EVENT f_BufferPlayoutGetEvent; + tOCT6100_BUFFER_PLAYOUT_EVENT PlayoutEvent[32]; + UINT32 ulResult; + wan_ec_dev_t *ec_dev; + UINT32 i; + int ec_chan,fe_chan; + + PRINT2(verbose, "%s: Getting EC Buffer Playout events ...\n", + ec->name); + Oct6100BufferPlayoutGetEventDef( &f_BufferPlayoutGetEvent ); + f_BufferPlayoutGetEvent.pBufferPlayoutEvent = PlayoutEvent; + f_BufferPlayoutGetEvent.ulMaxEvent = WANEC_MAX_PLAYOUTEVENTS; + f_BufferPlayoutGetEvent.fResetBufs = FALSE; + + ulResult = Oct6100BufferPlayoutGetEvent( + ec->pChipInstance, + &f_BufferPlayoutGetEvent); + if ( ulResult != cOCT6100_ERR_OK ){ + if ( ulResult != cOCT6100_ERR_BUFFER_PLAYOUT_EVENT_BUF_EMPTY ){ + PRINT2(verbose, "%s: There are not buffer playout events!\n", + ec->name); + return 0; + } + DEBUG_EVENT( + "ERROR: %s: Failed to get buffer playout events (err=0x%X)!\n", + ec->name, ulResult); + return -EINVAL; + } + + /* No dtmf tone event returned */ + if (!f_BufferPlayoutGetEvent.ulNumValidEvent) return 0; + + for(i = 0; i < f_BufferPlayoutGetEvent.ulNumValidEvent; i++){ + ec_chan = wanec_hndl2ec_channel(ec, PlayoutEvent[i].ulChannelHndl); + ec_dev = ec->pEcDevMap[ec_chan]; + fe_chan = wanec_ec2fe_channel(ec, ec_chan, &ec_dev); + if (ec_dev == NULL || ec_dev->card == NULL){ + DEBUG_EVENT( + "%s: Internal Error: Failed to find fe channel (ec_chan=%d)\n", + ec->name, ec_chan); + continue; + } + + PRINT2(verbose, + "%s: EC Buffer Playout event id %d %s on fe_chan=%d ec_chan=%d port=%s\n", + ec_dev->devname, + PlayoutEvent[i].ulUserEventId, + wanec_BufferPlayoutType2Str(PlayoutEvent[i].ulEventType), + fe_chan, ec_chan, + (PlayoutEvent[i].ulChannelPort==cOCT6100_CHANNEL_PORT_ROUT) ? "ROUT" : "SOUT"); +#if 0 + card = (sdla_t*)ec_dev->card; + if (card->wandev.event_callback.playout){ + } +#endif + } + + /* Return 1 if more playout event are present, otherwise - 0 */ + return (f_BufferPlayoutGetEvent.fMoreEvents == TRUE) ? 1 : 0; +} + +/* +** wanec_ISR() +** +** Return: 0 - on success +** <0 - on error +** 1 - pending dtmf events +**/ +int wanec_ISR(wan_ec_t *ec, int verbose) +{ + UINT32 ulResult; + int ret = 0; + + WAN_ASSERT(ec == NULL); + + PRINT2(verbose, "%s: Executing EC interrupt routine ...\n", + ec->name); + Oct6100InterruptServiceRoutineDef(&ec->f_InterruptFlag); + + ulResult = Oct6100InterruptServiceRoutine( + ec->pChipInstance, + &ec->f_InterruptFlag ); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to execute interrupt Service Routine (err=%08X)!\n", + ec->name, + ulResult); + return -EINVAL; + } + /* Critical errors */ + if (ec->f_InterruptFlag.fFatalGeneral == TRUE){ + DEBUG_EVENT( + "%s: An internal fatal chip error detected (0x%X)!\n", + ec->name, + ec->f_InterruptFlag.ulFatalGeneralFlags); + } + if (ec->f_InterruptFlag.fFatalReadTimeout == TRUE){ + DEBUG_EVENT( + "%s: A read to the external memory has failed!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorRefreshTooLate == TRUE){ + DEBUG_EVENT( + "%s: Error Refresh Too Late!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorPllJitter == TRUE){ + DEBUG_EVENT( + "%s: Error Pll Jitter\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorH100OutOfSync == TRUE){ + DEBUG_EVENT( + "%s: The H100 slave has lost its framing on the bus!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorH100ClkA == TRUE){ + DEBUG_EVENT( + "%s: The CT_C8_A clock behavior does not conform to the H.100 spec!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorH100FrameA == TRUE){ + DEBUG_EVENT( + "%s: The CT_FRAME_A clock behavior does not comform to the H.100 spec!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorH100ClkB == TRUE){ + DEBUG_EVENT( + "%s: The CT_C8_B clock is not running a 16.384 MHz!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorOverflowToneEvents == TRUE){ + DEBUG_EVENT( + "%s: Error: Tone Event buffer has overflowed\n", + ec->name); + } + if (ec->f_InterruptFlag.fToneEventsPending == TRUE){ + PRINT2(verbose, "%s: Tone Event pending....\n", + ec->name); + ret = wanec_ToneEvent(ec, ec->tone_verbose); + } + if (ec->f_InterruptFlag.fBufferPlayoutEventsPending == TRUE){ + PRINT2(verbose, + "%s: Buffer Playout Events Pending\n", + ec->name); + ret = wanec_PlayoutEvent(ec, ec->playout_verbose); + } + if (ec->f_InterruptFlag.fApiSynch == TRUE){ + PRINT2(verbose, + "%s: The chip interrupted the API for purpose of maintaining sync!\n", + ec->name); + } + return ret; +} + +int wanec_DebugChannel(wan_ec_dev_t *ec_dev, INT channel, int verbose) +{ + wan_ec_t *ec = NULL; + tOCT6100_DEBUG_SELECT_CHANNEL DebugSelectChannel; + wanec_chan_stats_t chan_stats; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + /* Verify Echo Canceller Channel operation mode */ + memset(&chan_stats, 0, sizeof(wanec_chan_stats_t)); + ulResult = wanec_ChannelStats(ec_dev, channel, &chan_stats, 0); + if (chan_stats.f_ChannelStats.ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_POWER_DOWN){ + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Channel %d operation mode (POWER DOWN)!\n", + ec_dev->name, channel); + return -EINVAL; + } + + if (ec_dev->ec->ulDebugChannelHndl != cOCT6100_INVALID_HANDLE){ + DEBUG_EVENT( + "ERROR: %s: Echo Canceller daemon can monitor only one ec channel (%d)!\n", + ec_dev->name, channel); + return -EINVAL; + } + Oct6100DebugSelectChannelDef( &DebugSelectChannel ); + + PRINT2(verbose, "%s: Select ec channel %d for monitoring...\n", + ec_dev->name, + channel); + /* Set selected debug channel */ + ec->DebugChannel = channel; + ec->ulDebugChannelHndl = ec->pEchoChannelHndl[channel]; + DebugSelectChannel.ulChannelHndl= ec->pEchoChannelHndl[channel]; + + /* Select Debug channel */ + ulResult = Oct6100DebugSelectChannel( + ec->pChipInstance, + &DebugSelectChannel ); + if (ulResult != cOCT6100_ERR_OK){ + DEBUG_EVENT( + "ERROR: %s: Failed to select debug ec channel %d for monitoring (err=0x%X)\n", + ec->name, + channel, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_DebugGetData(wan_ec_dev_t *ec_dev, wanec_chan_monitor_t *chan_monitor, int verbose) +{ + wan_ec_t *ec = NULL; + tOCT6100_DEBUG_GET_DATA fDebugGetData; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + if (ec->ulDebugChannelHndl == cOCT6100_INVALID_HANDLE){ + DEBUG_EVENT( + "ERROR: %s: No Debug channel was selected!\n", + ec->name); + return -EINVAL; + } + + Oct6100DebugGetDataDef( &fDebugGetData ); + + PRINT2(verbose, + "%s: Retrieves debug data for ec channel %d...\n", + ec->name, + ec->DebugChannel); + + memset(&chan_monitor->data[0], 0, + sizeof(UINT8) * (MAX_MONITOR_DATA_LEN+1)); + /* Set selected debug channel */ + fDebugGetData.ulGetDataMode = ec->ulDebugDataMode; + fDebugGetData.ulMaxBytes = chan_monitor->max_len; + fDebugGetData.pbyData = &chan_monitor->data[0]; + + /* Select Debug channel */ + ulResult = Oct6100DebugGetData( + ec->pChipInstance, + &fDebugGetData ); + if (ulResult != cOCT6100_ERR_OK){ + DEBUG_EVENT( + "ERROR: %s: Failed to get debug data for ec channel %d (err=0x%X)\n", + ec->name, + ec->DebugChannel, + ulResult); + return -EINVAL; + } + chan_monitor->data_len = fDebugGetData.ulValidNumBytes; + chan_monitor->remain_len= fDebugGetData.ulRemainingNumBytes; + //chan_monitor->fe_chan = ec->DebugChannel; + chan_monitor->fe_chan = wanec_ec2fe_channel(ec, ec->DebugChannel, NULL); + + if (fDebugGetData.ulRemainingNumBytes == 0){ + /* Last read */ + ec->ulDebugChannelHndl = cOCT6100_INVALID_HANDLE; + } + + return 0; +} + +static PUINT32 wanec_search_bufferindex(wan_ec_t *ec, UINT32 index) +{ + UINT32 i = 0; + + while(i < ec->f_OpenChip.ulMaxPlayoutBuffers){ + if (ec->pToneBufferIndexes[i] == index){ + return &ec->pToneBufferIndexes[i]; + } + i++; + } + return NULL; +} + +int wanec_BufferLoad(wan_ec_dev_t *ec_dev, wanec_buffer_config_t *buffer_config, int verbose) +{ + wan_ec_t *ec; + tOCT6100_BUFFER_LOAD BufferLoad; + UINT32 size, ulResult, pcmlaw = WAN_EC_PCM_U_LAW; + PUINT8 pData = NULL; + int err; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + pcmlaw = (buffer_config->pcmlaw) ? buffer_config->pcmlaw : WAN_EC_PCM_U_LAW; + PRINT2(verbose, + "%s: Loading Tone buffer (%s) law=%s into Echo Canceller Chip ...\n", + ec->name, + buffer_config->buffer, + WAN_EC_DECODE_PCM_LAW(pcmlaw)); + size = buffer_config->size * sizeof(INT8); + pData = wan_vmalloc(size); + if (pData == NULL){ + DEBUG_EVENT( + "ERROR: %s: Failed to allocate memory for buffer!\n", + ec->name); + return -EINVAL; + } + err = WAN_COPY_FROM_USER(pData, buffer_config->data, size); + if (err){ + DEBUG_EVENT( + "ERROR: %s: Failed to copy EC buffer from user space [%s:%d]!\n", + ec->name, + __FUNCTION__,__LINE__); + wan_vfree(pData); + return -EINVAL; + } + + Oct6100BufferPlayoutLoadDef( &BufferLoad ); + BufferLoad.pulBufferIndex = wanec_search_bufferindex(ec, cOCT6100_INVALID_VALUE); + /* FIXME: Can be alaw/mulaw */ + BufferLoad.ulBufferPcmLaw = (pcmlaw == WAN_EC_PCM_U_LAW) ? + cOCT6100_PCM_U_LAW : cOCT6100_PCM_A_LAW; + BufferLoad.pbyBufferPattern = pData; + BufferLoad.ulBufferSize = size; + ulResult = Oct6100BufferPlayoutLoad ( + ec->pChipInstance, + &BufferLoad); + if ( ulResult != cOCT6100_ERR_OK ){ + if (ulResult == cOCT6100_ERR_BUFFER_PLAYOUT_ALL_BUFFERS_OPEN){ + goto buffer_load_done; + } + DEBUG_EVENT( + "%s: ERROR: Failed to load buffer into EC Chip (err=0x%X)\n", + ec->name, ulResult); + wan_vfree(pData); + return -EINVAL; + } +buffer_load_done: + wan_vfree(pData); + buffer_config->buffer_index = *BufferLoad.pulBufferIndex; + PRINT2(verbose, + "%s: Current buffer index is %d\n", + ec->name, buffer_config->buffer_index); + return 0; +} + +int wanec_BufferUnload(wan_ec_dev_t *ec_dev, wanec_buffer_config_t *buffer_config, int verbose) +{ + wan_ec_t *ec; + tOCT6100_BUFFER_UNLOAD BufferUnload; + PUINT32 pBufferIndex = NULL; + UINT32 index = 0, ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + PRINT2(verbose, + "%s: Unloading buffer from EC chip ...\n", + ec->name); + +try_next_index: + Oct6100BufferPlayoutUnloadDef( &BufferUnload ); + if (buffer_config->buffer_index != cOCT6100_INVALID_VALUE){ + pBufferIndex = wanec_search_bufferindex(ec, buffer_config->buffer_index); + if (pBufferIndex == NULL){ + DEBUG_EVENT( + "ERROR: %s: Invalid buffer index %X!\n", + ec->name, buffer_config->buffer_index); + return EINVAL; + } + }else{ + if (index > ec->f_OpenChip.ulMaxPlayoutBuffers){ + goto buffer_unload_done; + } + if (ec->pToneBufferIndexes[index] == cOCT6100_INVALID_VALUE){ + index++; + goto try_next_index; + } + pBufferIndex = &ec->pToneBufferIndexes[index]; + } + + BufferUnload.ulBufferIndex = *pBufferIndex; + ulResult = Oct6100BufferPlayoutUnload ( + ec->pChipInstance, + &BufferUnload); + if ( ulResult != cOCT6100_ERR_OK ){ + if (ulResult == cOCT6100_ERR_BUFFER_PLAYOUT_NOT_OPEN){ + goto buffer_unload_done; + } + DEBUG_EVENT( + "ERROR: %s: Failed to unload buffer from EC Chip (err=0x%X)!\n", + ec->name, (unsigned int)ulResult); + return EINVAL; + } + *pBufferIndex = 0; + if (!buffer_config->buffer_index){ + index++; + goto try_next_index; + } + +buffer_unload_done: + return 0; +} + +int wanec_BufferPlayoutAdd(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose) +{ + tOCT6100_BUFFER_PLAYOUT_ADD BufferPlayoutAdd; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Add Tone buffer to ec channel %d port %s duration %d:%d...\n", + ec->name, + channel, + WAN_EC_DECODE_CHANNEL_PORT(playout->port), + playout->duration, + playout->repeat_cnt); + if (playout->index == cOCT6100_INVALID_VALUE|| + wanec_search_bufferindex(ec, playout->index) == NULL){ + DEBUG_EVENT( + "ERROR: %s: Invalid playout buffer index for ec channel %d!\n", + ec->name, channel); + return -EINVAL; + } + Oct6100BufferPlayoutAddDef( &BufferPlayoutAdd ); + if (playout->repeat_cnt == 1){ + BufferPlayoutAdd.fRepeat = FALSE; + }else{ + BufferPlayoutAdd.fRepeat = TRUE; + } + BufferPlayoutAdd.ulPlayoutPort = + (playout->port == WAN_EC_CHANNEL_PORT_ROUT) ? + cOCT6100_CHANNEL_PORT_ROUT : + cOCT6100_CHANNEL_PORT_SOUT; + BufferPlayoutAdd.ulMixingMode = cOCT6100_MIXING_MUTE; + BufferPlayoutAdd.ulChannelHndl = ec->pEchoChannelHndl[channel]; + BufferPlayoutAdd.ulBufferIndex = playout->index; + BufferPlayoutAdd.fRepeat = (playout->repeat_cnt) ? TRUE : FALSE; + BufferPlayoutAdd.ulRepeatCount = playout->repeat_cnt; + BufferPlayoutAdd.ulDuration = (playout->duration) ? + playout->duration : 5000; + BufferPlayoutAdd.ulBufferLength = (playout->buffer_length) ? + playout->buffer_length : + cOCT6100_AUTO_SELECT; + ulResult = Oct6100BufferPlayoutAdd( + ec->pChipInstance, + &BufferPlayoutAdd); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to add playout buffer to ec channel %d (err=%08X)\n", + ec->name, channel, ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_BufferPlayoutStart(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose) +{ + tOCT6100_BUFFER_PLAYOUT_START BufferPlayoutStart; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Active playout buffer on ec channel %d port %s ...\n", + ec->name, + channel, + WAN_EC_DECODE_CHANNEL_PORT(playout->port)); + Oct6100BufferPlayoutStartDef( &BufferPlayoutStart ); + BufferPlayoutStart.ulChannelHndl = ec->pEchoChannelHndl[channel]; + BufferPlayoutStart.ulPlayoutPort = + (playout->port == WAN_EC_CHANNEL_PORT_ROUT) ? + cOCT6100_CHANNEL_PORT_ROUT : + cOCT6100_CHANNEL_PORT_SOUT; + BufferPlayoutStart.fNotifyOnPlayoutStop = playout->notifyonstop; + BufferPlayoutStart.ulUserEventId = playout->user_event_id; + ulResult = Oct6100BufferPlayoutStart( + ec->pChipInstance, + &BufferPlayoutStart); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to active playout buffer on ec channel %d (err=%08X)\n", + ec->name, + channel, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_BufferPlayoutStop(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose) +{ + tOCT6100_BUFFER_PLAYOUT_STOP BufferPlayoutStop; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Deactive playout buffer on ec channel %d port %s...\n", + ec->name, + channel, + WAN_EC_DECODE_CHANNEL_PORT(playout->port)); + Oct6100BufferPlayoutStopDef( &BufferPlayoutStop ); + BufferPlayoutStop.ulChannelHndl = ec->pEchoChannelHndl[channel]; + BufferPlayoutStop.ulPlayoutPort = + (playout->port == WAN_EC_CHANNEL_PORT_ROUT) ? + cOCT6100_CHANNEL_PORT_ROUT : + cOCT6100_CHANNEL_PORT_SOUT; + ulResult = Oct6100BufferPlayoutStop( + ec->pChipInstance, + &BufferPlayoutStop); + if ( ulResult != cOCT6100_ERR_OK ){ + if (ulResult != cOCT6100_ERR_BUFFER_PLAYOUT_NOT_STARTED){ + DEBUG_EVENT( + "ERROR: %s: Failed to deactive playout buffer on ec channel %d (err=%08X)\n", + ec->name, + channel, + ulResult); + return -EINVAL; + } + } + return 0; +} + + +/****************************************************************************** +** CONFERENCE BRIDGE FUNCTIONS +******************************************************************************/ +int wanec_ConfBridgeOpen(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose) +{ + tOCT6100_CONF_BRIDGE_OPEN ConfBridgeOpen; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Opening Conference Bridge...\n", ec->name); + + if ((unsigned int)ec->confbridges_no >= ec->f_OpenChip.ulMaxConfBridges){ + DEBUG_EVENT( + "ERROR: %s: Trying to open too many conference bridges (%d:%d)\n", + ec->name, + ec->confbridges_no, + ec->f_OpenChip.ulMaxConfBridges); + return -EINVAL; + } + + Oct6100ConfBridgeOpenDef( &ConfBridgeOpen ); + ConfBridgeOpen.pulConfBridgeHndl = &confbridge->ulHndl; + ConfBridgeOpen.fFlexibleConferencing = FALSE; + ulResult = Oct6100ConfBridgeOpen( + ec->pChipInstance, + &ConfBridgeOpen); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to open new conference bridge (err=%08X)\n", + ec->name, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeClose(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose) +{ + tOCT6100_CONF_BRIDGE_CLOSE ConfBridgeClose; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Closing Conference Bridge...\n", ec->name); + + Oct6100ConfBridgeCloseDef( &ConfBridgeClose ); + ConfBridgeClose.ulConfBridgeHndl = confbridge->ulHndl; + ulResult = Oct6100ConfBridgeClose( + ec->pChipInstance, + &ConfBridgeClose); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to close conference bridge (%X, err=%08X)\n", + ec->name, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeChanAdd(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose) +{ + tOCT6100_CONF_BRIDGE_CHAN_ADD ConfBridgeChanAdd; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Add channel %d to Conference Bridge %X...\n", + ec->name, channel, confbridge->ulHndl); + + Oct6100ConfBridgeChanAddDef( &ConfBridgeChanAdd ); + ConfBridgeChanAdd.ulConfBridgeHndl = confbridge->ulHndl; + ConfBridgeChanAdd.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ConfBridgeChanAdd( + ec->pChipInstance, + &ConfBridgeChanAdd); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to add channel %d to conference bridge (%X, err=%08X)\n", + ec->name, channel, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeChanRemove(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose) +{ + tOCT6100_CONF_BRIDGE_CHAN_REMOVE ConfBridgeChanRemove; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Remove channel %d from Conference Bridge %X...\n", + ec->name, channel, confbridge->ulHndl); + + Oct6100ConfBridgeChanRemoveDef( &ConfBridgeChanRemove ); + ConfBridgeChanRemove.ulConfBridgeHndl = confbridge->ulHndl; + ConfBridgeChanRemove.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ConfBridgeChanRemove( + ec->pChipInstance, + &ConfBridgeChanRemove); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to remove channel %d from conference bridge (%X, err=%08X)\n", + ec->name, channel, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeChanMute(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose) +{ + tOCT6100_CONF_BRIDGE_CHAN_MUTE ConfBridgeChanMute; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Mute channel %d on a conference bridge %X...\n", + ec->name, channel, confbridge->ulHndl); + + Oct6100ConfBridgeChanMuteDef( &ConfBridgeChanMute ); + ConfBridgeChanMute.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ConfBridgeChanMute( + ec->pChipInstance, + &ConfBridgeChanMute); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to mute channel %d on a conference bridge (%X, err=%08X)\n", + ec->name, channel, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeChanUnMute(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose) +{ + tOCT6100_CONF_BRIDGE_CHAN_UNMUTE ConfBridgeChanUnMute; + UINT32 ulResult; + + PRINT2(verbose, + "%s: UnMute channel %d on a Conference Bridge %X...\n", + ec->name, channel, confbridge->ulHndl); + + Oct6100ConfBridgeChanUnMuteDef( &ConfBridgeChanUnMute ); + ConfBridgeChanUnMute.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ConfBridgeChanUnMute( + ec->pChipInstance, + &ConfBridgeChanUnMute); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to unmute channel %d from conference bridge (%X, err=%08X)\n", + ec->name, channel, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeDominantSpeakerSet(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int enable, int verbose) +{ + tOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET ConfBridgeDominantSpeaker; + UINT32 ulResult; + + PRINT2(verbose, + "%s: %s Dominant speaker (channel %d) to a Conference Bridge %X...\n", + ec->name, + (enable) ? "Enable":"Disable", + channel, + confbridge->ulHndl); + + Oct6100ConfBridgeDominantSpeakerSetDef( &ConfBridgeDominantSpeaker ); + ConfBridgeDominantSpeaker.ulConfBridgeHndl = confbridge->ulHndl; + if (enable){ + ConfBridgeDominantSpeaker.ulChannelHndl = ec->pEchoChannelHndl[channel]; + }else{ + ConfBridgeDominantSpeaker.ulChannelHndl = cOCT6100_CONF_NO_DOMINANT_SPEAKER_HNDL; + } + ulResult = Oct6100ConfBridgeDominantSpeakerSet( + ec->pChipInstance, + &ConfBridgeDominantSpeaker); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to %s dominant speaker to conference bridge (%X, err=%08X)\n", + ec->name, + (enable) ? "enable" : "disable", + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + + +int wanec_ConfBridgeMaskChange(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, UINT32 mask, int verbose) +{ + tOCT6100_CONF_BRIDGE_MASK_CHANGE ConfBridgeMaskChange; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Changing the listener (channel=%d) mask of bridge participant (%d)...\n", + ec->name, + channel, confbridge->ulHndl); + + Oct6100ConfBridgeMaskChangeDef( &ConfBridgeMaskChange ); + ConfBridgeMaskChange.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ConfBridgeMaskChange.ulNewListenerMask = mask; + ulResult = Oct6100ConfBridgeMaskChange( + ec->pChipInstance, + &ConfBridgeMaskChange); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to change the listener mask of bridge participant %d (err=%X)!\n", + ec->name, + channel, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeGetStats(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose) +{ + tOCT6100_CONF_BRIDGE_STATS ConfBridgeStats; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Getting bridge statistics %X...\n", + ec->name, confbridge->ulHndl); + + Oct6100ConfBridgeGetStatsDef( &ConfBridgeStats ); + ConfBridgeStats.ulConfBridgeHndl = confbridge->ulHndl; + ulResult = Oct6100ConfBridgeGetStats( + ec->pChipInstance, + &ConfBridgeStats); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to get conference bridge statistics (err=%X)!\n", + ec->name, + ulResult); + return -EINVAL; + } + return 0; +} + +/*===========================================================================*\ + Oct6100Read +\*===========================================================================*/ + +static int +wan_ec_read(wan_ec_dev_t *ec_dev, u32 read_addr, u16 *read_data) +{ + u32 data; + wan_ec_read_internal_dword(ec_dev, read_addr, &data); + *read_data = (u16)(data & 0xFFFF); + return 0; +} + +/*===========================================================================*\ + Oct6100Write +\*===========================================================================*/ + +static int +wan_ec_write(wan_ec_dev_t *ec_dev, u32 write_addr, u32 write_data) +{ + return wan_ec_write_internal_dword(ec_dev, write_addr, write_data); +} + + +/*===========================================================================*\ + Oct6100WriteSequenceSub +\*===========================================================================*/ +static u32 +wan_ec_write_seq(wan_ec_dev_t *ec_dev, u32 write_addr, u16 write_data) +{ + u32 ulResult; + u32 ulData; + u16 usData; + u32 ulWordAddress; + u32 i; + + /* Create the word address from the provided byte address. */ + ulWordAddress = write_addr >> 1; + + /* 16-bit indirect access. */ + + /* First write to the address indirection registers. */ + ulData = ( ulWordAddress >> 19 ) & 0x1FFF; + ulResult = wan_ec_write( ec_dev, 0x8, ulData ); + if (ulResult) + return ulResult; + + ulData = ( ulWordAddress >> 3 ) & 0xFFFF; + ulResult = wan_ec_write( ec_dev, 0xA, ulData ); + if (ulResult) + return ulResult; + + /* Next, write data word to read/write data registers. */ + ulData = write_data & 0xFFFF; + ulResult = wan_ec_write( ec_dev, 0x4, ulData ); + if ( ulResult ) + return ulResult; + + + /* Write the parities and write enables, as well as last three bits + ** of wadd and request the write access. */ + ulData = ( ( 0x0 & 0x3 ) << 14 ) | ( ( 0x3 & 0x3 ) << 12 ) | ( ( ulWordAddress & 0x7 ) << 9 ) | 0x0100; + ulResult = wan_ec_write( ec_dev, 0x0, ulData ); + if ( ulResult ) + return ulResult; + + /* Keep polling register contol0 for the access_req bit to go low. */ + for ( i = 0; i < WANEC_READ_LIMIT; i++ ) + { + ulResult = wan_ec_read( ec_dev, 0, &usData ); + if ( ulResult ) + return ulResult; + + if ( ( ( usData >> 8 ) & 0x1 ) == 0x0 ) + break; + } + + if ( i == WANEC_READ_LIMIT ){ + DEBUG_EVENT("%s: EC write command reached limit!\n", + ec_dev->name); + return WAN_EC_RC_CPU_INTERFACE_NO_RESPONSE; + } + return 0; +} + + +/*===========================================================================*\ + HandleReqWriteOct6100 +\*===========================================================================*/ +u32 wanec_req_write(void *arg, u32 write_addr, u16 write_data) +{ + wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; + u32 ulResult; + + DEBUG_TEST("%s: EC WRITE API addr=%X data=%X\n", + ec_dev->ec->name, write_addr, write_data); + ulResult = wan_ec_write_seq(ec_dev, write_addr, write_data); + if (ulResult){ + DEBUG_EVENT("%s: Failed to write %04X to addr %08X\n", + ec_dev->name, + write_addr, + write_data); + } + return ulResult; +} + + +/*===========================================================================*\ + HandleReqWriteSmearOct6100 +\*===========================================================================*/ +u32 wanec_req_write_smear(void *arg, u32 addr, u16 data, u32 len) +{ + wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; + u32 i, ulResult = WAN_EC_RC_OK; + + WAN_ASSERT(ec_dev == NULL); + for ( i = 0; i < len; i++ ){ + ulResult = wan_ec_write_seq(ec_dev, addr + (i*2), data); + if (ulResult){ + DEBUG_EVENT("%s: Failed to write %04X to addr %08X\n", + ec_dev->name, + addr + (i*2), + data); + break; + } + } + return ulResult; +} + + +/*===========================================================================*\ + HandleReqWriteBurstOct6100 +\*===========================================================================*/ +u32 wanec_req_write_burst(void *arg, u32 addr, u16 *data, u32 len) +{ + wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; + u32 i, ulResult = WAN_EC_RC_OK; + + WAN_ASSERT(ec_dev == NULL); + + for ( i = 0; i < len; i++ ){ + ulResult = wan_ec_write_seq(ec_dev, addr + (i * 2), data[i]); + if (ulResult){ + DEBUG_EVENT("%s: Failed to write %04X to addr %08X\n", + ec_dev->name, + addr + (i*2), + data[i]); + break; + } + } + return ulResult; +} + + +/*===========================================================================*\ + Oct6100ReadSequenceSub +\*===========================================================================*/ +static u32 +wan_ec_read_seq(wan_ec_dev_t *ec_dev, u32 read_addr, u16 *read_data, u32 read_len) +{ + u32 ulResult; + u32 ulData; + u32 ulWordAddress; + u32 ulReadBurstLength; + u16 usData; + u32 i; + + /* Create the word address from the provided byte address. */ + ulWordAddress = read_addr >> 1; + + /* Indirect accesses. */ + + /* First write to the address indirection registers. */ + ulData = ( ulWordAddress >> 19 ) & 0x1FFF; + ulResult = wan_ec_write( ec_dev, 0x8, ulData ); + if (ulResult) + return ulResult; + + ulData = ( ulWordAddress >> 3 ) & 0xFFFF; + ulResult = wan_ec_write( ec_dev, 0xA, ulData ); + if (ulResult) + return ulResult; + + /* Request access. */ + if ( read_len >= 128 ) + { + ulData = 0x100 | ( ( ulWordAddress & 0x7 ) << 9); + ulReadBurstLength = 0; + } + else + { + ulData = 0x100 | ( ( ulWordAddress & 0x7 ) << 9) | read_len; + ulReadBurstLength = read_len; + } + ulResult = wan_ec_write( ec_dev, 0x0, ulData ); + if (ulResult) + return ulResult; + + /* Keep polling register contol0 for the access_req bit to go low. */ + for ( i = 0; i < WANEC_READ_LIMIT; i++ ) + { + ulResult = wan_ec_read( ec_dev, 0x0, &usData ); + if (ulResult) + return ulResult; + + if ( ( ( usData >> 8 ) & 0x1 ) == 0x0 ) + break; + } + if ( i == WANEC_READ_LIMIT ){ + DEBUG_EVENT("%s: EC read command reached limit!\n", + ec_dev->name); + return WAN_EC_RC_CPU_INTERFACE_NO_RESPONSE; + } + + if ( ( usData & 0xFF ) == 0x1 ) + { + i = 0; + } + + /* Retrieve read data. */ + ulResult = wan_ec_read( ec_dev, 0x4, &usData ); + if (ulResult) + return ulResult; + + if ( ( usData & 0xFF ) == 0x1 ) + { + i = 0; + } + + *read_data = usData; + return 0; +} + +u32 wanec_req_read(void *arg, u32 addr, u16 *data) +{ + wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; + u32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + DEBUG_TEST("%s: EC READ API addr=%X data=????\n", + ec_dev->ec->name, addr); + ulResult = wan_ec_read_seq( + ec_dev, + addr, + data, + 1); + if (ulResult){ + DEBUG_EVENT("%s: Failed to read data from addr %08X\n", + ec_dev->name, + addr); + if (ec_dev->ec){ + wan_set_bit(WAN_EC_BIT_CRIT_ERROR, &ec_dev->ec->critical); + } + } + DEBUG_TEST("%s: EC READ API addr=%X data=%X\n", + ec_dev->ec->name, + addr, *data); + return ulResult; +} + +u32 wanec_req_read_burst(void *arg, u32 addr, u16 *data, u32 len) +{ + wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; + u32 i, ulResult = WAN_EC_RC_OK; + u16 read_data; + + for ( i = 0; i < len; i++ ){ + ulResult = wan_ec_read_seq(ec_dev, addr, &read_data, 1); + if (ulResult){ + DEBUG_EVENT("%s: Failed to read from addr %X\n", + ec_dev->name, + addr); + if (ec_dev->ec){ + wan_set_bit(WAN_EC_BIT_CRIT_ERROR, &ec_dev->ec->critical); + } + break; + } + data[i] = (u16)read_data; + addr += 2; + } + return ulResult; +} diff --git a/patches/kdrivers/wanec/.tmp_versions/wanec.mod b/patches/kdrivers/wanec/.tmp_versions/wanec.mod index 4f82a26..a828d7c 100644 --- a/patches/kdrivers/wanec/.tmp_versions/wanec.mod +++ b/patches/kdrivers/wanec/.tmp_versions/wanec.mod @@ -1,2 +1,2 @@ -/root/3.2/wanpipe/patches/kdrivers/wanec/wanec.ko -/root/3.2/wanpipe/patches/kdrivers/wanec/wanec_iface.o /root/3.2/wanpipe/patches/kdrivers/wanec/wanec_cmd.o /root/3.2/wanpipe/patches/kdrivers/wanec/wanec_utils.o /root/3.2/wanpipe/patches/kdrivers/wanec/wanec_dev.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/apilib/bt/octapi_bt0.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/apilib/largmath/octapi_largmath.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/apilib/llman/octapi_llman.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_apimi/oct6100_mask_interrupts.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_events.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.o /root/3.2/wanpipe/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_user.o +/root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/wanec.ko +/root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/wanec_iface.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/wanec_cmd.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/wanec_utils.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/wanec_dev.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/apilib/bt/octapi_bt0.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/apilib/largmath/octapi_largmath.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/apilib/llman/octapi_llman.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_apimi/oct6100_mask_interrupts.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_events.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.o /root/development/3.3/wanpipe-3.3.2/patches/kdrivers/wanec/oct6100_api/octdeviceapi/oct6100api/oct6100_api/oct6100_user.o diff --git a/patches/kdrivers/wanec/Makefile.Windows b/patches/kdrivers/wanec/Makefile.Windows new file mode 100755 index 0000000..b6c73b5 --- /dev/null +++ b/patches/kdrivers/wanec/Makefile.Windows @@ -0,0 +1,9 @@ +# +# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source +# file to this component. This file merely indirects to the real make file +# that is shared by all the driver components of the Windows NT DDK +# + +!INCLUDE $(NTMAKEENV)\makefile.def + + diff --git a/patches/kdrivers/wanec/Makefile6.FreeBSD b/patches/kdrivers/wanec/Makefile6.FreeBSD index 0a489a5..ec053a0 100755 --- a/patches/kdrivers/wanec/Makefile6.FreeBSD +++ b/patches/kdrivers/wanec/Makefile6.FreeBSD @@ -27,7 +27,7 @@ DESTDIR = / KMODDIR = /boot/modules MODULE_DEPEND = wanrouter SRCS = wanec_iface.c wanec_cmd.c wanec_utils.c octapi_bt0.c octapi_largmath.c octapi_llman.c oct6100_mask_interrupts.c oct6100_adpcm_chan.c oct6100_channel.c oct6100_chip_open.c oct6100_chip_stats.c oct6100_conf_bridge.c oct6100_debug.c oct6100_events.c oct6100_interrupts.c oct6100_memory.c oct6100_miscellaneous.c oct6100_mixer.c oct6100_phasing_tsst.c oct6100_playout_buf.c oct6100_remote_debug.c oct6100_tlv.c oct6100_tone_detection.c oct6100_tsi_cnct.c oct6100_tsst.c oct6100_user.c -CFLAGS += -Wunused -I/sys -I/usr/include/wanpipe -Ioct6100_api/include -Ioct6100_api/include/apilib -Ioct6100_api/apilib/bt -Ioct6100_api/apilib/llman -Ioct6100_api/apilib/largmath -Ioct6100_api/include/octrpc -Ioct6100_api/include/oct6100api -Ioct6100_api/octdeviceapi/oct6100api -DCONFIG_PRODUCT_WANPIPE_BASE -DCONFIG_PRODUCT_WANPIPE_AFT -DCONFIG_PRODUCT_WANPIPE_FR -DCONFIG_PRODUCT_WANPIPE_CHDLC -DCONFIG_PRODUCT_WANPIPE_PPP -DCONFIG_PRODUCT_WANPIPE_ADSL -DCONFIG_PRODUCT_WANPIPE_AFT -DCONFIG_PRODUCT_WANPIPE_AFT_TE1 -DCONFIG_PRODUCT_WANPIPE_AFT -DCONFIG_PRODUCT_WANPIPE_AFT_A200 -DCONFIG_PRODUCT_WANPIPE_AFT -DCONFIG_PRODUCT_WANPIPE_AFT_TE3 -DCONFIG_PRODUCT_WANPIPE_MLINK_PPP -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE ${WAN_GLB_CFLAGS} +CFLAGS += -Wunused -I/sys -I/wanpipe/code/include -I/common/include -Ioct6100_api/include -Ioct6100_api/include/apilib -Ioct6100_api/apilib/bt -Ioct6100_api/apilib/llman -Ioct6100_api/apilib/largmath -Ioct6100_api/include/octrpc -Ioct6100_api/include/oct6100api -Ioct6100_api/octdeviceapi/oct6100api -DCONFIG_PRODUCT_WANPIPE_BASE -DCONFIG_PRODUCT_WANPIPE_AFT -DCONFIG_PRODUCT_WANPIPE_FR -DCONFIG_PRODUCT_WANPIPE_CHDLC -DCONFIG_PRODUCT_WANPIPE_PPP -DCONFIG_PRODUCT_WANPIPE_ADSL -DCONFIG_PRODUCT_WANPIPE_AFT -DCONFIG_PRODUCT_WANPIPE_AFT_TE1 -DCONFIG_PRODUCT_WANPIPE_AFT -DCONFIG_PRODUCT_WANPIPE_AFT_RM -DCONFIG_PRODUCT_WANPIPE_AFT -DCONFIG_PRODUCT_WANPIPE_AFT_TE3 -DCONFIG_PRODUCT_WANPIPE_MLINK_PPP -DCONFIG_PRODUCT_WANPIPE_TDM_VOICE -DCONFIG_WANPIPE_HWEC ${WAN_GLB_CFLAGS} hdr_install: \cp -f wanec_iface.h /usr/include/wanpipe diff --git a/patches/kdrivers/wanec/oct6100_api.PR48/apilib/bt/octapi_bt0_private.h b/patches/kdrivers/wanec/oct6100_api.PR48/apilib/bt/octapi_bt0_private.h index b0c501a..0d24ba0 100644 --- a/patches/kdrivers/wanec/oct6100_api.PR48/apilib/bt/octapi_bt0_private.h +++ b/patches/kdrivers/wanec/oct6100_api.PR48/apilib/bt/octapi_bt0_private.h @@ -87,7 +87,9 @@ void OctApiBt0UpdateLinkDepth( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link ); void OctApiBt0Rebalance( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * root_link ); void OctApiBt0ExternalHeavy( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * root_link ); UINT32 OctApiBt0RemoveNode2( OCTAPI_BT0 * bb, OCTAPI_BT0_LINK * link, UINT32 * lkey, OCTAPI_BT0_LINK * link_to_removed_node, UINT32 state, OCTAPI_BT0_LINK * volatile_grandparent_link ); +UINT32 OctApiBt0RemoveNode3(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link, UINT32 * lkey, OCTAPI_BT0_LINK * link_to_removed_node, UINT32 state, OCTAPI_BT0_LINK * volatile_grandparent_link, UINT32 *p_prev_node_number ); +UINT32 OctApiBt0QueryNode2(OCTAPI_BT0 * bb,OCTAPI_BT0_LINK * link,UINT32 * lkey,UINT32 * node_number); #endif /*__OCTAPI_BT0_PRIVATE_H__*/ diff --git a/patches/kdrivers/wanec/oct6100_api.PR48/include/apilib/octapi_llman.h b/patches/kdrivers/wanec/oct6100_api.PR48/include/apilib/octapi_llman.h index d1a29fe..d2d30bf 100644 --- a/patches/kdrivers/wanec/oct6100_api.PR48/include/apilib/octapi_llman.h +++ b/patches/kdrivers/wanec/oct6100_api.PR48/include/apilib/octapi_llman.h @@ -134,6 +134,7 @@ UINT32 OctApiLlm2ListLength( PVOID l, UINT32 list_handle, PUINT32 number_of_item UINT32 OctApiLlm2ListInsertItem(void * l, UINT32 list_handle, UINT32 item_key, void ** item_data_pnt, void ** prev_item_data_pnt, void ** prev_prev_item_data_pnt, PUINT32 insert_status_pnt ); UINT32 OctApiLlm2ListRemoveItem(void * l, UINT32 list_handle, UINT32 item_key, PUINT32 prev_item_key_pnt, PUINT32 prev_prev_item_key_pnt, PUINT32 remove_status_pnt ); UINT32 OctApiLlm2ListItemData( PVOID l, UINT32 list_handle, UINT32 item_key, PVOID* item_data_pnt, PUINT32 item_number ); +UINT32 OctApiLlm2ListDelete(void * l,UINT32 list_handle); #ifdef __cplusplus } diff --git a/patches/kdrivers/wanec/oct6100_api.PR48/include/oct6100api/oct6100_apiud.h b/patches/kdrivers/wanec/oct6100_api.PR48/include/oct6100api/oct6100_apiud.h index e44811d..51ffb68 100644 --- a/patches/kdrivers/wanec/oct6100_api.PR48/include/oct6100api/oct6100_apiud.h +++ b/patches/kdrivers/wanec/oct6100_api.PR48/include/oct6100api/oct6100_apiud.h @@ -128,8 +128,12 @@ $Octasic_Revision: 16 $ /***************************** TYPES ***************************************/ -/*Change this type if your platform uses 64bits semaphores/locks */ -typedef UINT32 tOCT6100_USER_SERIAL_OBJECT; +/*Change this type if your platform uses 64bits semaphores/locks */ +/* Dec 14 2007 ALEX +** The type is changed to PVOID in order to support 64-bit platform. The +** value is allocated in CreateObject function and freed in DestroyObject. +******************************************************************************/ +typedef PVOID tOCT6100_USER_SERIAL_OBJECT; /* UINT32 */ typedef struct _OCT6100_GET_TIME_ { diff --git a/patches/kdrivers/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api/oct6100_user.c b/patches/kdrivers/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api/oct6100_user.c index dd272d6..ed7d79b 100644 --- a/patches/kdrivers/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api/oct6100_user.c +++ b/patches/kdrivers/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_api/oct6100_user.c @@ -23,7 +23,6 @@ $Octasic_Revision: 25 $ /***************************** INCLUDE FILES *******************************/ - /* System specific includes */ #if defined(WAN_EC_USER) # include @@ -73,13 +72,10 @@ $Octasic_Revision: 25 $ # include # include # endif - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_errors.h" - -#include "oct6100api/oct6100_api.h" -#include "oct6100_version.h" - +# include "oct6100api/oct6100_apiud.h" +# include "oct6100api/oct6100_errors.h" +# include "oct6100api/oct6100_api.h" +# include "oct6100_version.h" # include "wanec_iface.h" #endif @@ -116,11 +112,11 @@ UINT32 Oct6100UserGetTime( #if !defined(__WINDOWS__) /* Retrieve clock tick */ -#if defined(WAN_KERNEL) +# if defined(WAN_KERNEL) wan_getcurrenttime( &TimeVal.tv_sec, &TimeVal.tv_usec ); -#else +# else gettimeofday( &TimeVal, NULL ); -#endif +# endif /* ulClockTicks = ( TimeVal.tv_sec * 1000000 ) + ( TimeVal.tv_usec ); */ /* Create a value im ms (as clock does) */ ulClockTicks = ( TimeVal.tv_sec * 1000 ) + ( TimeVal.tv_usec /1000 ); @@ -211,6 +207,9 @@ union semun { }; #endif +#if defined(WAN_KERNEL) + +#else typedef struct _SEM_FILE_INF_ { UINT32 ulMainProcessId; @@ -224,6 +223,7 @@ typedef struct _SEM_INF_ CHAR szFileName[PATH_MAX]; } tSEM_INF, *tPSEM_INF; +#endif /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ @@ -392,6 +392,25 @@ UINT32 Oct6100UserCreateSerializeObject( return ulRc; #else + wan_spinlock_t *pLockInf; + tPOCTPCIDRV_USER_PROCESS_CONTEXT pContext; + + pContext = (tPOCTPCIDRV_USER_PROCESS_CONTEXT)f_pCreate->pProcessContext; + + if ( ( f_pCreate == NULL ) || ( f_pCreate->pszSerialObjName == NULL ) ) + return cOCT6100_CREATE_SERIAL_FAILED_0; + + /* Alloc a sem inf structure */ + pLockInf = (wan_spinlock_t*)wan_malloc( sizeof(wan_spinlock_t) ); + + /* Check if malloc failed!!! */ + if ( pLockInf == NULL ) + return cOCT6100_CREATE_SERIAL_FAILED_0; /* No memory. */ + + wan_spin_lock_init(pLockInf, "wan_ecapi_lock"); + /* Keep pointer to semaphore information. */ + f_pCreate->ulSerialObjHndl = (PVOID)pLockInf; + return cOCT6100_ERR_OK; #endif } @@ -485,6 +504,18 @@ UINT32 Oct6100UserDestroySerializeObject( return ulRc; #else + wan_spinlock_t *pLockInf; + + if ( ( f_pDestroy == NULL ) || ( f_pDestroy->ulSerialObjHndl == 0x0 ) ) + return cOCT6100_DESTROY_SERIAL_FAILED_0; + + pLockInf = (wan_spinlock_t*)(f_pDestroy->ulSerialObjHndl); + + if (wan_spin_is_locked(pLockInf)){ + return cOCT6100_DESTROY_SERIAL_FAILED_0; + } + + wan_free( pLockInf ); return cOCT6100_ERR_OK; #endif } @@ -575,8 +606,24 @@ UINT32 Oct6100UserSeizeSerializeObject( } return( ulRc ); #else - return cOCT6100_ERR_OK; + wan_spinlock_t *pLockInf; + if( f_pSeize == NULL ) + return cOCT6100_SEIZE_SERIAL_FAILED_0; + + if ( f_pSeize->ulSerialObjHndl == 0 ) + return cOCT6100_SEIZE_SERIAL_FAILED_0; + + pLockInf = (wan_spinlock_t*)f_pSeize->ulSerialObjHndl; + + /* Check mutex handle */ + if ( pLockInf ){ + if (wan_spin_trylock(pLockInf)){ + return cOCT6100_ERR_OK; + } + return cOCT6100_SEIZE_SERIAL_FAILED_1; + } + return cOCT6100_ERR_OK; #endif } @@ -629,7 +676,21 @@ UINT32 Oct6100UserReleaseSerializeObject( return( ulRc ); #else + wan_spinlock_t *pLockInf; + if( f_pRelease == NULL ) + return cOCT6100_RELEASE_SERIAL_FAILED_0; + + if ( f_pRelease->ulSerialObjHndl == 0 ) + return cOCT6100_RELEASE_SERIAL_FAILED_0; + + pLockInf = (wan_spinlock_t*)f_pRelease->ulSerialObjHndl; + + /* Check mutex handle */ + if ( pLockInf ){ + wan_spin_unlock(pLockInf); + return cOCT6100_ERR_OK; + } return cOCT6100_ERR_OK; #endif diff --git a/patches/kdrivers/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_channel_priv.h b/patches/kdrivers/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_channel_priv.h index 496b3b8..bf2667e 100644 --- a/patches/kdrivers/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_channel_priv.h +++ b/patches/kdrivers/wanec/oct6100_api.PR48/octdeviceapi/oct6100api/oct6100_channel_priv.h @@ -526,4 +526,13 @@ INT32 Oct6100ApiOctFloatToDbEnergyHalf( UINT16 Oct6100ApiDbAmpHalfToOctFloat( IN INT32 x ); +UINT32 Oct6100ApiReserveBiDirChanEntry( + IN tPOCT6100_INSTANCE_API f_pApiInstance, + OUT PUINT16 f_pusBiDirChanIndex ); + +UINT32 Oct6100ApiReleaseBiDirChanEntry( + IN tPOCT6100_INSTANCE_API f_pApiInstance, + IN UINT32 f_ulBiDirChanIndex ); + + #endif /* __OCT6100_CHANNEL_PRIV_H__ */ diff --git a/patches/kdrivers/wanec/oct6100_api.PR48/octdeviceapiw/oct6100_apiw_linux/oct6100api.mak b/patches/kdrivers/wanec/oct6100_api.PR48/octdeviceapiw/oct6100_apiw_linux/oct6100api.mak index 427c129..a70429e 100755 --- a/patches/kdrivers/wanec/oct6100_api.PR48/octdeviceapiw/oct6100_apiw_linux/oct6100api.mak +++ b/patches/kdrivers/wanec/oct6100_api.PR48/octdeviceapiw/oct6100_apiw_linux/oct6100api.mak @@ -1,6 +1,6 @@ #============================================================================= # -# File: oct6100api.mak ($Revision: 1.1 $) +# File: oct6100api.mak ($Revision: 1.2 $) # # Description: Makefile for building the OCT6100 API library. # @@ -47,7 +47,7 @@ INC = -I../../include \ -I../../include/oct6100api \ -I../../include/apilib \ -I../../octdeviceapi/oct6100api \ - -I/usr/include/ -I../../../ + -I/usr/include/wanpipe -I../../../ CCFLAGS = -m32 -DDEVICE_IOCTL -DWAN_EC_USER -D__LINUX__ -L/usr/local/lib \ -fPIC -ansi -Wall -Wpointer-arith -Winline -fno-builtin \ diff --git a/patches/kdrivers/wanec/sources b/patches/kdrivers/wanec/sources index 7abc756..063dd8e 100755 --- a/patches/kdrivers/wanec/sources +++ b/patches/kdrivers/wanec/sources @@ -9,22 +9,19 @@ MSC_WARNING_LEVEL=-W3 -WX #make sure no optimization done, even in "Free" build: MSC_OPTIMIZATION=/Odi -C_DEFINES=$(C_DEFINES) -D__WINDOWS__ -D__KERNEL__ -DBUSENUM_DRV -C_DEFINES=$(C_DEFINES) -DSANG_DBG +C_DEFINES=$(C_DEFINES) -D__WINDOWS__ -D__KERNEL__ -DVIRTUAL_IF_DRV -#build can not expand Env Vars names longer than 8 chars, so use -#absolute paths INCLUDES=$(DDK_INC_PATH);\ -D:\cvshome\development\wanpipe_windows\include\pnp;\ -D:\cvshome\development\wanpipe_windows\include\api;\ -D:\cvshome\development\wanpipe_windows\include\octasic\include;\ -D:\cvshome\development\wanpipe_windows\include\octasic\include\oct6100api;\ -D:\cvshome\development\wanpipe_windows\include\octasic\octdeviceapi\oct6100api;\ -D:\cvshome\development\wanpipe_windows\include\octasic\apilib\llman;\ -D:\cvshome\development\wanpipe_windows\include\octasic\include\apilib;\ -D:\cvshome\development\wanpipe_windows\include\octasic\include\octrpc;\ -D:\cvshome\development\wanpipe_windows\include\octasic\apilib\bt;\ -D:\cvshome\development\wanpipe_windows\include\debug +d:\development\wanpipe_windows\include;\ +d:\development\wanpipe_common\include;\ +d:\development\wanpipe_common\wanec;\ +d:\development\wanpipe_common\wanec\oct6100_api.PR43\include;\ +d:\development\wanpipe_common\wanec\oct6100_api.PR43\include\oct6100api;\ +d:\development\wanpipe_common\wanec\oct6100_api.PR43\octdeviceapi\oct6100api;\ +d:\development\wanpipe_common\wanec\oct6100_api.PR43\apilib\llman;\ +d:\development\wanpipe_common\wanec\oct6100_api.PR43\include\apilib;\ +d:\development\wanpipe_common\wanec\oct6100_api.PR43\include\octrpc;\ +d:\development\wanpipe_common\wanec\oct6100_api.PR43\apilib\bt SOURCES= wanec_iface.c \ wanec_cmd.c \ diff --git a/patches/kdrivers/wanec/wanec b/patches/kdrivers/wanec/wanec new file mode 120000 index 0000000..6919cf0 --- /dev/null +++ b/patches/kdrivers/wanec/wanec @@ -0,0 +1 @@ +../../wanpipe_common/wanec \ No newline at end of file diff --git a/patches/kdrivers/wanec/wanec.mod.c b/patches/kdrivers/wanec/wanec.mod.c index f73e369..27490c5 100644 --- a/patches/kdrivers/wanec/wanec.mod.c +++ b/patches/kdrivers/wanec/wanec.mod.c @@ -18,6 +18,7 @@ __attribute_used__ __attribute__((section("__versions"))) = { { 0x89e24b9c, "struct_module" }, { 0x12da5bb2, "__kmalloc" }, + { 0x7e3f931f, "_spin_trylock" }, { 0xec7bc0d, "__mod_timer" }, { 0xd6ee688f, "vmalloc" }, { 0x4827a016, "del_timer" }, @@ -25,6 +26,7 @@ __attribute__((section("__versions"))) = { { 0xb5513e49, "class_device_create" }, { 0xab978df6, "malloc_sizes" }, { 0x1bcd461f, "_spin_lock" }, + { 0x4e830a3e, "strnicmp" }, { 0xeae3dfd6, "__const_udelay" }, { 0x2fd1d81c, "vfree" }, { 0x1d26aa98, "sprintf" }, @@ -51,4 +53,4 @@ __attribute__((section(".modinfo"))) = "depends="; -MODULE_INFO(srcversion, "4B81F8CBCF0FE7DE2D1F612"); +MODULE_INFO(srcversion, "A6BF1CF61774AE275ECC9A5"); diff --git a/patches/kdrivers/wanec/wanec_cmd.c b/patches/kdrivers/wanec/wanec_cmd.c index 7341fbc..b2832e6 100644 --- a/patches/kdrivers/wanec/wanec_cmd.c +++ b/patches/kdrivers/wanec/wanec_cmd.c @@ -10,6 +10,10 @@ * March 19, 2006 Alex Feldman Enable Sout Adaptive Noise * Reduction for all channel by * default. + * + * January 9, 2008 David Rokhvarg + * Added support for Sangoma MS Windows Driver + * */ @@ -43,8 +47,15 @@ int verbose; /*============================================================= * Definitions */ -#define MAX_EC_PORT_RANGE 32 -#define WAN_OCT6100_READ_LIMIT 0x10000 +#define WANEC_MAX_PORT_RANGE 32 +#define WANEC_MAX_BRI_PORT_RANGE 2 +#define WANEC_READ_LIMIT 0x10000 + +#define WANEC_MAX_CONFBRIDGE_DEF 32 +#define WANEC_MAC_PLAYOUT_BUFFERS 20 + +#define WANEC_MAX_TONEEVENTS 8 +#define WANEC_MAX_PLAYOUTEVENTS 8 /*============================================================= * Global Parameters @@ -92,41 +103,52 @@ UINT32 DetectedRoutToneNumbers[WAN_NUM_DTMF_TONES] = * Function prototype */ -int wanec_ChipOpenPrep(wan_ec_dev_t*, wan_ec_api_t*); +int wanec_ChipOpenPrep(wan_ec_dev_t *ec_dev, char *devname, wanec_config_t *config, int verbose); int wanec_ChipOpen(wan_ec_dev_t*, int); -int wanec_ChipOpen_OLD(wan_ec_dev_t*, wan_ec_api_t*); int wanec_ChipClose(wan_ec_dev_t*, int verbose); -int wanec_ChipStats(wan_ec_dev_t*, wan_ec_api_t*, int reset); +int wanec_ChipStats(wan_ec_dev_t *ec_dev, wanec_chip_stats_t *chip_stats, int reset, int verbose); -int wanec_ChannelOpen(wan_ec_dev_t*, wan_ec_api_t*); -int wanec_ChannelClose(wan_ec_dev_t*, wan_ec_api_t*, int); -int wanec_ChannelModify(wan_ec_dev_t*, INT, UINT32, wan_ec_api_t*, int verbose); -int wanec_ChannelStats(wan_ec_dev_t*, INT channel, wan_ec_api_t*, int); +int wanec_ChannelOpen(wan_ec_dev_t*, int); +int wanec_ChannelClose(wan_ec_dev_t*, int); +int wanec_ChannelModifyOpmode(wan_ec_dev_t*, INT, UINT32, int verbose); +int wanec_ChannelModifyCustom(wan_ec_dev_t*, INT, wanec_chan_custom_t*, int verbose); +int wanec_ChannelStats(wan_ec_dev_t*, INT channel, wanec_chan_stats_t *chan_stats, int reset); -int wanec_TonesEnable(wan_ec_t *ec, int channel, unsigned char port, int verbose); -int wanec_TonesDisable(wan_ec_t *ec, int channel, unsigned char port, int verbose); +int wanec_ChannelMute(wan_ec_dev_t*, INT channel, wanec_chan_mute_t*, int); +int wanec_ChannelUnMute(wan_ec_dev_t*, INT channel, wanec_chan_mute_t*, int); -int wanec_DebugChannel(wan_ec_t *ec, INT channel, int verbose); -int wanec_DebugGetData(wan_ec_t *ec, wan_ec_api_t *ec_api); +int wanec_TonesEnable(wan_ec_t *ec, int ec_chan, wanec_dtmf_config_t*, int verbose); +int wanec_TonesDisable(wan_ec_t *ec, int ec_chan, wanec_dtmf_config_t*, int verbose); -int wanec_BufferLoad(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); -int wanec_BufferUnload(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); -int wanec_BufferPlayoutAdd(wan_ec_t *ec, int channel, wan_ec_api_t *ec_api); -int wanec_BufferPlayoutStart(wan_ec_t *ec, int channel, wan_ec_api_t *ec_api); -int wanec_BufferPlayoutStop(wan_ec_t *ec, int channel, wan_ec_api_t *ec_api); +int wanec_DebugChannel(wan_ec_dev_t*, INT channel, int verbose); +int wanec_DebugGetData(wan_ec_dev_t*, wanec_chan_monitor_t *chan_monitor, int verbose); -int wanec_ConfBridgeOpen(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); -int wanec_ConfBridgeClose(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); +int wanec_BufferLoad(wan_ec_dev_t *ec_dev, wanec_buffer_config_t *buffer_config, int verbose); +int wanec_BufferUnload(wan_ec_dev_t *ec_dev, wanec_buffer_config_t *buffer_config, int verbose); +int wanec_BufferPlayoutAdd(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose); +int wanec_BufferPlayoutStart(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose); +int wanec_BufferPlayoutStop(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose); -int wanec_EventTone(wan_ec_t *ec, int verbose); +int wanec_ConfBridgeOpen(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose); +int wanec_ConfBridgeClose(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose); +int wanec_ConfBridgeChanAdd(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose); +int wanec_ConfBridgeChanRemove(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose); +int wanec_ConfBridgeChanMute(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose); +int wanec_ConfBridgeChanUnMute(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose); +int wanec_ConfBridgeDominantSpeakerSet(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int enable, int verbose); +int wanec_ConfBridgeMaskChange(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, UINT32 mask, int verbose); +int wanec_ConfBridgeGetStats(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose); + +int wanec_ToneEvent(wan_ec_t *ec, int verbose); +int wanec_PlayoutEvent(wan_ec_t *ec, int verbose); int wanec_ISR(wan_ec_t *ec, int verbose); int wanec_fe2ec_channel(wan_ec_dev_t*, int); static int wanec_hndl2ec_channel(wan_ec_t *ec, UINT32 ChannelHndl); static int wanec_ec2fe_channel(wan_ec_t*, int, wan_ec_dev_t**); -extern int wanec_ChipParam(wan_ec_t*,tPOCT6100_CHIP_OPEN, wan_ec_api_t*); -extern int wanec_ChanParam(wan_ec_t*,tPOCT6100_CHANNEL_MODIFY, wan_ec_api_t*); +extern int wanec_ChipParam(wan_ec_t*,tPOCT6100_CHIP_OPEN, wan_custom_conf_t*, int); +extern int wanec_ChanParam(wan_ec_t*,tPOCT6100_CHANNEL_MODIFY, wan_custom_conf_t*, int); extern int wanec_ChanParamList(wan_ec_t *ec); u32 wanec_req_write(void*, u32 write_addr, u16 write_data); @@ -154,23 +176,41 @@ static int wanec_hndl2ec_channel(wan_ec_t *ec, UINT32 ChannelHndl) } int wanec_fe2ec_channel(wan_ec_dev_t *ec_dev, int fe_channel) { - /*ec_channel = ec_dev->fe_lineno * ec_dev->fe_max_channels + channel;*/ - return ec_dev->fe_lineno * MAX_EC_PORT_RANGE + fe_channel; + int ec_channel = 0; + + if (ec_dev->fe_media == WAN_MEDIA_BRI){ + if (ec_dev->fe_lineno >= 12){ + ec_channel = WANEC_MAX_PORT_RANGE; + } + ec_channel += (ec_dev->fe_lineno * WANEC_MAX_BRI_PORT_RANGE + (fe_channel-1)); + }else if (ec_dev->fe_media == WAN_MEDIA_T1 || ec_dev->fe_media == WAN_MEDIA_FXOFXS){ + ec_channel = ec_dev->fe_lineno * WANEC_MAX_PORT_RANGE + (fe_channel-1); + }else{ + /*ec_channel = ec_dev->fe_lineno * ec_dev->fe_max_chans + channel;*/ + ec_channel = ec_dev->fe_lineno * WANEC_MAX_PORT_RANGE + fe_channel; + } + return ec_channel; } static int wanec_ec2fe_channel(wan_ec_t *ec, int ec_chan, wan_ec_dev_t **ec_dev) { - int fe_chan; + wan_ec_dev_t *ec_dev_tmp; + int fe_chan; - *ec_dev = ec->pEcDevMap[ec_chan]; - if (*ec_dev == NULL) return 0; + ec_dev_tmp = ec->pEcDevMap[ec_chan]; + if (ec_dev_tmp == NULL) return 0; - fe_chan = ec_chan % MAX_EC_PORT_RANGE; - - if ((*ec_dev)->fe_media == WAN_MEDIA_T1 || - (*ec_dev)->fe_media == WAN_MEDIA_FXOFXS){ - fe_chan++; + fe_chan = ec_chan % WANEC_MAX_PORT_RANGE; + if (ec_dev_tmp->fe_media == WAN_MEDIA_BRI){ + fe_chan = fe_chan % WANEC_MAX_BRI_PORT_RANGE; + fe_chan++; + }else{ + if (ec_dev_tmp->fe_media == WAN_MEDIA_T1 || + ec_dev_tmp->fe_media == WAN_MEDIA_FXOFXS){ + fe_chan++; + } } + if (ec_dev && *ec_dev) *ec_dev = ec_dev_tmp; return fe_chan; } @@ -183,7 +223,7 @@ tOCT6100_CHIP_IMAGE_INFO f_ChipImageInfo; #if 0 tOCT6100_GET_HW_REVISION f_Revision; #endif -int wanec_ChipStats(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api, int reset) +int wanec_ChipStats(wan_ec_dev_t *ec_dev, wanec_chip_stats_t *chip_stats, int reset, int verbose) { wan_ec_t *ec; tOCT6100_CHIP_STATS f_ChipStats; @@ -193,9 +233,8 @@ int wanec_ChipStats(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api, int reset) WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; - if (ec_api){ - PRINT1(ec_api->verbose, - "%s: Reading chip statistics...\n", + if (chip_stats){ + PRINT2(verbose, "%s: Reading chip statistics...\n", ec->name); } Oct6100ChipGetStatsDef( &f_ChipStats ); @@ -209,18 +248,17 @@ int wanec_ChipStats(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api, int reset) ec->name, ulResult); return -EINVAL; } - if (ec_api){ - memcpy( &ec_api->u_chip_stats.f_ChipStats, + if (chip_stats){ + memcpy( &chip_stats->f_ChipStats, &f_ChipStats, sizeof(tOCT6100_CHIP_STATS)); } - if (ec_api){ - PRINT1(ec_api->verbose, - "%s: Reading chip image info...\n", + if (chip_stats){ + PRINT2(verbose, "%s: Reading chip image info...\n", ec->name); } - + Oct6100ChipGetImageInfoDef( &f_ChipImageInfo ); ulResult = Oct6100ChipGetImageInfo( ec->pChipInstance, @@ -231,78 +269,77 @@ int wanec_ChipStats(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api, int reset) ec->name, ulResult); return -EINVAL; } - if (ec_api){ - if (ec_api->u_chip_stats.f_ChipImageInfo){ + if (chip_stats){ + if (chip_stats->f_ChipImageInfo){ int err; err = WAN_COPY_TO_USER( &f_ChipImageInfo, - ec_api->u_chip_stats.f_ChipImageInfo, + chip_stats->f_ChipImageInfo, sizeof(tOCT6100_CHIP_IMAGE_INFO)); if (err){ DEBUG_EVENT( "%s: Failed to copy chip image info to user space [%s:%d]!\n", - ec_api->devname, - __FUNCTION__,__LINE__); + ec->name, __FUNCTION__,__LINE__); return -EINVAL; } }else{ - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Echo Canceller image description:\n%s\n", ec->name, f_ChipImageInfo.szVersionNumber); - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Echo Canceller image build ID\t\t\t%08X\n", ec->name, f_ChipImageInfo.ulBuildId); - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Echo Canceller maximum number of channels\t%d\n", ec->name, f_ChipImageInfo.ulMaxChannels); #if 0 - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Echo Canceller maximum tail displacement\t\t%d\n", ec->name, f_ChipImageInfo.ulMaxTailDisplacement); - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Echo Canceller per channel tail displacement\t%s\n", ec->name, (f_ChipImageInfo.fPerChannelTailDisplacement == TRUE)?"TRUE":"FALSE"); - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Echo Canceller per channel tail length\t\t%s\n", ec->name, (f_ChipImageInfo.fPerChannelTailLength == TRUE)?"TRUE":"FALSE"); - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Echo Canceller maximum tail length\t\t%d\n", ec->name, f_ChipImageInfo.ulMaxTailLength); - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Echo Canceller buffer Playout support\t\t%s\n", ec->name, (f_ChipImageInfo.fBufferPlayout == TRUE)?"TRUE":"FALSE"); - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Echo Canceller adaptive noise reduction\t\t%s\n", ec->name, (f_ChipImageInfo.fAdaptiveNoiseReduction==TRUE)?"TRUE":"FALSE"); - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Echo Canceller SOUT noise bleaching\t\t%s\n", ec->name, (f_ChipImageInfo.fSoutNoiseBleaching==TRUE)?"TRUE":"FALSE"); - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Echo Canceller ROUT noise reduction\t\t%s\n", ec->name, (f_ChipImageInfo.fRoutNoiseReduction==TRUE)?"TRUE":"FALSE"); - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Echo Canceller ROUT noise reduction level\t\t%s\n", ec->name, (f_ChipImageInfo.fRoutNoiseReductionLevel==TRUE)?"TRUE":"FALSE"); - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Echo Canceller automatic level control\t\t%s\n", ec->name, (f_ChipImageInfo.fAutoLevelControl==TRUE)?"TRUE":"FALSE"); - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Echo Canceller acoustic echo cancellation\t\t%s\n", ec->name, (f_ChipImageInfo.fAcousticEcho==TRUE)?"TRUE":"FALSE"); - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Echo Canceller conferencing\t\t%s\n", ec->name, (f_ChipImageInfo.fConferencing==TRUE)?"TRUE":"FALSE"); - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Echo Canceller conferencing noise reduction\t\t%s\n", ec->name, (f_ChipImageInfo.fConferencingNoiseReduction==TRUE)?"TRUE":"FALSE"); @@ -331,38 +368,17 @@ int wanec_ChipStats(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api, int reset) return 0; } -int wanec_ChipOpenPrep(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) +int wanec_ChipOpenPrep(wan_ec_dev_t *ec_dev, char *devname, wanec_config_t *config, int verbose) { tOCT6100_GET_INSTANCE_SIZE InstanceSize; wan_ec_t *ec; UINT32 ulResult; - INT err; WAN_ASSERT(ec_dev == NULL); WAN_ASSERT(ec_dev->ec == NULL); - WAN_ASSERT(ec_api->u_config.imageData == NULL); + WAN_ASSERT(config->imageData == NULL); ec = ec_dev->ec; - ec->pImageData = wan_vmalloc(ec_api->u_config.imageSize * sizeof(UINT8)); - if (ec->pImageData == NULL){ - DEBUG_EVENT( - "ERROR: Failed to allocate memory for EC image %ld bytes [%s:%d]!\n", - (unsigned long)ec_api->u_config.imageSize*sizeof(UINT8), - __FUNCTION__,__LINE__); - return -EINVAL; - } - err = WAN_COPY_FROM_USER( - ec->pImageData, - ec_api->u_config.imageData, - ec_api->u_config.imageSize * sizeof(UINT8)); - if (err){ - DEBUG_EVENT( - "ERROR: Failed to copy EC image from user space [%s:%d]!\n", - __FUNCTION__,__LINE__); - wan_vfree(ec->pImageData); - return -EINVAL; - } - ulResult = Oct6100ChipOpenDef( &ec->f_OpenChip ); /*==============================================================*/ @@ -385,19 +401,19 @@ int wanec_ChipOpenPrep(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) /* General parameters */ /* Chip ID.*/ - ec->f_OpenChip.ulUserChipId = 1; + ec->f_OpenChip.ulUserChipId = ec->chip_no; /* Set the max number of accesses to 1024 to speed things up */ - ec->f_OpenChip.ulMaxRwAccesses = 1024; + ec->f_OpenChip.ulMaxRwAccesses = 1024; /* Set the maximums that the chip needs to support for this test */ - ec->f_OpenChip.ulMaxChannels = ec_api->u_config.max_channels; + ec->f_OpenChip.ulMaxChannels = config->max_channels; ec->f_OpenChip.ulMaxBiDirChannels = 0; - ec->f_OpenChip.ulMaxConfBridges = 0; + ec->f_OpenChip.ulMaxConfBridges = 0; //WANEC_MAX_CONFBRIDGE_DEF; ec->f_OpenChip.ulMaxPhasingTssts = 0; - ec->f_OpenChip.ulMaxTdmStreams = 32; - ec->f_OpenChip.ulMaxTsiCncts = 2; + ec->f_OpenChip.ulMaxTdmStreams = 32; + ec->f_OpenChip.ulMaxTsiCncts = 2; /*==============================================================*/ @@ -410,18 +426,18 @@ int wanec_ChipOpenPrep(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) #else ec->f_OpenChip.ulMemoryType = cOCT6100_MEM_TYPE_DDR; #endif - - ec->f_OpenChip.ulNumMemoryChips = 2; - /* **f_OpenChip.ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_8MB; **f_OpenChip.ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_16MB;*/ - ec->f_OpenChip.ulMemoryChipSize = ec_api->u_config.memory_chip_size; + ec->f_OpenChip.ulMemoryChipSize = config->memory_chip_size; + ec->f_OpenChip.ulNumMemoryChips = 2; + ec->f_OpenChip.ulSoftBufferPlayoutEventsBufSize = 2048; + ec->f_OpenChip.fEnableChannelRecording = TRUE; #if defined(ENABLE_ACOUSTICECHO) - ec->f_OpenChip.fEnableAcousticEcho = TRUE; + ec->f_OpenChip.fEnableAcousticEcho = TRUE; #endif #if defined(ENABLE_PRODBIST) @@ -430,10 +446,10 @@ int wanec_ChipOpenPrep(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) ec->f_OpenChip.ulNumProductionBistLoops = 0x1; #endif - ec->f_OpenChip.pbyImageFile = ec->pImageData; - ec->f_OpenChip.ulImageSize = ec_api->u_config.imageSize; + ec->f_OpenChip.ulMaxPlayoutBuffers = WANEC_MAC_PLAYOUT_BUFFERS; - ec->f_OpenChip.ulMaxPlayoutBuffers = cOCT6100_MAX_PLAYOUT_BUFFERS; + ec->f_OpenChip.pbyImageFile = ec->pImageData; + ec->f_OpenChip.ulImageSize = ec->ImageSize; /* Assign board index (0). */ ec->f_Context.ulBoardId = ec->chip_no; @@ -442,14 +458,13 @@ int wanec_ChipOpenPrep(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) ec->f_Context.ec_dev = ec_dev; /* Interface name to driver */ - strlcpy(ec->f_Context.devname, ec_api->devname, WAN_DRVNAME_SZ); + strlcpy(ec->f_Context.devname, devname, WAN_DRVNAME_SZ); ulResult = Oct6100GetInstanceSize(&ec->f_OpenChip, &InstanceSize); if ( ulResult != cOCT6100_ERR_OK ){ DEBUG_EVENT( "ERROR: %s: Failed to get EC chip instance size (err=0x%X)!\n", ec->name, ulResult); - wan_vfree(ec->pImageData); return -EINVAL; } @@ -460,22 +475,23 @@ int wanec_ChipOpenPrep(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) DEBUG_EVENT( "ERROR: %s: Failed to allocate memory for EC chip (%d bytes)!\n", ec->name,InstanceSize.ulApiInstanceSize); - wan_vfree(ec->pImageData); return -EINVAL; } /* Open the OCT6100 on the evaluation board. */ - ec->f_OpenChip.pProcessContext = (PVOID)&ec->f_Context; + ec->f_OpenChip.pProcessContext = (PVOID)&ec->f_Context; - /* parse advianced params */ - if (ec_api->param_no){ - wanec_ChipParam(ec, &ec->f_OpenChip, ec_api); + /* parse advanced params (global custom configuration) */ + if (ec->custom_conf.param_no){ + wanec_ChipParam(ec, &ec->f_OpenChip, &ec->custom_conf, verbose); + } + /* parse advanced params (command line custom configuration) */ + if (config->custom_conf.param_no){ + wanec_ChipParam(ec, &ec->f_OpenChip, &config->custom_conf, verbose); } - /* Chip Open parameter verification */ - ec->ulDebugChannelHndl = cOCT6100_INVALID_HANDLE; - ec->ulDebugDataMode = ec_api->u_config.debug_data_mode; + ec->ulDebugDataMode = config->debug_data_mode; return 0; } @@ -489,9 +505,15 @@ int wanec_ChipOpen(wan_ec_dev_t *ec_dev, int verbose) WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; - PRINT1(verbose, + PRINT2(verbose, "%s: Opening Echo Canceller Chip ...\n", ec->name); + if (ec->f_OpenChip.pbyImageFile == NULL){ + DEBUG_EVENT( + "ERROR: %s: Invalid EC image pointer\n", + ec->name); + return -EINVAL; + } ulResult = Oct6100ChipOpen( ec->pChipInstance, /* API instance memory. */ &ec->f_OpenChip ); /* Open chip structure. */ @@ -502,12 +524,13 @@ int wanec_ChipOpen(wan_ec_dev_t *ec_dev, int verbose) "ERROR: %s: Failed to open Echo Canceller Chip (err=0x%X)\n", ec->name, ulResult); } - wan_vfree(ec->pImageData); return -EINVAL; } - wan_vfree(ec->pImageData); - if (wanec_ChipStats(ec_dev, NULL, TRUE)){ + if (wanec_ChipStats(ec_dev, NULL, TRUE, verbose)){ + DEBUG_EVENT( + "ERROR: %s: Failed to read EC chip statistics!\n", + ec->name); wanec_ChipClose(ec_dev, verbose); return EINVAL; } @@ -535,7 +558,9 @@ int wanec_ChipOpen(wan_ec_dev_t *ec_dev, int verbose) wanec_ChipClose(ec_dev, verbose); return EINVAL; } +#if !defined(__WINDOWS__) ec->pEcDevMap = wan_malloc(sizeof(wan_ec_dev_t*) * ec->max_channels); +#endif if (ec->pEcDevMap == NULL){ DEBUG_EVENT( "ERROR: %s: Failed allocate memory for ec channel map!\n", @@ -549,219 +574,6 @@ int wanec_ChipOpen(wan_ec_dev_t *ec_dev, int verbose) ec->pEchoChannelHndl[ec_chan] = cOCT6100_INVALID_HANDLE; ec->pEcDevMap[ec_chan] = NULL; } - - return 0; -} - -int wanec_ChipOpen_OLD(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) -{ - tOCT6100_CHIP_OPEN f_OpenChip; - tOCT6100_GET_INSTANCE_SIZE InstanceSize; - wan_ec_t *ec; - /*PUINT8 pImageData = NULL;*/ - UINT32 ulResult, i = 0; - INT ec_chan = 0, err; - - WAN_ASSERT(ec_dev == NULL); - WAN_ASSERT(ec_dev->ec == NULL); - WAN_ASSERT(ec_api->u_config.imageData == NULL); - ec = ec_dev->ec; - - ec->pImageData = wan_vmalloc(ec_api->u_config.imageSize * sizeof(UINT8)); - if (ec->pImageData == NULL){ - DEBUG_EVENT( - "ERROR: Failed to allocate memory for EC image %ld bytes [%s:%d]!\n", - (unsigned long)ec_api->u_config.imageSize*sizeof(UINT8), - __FUNCTION__,__LINE__); - return -EINVAL; - } - err = WAN_COPY_FROM_USER( - ec->pImageData, - ec_api->u_config.imageData, - ec_api->u_config.imageSize * sizeof(UINT8)); - if (err){ - DEBUG_EVENT( - "ERROR: Failed to copy EC image from user space [%s:%d]!\n", - __FUNCTION__,__LINE__); - wan_vfree(ec->pImageData); - return -EINVAL; - } - - ulResult = Oct6100ChipOpenDef( &f_OpenChip ); - - /*==============================================================*/ - /* Configure clocks */ - - /* upclk oscillator is at 33.33 Mhz */ - f_OpenChip.ulUpclkFreq = cOCT6100_UPCLK_FREQ_33_33_MHZ; - - /* mclk will be generated by internal PLL at 133 Mhz */ - f_OpenChip.fEnableMemClkOut = TRUE; -#if 1 - f_OpenChip.ulMemClkFreq = cOCT6100_MCLK_FREQ_133_MHZ; -#else - f_OpenChip.ulMemClkFreq = cOCT6100_MCLK_FREQ_125_MHZ; /*125*/ -#endif - - /*==============================================================*/ - - /*==============================================================*/ - /* General parameters */ - - /* Chip ID.*/ - f_OpenChip.ulUserChipId = 1; - - /* Set the max number of accesses to 1024 to speed things up */ - f_OpenChip.ulMaxRwAccesses = 1024; - - /* Set the maximums that the chip needs to support for this test */ - f_OpenChip.ulMaxChannels = ec_api->u_config.max_channels; - -#if 1 - f_OpenChip.ulMaxPlayoutBuffers = WAN_NUM_PLAYOUT_TONES; -#else - f_OpenChip.ulMaxPlayoutBuffers = 2; -#endif - - f_OpenChip.ulMaxBiDirChannels = 0; - f_OpenChip.ulMaxConfBridges = 0; - f_OpenChip.ulMaxPhasingTssts = 0; - f_OpenChip.ulMaxTdmStreams = 32; - f_OpenChip.ulMaxTsiCncts = 2; - - /*==============================================================*/ - - /*==============================================================*/ - /* External Memory Settings */ - - /* Use DDR memory.*/ -#if 1 - f_OpenChip.ulMemoryType = cOCT6100_MEM_TYPE_SDR; -#else - f_OpenChip.ulMemoryType = cOCT6100_MEM_TYPE_DDR; -#endif - - f_OpenChip.ulNumMemoryChips = 2; - - /* - **f_OpenChip.ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_8MB; - **f_OpenChip.ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_16MB;*/ - f_OpenChip.ulMemoryChipSize = ec_api->u_config.memory_chip_size; - - f_OpenChip.fEnableChannelRecording = TRUE; - -#if defined(ENABLE_ACOUSTICECHO) - f_OpenChip.fEnableAcousticEcho = TRUE; -#endif - -#if defined(ENABLE_PRODBIST) - /* Enable production bist mode */ - f_OpenChip.fEnableProductionBist = TRUE; - f_OpenChip.ulNumProductionBistLoops = 0x1; -#endif - - f_OpenChip.pbyImageFile = ec->pImageData; - f_OpenChip.ulImageSize = ec_api->u_config.imageSize; - - /* Assign board index (0). */ - ec->f_Context.ulBoardId = ec->chip_no; - - /* Handle to driver */ - ec->f_Context.ec_dev = ec_dev; - - /* Interface name to driver */ - strlcpy(ec->f_Context.devname, ec_api->devname, WAN_DRVNAME_SZ); - - ulResult = Oct6100GetInstanceSize(&f_OpenChip, &InstanceSize); - if ( ulResult != cOCT6100_ERR_OK ){ - DEBUG_EVENT( - "ERROR: %s: Failed to get EC chip instance size (err=0x%X)!\n", - ec->name, ulResult); - wan_vfree(ec->pImageData); - return -EINVAL; - } - - /* Allocate memory needed for API instance. */ - ec->pChipInstance = - (tPOCT6100_INSTANCE_API)wan_vmalloc(InstanceSize.ulApiInstanceSize); - if (ec->pChipInstance == NULL){ - DEBUG_EVENT( - "ERROR: %s: Failed to allocate memory for EC chip (%d bytes)!\n", - ec->name,InstanceSize.ulApiInstanceSize); - wan_vfree(ec->pImageData); - return -EINVAL; - } - - /* Open the OCT6100 on the evaluation board. */ - f_OpenChip.pProcessContext = (PVOID)&ec->f_Context; - - /* parse advianced params */ - if (ec_api->param_no){ - wanec_ChipParam(ec, &f_OpenChip, ec_api); - } - - PRINT1(ec_api->verbose, - "%s: Opening Echo Canceller Chip ...\n", - ec->name); - ulResult = Oct6100ChipOpen( - ec->pChipInstance, /* API instance memory. */ - &f_OpenChip ); /* Open chip structure. */ - if ( ulResult != cOCT6100_ERR_OK ){ - DEBUG_EVENT( - "ERROR: %s: Failed to open Echo Canceller Chip (err=0x%X)\n", - ec->name, ulResult); - wan_vfree(ec->pImageData); - return -EINVAL; - } - wan_vfree(ec->pImageData); - - if (wanec_ChipStats(ec_dev, NULL, TRUE)){ - wanec_ChipClose(ec_dev, ec_api->verbose); - return EINVAL; - } - - ec->pToneBufferIndexes = - wan_malloc(sizeof(UINT32) * ec->f_OpenChip.ulMaxPlayoutBuffers); - if (ec->pToneBufferIndexes == NULL){ - DEBUG_EVENT( - "ERROR: %s: Failed allocate memory for playout handles!\n", - ec->name); - wanec_ChipClose(ec_dev, ec_api->verbose); - return EINVAL; - } - i = 0; - while(i < ec->f_OpenChip.ulMaxPlayoutBuffers){ - ec->pToneBufferIndexes[i++] = cOCT6100_INVALID_VALUE; - } - - ec->pEchoChannelHndl = - wan_malloc(sizeof(UINT32) * ec->max_channels); - if (ec->pEchoChannelHndl == NULL){ - DEBUG_EVENT( - "ERROR: %s: Failed allocate memory for channel handle!\n", - ec->name); - wan_free(ec->pToneBufferIndexes); - wanec_ChipClose(ec_dev, ec_api->verbose); - return EINVAL; - } - ec->pEcDevMap = wan_malloc(sizeof(wan_ec_dev_t*) * ec->max_channels); - if (ec->pEcDevMap == NULL){ - DEBUG_EVENT( - "ERROR: %s: Failed allocate memory for ec channel map!\n", - ec->name); - wan_free(ec->pToneBufferIndexes); - wan_free(ec->pEchoChannelHndl); - wanec_ChipClose(ec_dev, ec_api->verbose); - return -EINVAL; - } - for(ec_chan = 0; ec_chan < ec->max_channels; ec_chan++){ - ec->pEchoChannelHndl[ec_chan] = cOCT6100_INVALID_HANDLE; - ec->pEcDevMap[ec_chan] = NULL; - } - - ec->ulDebugChannelHndl = cOCT6100_INVALID_HANDLE; - ec->ulDebugDataMode = ec_api->u_config.debug_data_mode; - return 0; } @@ -774,7 +586,7 @@ int wanec_ChipClose(wan_ec_dev_t *ec_dev, int verbose) WAN_ASSERT(ec_dev == NULL); WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; - PRINT1(verbose, + PRINT2(verbose, "%s: Closing Echo Canceller Chip ...\n", ec->name); Oct6100ChipCloseDef( &f_CloseChip ); @@ -799,14 +611,16 @@ int wanec_ChipClose(wan_ec_dev_t *ec_dev, int verbose) wan_free(ec->pEchoChannelHndl); ec->pEchoChannelHndl = NULL; } +#if !defined(__WINDOWS__) if (ec->pEcDevMap){ wan_free(ec->pEcDevMap); ec->pEcDevMap = NULL; } +#endif return 0; } -int wanec_ChannelOpen(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) +int wanec_ChannelOpen(wan_ec_dev_t *ec_dev, int verbose) { tOCT6100_CHANNEL_OPEN EchoChannelOpen; wan_ec_t *ec; @@ -823,7 +637,7 @@ int wanec_ChannelOpen(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) pcm_law_type = (WAN_FE_TDMV_LAW(&card->fe) == WAN_TDMV_MULAW) ? cOCT6100_PCM_U_LAW : cOCT6100_PCM_A_LAW; - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Openning all Echo Canceller channels (%s)...\n", ec->name, (pcm_law_type == cOCT6100_PCM_U_LAW) ? @@ -831,7 +645,8 @@ int wanec_ChannelOpen(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) DEBUG_EVENT("%s: Opening HW Echo Canceller (NoiseRed=%s)\n", ec->name,card->hwec_conf.noise_reduction?"On":"Off"); - + + for(channel = 0; channel < ec->max_channels; channel++){ Oct6100ChannelOpenDef( &EchoChannelOpen ); @@ -887,7 +702,7 @@ int wanec_ChannelOpen(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) ** cOCT6100_COMFORT_NOISE_OFF, ** cOCT6100_COMFORT_NOISE_FAST_LATCH */ - PRINT1(ec_api->verbose, + PRINT2(verbose, "%s: Openning Echo Canceller channel %d (%s)...\n", ec->name, channel, @@ -912,7 +727,7 @@ int wanec_ChannelOpen(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) return 0; } -int wanec_ChannelClose(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api, int verbose) +int wanec_ChannelClose(wan_ec_dev_t *ec_dev, int verbose) { wan_ec_t *ec; tOCT6100_CHANNEL_CLOSE EchoChannelClose; @@ -921,7 +736,7 @@ int wanec_ChannelClose(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api, int verbose) WAN_ASSERT(ec_dev == NULL); WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; - PRINT1(verbose, + PRINT2(verbose, "%s: Closing all Echo Canceller channels ...\n", ec->name); for(channel = 0; channel < (UINT32)ec->max_channels; channel++){ @@ -943,11 +758,10 @@ int wanec_ChannelClose(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api, int verbose) return 0; } -int wanec_ChannelModify( wan_ec_dev_t *ec_dev, - INT channel, - UINT32 mode, - wan_ec_api_t *ec_api, - int verbose) +int wanec_ChannelModifyOpmode( wan_ec_dev_t *ec_dev, + INT channel, + UINT32 opmode, + int verbose) { wan_ec_t *ec; tOCT6100_CHANNEL_MODIFY EchoChannelModify; @@ -957,44 +771,58 @@ int wanec_ChannelModify( wan_ec_dev_t *ec_dev, WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; - Oct6100ChannelModifyDef( &EchoChannelModify ); + PRINT2(verbose, "%s: Modifing EC Channel OPMODE to %d on ec_chan:%d...\n", + ec->name, opmode, channel); + Oct6100ChannelModifyDef( &EchoChannelModify ); /* Assign the handle memory.*/ EchoChannelModify.ulChannelHndl = ec->pEchoChannelHndl[channel]; - /* Enable echo cancellation */ - EchoChannelModify.ulEchoOperationMode = mode; - - /* parse advianced params */ - if (ec_api && ec_api->param_no){ - int err; - err = wanec_ChanParam(ec, &EchoChannelModify, ec_api); - if (err){ - DEBUG_EVENT( - "%s: WARNING: Unsupported parameter for channel %d!\n", - ec->name, - channel); - return -EINVAL; - } - }else if (mode == cOCT6100_KEEP_PREVIOUS_SETTING){ - wanec_ChanParamList(ec); - return 0; + /* Echo Channel Operation Mode */ + EchoChannelModify.ulEchoOperationMode = opmode; + + /* Open the channel.*/ + ulResult = Oct6100ChannelModify( + ec->pChipInstance, + &EchoChannelModify ); + if (ulResult != cOCT6100_ERR_OK){ + DEBUG_EVENT( + "%s: Failed to modify EC Channel OPMOde for ec_chan:%d (err=0x%X)\n", + ec->name, channel, ulResult); + return EINVAL; } + return 0; +} - if (mode == cOCT6100_KEEP_PREVIOUS_SETTING){ - PRINT1(verbose, - "%s: Modify Channel configuration for channel %d...\n", - ec->name, - channel); - }else{ - PRINT1(verbose, - "%s: Modify EC mode for channel %d to %s ...\n", - ec->name, - channel, - (mode == cOCT6100_ECHO_OP_MODE_POWER_DOWN) ? - "POWER_DOWN" : - (mode == cOCT6100_ECHO_OP_MODE_NORMAL) ? - "NORMAL" : "UNKNOWN"); +int wanec_ChannelModifyCustom( wan_ec_dev_t *ec_dev, + INT channel, + wanec_chan_custom_t *chan_custom, + int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_MODIFY EchoChannelModify; + UINT32 ulResult; + int err; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + WAN_ASSERT(chan_custom == NULL); + WAN_ASSERT(chan_custom->custom_conf.param_no == 0); + ec = ec_dev->ec; + + PRINT2(verbose, "%s: Modifing EC Channel Config parameters for ec_chan:%d...\n", + ec->name, channel); + + Oct6100ChannelModifyDef( &EchoChannelModify ); + /* Assign the handle memory.*/ + EchoChannelModify.ulChannelHndl = ec->pEchoChannelHndl[channel]; + /* parse advianced params */ + err = wanec_ChanParam(ec, &EchoChannelModify, &chan_custom->custom_conf, verbose); + if (err){ + DEBUG_EVENT( + "%s: WARNING: Unsupported parameter for channel %d!\n", + ec->name, channel); + return -EINVAL; } /* Open the channel.*/ @@ -1002,29 +830,87 @@ int wanec_ChannelModify( wan_ec_dev_t *ec_dev, ec->pChipInstance, &EchoChannelModify ); if (ulResult != cOCT6100_ERR_OK){ - if (mode == cOCT6100_KEEP_PREVIOUS_SETTING){ - PRINT1(verbose, - "%s: Failed to modify Channel config parameters for channel %d (err=0x%X)\n", - ec->name, - channel, - ulResult); - }else{ - DEBUG_EVENT( - "ERROR: %s: Failed to modify EC mode %s for channel %d (err=0x%X)\n", - ec->name, - (mode == cOCT6100_ECHO_OP_MODE_POWER_DOWN) ? - "POWER_DOWN" : - (mode == cOCT6100_ECHO_OP_MODE_NORMAL) ? - "NORMAL" : "UNKNOWN", - channel, - ulResult); - } + DEBUG_EVENT( + "%s: Failed to modify EC channel config parameters for ec_chan:%d (err=0x%X)\n", + ec->name, channel, ulResult); return EINVAL; } return 0; } -int wanec_ChannelStats(wan_ec_dev_t *ec_dev, INT channel, wan_ec_api_t *ec_api, int reset) +/****************************************************************************** +** CONFERENCE BRIDGE FUNCTIONS +******************************************************************************/ +int wanec_ChannelMute(wan_ec_dev_t* ec_dev, INT ec_chan, wanec_chan_mute_t *mute, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_MUTE f_ChannelMute; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + Oct6100ChannelMuteDef( &f_ChannelMute ); + f_ChannelMute.ulChannelHndl = ec->pEchoChannelHndl[ec_chan]; + f_ChannelMute.ulPortMask = cOCT6100_CHANNEL_MUTE_PORT_NONE; + if (mute == NULL || mute->port_map & WAN_EC_CHANNEL_PORT_SOUT) + f_ChannelMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_SOUT; + if (mute == NULL || mute->port_map & WAN_EC_CHANNEL_PORT_SIN) + f_ChannelMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_SIN; + if (mute == NULL || mute->port_map & WAN_EC_CHANNEL_PORT_ROUT) + f_ChannelMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_ROUT; + if (mute == NULL || mute->port_map & WAN_EC_CHANNEL_PORT_RIN) + f_ChannelMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_RIN; + PRINT2(verbose, "%s: Muting EC Channel %d on port:%X...\n", + ec->name, ec_chan, f_ChannelMute.ulPortMask); + ulResult = Oct6100ChannelMute( + ec->pChipInstance, + &f_ChannelMute); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to mute EC channel %d on port %X (%08X)!\n", + ec->name, ec_chan, f_ChannelMute.ulPortMask, ulResult); + return EINVAL; + } + return 0; +} +int wanec_ChannelUnMute(wan_ec_dev_t *ec_dev, INT ec_chan, wanec_chan_mute_t *mute, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_UNMUTE f_ChannelUnMute; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + Oct6100ChannelUnMuteDef( &f_ChannelUnMute ); + f_ChannelUnMute.ulChannelHndl = ec->pEchoChannelHndl[ec_chan]; + f_ChannelUnMute.ulPortMask = cOCT6100_CHANNEL_MUTE_PORT_NONE; + if (mute == NULL || mute->port_map & WAN_EC_CHANNEL_PORT_SOUT) + f_ChannelUnMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_SOUT; + if (mute == NULL || mute->port_map & WAN_EC_CHANNEL_PORT_SIN) + f_ChannelUnMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_SIN; + if (mute == NULL || mute->port_map & WAN_EC_CHANNEL_PORT_ROUT) + f_ChannelUnMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_ROUT; + if (mute == NULL || mute->port_map & WAN_EC_CHANNEL_PORT_RIN) + f_ChannelUnMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_RIN; + PRINT2(verbose, "%s: Un-Muting EC channel %d on port:%X...\n", + ec->name, ec_chan, f_ChannelUnMute.ulPortMask); + ulResult = Oct6100ChannelUnMute( + ec->pChipInstance, + &f_ChannelUnMute); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to un-mute channel %d on port %X (%08X)!\n", + ec->name, ec_chan, f_ChannelUnMute.ulPortMask, ulResult); + return EINVAL; + } + return 0; +} + +int wanec_ChannelStats(wan_ec_dev_t *ec_dev, INT channel, wanec_chan_stats_t *chan_stats, int verbose) { wan_ec_t *ec; tOCT6100_CHANNEL_STATS f_ChannelStats; @@ -1034,11 +920,11 @@ int wanec_ChannelStats(wan_ec_dev_t *ec_dev, INT channel, wan_ec_api_t *ec_api, WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; - PRINT1(ec_api->verbose, "%s: Reading EC statistics for channel %d...\n", + PRINT2(verbose, "%s: Reading EC statistics for channel %d...\n", ec->name, channel); Oct6100ChannelGetStatsDef( &f_ChannelStats ); f_ChannelStats.ulChannelHndl = ec->pEchoChannelHndl[channel]; - f_ChannelStats.fResetStats = reset; + f_ChannelStats.fResetStats = chan_stats->reset; ulResult = Oct6100ChannelGetStats( ec->pChipInstance, &f_ChannelStats); @@ -1048,30 +934,31 @@ int wanec_ChannelStats(wan_ec_dev_t *ec_dev, INT channel, wan_ec_api_t *ec_api, ec->name, channel, ulResult); return EINVAL; } - if (ec_api){ - memcpy( &ec_api->u_chan_stats.f_ChannelStats, + if (chan_stats){ + memcpy( &chan_stats->f_ChannelStats, &f_ChannelStats, sizeof(tOCT6100_CHANNEL_STATS)); } return 0; } -int wanec_TonesEnable(wan_ec_t *ec, int channel, unsigned char type, int verbose) +int wanec_TonesEnable(wan_ec_t *ec, int ec_chan, wanec_dtmf_config_t *dtmf, int verbose) { tOCT6100_TONE_DETECTION_ENABLE f_ToneDetectionEnable; UINT32 ulResult; int i; - PRINT1(verbose, "%s: Enable tone detection on channel %d ...\n", + PRINT2(verbose, "%s: Enable EC tone detection on chan %d port %X ...\n", ec->name, - channel); + ec_chan, + (dtmf == NULL) ? WAN_EC_CHANNEL_PORT_SOUT|WAN_EC_CHANNEL_PORT_ROUT:dtmf->port_map); - if (type & WAN_EC_CHANNEL_PORT_ROUT){ + if (dtmf == NULL || dtmf->port_map & WAN_EC_CHANNEL_PORT_ROUT){ for(i = 0; i < WAN_NUM_DTMF_TONES; i++){ Oct6100ToneDetectionEnableDef( &f_ToneDetectionEnable ); f_ToneDetectionEnable.ulChannelHndl = - ec->pEchoChannelHndl[channel]; + ec->pEchoChannelHndl[ec_chan]; f_ToneDetectionEnable.ulToneNumber = DetectedRoutToneNumbers[i]; ulResult = Oct6100ToneDetectionEnable ( @@ -1080,14 +967,14 @@ int wanec_TonesEnable(wan_ec_t *ec, int channel, unsigned char type, int verbose if ( ulResult == cOCT6100_ERR_OK ){ continue; }else if (ulResult == cOCT6100_ERR_TONE_DETECTION_TONE_ACTIVATED){ - PRINT1(verbose, - "%s: Tone detection is already enabled on channel %d for port ROUT!\n", - ec->name, channel); + PRINT2(verbose, + "%s: EC Tone detection is already enabled on channel %d for port ROUT!\n", + ec->name, ec_chan); continue; /* already activated */ }else{ DEBUG_EVENT( - "ERROR: %s: Failed to enable tone detection on channel %d!\n", - ec->name, channel); + "ERROR: %s: Failed to enable EC tone detection on ec chan %d!\n", + ec->name, ec_chan); DEBUG_EVENT( "ERROR: %s: (err=0x%X,i=%d)!\n", ec->name, @@ -1096,12 +983,12 @@ int wanec_TonesEnable(wan_ec_t *ec, int channel, unsigned char type, int verbose } } } - if (type & WAN_EC_CHANNEL_PORT_SOUT){ + if (dtmf == NULL || dtmf->port_map & WAN_EC_CHANNEL_PORT_SOUT){ for(i = 0; i < WAN_NUM_DTMF_TONES; i++){ Oct6100ToneDetectionEnableDef( &f_ToneDetectionEnable ); f_ToneDetectionEnable.ulChannelHndl = - ec->pEchoChannelHndl[channel]; + ec->pEchoChannelHndl[ec_chan]; f_ToneDetectionEnable.ulToneNumber = DetectedSoutToneNumbers[i]; ulResult = Oct6100ToneDetectionEnable ( @@ -1110,14 +997,14 @@ int wanec_TonesEnable(wan_ec_t *ec, int channel, unsigned char type, int verbose if ( ulResult == cOCT6100_ERR_OK ){ continue; }else if (ulResult == cOCT6100_ERR_TONE_DETECTION_TONE_ACTIVATED){ - PRINT1(verbose, - "%s: Tone detection is already enabled on channel %d for port SOUT!\n", - ec->name, channel); + PRINT2(verbose, + "%s: EC Tone detection is already enabled on channel %d for port SOUT!\n", + ec->name, ec_chan); continue; /* already activated */ }else{ DEBUG_EVENT( - "ERROR: %s: Failed to enable tone detection on channel %d!\n", - ec->name, channel); + "ERROR: %s: Failed to enable EC tone detection on channel %d!\n", + ec->name, ec_chan); DEBUG_EVENT( "ERROR: %s: (err=0x%X,i=%d)!\n", ec->name, @@ -1130,23 +1017,24 @@ int wanec_TonesEnable(wan_ec_t *ec, int channel, unsigned char type, int verbose return 0; } -int wanec_TonesDisable(wan_ec_t *ec, int channel, unsigned char type, int verbose) +int wanec_TonesDisable(wan_ec_t *ec, int ec_chan, wanec_dtmf_config_t *dtmf, int verbose) { tOCT6100_TONE_DETECTION_DISABLE f_ToneDetectionDisable; UINT32 ulResult; INT i; - PRINT1(verbose, "%s: Disable tone detection on channel %d ...\n", + PRINT2(verbose, "%s: Disable EC tone detection on channel %d port %X...\n", ec->name, - channel); - if (type & WAN_EC_CHANNEL_PORT_ROUT){ + ec_chan, + (dtmf == NULL) ? WAN_EC_CHANNEL_PORT_SOUT|WAN_EC_CHANNEL_PORT_ROUT:dtmf->port_map); + if (dtmf == NULL || dtmf->port_map & WAN_EC_CHANNEL_PORT_ROUT){ for(i = 0; i < WAN_NUM_DTMF_TONES; i++){ Oct6100ToneDetectionDisableDef( &f_ToneDetectionDisable ); f_ToneDetectionDisable.ulChannelHndl = - ec->pEchoChannelHndl[channel]; - if (channel >= 0){ + ec->pEchoChannelHndl[ec_chan]; + if (ec_chan >= 0){ f_ToneDetectionDisable.ulToneNumber = DetectedRoutToneNumbers[i]; }else{ @@ -1156,22 +1044,24 @@ int wanec_TonesDisable(wan_ec_t *ec, int channel, unsigned char type, int verbos ec->pChipInstance, &f_ToneDetectionDisable); if ( ulResult != cOCT6100_ERR_OK ){ - DEBUG_EVENT( - "ERROR: %s: Failed to disable tone detection for channel %d (err=0x%X,i=%d)!\n", - ec->name, channel, - (unsigned int)ulResult, i); - return -EINVAL; + if (ulResult != cOCT6100_ERR_TONE_DETECTION_TONE_NOT_ACTIVATED){ + DEBUG_EVENT( + "ERROR: %s: Failed to disable EC tone detection for channel %d (err=0x%X,i=%d)!\n", + ec->name, ec_chan, + (unsigned int)ulResult, i); + return -EINVAL; + } } } } - if (type & WAN_EC_CHANNEL_PORT_SOUT){ + if (dtmf == NULL || dtmf->port_map & WAN_EC_CHANNEL_PORT_SOUT){ for(i = 0; i < WAN_NUM_DTMF_TONES; i++){ Oct6100ToneDetectionDisableDef( &f_ToneDetectionDisable ); f_ToneDetectionDisable.ulChannelHndl = - ec->pEchoChannelHndl[channel]; - if (channel >= 0){ + ec->pEchoChannelHndl[ec_chan]; + if (ec_chan >= 0){ f_ToneDetectionDisable.ulToneNumber = DetectedSoutToneNumbers[i]; }else{ @@ -1181,11 +1071,13 @@ int wanec_TonesDisable(wan_ec_t *ec, int channel, unsigned char type, int verbos ec->pChipInstance, &f_ToneDetectionDisable); if ( ulResult != cOCT6100_ERR_OK ){ - DEBUG_EVENT( - "ERROR: %s: Failed to disable tone detection for channel %d (err=0x%X,i=%d)!\n", - ec->name, channel, - (unsigned int)ulResult, i); - return -EINVAL; + if (ulResult != cOCT6100_ERR_TONE_DETECTION_TONE_NOT_ACTIVATED){ + DEBUG_EVENT( + "ERROR: %s: Failed to disable EC tone detection for channel %d (err=0x%X,i=%d)!\n", + ec->name, ec_chan, + (unsigned int)ulResult, i); + return -EINVAL; + } } } } @@ -1303,8 +1195,27 @@ static unsigned char wanec_ConvertToneType(UINT32 f_ulToneType) return 0x00; } +static CHAR* wanec_BufferPlayoutType2Str(UINT32 f_ulBufferPlayoutType) +{ + switch (f_ulBufferPlayoutType){ + case cOCT6100_BUFFER_PLAYOUT_EVENT_STOP: return "PLAYOUT_EVENT_STOP"; +#if 0 + case cOCT6100_BUFFER_PLAYOUT_EVENT_CALLER_ID_STOP: return "PLAYOUT_EVENT_CALLER_ID_STOP"; + case cOCT6100_BUFFER_PLAYOUT_EVENT_CALLER_ID_AS_STOP: return "PLAYOUT_EVENT_CALLER_ID_AS_STOP"; +#endif + default: return "INVALID BUFFER_PLAYOUT TYPE!"; + } +} -int wanec_EventTone(wan_ec_t *ec, int verbose) +/* +** wanec_ToneEvent() +** +** Return: 0 - on success +** <0 - on error +** 1 - pending dtmf events +**/ + +int wanec_ToneEvent(wan_ec_t *ec, int verbose) { tOCT6100_EVENT_GET_TONE f_GetToneEvent; tOCT6100_TONE_EVENT ToneEvent[32]; @@ -1314,27 +1225,30 @@ int wanec_EventTone(wan_ec_t *ec, int verbose) UINT32 i; int ec_chan,fe_chan; - PRINT1(verbose, "%s: Getting Tone events ...\n", + PRINT2(verbose, "%s: Getting Tone events ...\n", ec->name); Oct6100EventGetToneDef( &f_GetToneEvent ); f_GetToneEvent.fResetBufs = FALSE; - f_GetToneEvent.ulMaxToneEvent = 32; + f_GetToneEvent.ulMaxToneEvent = WANEC_MAX_TONEEVENTS; f_GetToneEvent.pToneEvent = ToneEvent; ulResult = Oct6100EventGetTone( ec->pChipInstance, &f_GetToneEvent); if ( ulResult != cOCT6100_ERR_OK ){ if ( ulResult != cOCT6100_ERR_EVENTS_TONE_BUF_EMPTY ){ - PRINT1(verbose, "%s: There are not tone events!\n", + PRINT2(verbose, "%s: There are not tone events!\n", ec->name); return 0; } DEBUG_EVENT( "ERROR: %s: Failed to get tone events (err=0x%X)!\n", ec->name, ulResult); - return EINVAL; + return -EINVAL; } + /* No dtmf tone event returned */ + if (!f_GetToneEvent.ulNumValidToneEvent) return 0; + for(i = 0; i < f_GetToneEvent.ulNumValidToneEvent; i++){ ec_chan = wanec_hndl2ec_channel(ec, ToneEvent[i].ulChannelHndl); ec_dev = ec->pEcDevMap[ec_chan]; @@ -1346,7 +1260,7 @@ int wanec_EventTone(wan_ec_t *ec, int verbose) continue; } - PRINT1(verbose, + PRINT2(verbose, "%s: Tone event %s %s on fe_chan=%d ec_chan=%d\n", ec_dev->devname, wanec_ToneId2Str(ToneEvent[i].ulToneDetected), @@ -1356,7 +1270,7 @@ int wanec_EventTone(wan_ec_t *ec, int verbose) card = (sdla_t*)ec_dev->card; if (card->wandev.event_callback.dtmf){ wan_event_t event; - unsigned char dtmf_port=0, dtmf_type=0; + unsigned char dtmf_port = WAN_EC_CHANNEL_PORT_ROUT, dtmf_type; event.type = WAN_EVENT_EC_DTMF; event.channel = fe_chan; @@ -1370,15 +1284,96 @@ int wanec_EventTone(wan_ec_t *ec, int verbose) } } - return 0; + /* Return 1 if more dtmf event are present, otherwise - 0 */ + return (f_GetToneEvent.fMoreEvents == TRUE) ? 1 : 0; } +/* +** wanec_PlayoutEvent() +** +** Return: 0 - on success +** <0 - on error +** 1 - pending dtmf events +**/ +int wanec_PlayoutEvent(wan_ec_t *ec, int verbose) +{ + tOCT6100_BUFFER_PLAYOUT_GET_EVENT f_BufferPlayoutGetEvent; + tOCT6100_BUFFER_PLAYOUT_EVENT PlayoutEvent[32]; + UINT32 ulResult; + wan_ec_dev_t *ec_dev; + UINT32 i; + int ec_chan,fe_chan; + + PRINT2(verbose, "%s: Getting EC Buffer Playout events ...\n", + ec->name); + Oct6100BufferPlayoutGetEventDef( &f_BufferPlayoutGetEvent ); + f_BufferPlayoutGetEvent.pBufferPlayoutEvent = PlayoutEvent; + f_BufferPlayoutGetEvent.ulMaxEvent = WANEC_MAX_PLAYOUTEVENTS; + f_BufferPlayoutGetEvent.fResetBufs = FALSE; + + ulResult = Oct6100BufferPlayoutGetEvent( + ec->pChipInstance, + &f_BufferPlayoutGetEvent); + if ( ulResult != cOCT6100_ERR_OK ){ + if ( ulResult != cOCT6100_ERR_BUFFER_PLAYOUT_EVENT_BUF_EMPTY ){ + PRINT2(verbose, "%s: There are not buffer playout events!\n", + ec->name); + return 0; + } + DEBUG_EVENT( + "ERROR: %s: Failed to get buffer playout events (err=0x%X)!\n", + ec->name, ulResult); + return -EINVAL; + } + + /* No dtmf tone event returned */ + if (!f_BufferPlayoutGetEvent.ulNumValidEvent) return 0; + + for(i = 0; i < f_BufferPlayoutGetEvent.ulNumValidEvent; i++){ + ec_chan = wanec_hndl2ec_channel(ec, PlayoutEvent[i].ulChannelHndl); + ec_dev = ec->pEcDevMap[ec_chan]; + fe_chan = wanec_ec2fe_channel(ec, ec_chan, &ec_dev); + if (ec_dev == NULL || ec_dev->card == NULL){ + DEBUG_EVENT( + "%s: Internal Error: Failed to find fe channel (ec_chan=%d)\n", + ec->name, ec_chan); + continue; + } + + PRINT2(verbose, + "%s: EC Buffer Playout event id %d %s on fe_chan=%d ec_chan=%d port=%s\n", + ec_dev->devname, + PlayoutEvent[i].ulUserEventId, + wanec_BufferPlayoutType2Str(PlayoutEvent[i].ulEventType), + fe_chan, ec_chan, + (PlayoutEvent[i].ulChannelPort==cOCT6100_CHANNEL_PORT_ROUT) ? "ROUT" : "SOUT"); +#if 0 + card = (sdla_t*)ec_dev->card; + if (card->wandev.event_callback.playout){ + } +#endif + } + + /* Return 1 if more playout event are present, otherwise - 0 */ + return (f_BufferPlayoutGetEvent.fMoreEvents == TRUE) ? 1 : 0; +} + +/* +** wanec_ISR() +** +** Return: 0 - on success +** <0 - on error +** 1 - pending dtmf events +**/ int wanec_ISR(wan_ec_t *ec, int verbose) { UINT32 ulResult; + int ret = 0; WAN_ASSERT(ec == NULL); + PRINT2(verbose, "%s: Executing EC interrupt routine ...\n", + ec->name); Oct6100InterruptServiceRoutineDef(&ec->f_InterruptFlag); ulResult = Oct6100InterruptServiceRoutine( @@ -1413,7 +1408,7 @@ int wanec_ISR(wan_ec_t *ec, int verbose) "%s: Error Pll Jitter\n", ec->name); } - if (ec->f_InterruptFlag.fErrorH100OutOfSync == TRUE){ + if (ec->f_InterruptFlag.fErrorH100OutOfSync == TRUE && !ec->ignore_H100){ DEBUG_EVENT( "%s: The H100 slave has lost its framing on the bus!\n", ec->name); @@ -1434,44 +1429,59 @@ int wanec_ISR(wan_ec_t *ec, int verbose) ec->name); } if (ec->f_InterruptFlag.fErrorOverflowToneEvents == TRUE){ - PRINT1(verbose, - "%s: Error Overflow Tone Events\n", + DEBUG_EVENT( + "%s: Error: Tone Event buffer has overflowed\n", ec->name); } if (ec->f_InterruptFlag.fToneEventsPending == TRUE){ - PRINT1(verbose, "%s: Tone Event pending....\n", + PRINT2(verbose, "%s: Tone Event pending....\n", ec->name); - wanec_EventTone(ec, verbose); + ret = wanec_ToneEvent(ec, ec->tone_verbose); } if (ec->f_InterruptFlag.fBufferPlayoutEventsPending == TRUE){ - PRINT1(verbose, + PRINT2(verbose, "%s: Buffer Playout Events Pending\n", ec->name); + ret = wanec_PlayoutEvent(ec, ec->playout_verbose); } if (ec->f_InterruptFlag.fApiSynch == TRUE){ - PRINT1(verbose, + PRINT2(verbose, "%s: The chip interrupted the API for purpose of maintaining sync!\n", ec->name); } - return 0; + return ret; } -int wanec_DebugChannel(wan_ec_t *ec, INT channel, int verbose) +int wanec_DebugChannel(wan_ec_dev_t *ec_dev, INT channel, int verbose) { + wan_ec_t *ec = NULL; tOCT6100_DEBUG_SELECT_CHANNEL DebugSelectChannel; + wanec_chan_stats_t chan_stats; UINT32 ulResult; - if (ec->ulDebugChannelHndl != cOCT6100_INVALID_HANDLE){ + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + /* Verify Echo Canceller Channel operation mode */ + memset(&chan_stats, 0, sizeof(wanec_chan_stats_t)); + ulResult = wanec_ChannelStats(ec_dev, channel, &chan_stats, 0); + if (chan_stats.f_ChannelStats.ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_POWER_DOWN){ DEBUG_EVENT( - "ERROR: %s: Echo Canceller daemon can monitor only one channel (%d)!\n", - ec->name, - ec->DebugChannel); + "ERROR: %s: Invalid Echo Channel %d operation mode (POWER DOWN)!\n", + ec_dev->name, channel); + return -EINVAL; + } + + if (ec_dev->ec->ulDebugChannelHndl != cOCT6100_INVALID_HANDLE){ + DEBUG_EVENT( + "ERROR: %s: Echo Canceller daemon can monitor only one ec channel (%d)!\n", + ec_dev->name, channel); return -EINVAL; } Oct6100DebugSelectChannelDef( &DebugSelectChannel ); - PRINT1(verbose, "%s: Select channel %d for monitoring...\n", - ec->name, + PRINT2(verbose, "%s: Select ec channel %d for monitoring...\n", + ec_dev->name, channel); /* Set selected debug channel */ ec->DebugChannel = channel; @@ -1484,7 +1494,7 @@ int wanec_DebugChannel(wan_ec_t *ec, INT channel, int verbose) &DebugSelectChannel ); if (ulResult != cOCT6100_ERR_OK){ DEBUG_EVENT( - "ERROR: %s: Failed to select debug channel %d for monitoring (err=0x%X)\n", + "ERROR: %s: Failed to select debug ec channel %d for monitoring (err=0x%X)\n", ec->name, channel, ulResult); @@ -1493,16 +1503,17 @@ int wanec_DebugChannel(wan_ec_t *ec, INT channel, int verbose) return 0; } -int wanec_DebugGetData(wan_ec_t *ec, wan_ec_api_t *ec_api) +int wanec_DebugGetData(wan_ec_dev_t *ec_dev, wanec_chan_monitor_t *chan_monitor, int verbose) { + wan_ec_t *ec = NULL; tOCT6100_DEBUG_GET_DATA fDebugGetData; UINT32 ulResult; + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; if (ec->ulDebugChannelHndl == cOCT6100_INVALID_HANDLE){ - PRINT( -#if !defined(__WINDOWS__) - verbose, -#endif + DEBUG_EVENT( "ERROR: %s: No Debug channel was selected!\n", ec->name); return -EINVAL; @@ -1510,36 +1521,34 @@ int wanec_DebugGetData(wan_ec_t *ec, wan_ec_api_t *ec_api) Oct6100DebugGetDataDef( &fDebugGetData ); - PRINT1(ec_api->verbose, - "%s: Retrieves debug data for channel %d...\n", + PRINT2(verbose, + "%s: Retrieves debug data for ec channel %d...\n", ec->name, ec->DebugChannel); - memset(&ec_api->u_chan_monitor.data[0], 0, + memset(&chan_monitor->data[0], 0, sizeof(UINT8) * (MAX_MONITOR_DATA_LEN+1)); /* Set selected debug channel */ fDebugGetData.ulGetDataMode = ec->ulDebugDataMode; - fDebugGetData.ulMaxBytes = ec_api->u_chan_monitor.max_len; - fDebugGetData.pbyData = &ec_api->u_chan_monitor.data[0]; + fDebugGetData.ulMaxBytes = chan_monitor->max_len; + fDebugGetData.pbyData = &chan_monitor->data[0]; /* Select Debug channel */ ulResult = Oct6100DebugGetData( ec->pChipInstance, &fDebugGetData ); if (ulResult != cOCT6100_ERR_OK){ - PRINT( -#if !defined(__WINDOWS__) - verbose, -#endif - "ERROR: %s: Failed to get debug data for channel %d (err=0x%X)\n", + DEBUG_EVENT( + "ERROR: %s: Failed to get debug data for ec channel %d (err=0x%X)\n", ec->name, ec->DebugChannel, ulResult); return -EINVAL; } - ec_api->u_chan_monitor.data_len = fDebugGetData.ulValidNumBytes; - ec_api->u_chan_monitor.remain_len = fDebugGetData.ulRemainingNumBytes; - ec_api->channel = ec->DebugChannel; + chan_monitor->data_len = fDebugGetData.ulValidNumBytes; + chan_monitor->remain_len= fDebugGetData.ulRemainingNumBytes; + //chan_monitor->fe_chan = ec->DebugChannel; + chan_monitor->fe_chan = wanec_ec2fe_channel(ec, ec->DebugChannel, NULL); if (fDebugGetData.ulRemainingNumBytes == 0){ /* Last read */ @@ -1562,35 +1571,35 @@ static PUINT32 wanec_search_bufferindex(wan_ec_t *ec, UINT32 index) return NULL; } -int wanec_BufferLoad(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) +int wanec_BufferLoad(wan_ec_dev_t *ec_dev, wanec_buffer_config_t *buffer_config, int verbose) { wan_ec_t *ec; tOCT6100_BUFFER_LOAD BufferLoad; - UINT32 size, ulResult; + UINT32 size, ulResult, pcmlaw = WAN_EC_PCM_U_LAW; PUINT8 pData = NULL; int err; WAN_ASSERT(ec_dev == NULL); WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; - PRINT1(ec_api->verbose, - "%s: Loading Tone buffer (%s) into OCT6100 Chip ...\n", - ec->name, ec_api->u_tone_config.tone); - size = ec_api->u_tone_config.size * sizeof(INT8); + pcmlaw = (buffer_config->pcmlaw) ? buffer_config->pcmlaw : WAN_EC_PCM_U_LAW; + PRINT2(verbose, + "%s: Loading Tone buffer (%s) law=%s into Echo Canceller Chip ...\n", + ec->name, + buffer_config->buffer, + WAN_EC_DECODE_PCM_LAW(pcmlaw)); + size = buffer_config->size * sizeof(INT8); pData = wan_vmalloc(size); if (pData == NULL){ DEBUG_EVENT( - "ERROR: %s: Failed to allocate memory for tone buffer!\n", + "ERROR: %s: Failed to allocate memory for buffer!\n", ec->name); return -EINVAL; } - err = WAN_COPY_FROM_USER( - pData, - ec_api->u_tone_config.data, - size); + err = WAN_COPY_FROM_USER(pData, buffer_config->data, size); if (err){ DEBUG_EVENT( - "ERROR: %s: Failed to copy EC tone buffer from user space [%s:%d]!\n", + "ERROR: %s: Failed to copy EC buffer from user space [%s:%d]!\n", ec->name, __FUNCTION__,__LINE__); wan_vfree(pData); @@ -1600,10 +1609,8 @@ int wanec_BufferLoad(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) Oct6100BufferPlayoutLoadDef( &BufferLoad ); BufferLoad.pulBufferIndex = wanec_search_bufferindex(ec, cOCT6100_INVALID_VALUE); /* FIXME: Can be alaw/mulaw */ - BufferLoad.ulBufferPcmLaw = - (ec_dev->fe_tdmv_law == WAN_TDMV_MULAW) ? - cOCT6100_PCM_U_LAW : - cOCT6100_PCM_A_LAW; + BufferLoad.ulBufferPcmLaw = (pcmlaw == WAN_EC_PCM_U_LAW) ? + cOCT6100_PCM_U_LAW : cOCT6100_PCM_A_LAW; BufferLoad.pbyBufferPattern = pData; BufferLoad.ulBufferSize = size; ulResult = Oct6100BufferPlayoutLoad ( @@ -1614,21 +1621,21 @@ int wanec_BufferLoad(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) goto buffer_load_done; } DEBUG_EVENT( - "%s: ERROR: Failed to load tone buffer into EC Chip (err=0x%X)\n", + "%s: ERROR: Failed to load buffer into EC Chip (err=0x%X)\n", ec->name, ulResult); wan_vfree(pData); return -EINVAL; } buffer_load_done: wan_vfree(pData); - ec_api->u_tone_config.buffer_index = *BufferLoad.pulBufferIndex; - PRINT1(ec_api->verbose, - "%s: Current tone index is %d\n", - ec->name, ec_api->u_tone_config.buffer_index); + buffer_config->buffer_index = *BufferLoad.pulBufferIndex; + PRINT2(verbose, + "%s: Current buffer index is %d\n", + ec->name, buffer_config->buffer_index); return 0; } -int wanec_BufferUnload(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) +int wanec_BufferUnload(wan_ec_dev_t *ec_dev, wanec_buffer_config_t *buffer_config, int verbose) { wan_ec_t *ec; tOCT6100_BUFFER_UNLOAD BufferUnload; @@ -1638,18 +1645,18 @@ int wanec_BufferUnload(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) WAN_ASSERT(ec_dev == NULL); WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; - PRINT1(ec_api->verbose, - "%s: Unloading Tone buffer from EC chip ...\n", + PRINT2(verbose, + "%s: Unloading buffer from EC chip ...\n", ec->name); try_next_index: Oct6100BufferPlayoutUnloadDef( &BufferUnload ); - if (ec_api->u_tone_config.buffer_index != cOCT6100_INVALID_VALUE){ - pBufferIndex = wanec_search_bufferindex(ec, ec_api->u_tone_config.buffer_index); + if (buffer_config->buffer_index != cOCT6100_INVALID_VALUE){ + pBufferIndex = wanec_search_bufferindex(ec, buffer_config->buffer_index); if (pBufferIndex == NULL){ DEBUG_EVENT( - "ERROR: %s: Invalid tone buffer index %X!\n", - ec->name, ec_api->u_tone_config.buffer_index); + "ERROR: %s: Invalid buffer index %X!\n", + ec->name, buffer_config->buffer_index); return EINVAL; } }else{ @@ -1672,12 +1679,12 @@ try_next_index: goto buffer_unload_done; } DEBUG_EVENT( - "ERROR: %s: Failed to unload tone buffer from EC Chip (err=0x%X)!\n", + "ERROR: %s: Failed to unload buffer from EC Chip (err=0x%X)!\n", ec->name, (unsigned int)ulResult); return EINVAL; } *pBufferIndex = 0; - if (!ec_api->u_tone_config.buffer_index){ + if (!buffer_config->buffer_index){ index++; goto try_next_index; } @@ -1686,62 +1693,81 @@ buffer_unload_done: return 0; } -int wanec_BufferPlayoutAdd(wan_ec_t *ec, int channel, wan_ec_api_t *ec_api) +int wanec_BufferPlayoutAdd(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose) { tOCT6100_BUFFER_PLAYOUT_ADD BufferPlayoutAdd; UINT32 ulResult; - PRINT1(ec_api->verbose, - "%s: Add Tone buffer to channel %d...\n", - ec->name, channel); - if (ec_api->u_playout.index == cOCT6100_INVALID_VALUE|| - wanec_search_bufferindex(ec, ec_api->u_playout.index) == NULL){ + PRINT2(verbose, + "%s: Add Tone buffer to ec channel %d port %s duration %d:%d...\n", + ec->name, + channel, + WAN_EC_DECODE_CHANNEL_PORT(playout->port), + playout->duration, + playout->repeat_cnt); + if (playout->index == cOCT6100_INVALID_VALUE|| + wanec_search_bufferindex(ec, playout->index) == NULL){ DEBUG_EVENT( - "ERROR: %s: Invalid playout buffer index for channel %d!\n", + "ERROR: %s: Invalid playout buffer index for ec channel %d!\n", ec->name, channel); return -EINVAL; } Oct6100BufferPlayoutAddDef( &BufferPlayoutAdd ); - BufferPlayoutAdd.fRepeat = ec_api->u_playout.repeat; - BufferPlayoutAdd.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; + if (playout->repeat_cnt == 1){ + BufferPlayoutAdd.fRepeat = FALSE; + }else{ + BufferPlayoutAdd.fRepeat = TRUE; + } + BufferPlayoutAdd.ulPlayoutPort = + (playout->port == WAN_EC_CHANNEL_PORT_ROUT) ? + cOCT6100_CHANNEL_PORT_ROUT : + cOCT6100_CHANNEL_PORT_SOUT; BufferPlayoutAdd.ulMixingMode = cOCT6100_MIXING_MUTE; BufferPlayoutAdd.ulChannelHndl = ec->pEchoChannelHndl[channel]; - BufferPlayoutAdd.ulBufferIndex = ec_api->u_playout.index; - BufferPlayoutAdd.ulDuration = (ec_api->u_playout.duration) ? - ec_api->u_playout.duration : 5000; - BufferPlayoutAdd.ulBufferLength = (ec_api->u_playout.buffer_length) ? - ec_api->u_playout.buffer_length : + BufferPlayoutAdd.ulBufferIndex = playout->index; + BufferPlayoutAdd.fRepeat = (playout->repeat_cnt) ? TRUE : FALSE; + BufferPlayoutAdd.ulRepeatCount = playout->repeat_cnt; + BufferPlayoutAdd.ulDuration = (playout->duration) ? + playout->duration : 5000; + BufferPlayoutAdd.ulBufferLength = (playout->buffer_length) ? + playout->buffer_length : cOCT6100_AUTO_SELECT; ulResult = Oct6100BufferPlayoutAdd( ec->pChipInstance, &BufferPlayoutAdd); if ( ulResult != cOCT6100_ERR_OK ){ DEBUG_EVENT( - "ERROR: %s: Failed to add playout buffer to channel %d (err=%08X)\n", + "ERROR: %s: Failed to add playout buffer to ec channel %d (err=%08X)\n", ec->name, channel, ulResult); return -EINVAL; } return 0; } -int wanec_BufferPlayoutStart(wan_ec_t *ec, int channel, wan_ec_api_t *ec_api) +int wanec_BufferPlayoutStart(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose) { tOCT6100_BUFFER_PLAYOUT_START BufferPlayoutStart; UINT32 ulResult; - PRINT1(ec_api->verbose, - "%s: Active playout buffer on channel %d...\n", + PRINT2(verbose, + "%s: Active playout buffer on ec channel %d port %s ...\n", ec->name, - channel); + channel, + WAN_EC_DECODE_CHANNEL_PORT(playout->port)); Oct6100BufferPlayoutStartDef( &BufferPlayoutStart ); BufferPlayoutStart.ulChannelHndl = ec->pEchoChannelHndl[channel]; - BufferPlayoutStart.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; + BufferPlayoutStart.ulPlayoutPort = + (playout->port == WAN_EC_CHANNEL_PORT_ROUT) ? + cOCT6100_CHANNEL_PORT_ROUT : + cOCT6100_CHANNEL_PORT_SOUT; + BufferPlayoutStart.fNotifyOnPlayoutStop = playout->notifyonstop; + BufferPlayoutStart.ulUserEventId = playout->user_event_id; ulResult = Oct6100BufferPlayoutStart( ec->pChipInstance, &BufferPlayoutStart); if ( ulResult != cOCT6100_ERR_OK ){ DEBUG_EVENT( - "ERROR: %s: Failed to active playout buffer on channel %d (err=%08X)\n", + "ERROR: %s: Failed to active playout buffer on ec channel %d (err=%08X)\n", ec->name, channel, ulResult); @@ -1750,25 +1776,256 @@ int wanec_BufferPlayoutStart(wan_ec_t *ec, int channel, wan_ec_api_t *ec_api) return 0; } -int wanec_BufferPlayoutStop(wan_ec_t *ec, int channel, wan_ec_api_t *ec_api) +int wanec_BufferPlayoutStop(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose) { tOCT6100_BUFFER_PLAYOUT_STOP BufferPlayoutStop; UINT32 ulResult; - PRINT1(ec_api->verbose, - "%s: Deactive playout buffer on channel %d...\n", + PRINT2(verbose, + "%s: Deactive playout buffer on ec channel %d port %s...\n", ec->name, - channel); + channel, + WAN_EC_DECODE_CHANNEL_PORT(playout->port)); Oct6100BufferPlayoutStopDef( &BufferPlayoutStop ); BufferPlayoutStop.ulChannelHndl = ec->pEchoChannelHndl[channel]; - BufferPlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; + BufferPlayoutStop.ulPlayoutPort = + (playout->port == WAN_EC_CHANNEL_PORT_ROUT) ? + cOCT6100_CHANNEL_PORT_ROUT : + cOCT6100_CHANNEL_PORT_SOUT; ulResult = Oct6100BufferPlayoutStop( ec->pChipInstance, &BufferPlayoutStop); if ( ulResult != cOCT6100_ERR_OK ){ + if (ulResult != cOCT6100_ERR_BUFFER_PLAYOUT_NOT_STARTED){ + DEBUG_EVENT( + "ERROR: %s: Failed to deactive playout buffer on ec channel %d (err=%08X)\n", + ec->name, + channel, + ulResult); + return -EINVAL; + } + } + return 0; +} + + +/****************************************************************************** +** CONFERENCE BRIDGE FUNCTIONS +******************************************************************************/ +int wanec_ConfBridgeOpen(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose) +{ + tOCT6100_CONF_BRIDGE_OPEN ConfBridgeOpen; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Opening Conference Bridge...\n", ec->name); + + if ((unsigned int)ec->confbridges_no >= ec->f_OpenChip.ulMaxConfBridges){ DEBUG_EVENT( - "ERROR: %s: Failed to deactive playout buffer on channel %d (err=%08X)\n", + "ERROR: %s: Trying to open too many conference bridges (%d:%d)\n", ec->name, + ec->confbridges_no, + ec->f_OpenChip.ulMaxConfBridges); + return -EINVAL; + } + + Oct6100ConfBridgeOpenDef( &ConfBridgeOpen ); + ConfBridgeOpen.pulConfBridgeHndl = &confbridge->ulHndl; + ConfBridgeOpen.fFlexibleConferencing = FALSE; + ulResult = Oct6100ConfBridgeOpen( + ec->pChipInstance, + &ConfBridgeOpen); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to open new conference bridge (err=%08X)\n", + ec->name, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeClose(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose) +{ + tOCT6100_CONF_BRIDGE_CLOSE ConfBridgeClose; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Closing Conference Bridge...\n", ec->name); + + Oct6100ConfBridgeCloseDef( &ConfBridgeClose ); + ConfBridgeClose.ulConfBridgeHndl = confbridge->ulHndl; + ulResult = Oct6100ConfBridgeClose( + ec->pChipInstance, + &ConfBridgeClose); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to close conference bridge (%X, err=%08X)\n", + ec->name, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeChanAdd(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose) +{ + tOCT6100_CONF_BRIDGE_CHAN_ADD ConfBridgeChanAdd; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Add channel %d to Conference Bridge %X...\n", + ec->name, channel, confbridge->ulHndl); + + Oct6100ConfBridgeChanAddDef( &ConfBridgeChanAdd ); + ConfBridgeChanAdd.ulConfBridgeHndl = confbridge->ulHndl; + ConfBridgeChanAdd.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ConfBridgeChanAdd( + ec->pChipInstance, + &ConfBridgeChanAdd); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to add channel %d to conference bridge (%X, err=%08X)\n", + ec->name, channel, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeChanRemove(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose) +{ + tOCT6100_CONF_BRIDGE_CHAN_REMOVE ConfBridgeChanRemove; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Remove channel %d from Conference Bridge %X...\n", + ec->name, channel, confbridge->ulHndl); + + Oct6100ConfBridgeChanRemoveDef( &ConfBridgeChanRemove ); + ConfBridgeChanRemove.ulConfBridgeHndl = confbridge->ulHndl; + ConfBridgeChanRemove.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ConfBridgeChanRemove( + ec->pChipInstance, + &ConfBridgeChanRemove); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to remove channel %d from conference bridge (%X, err=%08X)\n", + ec->name, channel, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeChanMute(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose) +{ + tOCT6100_CONF_BRIDGE_CHAN_MUTE ConfBridgeChanMute; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Mute channel %d on a conference bridge %X...\n", + ec->name, channel, confbridge->ulHndl); + + Oct6100ConfBridgeChanMuteDef( &ConfBridgeChanMute ); + ConfBridgeChanMute.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ConfBridgeChanMute( + ec->pChipInstance, + &ConfBridgeChanMute); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to mute channel %d on a conference bridge (%X, err=%08X)\n", + ec->name, channel, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeChanUnMute(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose) +{ + tOCT6100_CONF_BRIDGE_CHAN_UNMUTE ConfBridgeChanUnMute; + UINT32 ulResult; + + PRINT2(verbose, + "%s: UnMute channel %d on a Conference Bridge %X...\n", + ec->name, channel, confbridge->ulHndl); + + Oct6100ConfBridgeChanUnMuteDef( &ConfBridgeChanUnMute ); + ConfBridgeChanUnMute.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ConfBridgeChanUnMute( + ec->pChipInstance, + &ConfBridgeChanUnMute); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to unmute channel %d from conference bridge (%X, err=%08X)\n", + ec->name, channel, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeDominantSpeakerSet(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int enable, int verbose) +{ + tOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET ConfBridgeDominantSpeaker; + UINT32 ulResult; + + PRINT2(verbose, + "%s: %s Dominant speaker (channel %d) to a Conference Bridge %X...\n", + ec->name, + (enable) ? "Enable":"Disable", + channel, + confbridge->ulHndl); + + Oct6100ConfBridgeDominantSpeakerSetDef( &ConfBridgeDominantSpeaker ); + ConfBridgeDominantSpeaker.ulConfBridgeHndl = confbridge->ulHndl; + if (enable){ + ConfBridgeDominantSpeaker.ulChannelHndl = ec->pEchoChannelHndl[channel]; + }else{ + ConfBridgeDominantSpeaker.ulChannelHndl = cOCT6100_CONF_NO_DOMINANT_SPEAKER_HNDL; + } + ulResult = Oct6100ConfBridgeDominantSpeakerSet( + ec->pChipInstance, + &ConfBridgeDominantSpeaker); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to %s dominant speaker to conference bridge (%X, err=%08X)\n", + ec->name, + (enable) ? "enable" : "disable", + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + + +int wanec_ConfBridgeMaskChange(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, UINT32 mask, int verbose) +{ + tOCT6100_CONF_BRIDGE_MASK_CHANGE ConfBridgeMaskChange; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Changing the listener (channel=%d) mask of bridge participant (%d)...\n", + ec->name, + channel, confbridge->ulHndl); + + Oct6100ConfBridgeMaskChangeDef( &ConfBridgeMaskChange ); + ConfBridgeMaskChange.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ConfBridgeMaskChange.ulNewListenerMask = mask; + ulResult = Oct6100ConfBridgeMaskChange( + ec->pChipInstance, + &ConfBridgeMaskChange); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to change the listener mask of bridge participant %d (err=%X)!\n", + ec->name, channel, ulResult); return -EINVAL; @@ -1776,6 +2033,30 @@ int wanec_BufferPlayoutStop(wan_ec_t *ec, int channel, wan_ec_api_t *ec_api) return 0; } +int wanec_ConfBridgeGetStats(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose) +{ + tOCT6100_CONF_BRIDGE_STATS ConfBridgeStats; + UINT32 ulResult; + + PRINT2(verbose, + "%s: Getting bridge statistics %X...\n", + ec->name, confbridge->ulHndl); + + Oct6100ConfBridgeGetStatsDef( &ConfBridgeStats ); + ConfBridgeStats.ulConfBridgeHndl = confbridge->ulHndl; + ulResult = Oct6100ConfBridgeGetStats( + ec->pChipInstance, + &ConfBridgeStats); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to get conference bridge statistics (err=%X)!\n", + ec->name, + ulResult); + return -EINVAL; + } + return 0; +} + /*===========================================================================*\ Oct6100Read \*===========================================================================*/ @@ -1843,7 +2124,7 @@ wan_ec_write_seq(wan_ec_dev_t *ec_dev, u32 write_addr, u16 write_data) return ulResult; /* Keep polling register contol0 for the access_req bit to go low. */ - for ( i = 0; i < WAN_OCT6100_READ_LIMIT; i++ ) + for ( i = 0; i < WANEC_READ_LIMIT; i++ ) { ulResult = wan_ec_read( ec_dev, 0, &usData ); if ( ulResult ) @@ -1853,10 +2134,10 @@ wan_ec_write_seq(wan_ec_dev_t *ec_dev, u32 write_addr, u16 write_data) break; } - if ( i == WAN_OCT6100_READ_LIMIT ){ + if ( i == WANEC_READ_LIMIT ){ DEBUG_EVENT("%s: EC write command reached limit!\n", ec_dev->name); - return WAN_OCT6100_RC_CPU_INTERFACE_NO_RESPONSE; + return WAN_EC_RC_CPU_INTERFACE_NO_RESPONSE; } return 0; } @@ -1889,7 +2170,7 @@ u32 wanec_req_write(void *arg, u32 write_addr, u16 write_data) u32 wanec_req_write_smear(void *arg, u32 addr, u16 data, u32 len) { wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; - u32 i, ulResult = WAN_OCT6100_RC_OK; + u32 i, ulResult = WAN_EC_RC_OK; WAN_ASSERT(ec_dev == NULL); for ( i = 0; i < len; i++ ){ @@ -1912,7 +2193,7 @@ u32 wanec_req_write_smear(void *arg, u32 addr, u16 data, u32 len) u32 wanec_req_write_burst(void *arg, u32 addr, u16 *data, u32 len) { wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; - u32 i, ulResult = WAN_OCT6100_RC_OK; + u32 i, ulResult = WAN_EC_RC_OK; WAN_ASSERT(ec_dev == NULL); @@ -1975,7 +2256,7 @@ wan_ec_read_seq(wan_ec_dev_t *ec_dev, u32 read_addr, u16 *read_data, u32 read_le return ulResult; /* Keep polling register contol0 for the access_req bit to go low. */ - for ( i = 0; i < WAN_OCT6100_READ_LIMIT; i++ ) + for ( i = 0; i < WANEC_READ_LIMIT; i++ ) { ulResult = wan_ec_read( ec_dev, 0x0, &usData ); if (ulResult) @@ -1984,10 +2265,10 @@ wan_ec_read_seq(wan_ec_dev_t *ec_dev, u32 read_addr, u16 *read_data, u32 read_le if ( ( ( usData >> 8 ) & 0x1 ) == 0x0 ) break; } - if ( i == WAN_OCT6100_READ_LIMIT ){ + if ( i == WANEC_READ_LIMIT ){ DEBUG_EVENT("%s: EC read command reached limit!\n", ec_dev->name); - return WAN_OCT6100_RC_CPU_INTERFACE_NO_RESPONSE; + return WAN_EC_RC_CPU_INTERFACE_NO_RESPONSE; } if ( ( usData & 0xFF ) == 0x1 ) @@ -2039,7 +2320,7 @@ u32 wanec_req_read(void *arg, u32 addr, u16 *data) u32 wanec_req_read_burst(void *arg, u32 addr, u16 *data, u32 len) { wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; - u32 i, ulResult = WAN_OCT6100_RC_OK; + u32 i, ulResult = WAN_EC_RC_OK; u16 read_data; for ( i = 0; i < len; i++ ){ diff --git a/patches/kdrivers/wanec/wanec_cmd.nc.c b/patches/kdrivers/wanec/wanec_cmd.nc.c new file mode 100644 index 0000000..1d57c5f --- /dev/null +++ b/patches/kdrivers/wanec/wanec_cmd.nc.c @@ -0,0 +1,2189 @@ +/************************************************************* + * wanec_cmd.c WANPIPE Echo Canceller Layer (WANEC_LIP) + * + * + * + * =========================================================== + * + * May 10 2006 Alex Feldman Initial Version + * + * March 19, 2006 Alex Feldman Enable Sout Adaptive Noise + * Reduction for all channel by + * default. + */ + + +/*============================================================= + * Includes + */ + +#if defined(__FreeBSD__) || defined(__OpenBSD__) +# include +# include +# include +#elif defined(__LINUX__) +# include +# include +# include +# include +#elif defined(__WINDOWS__) +# include +# include +# include +#endif + +int verbose; + +#include "oct6100_api.h" +#include "oct6100_version.h" + +#include "wanec_iface.h" +#include "wanec_tones.h" + +/*============================================================= + * Definitions + */ +#define WANEC_MAX_PORT_RANGE 32 +#define WANEC_MAX_BRI_PORT_RANGE 2 +#define WANEC_READ_LIMIT 0x10000 + +#define WANEC_MAX_CONFBRIDGE_DEF 32 +#define WANEC_MAC_PLAYOUT_BUFFERS 20 +<<<<<<< wanec_cmd.c + +//FIXME: Take this out +#warning "WAN_MEDIA_BRI is localy defined to 0: do not commit" +#define WAN_MEDIA_BRI 0 +======= + +>>>>>>> 1.52 +/*============================================================= + * Global Parameters + */ +UINT32 DetectedSoutToneNumbers[WAN_NUM_DTMF_TONES] = +{ + SOUT_DTMF_0, + SOUT_DTMF_1, + SOUT_DTMF_2, + SOUT_DTMF_3, + SOUT_DTMF_4, + SOUT_DTMF_5, + SOUT_DTMF_6, + SOUT_DTMF_7, + SOUT_DTMF_8, + SOUT_DTMF_9, + SOUT_DTMF_A, + SOUT_DTMF_B, + SOUT_DTMF_C, + SOUT_DTMF_D, + SOUT_DTMF_STAR, + SOUT_DTMF_POUND, +}; +UINT32 DetectedRoutToneNumbers[WAN_NUM_DTMF_TONES] = +{ + ROUT_DTMF_0, + ROUT_DTMF_1, + ROUT_DTMF_2, + ROUT_DTMF_3, + ROUT_DTMF_4, + ROUT_DTMF_5, + ROUT_DTMF_6, + ROUT_DTMF_7, + ROUT_DTMF_8, + ROUT_DTMF_9, + ROUT_DTMF_A, + ROUT_DTMF_B, + ROUT_DTMF_C, + ROUT_DTMF_D, + ROUT_DTMF_STAR, + ROUT_DTMF_POUND +}; + +/*============================================================= + * Function prototype +*/ + +int wanec_ChipOpenPrep(wan_ec_dev_t *ec_dev, char *devname, wanec_config_t *config, int verbose); +int wanec_ChipOpen(wan_ec_dev_t*, int); +int wanec_ChipClose(wan_ec_dev_t*, int verbose); +int wanec_ChipStats(wan_ec_dev_t *ec_dev, wanec_chip_stats_t *chip_stats, int reset, int verbose); + +int wanec_ChannelOpen(wan_ec_dev_t*, int); +int wanec_ChannelClose(wan_ec_dev_t*, int); +int wanec_ChannelModify(wan_ec_dev_t*, INT, wanec_chan_modify_t*, int verbose); +int wanec_ChannelStats(wan_ec_dev_t*, INT channel, wanec_chan_stats_t *chan_stats, int reset); + +int wanec_ChannelMute(wan_ec_dev_t*, INT channel, unsigned char port_mask, int); +int wanec_ChannelUnMute(wan_ec_dev_t*, INT channel, unsigned char port_mask, int); + +int wanec_TonesEnable(wan_ec_t *ec, int channel, unsigned char port, int verbose); +int wanec_TonesDisable(wan_ec_t *ec, int channel, unsigned char port, int verbose); + +int wanec_DebugChannel(wan_ec_dev_t*, INT channel, int verbose); +int wanec_DebugGetData(wan_ec_dev_t*, wanec_chan_monitor_t *chan_monitor, int verbose); + +int wanec_BufferLoad(wan_ec_dev_t *ec_dev, wanec_tone_config_t *tone_config, int verbose); +int wanec_BufferUnload(wan_ec_dev_t *ec_dev, wanec_tone_config_t *tone_config, int verbose); +int wanec_BufferPlayoutAdd(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose); +int wanec_BufferPlayoutStart(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose); +int wanec_BufferPlayoutStop(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose); + +int wanec_ConfBridgeOpen(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose); +int wanec_ConfBridgeClose(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose); +int wanec_ConfBridgeChanAdd(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose); +int wanec_ConfBridgeChanRemove(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose); +int wanec_ConfBridgeChanMute(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose); +int wanec_ConfBridgeChanUnMute(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose); +int wanec_ConfBridgeDominantSpeakerSet(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int enable, int verbose); +int wanec_ConfBridgeMaskChange(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, UINT32 mask, int verbose); +int wanec_ConfBridgeGetStats(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose); + +int wanec_EventTone(wan_ec_t *ec, int verbose); +int wanec_ISR(wan_ec_t *ec, int verbose); + +int wanec_fe2ec_channel(wan_ec_dev_t*, int); +static int wanec_hndl2ec_channel(wan_ec_t *ec, UINT32 ChannelHndl); +static int wanec_ec2fe_channel(wan_ec_t*, int, wan_ec_dev_t**); + +extern int wanec_ChipParam(wan_ec_t*,tPOCT6100_CHIP_OPEN, wan_custom_conf_t*, int); +extern int wanec_ChanParam(wan_ec_t*,tPOCT6100_CHANNEL_MODIFY, wan_custom_conf_t*, int); +extern int wanec_ChanParamList(wan_ec_t *ec); + +u32 wanec_req_write(void*, u32 write_addr, u16 write_data); +u32 wanec_req_write_smear(void*, u32 addr, u16 data, u32 len); +u32 wanec_req_write_burst(void*, u32 addr, u16 *data, u32 len); +u32 wanec_req_read(void*, u32 addr, u16 *data); +u32 wanec_req_read_burst(void*, u32 addr, u16 *data, u32 len); + +extern int wan_ec_write_internal_dword(wan_ec_dev_t *ec_dev, u32 addr1, u32 data); +extern int wan_ec_read_internal_dword(wan_ec_dev_t *ec_dev, u32 addr1, u32 *data); + +/*============================================================= + * Function definition +*/ +static int wanec_hndl2ec_channel(wan_ec_t *ec, UINT32 ChannelHndl) +{ + int channel = 0; + + for(channel = 0; channel < ec->max_channels; channel++){ + if (ec->pEchoChannelHndl[channel] == ChannelHndl){ + return channel; + } + } + return 0; +} +int wanec_fe2ec_channel(wan_ec_dev_t *ec_dev, int fe_channel) +{ + int ec_channel = 0; + + if (ec_dev->fe_media == WAN_MEDIA_BRI){ + if (ec_dev->fe_lineno >= 12){ + ec_channel = WANEC_MAX_PORT_RANGE; + } + ec_channel += (ec_dev->fe_lineno * WANEC_MAX_BRI_PORT_RANGE + (fe_channel-1)); + }else if (ec_dev->fe_media == WAN_MEDIA_T1 || ec_dev->fe_media == WAN_MEDIA_FXOFXS){ + ec_channel = ec_dev->fe_lineno * WANEC_MAX_PORT_RANGE + (fe_channel-1); + }else{ + /*ec_channel = ec_dev->fe_lineno * ec_dev->fe_max_channels + channel;*/ + ec_channel = ec_dev->fe_lineno * WANEC_MAX_PORT_RANGE + fe_channel; + } + return ec_channel; +} + +static int wanec_ec2fe_channel(wan_ec_t *ec, int ec_chan, wan_ec_dev_t **ec_dev) +{ + int fe_chan; + + *ec_dev = ec->pEcDevMap[ec_chan]; + if (*ec_dev == NULL) return 0; + + fe_chan = ec_chan % WANEC_MAX_PORT_RANGE; + if ((*ec_dev)->fe_media == WAN_MEDIA_BRI){ + fe_chan = fe_chan % WANEC_MAX_BRI_PORT_RANGE; + fe_chan++; + }else{ + if ((*ec_dev)->fe_media == WAN_MEDIA_T1 || + (*ec_dev)->fe_media == WAN_MEDIA_FXOFXS){ + fe_chan++; + } + } + return fe_chan; +} + + +/****************************************************************** +** +** +*******************************************************************/ +tOCT6100_CHIP_IMAGE_INFO f_ChipImageInfo; +#if 0 +tOCT6100_GET_HW_REVISION f_Revision; +#endif +int wanec_ChipStats(wan_ec_dev_t *ec_dev, wanec_chip_stats_t *chip_stats, int reset, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHIP_STATS f_ChipStats; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + if (chip_stats){ + PRINT1(verbose, "%s: Reading chip statistics...\n", + ec->name); + } + Oct6100ChipGetStatsDef( &f_ChipStats ); + f_ChipStats.fResetChipStats = reset; + ulResult = Oct6100ChipGetStats( + ec->pChipInstance, + &f_ChipStats); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "%s: Reading chip statistics...\tFailed (err=0x%X)\n", + ec->name, ulResult); + return -EINVAL; + } + if (chip_stats){ + memcpy( &chip_stats->f_ChipStats, + &f_ChipStats, + sizeof(tOCT6100_CHIP_STATS)); + } + + if (chip_stats){ + PRINT1(verbose, "%s: Reading chip image info...\n", + ec->name); + } + + Oct6100ChipGetImageInfoDef( &f_ChipImageInfo ); + ulResult = Oct6100ChipGetImageInfo( + ec->pChipInstance, + &f_ChipImageInfo); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "%s: Reading chip image info...\tFailed (err=0x%X)\n", + ec->name, ulResult); + return -EINVAL; + } + if (chip_stats){ + if (chip_stats->f_ChipImageInfo){ + int err; + err = WAN_COPY_TO_USER( + &f_ChipImageInfo, + chip_stats->f_ChipImageInfo, + sizeof(tOCT6100_CHIP_IMAGE_INFO)); + if (err){ + DEBUG_EVENT( + "%s: Failed to copy chip image info to user space [%s:%d]!\n", + ec->name, __FUNCTION__,__LINE__); + return -EINVAL; + } + }else{ + PRINT1(verbose, + "%s: Echo Canceller image description:\n%s\n", + ec->name, f_ChipImageInfo.szVersionNumber); + PRINT1(verbose, + "%s: Echo Canceller image build ID\t\t\t%08X\n", + ec->name, f_ChipImageInfo.ulBuildId); + PRINT1(verbose, + "%s: Echo Canceller maximum number of channels\t%d\n", + ec->name, f_ChipImageInfo.ulMaxChannels); +#if 0 + PRINT1(verbose, + "%s: Echo Canceller maximum tail displacement\t\t%d\n", + ec->name, f_ChipImageInfo.ulMaxTailDisplacement); + PRINT1(verbose, + "%s: Echo Canceller per channel tail displacement\t%s\n", + ec->name, + (f_ChipImageInfo.fPerChannelTailDisplacement == TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller per channel tail length\t\t%s\n", + ec->name, + (f_ChipImageInfo.fPerChannelTailLength == TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller maximum tail length\t\t%d\n", + ec->name, f_ChipImageInfo.ulMaxTailLength); + PRINT1(verbose, + "%s: Echo Canceller buffer Playout support\t\t%s\n", + ec->name, + (f_ChipImageInfo.fBufferPlayout == TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller adaptive noise reduction\t\t%s\n", + ec->name, + (f_ChipImageInfo.fAdaptiveNoiseReduction==TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller SOUT noise bleaching\t\t%s\n", + ec->name, + (f_ChipImageInfo.fSoutNoiseBleaching==TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller ROUT noise reduction\t\t%s\n", + ec->name, + (f_ChipImageInfo.fRoutNoiseReduction==TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller ROUT noise reduction level\t\t%s\n", + ec->name, + (f_ChipImageInfo.fRoutNoiseReductionLevel==TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller automatic level control\t\t%s\n", + ec->name, + (f_ChipImageInfo.fAutoLevelControl==TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller acoustic echo cancellation\t\t%s\n", + ec->name, + (f_ChipImageInfo.fAcousticEcho==TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller conferencing\t\t%s\n", + ec->name, + (f_ChipImageInfo.fConferencing==TRUE)?"TRUE":"FALSE"); + PRINT1(verbose, + "%s: Echo Canceller conferencing noise reduction\t\t%s\n", + ec->name, + (f_ChipImageInfo.fConferencingNoiseReduction==TRUE)?"TRUE":"FALSE"); +#endif + } + } + if (f_ChipImageInfo.ulMaxChannels < (unsigned int)ec->max_channels){ + ec->max_channels = f_ChipImageInfo.ulMaxChannels-1; + } + +// DEBUG_EVENT(verbose, "%s: Reading hw revision...\n", +// ec->name); +#if 0 + DEBUG_EVENT(verbose, "%s: Reading hw revision...\n", + ec->name); + ec->f_Revision.ulUserChipId = 0; + ec->f_Revision.pProcessContext = &ec->f_Context; + ulResult = Oct6100GetHwRevision(&ec->f_Revision); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "%s: Reading hw revision...\tFailed (err=0x%X)\n", + ec->name, ulResult); + return EINVAL; + } +#endif + return 0; +} + +int wanec_ChipOpenPrep(wan_ec_dev_t *ec_dev, char *devname, wanec_config_t *config, int verbose) +{ + tOCT6100_GET_INSTANCE_SIZE InstanceSize; + wan_ec_t *ec; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + WAN_ASSERT(config->imageData == NULL); + ec = ec_dev->ec; + + ulResult = Oct6100ChipOpenDef( &ec->f_OpenChip ); + + /*==============================================================*/ + /* Configure clocks */ + + /* upclk oscillator is at 33.33 Mhz */ + ec->f_OpenChip.ulUpclkFreq = cOCT6100_UPCLK_FREQ_33_33_MHZ; + + /* mclk will be generated by internal PLL at 133 Mhz */ + ec->f_OpenChip.fEnableMemClkOut = TRUE; +#if 1 + ec->f_OpenChip.ulMemClkFreq = cOCT6100_MCLK_FREQ_133_MHZ; +#else + ec->f_OpenChip.ulMemClkFreq = cOCT6100_MCLK_FREQ_125_MHZ; /*125*/ +#endif + + /*==============================================================*/ + + /*==============================================================*/ + /* General parameters */ + + /* Chip ID.*/ + ec->f_OpenChip.ulUserChipId = ec->chip_no; + + /* Set the max number of accesses to 1024 to speed things up */ + ec->f_OpenChip.ulMaxRwAccesses = 1024; + + /* Set the maximums that the chip needs to support for this test */ + ec->f_OpenChip.ulMaxChannels = config->max_channels; + + ec->f_OpenChip.ulMaxBiDirChannels = 0; + ec->f_OpenChip.ulMaxConfBridges = 0; //WANEC_MAX_CONFBRIDGE_DEF; + ec->f_OpenChip.ulMaxPhasingTssts = 0; + ec->f_OpenChip.ulMaxTdmStreams = 32; + ec->f_OpenChip.ulMaxTsiCncts = 2; + + /*==============================================================*/ + + /*==============================================================*/ + /* External Memory Settings */ + + /* Use DDR memory.*/ +#if 1 + ec->f_OpenChip.ulMemoryType = cOCT6100_MEM_TYPE_SDR; +#else + ec->f_OpenChip.ulMemoryType = cOCT6100_MEM_TYPE_DDR; +#endif + + ec->f_OpenChip.ulNumMemoryChips = 2; + + /* + **f_OpenChip.ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_8MB; + **f_OpenChip.ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_16MB;*/ + ec->f_OpenChip.ulMemoryChipSize = config->memory_chip_size; + + ec->f_OpenChip.fEnableChannelRecording = TRUE; + +#if defined(ENABLE_ACOUSTICECHO) + ec->f_OpenChip.fEnableAcousticEcho = TRUE; +#endif + +#if defined(ENABLE_PRODBIST) + /* Enable production bist mode */ + ec->f_OpenChip.fEnableProductionBist = TRUE; + ec->f_OpenChip.ulNumProductionBistLoops = 0x1; +#endif + + ec->f_OpenChip.ulMaxPlayoutBuffers = WANEC_MAC_PLAYOUT_BUFFERS; + + ec->f_OpenChip.pbyImageFile = ec->pImageData; + ec->f_OpenChip.ulImageSize = ec->ImageSize; + + /* Assign board index (0). */ + ec->f_Context.ulBoardId = ec->chip_no; + + /* Handle to driver */ + ec->f_Context.ec_dev = ec_dev; + + /* Interface name to driver */ + strlcpy(ec->f_Context.devname, devname, WAN_DRVNAME_SZ); + + ulResult = Oct6100GetInstanceSize(&ec->f_OpenChip, &InstanceSize); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to get EC chip instance size (err=0x%X)!\n", + ec->name, ulResult); + return -EINVAL; + } + + /* Allocate memory needed for API instance. */ + ec->pChipInstance = + (tPOCT6100_INSTANCE_API)wan_vmalloc(InstanceSize.ulApiInstanceSize); + if (ec->pChipInstance == NULL){ + DEBUG_EVENT( + "ERROR: %s: Failed to allocate memory for EC chip (%d bytes)!\n", + ec->name,InstanceSize.ulApiInstanceSize); + return -EINVAL; + } + + /* Open the OCT6100 on the evaluation board. */ + ec->f_OpenChip.pProcessContext = (PVOID)&ec->f_Context; + + /* parse advanced params (global custom configuration) */ + if (ec->custom_conf.param_no){ + wanec_ChipParam(ec, &ec->f_OpenChip, &ec->custom_conf, verbose); + } + /* parse advanced params (command line custom configuration) */ + if (config->custom_conf.param_no){ + wanec_ChipParam(ec, &ec->f_OpenChip, &config->custom_conf, verbose); + } + + ec->ulDebugChannelHndl = cOCT6100_INVALID_HANDLE; + ec->ulDebugDataMode = config->debug_data_mode; + return 0; +} + +int wanec_ChipOpen(wan_ec_dev_t *ec_dev, int verbose) +{ + wan_ec_t *ec; + UINT32 ulResult, i = 0; + INT ec_chan = 0; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + PRINT1(verbose, + "%s: Opening Echo Canceller Chip ...\n", + ec->name); + if (ec->f_OpenChip.pbyImageFile == NULL){ + DEBUG_EVENT( + "ERROR: %s: Invalid EC image pointer\n", + ec->name); + return -EINVAL; + } + ulResult = Oct6100ChipOpen( + ec->pChipInstance, /* API instance memory. */ + &ec->f_OpenChip ); /* Open chip structure. */ + if ( ulResult != cOCT6100_ERR_OK ){ + if (ec->imageLast == WANOPT_YES || + ulResult != cOCT6100_ERR_OPEN_INVALID_FIRMWARE_OR_CAPACITY_PINS){ + DEBUG_EVENT( + "ERROR: %s: Failed to open Echo Canceller Chip (err=0x%X)\n", + ec->name, ulResult); + } + return -EINVAL; + } + + if (wanec_ChipStats(ec_dev, NULL, TRUE, verbose)){ + DEBUG_EVENT( + "ERROR: %s: Failed to read EC chip statistics!\n", + ec->name); + wanec_ChipClose(ec_dev, verbose); + return EINVAL; + } + + ec->pToneBufferIndexes = + wan_malloc(sizeof(UINT32) * ec->f_OpenChip.ulMaxPlayoutBuffers); + if (ec->pToneBufferIndexes == NULL){ + DEBUG_EVENT( + "ERROR: %s: Failed allocate memory for playout handles!\n", + ec->name); + wanec_ChipClose(ec_dev, verbose); + return EINVAL; + } + i = 0; + while(i < ec->f_OpenChip.ulMaxPlayoutBuffers){ + ec->pToneBufferIndexes[i++] = cOCT6100_INVALID_VALUE; + } + ec->pEchoChannelHndl = + wan_malloc(sizeof(UINT32) * ec->max_channels); + if (ec->pEchoChannelHndl == NULL){ + DEBUG_EVENT( + "ERROR: %s: Failed allocate memory for channel handle!\n", + ec->name); + wan_free(ec->pToneBufferIndexes); + wanec_ChipClose(ec_dev, verbose); + return EINVAL; + } + ec->pEcDevMap = wan_malloc(sizeof(wan_ec_dev_t*) * ec->max_channels); + if (ec->pEcDevMap == NULL){ + DEBUG_EVENT( + "ERROR: %s: Failed allocate memory for ec channel map!\n", + ec->name); + wan_free(ec->pToneBufferIndexes); + wan_free(ec->pEchoChannelHndl); + wanec_ChipClose(ec_dev, verbose); + return -EINVAL; + } + for(ec_chan = 0; ec_chan < ec->max_channels; ec_chan++){ + ec->pEchoChannelHndl[ec_chan] = cOCT6100_INVALID_HANDLE; + ec->pEcDevMap[ec_chan] = NULL; + } + return 0; +} + +int wanec_ChipClose(wan_ec_dev_t *ec_dev, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHIP_CLOSE f_CloseChip; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + PRINT1(verbose, + "%s: Closing Echo Canceller Chip ...\n", + ec->name); + Oct6100ChipCloseDef( &f_CloseChip ); + ulResult = Oct6100ChipClose( + ec->pChipInstance, + &f_CloseChip ); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to close Echo Canceller chip (err=0x%X)!\n", + ec->name, ulResult); + return -EINVAL; + } + if (ec->pChipInstance){ + wan_vfree(ec->pChipInstance); + ec->pChipInstance = NULL; + } + if (ec->pToneBufferIndexes){ + wan_free(ec->pToneBufferIndexes); + ec->pToneBufferIndexes = NULL; + } + if (ec->pEchoChannelHndl){ + wan_free(ec->pEchoChannelHndl); + ec->pEchoChannelHndl = NULL; + } + if (ec->pEcDevMap){ + wan_free(ec->pEcDevMap); + ec->pEcDevMap = NULL; + } + return 0; +} + +int wanec_ChannelOpen(wan_ec_dev_t *ec_dev, int verbose) +{ + tOCT6100_CHANNEL_OPEN EchoChannelOpen; + wan_ec_t *ec; + sdla_t *card; + UINT32 ulResult; + UINT32 stream = 0,timeslot=0; + INT channel, pcm_law_type; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + WAN_ASSERT(ec_dev->card == NULL); + ec = ec_dev->ec; + card = (sdla_t*)ec_dev->card; + + pcm_law_type = (WAN_FE_TDMV_LAW(&card->fe) == WAN_TDMV_MULAW) ? + cOCT6100_PCM_U_LAW : cOCT6100_PCM_A_LAW; + PRINT1(verbose, + "%s: Openning all Echo Canceller channels (%s)...\n", + ec->name, + (pcm_law_type == cOCT6100_PCM_U_LAW) ? + "MULAW":"ALAW"); + + for(channel = 0; channel < ec->max_channels; channel++){ + Oct6100ChannelOpenDef( &EchoChannelOpen ); + + /* Assign the handle memory.*/ + EchoChannelOpen.pulChannelHndl = &ec->pEchoChannelHndl[channel]; + + /* Make sure the channel does not perform echo cancellation */ +#if defined(WANEC_BYDEFAULT_NORMAL) + EchoChannelOpen.ulEchoOperationMode = + cOCT6100_ECHO_OP_MODE_NORMAL; +#else + EchoChannelOpen.ulEchoOperationMode = + cOCT6100_ECHO_OP_MODE_POWER_DOWN; +#endif + EchoChannelOpen.fEnableToneDisabler = TRUE; + + stream = (channel % 2 == 1) ? 4 : 0; + timeslot = channel / 2; + + /* Configure the TDM interface.*/ + EchoChannelOpen.TdmConfig.ulRinPcmLaw = pcm_law_type; + EchoChannelOpen.TdmConfig.ulRoutPcmLaw = pcm_law_type; + EchoChannelOpen.TdmConfig.ulSinPcmLaw = pcm_law_type; + EchoChannelOpen.TdmConfig.ulSoutPcmLaw = pcm_law_type; + + EchoChannelOpen.TdmConfig.ulRinStream = stream + 0; + EchoChannelOpen.TdmConfig.ulRinTimeslot = timeslot; + EchoChannelOpen.TdmConfig.ulRoutStream = stream + 1; + EchoChannelOpen.TdmConfig.ulRoutTimeslot = timeslot; + EchoChannelOpen.TdmConfig.ulSinStream = stream + 2; + EchoChannelOpen.TdmConfig.ulSinTimeslot = timeslot; + EchoChannelOpen.TdmConfig.ulSoutStream = stream + 3; + EchoChannelOpen.TdmConfig.ulSoutTimeslot = timeslot; + + /* Set the desired VQE features (TRUE/FALSE).*/ + EchoChannelOpen.VqeConfig.fEnableNlp = TRUE; + EchoChannelOpen.VqeConfig.fRinDcOffsetRemoval = TRUE; + EchoChannelOpen.VqeConfig.fSinDcOffsetRemoval = TRUE; +#if defined(ENABLE_ACOUSTICECHO) + EchoChannelOpen.VqeConfig.fAcousticEcho = TRUE; +#endif + + EchoChannelOpen.VqeConfig.fSoutAdaptiveNoiseReduction = TRUE; + EchoChannelOpen.VqeConfig.ulComfortNoiseMode = + cOCT6100_COMFORT_NOISE_NORMAL; + /* cOCT6100_COMFORT_NOISE_NORMAL + ** cOCT6100_COMFORT_NOISE_EXTENDED, + ** cOCT6100_COMFORT_NOISE_OFF, + ** cOCT6100_COMFORT_NOISE_FAST_LATCH */ + + PRINT1(verbose, + "%s: Openning Echo Canceller channel %d (%s)...\n", + ec->name, + channel, + (pcm_law_type == cOCT6100_PCM_U_LAW) ? + "MULAW":"ALAW"); + /* Open the channel.*/ + ulResult = Oct6100ChannelOpen( ec->pChipInstance, + &EchoChannelOpen ); + if (ulResult != cOCT6100_ERR_OK){ + DEBUG_EVENT( + "ERROR: %s: Failed to open Echo Canceller channel %d (err=0x%X)!\n", + ec->name, + channel, + ulResult); + return ulResult; + } + } + + /* Init debug channel handle */ + ec->ulDebugChannelHndl = cOCT6100_INVALID_HANDLE; + + return 0; +} + +int wanec_ChannelClose(wan_ec_dev_t *ec_dev, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_CLOSE EchoChannelClose; + UINT32 ulResult, channel; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + PRINT1(verbose, + "%s: Closing all Echo Canceller channels ...\n", + ec->name); + for(channel = 0; channel < (UINT32)ec->max_channels; channel++){ + Oct6100ChannelCloseDef( &EchoChannelClose ); + EchoChannelClose.ulChannelHndl = + ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ChannelClose( ec->pChipInstance, + &EchoChannelClose ); + if (ulResult != cOCT6100_ERR_OK){ + DEBUG_EVENT( + "ERROR: %s: Failed to close Echo Canceller channel %d (err=0x%X)!\n", + ec->name, + channel, + ulResult); + return -EINVAL; + } + ec->pEchoChannelHndl[channel] = cOCT6100_INVALID_HANDLE; + } + return 0; +} + +int wanec_ChannelModify( wan_ec_dev_t *ec_dev, + INT channel, + wanec_chan_modify_t *chan_modify, + int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_MODIFY EchoChannelModify; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + Oct6100ChannelModifyDef( &EchoChannelModify ); + + /* Assign the handle memory.*/ + EchoChannelModify.ulChannelHndl = ec->pEchoChannelHndl[channel]; + + /* parse advianced params */ + if (chan_modify->custom_conf.param_no){ + int err; + err = wanec_ChanParam(ec, &EchoChannelModify, &chan_modify->custom_conf, verbose); + if (err){ + DEBUG_EVENT( + "%s: WARNING: Unsupported parameter for channel %d!\n", + ec->name, channel); + return -EINVAL; + } + }else{ + + /* Echo Channel Operation Mode */ + EchoChannelModify.ulEchoOperationMode = chan_modify->opmode; + + if (chan_modify->mute != WANEC_IGNORE){ + EchoChannelModify.fVqeConfigModified = TRUE; + if (chan_modify->mute){ + EchoChannelModify.VqeConfig.fDtmfToneRemoval = TRUE; + }else{ + EchoChannelModify.VqeConfig.fDtmfToneRemoval = FALSE; + } + } + } + + /* Open the channel.*/ + ulResult = Oct6100ChannelModify( + ec->pChipInstance, + &EchoChannelModify ); + if (ulResult != cOCT6100_ERR_OK){ + PRINT1(verbose, + "%s: Failed to modify Channel config parameters for channel %d (err=0x%X)\n", + ec->name, + channel, + ulResult); + return EINVAL; + } + return 0; +} + +/****************************************************************************** +** CONFERENCE BRIDGE FUNCTIONS +******************************************************************************/ +int wanec_ChannelMute(wan_ec_dev_t* ec_dev, INT channel, unsigned char port_mask, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_MUTE f_ChannelMute; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + PRINT1(verbose, "%s: Muting channel %d on port %X...\n", + ec->name, channel, port_mask); + Oct6100ChannelMuteDef( &f_ChannelMute ); + f_ChannelMute.ulChannelHndl = ec->pEchoChannelHndl[channel]; + f_ChannelMute.ulPortMask = cOCT6100_CHANNEL_MUTE_PORT_NONE; + if (port_mask & WAN_EC_CHANNEL_PORT_SOUT) + f_ChannelMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_SOUT; + if (port_mask & WAN_EC_CHANNEL_PORT_SIN) + f_ChannelMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_SIN; + if (port_mask & WAN_EC_CHANNEL_PORT_ROUT) + f_ChannelMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_ROUT; + if (port_mask & WAN_EC_CHANNEL_PORT_RIN) + f_ChannelMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_RIN; + ulResult = Oct6100ChannelMute( + ec->pChipInstance, + &f_ChannelMute); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to mute channel %d on port %X (%08X)!\n", + ec->name, channel, port_mask, ulResult); + return EINVAL; + } + return 0; +} +int wanec_ChannelUnMute(wan_ec_dev_t *ec_dev, INT channel, unsigned char port_mask, int verbose) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_UNMUTE f_ChannelUnMute; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + PRINT1(verbose, "%s: Un-muting channel %d on port %X...\n", + ec->name, channel, port_mask); + Oct6100ChannelUnMuteDef( &f_ChannelUnMute ); + f_ChannelUnMute.ulChannelHndl = ec->pEchoChannelHndl[channel]; + f_ChannelUnMute.ulPortMask = cOCT6100_CHANNEL_MUTE_PORT_NONE; + if (port_mask & WAN_EC_CHANNEL_PORT_SOUT) + f_ChannelUnMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_SOUT; + if (port_mask & WAN_EC_CHANNEL_PORT_SIN) + f_ChannelUnMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_SIN; + if (port_mask & WAN_EC_CHANNEL_PORT_ROUT) + f_ChannelUnMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_ROUT; + if (port_mask & WAN_EC_CHANNEL_PORT_RIN) + f_ChannelUnMute.ulPortMask |= cOCT6100_CHANNEL_MUTE_PORT_RIN; + ulResult = Oct6100ChannelUnMute( + ec->pChipInstance, + &f_ChannelUnMute); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to un-mute channel %d on port %X (%08X)!\n", + ec->name, channel, port_mask, ulResult); + return EINVAL; + } + return 0; +} + +int wanec_ChannelStats(wan_ec_dev_t *ec_dev, INT channel, wanec_chan_stats_t *chan_stats, int reset) +{ + wan_ec_t *ec; + tOCT6100_CHANNEL_STATS f_ChannelStats; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + PRINT1(verbose, "%s: Reading EC statistics for channel %d...\n", + ec->name, channel); + Oct6100ChannelGetStatsDef( &f_ChannelStats ); + f_ChannelStats.ulChannelHndl = ec->pEchoChannelHndl[channel]; + f_ChannelStats.fResetStats = reset; + ulResult = Oct6100ChannelGetStats( + ec->pChipInstance, + &f_ChannelStats); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to read EC stats for channel %d (%08X)!\n", + ec->name, channel, ulResult); + return EINVAL; + } + if (chan_stats){ + memcpy( &chan_stats->f_ChannelStats, + &f_ChannelStats, + sizeof(tOCT6100_CHANNEL_STATS)); + } + return 0; +} + +int wanec_TonesEnable(wan_ec_t *ec, int channel, unsigned char type, int verbose) +{ + tOCT6100_TONE_DETECTION_ENABLE f_ToneDetectionEnable; + UINT32 ulResult; + int i; + + PRINT1(verbose, "%s: Enable tone detection on ec chan %d ...\n", + ec->name, + channel); + + if (type & WAN_EC_CHANNEL_PORT_ROUT){ + for(i = 0; i < WAN_NUM_DTMF_TONES; i++){ + + Oct6100ToneDetectionEnableDef( &f_ToneDetectionEnable ); + f_ToneDetectionEnable.ulChannelHndl = + ec->pEchoChannelHndl[channel]; + f_ToneDetectionEnable.ulToneNumber = + DetectedRoutToneNumbers[i]; + ulResult = Oct6100ToneDetectionEnable ( + ec->pChipInstance, + &f_ToneDetectionEnable); + if ( ulResult == cOCT6100_ERR_OK ){ + continue; + }else if (ulResult == cOCT6100_ERR_TONE_DETECTION_TONE_ACTIVATED){ + PRINT1(verbose, + "%s: Tone detection is already enabled on channel %d for port ROUT!\n", + ec->name, channel); + continue; /* already activated */ + }else{ + DEBUG_EVENT( + "ERROR: %s: Failed to enable tone detection on ec chan %d!\n", + ec->name, channel); + DEBUG_EVENT( + "ERROR: %s: (err=0x%X,i=%d)!\n", + ec->name, + (unsigned int)ulResult, i); + return -EINVAL; + } + } + } + if (type & WAN_EC_CHANNEL_PORT_SOUT){ + for(i = 0; i < WAN_NUM_DTMF_TONES; i++){ + + Oct6100ToneDetectionEnableDef( &f_ToneDetectionEnable ); + f_ToneDetectionEnable.ulChannelHndl = + ec->pEchoChannelHndl[channel]; + f_ToneDetectionEnable.ulToneNumber = + DetectedSoutToneNumbers[i]; + ulResult = Oct6100ToneDetectionEnable ( + ec->pChipInstance, + &f_ToneDetectionEnable); + if ( ulResult == cOCT6100_ERR_OK ){ + continue; + }else if (ulResult == cOCT6100_ERR_TONE_DETECTION_TONE_ACTIVATED){ + PRINT1(verbose, + "%s: Tone detection is already enabled on channel %d for port SOUT!\n", + ec->name, channel); + continue; /* already activated */ + }else{ + DEBUG_EVENT( + "ERROR: %s: Failed to enable tone detection on channel %d!\n", + ec->name, channel); + DEBUG_EVENT( + "ERROR: %s: (err=0x%X,i=%d)!\n", + ec->name, + (unsigned int)ulResult, i); + return -EINVAL; + } + } + } + + return 0; +} + +int wanec_TonesDisable(wan_ec_t *ec, int channel, unsigned char type, int verbose) +{ + tOCT6100_TONE_DETECTION_DISABLE f_ToneDetectionDisable; + UINT32 ulResult; + INT i; + + PRINT1(verbose, "%s: Disable tone detection on channel %d ...\n", + ec->name, + channel); + if (type & WAN_EC_CHANNEL_PORT_ROUT){ + + for(i = 0; i < WAN_NUM_DTMF_TONES; i++){ + + Oct6100ToneDetectionDisableDef( &f_ToneDetectionDisable ); + f_ToneDetectionDisable.ulChannelHndl = + ec->pEchoChannelHndl[channel]; + if (channel >= 0){ + f_ToneDetectionDisable.ulToneNumber = + DetectedRoutToneNumbers[i]; + }else{ + f_ToneDetectionDisable.fDisableAll = TRUE; + } + ulResult = Oct6100ToneDetectionDisable ( + ec->pChipInstance, + &f_ToneDetectionDisable); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to disable tone detection for channel %d (err=0x%X,i=%d)!\n", + ec->name, channel, + (unsigned int)ulResult, i); + return -EINVAL; + } + } + } + if (type & WAN_EC_CHANNEL_PORT_SOUT){ + + for(i = 0; i < WAN_NUM_DTMF_TONES; i++){ + + Oct6100ToneDetectionDisableDef( &f_ToneDetectionDisable ); + f_ToneDetectionDisable.ulChannelHndl = + ec->pEchoChannelHndl[channel]; + if (channel >= 0){ + f_ToneDetectionDisable.ulToneNumber = + DetectedSoutToneNumbers[i]; + }else{ + f_ToneDetectionDisable.fDisableAll = TRUE; + } + ulResult = Oct6100ToneDetectionDisable ( + ec->pChipInstance, + &f_ToneDetectionDisable); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to disable tone detection for channel %d (err=0x%X,i=%d)!\n", + ec->name, channel, + (unsigned int)ulResult, i); + return -EINVAL; + } + } + } + return 0; +} + +//#if defined(WAN_DEBUG_HWEC) +#if 1 +static CHAR* wanec_ToneId2Str(UINT32 f_ulToneId) +{ + switch (f_ulToneId){ + /* DTMF Section */ + case ROUT_DTMF_0: return "ROUT_DTMF_0"; + case ROUT_DTMF_1: return "ROUT_DTMF_1"; + case ROUT_DTMF_2: return "ROUT_DTMF_2"; + case ROUT_DTMF_3: return "ROUT_DTMF_3"; + case ROUT_DTMF_4: return "ROUT_DTMF_4"; + case ROUT_DTMF_5: return "ROUT_DTMF_5"; + case ROUT_DTMF_6: return "ROUT_DTMF_6"; + case ROUT_DTMF_7: return "ROUT_DTMF_7"; + case ROUT_DTMF_8: return "ROUT_DTMF_8"; + case ROUT_DTMF_9: return "ROUT_DTMF_9"; + case ROUT_DTMF_A: return "ROUT_DTMF_A"; + case ROUT_DTMF_B: return "ROUT_DTMF_B"; + case ROUT_DTMF_C: return "ROUT_DTMF_C"; + case ROUT_DTMF_D: return "ROUT_DTMF_D"; + case ROUT_DTMF_STAR: return "ROUT_DTMF_STAR"; + case ROUT_DTMF_POUND: return "ROUT_DTMF_POUND"; + case SOUT_DTMF_0: return "SOUT_DTMF_0"; + case SOUT_DTMF_1: return "SOUT_DTMF_1"; + case SOUT_DTMF_2: return "SOUT_DTMF_2"; + case SOUT_DTMF_3: return "SOUT_DTMF_3"; + case SOUT_DTMF_4: return "SOUT_DTMF_4"; + case SOUT_DTMF_5: return "SOUT_DTMF_5"; + case SOUT_DTMF_6: return "SOUT_DTMF_6"; + case SOUT_DTMF_7: return "SOUT_DTMF_7"; + case SOUT_DTMF_8: return "SOUT_DTMF_8"; + case SOUT_DTMF_9: return "SOUT_DTMF_9"; + case SOUT_DTMF_A: return "SOUT_DTMF_A"; + case SOUT_DTMF_B: return "SOUT_DTMF_B"; + case SOUT_DTMF_C: return "SOUT_DTMF_C"; + case SOUT_DTMF_D: return "SOUT_DTMF_D"; + case SOUT_DTMF_STAR: return "SOUT_DTMF_STAR"; + case SOUT_DTMF_POUND: return "SOUT_DTMF_POUND"; + + /* System 5/6/7 Section */ + case SIN_SYSTEM5_2400: return "SIN_SYSTEM5_2400"; + case SIN_SYSTEM5_2600: return "SIN_SYSTEM5_2600"; + case SIN_SYSTEM5_2400_2600: return "SIN_SYSTEM5_2400_2600"; + case SIN_SYSTEM7_2000: return "SIN_SYSTEM7_2000"; + case SIN_SYSTEM7_1780: return "SIN_SYSTEM7_1780"; + + default: return "INVALID TONE ID!"; + } +} +#endif + +static unsigned char wanec_ConvertToneId(UINT32 f_ulToneId, unsigned char *ec_dtmf_port) +{ + switch (f_ulToneId){ + /* DTMF Section */ + case ROUT_DTMF_0: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '0'; + case ROUT_DTMF_1: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '1'; + case ROUT_DTMF_2: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '2'; + case ROUT_DTMF_3: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '3'; + case ROUT_DTMF_4: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '4'; + case ROUT_DTMF_5: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '5'; + case ROUT_DTMF_6: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '6'; + case ROUT_DTMF_7: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '7'; + case ROUT_DTMF_8: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '8'; + case ROUT_DTMF_9: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '9'; + case ROUT_DTMF_A: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return 'A'; + case ROUT_DTMF_B: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return 'B'; + case ROUT_DTMF_C: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return 'C'; + case ROUT_DTMF_D: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return 'D'; + case ROUT_DTMF_STAR: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '*'; + case ROUT_DTMF_POUND: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_ROUT; return '#'; + case SOUT_DTMF_0: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '0'; + case SOUT_DTMF_1: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '1'; + case SOUT_DTMF_2: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '2'; + case SOUT_DTMF_3: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '3'; + case SOUT_DTMF_4: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '4'; + case SOUT_DTMF_5: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '5'; + case SOUT_DTMF_6: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '6'; + case SOUT_DTMF_7: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '7'; + case SOUT_DTMF_8: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '8'; + case SOUT_DTMF_9: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '9'; + case SOUT_DTMF_A: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return 'A'; + case SOUT_DTMF_B: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return 'B'; + case SOUT_DTMF_C: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return 'C'; + case SOUT_DTMF_D: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return 'D'; + case SOUT_DTMF_STAR: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '*'; + case SOUT_DTMF_POUND: *ec_dtmf_port = WAN_EC_CHANNEL_PORT_SOUT; return '#'; + } + return 0x00000000; +} + +#if 1 +//#if defined(WAN_DEBUG_HWEC) +static CHAR* wanec_ToneType2Str(UINT32 f_ulToneType) +{ + switch (f_ulToneType){ + case cOCT6100_TONE_PRESENT: return "cOCT6100_TONE_PRESENT"; + case cOCT6100_TONE_STOP: return "cOCT6100_TONE_STOP"; + default: return "INVALID TONE TYPE!"; + } +} +#endif +static unsigned char wanec_ConvertToneType(UINT32 f_ulToneType) +{ + switch (f_ulToneType){ + case cOCT6100_TONE_PRESENT: return WAN_EC_TONE_PRESENT; + case cOCT6100_TONE_STOP: return WAN_EC_TONE_STOP; + } + return 0x00; +} + + +/* +** wanec_EventTone() +** +** Return: 0 - on success +** <0 - on error +** 1 - pending dtmf events +**/ +int wanec_EventTone(wan_ec_t *ec, int verbose) +{ + tOCT6100_EVENT_GET_TONE f_GetToneEvent; + tOCT6100_TONE_EVENT ToneEvent[32]; + UINT32 ulResult; + wan_ec_dev_t *ec_dev; + sdla_t *card; + UINT32 i; + int ec_chan,fe_chan; + + PRINT1(verbose, "%s: Getting Tone events ...\n", + ec->name); + Oct6100EventGetToneDef( &f_GetToneEvent ); + f_GetToneEvent.fResetBufs = FALSE; + f_GetToneEvent.ulMaxToneEvent = 32; + f_GetToneEvent.pToneEvent = ToneEvent; + ulResult = Oct6100EventGetTone( + ec->pChipInstance, + &f_GetToneEvent); + if ( ulResult != cOCT6100_ERR_OK ){ + if ( ulResult != cOCT6100_ERR_EVENTS_TONE_BUF_EMPTY ){ + PRINT1(verbose, "%s: There are not tone events!\n", + ec->name); + return 0; + } + DEBUG_EVENT( + "ERROR: %s: Failed to get tone events (err=0x%X)!\n", + ec->name, ulResult); + return -EINVAL; + } + + /* No dtmf tone event returned */ + if (!f_GetToneEvent.ulNumValidToneEvent) return 0; + + for(i = 0; i < f_GetToneEvent.ulNumValidToneEvent; i++){ + ec_chan = wanec_hndl2ec_channel(ec, ToneEvent[i].ulChannelHndl); + ec_dev = ec->pEcDevMap[ec_chan]; + fe_chan = wanec_ec2fe_channel(ec, ec_chan, &ec_dev); + if (ec_dev == NULL || ec_dev->card == NULL){ + DEBUG_EVENT( + "%s: Internal Error: Failed to find fe channel (ec_chan=%d)\n", + ec->name, ec_chan); + continue; + } + + PRINT1(verbose, + "%s: Tone event %s %s on fe_chan=%d ec_chan=%d\n", + ec_dev->devname, + wanec_ToneId2Str(ToneEvent[i].ulToneDetected), + wanec_ToneType2Str(f_GetToneEvent.pToneEvent[i].ulEventType), + fe_chan, ec_chan); + + card = (sdla_t*)ec_dev->card; + if (card->wandev.event_callback.dtmf){ + wan_event_t event; + unsigned char dtmf_port = WAN_EC_CHANNEL_PORT_ROUT, dtmf_type; + + event.type = WAN_EVENT_EC_DTMF; + event.channel = fe_chan; + event.digit = wanec_ConvertToneId( + ToneEvent[i].ulToneDetected, + &dtmf_port); + dtmf_type = wanec_ConvertToneType(ToneEvent[i].ulEventType); + event.dtmf_type = dtmf_type; + event.dtmf_port = dtmf_port; + card->wandev.event_callback.dtmf(card, &event); + } + } + + /* Return 1 if more dtmf event are present, otherwise - 0 */ + return (f_GetToneEvent.fMoreEvents == TRUE) ? 1 : 0; +} + +/* +** wanec_ISR() +** +** Return: 0 - on success +** <0 - on error +** 1 - pending dtmf events +**/ +int wanec_ISR(wan_ec_t *ec, int verbose) +{ + UINT32 ulResult; + int ret = 0; + + WAN_ASSERT(ec == NULL); + + Oct6100InterruptServiceRoutineDef(&ec->f_InterruptFlag); + + ulResult = Oct6100InterruptServiceRoutine( + ec->pChipInstance, + &ec->f_InterruptFlag ); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to execute interrupt Service Routine (err=%08X)!\n", + ec->name, + ulResult); + return -EINVAL; + } + /* Critical errors */ + if (ec->f_InterruptFlag.fFatalGeneral == TRUE){ + DEBUG_EVENT( + "%s: An internal fatal chip error detected (0x%X)!\n", + ec->name, + ec->f_InterruptFlag.ulFatalGeneralFlags); + } + if (ec->f_InterruptFlag.fFatalReadTimeout == TRUE){ + DEBUG_EVENT( + "%s: A read to the external memory has failed!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorRefreshTooLate == TRUE){ + DEBUG_EVENT( + "%s: Error Refresh Too Late!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorPllJitter == TRUE){ + DEBUG_EVENT( + "%s: Error Pll Jitter\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorH100OutOfSync == TRUE){ + DEBUG_EVENT( + "%s: The H100 slave has lost its framing on the bus!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorH100ClkA == TRUE){ + DEBUG_EVENT( + "%s: The CT_C8_A clock behavior does not conform to the H.100 spec!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorH100FrameA == TRUE){ + DEBUG_EVENT( + "%s: The CT_FRAME_A clock behavior does not comform to the H.100 spec!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorH100ClkB == TRUE){ + DEBUG_EVENT( + "%s: The CT_C8_B clock is not running a 16.384 MHz!\n", + ec->name); + } + if (ec->f_InterruptFlag.fErrorOverflowToneEvents == TRUE){ + DEBUG_EVENT( + "%s: Error: Tone Event buffer has overflowed\n", + ec->name); + } + if (ec->f_InterruptFlag.fToneEventsPending == TRUE){ + PRINT1(verbose, "%s: Tone Event pending....\n", + ec->name); + ret = wanec_EventTone(ec, verbose); + } + if (ec->f_InterruptFlag.fBufferPlayoutEventsPending == TRUE){ + PRINT1(verbose, + "%s: Buffer Playout Events Pending\n", + ec->name); + } + if (ec->f_InterruptFlag.fApiSynch == TRUE){ + PRINT1(verbose, + "%s: The chip interrupted the API for purpose of maintaining sync!\n", + ec->name); + } + return ret; +} + +int wanec_DebugChannel(wan_ec_dev_t *ec_dev, INT channel, int verbose) +{ + wan_ec_t *ec = NULL; + tOCT6100_DEBUG_SELECT_CHANNEL DebugSelectChannel; + wanec_chan_stats_t chan_stats; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + /* Verify Echo Canceller Channel operation mode */ + ulResult = wanec_ChannelStats(ec_dev, channel, &chan_stats, 0); + if (chan_stats.f_ChannelStats.ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_POWER_DOWN){ + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Channel %d operation mode (POWER DOWN)!\n", + ec_dev->name, channel); + return -EINVAL; + } + + if (ec_dev->ec->ulDebugChannelHndl != cOCT6100_INVALID_HANDLE){ + DEBUG_EVENT( + "ERROR: %s: Echo Canceller daemon can monitor only one ec channel (%d)!\n", + ec_dev->name, channel); + return -EINVAL; + } + Oct6100DebugSelectChannelDef( &DebugSelectChannel ); + + PRINT1(verbose, "%s: Select ec channel %d for monitoring...\n", + ec_dev->name, + channel); + /* Set selected debug channel */ + ec->DebugChannel = channel; + ec->ulDebugChannelHndl = ec->pEchoChannelHndl[channel]; + DebugSelectChannel.ulChannelHndl= ec->pEchoChannelHndl[channel]; + + /* Select Debug channel */ + ulResult = Oct6100DebugSelectChannel( + ec->pChipInstance, + &DebugSelectChannel ); + if (ulResult != cOCT6100_ERR_OK){ + DEBUG_EVENT( + "ERROR: %s: Failed to select debug ec channel %d for monitoring (err=0x%X)\n", + ec->name, + channel, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_DebugGetData(wan_ec_dev_t *ec_dev, wanec_chan_monitor_t *chan_monitor, int verbose) +{ + wan_ec_t *ec = NULL; + tOCT6100_DEBUG_GET_DATA fDebugGetData; + UINT32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + if (ec->ulDebugChannelHndl == cOCT6100_INVALID_HANDLE){ + PRINT( +#if !defined(__WINDOWS__) + verbose, +#endif + "ERROR: %s: No Debug channel was selected!\n", + ec->name); + return -EINVAL; + } + + Oct6100DebugGetDataDef( &fDebugGetData ); + + PRINT1(verbose, + "%s: Retrieves debug data for ec channel %d...\n", + ec->name, + ec->DebugChannel); + + memset(&chan_monitor->data[0], 0, + sizeof(UINT8) * (MAX_MONITOR_DATA_LEN+1)); + /* Set selected debug channel */ + fDebugGetData.ulGetDataMode = ec->ulDebugDataMode; + fDebugGetData.ulMaxBytes = chan_monitor->max_len; + fDebugGetData.pbyData = &chan_monitor->data[0]; + + /* Select Debug channel */ + ulResult = Oct6100DebugGetData( + ec->pChipInstance, + &fDebugGetData ); + if (ulResult != cOCT6100_ERR_OK){ + PRINT( +#if !defined(__WINDOWS__) + verbose, +#endif + "ERROR: %s: Failed to get debug data for ec channel %d (err=0x%X)\n", + ec->name, + ec->DebugChannel, + ulResult); + return -EINVAL; + } + chan_monitor->data_len = fDebugGetData.ulValidNumBytes; + chan_monitor->remain_len = fDebugGetData.ulRemainingNumBytes; + chan_monitor->channel = ec->DebugChannel; + + if (fDebugGetData.ulRemainingNumBytes == 0){ + /* Last read */ + ec->ulDebugChannelHndl = cOCT6100_INVALID_HANDLE; + } + + return 0; +} + +static PUINT32 wanec_search_bufferindex(wan_ec_t *ec, UINT32 index) +{ + UINT32 i = 0; + + while(i < ec->f_OpenChip.ulMaxPlayoutBuffers){ + if (ec->pToneBufferIndexes[i] == index){ + return &ec->pToneBufferIndexes[i]; + } + i++; + } + return NULL; +} + +int wanec_BufferLoad(wan_ec_dev_t *ec_dev, wanec_tone_config_t *tone_config, int verbose) +{ + wan_ec_t *ec; + tOCT6100_BUFFER_LOAD BufferLoad; + UINT32 size, ulResult; + PUINT8 pData = NULL; + int err; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + PRINT1(verbose, + "%s: Loading Tone buffer (%s) into OCT6100 Chip ...\n", + ec->name, tone_config->tone); + size = tone_config->size * sizeof(INT8); + pData = wan_vmalloc(size); + if (pData == NULL){ + DEBUG_EVENT( + "ERROR: %s: Failed to allocate memory for tone buffer!\n", + ec->name); + return -EINVAL; + } + err = WAN_COPY_FROM_USER(pData, tone_config->data, size); + if (err){ + DEBUG_EVENT( + "ERROR: %s: Failed to copy EC tone buffer from user space [%s:%d]!\n", + ec->name, + __FUNCTION__,__LINE__); + wan_vfree(pData); + return -EINVAL; + } + + Oct6100BufferPlayoutLoadDef( &BufferLoad ); + BufferLoad.pulBufferIndex = wanec_search_bufferindex(ec, cOCT6100_INVALID_VALUE); + /* FIXME: Can be alaw/mulaw */ + BufferLoad.ulBufferPcmLaw = + (ec_dev->fe_tdmv_law == WAN_TDMV_MULAW) ? + cOCT6100_PCM_U_LAW : + cOCT6100_PCM_A_LAW; + BufferLoad.pbyBufferPattern = pData; + BufferLoad.ulBufferSize = size; + ulResult = Oct6100BufferPlayoutLoad ( + ec->pChipInstance, + &BufferLoad); + if ( ulResult != cOCT6100_ERR_OK ){ + if (ulResult == cOCT6100_ERR_BUFFER_PLAYOUT_ALL_BUFFERS_OPEN){ + goto buffer_load_done; + } + DEBUG_EVENT( + "%s: ERROR: Failed to load tone buffer into EC Chip (err=0x%X)\n", + ec->name, ulResult); + wan_vfree(pData); + return -EINVAL; + } +buffer_load_done: + wan_vfree(pData); + tone_config->buffer_index = *BufferLoad.pulBufferIndex; + PRINT1(verbose, + "%s: Current tone index is %d\n", + ec->name, tone_config->buffer_index); + return 0; +} + +int wanec_BufferUnload(wan_ec_dev_t *ec_dev, wanec_tone_config_t *tone_config, int verbose) +{ + wan_ec_t *ec; + tOCT6100_BUFFER_UNLOAD BufferUnload; + PUINT32 pBufferIndex = NULL; + UINT32 index = 0, ulResult; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + PRINT1(verbose, + "%s: Unloading Tone buffer from EC chip ...\n", + ec->name); + +try_next_index: + Oct6100BufferPlayoutUnloadDef( &BufferUnload ); + if (tone_config->buffer_index != cOCT6100_INVALID_VALUE){ + pBufferIndex = wanec_search_bufferindex(ec, tone_config->buffer_index); + if (pBufferIndex == NULL){ + DEBUG_EVENT( + "ERROR: %s: Invalid tone buffer index %X!\n", + ec->name, tone_config->buffer_index); + return EINVAL; + } + }else{ + if (index > ec->f_OpenChip.ulMaxPlayoutBuffers){ + goto buffer_unload_done; + } + if (ec->pToneBufferIndexes[index] == cOCT6100_INVALID_VALUE){ + index++; + goto try_next_index; + } + pBufferIndex = &ec->pToneBufferIndexes[index]; + } + + BufferUnload.ulBufferIndex = *pBufferIndex; + ulResult = Oct6100BufferPlayoutUnload ( + ec->pChipInstance, + &BufferUnload); + if ( ulResult != cOCT6100_ERR_OK ){ + if (ulResult == cOCT6100_ERR_BUFFER_PLAYOUT_NOT_OPEN){ + goto buffer_unload_done; + } + DEBUG_EVENT( + "ERROR: %s: Failed to unload tone buffer from EC Chip (err=0x%X)!\n", + ec->name, (unsigned int)ulResult); + return EINVAL; + } + *pBufferIndex = 0; + if (!tone_config->buffer_index){ + index++; + goto try_next_index; + } + +buffer_unload_done: + return 0; +} + +int wanec_BufferPlayoutAdd(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose) +{ + tOCT6100_BUFFER_PLAYOUT_ADD BufferPlayoutAdd; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Add Tone buffer to ec channel %d...\n", + ec->name, channel); + if (playout->index == cOCT6100_INVALID_VALUE|| + wanec_search_bufferindex(ec, playout->index) == NULL){ + DEBUG_EVENT( + "ERROR: %s: Invalid playout buffer index for ec channel %d!\n", + ec->name, channel); + return -EINVAL; + } + Oct6100BufferPlayoutAddDef( &BufferPlayoutAdd ); + BufferPlayoutAdd.fRepeat = playout->repeat; + BufferPlayoutAdd.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; + BufferPlayoutAdd.ulMixingMode = cOCT6100_MIXING_MUTE; + BufferPlayoutAdd.ulChannelHndl = ec->pEchoChannelHndl[channel]; + BufferPlayoutAdd.ulBufferIndex = playout->index; + BufferPlayoutAdd.ulDuration = (playout->duration) ? + playout->duration : 5000; + BufferPlayoutAdd.ulBufferLength = (playout->buffer_length) ? + playout->buffer_length : + cOCT6100_AUTO_SELECT; + ulResult = Oct6100BufferPlayoutAdd( + ec->pChipInstance, + &BufferPlayoutAdd); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to add playout buffer to ec channel %d (err=%08X)\n", + ec->name, channel, ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_BufferPlayoutStart(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose) +{ + tOCT6100_BUFFER_PLAYOUT_START BufferPlayoutStart; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Active playout buffer on ec channel %d...\n", + ec->name, + channel); + Oct6100BufferPlayoutStartDef( &BufferPlayoutStart ); + BufferPlayoutStart.ulChannelHndl = ec->pEchoChannelHndl[channel]; + BufferPlayoutStart.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; + ulResult = Oct6100BufferPlayoutStart( + ec->pChipInstance, + &BufferPlayoutStart); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to active playout buffer on ec channel %d (err=%08X)\n", + ec->name, + channel, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_BufferPlayoutStop(wan_ec_t *ec, int channel, wanec_playout_t *playout, int verbose) +{ + tOCT6100_BUFFER_PLAYOUT_STOP BufferPlayoutStop; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Deactive playout buffer on ec channel %d...\n", + ec->name, + channel); + Oct6100BufferPlayoutStopDef( &BufferPlayoutStop ); + BufferPlayoutStop.ulChannelHndl = ec->pEchoChannelHndl[channel]; + BufferPlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; + ulResult = Oct6100BufferPlayoutStop( + ec->pChipInstance, + &BufferPlayoutStop); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to deactive playout buffer on ec channel %d (err=%08X)\n", + ec->name, + channel, + ulResult); + return -EINVAL; + } + return 0; +} + + +/****************************************************************************** +** CONFERENCE BRIDGE FUNCTIONS +******************************************************************************/ +int wanec_ConfBridgeOpen(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose) +{ + tOCT6100_CONF_BRIDGE_OPEN ConfBridgeOpen; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Opening Conference Bridge...\n", ec->name); + + if (ec->confbridges_no >= ec->f_OpenChip.ulMaxConfBridges){ + DEBUG_EVENT( + "ERROR: %s: Trying to open too many conference bridges (%d:%d)\n", + ec->name, + ec->confbridges_no, + ec->f_OpenChip.ulMaxConfBridges); + return -EINVAL; + } + + Oct6100ConfBridgeOpenDef( &ConfBridgeOpen ); + ConfBridgeOpen.pulConfBridgeHndl = &confbridge->ulHndl; + ConfBridgeOpen.fFlexibleConferencing = FALSE; + ulResult = Oct6100ConfBridgeOpen( + ec->pChipInstance, + &ConfBridgeOpen); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to open new conference bridge (err=%08X)\n", + ec->name, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeClose(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose) +{ + tOCT6100_CONF_BRIDGE_CLOSE ConfBridgeClose; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Closing Conference Bridge...\n", ec->name); + + Oct6100ConfBridgeCloseDef( &ConfBridgeClose ); + ConfBridgeClose.ulConfBridgeHndl = confbridge->ulHndl; + ulResult = Oct6100ConfBridgeClose( + ec->pChipInstance, + &ConfBridgeClose); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to close conference bridge (%X, err=%08X)\n", + ec->name, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeChanAdd(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose) +{ + tOCT6100_CONF_BRIDGE_CHAN_ADD ConfBridgeChanAdd; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Add channel %d to Conference Bridge %X...\n", + ec->name, channel, confbridge->ulHndl); + + Oct6100ConfBridgeChanAddDef( &ConfBridgeChanAdd ); + ConfBridgeChanAdd.ulConfBridgeHndl = confbridge->ulHndl; + ConfBridgeChanAdd.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ConfBridgeChanAdd( + ec->pChipInstance, + &ConfBridgeChanAdd); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to add channel %d to conference bridge (%X, err=%08X)\n", + ec->name, channel, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeChanRemove(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose) +{ + tOCT6100_CONF_BRIDGE_CHAN_REMOVE ConfBridgeChanRemove; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Remove channel %d from Conference Bridge %X...\n", + ec->name, channel, confbridge->ulHndl); + + Oct6100ConfBridgeChanRemoveDef( &ConfBridgeChanRemove ); + ConfBridgeChanRemove.ulConfBridgeHndl = confbridge->ulHndl; + ConfBridgeChanRemove.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ConfBridgeChanRemove( + ec->pChipInstance, + &ConfBridgeChanRemove); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to remove channel %d from conference bridge (%X, err=%08X)\n", + ec->name, channel, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeChanMute(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose) +{ + tOCT6100_CONF_BRIDGE_CHAN_MUTE ConfBridgeChanMute; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Mute channel %d on a conference bridge %X...\n", + ec->name, channel, confbridge->ulHndl); + + Oct6100ConfBridgeChanMuteDef( &ConfBridgeChanMute ); + ConfBridgeChanMute.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ConfBridgeChanMute( + ec->pChipInstance, + &ConfBridgeChanMute); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to mute channel %d on a conference bridge (%X, err=%08X)\n", + ec->name, channel, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeChanUnMute(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int verbose) +{ + tOCT6100_CONF_BRIDGE_CHAN_UNMUTE ConfBridgeChanUnMute; + UINT32 ulResult; + + PRINT1(verbose, + "%s: UnMute channel %d on a Conference Bridge %X...\n", + ec->name, channel, confbridge->ulHndl); + + Oct6100ConfBridgeChanUnMuteDef( &ConfBridgeChanUnMute ); + ConfBridgeChanUnMute.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ulResult = Oct6100ConfBridgeChanUnMute( + ec->pChipInstance, + &ConfBridgeChanUnMute); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to unmute channel %d from conference bridge (%X, err=%08X)\n", + ec->name, channel, + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeDominantSpeakerSet(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, int enable, int verbose) +{ + tOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET ConfBridgeDominantSpeaker; + UINT32 ulResult; + + PRINT1(verbose, + "%s: %s Dominant speaker (channel %d) to a Conference Bridge %X...\n", + ec->name, + (enable) ? "Enable":"Disable", + channel, + confbridge->ulHndl); + + Oct6100ConfBridgeDominantSpeakerSetDef( &ConfBridgeDominantSpeaker ); + ConfBridgeDominantSpeaker.ulConfBridgeHndl = confbridge->ulHndl; + if (enable){ + ConfBridgeDominantSpeaker.ulChannelHndl = ec->pEchoChannelHndl[channel]; + }else{ + ConfBridgeDominantSpeaker.ulChannelHndl = cOCT6100_CONF_NO_DOMINANT_SPEAKER_HNDL; + } + ulResult = Oct6100ConfBridgeDominantSpeakerSet( + ec->pChipInstance, + &ConfBridgeDominantSpeaker); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to %s dominant speaker to conference bridge (%X, err=%08X)\n", + ec->name, + (enable) ? "enable" : "disable", + confbridge->ulHndl, + ulResult); + return -EINVAL; + } + return 0; +} + + +int wanec_ConfBridgeMaskChange(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int channel, UINT32 mask, int verbose) +{ + tOCT6100_CONF_BRIDGE_MASK_CHANGE ConfBridgeMaskChange; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Changing the listener (channel=%d) mask of bridge participant (%d)...\n", + ec->name, + channel, confbridge->ulHndl); + + Oct6100ConfBridgeMaskChangeDef( &ConfBridgeMaskChange ); + ConfBridgeMaskChange.ulChannelHndl = ec->pEchoChannelHndl[channel]; + ConfBridgeMaskChange.ulNewListenerMask = mask; + ulResult = Oct6100ConfBridgeMaskChange( + ec->pChipInstance, + &ConfBridgeMaskChange); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to change the listener mask of bridge participant %d (err=%X)!\n", + ec->name, + channel, + ulResult); + return -EINVAL; + } + return 0; +} + +int wanec_ConfBridgeGetStats(wan_ec_t *ec, wan_ec_confbridge_t *confbridge, int verbose) +{ + tOCT6100_CONF_BRIDGE_STATS ConfBridgeStats; + UINT32 ulResult; + + PRINT1(verbose, + "%s: Getting bridge statistics %X...\n", + ec->name, confbridge->ulHndl); + + Oct6100ConfBridgeGetStatsDef( &ConfBridgeStats ); + ConfBridgeStats.ulConfBridgeHndl = confbridge->ulHndl; + ulResult = Oct6100ConfBridgeGetStats( + ec->pChipInstance, + &ConfBridgeStats); + if ( ulResult != cOCT6100_ERR_OK ){ + DEBUG_EVENT( + "ERROR: %s: Failed to get conference bridge statistics (err=%X)!\n", + ec->name, + ulResult); + return -EINVAL; + } + return 0; +} + +/*===========================================================================*\ + Oct6100Read +\*===========================================================================*/ + +static int +wan_ec_read(wan_ec_dev_t *ec_dev, u32 read_addr, u16 *read_data) +{ + u32 data; + wan_ec_read_internal_dword(ec_dev, read_addr, &data); + *read_data = (u16)(data & 0xFFFF); + return 0; +} + +/*===========================================================================*\ + Oct6100Write +\*===========================================================================*/ + +static int +wan_ec_write(wan_ec_dev_t *ec_dev, u32 write_addr, u32 write_data) +{ + return wan_ec_write_internal_dword(ec_dev, write_addr, write_data); +} + + +/*===========================================================================*\ + Oct6100WriteSequenceSub +\*===========================================================================*/ +static u32 +wan_ec_write_seq(wan_ec_dev_t *ec_dev, u32 write_addr, u16 write_data) +{ + u32 ulResult; + u32 ulData; + u16 usData; + u32 ulWordAddress; + u32 i; + + /* Create the word address from the provided byte address. */ + ulWordAddress = write_addr >> 1; + + /* 16-bit indirect access. */ + + /* First write to the address indirection registers. */ + ulData = ( ulWordAddress >> 19 ) & 0x1FFF; + ulResult = wan_ec_write( ec_dev, 0x8, ulData ); + if (ulResult) + return ulResult; + + ulData = ( ulWordAddress >> 3 ) & 0xFFFF; + ulResult = wan_ec_write( ec_dev, 0xA, ulData ); + if (ulResult) + return ulResult; + + /* Next, write data word to read/write data registers. */ + ulData = write_data & 0xFFFF; + ulResult = wan_ec_write( ec_dev, 0x4, ulData ); + if ( ulResult ) + return ulResult; + + + /* Write the parities and write enables, as well as last three bits + ** of wadd and request the write access. */ + ulData = ( ( 0x0 & 0x3 ) << 14 ) | ( ( 0x3 & 0x3 ) << 12 ) | ( ( ulWordAddress & 0x7 ) << 9 ) | 0x0100; + ulResult = wan_ec_write( ec_dev, 0x0, ulData ); + if ( ulResult ) + return ulResult; + + /* Keep polling register contol0 for the access_req bit to go low. */ + for ( i = 0; i < WANEC_READ_LIMIT; i++ ) + { + ulResult = wan_ec_read( ec_dev, 0, &usData ); + if ( ulResult ) + return ulResult; + + if ( ( ( usData >> 8 ) & 0x1 ) == 0x0 ) + break; + } + + if ( i == WANEC_READ_LIMIT ){ + DEBUG_EVENT("%s: EC write command reached limit!\n", + ec_dev->name); + return WAN_EC_RC_CPU_INTERFACE_NO_RESPONSE; + } + return 0; +} + + +/*===========================================================================*\ + HandleReqWriteOct6100 +\*===========================================================================*/ +u32 wanec_req_write(void *arg, u32 write_addr, u16 write_data) +{ + wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; + u32 ulResult; + + DEBUG_TEST("%s: EC WRITE API addr=%X data=%X\n", + ec_dev->ec->name, write_addr, write_data); + ulResult = wan_ec_write_seq(ec_dev, write_addr, write_data); + if (ulResult){ + DEBUG_EVENT("%s: Failed to write %04X to addr %08X\n", + ec_dev->name, + write_addr, + write_data); + } + return ulResult; +} + + +/*===========================================================================*\ + HandleReqWriteSmearOct6100 +\*===========================================================================*/ +u32 wanec_req_write_smear(void *arg, u32 addr, u16 data, u32 len) +{ + wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; + u32 i, ulResult = WAN_EC_RC_OK; + + WAN_ASSERT(ec_dev == NULL); + for ( i = 0; i < len; i++ ){ + ulResult = wan_ec_write_seq(ec_dev, addr + (i*2), data); + if (ulResult){ + DEBUG_EVENT("%s: Failed to write %04X to addr %08X\n", + ec_dev->name, + addr + (i*2), + data); + break; + } + } + return ulResult; +} + + +/*===========================================================================*\ + HandleReqWriteBurstOct6100 +\*===========================================================================*/ +u32 wanec_req_write_burst(void *arg, u32 addr, u16 *data, u32 len) +{ + wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; + u32 i, ulResult = WAN_EC_RC_OK; + + WAN_ASSERT(ec_dev == NULL); + + for ( i = 0; i < len; i++ ){ + ulResult = wan_ec_write_seq(ec_dev, addr + (i * 2), data[i]); + if (ulResult){ + DEBUG_EVENT("%s: Failed to write %04X to addr %08X\n", + ec_dev->name, + addr + (i*2), + data[i]); + break; + } + } + return ulResult; +} + + +/*===========================================================================*\ + Oct6100ReadSequenceSub +\*===========================================================================*/ +static u32 +wan_ec_read_seq(wan_ec_dev_t *ec_dev, u32 read_addr, u16 *read_data, u32 read_len) +{ + u32 ulResult; + u32 ulData; + u32 ulWordAddress; + u32 ulReadBurstLength; + u16 usData; + u32 i; + + /* Create the word address from the provided byte address. */ + ulWordAddress = read_addr >> 1; + + /* Indirect accesses. */ + + /* First write to the address indirection registers. */ + ulData = ( ulWordAddress >> 19 ) & 0x1FFF; + ulResult = wan_ec_write( ec_dev, 0x8, ulData ); + if (ulResult) + return ulResult; + + ulData = ( ulWordAddress >> 3 ) & 0xFFFF; + ulResult = wan_ec_write( ec_dev, 0xA, ulData ); + if (ulResult) + return ulResult; + + /* Request access. */ + if ( read_len >= 128 ) + { + ulData = 0x100 | ( ( ulWordAddress & 0x7 ) << 9); + ulReadBurstLength = 0; + } + else + { + ulData = 0x100 | ( ( ulWordAddress & 0x7 ) << 9) | read_len; + ulReadBurstLength = read_len; + } + ulResult = wan_ec_write( ec_dev, 0x0, ulData ); + if (ulResult) + return ulResult; + + /* Keep polling register contol0 for the access_req bit to go low. */ + for ( i = 0; i < WANEC_READ_LIMIT; i++ ) + { + ulResult = wan_ec_read( ec_dev, 0x0, &usData ); + if (ulResult) + return ulResult; + + if ( ( ( usData >> 8 ) & 0x1 ) == 0x0 ) + break; + } + if ( i == WANEC_READ_LIMIT ){ + DEBUG_EVENT("%s: EC read command reached limit!\n", + ec_dev->name); + return WAN_EC_RC_CPU_INTERFACE_NO_RESPONSE; + } + + if ( ( usData & 0xFF ) == 0x1 ) + { + i = 0; + } + + /* Retrieve read data. */ + ulResult = wan_ec_read( ec_dev, 0x4, &usData ); + if (ulResult) + return ulResult; + + if ( ( usData & 0xFF ) == 0x1 ) + { + i = 0; + } + + *read_data = usData; + return 0; +} + +u32 wanec_req_read(void *arg, u32 addr, u16 *data) +{ + wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; + u32 ulResult; + + WAN_ASSERT(ec_dev == NULL); + DEBUG_TEST("%s: EC READ API addr=%X data=????\n", + ec_dev->ec->name, addr); + ulResult = wan_ec_read_seq( + ec_dev, + addr, + data, + 1); + if (ulResult){ + DEBUG_EVENT("%s: Failed to read data from addr %08X\n", + ec_dev->name, + addr); + if (ec_dev->ec){ + wan_set_bit(WAN_EC_BIT_CRIT_ERROR, &ec_dev->ec->critical); + } + } + DEBUG_TEST("%s: EC READ API addr=%X data=%X\n", + ec_dev->ec->name, + addr, *data); + return ulResult; +} + +u32 wanec_req_read_burst(void *arg, u32 addr, u16 *data, u32 len) +{ + wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; + u32 i, ulResult = WAN_EC_RC_OK; + u16 read_data; + + for ( i = 0; i < len; i++ ){ + ulResult = wan_ec_read_seq(ec_dev, addr, &read_data, 1); + if (ulResult){ + DEBUG_EVENT("%s: Failed to read from addr %X\n", + ec_dev->name, + addr); + if (ec_dev->ec){ + wan_set_bit(WAN_EC_BIT_CRIT_ERROR, &ec_dev->ec->critical); + } + break; + } + data[i] = (u16)read_data; + addr += 2; + } + return ulResult; +} diff --git a/patches/kdrivers/wanec/wanec_dev.c b/patches/kdrivers/wanec/wanec_dev.c index a6e5216..41fde57 100644 --- a/patches/kdrivers/wanec/wanec_dev.c +++ b/patches/kdrivers/wanec/wanec_dev.c @@ -35,6 +35,7 @@ #include "oct6100_version.h" #include "wanec_iface.h" +#include "wanec_iface_api.h" #if !defined(__WINDOWS__) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) diff --git a/patches/kdrivers/wanec/wanec_iface.c b/patches/kdrivers/wanec/wanec_iface.c index 00c0830..f27695f 100644 --- a/patches/kdrivers/wanec/wanec_iface.c +++ b/patches/kdrivers/wanec/wanec_iface.c @@ -1,12 +1,17 @@ -/************************************************************* +/******************************************************************** * wanec_iface.c WANPIPE Echo Canceller Layer (WANEC) * * * - * =========================================================== + * ================================================================== * - * May 10 2006 Alex Feldman Initial Versionr - */ + * May 10 2006 Alex Feldman + * Initial Version + * + * January 9 2008 David Rokhvarg + * Added support for Sangoma MS Windows Driver + * + ********************************************************************/ /*============================================================= * Includes @@ -33,12 +38,10 @@ # include # include # include - -# define DEBUG_HWEC_V1 DbgPrint -//#define DEBUG_HWEC_V1 +/*# define DEBUG*/ #endif -#include "wanec_iface.h" +#include "wanec_iface_api.h" /*============================================================= * Definitions @@ -48,16 +51,16 @@ #define WAN_OCT6100_READ_LIMIT 0x10000 #if 0 -# define DEBUG +# define WANEC_DEBUG #endif /*============================================================= * Global Parameters */ -#if defined(DEBUG) -static int global_verbose = WAN_EC_VERBOSE_EXTRA1; +#if defined(WANEC_DEBUG) +static int wanec_verbose = WAN_EC_VERBOSE_EXTRA2; #else -static int global_verbose = WAN_EC_VERBOSE_NONE; +static int wanec_verbose = WAN_EC_VERBOSE_NONE; #endif WAN_LIST_HEAD(wan_ec_head_, wan_ec_) wan_ec_head = @@ -68,15 +71,12 @@ wanec_iface_t wanec_iface = 0, NULL, NULL, - NULL, NULL, NULL, NULL }; -static int wan_ec_no = 0; - static unsigned char wpec_fullname[]="WANPIPE(tm) WANEC Layer"; static unsigned char wpec_copyright[]="(c) 1995-2006 Sangoma Technologies Inc."; /*============================================================= @@ -98,44 +98,56 @@ void unregister_wanec_iface (void); extern int wanec_fe2ec_channel(wan_ec_dev_t*, int); -extern int wanec_ChipOpenPrep(wan_ec_dev_t*, wan_ec_api_t*); +extern int wanec_ChipOpenPrep(wan_ec_dev_t *ec_dev, char *devname, wanec_config_t *config, int); extern int wanec_ChipOpen(wan_ec_dev_t*, int verbose); -extern int wanec_ChipOpen_OLD(wan_ec_dev_t*, wan_ec_api_t*); extern int wanec_ChipClose(wan_ec_dev_t*, int verbose); -extern int wanec_ChipStats(wan_ec_dev_t*, wan_ec_api_t*, int); +extern int wanec_ChipStats(wan_ec_dev_t *ec_dev, wanec_chip_stats_t *chip_stats, int reset, int verbose); -extern int wanec_ChannelOpen(wan_ec_dev_t*, wan_ec_api_t *ec_api); -extern int wanec_ChannelClose(wan_ec_dev_t*, wan_ec_api_t *ec_api, int); -extern int wanec_ChannelModify(wan_ec_dev_t*, INT, UINT32, wan_ec_api_t*, int verbose); -extern int wanec_ChannelStats(wan_ec_dev_t*, INT channel, wan_ec_api_t *ec_api, int reset); +extern int wanec_ChannelOpen(wan_ec_dev_t*, int); +extern int wanec_ChannelClose(wan_ec_dev_t*, int); +extern int wanec_ChannelModifyOpmode(wan_ec_dev_t*, INT, UINT32, int verbose); +extern int wanec_ChannelModifyCustom(wan_ec_dev_t*, INT, wanec_chan_custom_t*, int verbose); +extern int wanec_ChannelStats(wan_ec_dev_t*, INT ec_chan, wanec_chan_stats_t *chan_stats, int reset); -extern int wanec_TonesEnable(wan_ec_t *ec, int channel, unsigned char, int verbose); -extern int wanec_TonesDisable(wan_ec_t *ec, int channel, unsigned char, int verbose); +extern int wanec_ChannelMute(wan_ec_dev_t*, INT ec_chan, wanec_chan_mute_t*, int); +extern int wanec_ChannelUnMute(wan_ec_dev_t*, INT ec_chan, wanec_chan_mute_t*, int); -extern int wanec_DebugChannel(wan_ec_t *ec, INT channel, int verbose); -extern int wanec_DebugGetData(wan_ec_t *ec, wan_ec_api_t *ec_api); +extern int wanec_TonesEnable(wan_ec_t *ec, int ec_chan, wanec_dtmf_config_t*, int verbose); +extern int wanec_TonesDisable(wan_ec_t *ec, int ec_chan, wanec_dtmf_config_t*, int verbose); -extern int wanec_BufferLoad(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); -extern int wanec_BufferUnload(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); -extern int wanec_BufferPlayoutAdd(wan_ec_t *ec, int channel, wan_ec_api_t *ec_api); -extern int wanec_BufferPlayoutStart(wan_ec_t *ec, int channel, wan_ec_api_t *ec_api); -extern int wanec_BufferPlayoutStop(wan_ec_t *ec, int channel, wan_ec_api_t *ec_api); +extern int wanec_DebugChannel(wan_ec_dev_t*, INT, int); +extern int wanec_DebugGetData(wan_ec_dev_t*, wanec_chan_monitor_t*, int); + +extern int wanec_BufferLoad(wan_ec_dev_t *ec_dev, wanec_buffer_config_t *buffer_config, int verbose); +extern int wanec_BufferUnload(wan_ec_dev_t *ec_dev, wanec_buffer_config_t *buffer_config, int verbose); +extern int wanec_BufferPlayoutAdd(wan_ec_t *ec, int ec_chan, wanec_playout_t *playout, int verbose); +extern int wanec_BufferPlayoutStart(wan_ec_t *ec, int ec_chan, wanec_playout_t *playout, int verbose); +extern int wanec_BufferPlayoutStop(wan_ec_t *ec, int ec_chan, wanec_playout_t *playout, int verbose); extern int wanec_EventTone(wan_ec_t *ec, int verbose); extern int wanec_ISR(wan_ec_t *ec, int verbose); -static int wanec_config(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); -static int wanec_release(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api, int verbose); -static int wanec_channel_open(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); -static int wanec_modify_channel(wan_ec_dev_t *ec_dev, int fe_chan, u32 cmd, int verbose); -static int wanec_modify(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); -static int wanec_modify_mode(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); -static int wanec_modify_bypass(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); -static int wanec_bypass(wan_ec_dev_t *ec_dev, int fe_channel, int enable, int verbose); +static int wanec_channel_opmode_modify(wan_ec_dev_t *ec_dev, int fe_chan, UINT32 opmode, int verbose); +static int wanec_channel_dtmf(wan_ec_dev_t*, int, int, wanec_dtmf_config_t*, int); + +static int wanec_bypass(wan_ec_dev_t *ec_dev, int fe_chan, int enable, int verbose); + +static int wanec_api_config(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); +static int wanec_api_release(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api, int verbose); +static int wanec_api_channel_open(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); +static int wanec_api_modify(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); +static int wanec_api_chan_opmode(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); +static int wanec_api_chan_custom(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); +static int wanec_api_modify_bypass(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); +static int wanec_api_dtmf(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); +static int wanec_api_stats(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); +static int wanec_api_buffer(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); +static int wanec_api_playout(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); +static int wanec_api_monitor(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api); static wan_ec_dev_t *wanec_search(char *devname); -static int wanec_enable(void *pcard, int enable, int channel); +static int wanec_enable(void *pcard, int enable, int fe_chan); static int wanec_poll(void *arg, void *pcard); #if defined(__FreeBSD__) || defined(__OpenBSD__) @@ -149,7 +161,10 @@ int wan_ec_read_internal_dword(wan_ec_dev_t *ec_dev, u32 addr1, u32 *data); int wanec_init(void*); int wanec_exit(void*); - +#if defined(__FreeBSD__) +int wanec_shutdown(void*); +int wanec_ready_unload(void*); +#endif /*****************************************************************************/ @@ -245,16 +260,16 @@ static int wanec_reset(wan_ec_dev_t *ec_dev, int reset) err = card->wandev.hwec_reset(card, reset); if (!err){ if (reset){ - ec->state = WAN_OCT6100_STATE_RESET; + ec->state = WAN_EC_STATE_RESET; }else{ - ec->state = WAN_OCT6100_STATE_READY; + ec->state = WAN_EC_STATE_READY; } } } return err; } -static int wanec_enable(void *pcard, int enable, int fe_channel) +static int wanec_enable(void *pcard, int enable, int fe_chan) { sdla_t *card = (sdla_t*)pcard; wan_ec_dev_t *ec_dev = NULL; @@ -271,24 +286,25 @@ static int wanec_enable(void *pcard, int enable, int fe_channel) #if defined(WANEC_BYDEFAULT_NORMAL) WAN_ASSERT(ec_dev->ec == NULL); wan_spin_lock(&ec_dev->ec->lock); - err=wanec_bypass(ec_dev, fe_channel, enable, 0); + err = wanec_bypass(ec_dev, fe_chan, enable, 0); wan_spin_unlock(&ec_dev->ec->lock); return err; #else - return wanec_modify_channel( + return wanec_channel_opmode_modify( ec_dev, - fe_channel, - (enable) ? WAN_EC_CMD_ENABLE : WAN_EC_CMD_DISABLE, + fe_chan, + (enable) ? cOCT6100_ECHO_OP_MODE_NORMAL : cOCT6100_ECHO_OP_MODE_POWER_DOWN, 0); #endif } -static int wanec_bypass(wan_ec_dev_t *ec_dev, int fe_channel, int enable, int verbose) +static int +wanec_bypass(wan_ec_dev_t *ec_dev, int fe_chan, int enable, int verbose) { wan_ec_t *ec = NULL; sdla_t *card = NULL; - int err = -ENODEV; + int ec_chan = 0, err = -ENODEV; WAN_ASSERT(ec_dev == NULL); WAN_ASSERT(ec_dev->ec == NULL); @@ -297,52 +313,56 @@ static int wanec_bypass(wan_ec_dev_t *ec_dev, int fe_channel, int enable, int ve card = ec_dev->card; PRINT1(verbose, - "%s: %s bypass mode for channel %d (%lX)!\n", + "%s: %s bypass mode for fe_chan:%d (ec map:%lX, fe map:%X)!\n", card->devname, (enable) ? "Enable" : "Disable", - fe_channel, - card->wandev.ec_map); + fe_chan, + card->wandev.fe_ec_map, ec_dev->fe_channel_map); if (card->wandev.hwec_enable == NULL){ - DEBUG_EVENT("%s: Undefined HW EC callback function!\n", + DEBUG_EVENT( "%s: Undefined HW EC Bypass callback function!\n", ec->name); return -ENODEV; } + if (!wan_test_bit(fe_chan, &ec_dev->fe_channel_map)){ + PRINT1(verbose, "%s: FE channel %d is not available (fe_chan_map=%X)!\n", + ec->name, fe_chan, ec_dev->fe_channel_map); + return 0; + } + ec_chan = wanec_fe2ec_channel(ec_dev, fe_chan); if (enable){ - if (!wan_test_bit(fe_channel, &card->wandev.ec_map)){ - if (ec->ec_active >= ec->max_channels){ - DEBUG_EVENT( - "%s: Exceeded maximum number of Echo Canceller channels (max=%d)!\n", - ec->name, - ec->max_channels); - return -ENODEV; - } - }else{ + if (wan_test_bit(fe_chan, &card->wandev.fe_ec_map)){ /* Already enabled */ + PRINT2(verbose, + "%s: Enable bypass mode overrun detected for ec_chan %d!\n", + card->devname, ec_chan); return 0; } }else{ - if (!wan_test_bit(fe_channel, &card->wandev.ec_map)){ + if (!wan_test_bit(fe_chan, &card->wandev.fe_ec_map)){ /* Already disabled */ + PRINT2(verbose, + "%s: Disble bypass mode overrun detected for ec_channel %d!\n", + card->devname, ec_chan); return 0; } - } - err = card->wandev.hwec_enable(card, enable, fe_channel); + err = card->wandev.hwec_enable(card, enable, fe_chan); if (!err){ if (enable){ - ec->ec_active++; + wan_set_bit(fe_chan, &card->wandev.fe_ec_map); }else{ - if (ec->ec_active) ec->ec_active--; + wan_clear_bit(fe_chan, &card->wandev.fe_ec_map); } + }else if (err < 0){ + DEBUG_EVENT("ERROR: %s: Failed to %s Bypass mode on fe_chan:%d!\n", + ec->name, + (enable) ? "Enable" : "Disable", + fe_chan); + return err; }else{ - if (err < 0){ - PRINT1(verbose, - "%s: HWEC option is not enable for the channel %d (%lX)!\n", - ec->name, fe_channel, card->wandev.ec_enable_map); - return err; - } - return 0; + /* no action made */ + err = 0; } return err; } @@ -394,27 +414,6 @@ static void wanec_enable_timer(wan_ec_dev_t* ec_dev, u_int8_t cmd, u_int32_t del WAN_ASSERT1(ec_dev->card == NULL); card = (sdla_t*)ec_dev->card; -#if defined (__WINDOWS__) - if(KeGetCurrentIrql() > DISPATCH_LEVEL){ - /* May get here on AFT card because front end interrupt - is handled inside ISR not in DPC as on S514. - The KeSetTimer() function is illegal inside ISR, - so queue 'front_end_dpc_obj' DPC and this routine - will be called again from xilinx_front_end_dpc(). - */ - card->xilinx_fe_dpc.te_timer_delay = delay; - ec_dev->poll_cmd = (u_int8_t)cmd; - - if(KeInsertQueueDpc(&card->front_end_dpc_obj, NULL, - (PVOID)ENABLE_HWEC_TIMER) == FALSE){ - - DEBUG_HWEC("Failed to queue 'front_end_dpc_obj'!\n"); - }else{ - DEBUG_HWEC("Successfully queued 'front_end_dpc_obj'.\n"); - } - return; - }/* if() */ -#endif if (wan_test_bit(WAN_EC_BIT_TIMER_KILL,(void*)&ec_dev->critical)){ wan_clear_bit(WAN_EC_BIT_TIMER_RUNNING, (void*)&ec_dev->critical); return; @@ -453,7 +452,157 @@ wan_ec_dev_t *wanec_search(char *devname) return NULL; } -static int wanec_config(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) + +static int wanec_channel_opmode_modify(wan_ec_dev_t *ec_dev, int fe_chan, UINT32 opmode, int verbose) +{ + wan_ec_t *ec = NULL; + u_int32_t ec_chan = 0; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + WAN_ASSERT(ec_dev->card == NULL); + ec = ec_dev->ec; + + if (ec->state != WAN_EC_STATE_CHIP_READY){ + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Canceller %s API state (%s)\n", + ec_dev->devname, + ec->name, + WAN_EC_STATE_DECODE(ec->state)); + return -EINVAL; + } + + switch(opmode){ + case cOCT6100_ECHO_OP_MODE_NORMAL: + case cOCT6100_ECHO_OP_MODE_HT_FREEZE: + case cOCT6100_ECHO_OP_MODE_HT_RESET: + case cOCT6100_ECHO_OP_MODE_NO_ECHO: + case cOCT6100_ECHO_OP_MODE_POWER_DOWN: + case cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION: + break; + default: + DEBUG_EVENT( + "%s: Invalid Echo Channel Operation Mode (opmode=%X)\n", + ec_dev->devname, opmode); + return -EINVAL; + } + + /* Enable Echo cancelation on Oct6100 */ + PRINT1(verbose, + "%s: Modify Echo Channel OpMode %s on fe_chan:%d ...\n", + ec_dev->devname, + (opmode == cOCT6100_ECHO_OP_MODE_NORMAL) ? "Normal" : + (opmode == cOCT6100_ECHO_OP_MODE_POWER_DOWN) ? "Power Down" : + (opmode == cOCT6100_ECHO_OP_MODE_HT_FREEZE) ? "HT Freeze" : + (opmode == cOCT6100_ECHO_OP_MODE_HT_RESET) ? "HT Reset" : + (opmode == cOCT6100_ECHO_OP_MODE_NO_ECHO) ? "NO Echo" : + (opmode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION) ? "Speech Recognition" : "Unknown", + fe_chan); + ec_chan = wanec_fe2ec_channel(ec_dev, fe_chan); + return wanec_ChannelModifyOpmode(ec_dev, ec_chan, opmode, verbose); +} + +static int wanec_channel_dtmf( wan_ec_dev_t *ec_dev, + int fe_chan, + int cmd, + wanec_dtmf_config_t *dtmf, + int verbose) +{ + wan_ec_t *ec = NULL; + int ec_chan, err; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + if (ec->state != WAN_EC_STATE_CHIP_READY){ + DEBUG_EVENT( + "WARNING: %s: Invalid Echo Canceller %s API state (%s)\n", + ec_dev->devname, + ec->name, + WAN_EC_STATE_DECODE(ec->state)); + return -EINVAL; + } + + if (dtmf){ + if ((dtmf->port_map & (WAN_EC_CHANNEL_PORT_SOUT|WAN_EC_CHANNEL_PORT_ROUT)) != dtmf->port_map){ + + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Canceller port value (%X)!\n", + ec_dev->devname, + dtmf->port_map); + return -EINVAL; + } + } + /* Enable/Disable Normal mode on Oct6100 */ + PRINT1(verbose, "%s: %s EC DTMF detection on fe_chan:%d ...\n", + ec_dev->devname, (cmd==WAN_TRUE) ? "Enable" : "Disable", + fe_chan); + ec_chan = wanec_fe2ec_channel(ec_dev, fe_chan); + if (cmd == WAN_TRUE){ + err = wanec_TonesEnable(ec, ec_chan, dtmf, verbose); + }else{ + err = wanec_TonesDisable(ec, ec_chan, dtmf, verbose); + } + if (err == WAN_EC_API_RC_OK){ + if (cmd == WAN_TRUE){ + wan_set_bit(WAN_EC_BIT_EVENT_DTMF, &ec_dev->events); + ec->tone_verbose = verbose; + }else{ + /* FIXME: Once the DTMF event was enabled, do not + ** disable it otherwise dtmf events for other + ** channels will be delayed + ** wan_clear_bit(WAN_EC_BIT_EVENT_DTMF, &ec_dev->events); + ** ec->tone_verbose = 0; */ + } + } + return err; +} + + +static int wanec_channel_mute( wan_ec_dev_t *ec_dev, + int fe_chan, + int cmd, + wanec_chan_mute_t *mute, + int verbose) +{ + wan_ec_t *ec = NULL; + int ec_chan, err; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + if (ec->state != WAN_EC_STATE_CHIP_READY){ + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Canceller %s API state (%s)\n", + ec_dev->devname, + ec->name, + WAN_EC_STATE_DECODE(ec->state)); + return -EINVAL; + } + + /* Enable/Disable Normal mode on Oct6100 */ + PRINT1(verbose, + "%s: %s EC channel on fe_chan:%d ...\n", + ec_dev->devname, + (cmd == WAN_TRUE) ? "Mute" : "Un-mute", + fe_chan); + + ec_chan = wanec_fe2ec_channel(ec_dev, fe_chan); + if (cmd == WAN_TRUE){ + err = wanec_ChannelMute(ec_dev, ec_chan, mute, verbose); + }else{ + err = wanec_ChannelUnMute(ec_dev, ec_chan, mute, verbose); + } + return err; +} + + +/****************************************************************************** +** WANPIPE EC API INTERFACE FUNCTION +******************************************************************************/ + +static int wanec_api_config(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) { wan_ec_t *ec = NULL; int err; @@ -462,126 +611,170 @@ static int wanec_config(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; switch(ec->state){ - case WAN_OCT6100_STATE_RESET: - case WAN_OCT6100_STATE_READY: + case WAN_EC_STATE_RESET: + case WAN_EC_STATE_READY: break; - case WAN_OCT6100_STATE_CHIP_OPEN: - case WAN_OCT6100_STATE_CHIP_OPEN_PENDING: - case WAN_OCT6100_STATE_CHIP_READY: + case WAN_EC_STATE_CHIP_OPEN: + case WAN_EC_STATE_CHIP_OPEN_PENDING: + case WAN_EC_STATE_CHIP_READY: DEBUG_HWEC( "%s: Echo Canceller %s chip is %s!\n", ec_api->devname, ec->name, - WAN_OCT6100_STATE_DECODE(ec->state)); + WAN_EC_STATE_DECODE(ec->state)); break; default: DEBUG_EVENT( "ERROR: %s: Invalid Echo Canceller %s API state (%s)\n", ec_api->devname, ec->name, - WAN_OCT6100_STATE_DECODE(ec->state)); + WAN_EC_STATE_DECODE(ec->state)); ec_api->err = WAN_EC_API_RC_INVALID_STATE; return 0; } - if (ec->state == WAN_OCT6100_STATE_RESET){ + if (ec->state == WAN_EC_STATE_RESET){ err = wanec_reset(ec_dev, 0); if (err) return err; } - if (ec->state == WAN_OCT6100_STATE_READY){ + if (ec->state == WAN_EC_STATE_READY){ - if (wanec_ChipOpenPrep(ec_dev, ec_api)){ + ec->pImageData = wan_vmalloc(ec_api->u_config.imageSize * sizeof(UINT8)); + if (ec->pImageData == NULL){ + DEBUG_EVENT( + "ERROR: Failed to allocate memory for EC image %ld bytes [%s:%d]!\n", + (unsigned long)ec_api->u_config.imageSize*sizeof(UINT8), + __FUNCTION__,__LINE__); + err = wanec_reset(ec_dev, 0); + return -EINVAL; + } + err = WAN_COPY_FROM_USER( + ec->pImageData, + ec_api->u_config.imageData, + ec_api->u_config.imageSize * sizeof(UINT8)); + if (err){ + DEBUG_EVENT( + "ERROR: Failed to copy EC image from user space [%s:%d]!\n", + __FUNCTION__,__LINE__); + wan_vfree(ec->pImageData); + err = wanec_reset(ec_dev, 0); + return -EINVAL; + } + ec->ImageSize = ec_api->u_config.imageSize; + + /* Copyin custom configuration (if exists) */ + if (ec_api->custom_conf.param_no){ + ec_api->u_config.custom_conf.params = + wan_malloc(ec_api->custom_conf.param_no * sizeof(wan_custom_param_t)); + if (ec_api->u_config.custom_conf.params){ + int err = 0; + err = WAN_COPY_FROM_USER( + ec_api->u_config.custom_conf.params, + ec_api->custom_conf.params, + ec_api->custom_conf.param_no * sizeof(wan_custom_param_t)); + ec_api->u_config.custom_conf.param_no = ec_api->custom_conf.param_no; + } + } + + if (wanec_ChipOpenPrep(ec_dev, ec_api->devname, &ec_api->u_config, ec_api->verbose)){ + wan_vfree(ec->pImageData); + if (ec_api->u_config.custom_conf.params){ + wan_free(ec_api->u_config.custom_conf.params); + } wanec_reset(ec_dev, 1); return -EINVAL; } + if (ec_api->u_config.custom_conf.params){ + wan_free(ec_api->u_config.custom_conf.params); + } ec->imageLast = ec_api->u_config.imageLast; - ec->state = WAN_OCT6100_STATE_CHIP_OPEN_PENDING; + ec->state = WAN_EC_STATE_CHIP_OPEN_PENDING; wanec_enable_timer(ec_dev, WAN_EC_POLL_CHIPOPENPENDING, 10); } ec_dev->state = ec->state; return 0; } -static int wanec_channel_open(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) +static int wanec_api_channel_open(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) { - wan_ec_t *ec = NULL; - unsigned int ec_chan, fe_chan; + wan_ec_t *ec = NULL; + int ec_chan, fe_chan; WAN_ASSERT(ec_dev == NULL); WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; switch(ec->state){ - case WAN_OCT6100_STATE_CHIP_OPEN: + case WAN_EC_STATE_CHIP_OPEN: break; - case WAN_OCT6100_STATE_CHIP_READY: - DEBUG_HWEC( + case WAN_EC_STATE_CHIP_READY: + PRINT1(ec_api->verbose, "%s: Echo Canceller %s chip is %s!\n", ec_api->devname, ec->name, - WAN_OCT6100_STATE_DECODE(ec->state)); + WAN_EC_STATE_DECODE(ec->state)); break; default: - PRINT1(ec_api->verbose, + DEBUG_EVENT( "ERROR: %s: Invalid Echo Canceller %s API state (%s)\n", ec_api->devname, ec->name, - WAN_OCT6100_STATE_DECODE(ec->state)); + WAN_EC_STATE_DECODE(ec->state)); ec_api->err = WAN_EC_API_RC_INVALID_STATE; return 0; } - if (ec->state == WAN_OCT6100_STATE_CHIP_OPEN){ + if (ec->state == WAN_EC_STATE_CHIP_OPEN){ /* Open all channels */ - if (wanec_ChannelOpen(ec_dev, ec_api)){ + if (wanec_ChannelOpen(ec_dev, ec_api->verbose)){ wanec_ChipClose(ec_dev, ec_api->verbose); wanec_reset(ec_dev, 1); return -EINVAL; } - ec->state = WAN_OCT6100_STATE_CHIP_READY; + ec->state = WAN_EC_STATE_CHIP_READY; } ec_dev->state = ec->state; /* EC_DEV_MAP */ - for(fe_chan=0; fe_chan < ec_dev->fe_max_channels; fe_chan++){ + for(fe_chan = ec_dev->fe_start_chan; fe_chan <= ec_dev->fe_stop_chan; fe_chan++){ ec_chan = wanec_fe2ec_channel(ec_dev, fe_chan); ec->pEcDevMap[ec_chan] = ec_dev; } return 0; } -int wanec_release(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api, int verbose) +int wanec_api_release(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api, int verbose) { wan_ec_t *ec = NULL; wan_ec_dev_t *ec_dev_tmp = NULL; - unsigned int fe_chan, ec_chan, err = 0; + int fe_chan, ec_chan, err = 0; WAN_ASSERT(ec_dev == NULL); WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; switch(ec->state){ - case WAN_OCT6100_STATE_READY: - case WAN_OCT6100_STATE_CHIP_OPEN: - case WAN_OCT6100_STATE_CHIP_OPEN_PENDING: - case WAN_OCT6100_STATE_CHIP_READY: + case WAN_EC_STATE_READY: + case WAN_EC_STATE_CHIP_OPEN: + case WAN_EC_STATE_CHIP_OPEN_PENDING: + case WAN_EC_STATE_CHIP_READY: break; - case WAN_OCT6100_STATE_RESET: + case WAN_EC_STATE_RESET: return 0; default: PRINT1(verbose, "%s: WARNING: Echo Canceller %s API state (%s)\n", ec_dev->devname, ec->name, - WAN_OCT6100_STATE_DECODE(ec->state)); + WAN_EC_STATE_DECODE(ec->state)); return 0; } #if defined(__WINDOWS__) //for TDMV API there is only only one device created. //So 'release' request should simply go ahead. - FUNC_DEBUG(); + EC_FUNC_DEBUG(); #else WAN_LIST_FOREACH(ec_dev_tmp, &ec->ec_dev_head, next){ if (ec_dev_tmp != ec_dev){ - if (ec_dev_tmp->state == WAN_OCT6100_STATE_CHIP_READY){ + if (ec_dev_tmp->state == WAN_EC_STATE_CHIP_READY){ /* This EC device is still connected */ ec->f_Context.ec_dev = ec_dev_tmp; strlcpy(ec->f_Context.devname, ec_dev_tmp->devname, WAN_DRVNAME_SZ); @@ -592,13 +785,13 @@ int wanec_release(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api, int verbose) #endif - for(fe_chan = 0; fe_chan < ec_dev->fe_max_channels; fe_chan++){ + for(fe_chan = ec_dev->fe_start_chan; fe_chan <= ec_dev->fe_stop_chan; fe_chan++){ ec_chan = wanec_fe2ec_channel(ec_dev, fe_chan); if (ec->pEcDevMap){ ec->pEcDevMap[ec_chan] = NULL; } } - ec_dev->state = WAN_OCT6100_STATE_RESET; + ec_dev->state = WAN_EC_STATE_RESET; if (ec_dev_tmp){ /* EC device is still in used */ return 0; @@ -606,23 +799,23 @@ int wanec_release(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api, int verbose) /* EC device is not in used anymore. ** Close all channels and chip */ - if (ec->state == WAN_OCT6100_STATE_CHIP_READY){ - if (wanec_ChannelClose(ec_dev, ec_api, verbose)){ + if (ec->state == WAN_EC_STATE_CHIP_READY){ + if (wanec_ChannelClose(ec_dev, verbose)){ return EINVAL; } - ec->state = WAN_OCT6100_STATE_CHIP_OPEN; + ec->state = WAN_EC_STATE_CHIP_OPEN; } - if (ec->state == WAN_OCT6100_STATE_CHIP_OPEN){ + if (ec->state == WAN_EC_STATE_CHIP_OPEN){ if (wanec_ChipClose(ec_dev, verbose)){ return EINVAL; } - ec->state = WAN_OCT6100_STATE_READY; + ec->state = WAN_EC_STATE_READY; } - if (ec->state == WAN_OCT6100_STATE_CHIP_OPEN_PENDING){ - ec->state = WAN_OCT6100_STATE_READY; + if (ec->state == WAN_EC_STATE_CHIP_OPEN_PENDING){ + ec->state = WAN_EC_STATE_READY; } - if (ec->state == WAN_OCT6100_STATE_READY){ + if (ec->state == WAN_EC_STATE_READY){ err = wanec_reset(ec_dev, 1); if (err){ return EINVAL; @@ -631,77 +824,12 @@ int wanec_release(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api, int verbose) return 0; } -static int wanec_modify_channel(wan_ec_dev_t *ec_dev, int fe_chan, u32 cmd, int verbose) + +static int wanec_api_modify(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) { wan_ec_t *ec = NULL; - sdla_t *card = NULL; - u_int32_t ec_chan = 0; - int err; - - WAN_ASSERT(ec_dev == NULL); - WAN_ASSERT(ec_dev->ec == NULL); - WAN_ASSERT(ec_dev->card == NULL); - ec = ec_dev->ec; - card = ec_dev->card; - - if (ec->state != WAN_OCT6100_STATE_CHIP_READY){ - PRINT1(verbose, - "WARNING: %s: Invalid Echo Canceller %s API state (%s)\n", - ec_dev->devname, - ec->name, - WAN_OCT6100_STATE_DECODE(ec->state)); - return WAN_EC_API_RC_INVALID_STATE; - } - - /* Enable Echo cancelation on Oct6100 */ - PRINT1(verbose, - "%s: %s Echo Canceller on channel %d ...\n", - ec_dev->devname, - (cmd == WAN_EC_CMD_ENABLE) ? "Enable" : "Disable", - fe_chan); - ec_chan = wanec_fe2ec_channel(ec_dev, fe_chan); - if (cmd == WAN_EC_CMD_ENABLE){ - err = wanec_ChannelModify( - ec_dev, - ec_chan, - cOCT6100_ECHO_OP_MODE_NORMAL, - NULL, - verbose); - if (err){ - return WAN_EC_API_RC_FAILED; - } - - /* Change rx/tx traffic through Oct6100 */ - if (wanec_bypass(ec_dev, fe_chan, 1, verbose)){ - return WAN_EC_API_RC_FAILED; - } - }else{ - /* Change rx/tx traffic through Oct6100 */ - if (wanec_bypass(ec_dev, fe_chan, 0, verbose)){ - return WAN_EC_API_RC_FAILED; - } - - err = wanec_ChannelModify( - ec_dev, - ec_chan, - cOCT6100_ECHO_OP_MODE_POWER_DOWN, - NULL, - verbose); - if (err){ - return WAN_EC_API_RC_FAILED; - } - } - - return 0; -} - - -static int wanec_modify(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) -{ - wan_ec_t *ec = NULL; - sdla_t *card = NULL; u_int32_t cmd = ec_api->cmd; - u_int32_t fe_chan = 0; + int fe_chan = 0; #if 0 u_int32_t ec_chan = 0; #endif @@ -709,153 +837,88 @@ static int wanec_modify(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) WAN_ASSERT(ec_dev == NULL); WAN_ASSERT(ec_dev->ec == NULL); - WAN_ASSERT(ec_dev->card == NULL); ec = ec_dev->ec; - card = ec_dev->card; - if (ec->state != WAN_OCT6100_STATE_CHIP_READY){ - PRINT1(ec_api->verbose, - "WARNING: %s: Invalid Echo Canceller %s API state (%s)\n", + if (ec->state != WAN_EC_STATE_CHIP_READY){ + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Canceller %s API state (%s)\n", ec_dev->devname, ec->name, - WAN_OCT6100_STATE_DECODE(ec->state)); + WAN_EC_STATE_DECODE(ec->state)); return WAN_EC_API_RC_INVALID_STATE; } - if (ec_api->channel_map == 0xFFFFFFFF){ + if (ec_api->fe_chan_map == 0xFFFFFFFF){ /* All channels selected */ - ec_api->channel_map = 0l; - for (fe_chan = 0; fe_chan < ec_dev->fe_max_channels; fe_chan++){ - ec_api->channel_map |= (1 << fe_chan); - } - }else{ - if (ec_dev->fe_media == WAN_MEDIA_T1 || - ec_dev->fe_media == WAN_MEDIA_FXOFXS){ - ec_api->channel_map = ec_api->channel_map >> 1; - } + ec_api->fe_chan_map = ec_dev->fe_channel_map; } /* Enable Echo cancelation on Oct6100 */ PRINT1(ec_api->verbose, - "%s: %s Echo Canceller on channel(s) map=0x%08lX ...\n", + "%s: %s Echo Canceller on channel(s) chan_map=0x%08lX ...\n", ec_dev->devname, - (cmd == WAN_EC_CMD_ENABLE) ? "Enable" : "Disable", - ec_api->channel_map); + (cmd == WAN_EC_API_CMD_ENABLE) ? "Enable" : "Disable", + ec_api->fe_chan_map); /*for(chan = fe_first; chan <= fe_last; chan++){*/ - for(fe_chan=0; fe_chan < ec_dev->fe_max_channels; fe_chan++){ - if (!(ec_api->channel_map & (1 << fe_chan))){ + for(fe_chan = ec_dev->fe_start_chan; fe_chan <= ec_dev->fe_stop_chan; fe_chan++){ + if (!(ec_api->fe_chan_map & (1 << fe_chan))){ continue; } if (ec_dev->fe_media == WAN_MEDIA_E1 && fe_chan == 0) continue; -#if 1 - err = wanec_modify_channel(ec_dev, fe_chan, cmd, ec_api->verbose); -#else - ec_chan = wanec_fe2ec_channel(ec_dev, fe_chan); - if (cmd == WAN_EC_CMD_ENABLE){ - err = wanec_ChannelModify( - ec_dev, - ec_chan, - cOCT6100_ECHO_OP_MODE_NORMAL, - ec_api); - if (err){ - return WAN_EC_API_RC_FAILED; - } - - /* Change rx/tx traffic through Oct6100 */ - if (wanec_bypass(ec_dev, fe_chan, 1, ec_api->verbose)){ - return WAN_EC_API_RC_FAILED; - } + if (cmd == WAN_EC_API_CMD_ENABLE){ + err = wanec_channel_opmode_modify( + ec_dev, fe_chan, + cOCT6100_ECHO_OP_MODE_NORMAL, + ec_api->verbose); + if (err) return WAN_EC_API_RC_FAILED; + err = wanec_bypass(ec_dev, fe_chan, 1, ec_api->verbose); }else{ - /* Change rx/tx traffic through Oct6100 */ - if (wanec_bypass(ec_dev, fe_chan, 0, ec_api->verbose)){ - return WAN_EC_API_RC_FAILED; - } - - err = wanec_ChannelModify( - ec_dev, - ec_chan, - cOCT6100_ECHO_OP_MODE_POWER_DOWN, - ec_api); - if (err){ - return WAN_EC_API_RC_FAILED; - } + wanec_bypass(ec_dev, fe_chan, 0, ec_api->verbose); + err = wanec_channel_opmode_modify( + ec_dev, fe_chan, + cOCT6100_ECHO_OP_MODE_POWER_DOWN, + ec_api->verbose); + } + if (err){ + return WAN_EC_API_RC_FAILED; } -#endif } return 0; } -static int wanec_modify_mode(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) +static int wanec_api_chan_opmode(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) { wan_ec_t *ec = NULL; - u_int32_t cmd = ec_api->cmd; - u_int32_t chan, ec_channel; - int err; + int fe_chan, err; WAN_ASSERT(ec_dev == NULL); WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; - if (ec->state != WAN_OCT6100_STATE_CHIP_READY){ - PRINT1(ec_api->verbose, - "WARNING: %s: Invalid Echo Canceller %s API state (%s)\n", + if (ec->state != WAN_EC_STATE_CHIP_READY){ + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Canceller %s API state (%s)\n", ec_dev->devname, ec->name, - WAN_OCT6100_STATE_DECODE(ec->state)); + WAN_EC_STATE_DECODE(ec->state)); return WAN_EC_API_RC_INVALID_STATE; } - if (ec_api->channel_map == 0xFFFFFFFF){ + if (ec_api->fe_chan_map == 0xFFFFFFFF){ /* All channels selected */ - ec_api->channel_map = 0l; - for (chan = 0; chan < ec_dev->fe_max_channels; chan++){ - ec_api->channel_map |= (1 << chan); - } - }else{ - if (ec_dev->fe_media == WAN_MEDIA_T1 || - ec_dev->fe_media == WAN_MEDIA_FXOFXS){ - ec_api->channel_map = ec_api->channel_map >> 1; - } + ec_api->fe_chan_map = ec_dev->fe_channel_map; } /* Enable/Disable Normal mode on Oct6100 */ PRINT1(ec_api->verbose, - "%s: %s Echo Canceller mode on channel(s) map=0x%08lX ...\n", - ec_dev->devname, - (cmd == WAN_EC_CMD_MODE_NORMAL) ? "Enable" : - (cmd == WAN_EC_CMD_MODE_POWERDOWN) ? "Disable" : "Modify", - ec_api->channel_map); - for(chan=0; chan < ec_dev->fe_max_channels; chan++){ - if (!(ec_api->channel_map & (1 << chan))){ + "%s: Modify Echo Canceller opmode on channel(s) chan_map=0x%08lX ...\n", + ec_dev->devname, ec_api->fe_chan_map); + for(fe_chan = ec_dev->fe_start_chan; fe_chan <= ec_dev->fe_stop_chan; fe_chan++){ + if (!(ec_api->fe_chan_map & (1 << fe_chan))){ continue; } - if (ec_dev->fe_media == WAN_MEDIA_E1 && chan == 0) continue; - ec_channel = wanec_fe2ec_channel(ec_dev, chan); - switch(cmd){ - case WAN_EC_CMD_MODE_NORMAL: - err = wanec_ChannelModify( - ec_dev, - ec_channel, - cOCT6100_ECHO_OP_MODE_NORMAL, - ec_api, - ec_api->verbose); - break; - case WAN_EC_CMD_MODE_POWERDOWN: - err = wanec_ChannelModify( - ec_dev, - ec_channel, - cOCT6100_ECHO_OP_MODE_POWER_DOWN, - ec_api, - ec_api->verbose); - break; - default: - err = wanec_ChannelModify( - ec_dev, - ec_channel, - cOCT6100_KEEP_PREVIOUS_SETTING, - ec_api, - ec_api->verbose); - break; - } + if (ec_dev->fe_media == WAN_MEDIA_E1 && fe_chan == 0) continue; + err = wanec_channel_opmode_modify( + ec_dev, fe_chan, ec_api->u_chan_opmode.opmode, ec_api->verbose); if (err){ return WAN_EC_API_RC_FAILED; } @@ -863,50 +926,104 @@ static int wanec_modify_mode(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) return 0; } -static int wanec_modify_bypass(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) +static int wanec_api_chan_custom(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) { - wan_ec_t *ec = NULL; - sdla_t *card = NULL; - unsigned int chan, fe_chan = 0; + wan_ec_t *ec = NULL; + wanec_chan_custom_t *chan_custom; + int fe_chan, ec_chan, err; WAN_ASSERT(ec_dev == NULL); WAN_ASSERT(ec_dev->ec == NULL); - WAN_ASSERT(ec_dev->card == NULL); ec = ec_dev->ec; - card = ec_dev->card; - - if (ec->state != WAN_OCT6100_STATE_CHIP_READY){ - PRINT1(ec_api->verbose, - "WARNING: %s: Invalid Echo Canceller %s API state (%s)\n", + if (ec->state != WAN_EC_STATE_CHIP_READY){ + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Canceller %s API state (%s)\n", ec_dev->devname, ec->name, - WAN_OCT6100_STATE_DECODE(ec->state)); + WAN_EC_STATE_DECODE(ec->state)); return WAN_EC_API_RC_INVALID_STATE; } - if (ec_api->channel_map == 0xFFFFFFFF){ + + if (ec_api->fe_chan_map == 0xFFFFFFFF){ /* All channels selected */ - ec_api->channel_map = 0l; - for (chan = 0; chan < ec_dev->fe_max_channels; chan++){ - ec_api->channel_map |= (1 << chan); - } + ec_api->fe_chan_map = ec_dev->fe_channel_map; + } + /* Enable/Disable Normal mode on Oct6100 */ + PRINT1(ec_api->verbose, + "%s: Modify EC Channel config (parms:%d) on channel(s) chan_map=0x%08lX ...\n", + ec_dev->devname, ec_api->custom_conf.param_no, + ec_api->fe_chan_map); + if (ec_api->custom_conf.param_no == 0){ + /* nothing to do */ + return 0; + } + chan_custom = &ec_api->u_chan_custom; + chan_custom->custom_conf.params = + wan_malloc(ec_api->custom_conf.param_no * sizeof(wan_custom_param_t)); + if (chan_custom->custom_conf.params){ + int err = 0; + err = WAN_COPY_FROM_USER( + chan_custom->custom_conf.params, + ec_api->custom_conf.params, + ec_api->custom_conf.param_no * sizeof(wan_custom_param_t)); + chan_custom->custom_conf.param_no = ec_api->custom_conf.param_no; }else{ - if (ec_dev->fe_media == WAN_MEDIA_T1 || - ec_dev->fe_media == WAN_MEDIA_FXOFXS){ - ec_api->channel_map = ec_api->channel_map >> 1; + DEBUG_EVENT( + "%s: WARNING: Skipping custom OCT6100 configuration (allocation failed)!\n", + ec_dev->devname); + return WAN_EC_API_RC_FAILED; + } + + for(fe_chan = ec_dev->fe_start_chan; fe_chan <= ec_dev->fe_stop_chan; fe_chan++){ + if (!(ec_api->fe_chan_map & (1 << fe_chan))){ + continue; } + if (ec_dev->fe_media == WAN_MEDIA_E1 && fe_chan == 0) continue; + ec_chan = wanec_fe2ec_channel(ec_dev, fe_chan); + err = wanec_ChannelModifyCustom(ec_dev, ec_chan, chan_custom, ec_api->verbose); + if (err){ + wan_free(chan_custom->custom_conf.params); + chan_custom->custom_conf.params = NULL; + return WAN_EC_API_RC_FAILED; + } + } + wan_free(chan_custom->custom_conf.params); + chan_custom->custom_conf.params = NULL; + return 0; +} + +static int wanec_api_modify_bypass(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) +{ + wan_ec_t *ec = NULL; + unsigned int fe_chan = 0; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + + if (ec->state != WAN_EC_STATE_CHIP_READY){ + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Canceller %s API state (%s)\n", + ec_dev->devname, + ec->name, + WAN_EC_STATE_DECODE(ec->state)); + return WAN_EC_API_RC_INVALID_STATE; + } + if (ec_api->fe_chan_map == 0xFFFFFFFF){ + /* All channels selected */ + ec_api->fe_chan_map = ec_dev->fe_channel_map; } /* Enable/Disable bypass mode on Oct6100 */ PRINT1(ec_api->verbose, - "%s: %s Bypass mode on channel(s) map=0x%08lX ...\n", + "%s: %s Bypass mode on channel(s) chan_map=0x%08lX ...\n", ec_dev->devname, - (ec_api->cmd == WAN_EC_CMD_BYPASS_ENABLE) ? "Enable" : "Disable", - ec_api->channel_map); - for(chan = 0; chan < ec_dev->fe_max_channels; chan++){ - if (!(ec_api->channel_map & (1 << chan))){ + (ec_api->cmd == WAN_EC_API_CMD_BYPASS_ENABLE) ? "Enable" : "Disable", + ec_api->fe_chan_map); + for(fe_chan = ec_dev->fe_start_chan; fe_chan <= (unsigned int)ec_dev->fe_stop_chan; fe_chan++){ + if (!(ec_api->fe_chan_map & (1 << fe_chan))){ continue; } - fe_chan = chan; - if (ec_api->cmd == WAN_EC_CMD_BYPASS_ENABLE){ + if (ec_api->cmd == WAN_EC_API_CMD_BYPASS_ENABLE){ /* Change rx/tx traffic through Oct6100 */ if (wanec_bypass(ec_dev, fe_chan, 1, ec_api->verbose)){ return WAN_EC_API_RC_FAILED; @@ -922,82 +1039,42 @@ static int wanec_modify_bypass(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) } -static int wanec_modify_dtmf(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) +static int wanec_api_channel_mute(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) { wan_ec_t *ec = NULL; - sdla_t *card = NULL; - unsigned int fe_chan, ec_channel; + int fe_chan; int err = WAN_EC_API_RC_OK; WAN_ASSERT(ec_dev == NULL); WAN_ASSERT(ec_dev->ec == NULL); - WAN_ASSERT(ec_dev->card == NULL); ec = ec_dev->ec; - card = ec_dev->card; - if (ec->state != WAN_OCT6100_STATE_CHIP_READY){ - PRINT1(ec_api->verbose, - "WARNING: %s: Invalid Echo Canceller %s API state (%s)\n", + if (ec->state != WAN_EC_STATE_CHIP_READY){ + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Canceller %s API state (%s)\n", ec_dev->devname, ec->name, - WAN_OCT6100_STATE_DECODE(ec->state)); + WAN_EC_STATE_DECODE(ec->state)); return WAN_EC_API_RC_INVALID_STATE; } - - if (ec_api->channel_map == 0xFFFFFFFF){ + if (ec_api->fe_chan_map == 0xFFFFFFFF){ /* All channels selected */ - ec_api->channel_map = 0l; - for (fe_chan = 0; fe_chan < ec_dev->fe_max_channels; fe_chan++){ - ec_api->channel_map |= (1 << fe_chan); - } - }else{ - if (ec_dev->fe_media == WAN_MEDIA_T1 || - ec_dev->fe_media == WAN_MEDIA_FXOFXS){ - ec_api->channel_map = ec_api->channel_map >> 1; - } + ec_api->fe_chan_map = ec_dev->fe_channel_map; } - if (!ec_api->channel_map){ + if (!ec_api->fe_chan_map){ return WAN_EC_API_RC_NOACTION; } - /* Enable/Disable Normal mode on Oct6100 */ - PRINT1(ec_api->verbose, - "%s: %s Echo Canceller DTMF on channel(s) map=0x%08lX ...\n", - ec_dev->devname, - (ec_api->cmd == WAN_EC_CMD_DTMF_ENABLE) ? "Enable" : - (ec_api->cmd == WAN_EC_CMD_DTMF_DISABLE) ? "Disable" : - "Unknown", - ec_api->channel_map); - for(fe_chan=0; fe_chan < ec_dev->fe_max_channels; fe_chan++){ - if (!(ec_api->channel_map & (1 << fe_chan))){ + for(fe_chan = ec_dev->fe_start_chan; fe_chan <= ec_dev->fe_stop_chan; fe_chan++){ + if (!(ec_api->fe_chan_map & (1 << fe_chan))){ continue; } if (ec_dev->fe_media == WAN_MEDIA_E1 && fe_chan == 0) continue; - ec_channel = wanec_fe2ec_channel(ec_dev, fe_chan); - switch(ec_api->cmd){ - case WAN_EC_CMD_DTMF_ENABLE: - if (wanec_bypass(ec_dev, fe_chan, 1, ec_api->verbose)){ - return WAN_EC_API_RC_FAILED; - } - err = wanec_TonesEnable( - ec, - ec_channel, - ec_api->u_dtmf_config.port, + err = wanec_channel_mute( + ec_dev, + fe_chan, + (ec_api->cmd == WAN_EC_API_CMD_CHANNEL_MUTE) ? WAN_TRUE: WAN_FALSE, + &ec_api->u_chan_mute, ec_api->verbose); - break; - case WAN_EC_CMD_DTMF_DISABLE: - err = wanec_TonesDisable( - ec, - ec_channel, - ec_api->u_dtmf_config.port, - ec_api->verbose); - if (wanec_bypass(ec_dev, fe_chan, 0, ec_api->verbose)){ - return WAN_EC_API_RC_FAILED; - } - break; - default: - err = WAN_EC_API_RC_INVALID_CMD; - break; - } if (err){ return WAN_EC_API_RC_FAILED; } @@ -1005,101 +1082,161 @@ static int wanec_modify_dtmf(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) return err; } -static int wanec_stats(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) +static int wanec_api_dtmf(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) { wan_ec_t *ec = NULL; - unsigned int fe_chan, ec_channel, err = 0; + int fe_chan, err = WAN_EC_API_RC_OK; WAN_ASSERT(ec_dev == NULL); WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; - if (ec->state != WAN_OCT6100_STATE_CHIP_READY){ - PRINT1(ec_api->verbose, - "WARNING: %s: Invalid Echo Canceller %s API state (%s)\n", + if (ec->state != WAN_EC_STATE_CHIP_READY){ + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Canceller %s API state (%s)\n", ec_dev->devname, ec->name, - WAN_OCT6100_STATE_DECODE(ec->state)); + WAN_EC_STATE_DECODE(ec->state)); return WAN_EC_API_RC_INVALID_STATE; } - if (ec_dev->fe_media == WAN_MEDIA_T1 || ec_dev->fe_media == WAN_MEDIA_FXOFXS){ - ec_api->channel_map = ec_api->channel_map >> 1; + if (ec_api->fe_chan_map == 0xFFFFFFFF){ + /* All channels selected */ + ec_api->fe_chan_map = ec_dev->fe_channel_map; } + + if (!ec_api->fe_chan_map){ + return WAN_EC_API_RC_NOACTION; + } + /* Enable/Disable Normal mode on Oct6100 */ PRINT1(ec_api->verbose, - "%s: Read Echo Canceller stats on channel(s) map=0x%08lX reset %d...\n", + "%s: %s Echo Canceller DTMF on channel(s) chan_map=0x%08lX ...\n", ec_dev->devname, - ec_api->channel_map, - (ec_api->channel_map) ? + (ec_api->cmd == WAN_EC_API_CMD_DTMF_ENABLE) ? "Enable" : + (ec_api->cmd == WAN_EC_API_CMD_DTMF_DISABLE) ? "Disable" : + "Unknown", + ec_api->fe_chan_map); + for(fe_chan = ec_dev->fe_start_chan; fe_chan <= ec_dev->fe_stop_chan; fe_chan++){ + if (!(ec_api->fe_chan_map & (1 << fe_chan))){ + continue; + } + if (ec_dev->fe_media == WAN_MEDIA_E1 && fe_chan == 0) continue; + err = wanec_channel_dtmf( + ec_dev, + fe_chan, + (ec_api->cmd == WAN_EC_API_CMD_DTMF_ENABLE) ? WAN_TRUE : WAN_FALSE, + &ec_api->u_dtmf_config, + ec_api->verbose); + if (err){ + return WAN_EC_API_RC_FAILED; + } + } + return err; +} + +static int wanec_api_stats(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) +{ + wan_ec_t *ec = NULL; + int fe_chan, ec_chan, err = 0; + + WAN_ASSERT(ec_dev == NULL); + WAN_ASSERT(ec_dev->ec == NULL); + ec = ec_dev->ec; + if (ec->state != WAN_EC_STATE_CHIP_READY){ + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Canceller %s API state (%s)\n", + ec_dev->devname, + ec->name, + WAN_EC_STATE_DECODE(ec->state)); + return WAN_EC_API_RC_INVALID_STATE; + } + + PRINT1(ec_api->verbose, + "%s: Read EC stats on channel(s) chan_map=0x%08lX reset:%d...\n", + ec_dev->devname, + ec_api->fe_chan_map, + (ec_api->fe_chan_map) ? ec_api->u_chan_stats.reset:ec_api->u_chip_stats.reset); if (wanec_ISR(ec, ec_api->verbose)){ return WAN_EC_API_RC_FAILED; } - if (ec_api->channel_map){ - for(fe_chan=0; fe_chan < ec_dev->fe_max_channels; fe_chan++){ - if (!(ec_api->channel_map & (1 << fe_chan))){ + if (ec_api->fe_chan_map){ + int ready = 0; + for(fe_chan = ec_dev->fe_start_chan; fe_chan <= ec_dev->fe_stop_chan; fe_chan++){ + if (!(ec_api->fe_chan_map & (1 << fe_chan))){ + continue; + } + if (!wan_test_bit(fe_chan, &ec_dev->fe_channel_map)){ continue; } if (ec_dev->fe_media == WAN_MEDIA_E1 && fe_chan == 0){ continue; } - ec_channel = wanec_fe2ec_channel(ec_dev, fe_chan); + ec_chan = wanec_fe2ec_channel(ec_dev, fe_chan); err = wanec_ChannelStats( ec_dev, - ec_channel, - ec_api, - ec_api->u_chan_stats.reset); + ec_chan, + &ec_api->u_chan_stats, + ec_api->verbose); if (err){ return WAN_EC_API_RC_FAILED; } + ready = 1; + break; + } + if (!ready){ + return WAN_EC_API_RC_INVALID_CHANNELS; } }else{ - wanec_ChipStats(ec_dev, ec_api, ec_api->u_chip_stats.reset); + wanec_ChipStats(ec_dev, &ec_api->u_chip_stats, ec_api->u_chip_stats.reset, ec_api->verbose); } return 0; } -static int wanec_monitor(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) +static int wanec_api_monitor(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) { wan_ec_t *ec = NULL; - unsigned int channel = ec_api->channel, - ec_channel; + int fe_chan = ec_api->fe_chan, + ec_chan = 0; WAN_ASSERT(ec_dev == NULL); WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; - if (ec->state != WAN_OCT6100_STATE_CHIP_READY){ - PRINT1(ec_api-> verbose, - "WARNING: %s: Invalid Echo Canceller %s API state (%s)\n", + if (ec->state != WAN_EC_STATE_CHIP_READY){ + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Canceller %s API state (%s)\n", ec_dev->devname, ec->name, - WAN_OCT6100_STATE_DECODE(ec->state)); + WAN_EC_STATE_DECODE(ec->state)); return WAN_EC_API_RC_INVALID_STATE; } /* Sanity check from channel selection */ - if (((ec_dev->fe_media == WAN_MEDIA_T1) && (channel > ec_dev->fe_max_channels)) || - ((ec_dev->fe_media == WAN_MEDIA_E1) && (channel >= ec_dev->fe_max_channels))){ + if (fe_chan > ec_dev->fe_stop_chan){ DEBUG_EVENT( - "ERROR: %s: Channel number %d out of range!\n", - ec_dev->devname, - channel); + "ERROR: %s: Front-End channel number %d is out of range!\n", + ec_dev->devname, fe_chan); return WAN_EC_API_RC_INVALID_CHANNELS; } - if (channel){ - if (ec_dev->fe_media == WAN_MEDIA_T1 || ec_dev->fe_media == WAN_MEDIA_FXOFXS) channel--; - ec_channel = wanec_fe2ec_channel(ec_dev, channel); - if (wanec_DebugChannel(ec, ec_channel, ec_api->verbose)){ + if (fe_chan){ + if (!(ec_dev->fe_channel_map & (1 << fe_chan))){ + return WAN_EC_API_RC_INVALID_CHANNELS; + } + ec_chan = wanec_fe2ec_channel(ec_dev, fe_chan); + if (wanec_DebugChannel(ec_dev, ec_chan, ec_api->verbose)){ return WAN_EC_API_RC_FAILED; } }else{ - wanec_DebugGetData(ec, ec_api); + if (wanec_DebugGetData(ec_dev, &ec_api->u_chan_monitor, ec_api->verbose)){ + return WAN_EC_API_RC_FAILED; + } + ec_api->fe_chan = ec_api->u_chan_monitor.fe_chan; } return 0; } -static int wanec_tone(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) +static int wanec_api_buffer(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) { wan_ec_t *ec = NULL; int err; @@ -1107,18 +1244,18 @@ static int wanec_tone(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) WAN_ASSERT(ec_dev == NULL); WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; - if (ec->state != WAN_OCT6100_STATE_CHIP_READY){ - PRINT1(ec_api->verbose, - "WARNING: %s: Invalid Echo Canceller %s API state (%s)\n", + if (ec->state != WAN_EC_STATE_CHIP_READY){ + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Canceller %s API state (%s)\n", ec_dev->devname, ec->name, - WAN_OCT6100_STATE_DECODE(ec->state)); + WAN_EC_STATE_DECODE(ec->state)); return WAN_EC_API_RC_INVALID_STATE; } - if (ec_api->cmd == WAN_EC_CMD_TONE_LOAD){ - err = wanec_BufferLoad(ec_dev, ec_api); + if (ec_api->cmd == WAN_EC_API_CMD_BUFFER_LOAD){ + err = wanec_BufferLoad(ec_dev, &ec_api->u_buffer_config, ec_api->verbose); }else{ - err = wanec_BufferUnload(ec_dev, ec_api); + err = wanec_BufferUnload(ec_dev, &ec_api->u_buffer_config, ec_api->verbose); } if (err){ return WAN_EC_API_RC_FAILED; @@ -1126,51 +1263,70 @@ static int wanec_tone(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) return 0; } -static int wanec_playout(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) +static int wanec_api_playout(wan_ec_dev_t *ec_dev, wan_ec_api_t *ec_api) { wan_ec_t *ec = NULL; - int ec_channel; + int fe_chan = ec_api->fe_chan, + ec_chan = 0; WAN_ASSERT(ec_dev == NULL); WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; - if (ec->state != WAN_OCT6100_STATE_CHIP_READY){ - PRINT1(ec_api->verbose, - "WARNING: %s: Invalid Echo Canceller %s API state (%s)\n", + if (ec->state != WAN_EC_STATE_CHIP_READY){ + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Canceller %s API state (%s)\n", ec_dev->devname, ec->name, - WAN_OCT6100_STATE_DECODE(ec->state)); + WAN_EC_STATE_DECODE(ec->state)); return WAN_EC_API_RC_INVALID_STATE; } - if (ec_dev->fe_media == WAN_MEDIA_E1 && ec_api->channel == 0){ + if (ec_dev->fe_media == WAN_MEDIA_E1 && ec_api->fe_chan == 0){ return WAN_EC_API_RC_NOACTION; } - if (((ec_dev->fe_media == WAN_MEDIA_T1) && ((unsigned int)ec_api->channel > ec_dev->fe_max_channels)) || - ((ec_dev->fe_media == WAN_MEDIA_E1) && ((unsigned int)ec_api->channel >= ec_dev->fe_max_channels))){ + if (fe_chan > ec_dev->fe_stop_chan){ DEBUG_EVENT( - "ERROR: %s: Channel number %d out of range!\n", - ec_dev->devname, - ec_api->channel); + "ERROR: %s: Front-End channel number %d is out of range!\n", + ec_dev->devname, fe_chan); return WAN_EC_API_RC_INVALID_CHANNELS; } + if (ec_api->u_playout.port != WAN_EC_CHANNEL_PORT_SOUT && + ec_api->u_playout.port != WAN_EC_CHANNEL_PORT_ROUT){ + DEBUG_EVENT( + "ERROR: %s: Invalid Echo Canceller port value (%s)!\n", + ec_dev->devname, + WAN_EC_DECODE_CHANNEL_PORT(ec_api->u_playout.port)); + return WAN_EC_API_RC_INVALID_PORT; + } + ec_chan = wanec_fe2ec_channel(ec_dev, fe_chan); - if (ec_dev->fe_media == WAN_MEDIA_T1 || ec_dev->fe_media == WAN_MEDIA_FXOFXS) - ec_api->channel--; - ec_channel = wanec_fe2ec_channel(ec_dev, ec_api->channel); - + PRINT1(ec_api->verbose, + "%s: Buffer Playout %s on fe_chan:%d ...\n", + ec_dev->devname, + (ec_api->cmd == WAN_EC_API_CMD_PLAYOUT_START) ? + "Start" : "Stop", + fe_chan); switch(ec_api->cmd){ - case WAN_EC_CMD_PLAYOUT_START: - if (wanec_BufferPlayoutAdd(ec, ec_channel, ec_api)){ + case WAN_EC_API_CMD_PLAYOUT_START: + if (wanec_BufferPlayoutAdd(ec, ec_chan, &ec_api->u_playout, ec_api->verbose)){ return WAN_EC_API_RC_FAILED; } - if (wanec_BufferPlayoutStart(ec, ec_channel, ec_api)){ - wanec_BufferPlayoutStop(ec, ec_channel, ec_api); + if (wanec_BufferPlayoutStart(ec, ec_chan, &ec_api->u_playout, ec_api->verbose)){ + wanec_BufferPlayoutStop(ec, ec_chan, &ec_api->u_playout, ec_api->verbose); return WAN_EC_API_RC_FAILED; } + ec->playout_verbose = ec_api->verbose; + if (ec_api->u_playout.notifyonstop){ + wan_set_bit(WAN_EC_BIT_EVENT_PLAYOUT, &ec_dev->events); + } break; - case WAN_EC_CMD_PLAYOUT_STOP: - wanec_BufferPlayoutStop(ec, ec_channel, ec_api); + case WAN_EC_API_CMD_PLAYOUT_STOP: + wanec_BufferPlayoutStop(ec, ec_chan, &ec_api->u_playout, ec_api->verbose); + /* FIXME: Once the Playout event was enabled, do not + ** disable it otherwise playout events for other + ** channels will be delayed + **ec->playout_verbose = 0; + **wan_clear_bit(WAN_EC_BIT_EVENT_PLAYOUT, &ec_dev->events);*/ break; } @@ -1230,7 +1386,7 @@ int wanec_ioctl(void *data, void *pcard) wanec_search(ec_api->devname); #endif if (ec_dev == NULL){ - PRINT1(ec_api->verbose, + DEBUG_EVENT( "%s: Failed to find device [%s:%d]!\n", ec_api->devname, __FUNCTION__,__LINE__); ec_api->err = WAN_EC_API_RC_INVALID_DEV; @@ -1238,17 +1394,19 @@ int wanec_ioctl(void *data, void *pcard) } WAN_ASSERT(ec_dev->ec == NULL); ec = ec_dev->ec; +#if !defined(__WINDOWS__) + /* Windows: can not copy to/from user when locked */ wan_spin_lock(&ec->lock); - +#endif if (wan_test_bit(WAN_EC_BIT_CRIT_DOWN, &ec_dev->critical)){ - PRINT1(ec_api->verbose, + DEBUG_EVENT( "%s: Echo Canceller device is down!\n", ec_api->devname); ec_api->err = WAN_EC_API_RC_INVALID_DEV; goto wanec_ioctl_done; } if (wan_test_and_set_bit(WAN_EC_BIT_CRIT_CMD, &ec->critical)){ - PRINT1(ec_api->verbose, + DEBUG_EVENT( "%s: Echo Canceller is busy!\n", ec_api->devname); ec_api->err = WAN_EC_API_RC_BUSY; @@ -1256,61 +1414,83 @@ int wanec_ioctl(void *data, void *pcard) } PRINT2(ec_api->verbose, "%s: WPEC_LIP IOCTL: %s\n", - ec_api->devname, WAN_EC_CMD_DECODE(ec_api->cmd)); + ec_api->devname, WAN_EC_API_CMD_DECODE(ec_api->cmd)); ec_api->err = WAN_EC_API_RC_OK; +/* + { + int i; + u8 *t = (u8*)ec_api; + for(i = 0; i < sizeof(wan_ec_api_t); i++){ + DEBUG_HWEC("[%i]=%02X\n", i, t[i]); + if(i > 1000){ + DEBUG_HWEC("...\n"); + break; + } + } + + } +*/ switch(ec_api->cmd){ - case WAN_EC_CMD_GETINFO: + case WAN_EC_API_CMD_GETINFO: ec_api->u_info.max_channels = ec->max_channels; ec_api->state = ec->state; break; - case WAN_EC_CMD_CONFIG: - err = wanec_config(ec_dev, ec_api); + case WAN_EC_API_CMD_CONFIG: + err = wanec_api_config(ec_dev, ec_api); break; - case WAN_EC_CMD_RELEASE: - err = wanec_release(ec_dev, ec_api, ec_api->verbose); + case WAN_EC_API_CMD_CONFIG_POLL: + ec_api->state = ec->state; break; - case WAN_EC_CMD_CHANNEL_OPEN: - err = wanec_channel_open(ec_dev, ec_api); + case WAN_EC_API_CMD_RELEASE: + err = wanec_api_release(ec_dev, ec_api, ec_api->verbose); break; - case WAN_EC_CMD_ENABLE: - case WAN_EC_CMD_DISABLE: - err = wanec_modify(ec_dev, ec_api); + case WAN_EC_API_CMD_CHANNEL_OPEN: + err = wanec_api_channel_open(ec_dev, ec_api); break; - case WAN_EC_CMD_BYPASS_ENABLE: - case WAN_EC_CMD_BYPASS_DISABLE: - err = wanec_modify_bypass(ec_dev, ec_api); + case WAN_EC_API_CMD_ENABLE: + case WAN_EC_API_CMD_DISABLE: + err = wanec_api_modify(ec_dev, ec_api); break; - case WAN_EC_CMD_MODE_NORMAL: - case WAN_EC_CMD_MODE_POWERDOWN: - case WAN_EC_CMD_MODIFY_CHANNEL: - err = wanec_modify_mode(ec_dev, ec_api); + case WAN_EC_API_CMD_BYPASS_ENABLE: + case WAN_EC_API_CMD_BYPASS_DISABLE: + err = wanec_api_modify_bypass(ec_dev, ec_api); break; - case WAN_EC_CMD_DTMF_ENABLE: - case WAN_EC_CMD_DTMF_DISABLE: - ec_api->err = wanec_modify_dtmf(ec_dev, ec_api); + case WAN_EC_API_CMD_OPMODE: + err = wanec_api_chan_opmode(ec_dev, ec_api); break; - case WAN_EC_CMD_STATS: - case WAN_EC_CMD_STATS_FULL: - err = wanec_stats(ec_dev, ec_api); + case WAN_EC_API_CMD_CHANNEL_MUTE: + case WAN_EC_API_CMD_CHANNEL_UNMUTE: + err = wanec_api_channel_mute(ec_dev, ec_api); break; - case WAN_EC_CMD_TONE_LOAD: - case WAN_EC_CMD_TONE_UNLOAD: - err = wanec_tone(ec_dev, ec_api); + case WAN_EC_API_CMD_MODIFY_CHANNEL: + err = wanec_api_chan_custom(ec_dev, ec_api); break; - case WAN_EC_CMD_PLAYOUT_START: - case WAN_EC_CMD_PLAYOUT_STOP: - err = wanec_playout(ec_dev, ec_api); + case WAN_EC_API_CMD_DTMF_ENABLE: + case WAN_EC_API_CMD_DTMF_DISABLE: + ec_api->err = wanec_api_dtmf(ec_dev, ec_api); break; - case WAN_EC_CMD_MONITOR: - err = wanec_monitor(ec_dev, ec_api); + case WAN_EC_API_CMD_STATS: + case WAN_EC_API_CMD_STATS_FULL: + err = wanec_api_stats(ec_dev, ec_api); break; - case WAN_EC_CMD_RELEASE_ALL: + case WAN_EC_API_CMD_BUFFER_LOAD: + case WAN_EC_API_CMD_BUFFER_UNLOAD: + err = wanec_api_buffer(ec_dev, ec_api); + break; + case WAN_EC_API_CMD_PLAYOUT_START: + case WAN_EC_API_CMD_PLAYOUT_STOP: + err = wanec_api_playout(ec_dev, ec_api); + break; + case WAN_EC_API_CMD_MONITOR: + err = wanec_api_monitor(ec_dev, ec_api); + break; + case WAN_EC_API_CMD_RELEASE_ALL: break; } if (err){ PRINT2(ec_api->verbose, "%s: %s return error (Command: %s)\n", - ec_api->devname, __FUNCTION__, WAN_EC_CMD_DECODE(ec_api->cmd)); + ec_api->devname, __FUNCTION__, WAN_EC_API_CMD_DECODE(ec_api->cmd)); ec_api->err = err; } if (ec_api->err == WAN_EC_API_RC_INVALID_STATE){ @@ -1319,7 +1499,11 @@ int wanec_ioctl(void *data, void *pcard) wan_clear_bit(WAN_EC_BIT_CRIT_CMD, &ec->critical); wanec_ioctl_done: +#if !defined(__WINDOWS__) + /* Windows: can not copy to/from user when locked */ wan_spin_unlock(&ec->lock); +#endif + wanec_ioctl_exit: #if defined(__LINUX__) err = WAN_COPY_TO_USER( @@ -1338,7 +1522,7 @@ wanec_ioctl_exit: PRINT2(ec_api->verbose, "%s: WPEC_LIP IOCTL: %s returns %d\n", ec_api->devname, - WAN_EC_CMD_DECODE(ec_api->cmd), + WAN_EC_API_CMD_DECODE(ec_api->cmd), ec_api->err); #if defined(__LINUX__) @@ -1372,15 +1556,15 @@ static int wan_ec_devnum(char *ptr) return num; } -static void* wanec_register(void *pcard, int max_channels) +static void* +wanec_register(void *pcard, u_int32_t fe_port_mask, int max_line_no, int max_channels, void *pconf) { - sdla_t *card = (sdla_t*)pcard; - wan_ec_t *ec = NULL; - wan_ec_dev_t *ec_dev = NULL, *ec_dev_new = NULL; + sdla_t *card = (sdla_t*)pcard; + wan_custom_conf_t *conf = (wan_custom_conf_t*)pconf; + wan_ec_t *ec = NULL; + wan_ec_dev_t *ec_dev = NULL, *ec_dev_new = NULL; WAN_DEBUG_FUNC_START; - - #if defined(__WINDOWS__) ec = get_wan_ec_ptr(card); #else @@ -1388,14 +1572,9 @@ static void* wanec_register(void *pcard, int max_channels) WAN_LIST_FOREACH(ec_dev, &ec->ec_dev_head, next){ if (ec_dev->card == NULL || ec_dev->card == card){ DEBUG_EVENT("%s: Internal Error (%s:%d)\n", - card->devname, - __FUNCTION__,__LINE__); + card->devname, __FUNCTION__,__LINE__); return NULL; } - } - } - WAN_LIST_FOREACH(ec, &wan_ec_head, next){ - WAN_LIST_FOREACH(ec_dev, &ec->ec_dev_head, next){ if (card->hw_iface.hw_same(ec_dev->card->hw, card->hw)){ /* Current OCT6100 chip is already in use */ break; @@ -1429,6 +1608,7 @@ static void* wanec_register(void *pcard, int max_channels) #else if (ec_dev == NULL){ #endif + /* First device for current Oct6100 chip */ ec = wan_malloc(sizeof(wan_ec_t)); if (ec == NULL){ @@ -1437,20 +1617,45 @@ static void* wanec_register(void *pcard, int max_channels) __FUNCTION__,__LINE__); return NULL; } - memset(ec, 0, sizeof(wan_ec_t)); - ec->chip_no = ++wan_ec_no; - ec->state = WAN_OCT6100_STATE_RESET; - ec->ec_active = 0; - ec->max_channels = max_channels; - wan_spin_lock_init(&ec->lock); + + ec->chip_no = card->hw_iface.get_hwec_index(card->hw); + if (ec->chip_no < 0){ + DEBUG_EVENT("%s: ERROR: Failed to get EC chip number!\n", + card->devname); + wan_free(ec); + return NULL; + } + ec->state = WAN_EC_STATE_RESET; + ec->max_channels = (u_int16_t)max_channels; + wan_spin_lock_init(&ec->lock, "wan_ec_lock"); sprintf(ec->name, "%s%d", WANEC_DEV_NAME, ec->chip_no); + + /* Copy EC chip custom configuration */ + if (conf->param_no){ + /* Copy custom oct parameter from user space */ + ec->custom_conf.params = wan_malloc(conf->param_no * sizeof(wan_custom_param_t)); + if (ec->custom_conf.params){ + int err = 0; + err = WAN_COPY_FROM_USER( + ec->custom_conf.params, + conf->params, + conf->param_no * sizeof(wan_custom_param_t)); + ec->custom_conf.param_no = conf->param_no; + }else{ + DEBUG_EVENT( + "%s: WARNING: Skipping custom OCT6100 configuration (allocation failed)!\n", + card->devname); + } + } + Oct6100InterruptServiceRoutineDef(&ec->f_InterruptFlag); #if defined(__WINDOWS__) set_wan_ec_ptr(card, ec); #else WAN_LIST_INIT(&ec->ec_dev_head); + WAN_LIST_INIT(&ec->ec_confbridge_head); WAN_LIST_INSERT_HEAD(&wan_ec_head, ec, next); #endif }else{ @@ -1459,14 +1664,28 @@ static void* wanec_register(void *pcard, int max_channels) #endif } ec->usage++; - ec_dev_new->ecdev_no = wan_ec_devnum(card->devname); + ec_dev_new->ecdev_no = wan_ec_devnum(card->devname); ec_dev_new->ec = ec; ec_dev_new->name = ec->name; ec_dev_new->card = card; ec_dev_new->fe_media = WAN_FE_MEDIA(&card->fe); ec_dev_new->fe_lineno = WAN_FE_LINENO(&card->fe); - ec_dev_new->fe_max_channels = WAN_FE_MAX_CHANNELS(&card->fe); + ec_dev_new->fe_start_chan = WAN_FE_START_CHANNEL(&card->fe); + ec_dev_new->fe_max_chans = WAN_FE_MAX_CHANNELS(&card->fe); //max_line_no; // + ec_dev_new->fe_stop_chan = ec_dev_new->fe_start_chan + ec_dev_new->fe_max_chans - 1; + /* Feb 14, 2008 + ** Ignore fe_port_mask for BRI cards. fe_port_mask is for full card, + ** but ec_dev created per module. In this case, we have always + ** 2 channels (1 and 2). Create fe_channel_map manually */ + if (fe_port_mask && ec_dev_new->fe_media != WAN_MEDIA_BRI){ + ec_dev_new->fe_channel_map = fe_port_mask; + }else{ + int fe_chan = 0; + for(fe_chan = ec_dev_new->fe_start_chan; fe_chan <= ec_dev_new->fe_stop_chan; fe_chan++){ + ec_dev_new->fe_channel_map |= (1 << fe_chan); + } + } if (!WAN_FE_TDMV_LAW(&card->fe)){ if (WAN_FE_MEDIA(&card->fe) == WAN_MEDIA_T1){ WAN_FE_TDMV_LAW(&card->fe) = WAN_TDMV_MULAW; @@ -1478,11 +1697,11 @@ static void* wanec_register(void *pcard, int max_channels) } } ec_dev_new->fe_tdmv_law = WAN_FE_TDMV_LAW(&card->fe); - ec_dev_new->state = WAN_OCT6100_STATE_RESET; + ec_dev_new->state = WAN_EC_STATE_RESET; /* Initialize hwec_bypass pointer */ card->wandev.ec_enable = wanec_enable; - card->wandev.ec_map = 0; + card->wandev.fe_ec_map = 0; memcpy(ec_dev_new->devname, card->devname, sizeof(card->devname)); sprintf(ec_dev_new->ecdev_name, "wp%dec", ec_dev_new->ecdev_no); @@ -1517,10 +1736,9 @@ static int wanec_unregister(void *arg, void *pcard) ec = ec_dev->ec; wan_spin_lock(&ec->lock); - DEBUG_EVENT("%s: Unregister interface from %s (chip id %d, usage %d)!\n", + DEBUG_EVENT("%s: Unregister interface from %s (usage %d)!\n", card->devname, ec->name, - ec->chip_no, ec->usage); wan_set_bit(WAN_EC_BIT_TIMER_KILL,(void*)&ec_dev->critical); @@ -1528,11 +1746,11 @@ static int wanec_unregister(void *arg, void *pcard) wan_set_bit(WAN_EC_BIT_CRIT,(void*)&ec_dev->critical); wan_del_timer(&ec_dev->timer); - if (ec_dev->state != WAN_OCT6100_STATE_RESET){ - PRINT1(global_verbose, - "%s: Forcing EC device release\n", + if (ec_dev->state != WAN_EC_STATE_RESET){ + DEBUG_EVENT( + "%s: Releasing EC device (force)!\n", card->devname); - wanec_release(ec_dev, NULL, global_verbose); + wanec_api_release(ec_dev, NULL, wanec_verbose); } ec_dev->card = NULL; ec->usage--; @@ -1552,10 +1770,12 @@ static int wanec_unregister(void *arg, void *pcard) card->ec_dev_ptr = NULL; #endif + ec_dev->ec = NULL; + wan_free(ec_dev); + wan_spin_unlock(&ec->lock); + /* FIXME: Remove character device */ if (!ec->usage){ - ec_dev->ec = NULL; - wan_free(ec_dev); #if !defined(__WINDOWS__) if (WAN_LIST_FIRST(&wan_ec_head) == ec){ WAN_LIST_FIRST(&wan_ec_head) = @@ -1566,77 +1786,56 @@ static int wanec_unregister(void *arg, void *pcard) } #endif + /* Free all custom configuration parameters */ + if (ec->custom_conf.params){ + wan_free(ec->custom_conf.params); + } + wan_free(ec); #if defined(__WINDOWS__) set_wan_ec_ptr(card, NULL); #endif - }else{ - ec_dev->ec = NULL; - wan_free(ec_dev); } - wan_spin_unlock(&ec->lock); WAN_DEBUG_FUNC_END; return 0; } -#if 0 -static int wanec_isr(void *arg, void *pcard) +#define WAN_EC_IRQ_TIMEOUT (HZ*60) +#define WAN_EC_DTMF_IRQ_TIMEOUT (HZ/32) +#define WAN_EC_PLAYOUT_IRQ_TIMEOUT (HZ/32) +static int wanec_isr(void *arg) { - wan_ec_t *ec = NULL; wan_ec_dev_t *ec_dev = (wan_ec_dev_t*)arg; - - WAN_ASSERT2(ec_dev == NULL, 0); - WAN_ASSERT2(ec_dev->ec == NULL, 0); - ec = ec_dev->ec; - -#if !defined(__WINDOWS__) - if (WAN_LIST_FIRST(&ec->ec_dev_head) != ec_dev){ - return 0; - } -#endif - - if (ec->state != WAN_OCT6100_STATE_CHIP_READY){ - return 0; - } - if (wan_test_bit(WAN_EC_BIT_CRIT_DOWN, &ec_dev->critical)){ - return 0; - } - if (wan_test_bit(WAN_EC_BIT_CRIT_ERROR, &ec_dev->critical)){ - return 0; - } - if (wan_test_bit(WAN_EC_BIT_CRIT_CMD, &ec->critical)){ - return 0; - } - if (ec_dev->poll_cmd != WAN_EC_POLL_NONE){ - /* I'm still busy, return now */ - return 0; - } - - ec->intcount++; - /* Execute interrupt routine */ - if (wanec_ISR(ec, global_verbose)){ - wan_set_bit(WAN_EC_BIT_CRIT_ERROR, &ec->critical); - wan_set_bit(WAN_EC_BIT_CRIT,(void*)&ec_dev->critical); + if (ec_dev == NULL || ec_dev->ec == NULL) return 0; + if (ec_dev->ec->state != WAN_EC_STATE_CHIP_READY){ + return 0; + } + if (wan_test_bit(WAN_EC_BIT_EVENT_DTMF, &ec_dev->events)){ + /* DTMF event is enabled */ + if ((SYSTEM_TICKS - ec_dev->lastint_ticks) > WAN_EC_DTMF_IRQ_TIMEOUT){ + ec_dev->lastint_ticks = SYSTEM_TICKS; + return 1; + } + return 0; + } + if (wan_test_bit(WAN_EC_BIT_EVENT_PLAYOUT, &ec_dev->events)){ + /* Playout event is enabled */ + if ((SYSTEM_TICKS - ec_dev->lastint_ticks) > WAN_EC_PLAYOUT_IRQ_TIMEOUT){ + ec_dev->lastint_ticks = SYSTEM_TICKS; + return 1; + } return 0; } - - PRINT1(global_verbose, - "%s: HW EC ISR-POLL (%d:%d)\n", - ec_dev->devname, ec->intcount, - (ec->f_InterruptFlag.fToneEventsPending == TRUE)?1:0); - if (ec->f_InterruptFlag.fToneEventsPending == TRUE && - wan_test_bit(WAN_EC_BIT_EVENT_DTMF, &ec_dev->events)){ - ec_dev->poll_cmd = WAN_EC_POLL_INTR; - /* Schedule poll */ - return 1; + if ((SYSTEM_TICKS - ec_dev->lastint_ticks) > WAN_EC_IRQ_TIMEOUT){ + ec_dev->lastint_ticks = SYSTEM_TICKS; + return 1; } return 0; } -#endif static int wanec_poll(void *arg, void *pcard) { @@ -1649,10 +1848,18 @@ static int wanec_poll(void *arg, void *pcard) ec = ec_dev->ec; WAN_DEBUG_FUNC_START; - + +#if defined(__WINDOWS__) wan_spin_lock(&ec->lock); +#else + if (!wan_spin_trylock(&ec->lock)){ + return -EBUSY; + } +#endif + wan_clear_bit(WAN_EC_BIT_TIMER_RUNNING,(void*)&ec_dev->critical); - if (wan_test_bit(WAN_EC_BIT_CRIT_DOWN, &ec_dev->critical)){ + if (wan_test_bit(WAN_EC_BIT_CRIT_DOWN, &ec_dev->critical) || + wan_test_bit(WAN_EC_BIT_CRIT_ERROR, &ec_dev->critical)){ ec_dev->poll_cmd = WAN_EC_POLL_NONE; wan_spin_unlock(&ec->lock); return -EINVAL; @@ -1660,33 +1867,49 @@ static int wanec_poll(void *arg, void *pcard) switch(ec_dev->poll_cmd){ case WAN_EC_POLL_CHIPOPENPENDING: /* Chip open */ + if (ec->state != WAN_EC_STATE_CHIP_OPEN_PENDING){ + DEBUG_EVENT( + "%s: Invalid EC state at ChipOpenPending poll command (%02X)\n", + ec->name, ec->state); + ec->state = WAN_EC_STATE_READY; + ec_dev->state = ec->state; + ec_dev->poll_cmd = WAN_EC_POLL_NONE; + err = -EINVAL; + goto wanec_poll_done; + } if (wanec_ChipOpen(ec_dev, WAN_EC_VERBOSE_NONE)){ + ec->f_OpenChip.pbyImageFile = NULL; + if (ec->pImageData) wan_vfree(ec->pImageData); + ec->pImageData = NULL; /* Chip state is Ready state */ - ec->state = WAN_OCT6100_STATE_READY; + ec->state = WAN_EC_STATE_READY; ec_dev->state = ec->state; ec_dev->poll_cmd = WAN_EC_POLL_NONE; err = -EINVAL; goto wanec_poll_done; } - ec->state = WAN_OCT6100_STATE_CHIP_OPEN; + ec->state = WAN_EC_STATE_CHIP_OPEN; ec_dev->state = ec->state; + + ec->f_OpenChip.pbyImageFile = NULL; + if (ec->pImageData) wan_vfree(ec->pImageData); + ec->pImageData = NULL; break; case WAN_EC_POLL_INTR: default: /* by default, can be only schedule from interrupt */ - if (ec->state != WAN_OCT6100_STATE_CHIP_READY){ + if (ec->state != WAN_EC_STATE_CHIP_READY){ break; } - if ((wan_test_bit(WAN_EC_BIT_CRIT_DOWN, &ec_dev->critical)) || - (wan_test_bit(WAN_EC_BIT_CRIT_ERROR, &ec_dev->critical)) || - (wan_test_bit(WAN_EC_BIT_CRIT_CMD, &ec->critical))) { + if (wan_test_bit(WAN_EC_BIT_CRIT_CMD, &ec->critical)) { err = -EINVAL; break; } /* Execute interrupt routine */ - if (wanec_ISR(ec, global_verbose)){ + err = wanec_ISR(ec, wanec_verbose); + if (err < 0){ wan_set_bit(WAN_EC_BIT_CRIT_ERROR, &ec->critical); wan_set_bit(WAN_EC_BIT_CRIT,(void*)&ec_dev->critical); err = -EINVAL; @@ -1713,19 +1936,25 @@ static int wanec_event_ctrl(void *arg, void *pcard, wan_event_ctrl_t *event_ctrl WAN_ASSERT(event_ctrl == NULL); ec = ec_dev->ec; + wan_spin_lock(&ec->lock); if (wan_test_and_set_bit(WAN_EC_BIT_CRIT_CMD, &ec->critical)){ + wan_spin_unlock(&ec->lock); return -EBUSY; } switch(event_ctrl->type){ case WAN_EVENT_EC_DTMF: - DEBUG_EVENT("%s: %s DTMF events\n", - ec_dev->devname, - WAN_EVENT_MODE_DECODE(event_ctrl->mode)); if (event_ctrl->mode == WAN_EVENT_ENABLE){ - wan_set_bit(WAN_EC_BIT_EVENT_DTMF, &ec_dev->events); + wanec_channel_dtmf(ec_dev, event_ctrl->channel, WAN_TRUE, NULL, WAN_EC_VERBOSE_EXTRA2/*wanec_verbose*/); }else{ - wan_clear_bit(WAN_EC_BIT_EVENT_DTMF, &ec_dev->events); + wanec_channel_dtmf(ec_dev, event_ctrl->channel, WAN_FALSE, NULL, wanec_verbose); + } + break; + case WAN_EVENT_EC_H100_REPORT: + if (event_ctrl->mode == WAN_EVENT_DISABLE){ + ec->ignore_H100 = 1; + }else{ + ec->ignore_H100 = 0; } break; default: @@ -1738,6 +1967,7 @@ static int wanec_event_ctrl(void *arg, void *pcard, wan_event_ctrl_t *event_ctrl #endif } wan_clear_bit(WAN_EC_BIT_CRIT_CMD, &ec->critical); + wan_spin_unlock(&ec->lock); return err; } @@ -1768,39 +1998,57 @@ int wanec_init(void *arg) wanec_iface.reg = wanec_register; wanec_iface.unreg = wanec_unregister; wanec_iface.ioctl = NULL; - wanec_iface.isr = NULL; // wanec_isr; + wanec_iface.isr = wanec_isr; wanec_iface.poll = wanec_poll; wanec_iface.event_ctrl = wanec_event_ctrl; +#if defined(CONFIG_WANPIPE_HWEC) register_wanec_iface (&wanec_iface); - -#if defined(__FreeBSD__) || defined(__OpenBSD__) +# if defined(__FreeBSD__) || defined(__OpenBSD__) wp_cdev_reg(NULL, WANEC_DEV_NAME, wanec_ioctl); -#elif defined(__LINUX__) || defined(__WINDOWS__) +# elif defined(__LINUX__) || defined(__WINDOWS__) wanec_create_dev(); +# endif #endif return 0; } int wanec_exit (void *arg) { -#if defined(__FreeBSD__) || defined(__OpenBSD__) +#if defined(CONFIG_WANPIPE_HWEC) +# if defined(__FreeBSD__) || defined(__OpenBSD__) wp_cdev_unreg(WANEC_DEV_NAME); -#elif defined(__LINUX__) || defined(__WINDOWS__) +# elif defined(__LINUX__) || defined(__WINDOWS__) wanec_remove_dev(); -#endif +# endif unregister_wanec_iface(); +#endif DEBUG_EVENT("WANEC Layer: Unloaded\n"); return 0; } +#if 0 +int wanec_shutdown(void *arg) +{ + DEBUG_EVENT("Shutting down WANEC module ...\n"); + return 0; +} + +int wanec_ready_unload(void *arg) +{ + DEBUG_EVENT("Is WANEC module ready to unload...\n"); + return 0; +} +#endif + #if !defined(__WINDOWS__) WAN_MODULE_DEFINE( wanec,"wanec", "Alex Feldman ", "Wanpipe Echo Canceller Layer - Sangoma Tech. Copyright 2006", "GPL", - wanec_init, wanec_exit, NULL); + wanec_init, wanec_exit, /*wanec_shutdown, wanec_ready_unload,*/ + NULL); WAN_MODULE_DEPEND(wanec, wanrouter, 1, WANROUTER_MAJOR_VER, WANROUTER_MAJOR_VER); diff --git a/patches/kdrivers/wanec/wanec_iface.h b/patches/kdrivers/wanec/wanec_iface.h index 346938e..3d9672f 100644 --- a/patches/kdrivers/wanec/wanec_iface.h +++ b/patches/kdrivers/wanec/wanec_iface.h @@ -1,5 +1,5 @@ /****************************************************************************** - * wanec_lip.h + * wanec_iface.h * * Author: Alex Feldman * @@ -13,10 +13,11 @@ ****************************************************************************** */ -#ifndef __WANEC_LIP_H -# define __WANEC_LIP_H +#ifndef __WANEC_IFACE_H +# define __WANEC_IFACE_H #if defined(__LINUX__) +# include # include #elif defined(__WINDOWS__) @@ -27,6 +28,8 @@ # include #endif +#define MAX_EC_CHANS 256 + # include # include # include @@ -34,21 +37,12 @@ #elif defined(__FreeBSD__) || defined(__OpenBSD__) # include #endif + +#if defined(__WINDOWS__) +#include +#else #include "oct6100api/oct6100_api.h" - -#define WANEC_BYDEFAULT_NORMAL - -#define WANEC_DEV_DIR "/dev/" -#define WANEC_DEV_NAME "wanec" - -#define MAX_CHANNELS_LEN 50 - -#define MAX_PARAM_LEN 50 -#define MAX_VALUE_LEN 50 - -#define WAN_NUM_DTMF_TONES 16 -#define WAN_NUM_PLAYOUT_TONES 16 -#define WAN_MAX_TONE_LEN 100 +#endif #define WAN_EC_VERBOSE_NONE 0x00 #define WAN_EC_VERBOSE_EXTRA1 0x01 @@ -57,206 +51,121 @@ #define WAN_EC_VERBOSE_MASK_EXTRA2 0x03 #define WAN_EC_VERBOSE(ec_api) (ec_api)?ec_api->verbose:WAN_EC_VERBOSE_NONE -#if defined(__WINDOWS__) -#define PRINT1 Debug -#define PRINT2 Debug -#else -#define PRINT(v, format,msg...) \ - DEBUG_EVENT(format, ##msg) -#define PRINT1(v,format,msg...) \ - if (v & WAN_EC_VERBOSE_EXTRA1) DEBUG_EVENT(format,##msg) -#define PRINT2(v,format,msg...) \ - if (v & WAN_EC_VERBOSE_EXTRA2) DEBUG_EVENT(format,##msg) -#endif +#define WAN_EC_RC_OK 0x0000 +#define WAN_EC_RC_CPU_INTERFACE_NO_RESPONSE 0x0001 +#define WAN_EC_RC_MEMORY 0x0002 -#define WAN_OCT6100_RC_OK 0x0000 -#define WAN_OCT6100_RC_CPU_INTERFACE_NO_RESPONSE 0x0001 -#define WAN_OCT6100_RC_MEMORY 0x0002 -/* WANPIPE EC API return code */ -#define WAN_EC_API_RC_OK 0x0000 -#define WAN_EC_API_RC_FAILED 0x0001 -#define WAN_EC_API_RC_INVALID_CMD 0x0002 -#define WAN_EC_API_RC_INVALID_STATE 0x0003 -#define WAN_EC_API_RC_INVALID_DEV 0x0004 -#define WAN_EC_API_RC_INVALID_CHANNELS 0x0005 -#define WAN_EC_API_RC_BUSY 0x0006 -#define WAN_EC_API_RC_NOACTION 0x0007 -#define WAN_EC_API_RC_DECODE(err) \ - (err == WAN_EC_API_RC_OK) ? "OK" : \ - (err == WAN_EC_API_RC_FAILED) ? "Failed" : \ - (err == WAN_EC_API_RC_INVALID_CMD) ? "Invalid Cmd" : \ - (err == WAN_EC_API_RC_INVALID_STATE) ? "Invalid State" : \ - (err == WAN_EC_API_RC_INVALID_DEV) ? "Invalid Device" : \ - (err == WAN_EC_API_RC_INVALID_CHANNELS) ? "Invalid Channels" : \ - (err == WAN_EC_API_RC_BUSY) ? "Busy" : \ - (err == WAN_EC_API_RC_NOACTION) ? "No action" : \ - "Unknown RC" - -/* OCT6100 state machine */ +/* Internal EC chip state machine */ enum { - WAN_OCT6100_STATE_NONE = 0x00, - WAN_OCT6100_STATE_RESET, - WAN_OCT6100_STATE_READY, - WAN_OCT6100_STATE_CHIP_OPEN_PENDING, - WAN_OCT6100_STATE_CHIP_OPEN, - WAN_OCT6100_STATE_CHIP_READY + WAN_EC_STATE_NONE = 0x00, + WAN_EC_STATE_RESET, + WAN_EC_STATE_READY, + WAN_EC_STATE_CHIP_OPEN_PENDING, + WAN_EC_STATE_CHIP_OPEN, + WAN_EC_STATE_CHIP_READY }; -#define WAN_OCT6100_STATE_DECODE(state) \ - (state == WAN_OCT6100_STATE_RESET) ? "Reset" : \ - (state == WAN_OCT6100_STATE_READY) ? "Ready" : \ - (state == WAN_OCT6100_STATE_CHIP_OPEN_PENDING) ? "Chip Open Pending" : \ - (state == WAN_OCT6100_STATE_CHIP_OPEN) ? "Chip Open" : \ - (state == WAN_OCT6100_STATE_CHIP_READY) ? "Chip Ready" : \ +#define WAN_EC_STATE_DECODE(state) \ + (state == WAN_EC_STATE_RESET) ? "Reset" : \ + (state == WAN_EC_STATE_READY) ? "Ready" : \ + (state == WAN_EC_STATE_CHIP_OPEN_PENDING) ? "Chip Open Pending" : \ + (state == WAN_EC_STATE_CHIP_OPEN) ? "Chip Open" : \ + (state == WAN_EC_STATE_CHIP_READY) ? "Chip Ready" : \ "Unknown" -#define WAN_EC_SOUT_DTMF_1 0x40000011 -#define WAN_EC_SOUT_DTMF_2 0x40000012 -#define WAN_EC_SOUT_DTMF_3 0x40000013 -#define WAN_EC_SOUT_DTMF_A 0x4000001A -#define WAN_EC_SOUT_DTMF_4 0x40000014 -#define WAN_EC_SOUT_DTMF_5 0x40000015 -#define WAN_EC_SOUT_DTMF_6 0x40000016 -#define WAN_EC_SOUT_DTMF_B 0x4000001B -#define WAN_EC_SOUT_DTMF_7 0x40000017 -#define WAN_EC_SOUT_DTMF_8 0x40000018 -#define WAN_EC_SOUT_DTMF_9 0x40000019 -#define WAN_EC_SOUT_DTMF_C 0x4000001C -#define WAN_EC_SOUT_DTMF_STAR 0x4000001E -#define WAN_EC_SOUT_DTMF_0 0x40000010 -#define WAN_EC_SOUT_DTMF_POUND 0x4000001F -#define WAN_EC_SOUT_DTMF_D 0x4000001D -#define WAN_EC_ROUT_DTMF_1 0x10000011 -#define WAN_EC_ROUT_DTMF_2 0x10000012 -#define WAN_EC_ROUT_DTMF_3 0x10000013 -#define WAN_EC_ROUT_DTMF_A 0x1000001A -#define WAN_EC_ROUT_DTMF_4 0x10000014 -#define WAN_EC_ROUT_DTMF_5 0x10000015 -#define WAN_EC_ROUT_DTMF_6 0x10000016 -#define WAN_EC_ROUT_DTMF_B 0x1000001B -#define WAN_EC_ROUT_DTMF_7 0x10000017 -#define WAN_EC_ROUT_DTMF_8 0x10000018 -#define WAN_EC_ROUT_DTMF_9 0x10000019 -#define WAN_EC_ROUT_DTMF_C 0x1000001C -#define WAN_EC_ROUT_DTMF_STAR 0x1000001E -#define WAN_EC_ROUT_DTMF_0 0x10000010 -#define WAN_EC_ROUT_DTMF_POUND 0x1000001F -#define WAN_EC_ROUT_DTMF_D 0x1000001D -#define WAN_EC_DECODE_DTMF_ID(id) \ - (id == WAN_EC_SOUT_DTMF_0) ? "SOUT_0" : \ - (id == WAN_EC_SOUT_DTMF_1) ? "SOUT_1" : \ - (id == WAN_EC_SOUT_DTMF_2) ? "SOUT_2" : \ - (id == WAN_EC_SOUT_DTMF_3) ? "SOUT_3" : \ - (id == WAN_EC_SOUT_DTMF_4) ? "SOUT_4" : \ - (id == WAN_EC_SOUT_DTMF_5) ? "SOUT_5" : \ - (id == WAN_EC_SOUT_DTMF_6) ? "SOUT_6" : \ - (id == WAN_EC_SOUT_DTMF_7) ? "SOUT_7" : \ - (id == WAN_EC_SOUT_DTMF_8) ? "SOUT_8" : \ - (id == WAN_EC_SOUT_DTMF_9) ? "SOUT_9" : \ - (id == WAN_EC_SOUT_DTMF_A) ? "SOUT_A" : \ - (id == WAN_EC_SOUT_DTMF_B) ? "SOUT_B" : \ - (id == WAN_EC_SOUT_DTMF_C) ? "SOUT_C" : \ - (id == WAN_EC_SOUT_DTMF_D) ? "SOUT_D" : \ - (id == WAN_EC_SOUT_DTMF_STAR) ? "SOUT_STAR" : \ - (id == WAN_EC_SOUT_DTMF_POUND) ? "SOUT_POUND" :\ - (id == WAN_EC_ROUT_DTMF_0) ? "ROUT_0" : \ - (id == WAN_EC_ROUT_DTMF_1) ? "ROUT_1" : \ - (id == WAN_EC_ROUT_DTMF_2) ? "ROUT_2" : \ - (id == WAN_EC_ROUT_DTMF_3) ? "ROUT_3" : \ - (id == WAN_EC_ROUT_DTMF_4) ? "ROUT_4" : \ - (id == WAN_EC_ROUT_DTMF_5) ? "ROUT_5" : \ - (id == WAN_EC_ROUT_DTMF_6) ? "ROUT_6" : \ - (id == WAN_EC_ROUT_DTMF_7) ? "ROUT_7" : \ - (id == WAN_EC_ROUT_DTMF_8) ? "ROUT_8" : \ - (id == WAN_EC_ROUT_DTMF_9) ? "ROUT_9" : \ - (id == WAN_EC_ROUT_DTMF_A) ? "ROUT_A" : \ - (id == WAN_EC_ROUT_DTMF_B) ? "ROUT_B" : \ - (id == WAN_EC_ROUT_DTMF_C) ? "ROUT_C" : \ - (id == WAN_EC_ROUT_DTMF_D) ? "ROUT_D" : \ - (id == WAN_EC_ROUT_DTMF_STAR) ? "ROUT_STAR" : \ - (id == WAN_EC_ROUT_DTMF_POUND) ? "ROUT_POUND" :\ - "Unknown" +#define WAN_NUM_DTMF_TONES 16 +#define WAN_NUM_PLAYOUT_TONES 16 +#define WAN_MAX_TONE_LEN 100 +typedef struct wanec_config_ +{ + u_int16_t max_channels; + int memory_chip_size; + UINT32 debug_data_mode; + PUINT8 imageData; + UINT32 imageSize; + int imageLast; -#if defined(__WINDOWS__) -# define WAN_EC_CMD_NONE 0 -# define WAN_EC_CMD_GETINFO 1 -# define WAN_EC_CMD_CONFIG 2 -# define WAN_EC_CMD_CHANNEL_OPEN 3 -# define WAN_EC_CMD_RELEASE 4 -# define WAN_EC_CMD_ENABLE 5 -# define WAN_EC_CMD_DISABLE 6 -# define WAN_EC_CMD_BYPASS_ENABLE 7 -# define WAN_EC_CMD_BYPASS_DISABLE 8 -# define WAN_EC_CMD_MODE_NORMAL 9 -# define WAN_EC_CMD_MODE_POWERDOWN 10 -# define WAN_EC_CMD_MODIFY_CHANNEL 11 -# define WAN_EC_CMD_DTMF_ENABLE 12 -# define WAN_EC_CMD_DTMF_DISABLE 13 -# define WAN_EC_CMD_STATS 14 -# define WAN_EC_CMD_STATS_FULL 15 -# define WAN_EC_CMD_TONE_LOAD 16 -# define WAN_EC_CMD_TONE_UNLOAD 17 -# define WAN_EC_CMD_PLAYOUT_START 18 -# define WAN_EC_CMD_PLAYOUT_STOP 19 -# define WAN_EC_CMD_MONITOR 20 -# define WAN_EC_CMD_RELEASE_ALL 21 -#else -# define WAN_EC_CMD_NONE _IOWR('E', 0, struct wan_ec_api_) -# define WAN_EC_CMD_GETINFO _IOWR('E', 1, wan_ec_api_t) -# define WAN_EC_CMD_CONFIG _IOWR('E', 2, struct wan_ec_api_) -# define WAN_EC_CMD_CHANNEL_OPEN _IOWR('E', 3, struct wan_ec_api_) -# define WAN_EC_CMD_RELEASE _IOWR('E', 4, struct wan_ec_api_) -# define WAN_EC_CMD_ENABLE _IOWR('E', 5, struct wan_ec_api_) -# define WAN_EC_CMD_DISABLE _IOWR('E', 6, struct wan_ec_api_) -# define WAN_EC_CMD_BYPASS_ENABLE _IOWR('E', 7, struct wan_ec_api_) -# define WAN_EC_CMD_BYPASS_DISABLE _IOWR('E', 8, struct wan_ec_api_) -# define WAN_EC_CMD_MODE_NORMAL _IOWR('E', 9, struct wan_ec_api_) -# define WAN_EC_CMD_MODE_POWERDOWN _IOWR('E', 10, struct wan_ec_api_) -# define WAN_EC_CMD_MODIFY_CHANNEL _IOWR('E', 11, struct wan_ec_api_) -# define WAN_EC_CMD_DTMF_ENABLE _IOWR('E', 12, struct wan_ec_api_) -# define WAN_EC_CMD_DTMF_DISABLE _IOWR('E', 13, struct wan_ec_api_) -# define WAN_EC_CMD_STATS _IOWR('E', 14, struct wan_ec_api_) -# define WAN_EC_CMD_STATS_FULL _IOWR('E', 15, struct wan_ec_api_) -# define WAN_EC_CMD_TONE_LOAD _IOWR('E', 16, struct wan_ec_api_) -# define WAN_EC_CMD_TONE_UNLOAD _IOWR('E', 17, struct wan_ec_api_) -# define WAN_EC_CMD_PLAYOUT_START _IOWR('E', 18, struct wan_ec_api_) -# define WAN_EC_CMD_PLAYOUT_STOP _IOWR('E', 19, struct wan_ec_api_) -# define WAN_EC_CMD_MONITOR _IOWR('E', 20, struct wan_ec_api_) -# define WAN_EC_CMD_RELEASE_ALL _IOWR('E', 21, struct wan_ec_api_) -#endif + wan_custom_conf_t custom_conf; +} wanec_config_t; -# define WAN_EC_CMD_DECODE(cmd) \ - (cmd == WAN_EC_CMD_GETINFO) ? "Get Info" : \ - (cmd == WAN_EC_CMD_CONFIG) ? "Config" : \ - (cmd == WAN_EC_CMD_CHANNEL_OPEN) ? "Channel Open" : \ - (cmd == WAN_EC_CMD_ENABLE) ? "Enable" : \ - (cmd == WAN_EC_CMD_DISABLE) ? "Disable" : \ - (cmd == WAN_EC_CMD_BYPASS_ENABLE) ? "Enable bypass" : \ - (cmd == WAN_EC_CMD_BYPASS_DISABLE) ? "Disable bypass" : \ - (cmd == WAN_EC_CMD_MODE_NORMAL) ? "Mode Normal" : \ - (cmd == WAN_EC_CMD_MODE_POWERDOWN) ? "Mode PowerDown" : \ - (cmd == WAN_EC_CMD_STATS) ? "Get stats" : \ - (cmd == WAN_EC_CMD_STATS_FULL) ? "Get stats" : \ - (cmd == WAN_EC_CMD_TONE_LOAD) ? "Tone load" : \ - (cmd == WAN_EC_CMD_TONE_UNLOAD) ? "Tone unload" : \ - (cmd == WAN_EC_CMD_PLAYOUT_START) ? "Playout start" : \ - (cmd == WAN_EC_CMD_PLAYOUT_STOP) ? "Playout stop" : \ - (cmd == WAN_EC_CMD_RELEASE) ? "Release" : \ - (cmd == WAN_EC_CMD_RELEASE_ALL) ? "Release all" : \ - (cmd == WAN_EC_CMD_MONITOR) ? "MONITOR" : \ - (cmd == WAN_EC_CMD_MODIFY_CHANNEL) ? "MODIFY" : \ - (cmd == WAN_EC_CMD_DTMF_ENABLE) ? "Enable DTMF" : \ - (cmd == WAN_EC_CMD_DTMF_DISABLE) ? "Disable DTMF" : \ - "Unknown" +typedef struct wanec_config_poll_ +{ + int cnt; +} wanec_config_poll_t; + +typedef struct wanec_chip_stats_ +{ + int reset; + tOCT6100_CHIP_STATS f_ChipStats; + tOCT6100_CHIP_IMAGE_INFO *f_ChipImageInfo; +} wanec_chip_stats_t; + +typedef struct wanec_chan_opmode_ +{ + UINT32 opmode; +} wanec_chan_opmode_t; + +typedef struct wanec_chan_mute_ +{ + unsigned char port_map; + +} wanec_chan_mute_t; + +typedef struct wanec_chan_custom_ +{ + int custom; + wan_custom_conf_t custom_conf; +} wanec_chan_custom_t; + +typedef struct wanec_chan_stats_ +{ + int reset; + tOCT6100_CHANNEL_STATS f_ChannelStats; +} wanec_chan_stats_t; + +#define MAX_MONITOR_DATA_LEN 1024 +typedef struct wanec_chan_monitor_ +{ + int fe_chan; + UINT32 remain_len; + UINT32 data_len; + UINT32 max_len; + UINT8 data[MAX_MONITOR_DATA_LEN+1]; +} wanec_chan_monitor_t; + +typedef struct wanec_buffer_config_ +{ + UINT8 buffer[WAN_MAX_TONE_LEN]; + PUINT8 data; + UINT32 size; + UINT32 pcmlaw; + UINT32 buffer_index; /* value return by ec */ +} wanec_buffer_config_t; + +#define MAX_EC_PLAYOUT_LEN 20 +typedef struct wanec_playout_ +{ + UINT32 index; + UINT8 port; + UINT32 duration; + BOOL repeat; + UINT32 repeat_cnt; + UINT32 buffer_length; + INT32 gaindb; + BOOL notifyonstop; + UINT32 user_event_id; + + CHAR str[MAX_EC_PLAYOUT_LEN]; + UINT32 delay; +} wanec_playout_t; + +typedef struct wanec_dtmf_config_ +{ + u_int8_t port_map; /* SOUT/ROUT */ + u_int8_t type; /* PRESENT or STOP */ +} wanec_dtmf_config_t; -#if 0 -enum { - WAN_OCT6100_BYPASS = 0x01, - WAN_OCT6100_BYPASS_FULL, - WAN_OCT6100_BYPASS_LINE, -}; -#endif /*===========================================================================*\ User process context - This would probably have to be defined elsewhere. @@ -297,103 +206,22 @@ typedef struct _OCTPCIDRV_USER_PROCESS_CONTEXT_ } tOCTPCIDRV_USER_PROCESS_CONTEXT, *tPOCTPCIDRV_USER_PROCESS_CONTEXT; -typedef struct wanec_config_ { - int max_channels; - int memory_chip_size; - UINT32 debug_data_mode; - PUINT8 imageData; - UINT32 imageSize; - int imageLast; -} wanec_config_t; - -typedef struct wanec_param_ { - char key[MAX_PARAM_LEN]; - char value[MAX_VALUE_LEN]; - UINT32 value1; -} wanec_param_t; - -typedef struct wanec_chip_stats_ { - int reset; - tOCT6100_CHIP_STATS f_ChipStats; - tOCT6100_CHIP_IMAGE_INFO *f_ChipImageInfo; -} wanec_chip_stats_t; - -typedef struct wanec_chan_stats_ { - int reset; - tOCT6100_CHANNEL_STATS f_ChannelStats; -} wanec_chan_stats_t; - -#define MAX_MONITOR_DATA_LEN 1024 -typedef struct wanec_chan_monitor_ { - UINT32 remain_len; - UINT32 data_len; - UINT32 max_len; - UINT8 data[MAX_MONITOR_DATA_LEN+1]; -} wanec_chan_monitor_t; - -typedef struct wanec_tone_config_ { - UINT8 tone[WAN_MAX_TONE_LEN]; - PUINT8 data; - UINT32 size; - UINT32 buffer_index; /* value return by ec */ -} wanec_tone_config_t; - -typedef struct wanec_dtmf_config { - u_int8_t port; /* SOUT or ROUT */ - u_int8_t type; /* PRESENT or STOP */ -} wanec_dtmf_config_t; - -#define MAX_EC_PLAYOUT_LEN 20 -typedef struct wanec_playout_ { - UINT32 index; - UINT32 duration; - BOOL repeat; - UINT32 repeat_count; - UINT32 buffer_length; - INT32 gaindb; - - CHAR str[MAX_EC_PLAYOUT_LEN]; - UINT32 delay; -} wanec_playout_t; - -typedef struct wan_ec_api_ { - char devname[WAN_DRVNAME_SZ+1]; - unsigned long cmd; - unsigned int type; - int err; - int verbose; - int state; - - int channel; - unsigned long channel_map; - - union { -#define u_info u_ec.info -#define u_config u_ec.config -#define u_chip_stats u_ec.chip_stats -#define u_chan_stats u_ec.chan_stats -#define u_chan_monitor u_ec.chan_monitor -#define u_tone_config u_ec.tone_config -#define u_dtmf_config u_ec.dtmf_config -#define u_playout u_ec.playout - struct info_ { - unsigned int max_channels; - } info; - wanec_config_t config; - wanec_chip_stats_t chip_stats; - wanec_chan_stats_t chan_stats; - wanec_chan_monitor_t chan_monitor; - wanec_tone_config_t tone_config; - wanec_dtmf_config_t dtmf_config; - wanec_playout_t playout; - } u_ec; - int param_no; - wanec_param_t param[2]; -} wan_ec_api_t; - - #if defined(WAN_KERNEL) +#if defined(__WINDOWS__) +# define PRINT1 if(0)Debug +# define PRINT2 if(0)Debug +#else +# define PRINT1(v,format,msg...) \ + if (v & WAN_EC_VERBOSE_EXTRA1) DEBUG_EVENT(format,##msg) +# define PRINT2(v,format,msg...) \ + if (v & WAN_EC_VERBOSE_EXTRA2) DEBUG_EVENT(format,##msg) +#endif + +#define WANEC_IGNORE (TRUE+1) + +#define WANEC_BYDEFAULT_NORMAL + /* Critical bit map */ #define WAN_EC_BIT_TIMER_RUNNING 1 #define WAN_EC_BIT_TIMER_KILL 2 @@ -403,13 +231,26 @@ typedef struct wan_ec_api_ { #define WAN_EC_BIT_CRIT 6 #define WAN_EC_BIT_EVENT_DTMF 4 +#define WAN_EC_BIT_EVENT_PLAYOUT 5 #define WAN_EC_POLL_NONE 0x00 #define WAN_EC_POLL_INTR 0x01 #define WAN_EC_POLL_CHIPOPENPENDING 0x02 +#define WAN_EC_POLL_DTMF_MUTE_ON 0x03 +#define WAN_EC_POLL_DTMF_MUTE_OFF 0x04 + +typedef +struct wan_ec_confbridge_ +{ + UINT32 ulHndl; + + WAN_LIST_ENTRY(wan_ec_confbridge_) next; +} wan_ec_confbridge_t; + struct wan_ec_; -typedef struct wan_ec_dev_ { +typedef struct wan_ec_dev_ +{ char *name; char devname[WAN_DRVNAME_SZ+1]; char ecdev_name[WAN_DRVNAME_SZ+1]; @@ -418,37 +259,51 @@ typedef struct wan_ec_dev_ { u_int8_t fe_media; u_int32_t fe_lineno; - u_int32_t fe_max_channels; + int fe_start_chan, fe_stop_chan; + int fe_max_chans; + u_int32_t fe_channel_map; + u_int32_t fe_ec_map; u_int32_t fe_tdmv_law; u_int32_t channel; int state; u_int32_t critical; wan_timer_t timer; + u_int8_t poll_cmd; + int poll_channel; u_int32_t events; /* enable events map */ - + wan_ticks_t lastint_ticks; + struct wan_ec_ *ec; WAN_LIST_ENTRY(wan_ec_dev_) next; } wan_ec_dev_t; -typedef struct wan_ec_ { +typedef struct wan_ec_ +{ char name[WAN_DRVNAME_SZ+1]; int usage; int chip_no; int state; int ec_active; - int max_channels; /* max number of ec channels (security) */ + u_int16_t max_channels; /* max number of ec channels (security) */ + int confbridges_no; /* number of opened conf bridges */ void *ec_dev; u_int32_t intcount; u_int32_t critical; + int ignore_H100; /* Temporary for BRI card */ + wan_spinlock_t lock; u_int32_t events; /* enable events map */ - + int tone_verbose; /* verbose mode for tone events */ + int playout_verbose; /* verbose mode for playout events */ + PUINT8 pImageData; + UINT32 ImageSize; int imageLast; + wan_custom_conf_t custom_conf; tOCT6100_CHIP_OPEN f_OpenChip; tOCTPCIDRV_USER_PROCESS_CONTEXT f_Context; @@ -459,9 +314,13 @@ typedef struct wan_ec_ { UINT32 ulDebugChannelHndl; INT DebugChannel; UINT32 ulDebugDataMode; - +#if defined(__WINDOWS__) + struct wan_ec_dev_ *pEcDevMap[MAX_EC_CHANS]; +#else struct wan_ec_dev_ **pEcDevMap; - WAN_LIST_HEAD(wan_ec_dev_head_, wan_ec_dev_) ec_dev_head; +#endif + WAN_LIST_HEAD(wan_ec_dev_head_, wan_ec_dev_) ec_dev_head; + WAN_LIST_HEAD(wan_ec_confbridge_head_, wan_ec_confbridge_) ec_confbridge_head; WAN_LIST_ENTRY(wan_ec_) next; } wan_ec_t; @@ -493,4 +352,4 @@ u32 wan_ec_req_read_burst(void*, u32 addr, u16 *data, u32 len); #endif -#endif /* __WANEC_LIP_H */ +#endif /* __WANEC_IFACE_H */ diff --git a/patches/kdrivers/wanec/wanec_iface_api.h b/patches/kdrivers/wanec/wanec_iface_api.h new file mode 100644 index 0000000..c7d3b06 --- /dev/null +++ b/patches/kdrivers/wanec/wanec_iface_api.h @@ -0,0 +1,197 @@ +/****************************************************************************** + * wanec_iface_api.h + * + * Author: Alex Feldman + * + * Copyright: (c) 1995-2001 Sangoma Technologies 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. + * ============================================================================ + ****************************************************************************** + */ + +#ifndef __WANEC_IFACE_API_H +# define __WANEC_IFACE_API_H + +#if defined(__LINUX__) +# include +# include +# include +#elif defined(__WINDOWS__) + +#if defined(__KERNEL__) +# define _DEBUG +# include +#else +# include +#endif + +# include +# include +# include + +# include + +#elif defined(__FreeBSD__) || defined(__OpenBSD__) +# include +# include +#endif +#include "oct6100api/oct6100_api.h" + +#define WANEC_BYDEFAULT_NORMAL + +#define WANEC_API_MAX_CONFIG_POLL 20 + +#define WANEC_DEV_DIR "/dev/" +#define WANEC_DEV_NAME "wanec" + +/* WANPIPE EC API return code */ +#define WAN_EC_API_RC_OK 0x0000 +#define WAN_EC_API_RC_FAILED 0x0001 +#define WAN_EC_API_RC_INVALID_CMD 0x0002 +#define WAN_EC_API_RC_INVALID_STATE 0x0003 +#define WAN_EC_API_RC_INVALID_DEV 0x0004 +#define WAN_EC_API_RC_INVALID_CHANNELS 0x0005 +#define WAN_EC_API_RC_BUSY 0x0006 +#define WAN_EC_API_RC_NOACTION 0x0007 +#define WAN_EC_API_RC_INVALID_PORT 0x0008 +#define WAN_EC_API_RC_DECODE(err) \ + (err == WAN_EC_API_RC_OK) ? "OK" : \ + (err == WAN_EC_API_RC_FAILED) ? "Failed" : \ + (err == WAN_EC_API_RC_INVALID_CMD) ? "Invalid Cmd" : \ + (err == WAN_EC_API_RC_INVALID_STATE) ? "Invalid State" : \ + (err == WAN_EC_API_RC_INVALID_DEV) ? "Invalid Device" : \ + (err == WAN_EC_API_RC_INVALID_CHANNELS) ? "Invalid Channels" : \ + (err == WAN_EC_API_RC_BUSY) ? "Busy" : \ + (err == WAN_EC_API_RC_NOACTION) ? "No action" : \ + (err == WAN_EC_API_RC_INVALID_PORT) ? "Invalid Port" : \ + "Unknown RC" + +#if defined(__WINDOWS__) +# define WAN_EC_API_CMD_NONE 0 +# define WAN_EC_API_CMD_GETINFO 1 +# define WAN_EC_API_CMD_CONFIG 2 +# define WAN_EC_API_CMD_CHANNEL_OPEN 3 +# define WAN_EC_API_CMD_RELEASE 4 +# define WAN_EC_API_CMD_ENABLE 5 +# define WAN_EC_API_CMD_DISABLE 6 +# define WAN_EC_API_CMD_BYPASS_ENABLE 7 +# define WAN_EC_API_CMD_BYPASS_DISABLE 8 +# define WAN_EC_API_CMD_OPMODE 9 +# define WAN_EC_API_CMD_MODIFY_CHANNEL 10 +# define WAN_EC_API_CMD_DTMF_ENABLE 11 +# define WAN_EC_API_CMD_DTMF_DISABLE 12 +# define WAN_EC_API_CMD_STATS 13 +# define WAN_EC_API_CMD_STATS_FULL 14 +# define WAN_EC_API_CMD_BUFFER_LOAD 15 +# define WAN_EC_API_CMD_BUFFER_UNLOAD 16 +# define WAN_EC_API_CMD_PLAYOUT_START 17 +# define WAN_EC_API_CMD_PLAYOUT_STOP 18 +# define WAN_EC_API_CMD_MONITOR 19 +# define WAN_EC_API_CMD_RELEASE_ALL 20 +# define WAN_EC_API_CMD_CONFIG_POLL 21 +# define WAN_EC_API_CMD_CHANNEL_MUTE 22 +# define WAN_EC_API_CMD_CHANNEL_UNMUTE 23 +#else +# define WAN_EC_API_CMD_NONE _IOWR('E', 0, struct wan_ec_api_) +# define WAN_EC_API_CMD_GETINFO _IOWR('E', 1, wan_ec_api_t) +# define WAN_EC_API_CMD_CONFIG _IOWR('E', 2, struct wan_ec_api_) +# define WAN_EC_API_CMD_CHANNEL_OPEN _IOWR('E', 3, struct wan_ec_api_) +# define WAN_EC_API_CMD_RELEASE _IOWR('E', 4, struct wan_ec_api_) +# define WAN_EC_API_CMD_ENABLE _IOWR('E', 5, struct wan_ec_api_) +# define WAN_EC_API_CMD_DISABLE _IOWR('E', 6, struct wan_ec_api_) +# define WAN_EC_API_CMD_BYPASS_ENABLE _IOWR('E', 7, struct wan_ec_api_) +# define WAN_EC_API_CMD_BYPASS_DISABLE _IOWR('E', 8, struct wan_ec_api_) +# define WAN_EC_API_CMD_OPMODE _IOWR('E', 9, struct wan_ec_api_) +# define WAN_EC_API_CMD_MODIFY_CHANNEL _IOWR('E', 15, struct wan_ec_api_) +# define WAN_EC_API_CMD_DTMF_ENABLE _IOWR('E', 16, struct wan_ec_api_) +# define WAN_EC_API_CMD_DTMF_DISABLE _IOWR('E', 17, struct wan_ec_api_) +# define WAN_EC_API_CMD_STATS _IOWR('E', 18, struct wan_ec_api_) +# define WAN_EC_API_CMD_STATS_FULL _IOWR('E', 19, struct wan_ec_api_) +# define WAN_EC_API_CMD_BUFFER_LOAD _IOWR('E', 20, struct wan_ec_api_) +# define WAN_EC_API_CMD_BUFFER_UNLOAD _IOWR('E', 21, struct wan_ec_api_) +# define WAN_EC_API_CMD_PLAYOUT_START _IOWR('E', 22, struct wan_ec_api_) +# define WAN_EC_API_CMD_PLAYOUT_STOP _IOWR('E', 23, struct wan_ec_api_) +# define WAN_EC_API_CMD_MONITOR _IOWR('E', 24, struct wan_ec_api_) +# define WAN_EC_API_CMD_RELEASE_ALL _IOWR('E', 25, struct wan_ec_api_) +# define WAN_EC_API_CMD_CONFIG_POLL _IOWR('E', 26, struct wan_ec_api_) +# define WAN_EC_API_CMD_CHANNEL_MUTE _IOWR('E', 27, struct wan_ec_api_) +# define WAN_EC_API_CMD_CHANNEL_UNMUTE _IOWR('E', 28, struct wan_ec_api_) +#endif + +# define WAN_EC_API_CMD_DECODE(cmd) \ + (cmd == WAN_EC_API_CMD_GETINFO) ? "Get Info" : \ + (cmd == WAN_EC_API_CMD_CONFIG) ? "Config" : \ + (cmd == WAN_EC_API_CMD_CONFIG_POLL) ? "Config Poll" : \ + (cmd == WAN_EC_API_CMD_CHANNEL_OPEN) ? "Channel Open" : \ + (cmd == WAN_EC_API_CMD_ENABLE) ? "Enable" : \ + (cmd == WAN_EC_API_CMD_DISABLE) ? "Disable" : \ + (cmd == WAN_EC_API_CMD_BYPASS_ENABLE) ? "Enable bypass" : \ + (cmd == WAN_EC_API_CMD_BYPASS_DISABLE) ? "Disable bypass" : \ + (cmd == WAN_EC_API_CMD_OPMODE) ? "Modify EC OPMODE" : \ + (cmd == WAN_EC_API_CMD_STATS) ? "Get stats" : \ + (cmd == WAN_EC_API_CMD_STATS_FULL) ? "Get stats" : \ + (cmd == WAN_EC_API_CMD_BUFFER_LOAD) ? "Buffer load" : \ + (cmd == WAN_EC_API_CMD_BUFFER_UNLOAD) ? "Buffer unload" : \ + (cmd == WAN_EC_API_CMD_PLAYOUT_START) ? "Playout start" : \ + (cmd == WAN_EC_API_CMD_PLAYOUT_STOP) ? "Playout stop" : \ + (cmd == WAN_EC_API_CMD_RELEASE) ? "Release" : \ + (cmd == WAN_EC_API_CMD_RELEASE_ALL) ? "Release all" : \ + (cmd == WAN_EC_API_CMD_MONITOR) ? "MONITOR" : \ + (cmd == WAN_EC_API_CMD_MODIFY_CHANNEL) ? "MODIFY" : \ + (cmd == WAN_EC_API_CMD_DTMF_ENABLE) ? "Enable DTMF" : \ + (cmd == WAN_EC_API_CMD_DTMF_DISABLE) ? "Disable DTMF" : \ + (cmd == WAN_EC_API_CMD_CHANNEL_MUTE) ? "Channel Mute" : \ + (cmd == WAN_EC_API_CMD_CHANNEL_UNMUTE) ? "Channel Un-mute" : \ + "Unknown" + +#define WAN_ + +typedef struct wan_ec_api_ { + char devname[WAN_DRVNAME_SZ+1]; + unsigned long cmd; + unsigned int type; + int err; + int verbose; + int state; + + int fe_chan; + unsigned long fe_chan_map; + + union { +#define u_info u_ec.info +#define u_config u_ec.config +#define u_config_poll u_ec.config_poll +#define u_chip_stats u_ec.chip_stats +#define u_chan_opmode u_ec.chan_opmode +#define u_chan_mute u_ec.chan_mute +#define u_chan_custom u_ec.chan_custom +#define u_chan_stats u_ec.chan_stats +#define u_chan_monitor u_ec.chan_monitor +#define u_buffer_config u_ec.buffer_config +#define u_playout u_ec.playout +#define u_dtmf_config u_ec.dtmf_config + struct info_ { + u_int16_t max_channels; + } info; + wanec_config_t config; + wanec_config_poll_t config_poll; + wanec_chip_stats_t chip_stats; + wanec_chan_opmode_t chan_opmode; + wanec_chan_mute_t chan_mute; + wanec_chan_custom_t chan_custom; + wanec_chan_stats_t chan_stats; + wanec_chan_monitor_t chan_monitor; + wanec_buffer_config_t buffer_config; + wanec_playout_t playout; + wanec_dtmf_config_t dtmf_config; + } u_ec; + + wan_custom_conf_t custom_conf; +} wan_ec_api_t; + + +#endif /* __WANEC_IFACE_API_H */ diff --git a/patches/kdrivers/wanec/wanec_utils.c b/patches/kdrivers/wanec/wanec_utils.c index ac91c4b..2f4d73f 100644 --- a/patches/kdrivers/wanec/wanec_utils.c +++ b/patches/kdrivers/wanec/wanec_utils.c @@ -29,6 +29,7 @@ #include "oct6100_version.h" #include "wanec_iface.h" +#include "wanec_iface_api.h" /****************************************************************************** ** DEFINES AND MACROS @@ -50,6 +51,12 @@ typedef struct key_word /* Keyword table entry */ u_int16_t dtype; /* data type */ } key_word_t; +typedef struct value_word /* Keyword table entry */ +{ + u_int8_t *sValue; /* -> keyword */ + u_int32_t dValue; /* offset of the related parameter */ +} value_word_t; + /****************************************************************************** ** GLOBAL VARIABLES ******************************************************************************/ @@ -58,7 +65,19 @@ extern int verbose; key_word_t chip_param[] = { - { "fEnableAcousticEcho", + { "WANEC_TailDisplacement", + offsetof(tOCT6100_CHIP_OPEN, ulTailDisplacement), + DTYPE_UINT32 }, + { "WANEC_MaxPlayoutBuffers", + offsetof(tOCT6100_CHIP_OPEN, ulMaxPlayoutBuffers), + DTYPE_UINT32 }, + { "WANEC_MaxConfBridges", + offsetof(tOCT6100_CHIP_OPEN, ulMaxConfBridges), + DTYPE_UINT32 }, + { "WANEC_EnableExtToneDetection", + offsetof(tOCT6100_CHIP_OPEN, fEnableExtToneDetection), + DTYPE_BOOL }, + { "WANEC_EnableAcousticEcho", offsetof(tOCT6100_CHIP_OPEN, fEnableAcousticEcho), DTYPE_BOOL }, { NULL, 0, 0 } @@ -66,137 +85,178 @@ key_word_t chip_param[] = key_word_t ChannelModifyParam[] = { - { "ulEchoOperationMode", + { "WANEC_EchoOperationMode", offsetof(tOCT6100_CHANNEL_MODIFY, ulEchoOperationMode), DTYPE_UINT32 }, - { "fEnableToneDisabler", + { "WANEC_EnableToneDisabler", offsetof(tOCT6100_CHANNEL_MODIFY, fEnableToneDisabler), DTYPE_BOOL }, - { "fApplyToAllChannels", + { "WANEC_ApplyToAllChannels", offsetof(tOCT6100_CHANNEL_MODIFY, fApplyToAllChannels), DTYPE_BOOL }, - { "fEnableNlp", + { "WANEC_DisableToneDetection", + offsetof(tOCT6100_CHANNEL_MODIFY, fDisableToneDetection), + DTYPE_BOOL }, + /**************** tOCT6100_CHANNEL_MODIFY_TDM **********************/ + /**************** tOCT6100_CHANNEL_MODIFY_VQE **********************/ + { "WANEC_EnableNlp", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,fEnableNlp), DTYPE_BOOL }, - { "fEnableTailDisplacement", + { "WANEC_EnableTailDisplacement", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,fEnableTailDisplacement), DTYPE_BOOL }, - { "ulTailDisplacement", + { "WANEC_TailDisplacement", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,ulTailDisplacement), DTYPE_UINT32 }, - { "fRinLevelControl", + { "WANEC_RinLevelControl", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,fRinLevelControl), DTYPE_BOOL }, - { "lRinLevelControlGainDb", + { "WANEC_RinLevelControlGainDb", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,lRinLevelControlGainDb), DTYPE_INT32 }, - { "fSoutLevelControl", + { "WANEC_SoutLevelControl", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,fSoutLevelControl), DTYPE_BOOL }, - { "lSoutLevelControlGainDb", + { "WANEC_SoutLevelControlGainDb", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,lSoutLevelControlGainDb), DTYPE_INT32 }, - { "fRinAutomaticLevelControl", + { "WANEC_RinAutomaticLevelControl", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,fRinAutomaticLevelControl), DTYPE_BOOL }, - { "lRinAutomaticLevelControlTargetDb", + { "WANEC_RinAutomaticLevelControlTargetDb", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,lRinAutomaticLevelControlTargetDb), DTYPE_INT32 }, - { "fSoutAutomaticLevelControl", + { "WANEC_SoutAutomaticLevelControl", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,fSoutAutomaticLevelControl), DTYPE_BOOL }, - { "lSoutAutomaticLevelControlTargetDb", + { "WANEC_SoutAutomaticLevelControlTargetDb", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,lSoutAutomaticLevelControlTargetDb), DTYPE_INT32 }, #if 0 - { "ulAlcNoiseBleedOutTime", + { "WANEC_AlcNoiseBleedOutTime", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,ulAlcNoiseBleedOutTime), DTYPE_UINT32 }, #endif - { "fRinHighLevelCompensation", + { "WANEC_RinHighLevelCompensation", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,fRinHighLevelCompensation), DTYPE_BOOL }, - { "lRinHighLevelCompensationThresholdDb", + { "WANEC_RinHighLevelCompensationThresholdDb", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,lRinHighLevelCompensationThresholdDb), DTYPE_INT32 }, - { "fSoutAdaptiveNoiseReduction", + { "WANEC_SoutAdaptiveNoiseReduction", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,fSoutAdaptiveNoiseReduction), DTYPE_BOOL }, - { "fRoutNoiseReduction", + { "WANEC_RoutNoiseReduction", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,fRoutNoiseReduction), DTYPE_BOOL }, - { "ulComfortNoiseMode", + { "WANEC_ComfortNoiseMode", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,ulComfortNoiseMode), DTYPE_UINT32 }, - { "fAcousticEcho", + { "WANEC_DtmfToneRemoval", + offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,fDtmfToneRemoval), + DTYPE_BOOL }, + { "WANEC_AcousticEcho", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,fAcousticEcho), DTYPE_BOOL }, - { "fSoutNoiseBleaching", + { "WANEC_SoutNoiseBleaching", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,fSoutNoiseBleaching), DTYPE_BOOL }, - { "ulNonLinearityBehaviorA", + { "WANEC_NonLinearityBehaviorA", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,ulNonLinearityBehaviorA), DTYPE_UINT32 }, - { "ulNonLinearityBehaviorB", + { "WANEC_NonLinearityBehaviorB", offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,ulNonLinearityBehaviorB), DTYPE_UINT32 }, + { "WANEC_DoubleTalkBehavior", + offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,ulDoubleTalkBehavior), + DTYPE_UINT32 }, + { "WANEC_AnrSnrEnhancementDb", + offsetof(tOCT6100_CHANNEL_MODIFY, VqeConfig)+offsetof(tOCT6100_CHANNEL_MODIFY_VQE,lAnrSnrEnhancementDb), + DTYPE_INT32 }, + { NULL, 0, 0 } }; +value_word_t ValueParamList[] = +{ + { "OPMODE_NORMAL", cOCT6100_ECHO_OP_MODE_NORMAL }, + { "OPMODE_HT_FREEZE", cOCT6100_ECHO_OP_MODE_HT_FREEZE }, + { "OPMODE_HT_RESET", cOCT6100_ECHO_OP_MODE_HT_RESET }, + { "OPMODE_POWER_DOWN", cOCT6100_ECHO_OP_MODE_POWER_DOWN }, + { "OPMODE_EXTERNAL", cOCT6100_ECHO_OP_MODE_EXTERNAL }, + { "OPMODE_NO_ECHO", cOCT6100_ECHO_OP_MODE_NO_ECHO }, + { "OPMODE_SPEECH_RECOGNITION", cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION }, + { "OPMODE_G169_ALC", cOCT6100_ECHO_OP_MODE_G169_ALC }, + { "COMFORT_NOISE_NORMAL", cOCT6100_COMFORT_NOISE_NORMAL }, + { "COMFORT_NOISE_FAST_LATCH", cOCT6100_COMFORT_NOISE_FAST_LATCH }, + { "COMFORT_NOISE_EXTENDED", cOCT6100_COMFORT_NOISE_EXTENDED }, + { "COMFORT_NOISE_OFF", cOCT6100_COMFORT_NOISE_OFF }, + { "DT_BEH_NORMAL", cOCT6100_DOUBLE_TALK_BEH_NORMAL }, + { "DT_BEH_LESS_AGGRESSIVE", cOCT6100_DOUBLE_TALK_BEH_LESS_AGGRESSIVE }, + + { NULL, 0, } +}; + /****************************************************************************** ** FUNCTION PROTOTYPES ******************************************************************************/ -int wanec_ChipParam(wan_ec_t*,tPOCT6100_CHIP_OPEN, wan_ec_api_t*); -int wanec_ChanParam(wan_ec_t*,tPOCT6100_CHANNEL_MODIFY, wan_ec_api_t*); +int wanec_ChipParam(wan_ec_t*,tPOCT6100_CHIP_OPEN, wan_custom_conf_t*, int); +int wanec_ChanParam(wan_ec_t*,tPOCT6100_CHANNEL_MODIFY, wan_custom_conf_t*, int); int wanec_ChanParamList(wan_ec_t *ec); /****************************************************************************** ** FUNCTION DEFINITIONS ******************************************************************************/ static int -set_conf_param ( wan_ec_t *ec, - wanec_param_t *param, - key_word_t *dtab, - void *conf) +set_conf_param ( wan_ec_t *ec, + wan_custom_param_t *param, + key_word_t *dtab, + void *conf, + int verbose) { /* Search a keyword in configuration definition table */ - for (; dtab->key && strcmp(dtab->key, param->key); ++dtab); - + for (; dtab->key && strncasecmp(dtab->key, param->name, strlen(param->name)); ++dtab); if (dtab->key == NULL){ - DEBUG_EVENT("%s: param=%s\n", ec->name, param->key); + DEBUG_EVENT("%s: Failed to find EC parameter (name=%s)\n", + ec->name, param->name); return -EINVAL; /* keyword not found */ } - DEBUG_EVENT(" * Setting %s to %s\n", param->key, param->value); + /* Search a keyword in configuration definition table */ + if (dtab->dtype != DTYPE_BOOL && strlen(param->sValue)){ + value_word_t *ValueParam = ValueParamList; + for (; ValueParam->sValue && strncasecmp(ValueParam->sValue, param->sValue, strlen(param->sValue)); ++ValueParam); + if (ValueParam->sValue == NULL){ + DEBUG_EVENT("%s: Failed to find EC parameter value (sValue=%s)\n", + ec->name, param->sValue); + return -EINVAL; /* keyword not found */ + } + param->dValue = ValueParam->dValue; + } switch (dtab->dtype) { case DTYPE_BOOL: - if (memcmp(param->value, "TRUE", 4) == 0){ - DEBUG_EVENT( - "%s: *** Modify %s to %s\n", - ec->name, param->key, param->value); + if (memcmp(param->sValue, "TRUE", 4) == 0){ *(BOOL*)((char*)conf + dtab->offset) = TRUE; - }else if (memcmp(param->value, "FALSE", 5) == 0){ - DEBUG_EVENT( - "%s: *** Modify %s to %s\n", - ec->name, param->key, param->value); + }else if (memcmp(param->sValue, "FALSE", 5) == 0){ *(BOOL*)((char*)conf + dtab->offset) = FALSE; }else{ - DEBUG_EVENT( - "%s: Invalid parameter type (%d)\n", + PRINT1(verbose, "%s: Invalid parameter type (%d)\n", ec->name, dtab->dtype); return -EINVAL; } + PRINT1(verbose, "%s: * Setting %s to %s\n", + ec->name, param->name, param->sValue); break; case DTYPE_UINT32: - DEBUG_EVENT("%s: *** Modify %s to %d\n", - ec->name, param->key, param->value1); - *(UINT32*)((char*)conf + dtab->offset) = param->value1; + PRINT1(verbose, "%s: * Setting %s to %d\n", + ec->name, param->name, param->dValue); + *(UINT32*)((char*)conf + dtab->offset) = param->dValue; break; case DTYPE_INT32: - DEBUG_EVENT("%s: *** Modify %s to %d\n", - ec->name, param->key, param->value1); - *(INT32*)((char*)conf + dtab->offset) = param->value1; + PRINT1(verbose, "%s: * Setting %s to %d\n", + ec->name, param->name, param->dValue); + *(INT32*)((char*)conf + dtab->offset) = param->dValue; break; default: return -EINVAL; @@ -205,18 +265,20 @@ set_conf_param ( wan_ec_t *ec, } int wanec_ChipParam( wan_ec_t *ec, - tPOCT6100_CHIP_OPEN f_pOpenChip, - wan_ec_api_t *ec_api) + tPOCT6100_CHIP_OPEN f_pOpenChip, + wan_custom_conf_t *custom_conf, + int verbose) { - int iParam=0; + unsigned int iParam=0; - DEBUG_EVENT( - "%s: Parsing advanced Chip params\n", ec->name); - while(iParam < ec_api->param_no){ + PRINT1(verbose, "%s: Parsing advanced Chip params\n", + ec->name); + while(iParam < custom_conf->param_no){ set_conf_param( ec, - &ec_api->param[iParam], + &custom_conf->params[iParam], chip_param, - f_pOpenChip); + f_pOpenChip, + verbose); iParam++; } return 0; @@ -224,18 +286,21 @@ int wanec_ChipParam( wan_ec_t *ec, int wanec_ChanParam( wan_ec_t *ec, - tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - wan_ec_api_t *ec_api) + tPOCT6100_CHANNEL_MODIFY f_pChannelModify, + wan_custom_conf_t *custom_conf, + int verbose) { - int iParam=0, err; + unsigned int iParam=0; + int err; - DEBUG_EVENT( - "%s: Parsing advanced Channel params\n", ec->name); - while(iParam < ec_api->param_no){ + PRINT1(verbose, "%s: Parsing advanced Channel params\n", + ec->name); + while(iParam < custom_conf->param_no){ err = set_conf_param( ec, - &ec_api->param[iParam], + &custom_conf->params[iParam], ChannelModifyParam, - f_pChannelModify); + f_pChannelModify, + verbose); if (err < 0) return -EINVAL; if (err < offsetof(tOCT6100_CHANNEL_MODIFY, TdmConfig)){ /* no extra action */ diff --git a/rpmspec/wanpipe-mod.spec b/rpmspec/wanpipe-mod.spec index 2e677cb..56a6516 100644 --- a/rpmspec/wanpipe-mod.spec +++ b/rpmspec/wanpipe-mod.spec @@ -1,6 +1,6 @@ %define WANPIPE_VER wanpipe-modules %define name %{WANPIPE_VER} -%define version 3.2.7.1 +%define version 3.3.2 %define release 0 %define serial 1 %define MODULES_DIR /lib/modules @@ -50,150 +50,140 @@ echo "Wanpipe Modules located in %{MODULES_DIR}/%{KVERSION}" %changelog -* Thu Jul 16 2008 Nenad Corbic - Stable - 3.2.7 -======================================================================== -- Removed the Excessive Error check that disables the port. - This feature was introduced in 3.2.6 release. - Some lines are extremely noisy on startup which can cause - excessive crc errors (5000 per sec). In this case driver would - take the port down for few sec before bringing it back up in order to - avoid irq overlaod. This release will only print the - warning but will not take any up/down actions. +* Wed Feb 12 2008 Nenad Corbic - Beta - 3.3.2 +====================================================================== -- Added support for new PLX2 or TUNDRA PCIe chip. +- Support for A500 hardware support with NetBricks BRI Stack +- Major A500 driver updates and fixes +- Serial A142/A144 hardware support +- AFT A056 56K hardware support +- Support for HW DTMF -* Thu Jun 4 2008 Nenad Corbic - Stable - 3.2.6 -======================================================================== +- Updates for AFT PMC and MAXIM framers + PMC - lowered LOS sensitivity + Fixes fake up/down state changes on + started inactive lines. -- Updated hwprobe to add A056 card + MAXIM - lowered sensistivy + Fixes cable cross talk on 8 port cards. + - Enabled Unframed E1 + - Enabled Tri-State Mode + - Fixed loopback commands -- Updated for 2.6.25 kernel +- Updated loopback commands for AFT Maxim cards -- wanpipemon PRI/BRI wireshark tracing - http://wiki.sangoma.com/wanpipe-wireshark-pcap-pri-bri-wan-t1-e1-tracing - -- LIP Layer Update - Optimized packet handling in bh - -- Fixed WAN Protocol for 2.6.24 kernels and higher - -- AFT TE1 Code - Defaulted Maxim T1 Rx Level to 36DB - Defaulted Maxim E1 Rx Level to 42DB - This will improve T1/E1 connectivity on noisy or low power lines. - -- Wanpipemon PRI/BRI PCAP Tracing for Wireshark - Using wanpipemon dchan trace one can now capture - pcap files that can be opened by Wireshark. - http://wiki.sangoma.com/wanpipe-wireshark-pcap-pri-bri-wan-t1-e1-tracing - - -- Add pci parity check to wanrouter - wanrouter parity -> displays current system pci parity - wanrouter parity off -> disables system pci parity - wanrouter parity on -> enables system pci parity +- Updated for AstLinux + The make file can now build all WAN and Voice Protocols - /etc/wanpipe/wanrouter.rc - WAN_PCI_PARITY=OFF -> on wanrouter start disable pci parity - -> event logged in /var/log/wanrouter +- Updated legacy protocols for new front end architecture - On some servers pci parity can cause NMI interrupts that - can lead to reboots. Parity can be caused by unsuported - or buggy pci/bridge chipsets. The above commands can be used - to combat pci parity reboots. - - Another option is to disable PCI parity in BIOS :) +- +* Fri Feb 01 2008 Nenad Corbic - Beta - 3.3.2.p8 +====================================================================== -* Thu Apr 4 2008 Nenad Corbic - Stable - 3.2.5.1 -======================================================================== +- wancfg_zaptel now asks for the default_tei value for +- BRI cards in TE mode -- RTP TAP Bug fix - The driver was sending out invalid rtp tap header - http://wiki.sangoma.com/wanpipe-voice-rtp-tap +- Fix for HWEC not being enabled when non-consecutive modules are using +- in BRI cards + +* Fri Feb 01 2008 Nenad Corbic - Beta - 3.3.2.p4 +====================================================================== + +- Fixed AFT memory leak + Memory leak introduced in 3.3 release +- Fixed AFT 56K bug + Bug introduced in 3.3 releae -* Thu Apr 2 2008 Nenad Corbic - Stable - 3.2.5 -======================================================================== +* Fri Feb 01 2008 Nenad Corbic - Beta - 3.3.2.p3 +====================================================================== -- T3/E3 Update - Fixed T3 Loopback commands +- Fix bug in BRI protocol for fast local hangups. -- Updated T3/E3 Driver - Performance improvement on T3/E3 drivers when handling - VOIP and Data traffic. +* Mon Jan 18 2008 Nenad Corbic - Beta - 3.3.2.p1 +====================================================================== -- Update ifconfig MTU change from protocol interface - - -* Thu Mar 6 2008 Nenad Corbic - Stable - 3.2.4 -======================================================================== - -- Updated for 2.6.24 kernels - TDM Voice (Zaptel) tested with 2.6.24 kernel. - Known issues: WAN protocols are broken for 2.6.24 kernels. - Its a compilation issue that will be fixed ASAP. - -- TDM API bug fix - Check for max frame size on audio stream - -- Updated for Zaptel 1.4.9 - -- AFT IRQ Throttling feature - This feature is use to protect the server from - terrible lines. In some cases a bad hdlc line can - cause thousands of interrupts per sec. Rx errors are now - throttled so that system does not get compromized. - -- AFT RTP TAP Feature - RTP TAP Feature allows user to tap voice channels during - Asterisk-Zaptel/TMD API operation at the driver/kernel level. - Each voice stream is encapsulated in UDP/RTP header and transmitted over - neghbouring ethernet address directly from kenrel space. - Tapping 4E1s worth of voice channels adds estra 2% system load :) - http://wiki.sangoma.com/wanpipe-voice-rtp-tap - -- AFT Software Ring Buffers on A200/A400 Analog Cards - This feature improves analog preformance under Asterisk/TDM API - mode. In particualr it improves faxing reliability and - minimizes frame slippage due to system load or bad incoming - clock from the line. - Note: All AFT T1/E1 cards have this feature in hardare :) +- Bug fix in Hardware EC code for E1. + Bug introduced in 3.3 release. -* Thu Jan 18 2008 Nenad Corbic - Stable - 3.2.3 -======================================================================== +* Mon Jan 18 2008 Nenad Corbic - Beta - 3.3.1 +==================================================================== -- No changes from 3.2.2 - Version updated for versioning sake. -* Thu Jan 18 2008 Nenad Corbic - Stable - 3.2.2 -======================================================================== +* Mon Jan 16 2008 Nenad Corbic - Beta - 3.3.0.22 +==================================================================== -- AFT Maxim Front end update - Implemented graceful recovery on short circuit. +- BRI protocol:Increased internal timer that could cause issue in systems with +- more than 8 BRI spans -- AFT Driver update - Added a check for TDM IRQ timeout. - On some machines its possible for TDM IRQ to timeout. +* Mon Jan 15 2008 Nenad Corbic - Beta - 3.3.0.21 +==================================================================== -- SMG updated - Fixed wancfg_smg - MTU not properly set on ports 2 and up - Voice only ports were not being added to startup sequence - Updated for callweaver +- BRI protocol:Fix for smg_brid daemon crashing on race condition +- BRI protocol:default_tei parameter is not ignored when using point to +- multipoint anymore -- Added Zaptel 1.4 HW HDLC Support - No Sangoma zaptel patch needed with Zaptel 1.4 +* Mon Jan 14 2008 Nenad Corbic - Beta - 3.3.0.20 +==================================================================== -- Added HWEC Noise flag in wanpipe config file +- BRI protocol: Additional prefix options. +- BRI protocol: Check is caller ID number is all digits on incoming calls +- Sangoma MGD: Removed dynamic user period causing skb panics +- chan_woomera: Fixed issue with rxgain and txgain values set to 0 if +- coding not set in woomera.conf +- wancfg_zaptel: Support for fractional T1/E1 spans. +- wancfg_zaptel: fix issue BRI always being configured as bri_net introduced in v3.3.0.19 -- Updated SMG -- Updated E1 Unframed on Maxim Cards +* Mon Jan 07 2008 Nenad Corbic - Beta - 3.3.0.19 +==================================================================== +- Support for national/international prefix in BRI stack + +* Mon Jan 07 2008 Nenad Corbic - Beta - 3.3.0.18 +==================================================================== + +- Changed Makefile in wanpipe/api/fr causing compilation errors + + +* Thu Dec 20 2007 Nenad Corbic - Beta - 3.3.0.17 +==================================================================== + +- Fix for smg_ctrl boot script starting before network services on some systems +- Support for language parameter in chan_woomera + +* Thu Dec 20 2007 Nenad Corbic - Beta - 3.3.0.16 +==================================================================== + +- Fix for Sangoma BRI Daemon crashing on incoming call if chan_woomera is not installed on that system + +* Tue Dec 18 2007 Nenad Corbic - Beta - 3.3.0.15 +==================================================================== + +- Fix for caller ID value being corrupted sometimes +- Support for call confirmation in chan_woomera + +* Tue Dec 18 2007 Nenad Corbic - Beta - 3.3.0.14 +==================================================================== + +- Fix in smg_brid not releasing some b-channels properly +- Fix in wancfg_smg not setting MTU to 80 when configuring cards for SS7 + +* Fri Dec 14 2007 Nenad Corbic - Beta - 3.3.0.13 +==================================================================== + +- Fix for Kernel panic on 64-bit systems when enabling hardware echo canceller + + +* Thu Dec 5 2007 Nenad Corbic - Beta - 3.3.0.11 +==================================================================== + +- Support for AFT Serial Cards - Updates for AFT PMC and MAXIM framers PMC - lowered LOS sensitivity Fixes fake up/down state changes on @@ -226,216 +216,37 @@ echo "Wanpipe Modules located in %{MODULES_DIR}/%{KVERSION}" - Updated Setup script -* Wed Oct 6 2007 Nenad Corbic - Stable - 3.2.1 -===================================================================== -- Setup Zap Chunk Size Patch updated for Zaptel 1.4 - Patch allows running zaptel in 8,16,40,80 chunk size. - However wct drivers must be removed from compilation :) - Patch is now fixed for Zaptel 1.4 - -- Update to All AFT drivers for 64bit 2.6.22 kernel. - Updated affects: AFT A101/2/4/8/200/400 (all cards) - The major 2.6.20+ updates extend to 64bit as well. - Previous drivers segfaulted under 2.6.22 64bit - kernels. This does not affect you if you are running - kennels lower than 2.6.22. - -- Updated legacy drivers for 2.6.22 kernel - - - -* Wed Oct 3 2007 Nenad Corbic - Stable - 3.2.0 -===================================================================== - -- The Beta 3.1.X releases has now been declared as STABLE 3.2.X - -- Fixed AMI/D4 on MAXIM (A101/2/4/8D) cards -- Fixed A200/A400 tip/ring no dial tone issues. -- Fixed 2.6.22 support and above -- Fixed RPM Build post install issue -- Updated Setup install script - Option to build for zaptel: ./Setup zaptel -- Working E&M/RBS/CAS Channel Bank support for MAXIM (A101/2/4/8) cards. -- Fixed wanpipe crashing on system shutdown on some machines. - Caused by RedHat /var/lock/subsys mandatory lock file. -- New Firmware for all MAXIM Cards (A101/2/4/8D) - Firmware V33: Fixes EC Chip Security errors that can cause - PRI to go down on some computers. Firmware is backward compatible - to any previous release. -- Faxes/Modems working through hardware echo canceler. - Tested at 56K from one port to another. - New octasic update. -- Analog Network SYNC Feature for Fax Support - Analog cards can be synced to T1/E1 clock - from adjacent A101/2/4/8 cards for flawless faxing - from FXO/FXS to T1/E1. - -- Known Issues: - T1/E1 High Impedance Tap for MAXIM (A101/2/4/8D) cards. - It works on original PMC A101/2/4 cards - -For more info: http://wiki.sangoma.com - - -* Mon Oct 1 2007 Nenad Corbic - Beta - 3.1.4.6 -==================================================================== - -- Fixed Makefile for 2.6.22.9 kernel. -- Fixed all gcc4 warnings. - - -* Tue Sep 26 2007 Nenad Corbic - Beta - 3.1.4.5 -==================================================================== - -- Updated Setup install script -- A200/A400 Analog driver update - Fixed noise issue introduced in 3.1.4.3 release -- Updated SMG for Asterisk 1.4 & Callweaver - - -* Tue Sep 18 2007 Nenad Corbic - Beta - 3.1.4.3 -==================================================================== - -- A200/A400 Analog driver update - Fixed a problem where analog port starts up without - dialtone. - -* Tue Sep 14 2007 Nenad Corbic - Beta - 3.1.4.2 -==================================================================== - -- Update for 2.6.22 kernel. -- wanrouter startup script update for redhat distros. - Fixes the issue on system shutdown, where wanpipe - module sometimes do not unload due to /var/lock/subsys/ - lockfile check. This issue is only related or RedHat style distros. - - -* Tue Aug 15 2007 Nenad Corbic - Beta - 3.1.4 -==================================================================== - -- Added A101-SH old config support. - So onld A101u or A101c config file can be used with new A101-SH cards. - -- Updated KATM support in the LIP Layer. - Used to connect Kernel ATM Layer to Wanpipe ATM AAL5 layer - over all AFT cards. - -- Added a sanity checker for enabling HWEC. - Used to prevent duble hwec enable. - -- Added wancfg_tdmapi configurator - -- Updated SMG - - -* Mon Jun 30 2007 Nenad Corbic - Beta - 3.1.3 -==================================================================== - -- Update to Ocatsic Hardware Echo Canceler Library - Turned of the NOISE suppression because it can interfere - with faxes. If you faxes did not work properly on 3.1.2 - release they will work fine with this one. - -- Cleaned up the Setup installation script. - - -* Mon Jun 16 2007 Nenad Corbic - Beta - 3.1.2 -==================================================================== - -- Update to Octasic Hardware Echo Canceler library - This is a very important update that affects all AFT cards - with octasic hardware echo canceler. The new octasic update - fixes faxing/modem issues over octasic hwec. The previous - release contained a bug that limited the faxing/modem speeds - to 26k. The new update properly detects fax/modem and works - with full speed of 33k fax and 56k modem. - -- A200/A400 Updated - This update fixes the offhook startup failure. - On startup if fxs is offhook driver will start correctly - -- Wanpipe Startup order changed - The wanpipe startup scripts on bootup were previously - set too early "S03wanrouter". This caused unpredictable - behaviour on some systems. We have now moved wanrouter - startup on boot up to "S11wanrouter", after networking - code. - -- Zaptel Adjustable Chunk Size Feature - Wanpipe drivers can work with 1,2,5 and 10ms - chunk size. Zaptel also supports this, however - the wct4xx driver breaks compilation when chunk - size is changed. ./Setup can how change the - zaptel chunk size for you and update zaptel - Makefiles to remove wct4xx driver out. - - Zaptel with 1ms generates 1000 interrupts per sec - Zaptel with 10ms generates 100 interrupts per sec. - - As you can see its a drastic interrupt performance - increase. - - NOTE: This breaks software echo cancelation, but - its not needed since we have hwec. - - -* Fri Jun 06 2007 Nenad Corbic - Beta - 3.1.1 -==================================================================== - -- A101/2/4/8 (MAXIM) AFT Update IMPORTANT - A major bug fix for AFT Maxim E1 cards for E1 CRC4 Mode. - On some lines the E1/CRC4 mode causes line errors on - the telco side which results in PRI not coming up. - - Symptiom: E1 is up (no alarms) on local side but pri is - not coming up! (Only in E1 CRC4 Mode) - -- A101/2/4/8 (MAXIM) Mandatory Firmware Update - An echo canceler bug has been fixed for all AFT - MAXIM Cards A101/2/4/8dm. New firmware version is V31. - If you are running MAXIM cards with hwec wiht older - firmware version you must upgrade. - -- Updated SMG - Fixed DTMF synchronization - - - -- Updated SMG - Fixed DTMF synchronization - - -* Fri Jun 06 2007 Nenad Corbic - Beta - 3.1.0.1 -==================================================================== - -- Minor release -- Contains zaptel patch for zaptel 1.2.17 and above. -- No driver changes - -* Fri May 17 2007 Nenad Corbic - Beta - 3.1.0 +* Thu Nov 8 2007 Nenad Corbic - Beta - 3.3.0.4 ==================================================================== -- Major new BETA wanpipe release - Changed wanpipe versioning: - Release: A.B.C.D - A - Major Relase number - B - Indicates Stable or Beta - Odd number is Beta - Even number is Stable - C - Minor Release number - D - Optional pre-release and custom releases - -- Fixed RBS Support for all Maxim cards A101/2/4/8. +- Fixed A101/2 (Old) bug introduced in previous releaes -- Support for 2.6.20 kernels. +* Mon Oct 31 2007 Nenad Corbic - Beta - 3.3.0.4 +==================================================================== -- Support for New: A101D A102D A104D Maxim cards - : -- Support for New: AFT 56K DDS card +- Updated BRI caller name +- Updaged Setup -- Redesigned TDM API Events -- TDM API Analog Support +* Mon Oct 15 2007 Nenad Corbic - Beta - 3.3.0.1 +==================================================================== +- Major Updates +- New BRI architecture/support + SMG with Netbricks BRI Stack +- Support for Hardware DTMF + + +* Thu Aug 22 2007 Nenad Corbic - Beta - 3.3.0.p3 +====================================================================== + +- Updated wancfg_zaptel to support HW DTMF + + +* Thu Aug 21 2007 Nenad Corbic - Beta - 3.3.0.p2 +====================================================================== + +- Major Updates +- Hardware DTMF for Asterisk and TDM API - - END - diff --git a/rpmspec/wanpipe-util.spec b/rpmspec/wanpipe-util.spec index a87ba6c..02b5f7c 100644 --- a/rpmspec/wanpipe-util.spec +++ b/rpmspec/wanpipe-util.spec @@ -1,7 +1,7 @@ %define KERNEL_VERSION %{?kern_ver} %define WANPIPE_VER wanpipe-util %define name %{WANPIPE_VER} -%define version 3.2.7.1 +%define version 3.3.2 %define release 0 %define serial 1 %define ETC_DIR /etc @@ -179,9 +179,90 @@ ENDOFTEXT install_init() { ln -s /usr/sbin/wanrouter /etc/init.d/wanrouter - chkconfig wanrouter on + chkconfig --add wanrouter + chkconfig wanrouter on } +# ---------------------------------------------------------------------------- +# Enable MGD and BRI log for A500-BRI +# ---------------------------------------------------------------------------- +enable_smg_log() +{ +if [ -e /etc/syslog.conf ]; then + eval "grep "local2.*sangoma_mgd" /etc/syslog.conf" > /dev/null 2> /dev/null + if [ $? -ne 0 ]; then + eval "grep "local2" /etc/syslog.conf " > /dev/null 2> /dev/null + if [ $? -eq 0 ]; then + echo + echo "Warning : local2 is already used in syslog.conf" + echo + fi + echo -e "\n# Sangoma Media Gateway log" > tmp.$$ + echo -e "local2.* /var/log/sangoma_mgd.log\n" >> tmp.$$ + eval "cat /etc/syslog.conf tmp.$$ > tmp1.$$" + \cp -f tmp1.$$ /etc/syslog.conf + eval "/etc/init.d/syslog restart" > /dev/null 2>/dev/null + fi + eval "grep "local3.*sangoma_bri" /etc/syslog.conf" > /dev/null 2> /dev/null + if [ $? -ne 0 ]; then + eval "grep "local3" /etc/syslog.conf " > /dev/null 2> /dev/null + if [ $? -eq 0 ]; then + echo + echo "Warning : local3 is already used in syslog.conf" + echo + fi + echo -e "\n# Sangoma BRI Daemon (smg_bri) log" > tmp.$$ + echo -e "local3.* /var/log/sangoma_bri.log\n" >> tmp.$$ + eval "cat /etc/syslog.conf tmp.$$ > tmp1.$$" + \cp -f tmp1.$$ /etc/syslog.conf + eval "/etc/init.d/syslog restart" > /dev/null 2> /dev/null + fi +else + echo "Warning: /etc/syslog.conf not found" +fi + +if [ -f tmp1.$$ ]; then + rm -f tmp1.$$ +fi +if [ -f tmp.$$ ]; then + rm -f tmp.$$ +fi + +echo "Ok" +echo + +echo "Checking logrotate ..." +eval "type logrotate" > /dev/null 2> /dev/null +if [ $? -ne 0 ]; then + echo "Error: Logrotate not found !" +fi + +if [ -e /etc/logrotate.d ] && [ -e /etc/logrotate.d/syslog ]; then + + eval "grep sangoma_mgd /etc/logrotate.d/syslog" > /dev/null 2> /dev/null + if [ $? -ne 0 ]; then + eval "sed -e 's/messages/messages \/var\/log\/sangoma_mgd.log/' /etc/logrotate.d/syslog >tmp2.$$ 2>/dev/null" + eval "cp -f tmp2.$$ /etc/logrotate.d/syslog" + eval "logrotate -f /etc/logrotate.d/syslog" + if [ $? -ne 0 ]; then + echo "Error: logrotate restart failed!"; + exit 1; + fi + echo "Logrotate is being changed and restarted!" + else + echo "Logrotate is configured!" + fi + +else + echo "Error: Logrotate dir: /etc/logrotate.d not found !" +fi +echo "OK." +echo + +} + + + install_init_old() { #Examine system bootstrap files. @@ -234,7 +315,7 @@ EOM install_init; #create wanrouter.rc in /etc/wanpipe #create_metaconf; - +enable_smg_log; %files @@ -246,150 +327,140 @@ install_init; %changelog -* Thu Jul 16 2008 Nenad Corbic - Stable - 3.2.7 -======================================================================== -- Removed the Excessive Error check that disables the port. - This feature was introduced in 3.2.6 release. - Some lines are extremely noisy on startup which can cause - excessive crc errors (5000 per sec). In this case driver would - take the port down for few sec before bringing it back up in order to - avoid irq overlaod. This release will only print the - warning but will not take any up/down actions. +* Wed Feb 12 2008 Nenad Corbic - Beta - 3.3.2 +====================================================================== -- Added support for new PLX2 or TUNDRA PCIe chip. +- Support for A500 hardware support with NetBricks BRI Stack +- Major A500 driver updates and fixes +- Serial A142/A144 hardware support +- AFT A056 56K hardware support +- Support for HW DTMF -* Thu Jun 4 2008 Nenad Corbic - Stable - 3.2.6 -======================================================================== +- Updates for AFT PMC and MAXIM framers + PMC - lowered LOS sensitivity + Fixes fake up/down state changes on + started inactive lines. -- Updated hwprobe to add A056 card + MAXIM - lowered sensistivy + Fixes cable cross talk on 8 port cards. + - Enabled Unframed E1 + - Enabled Tri-State Mode + - Fixed loopback commands -- Updated for 2.6.25 kernel +- Updated loopback commands for AFT Maxim cards -- wanpipemon PRI/BRI wireshark tracing - http://wiki.sangoma.com/wanpipe-wireshark-pcap-pri-bri-wan-t1-e1-tracing - -- LIP Layer Update - Optimized packet handling in bh - -- Fixed WAN Protocol for 2.6.24 kernels and higher - -- AFT TE1 Code - Defaulted Maxim T1 Rx Level to 36DB - Defaulted Maxim E1 Rx Level to 42DB - This will improve T1/E1 connectivity on noisy or low power lines. - -- Wanpipemon PRI/BRI PCAP Tracing for Wireshark - Using wanpipemon dchan trace one can now capture - pcap files that can be opened by Wireshark. - http://wiki.sangoma.com/wanpipe-wireshark-pcap-pri-bri-wan-t1-e1-tracing - - -- Add pci parity check to wanrouter - wanrouter parity -> displays current system pci parity - wanrouter parity off -> disables system pci parity - wanrouter parity on -> enables system pci parity +- Updated for AstLinux + The make file can now build all WAN and Voice Protocols - /etc/wanpipe/wanrouter.rc - WAN_PCI_PARITY=OFF -> on wanrouter start disable pci parity - -> event logged in /var/log/wanrouter +- Updated legacy protocols for new front end architecture - On some servers pci parity can cause NMI interrupts that - can lead to reboots. Parity can be caused by unsuported - or buggy pci/bridge chipsets. The above commands can be used - to combat pci parity reboots. - - Another option is to disable PCI parity in BIOS :) +- +* Fri Feb 01 2008 Nenad Corbic - Beta - 3.3.2.p8 +====================================================================== -* Thu Apr 4 2008 Nenad Corbic - Stable - 3.2.5.1 -======================================================================== +- wancfg_zaptel now asks for the default_tei value for +- BRI cards in TE mode -- RTP TAP Bug fix - The driver was sending out invalid rtp tap header - http://wiki.sangoma.com/wanpipe-voice-rtp-tap +- Fix for HWEC not being enabled when non-consecutive modules are using +- in BRI cards + +* Fri Feb 01 2008 Nenad Corbic - Beta - 3.3.2.p4 +====================================================================== + +- Fixed AFT memory leak + Memory leak introduced in 3.3 release +- Fixed AFT 56K bug + Bug introduced in 3.3 releae -* Thu Apr 2 2008 Nenad Corbic - Stable - 3.2.5 -======================================================================== +* Fri Feb 01 2008 Nenad Corbic - Beta - 3.3.2.p3 +====================================================================== -- T3/E3 Update - Fixed T3 Loopback commands +- Fix bug in BRI protocol for fast local hangups. -- Updated T3/E3 Driver - Performance improvement on T3/E3 drivers when handling - VOIP and Data traffic. +* Mon Jan 18 2008 Nenad Corbic - Beta - 3.3.2.p1 +====================================================================== -- Update ifconfig MTU change from protocol interface - - -* Thu Mar 6 2008 Nenad Corbic - Stable - 3.2.4 -======================================================================== - -- Updated for 2.6.24 kernels - TDM Voice (Zaptel) tested with 2.6.24 kernel. - Known issues: WAN protocols are broken for 2.6.24 kernels. - Its a compilation issue that will be fixed ASAP. - -- TDM API bug fix - Check for max frame size on audio stream - -- Updated for Zaptel 1.4.9 - -- AFT IRQ Throttling feature - This feature is use to protect the server from - terrible lines. In some cases a bad hdlc line can - cause thousands of interrupts per sec. Rx errors are now - throttled so that system does not get compromized. - -- AFT RTP TAP Feature - RTP TAP Feature allows user to tap voice channels during - Asterisk-Zaptel/TMD API operation at the driver/kernel level. - Each voice stream is encapsulated in UDP/RTP header and transmitted over - neghbouring ethernet address directly from kenrel space. - Tapping 4E1s worth of voice channels adds estra 2% system load :) - http://wiki.sangoma.com/wanpipe-voice-rtp-tap - -- AFT Software Ring Buffers on A200/A400 Analog Cards - This feature improves analog preformance under Asterisk/TDM API - mode. In particualr it improves faxing reliability and - minimizes frame slippage due to system load or bad incoming - clock from the line. - Note: All AFT T1/E1 cards have this feature in hardare :) +- Bug fix in Hardware EC code for E1. + Bug introduced in 3.3 release. -* Thu Jan 18 2008 Nenad Corbic - Stable - 3.2.3 -======================================================================== +* Mon Jan 18 2008 Nenad Corbic - Beta - 3.3.1 +==================================================================== -- No changes from 3.2.2 - Version updated for versioning sake. -* Thu Jan 18 2008 Nenad Corbic - Stable - 3.2.2 -======================================================================== +* Mon Jan 16 2008 Nenad Corbic - Beta - 3.3.0.22 +==================================================================== -- AFT Maxim Front end update - Implemented graceful recovery on short circuit. +- BRI protocol:Increased internal timer that could cause issue in systems with +- more than 8 BRI spans -- AFT Driver update - Added a check for TDM IRQ timeout. - On some machines its possible for TDM IRQ to timeout. +* Mon Jan 15 2008 Nenad Corbic - Beta - 3.3.0.21 +==================================================================== -- SMG updated - Fixed wancfg_smg - MTU not properly set on ports 2 and up - Voice only ports were not being added to startup sequence - Updated for callweaver +- BRI protocol:Fix for smg_brid daemon crashing on race condition +- BRI protocol:default_tei parameter is not ignored when using point to +- multipoint anymore -- Added Zaptel 1.4 HW HDLC Support - No Sangoma zaptel patch needed with Zaptel 1.4 +* Mon Jan 14 2008 Nenad Corbic - Beta - 3.3.0.20 +==================================================================== -- Added HWEC Noise flag in wanpipe config file +- BRI protocol: Additional prefix options. +- BRI protocol: Check is caller ID number is all digits on incoming calls +- Sangoma MGD: Removed dynamic user period causing skb panics +- chan_woomera: Fixed issue with rxgain and txgain values set to 0 if +- coding not set in woomera.conf +- wancfg_zaptel: Support for fractional T1/E1 spans. +- wancfg_zaptel: fix issue BRI always being configured as bri_net introduced in v3.3.0.19 -- Updated SMG -- Updated E1 Unframed on Maxim Cards +* Mon Jan 07 2008 Nenad Corbic - Beta - 3.3.0.19 +==================================================================== +- Support for national/international prefix in BRI stack + +* Mon Jan 07 2008 Nenad Corbic - Beta - 3.3.0.18 +==================================================================== + +- Changed Makefile in wanpipe/api/fr causing compilation errors + + +* Thu Dec 20 2007 Nenad Corbic - Beta - 3.3.0.17 +==================================================================== + +- Fix for smg_ctrl boot script starting before network services on some systems +- Support for language parameter in chan_woomera + +* Thu Dec 20 2007 Nenad Corbic - Beta - 3.3.0.16 +==================================================================== + +- Fix for Sangoma BRI Daemon crashing on incoming call if chan_woomera is not installed on that system + +* Tue Dec 18 2007 Nenad Corbic - Beta - 3.3.0.15 +==================================================================== + +- Fix for caller ID value being corrupted sometimes +- Support for call confirmation in chan_woomera + +* Tue Dec 18 2007 Nenad Corbic - Beta - 3.3.0.14 +==================================================================== + +- Fix in smg_brid not releasing some b-channels properly +- Fix in wancfg_smg not setting MTU to 80 when configuring cards for SS7 + +* Fri Dec 14 2007 Nenad Corbic - Beta - 3.3.0.13 +==================================================================== + +- Fix for Kernel panic on 64-bit systems when enabling hardware echo canceller + + +* Thu Dec 5 2007 Nenad Corbic - Beta - 3.3.0.11 +==================================================================== + +- Support for AFT Serial Cards - Updates for AFT PMC and MAXIM framers PMC - lowered LOS sensitivity Fixes fake up/down state changes on @@ -422,216 +493,37 @@ install_init; - Updated Setup script -* Wed Oct 6 2007 Nenad Corbic - Stable - 3.2.1 -===================================================================== -- Setup Zap Chunk Size Patch updated for Zaptel 1.4 - Patch allows running zaptel in 8,16,40,80 chunk size. - However wct drivers must be removed from compilation :) - Patch is now fixed for Zaptel 1.4 - -- Update to All AFT drivers for 64bit 2.6.22 kernel. - Updated affects: AFT A101/2/4/8/200/400 (all cards) - The major 2.6.20+ updates extend to 64bit as well. - Previous drivers segfaulted under 2.6.22 64bit - kernels. This does not affect you if you are running - kennels lower than 2.6.22. - -- Updated legacy drivers for 2.6.22 kernel - - - -* Wed Oct 3 2007 Nenad Corbic - Stable - 3.2.0 -===================================================================== - -- The Beta 3.1.X releases has now been declared as STABLE 3.2.X - -- Fixed AMI/D4 on MAXIM (A101/2/4/8D) cards -- Fixed A200/A400 tip/ring no dial tone issues. -- Fixed 2.6.22 support and above -- Fixed RPM Build post install issue -- Updated Setup install script - Option to build for zaptel: ./Setup zaptel -- Working E&M/RBS/CAS Channel Bank support for MAXIM (A101/2/4/8) cards. -- Fixed wanpipe crashing on system shutdown on some machines. - Caused by RedHat /var/lock/subsys mandatory lock file. -- New Firmware for all MAXIM Cards (A101/2/4/8D) - Firmware V33: Fixes EC Chip Security errors that can cause - PRI to go down on some computers. Firmware is backward compatible - to any previous release. -- Faxes/Modems working through hardware echo canceler. - Tested at 56K from one port to another. - New octasic update. -- Analog Network SYNC Feature for Fax Support - Analog cards can be synced to T1/E1 clock - from adjacent A101/2/4/8 cards for flawless faxing - from FXO/FXS to T1/E1. - -- Known Issues: - T1/E1 High Impedance Tap for MAXIM (A101/2/4/8D) cards. - It works on original PMC A101/2/4 cards - -For more info: http://wiki.sangoma.com - - -* Mon Oct 1 2007 Nenad Corbic - Beta - 3.1.4.6 -==================================================================== - -- Fixed Makefile for 2.6.22.9 kernel. -- Fixed all gcc4 warnings. - - -* Tue Sep 26 2007 Nenad Corbic - Beta - 3.1.4.5 -==================================================================== - -- Updated Setup install script -- A200/A400 Analog driver update - Fixed noise issue introduced in 3.1.4.3 release -- Updated SMG for Asterisk 1.4 & Callweaver - - -* Tue Sep 18 2007 Nenad Corbic - Beta - 3.1.4.3 -==================================================================== - -- A200/A400 Analog driver update - Fixed a problem where analog port starts up without - dialtone. - -* Tue Sep 14 2007 Nenad Corbic - Beta - 3.1.4.2 -==================================================================== - -- Update for 2.6.22 kernel. -- wanrouter startup script update for redhat distros. - Fixes the issue on system shutdown, where wanpipe - module sometimes do not unload due to /var/lock/subsys/ - lockfile check. This issue is only related or RedHat style distros. - - -* Tue Aug 15 2007 Nenad Corbic - Beta - 3.1.4 -==================================================================== - -- Added A101-SH old config support. - So onld A101u or A101c config file can be used with new A101-SH cards. - -- Updated KATM support in the LIP Layer. - Used to connect Kernel ATM Layer to Wanpipe ATM AAL5 layer - over all AFT cards. - -- Added a sanity checker for enabling HWEC. - Used to prevent duble hwec enable. - -- Added wancfg_tdmapi configurator - -- Updated SMG - - -* Mon Jun 30 2007 Nenad Corbic - Beta - 3.1.3 -==================================================================== - -- Update to Ocatsic Hardware Echo Canceler Library - Turned of the NOISE suppression because it can interfere - with faxes. If you faxes did not work properly on 3.1.2 - release they will work fine with this one. - -- Cleaned up the Setup installation script. - - -* Mon Jun 16 2007 Nenad Corbic - Beta - 3.1.2 -==================================================================== - -- Update to Octasic Hardware Echo Canceler library - This is a very important update that affects all AFT cards - with octasic hardware echo canceler. The new octasic update - fixes faxing/modem issues over octasic hwec. The previous - release contained a bug that limited the faxing/modem speeds - to 26k. The new update properly detects fax/modem and works - with full speed of 33k fax and 56k modem. - -- A200/A400 Updated - This update fixes the offhook startup failure. - On startup if fxs is offhook driver will start correctly - -- Wanpipe Startup order changed - The wanpipe startup scripts on bootup were previously - set too early "S03wanrouter". This caused unpredictable - behaviour on some systems. We have now moved wanrouter - startup on boot up to "S11wanrouter", after networking - code. - -- Zaptel Adjustable Chunk Size Feature - Wanpipe drivers can work with 1,2,5 and 10ms - chunk size. Zaptel also supports this, however - the wct4xx driver breaks compilation when chunk - size is changed. ./Setup can how change the - zaptel chunk size for you and update zaptel - Makefiles to remove wct4xx driver out. - - Zaptel with 1ms generates 1000 interrupts per sec - Zaptel with 10ms generates 100 interrupts per sec. - - As you can see its a drastic interrupt performance - increase. - - NOTE: This breaks software echo cancelation, but - its not needed since we have hwec. - - -* Fri Jun 06 2007 Nenad Corbic - Beta - 3.1.1 -==================================================================== - -- A101/2/4/8 (MAXIM) AFT Update IMPORTANT - A major bug fix for AFT Maxim E1 cards for E1 CRC4 Mode. - On some lines the E1/CRC4 mode causes line errors on - the telco side which results in PRI not coming up. - - Symptiom: E1 is up (no alarms) on local side but pri is - not coming up! (Only in E1 CRC4 Mode) - -- A101/2/4/8 (MAXIM) Mandatory Firmware Update - An echo canceler bug has been fixed for all AFT - MAXIM Cards A101/2/4/8dm. New firmware version is V31. - If you are running MAXIM cards with hwec wiht older - firmware version you must upgrade. - -- Updated SMG - Fixed DTMF synchronization - - - -- Updated SMG - Fixed DTMF synchronization - - -* Fri Jun 06 2007 Nenad Corbic - Beta - 3.1.0.1 -==================================================================== - -- Minor release -- Contains zaptel patch for zaptel 1.2.17 and above. -- No driver changes - -* Fri May 17 2007 Nenad Corbic - Beta - 3.1.0 +* Thu Nov 8 2007 Nenad Corbic - Beta - 3.3.0.4 ==================================================================== -- Major new BETA wanpipe release - Changed wanpipe versioning: - Release: A.B.C.D - A - Major Relase number - B - Indicates Stable or Beta - Odd number is Beta - Even number is Stable - C - Minor Release number - D - Optional pre-release and custom releases - -- Fixed RBS Support for all Maxim cards A101/2/4/8. +- Fixed A101/2 (Old) bug introduced in previous releaes -- Support for 2.6.20 kernels. +* Mon Oct 31 2007 Nenad Corbic - Beta - 3.3.0.4 +==================================================================== -- Support for New: A101D A102D A104D Maxim cards - : -- Support for New: AFT 56K DDS card +- Updated BRI caller name +- Updaged Setup -- Redesigned TDM API Events -- TDM API Analog Support +* Mon Oct 15 2007 Nenad Corbic - Beta - 3.3.0.1 +==================================================================== +- Major Updates +- New BRI architecture/support + SMG with Netbricks BRI Stack +- Support for Hardware DTMF + + +* Thu Aug 22 2007 Nenad Corbic - Beta - 3.3.0.p3 +====================================================================== + +- Updated wancfg_zaptel to support HW DTMF + + +* Thu Aug 21 2007 Nenad Corbic - Beta - 3.3.0.p2 +====================================================================== + +- Major Updates +- Hardware DTMF for Asterisk and TDM API - - END - diff --git a/rpmspec/wanpipe.spec b/rpmspec/wanpipe.spec index fb9a621..8dd13b5 100644 --- a/rpmspec/wanpipe.spec +++ b/rpmspec/wanpipe.spec @@ -1,7 +1,7 @@ %define KERNEL_VERSION %{?kern_ver} %define WANPIPE_VER wanpipe %define name %{WANPIPE_VER} -%define version 3.2.7.1 +%define version 3.3.2 %define release 0 %define serial 1 %define UTILS_DIR /usr/sbin @@ -254,150 +254,140 @@ install_init; %changelog -* Thu Jul 16 2008 Nenad Corbic - Stable - 3.2.7 -======================================================================== -- Removed the Excessive Error check that disables the port. - This feature was introduced in 3.2.6 release. - Some lines are extremely noisy on startup which can cause - excessive crc errors (5000 per sec). In this case driver would - take the port down for few sec before bringing it back up in order to - avoid irq overlaod. This release will only print the - warning but will not take any up/down actions. +* Wed Feb 12 2008 Nenad Corbic - Beta - 3.3.2 +====================================================================== -- Added support for new PLX2 or TUNDRA PCIe chip. +- Support for A500 hardware support with NetBricks BRI Stack +- Major A500 driver updates and fixes +- Serial A142/A144 hardware support +- AFT A056 56K hardware support +- Support for HW DTMF -* Thu Jun 4 2008 Nenad Corbic - Stable - 3.2.6 -======================================================================== +- Updates for AFT PMC and MAXIM framers + PMC - lowered LOS sensitivity + Fixes fake up/down state changes on + started inactive lines. -- Updated hwprobe to add A056 card + MAXIM - lowered sensistivy + Fixes cable cross talk on 8 port cards. + - Enabled Unframed E1 + - Enabled Tri-State Mode + - Fixed loopback commands -- Updated for 2.6.25 kernel +- Updated loopback commands for AFT Maxim cards -- wanpipemon PRI/BRI wireshark tracing - http://wiki.sangoma.com/wanpipe-wireshark-pcap-pri-bri-wan-t1-e1-tracing - -- LIP Layer Update - Optimized packet handling in bh - -- Fixed WAN Protocol for 2.6.24 kernels and higher - -- AFT TE1 Code - Defaulted Maxim T1 Rx Level to 36DB - Defaulted Maxim E1 Rx Level to 42DB - This will improve T1/E1 connectivity on noisy or low power lines. - -- Wanpipemon PRI/BRI PCAP Tracing for Wireshark - Using wanpipemon dchan trace one can now capture - pcap files that can be opened by Wireshark. - http://wiki.sangoma.com/wanpipe-wireshark-pcap-pri-bri-wan-t1-e1-tracing - - -- Add pci parity check to wanrouter - wanrouter parity -> displays current system pci parity - wanrouter parity off -> disables system pci parity - wanrouter parity on -> enables system pci parity +- Updated for AstLinux + The make file can now build all WAN and Voice Protocols - /etc/wanpipe/wanrouter.rc - WAN_PCI_PARITY=OFF -> on wanrouter start disable pci parity - -> event logged in /var/log/wanrouter +- Updated legacy protocols for new front end architecture - On some servers pci parity can cause NMI interrupts that - can lead to reboots. Parity can be caused by unsuported - or buggy pci/bridge chipsets. The above commands can be used - to combat pci parity reboots. - - Another option is to disable PCI parity in BIOS :) +- +* Fri Feb 01 2008 Nenad Corbic - Beta - 3.3.2.p8 +====================================================================== -* Thu Apr 4 2008 Nenad Corbic - Stable - 3.2.5.1 -======================================================================== +- wancfg_zaptel now asks for the default_tei value for +- BRI cards in TE mode -- RTP TAP Bug fix - The driver was sending out invalid rtp tap header - http://wiki.sangoma.com/wanpipe-voice-rtp-tap +- Fix for HWEC not being enabled when non-consecutive modules are using +- in BRI cards + +* Fri Feb 01 2008 Nenad Corbic - Beta - 3.3.2.p4 +====================================================================== + +- Fixed AFT memory leak + Memory leak introduced in 3.3 release +- Fixed AFT 56K bug + Bug introduced in 3.3 releae -* Thu Apr 2 2008 Nenad Corbic - Stable - 3.2.5 -======================================================================== +* Fri Feb 01 2008 Nenad Corbic - Beta - 3.3.2.p3 +====================================================================== -- T3/E3 Update - Fixed T3 Loopback commands +- Fix bug in BRI protocol for fast local hangups. -- Updated T3/E3 Driver - Performance improvement on T3/E3 drivers when handling - VOIP and Data traffic. +* Mon Jan 18 2008 Nenad Corbic - Beta - 3.3.2.p1 +====================================================================== -- Update ifconfig MTU change from protocol interface - - -* Thu Mar 6 2008 Nenad Corbic - Stable - 3.2.4 -======================================================================== - -- Updated for 2.6.24 kernels - TDM Voice (Zaptel) tested with 2.6.24 kernel. - Known issues: WAN protocols are broken for 2.6.24 kernels. - Its a compilation issue that will be fixed ASAP. - -- TDM API bug fix - Check for max frame size on audio stream - -- Updated for Zaptel 1.4.9 - -- AFT IRQ Throttling feature - This feature is use to protect the server from - terrible lines. In some cases a bad hdlc line can - cause thousands of interrupts per sec. Rx errors are now - throttled so that system does not get compromized. - -- AFT RTP TAP Feature - RTP TAP Feature allows user to tap voice channels during - Asterisk-Zaptel/TMD API operation at the driver/kernel level. - Each voice stream is encapsulated in UDP/RTP header and transmitted over - neghbouring ethernet address directly from kenrel space. - Tapping 4E1s worth of voice channels adds estra 2% system load :) - http://wiki.sangoma.com/wanpipe-voice-rtp-tap - -- AFT Software Ring Buffers on A200/A400 Analog Cards - This feature improves analog preformance under Asterisk/TDM API - mode. In particualr it improves faxing reliability and - minimizes frame slippage due to system load or bad incoming - clock from the line. - Note: All AFT T1/E1 cards have this feature in hardare :) +- Bug fix in Hardware EC code for E1. + Bug introduced in 3.3 release. -* Thu Jan 18 2008 Nenad Corbic - Stable - 3.2.3 -======================================================================== +* Mon Jan 18 2008 Nenad Corbic - Beta - 3.3.1 +==================================================================== -- No changes from 3.2.2 - Version updated for versioning sake. -* Thu Jan 18 2008 Nenad Corbic - Stable - 3.2.2 -======================================================================== +* Mon Jan 16 2008 Nenad Corbic - Beta - 3.3.0.22 +==================================================================== -- AFT Maxim Front end update - Implemented graceful recovery on short circuit. +- BRI protocol:Increased internal timer that could cause issue in systems with +- more than 8 BRI spans -- AFT Driver update - Added a check for TDM IRQ timeout. - On some machines its possible for TDM IRQ to timeout. +* Mon Jan 15 2008 Nenad Corbic - Beta - 3.3.0.21 +==================================================================== -- SMG updated - Fixed wancfg_smg - MTU not properly set on ports 2 and up - Voice only ports were not being added to startup sequence - Updated for callweaver +- BRI protocol:Fix for smg_brid daemon crashing on race condition +- BRI protocol:default_tei parameter is not ignored when using point to +- multipoint anymore -- Added Zaptel 1.4 HW HDLC Support - No Sangoma zaptel patch needed with Zaptel 1.4 +* Mon Jan 14 2008 Nenad Corbic - Beta - 3.3.0.20 +==================================================================== -- Added HWEC Noise flag in wanpipe config file +- BRI protocol: Additional prefix options. +- BRI protocol: Check is caller ID number is all digits on incoming calls +- Sangoma MGD: Removed dynamic user period causing skb panics +- chan_woomera: Fixed issue with rxgain and txgain values set to 0 if +- coding not set in woomera.conf +- wancfg_zaptel: Support for fractional T1/E1 spans. +- wancfg_zaptel: fix issue BRI always being configured as bri_net introduced in v3.3.0.19 -- Updated SMG -- Updated E1 Unframed on Maxim Cards +* Mon Jan 07 2008 Nenad Corbic - Beta - 3.3.0.19 +==================================================================== +- Support for national/international prefix in BRI stack + +* Mon Jan 07 2008 Nenad Corbic - Beta - 3.3.0.18 +==================================================================== + +- Changed Makefile in wanpipe/api/fr causing compilation errors + + +* Thu Dec 20 2007 Nenad Corbic - Beta - 3.3.0.17 +==================================================================== + +- Fix for smg_ctrl boot script starting before network services on some systems +- Support for language parameter in chan_woomera + +* Thu Dec 20 2007 Nenad Corbic - Beta - 3.3.0.16 +==================================================================== + +- Fix for Sangoma BRI Daemon crashing on incoming call if chan_woomera is not installed on that system + +* Tue Dec 18 2007 Nenad Corbic - Beta - 3.3.0.15 +==================================================================== + +- Fix for caller ID value being corrupted sometimes +- Support for call confirmation in chan_woomera + +* Tue Dec 18 2007 Nenad Corbic - Beta - 3.3.0.14 +==================================================================== + +- Fix in smg_brid not releasing some b-channels properly +- Fix in wancfg_smg not setting MTU to 80 when configuring cards for SS7 + +* Fri Dec 14 2007 Nenad Corbic - Beta - 3.3.0.13 +==================================================================== + +- Fix for Kernel panic on 64-bit systems when enabling hardware echo canceller + + +* Thu Dec 5 2007 Nenad Corbic - Beta - 3.3.0.11 +==================================================================== + +- Support for AFT Serial Cards - Updates for AFT PMC and MAXIM framers PMC - lowered LOS sensitivity Fixes fake up/down state changes on @@ -430,216 +420,37 @@ install_init; - Updated Setup script -* Wed Oct 6 2007 Nenad Corbic - Stable - 3.2.1 -===================================================================== -- Setup Zap Chunk Size Patch updated for Zaptel 1.4 - Patch allows running zaptel in 8,16,40,80 chunk size. - However wct drivers must be removed from compilation :) - Patch is now fixed for Zaptel 1.4 - -- Update to All AFT drivers for 64bit 2.6.22 kernel. - Updated affects: AFT A101/2/4/8/200/400 (all cards) - The major 2.6.20+ updates extend to 64bit as well. - Previous drivers segfaulted under 2.6.22 64bit - kernels. This does not affect you if you are running - kennels lower than 2.6.22. - -- Updated legacy drivers for 2.6.22 kernel - - - -* Wed Oct 3 2007 Nenad Corbic - Stable - 3.2.0 -===================================================================== - -- The Beta 3.1.X releases has now been declared as STABLE 3.2.X - -- Fixed AMI/D4 on MAXIM (A101/2/4/8D) cards -- Fixed A200/A400 tip/ring no dial tone issues. -- Fixed 2.6.22 support and above -- Fixed RPM Build post install issue -- Updated Setup install script - Option to build for zaptel: ./Setup zaptel -- Working E&M/RBS/CAS Channel Bank support for MAXIM (A101/2/4/8) cards. -- Fixed wanpipe crashing on system shutdown on some machines. - Caused by RedHat /var/lock/subsys mandatory lock file. -- New Firmware for all MAXIM Cards (A101/2/4/8D) - Firmware V33: Fixes EC Chip Security errors that can cause - PRI to go down on some computers. Firmware is backward compatible - to any previous release. -- Faxes/Modems working through hardware echo canceler. - Tested at 56K from one port to another. - New octasic update. -- Analog Network SYNC Feature for Fax Support - Analog cards can be synced to T1/E1 clock - from adjacent A101/2/4/8 cards for flawless faxing - from FXO/FXS to T1/E1. - -- Known Issues: - T1/E1 High Impedance Tap for MAXIM (A101/2/4/8D) cards. - It works on original PMC A101/2/4 cards - -For more info: http://wiki.sangoma.com - - -* Mon Oct 1 2007 Nenad Corbic - Beta - 3.1.4.6 -==================================================================== - -- Fixed Makefile for 2.6.22.9 kernel. -- Fixed all gcc4 warnings. - - -* Tue Sep 26 2007 Nenad Corbic - Beta - 3.1.4.5 -==================================================================== - -- Updated Setup install script -- A200/A400 Analog driver update - Fixed noise issue introduced in 3.1.4.3 release -- Updated SMG for Asterisk 1.4 & Callweaver - - -* Tue Sep 18 2007 Nenad Corbic - Beta - 3.1.4.3 -==================================================================== - -- A200/A400 Analog driver update - Fixed a problem where analog port starts up without - dialtone. - -* Tue Sep 14 2007 Nenad Corbic - Beta - 3.1.4.2 -==================================================================== - -- Update for 2.6.22 kernel. -- wanrouter startup script update for redhat distros. - Fixes the issue on system shutdown, where wanpipe - module sometimes do not unload due to /var/lock/subsys/ - lockfile check. This issue is only related or RedHat style distros. - - -* Tue Aug 15 2007 Nenad Corbic - Beta - 3.1.4 -==================================================================== - -- Added A101-SH old config support. - So onld A101u or A101c config file can be used with new A101-SH cards. - -- Updated KATM support in the LIP Layer. - Used to connect Kernel ATM Layer to Wanpipe ATM AAL5 layer - over all AFT cards. - -- Added a sanity checker for enabling HWEC. - Used to prevent duble hwec enable. - -- Added wancfg_tdmapi configurator - -- Updated SMG - - -* Mon Jun 30 2007 Nenad Corbic - Beta - 3.1.3 -==================================================================== - -- Update to Ocatsic Hardware Echo Canceler Library - Turned of the NOISE suppression because it can interfere - with faxes. If you faxes did not work properly on 3.1.2 - release they will work fine with this one. - -- Cleaned up the Setup installation script. - - -* Mon Jun 16 2007 Nenad Corbic - Beta - 3.1.2 -==================================================================== - -- Update to Octasic Hardware Echo Canceler library - This is a very important update that affects all AFT cards - with octasic hardware echo canceler. The new octasic update - fixes faxing/modem issues over octasic hwec. The previous - release contained a bug that limited the faxing/modem speeds - to 26k. The new update properly detects fax/modem and works - with full speed of 33k fax and 56k modem. - -- A200/A400 Updated - This update fixes the offhook startup failure. - On startup if fxs is offhook driver will start correctly - -- Wanpipe Startup order changed - The wanpipe startup scripts on bootup were previously - set too early "S03wanrouter". This caused unpredictable - behaviour on some systems. We have now moved wanrouter - startup on boot up to "S11wanrouter", after networking - code. - -- Zaptel Adjustable Chunk Size Feature - Wanpipe drivers can work with 1,2,5 and 10ms - chunk size. Zaptel also supports this, however - the wct4xx driver breaks compilation when chunk - size is changed. ./Setup can how change the - zaptel chunk size for you and update zaptel - Makefiles to remove wct4xx driver out. - - Zaptel with 1ms generates 1000 interrupts per sec - Zaptel with 10ms generates 100 interrupts per sec. - - As you can see its a drastic interrupt performance - increase. - - NOTE: This breaks software echo cancelation, but - its not needed since we have hwec. - - -* Fri Jun 06 2007 Nenad Corbic - Beta - 3.1.1 -==================================================================== - -- A101/2/4/8 (MAXIM) AFT Update IMPORTANT - A major bug fix for AFT Maxim E1 cards for E1 CRC4 Mode. - On some lines the E1/CRC4 mode causes line errors on - the telco side which results in PRI not coming up. - - Symptiom: E1 is up (no alarms) on local side but pri is - not coming up! (Only in E1 CRC4 Mode) - -- A101/2/4/8 (MAXIM) Mandatory Firmware Update - An echo canceler bug has been fixed for all AFT - MAXIM Cards A101/2/4/8dm. New firmware version is V31. - If you are running MAXIM cards with hwec wiht older - firmware version you must upgrade. - -- Updated SMG - Fixed DTMF synchronization - - - -- Updated SMG - Fixed DTMF synchronization - - -* Fri Jun 06 2007 Nenad Corbic - Beta - 3.1.0.1 -==================================================================== - -- Minor release -- Contains zaptel patch for zaptel 1.2.17 and above. -- No driver changes - -* Fri May 17 2007 Nenad Corbic - Beta - 3.1.0 +* Thu Nov 8 2007 Nenad Corbic - Beta - 3.3.0.4 ==================================================================== -- Major new BETA wanpipe release - Changed wanpipe versioning: - Release: A.B.C.D - A - Major Relase number - B - Indicates Stable or Beta - Odd number is Beta - Even number is Stable - C - Minor Release number - D - Optional pre-release and custom releases - -- Fixed RBS Support for all Maxim cards A101/2/4/8. +- Fixed A101/2 (Old) bug introduced in previous releaes -- Support for 2.6.20 kernels. +* Mon Oct 31 2007 Nenad Corbic - Beta - 3.3.0.4 +==================================================================== -- Support for New: A101D A102D A104D Maxim cards - : -- Support for New: AFT 56K DDS card +- Updated BRI caller name +- Updaged Setup -- Redesigned TDM API Events -- TDM API Analog Support +* Mon Oct 15 2007 Nenad Corbic - Beta - 3.3.0.1 +==================================================================== +- Major Updates +- New BRI architecture/support + SMG with Netbricks BRI Stack +- Support for Hardware DTMF + + +* Thu Aug 22 2007 Nenad Corbic - Beta - 3.3.0.p3 +====================================================================== + +- Updated wancfg_zaptel to support HW DTMF + + +* Thu Aug 21 2007 Nenad Corbic - Beta - 3.3.0.p2 +====================================================================== + +- Major Updates +- Hardware DTMF for Asterisk and TDM API - - END - diff --git a/util/tmp_davidy/wancfg_zaptel/templates/ss7_a10u/wanpipe.tdmvoiceapi.a10u b/samples/wanpipe1.rtp similarity index 51% rename from util/tmp_davidy/wancfg_zaptel/templates/ss7_a10u/wanpipe.tdmvoiceapi.a10u rename to samples/wanpipe1.rtp index 379d36e..472f547 100644 --- a/util/tmp_davidy/wancfg_zaptel/templates/ss7_a10u/wanpipe.tdmvoiceapi.a10u +++ b/samples/wanpipe1.rtp @@ -15,36 +15,46 @@ #================================================ [devices] -wanpipeDEVNUM = WAN_AFT, Comment +wanpipe1 = WAN_AFT_TE1, Comment [interfaces] -wDEVNUMg1 = wanpipeDEVNUM, , TDM_VOICE_API, Comment +w1g1 = wanpipe1, , TDM_VOICE_API, Comment -[wanpipeDEVNUM] +[wanpipe1] CARD_TYPE = AFT -S514CPU = FECPU +S514CPU = A CommPort = PRI -AUTO_PCISLOT = NO -PCISLOT = SLOTNUM -PCIBUS = BUSNUM -FE_MEDIA = FEMEDIA -FE_LCODE = FELCODE -FE_FRAME = FEFRAME -FE_LINE = 1 -TE_CLOCK = FECLOCK +AUTO_PCISLOT = YES +PCISLOT = 1 +PCIBUS = 3 +FE_MEDIA = E1 +FE_LCODE = HDB3 +FE_FRAME = CRC4 +FE_LINE = 2 +TE_CLOCK = NORMAL TE_REF_CLOCK = 0 TE_HIGHIMPEDANCE = NO -LBO = FELBO +LBO = 120OH FE_TXTRISTATE = NO MTU = 1500 UDPPORT = 9000 TTL = 255 IGNORE_FRONT_END = NO -TDMV_SPAN = TDMVSPANNO -TDMV_DCHAN = 0 +TDMV_SPAN = 1 +TDMV_DCHAN = 16 -[wDEVNUMg1] +RTP_TAP_IP=192.168.1.1 #Remote IP Address on local network +RTP_TAP_PORT=9000 #Remote UDP Port +RTP_TAP_MAC=00:04:23:B0:24:CE #Remote MAC Address on local network + +RTP_TAP_SAMPLE=100 #RTP sample in millisec. (Default: 100ms) + #100ms = 800bytes = 100 * 8 byte/ms (ulaw/alaw) + +RTP_TAP_DEV=eth0 #Ethernet device on your local machine + #that is connected to the local network + + +[w1g1] ACTIVE_CH = ALL TDMV_ECHO_OFF = NO -TDMV_HWEC = NO -MTU = 80 +TDMV_HWEC = NO diff --git a/samples/wanrouter b/samples/wanrouter index d5b9cec..fac85c0 100644 --- a/samples/wanrouter +++ b/samples/wanrouter @@ -1,6 +1,6 @@ -#!/bin/bash -p +#!/bin/sh # chkconfig: 2345 7 9 -# description: Starts and stop Wanpipe devices +# Description: WANPIPE WAN Router Initialization Script. # # copyright (c) 1999-2002, Sangoma Technologies Inc. # @@ -8,7 +8,8 @@ # 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. -# ============================================================================ +# ========================================================================== +# Sep 19, 2007 Alex Feldman Add DEPMOD=NO support for FreeBSD OS. # July 28,2004 Alex Feldman Do not run 'ztcfg' after interface # configuration. Run ztcfg script manually # after all Voip interfaces loaded. @@ -55,7 +56,8 @@ prompt() return 0 fi - echo -ne "$*" >&2 + # BASH echo -ne "$*" >&2 + echo -n "$*" >&2 read CMD rest return 0 } @@ -87,7 +89,8 @@ getyn() pause() { - [ $# -ne 0 ] && echo -e $* >&2 + # BASH [ $# -ne 0 ] && echo -e $* >&2 + [ $# -ne 0 ] && echo -e "$*" >&2 echo -e "Press [Enter] to continue...\c" >&2 read tmp return 0 @@ -117,7 +120,7 @@ check_awk () fi } -function cleanup () +cleanup () { eval "rm -f $WAN_PROG_LOCK 2> /dev/null > /dev/null" @@ -140,7 +143,8 @@ check_list() val=$1 shift - for i in $* + # BASH for i in $* + for i in "$*" do [ "$val" = "$i" ] && return 0 done return 1 @@ -149,13 +153,15 @@ check_list() # ---------------------------------------------------------------------------- # Display error message. # ---------------------------------------------------------------------------- -error() { +error() +{ echo -e "$SCRIPT: $*!" [ -f "$WAN_LOG" ] && echo -e "$*!" >> $WAN_LOG return 0 } -file_exist() { +file_exist() +{ local ret eval "ls $1.* > /dev/null 2> /dev/null" ret=$? @@ -195,14 +201,16 @@ interface_up() return 0 fi fi - source $WAN_INTR_DIR/ifcfg-$1 + # BASH source $WAN_INTR_DIR/ifcfg-$1 + . $WAN_INTR_DIR/ifcfg-$1 else if [ ! -f $WAN_INTR_DIR/$1 ]; then ifconfig $1 up return 0; fi - source $WAN_INTR_DIR/$1 + # BASH source $WAN_INTR_DIR/$1" + . $WAN_INTR_DIR/$1 fi @@ -274,7 +282,7 @@ interface_up() return 0 } -function check_module () { +check_module () { if [ $OSYSTEM = "Linux" ]; then [ -d "$ROUTER_PROC" ] && { @@ -297,7 +305,24 @@ function check_module () { return 1; } -function load_driver () { +get_mod_name() +{ + local path=$1 + local name=$2 + + if [ "$DEPMOD" = "YES" ]; then + if [ "$OSYSTEM" = "Linux" ]; then + module_name=$name + else + module_name=$name$MODULE_EXT + fi + else + module_name=$path/$name$MODULE_EXT + fi + return 0 +} + +load_driver () { local err @@ -307,17 +332,17 @@ function load_driver () { elif [ $OSYSTEM = "FreeBSD" ]; then err=`$MODULE_LOAD $1 >/dev/null` elif [ $OSYSTEM = "OpenBSD" -o $OSYSTEM = "NetBSD" ]; then - err=`$MODULE_LOAD -o $MODULE_DIR/$1.out -e$1 -p$MODULE_DIR/$POSTINSTALL $MODULE_DIR/$1.o 1> /dev/null` + err=`$MODULE_LOAD -o ${WAN_MODULE_DIR}/$1.out -e$1 -p${WAN_MODULE_DIR}/$POSTINSTALL ${WAN_MODULE_DIR}/$1.o 1> /dev/null` fi return $err } -function unload_driver () { +unload_driver () { local err if [ $OSYSTEM = "OpenBSD" -o $OSYSTEM = "NetBSD" ]; then - \rm -rf $MODULE_DIR/$1.out + \rm -rf ${WAN_MODULE_DIR}/$1.out err=`$MODULE_UNLOAD -n $1 2> /dev/null` else err=`$MODULE_UNLOAD $1 2> /dev/null` @@ -396,7 +421,7 @@ echo "Error: Your securelevel does not allow to load kernel modules!" for i in $MODULES do - module_name=$i${MODULE_EXT} + module_name=$i$MODULE_EXT if [ ! -f $module_name ]; then if [ $OSYSTEM = "Linux" ]; then eval "echo $OPT_MODULES | grep $i > /dev/null 2> /dev/null" @@ -452,14 +477,15 @@ echo "Error: Your securelevel does not allow to load kernel modules!" for i in $MODULES do - if load_driver "$i" + module_name=$i$MODULE_EXT + if load_driver "$module_name" then if [ $opt != silent ]; then echo "ok" >> $WAN_LOG fi else if [ $opt != silent ]; then - echo -e "\nFailed to load wanpipe modules !\n" + echo -e "\nFailed to load $module_name modules !\n" echo "fail" >> $WAN_LOG fi unload_module @@ -577,8 +603,8 @@ interf_config() INTERFACES=`grep ".*=.*$device" -i $WAN_CONF | cut -d' ' -f1 2> /dev/null` # fi - INTERFACES=${INTERFACES// /} - + # BASH INTERFACES=${INTERFACES// /} + INTERFACES=${INTERFACES%% } if [ -z "$INTERFACES" ]; then error "No interface definitions found in $WAN_CONF" @@ -620,7 +646,8 @@ interf_config() if [ "$AWK_SUPPORT" = YES ]; then API=`echo $API | awk '{ gsub(" ", "") ; print }'` elif [ "$BASH_SUPPORT" -gt 1 ]; then - API=${API// /} + # BASH API=${API// /} + API=${API%% } fi if [ "$API" = API ] || [ "$API" = TDM_API ] || [ "$API" = TDM_VOICE_API ]; then @@ -742,7 +769,8 @@ interf_down() # ---------------------------------------------------------------------------- config_devices() { - local devices=$* + # bASH local devices=$* + local devices="$*" for dev in $devices; do if [ $OSYSTEM = "Linux" ] && [ ! -e "$ROUTER_PROC/$dev" ]; then @@ -799,7 +827,8 @@ config_devices() # ---------------------------------------------------------------------------- unconfig_devices() { - local devices=$* + # bASH local devices=$* + local devices="$*" #Stop all routers but check if device #is running first @@ -832,6 +861,16 @@ unconfig_devices() remove_cdev unload_module + for dev in $devices; do + WAN_CONF=$WAN_CONF_DIR/$dev.conf + + INTERFACES=`grep ".*=.*$dev" -i $WAN_CONF | cut -d' ' -f1 2> /dev/null` + for ifname in $INTERFACES; do + ifname=${ifname%%=*} + done + + done + return 0 } @@ -840,7 +879,8 @@ unconfig_devices() # ---------------------------------------------------------------------------- config_interfaces() { - local devices=$* + # bASH local devices=$* + local devices="$*" for dev in $devices; do @@ -877,7 +917,8 @@ config_interfaces() # ---------------------------------------------------------------------------- unconfig_interfaces() { - local devices=$* + # bASH local devices=$* + local devices="$*" #Stop all interfaces, but check whether #device is running first @@ -1000,17 +1041,14 @@ wanec_config () return 0 fi - if [ $DEPMOD != YES ]; then - return 0 - fi - if [ $opt = UNLOAD ]; then lsmods=`$MODULE_STAT` for i in $WANEC_UNLOAD_DRIVERS do echo "$lsmods" | grep -q "$i" && { - if ! unload_driver $i + get_mod_name $WANEC_MOD_DIR $i + if ! unload_driver $module_name then return 1 fi @@ -1022,7 +1060,8 @@ wanec_config () do $MODULE_STAT | grep -q $i && continue - if ! load_driver $i + get_mod_name $WANEC_MOD_DIR $i + if ! load_driver $module_name then return 1 fi @@ -1045,23 +1084,19 @@ lip_config () return 0 fi - file_exist $MOD9 if [ $? -ne 0 ]; then return 0 fi - if [ $DEPMOD != YES ]; then - return 0 - fi - if [ $opt = UNLOAD ]; then lsmods=`$MODULE_STAT` for i in $LIP_UNLOAD_DRIVERS do echo "$lsmods" | grep -q "$i" && { - if ! unload_driver $i + get_mod_name $WANPIPE_LIP_MOD_DIR $i + if ! unload_driver $module_name then return 1 fi @@ -1073,7 +1108,8 @@ lip_config () do $MODULE_STAT | grep -q $i && continue - if ! load_driver $i + get_mod_name $WANPIPE_LIP_MOD_DIR $i + if ! load_driver $module_name then return 1 fi @@ -1147,8 +1183,8 @@ print_active_devices() local silent=${1:-0} local devices - echo -e "Devices currently active:" - echo -en "\t" + echo "Devices currently active:" + echo -n " " if [ $OSYSTEM = "Linux" ]; then #If /proc directory doesn't exist nothing @@ -1176,7 +1212,7 @@ print_active_devices() return $rc } -function check_exists () { +check_exists () { local device=$1 @@ -1196,7 +1232,7 @@ function check_exists () { } -function check_dev_running () +check_dev_running () { local device=$1 local res @@ -1243,7 +1279,8 @@ check_and_print_still_running () if [ ! -z "$devices" ]; then echo "Devices Still Running:" - echo -ne "\t" + # BASH echo -en "\t" + echo -n " " echo $devices echo return 0 @@ -1264,7 +1301,8 @@ create_ft1_conf () { if [ $AWK_SUPPORT = YES ]; then eval "wandev=`echo $wandev | awk '{ gsub(" ", "") ; print }'`" elif [ $BASH_SUPPORT -gt 1 ]; then - wandev=${wandev// /} + # BASH wandev=${wandev// /} + wandev=${wandev%% } fi else echo -e "Error: Device name not found in $WAN_CONF_DIR/$dev.conf\n" @@ -1362,7 +1400,8 @@ check_config_opt () if [ $AWK_SUPPORT = YES ]; then dev=`echo $dev | awk '{ gsub(" ", "") ; print }'` elif [ $BASH_SUPPORT -gt 1 ]; then - dev=${dev// /} + # BASH dev=${dev// /} + dev=${dev%% } fi return $dev ;; @@ -1449,11 +1488,11 @@ wansock_config () fi if [ $opt = UNLOAD ]; then - $MODULE_STAT | grep -q "$AF_WANPIPE" && { - unload_driver $AF_WANPIPE + $MODULE_STAT | grep -q "$AF_WANPIPE_DRIVERS" && { + unload_driver $AF_WANPIPE_DRIVERS } else - load_driver $AF_WANPIPE + load_driver $AF_WANPIPE_DRIVERS fi return 0 } @@ -1510,7 +1549,7 @@ annexg_config () } -function print_wanpipe_config () { +print_wanpipe_config () { echo -e "Wanpipe Config:\n" if [ $OSYSTEM = "Linux" ]; then @@ -1520,7 +1559,7 @@ function print_wanpipe_config () { fi } -function print_wanrouter_status () { +print_wanrouter_status () { echo -e "\nWanrouter Status:\n" if [ $OSYSTEM = "Linux" ]; then @@ -1531,7 +1570,7 @@ function print_wanrouter_status () { } -function print_config_summary () +print_config_summary () { local pfiles; local pfile; @@ -1545,7 +1584,7 @@ function print_config_summary () return; fi - echo -e "Configuration File Summary in : $WAN_HOME\n" + echo -e "Configuration File Summary in : $WAN_HOME/\n" echo -e "Device\t\tProtocol\tType Cpu/Io Slot/Irq Bus\tState" echo -e "------------------------------------------------------------------------" @@ -1568,7 +1607,7 @@ function print_config_summary () continue fi - echo -e -n "$pdev\t" + echo -n "$pdev " pprot=`grep "^wanpiped*=*" $pfile | cut -d'=' -f2 | awk '{ gsub(" ", "") ; print }' | cut -d',' -f1` if [ $? -ne 0 ]; then @@ -1580,52 +1619,53 @@ function print_config_summary () fi if [ $pprot = WAN_X25 ] || [ $pprot = WAN_PPP ] || [ $pprot = WAN_FR ] || [ $pprot = WAN_MFR ] || [ $pprot = WAN_BSC ] || [ $pprot = WAN_AFT ] || [ $pprot = WAN_SS7 ] || [ $pprot = WAN_POS ] || [ $pprot = WAN_ATM ]; then - echo -e -n "$pprot\t\t" + #echo -e -n "$pprot\t\t" + echo -n "$pprot " else - echo -e -n "$pprot\t" + echo -n "$pprot " fi phw=`grep "^S514CPU*" $pfile` if [ $? -eq 0 ]; then - echo -e -n "PCI\t" + echo -n "PCI " pcpu=`grep -i "^S514CPU*" $pfile | cut -d'=' -f2 | awk '{ gsub(" ", "") ; print }' | cut -d',' -f1` - echo -e -n "$pcpu\t" + echo -n "$pcpu " pslot=`grep -i "^PCISLOT*" $pfile | cut -d'=' -f2 | awk '{ gsub(" ", "") ; print }' | cut -d',' -f1` - echo -e -n "$pslot\t" + echo -n "$pslot " pbus=`grep -i "^PCIBUS*" $pfile | cut -d'=' -f2 | awk '{ gsub(" ", "") ; print }' | cut -d',' -f1` if [ -z $pbus ]; then - echo -e -n "0\t" + echo -n "0 " else - echo -e -n "$pbus\t" + echo -n "$pbus " fi else if [ $pprot = WAN_ADSL ]; then - echo -e -n "PCI\t" + echo -n "PCI " - echo -e -n "N/A\t" + echo -n "N/A " pslot=`grep -i "^PCISLOT*" $pfile | cut -d'=' -f2 | awk '{ gsub(" ", "") ; print }' | cut -d',' -f1` - echo -e -n "$pslot\t" + echo -n "$pslot " pbus=`grep -i "^PCIBUS*" $pfile | cut -d'=' -f2 | awk '{ gsub(" ", "") ; print }' | cut -d',' -f1` if [ -z $pbus ]; then - echo -e -n "0\t" + echo -n "0 " else - echo -e -n "$pbus\t" + echo -n "$pbus " fi else - echo -n -e "ISA\t" + echo -n "ISA " pport=`grep -i "^IOPORT*" $pfile | cut -d'=' -f2 | awk '{ gsub(" ", "") ; print }' | cut -d',' -f1` - echo -e -n "$pport\t" + echo -n "$pport " pport=`grep -i "^IRQ*" $pfile | cut -d'=' -f2 | awk '{ gsub(" ", "") ; print }' | cut -d',' -f1` - echo -e -n "$pport\t" + echo -n "$pport " - echo -e -n "n/a\t" + echo -n "n/a " fi fi @@ -1646,9 +1686,9 @@ function print_config_summary () fi fi if [ -z $pstate ]; then - echo -e -n "Inactive\t" + echo -n "Inactive" else - echo -e -n "$pstate\t" + echo -n "$pstate" fi echo @@ -1656,7 +1696,7 @@ function print_config_summary () done } -function wanrouter_if_debug() +wanrouter_if_debug() { echo echo "Debug Info for $1" @@ -1752,85 +1792,13 @@ function wanrouter_if_debug() fi } - - -pci_parity_ctrl () -{ - local parity_cmd; - local pdev; - local IDS; - local verbosity=${2:-1} - - if [ $OSYSTEM != "Linux" ]; then - echo "Error: PCI Parity Ctrl only available on Linux" - echo - return - fi - - IDS=`lspci | cut -d' ' -f1` - - if [ -z $1 ]; then - echo "Displaying System PCI Parity Configuration"; - echo "==========================================" - echo - lspci -vvv | grep Parity - echo - echo "==========================================" - return - fi - - parity_cmd=${1:-"off"} - - if [ $parity_cmd != "on" ]; then - parity_cmd="off"; - fi - - eval "type setpci 2> /dev/null > /dev/null" - if [ $? -ne 0 ]; then - echo "Parity Set Error: setpci utility not found!" - return - fi - - if [ $verbosity -gt 0 ]; then - echo "Setting PCI Parity to $parity_cmd"; - fi - - for pdev in $IDS - do - if [ "$parity_cmd" = "on" ]; then - eval "setpci -s $pdev 3e.b=0x7" - else - eval "setpci -s $pdev 3e.b=0x4" - fi - - done - - return -} - -wanrouter_pre_start() -{ - - if [ "$WAN_PCI_PARITY" = "OFF" ]; then - echo "Wanrouter: Disabling PCI Parity on Start!" >> $WAN_LOG; - pci_parity_ctrl "off" 0 - elif [ "$WAN_PCI_PARITY" = "ON" ]; then - echo "Wanrouter: Enabling PCI Parity on Start!" >> $WAN_LOG; - pci_parity_ctrl "on" 0 - fi -} - - - - - -function wanrouter_debug () +wanrouter_debug () { local err=0 echo - if [ ! -d ${WAN_HOME} ]; then - echo "Error: ${WAN_HOME} not found" + if [ ! -d $WAN_HOME ]; then + echo "Error: $WAN_HOME not found" echo "Reason: Wanpipe not installed properly" echo "Solution: Re-install wanpipe" return @@ -1852,7 +1820,7 @@ function wanrouter_debug () unload_module fi - if [ ! -f ${WAN_HOME}/wanpipe1.conf ]; then + if [ ! -f $WAN_HOME/wanpipe1.conf ]; then echo "Warning: wanpipe1.conf configuration file not found" echo "Reason: did not run /usr/sbin/wancfg to create it" echo "Solution: run /usr/sbin/wancfg :)" @@ -1908,7 +1876,7 @@ function wanrouter_debug () echo } -function check_command_exist () +check_command_exist () { local cmd=$1 local cmd_rc @@ -1923,7 +1891,7 @@ function check_command_exist () return $cmd_rc } -function init_meta_conf () +init_meta_conf () { ROUTER_BOOT= WANPIPE_CONF_DIR= @@ -1948,7 +1916,7 @@ function init_meta_conf () WAN_DEVICES= } -function read_meta_conf () +read_meta_conf () { if [ $OSYSTEM = "Linux" ]; then @@ -1976,7 +1944,7 @@ function read_meta_conf () return 0 } -function meta_conf_compatiblity () +meta_conf_compatiblity () { WAN_CONF_DIR=$WANPIPE_CONF_DIR WAN_INTR_DIR=$WANPIPE_INTR_DIR @@ -1989,7 +1957,7 @@ function meta_conf_compatiblity () } -function wanrouter_script() +wanrouter_script() { local cmd=$1 local dev=$2 @@ -2016,7 +1984,7 @@ function wanrouter_script() fi } -function generate_adsl_list() +generate_adsl_list() { local vci=0; local vpi=0; @@ -2048,10 +2016,10 @@ function generate_adsl_list() } # FIXME: Add code for BSD -function wan_force_unload_modules() +wan_force_unload_modules() { if [ $OSYSTEM = "Linux" ]; then - if [ -e "$ROUTER_PROC/status" ]; then + if [ -e "$ROUTER_PROC" ] && [ -e "$ROUTER_PROC/status" ]; then wp_list=`cat $ROUTER_PROC/status | cut -d' ' -f1 | grep wanpipe | sort -r` if [ -z $list ]; then mod_list=`cat /proc/modules | grep wan | cut -d ' ' -f1 | xargs` @@ -2065,7 +2033,7 @@ function wan_force_unload_modules() } # FIXME: Add code for BSD -function stop_running_wanpipes () +stop_running_wanpipes () { if [ $OSYSTEM = "Linux" ]; then @@ -2074,7 +2042,8 @@ function stop_running_wanpipes () for list in $wp_list do - list=${list// /}; + # BASH list=${list// /}; + list=${list%% }; if [ ! -z $list ]; then eval "rm -f $WAN_PROG_LOCK 2> /dev/null > /dev/null" wanrouter stop $list @@ -2086,7 +2055,7 @@ function stop_running_wanpipes () fi } -function config_wanrouter_rc () +config_wanrouter_rc () { local sequence local num @@ -2147,6 +2116,209 @@ fi } +init_global_params() +{ + + if [ $OSYSTEM = "Linux" ]; then + ROUTER_VERSION=3.3.2 + IFCONFIG_LIST=ifconfig + MODULE_STAT=lsmod + WAN_DRIVERS="wanpipe" + AF_WANPIPE_DRIVERS=af_wanpipe + ANNEXG_LOAD_DRIVERS="wanpipe_lapb wanpipe_x25 wanpipe_dsp" + ANNEXG_UNLOAD_DRIVERS="wanpipe_dsp wanpipe_x25 wanpipe_lapb" + LIP_LOAD_DRIVERS="wanpipe_lip" + LIP_UNLOAD_DRIVERS="wanpipe_lip" + WANEC_LOAD_DRIVERS="wanec" + WANEC_UNLOAD_DRIVERS="wanec" + MODULE_LOAD=modprobe + MODULE_UNLOAD="modprobe -r" + MODULE_EXT=".ko" + DEPMOD=YES + + check_command_exist modprobe + if [ $? -ne 0 ]; then + check_command_exist insmod + if [ $? -eq 0 ]; then + DEPMOD=NO + MODULE_LOAD=insmod + MODULE_UNLOAD=rmmod + fi + fi + + MOD1=/lib/modules/sdladrv + MOD2=/lib/modules/wanrouter + MOD3=/lib/modules/wanpipe_syncppp + MOD4=/lib/modules/wanpipe + MOD5=/lib/modules/af_wanpipe + + if [ -d /lib/modules/$(uname -r) ]; then + uname -r | grep "^2.4.*" > /dev/null + if [ $? -eq 0 ]; then + MODULE_EXT=".o" + if [ -d /lib/modules/$(uname -r)/kernel ]; then + MOD1=/lib/modules/$(uname -r)/kernel/drivers/net/wan/sdladrv + MOD2=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanrouter + MOD3=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_syncppp + MOD4=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe + MOD5=/lib/modules/$(uname -r)/kernel/net/wanrouter/af_wanpipe + + MOD6=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_lapb + MOD7=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_x25 + MOD8=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_dsp + + MOD9=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanpipe_lip + WANPIPE_LIP_MOD_DIR=/lib/modules/$(uname -r)/kernel/net/wanrouter + MOD10=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanec + WANEC_MOD_DIR=/lib/modules/$(uname -r)/kernel/net/wanrouter + + fi + else + + uname -r | grep "^2.6.*" > /dev/null + if [ $? -eq 0 ]; then + if [ -d /lib/modules/$(uname -r)/kernel ]; then + MOD1=/lib/modules/$(uname -r)/kernel/drivers/net/wan/sdladrv + MOD2=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanrouter + MOD3=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_syncppp + MOD4=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe + MOD5=/lib/modules/$(uname -r)/kernel/net/wanrouter/af_wanpipe + + MOD6=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_lapb + MOD7=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_x25 + MOD8=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_dsp + + MOD9=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanpipe_lip + WANPIPE_LIP_MOD_DIR=/lib/modules/$(uname -r)/kernel/net/wanrouter + MOD10=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanec + WANEC_MOD_DIR=/lib/modules/$(uname -r)/kernel/net/wanrouter + fi + else + if [ -d /lib/modules/$(uname -r)/net ]; then + MOD1=/lib/modules/$(uname -r)/net/sdladrv + MOD2=/lib/modules/$(uname -r)/misc/wanrouter + MOD3=/lib/modules/$(uname -r)/net/wanpipe_syncppp + MOD4=/lib/modules/$(uname -r)/net/wanpipe + MOD5=/lib/modules/$(uname -r)/misc/af_wanpipe + + MOD6=/lib/modules/$(uname -r)/net/wanpipe_lapb + MOD7=/lib/modules/$(uname -r)/net/wanpipe_x25 + MOD8=/lib/modules/$(uname -r)/net/wanpipe_dsp + + MOD9=/lib/modules/$(uname -r)/misc/wanpipe_lip + WANPIPE_LIP_MOD_DIR=/lib/modules/$(uname -r)/misc + MOD10=/lib/modules/$(uname -r)/misc/wanec + WANEC_MOD_DIR=/lib/modules/$(uname -r)/misc + fi + fi + fi + fi + + MODULES="$MOD1 $MOD2 $MOD3 $MOD4 $MOD5" + OPT_MODULES="$MOD3 $MOD5" + UMODULES="af_wanpipe wanpipe wanpipe_syncppp wanrouter sdladrv" + + elif [ $OSYSTEM = "FreeBSD" ]; then + + SYSCTL=/sbin/sysctl + AWK=/usr/bin/awk + PKGINFO=/usr/sbin/pkg_info + major_ver=${RELEASE%%.*} + ROUTER_VERSION=`$PKGINFO | $AWK '$1~/wanpipe/ {$1=""; print }'` + IFCONFIG_LIST=ifconfig + CDEV_WANROUTER=/dev/$SCRIPT + CDEV_MAJOR=139 + CDEV_MINOR=0 + MODULE_STAT=kldstat + MODULE_LOAD=kldload + MODULE_UNLOAD=kldunload + MODULE_EXT=".ko" + DEPMOD=YES + if [ "$major_ver" = "5" -o "$major_ver" = "6" ]; then + MODULE_DIR=/boot/modules + else + MODULE_DIR=/modules + fi + + if [ -z ${WAN_MODULE_DIR} ]; then + WAN_MODULE_DIR=${MODULE_DIR} + else + if [ "${WAN_MODULE_DIR}" != ${MODULE_DIR} ]; then + DEPMOD=NO + fi + fi + + MOD9="${WAN_MODULE_DIR}/wanpipe_lip" + WANPIPE_LIP_MOD_DIR=${WAN_MODULE_DIR} + MOD10="${WAN_MODULE_DIR}/wanec" + WANEC_MOD_DIR=${WAN_MODULE_DIR} + MODULES="${WAN_MODULE_DIR}/sdladrv ${WAN_MODULE_DIR}/wanrouter ${WAN_MODULE_DIR}/wanpipe" + UMODULES="wanpipe_lip wanec wanpipe wanrouter sdladrv" + WAN_DRIVERS="wanpipe" + LIP_LOAD_DRIVERS="wanpipe_lip" + LIP_UNLOAD_DRIVERS="wanpipe_lip" + WANEC_LOAD_DRIVERS="wanec" + WANEC_UNLOAD_DRIVERS="wanec" + + elif [ $OSYSTEM = "OpenBSD" ]; then + + SYSCTL=/sbin/sysctl + AWK=/usr/bin/awk + PKGINFO=/usr/sbin/pkg_info + SECURELEVEL=`$SYSCTL -n kern.securelevel` + ROUTER_VERSION=`$PKGINFO | $AWK '$1~/wanpipe/ {$1=""; print }'` + IFCONFIG_LIST="ifconfig -a" + CDEV_WANROUTER=/dev/$SCRIPT + CDEV_MAJOR=139 + CDEV_MINOR=0 + POSTINSTALL=create_cdev + MODULE_STAT=modstat + MODULE_LOAD=modload + MODULE_UNLOAD=modunload + MODULE_DIR=/usr/lkm + DEPMOD=YES + if [ -z ${WAN_MODULE_DIR} ]; then + WAN_MODULE_DIR=${MODULE_DIR} + else + if [ "${WAN_MODULE_DIR}" != ${MODULE_DIR} ]; then + DEPMOD=NO + fi + fi + MODULE_EXT=".o" + MODULES="${WAN_MODULE_DIR}/wanpipe" + UMODULES="wanpipe" + WAN_DRIVERS="wanpipe" + elif [ $OSYSTEM = "NetBSD" ]; then + + SYSCTL=/sbin/sysctl + AWK=/usr/bin/awk + PKGINFO=/usr/sbin/pkg_info + SECURELEVEL=`$SYSCTL -n kern.securelevel` + ROUTER_VERSION=`$PKGINFO | $AWK '$1~/wanpipe/ {$1=""; print }'` + IFCONFIG_LIST="ifconfig -a" + CDEV_WANROUTER=/dev/$SCRIPT + CDEV_MAJOR=139 + CDEV_MINOR=0 + POSTINSTALL=create_cdev + MODULE_STAT=modstat + MODULE_LOAD=modload + MODULE_UNLOAD=modunload + MODULE_DIR=/usr/lkm + DEPMOD=YES + if [ -z ${WAN_MODULE_DIR} ]; then + WAN_MODULE_DIR=${MODULE_DIR} + else + if [ "${WAN_MODULE_DIR}" != ${MODULE_DIR} ]; then + DEPMOD=NO + fi + fi + MODULE_EXT=".o" + MODULES="${WAN_MODULE_DIR}/wanpipe" + UMODULES="wanpipe" + WAN_DRIVERS="wanpipe" + fi + return 0 +} ####### MAIN ################################################################# # set -x @@ -2163,13 +2335,6 @@ PROD=wanpipe SCRIPT=wanrouter REDHAT=/usr/src/redhat ROUTER_PROC=/proc/net/wanrouter -AF_WANPIPE=af_wanpipe -ANNEXG_LOAD_DRIVERS="wanpipe_lapb wanpipe_x25 wanpipe_dsp" -ANNEXG_UNLOAD_DRIVERS="wanpipe_dsp wanpipe_x25 wanpipe_lapb" -LIP_LOAD_DRIVERS="wanpipe_lip" -LIP_UNLOAD_DRIVERS="wanpipe_lip" -WANEC_LOAD_DRIVERS="wanec" -WANEC_UNLOAD_DRIVERS="wanec" WAN_PROG_LOCK=/var/lock/wanrouter_lock DEPMOD=YES LINEPROBE_PATH=/usr/sbin/lineprobe @@ -2177,157 +2342,9 @@ WANPIPE_IS_RUNNING=/var/run/wanpipe_is_running RUGGEDCOM=No -if [ $OSYSTEM = "Linux" ]; then - ROUTER_VERSION=3.2.7.1 - IFCONFIG_LIST=ifconfig - MODULE_STAT=lsmod - WAN_DRIVERS="wanpipe" - MODULE_LOAD=modprobe - MODULE_UNLOAD="modprobe -r" - MODULE_EXT=".*" - DEPMOD=YES - - check_command_exist modprobe - if [ $? -ne 0 ]; then - check_command_exist insmod - if [ $? -eq 0 ]; then - DEPMOD=NO - MODULE_LOAD=insmod - MODULE_UNLOAD=rmmod - fi - fi - - MOD1=/lib/modules/sdladrv - MOD2=/lib/modules/wanrouter - MOD3=/lib/modules/wanpipe_syncppp - MOD4=/lib/modules/wanpipe - MOD5=/lib/modules/af_wanpipe - - if [ -d /lib/modules/$(uname -r) ]; then - uname -r | grep "^2.4.*" > /dev/null - if [ $? -eq 0 ]; then - if [ -d /lib/modules/$(uname -r)/kernel ]; then - MOD1=/lib/modules/$(uname -r)/kernel/drivers/net/wan/sdladrv - MOD2=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanrouter - MOD3=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_syncppp - MOD4=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe - MOD5=/lib/modules/$(uname -r)/kernel/net/wanrouter/af_wanpipe - - MOD6=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_lapb - MOD7=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_x25 - MOD8=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_dsp - MOD9=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanpipe_lip - MOD10=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanec - fi - else - - uname -r | grep "^2.6.*" > /dev/null - if [ $? -eq 0 ]; then - if [ -d /lib/modules/$(uname -r)/kernel ]; then - MOD1=/lib/modules/$(uname -r)/kernel/drivers/net/wan/sdladrv - MOD2=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanrouter - MOD3=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_syncppp - MOD4=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe - MOD5=/lib/modules/$(uname -r)/kernel/net/wanrouter/af_wanpipe - - MOD6=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_lapb - MOD7=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_x25 - MOD8=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_dsp - MOD9=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanpipe_lip - MOD10=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanec - fi - else - if [ -d /lib/modules/$(uname -r)/net ]; then - MOD1=/lib/modules/$(uname -r)/net/sdladrv - MOD2=/lib/modules/$(uname -r)/misc/wanrouter - MOD3=/lib/modules/$(uname -r)/net/wanpipe_syncppp - MOD4=/lib/modules/$(uname -r)/net/wanpipe - MOD5=/lib/modules/$(uname -r)/misc/af_wanpipe - - MOD6=/lib/modules/$(uname -r)/net/wanpipe_lapb - MOD7=/lib/modules/$(uname -r)/net/wanpipe_x25 - MOD8=/lib/modules/$(uname -r)/net/wanpipe_dsp - MOD9=/lib/modules/$(uname -r)/misc/wanpipe_lip - MOD10=/lib/modules/$(uname -r)/misc/wanec - fi - fi - fi - fi - - MODULES="$MOD1 $MOD2 $MOD3 $MOD4 $MOD5" - OPT_MODULES="$MOD3 $MOD5" - UMODULES="af_wanpipe wanpipe wanpipe_syncppp wanrouter sdladrv" - -elif [ $OSYSTEM = "FreeBSD" ]; then - - SYSCTL=/sbin/sysctl - AWK=/usr/bin/awk - PKGINFO=/usr/sbin/pkg_info - major_ver=${RELEASE%%.*} - ROUTER_VERSION=`$PKGINFO | $AWK '$1~/wanpipe/ {$1=""; print }'` - IFCONFIG_LIST=ifconfig - CDEV_WANROUTER=/dev/$SCRIPT - CDEV_MAJOR=139 - CDEV_MINOR=0 - MODULE_STAT=kldstat - MODULE_LOAD=kldload - MODULE_UNLOAD=kldunload - MODULE_EXT=".*" - - if [ "$major_ver" = "5" -o "$major_ver" = "6" ]; then - MODULE_DIR=/boot/modules - else - MODULE_DIR=/modules - fi - MOD9="$MODULE_DIR/wanpipe_lip" - MOD10="$MODULE_DIR/wanec" - MODULES="$MODULE_DIR/wanrouter $MODULE_DIR/sdladrv $MODULE_DIR/wanpipe" - WAN_DRIVERS="wanpipe" - -elif [ $OSYSTEM = "OpenBSD" ]; then - - SYSCTL=/sbin/sysctl - AWK=/usr/bin/awk - PKGINFO=/usr/sbin/pkg_info - SECURELEVEL=`$SYSCTL -n kern.securelevel` - ROUTER_VERSION=`$PKGINFO | $AWK '$1~/wanpipe/ {$1=""; print }'` - IFCONFIG_LIST="ifconfig -a" - CDEV_WANROUTER=/dev/$SCRIPT - CDEV_MAJOR=139 - CDEV_MINOR=0 - POSTINSTALL=create_cdev - MODULE_STAT=modstat - MODULE_LOAD=modload - MODULE_UNLOAD=modunload - MODULE_DIR=/usr/lkm - MODULE_EXT=".o" - MODULES="$MODULE_DIR/wanpipe" - WAN_DRIVERS="wanpipe" -elif [ $OSYSTEM = "NetBSD" ]; then - - SYSCTL=/sbin/sysctl - AWK=/usr/bin/awk - PKGINFO=/usr/sbin/pkg_info - SECURELEVEL=`$SYSCTL -n kern.securelevel` - ROUTER_VERSION=`$PKGINFO | $AWK '$1~/wanpipe/ {$1=""; print }'` - IFCONFIG_LIST="ifconfig -a" - CDEV_WANROUTER=/dev/$SCRIPT - CDEV_MAJOR=139 - CDEV_MINOR=0 - POSTINSTALL=create_cdev - MODULE_STAT=modstat - MODULE_LOAD=modload - MODULE_UNLOAD=modunload - MODULE_DIR=/usr/lkm - MODULE_EXT=".o" - MODULES="$MODULE_DIR/wanpipe" - WAN_DRIVERS="wanpipe" -fi - check_bash check_awk - # Return code RC=$(pwd)/return_code GET_RC="cat $RC" @@ -2347,6 +2364,8 @@ if [ "$WANPIPE_CONF_DIR" != "" -a "$WAN_CONF_DIR" = "" ] || [ "$WAN_ADSL_LIST" = meta_conf_compatiblity fi +init_global_params + WAN_LIP_LOAD=YES WANEC_LOAD=YES WAN_ANNEXG_LOAD=${WAN_ANNEXG_LOAD:-NO} @@ -2427,7 +2446,6 @@ if [ $OSYSTEM = "Linux" ]; then fi fi - echo # If modules doesn't loaded remove all lock file from WAN_LOCK_DIR. check_module @@ -2447,8 +2465,6 @@ case "$1" in cleanup 2 fi - wanrouter_pre_start - config_devices $WAN_DEVICES config_interfaces $WAN_DEVICES @@ -2485,8 +2501,6 @@ case "$1" in dev="wanpipe$ft1_or_wanpipe" fi - wanrouter_pre_start - config_devices $dev if [ $? -ne 0 ]; then cleanup 3 @@ -2532,8 +2546,6 @@ case "$1" in echo -e "\nInterface $if_name is already up!\n" cleanup 1 fi - - wanrouter_pre_start echo "Configuring interface: $if_name" @@ -2591,8 +2603,9 @@ case "$1" in WAN_DEVICES=$tmp_dev_list fi + wanrouter_script stop - + unconfig_interfaces $WAN_DEVICES unconfig_devices $WAN_DEVICES @@ -2655,7 +2668,7 @@ case "$1" in WAN_CONF=$WAN_CONF_DIR/$dev.conf check_file $WAN_CONF || cleanup 1 - + wanrouter_script stop $dev $if_name eval "$IFCONFIG_LIST | grep -w $if_name > /dev/null 2> /dev/null" @@ -2746,7 +2759,6 @@ case "$1" in unconfig_devices $WAN_DEVICES - wanrouter_script stop elif [ -z $3 ]; then #WANROUTER STOP_DEV WANPIPE @@ -2929,11 +2941,6 @@ case "$1" in cleanup 0; ;; - parity) - pci_parity_ctrl $2 - ;; - - wanrc) config_wanrouter_rc diff --git a/samples/wanrouter.org b/samples/wanrouter.org deleted file mode 100644 index 1f02e8f..0000000 --- a/samples/wanrouter.org +++ /dev/null @@ -1,2986 +0,0 @@ -#!/bin/bash -p -# chkconfig: 2345 7 9 -# wanrouter WANPIPE WAN Router Initialization Script. -# -# copyright (c) 1999-2002, Sangoma Technologies 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. -# ============================================================================ -# July 28,2004 Alex Feldman Do not run 'ztcfg' after interface -# configuration. Run ztcfg script manually -# after all Voip interfaces loaded. -# Jan 16, 2004 David Rokhvarg Added 'lineprobe' option -# Mar 12, 2001 Nenad Corbic Added new if support -# Feb 20, 2001 Nenad Corbic Use /proc/net/wanrouter/status to determine -# the active devices. -# Jul 17, 2000 Nenad Corbic Added version option. -# Fixed the shutdown bug. If all interfaces -# are down but modules loaded, unload -# modules. -# May 30, 2000 Nenad Corbic Updated for v2.1.4 -# Enable IP Forwarding Option -# Apr 05, 2000 Nenad Corbic Updated for v2.1.3 -# Feb 22. 2000 Nenad Corbic Updated for v2.1.2 -# Feb 15, 2000 Nenad Corbic Load WANPIPE socket module along -# with router modules. -# Jan 18, 2000 Nenad Corbic No interface files are needed for API, -# interfaces. No IP addresses neccessary. -# Nov 09, 1999 Nenad Corbic Updated for v2.1.1 -# Enabled starting and stoping -# each wanpipe device separately. -# Nov 09, 1999 Nenad Corbic Updated for v2.1.1 -# Oct 04, 1999 Nenad Corbic Updated for v2.1.0 -# Aug 04, 1999 Nenad Corbic Updated for v2.0.5 -# Oct 15, 1998 Jaspreet Singh Updated for v2.0.4 -# Dec 09, 1997 Jaspreet Singh Updated for v2.0.2 -# Nov 28, 1997 Jaspreet Singh Updated for v2.0.1 -# Nov 06, 1997 Jaspreet Singh Updated for v2.0.0 -# Jul 28, 1997 Jaspreet Singh Updated for v1.0.5 -# Jul 10, 1997 Jaspreet Singh Updated for v1.0.4 -# Dec 15, 1996 Gene Kozin Initial version based on Sangoma's WANPIPE(tm) -# ============================================================================ - -####### FUNCTION DEFINITIONS ################################################# - - -# ---------------------------------------------------------------------------- -# Prompt user for input. -# ---------------------------------------------------------------------------- -prompt() -{ - if test $NONINTERACTIVE; then - return 0 - fi - - echo -ne "$*" >&2 - read CMD rest - return 0 -} - -# ---------------------------------------------------------------------------- -# Get Yes/No -# ---------------------------------------------------------------------------- -getyn() -{ - if test $NONINTERACTIVE; then - return 0 - fi - - while prompt "$* (y/n) " - do case $CMD in - [yY]) return 0 - ;; - [nN]) return 1 - ;; - *) echo -e "\nPlease answer y or n" >&2 - ;; - esac - done -} - -# ---------------------------------------------------------------------------- -# Pause. -# ---------------------------------------------------------------------------- -pause() -{ - - [ $# -ne 0 ] && echo -e $* >&2 - echo -e "Press [Enter] to continue...\c" >&2 - read tmp - return 0 -} - -check_bash () -{ - BASH_SUPPORT=`echo $BASH_VERSION | cut -d'.' -f1 2> /dev/null` -} - -check_awk () -{ - major_ver=${RELEASE%%.*} - if [ $OSYSTEM = "Linux" ]; then - eval "type awk 2> /dev/null > /dev/null" - elif [ $OSYSTEM = "FreeBSD" -a "$major_ver" = "5" ]; then - eval "type awk 2> /dev/null > /dev/null" - elif [ $OSYSTEM = "FreeBSD" -a "$major_ver" = "6" ]; then - eval "type awk 2> /dev/null > /dev/null" - else - eval "awk 2> /dev/null > /dev/null" - fi - if [ $? -eq 0 ]; then - AWK_SUPPORT=YES - else - AWK_SUPPORT=NO - fi -} - -function cleanup () -{ - eval "rm -f $WAN_PROG_LOCK 2> /dev/null > /dev/null" - - #Check module checks if modules are loaded and updates - #the subsys lock for LINUX - check_module - - exit $1 -} - - -# ---------------------------------------------------------------------------- -# Check to see if a value belongs to the list. -# Return: 0 - yes -# 1 - no -# ---------------------------------------------------------------------------- -check_list() -{ - [ $# -lt 2 ] && return 1 - - val=$1 - shift - for i in $* - do [ "$val" = "$i" ] && return 0 - done - return 1 -} - -# ---------------------------------------------------------------------------- -# Display error message. -# ---------------------------------------------------------------------------- -error() { - echo -e "$SCRIPT: $*!" - [ -f "$WAN_LOG" ] && echo -e "$*!" >> $WAN_LOG - return 0 -} - -file_exist() { - local ret - eval "ls $1.* > /dev/null 2> /dev/null" - ret=$? - return $ret -} - -# ---------------------------------------------------------------------------- -# Configure network interface. -# This routine performs TCP/IP-level interface configuration. Interface name -# is given as an argument. It reads a configuration file with the same name in -# and calls ifconfig and route to do the job. -# -# Configuration file is actually a shell script containing only variables: -# -# ONBOOT=yes if not 'yes' then skip this file -# IPADDR=xxx.xxx.xxx.xxx IP address of this interface -# NETMASK=xxx.xxx.xxx.xxx Network mask for this interface -# NETWORK=xxx.xxx.xxx.xxx Network address -# BROADCAST=xxx.xxx.xxx.xxx Broadcast address -# POINTOPOINT=xxx.xxx.xxx.xxx Point-to-point address -# GATEWAY=xxx.xxx.xxx.xxx Gateway address -# ---------------------------------------------------------------------------- -interface_up() -{ - ONBOOT= - IPADDR= - NETMASK= - NETWORK= - BROADCAST= - POINTOPOINT= - GATEWAY= - - if [ $NEW_IF_TYPE = YES ]; then - if [ $LINUX_DISTR = redhat ]; then - if [ $WAN_INTR_DIR = "/etc/sysconfig/network-scripts" ]; then - ifup $1 - return 0 - fi - fi - source $WAN_INTR_DIR/ifcfg-$1 - else - if [ ! -f $WAN_INTR_DIR/$1 ]; then - ifconfig $1 up - return 0; - fi - - source $WAN_INTR_DIR/$1 - fi - - - # Configure interface. - if [ "$IPADDR" -a "$IPADDR" != "0.0.0.0" ]; then - # Prepare ifconfig options. - OPTIONS= - if [ $OSYSTEM = "Linux" ]; then - [ "$POINTOPOINT" ] && OPTIONS="$OPTIONS pointopoint $POINTOPOINT" - else - [ "$POINTOPOINT" ] && OPTIONS="$OPTIONS $POINTOPOINT" - fi - [ "$NETMASK" ] && OPTIONS="$OPTIONS netmask $NETMASK" - [ "$BROADCAST" ] && OPTIONS="$OPTIONS broadcast $BROADCAST" - - if [ $OSYSTEM = "Linux" ]; then - ifconfig $1 $IPADDR $OPTIONS - else - ifconfig $1 inet $IPADDR $OPTIONS - fi - ifconfig $1 up - else - ifconfig $1 up - fi - - if [ "$GATEWAY" ]; then - check_command_exist route - if [ $? -eq 0 ]; then - if [ $OSYSTEM = "Linux" ]; then - if [ "$GATEWAY" = 0 ] || [ "$GATEWAY" = "0.0.0.0" ]; then - if [ "$IPADDR" -a "$IPADDR" != "0" -a "$IPADDR" != "0.0.0.0" ]; then - route add default dev $1 - fi - else - route add default gw $GATEWAY - fi - else - if [ "$GATEWAY" = 0 ] || [ "$GATEWAY" = "0.0.0.0" ]; then - if [ "$IPADDR" -a "$IPADDR" != "0" -a "$IPADDR" != "0.0.0.0" ]; then - route add -net 0.0.0.0 -interface $1 - fi - else - route add -net 0.0.0.0 $GATEWAY - fi - fi - else - if [ $OSYSTEM = "Linux" ]; then - check_command_exist ip - if [ $? -eq 0 ]; then - if [ "$GATEWAY" = 0 ] || [ "$GATEWAY" = "0.0.0.0" ]; then - ip route add default dev $1 - else - ip route add default via $GATEWAY - fi - return 0 - fi - fi - echo - echo "Error: Failed to set route, no route or ip cmd found" - echo - fi - fi - - if [ $OSYSTEM = "Linux" ] && [ $LINUX_DISTR = redhat ]; then - /etc/sysconfig/network-scripts/ifup-routes $1 - fi - - - return 0 -} - -function check_module () { - - if [ $OSYSTEM = "Linux" ]; then - [ -d "$ROUTER_PROC" ] && { - touch $WAN_LOCK 2> /dev/null - return 0 - } - else - for i in $WAN_DRIVERS - do $MODULE_STAT | grep -q $i && { - touch $WAN_LOCK 2> /dev/null - return 0 - } - done - fi - - # Driver is not loaded - if [ -e $WAN_LOCK ]; then - rm -f $WAN_LOCK 2> /dev/null - fi - return 1; -} - -function load_driver () { - - local err - - if [ $OSYSTEM = "Linux" ]; then - $MODULE_LOAD $1 > /dev/null - err=$? - elif [ $OSYSTEM = "FreeBSD" ]; then - err=`$MODULE_LOAD $1 >/dev/null` - elif [ $OSYSTEM = "OpenBSD" -o $OSYSTEM = "NetBSD" ]; then - err=`$MODULE_LOAD -o $MODULE_DIR/$1.out -e$1 -p$MODULE_DIR/$POSTINSTALL $MODULE_DIR/$1.o 1> /dev/null` - fi - return $err -} - -function unload_driver () { - - local err - - if [ $OSYSTEM = "OpenBSD" -o $OSYSTEM = "NetBSD" ]; then - \rm -rf $MODULE_DIR/$1.out - err=`$MODULE_UNLOAD -n $1 2> /dev/null` - else - err=`$MODULE_UNLOAD $1 2> /dev/null` - err=`$MODULE_UNLOAD sdladrv 2> /dev/null` - fi - - -#Deprecated: Confirm Alex -#FIXME -# if [ $OSYSTEM = "Linux" ]; then -# # try to unload Echo Canceller module -# eval "wan_ec_client unload 2>/dev/null" -# fi - - return $err -} - -#-------------------------------------------------------------------------- -# Create character device /dev/wanrouter -#-------------------------------------------------------------------------- -create_cdev() -{ - if [ $OSYSTEM = "FreeBSD" ]; then - [ ! -e "$CDEV_WANROUTER" ] && { - mknod $CDEV_WANROUTER c $CDEV_MAJOR $CDEV_MINOR - } - fi -} - - -# ---------------------------------------------------------------------------- -# Start WAN wanrouter. -# o create log file -# o check configuration file presence -# o load WAN drivers (using modprobe) -# o configure drivers -# o configure interfaces -# ---------------------------------------------------------------------------- -load_module() -{ - local opt=${1:-NO} - - check_module - if [ $? -eq 0 ]; then - return 0 - fi - - if [ $opt != silent ]; then - echo "Starting WAN Router..." - echo "`date`: starting WAN router" >> $WAN_LOG - fi - - if [ $OSYSTEM = "Linux" ]; then - if [ -e "/proc/net/wanrouter" ]; then - - #Make sure to load optionl modules - wansock_config LOAD - annexg_config LOAD - lip_config LOAD - wanec_config LOAD - - #RuggedCom LedTask - touch $WANPIPE_IS_RUNNING - return 0 - fi - fi - - # Check if SecureLevel allows to load module. - if [ $OSYSTEM = "OpenBSD" ]; then - if [ $SECURELEVEL -gt 0 ]; then -echo "Error: Your securelevel does not allow to load kernel modules!" - return 1 - fi - fi - - for i in $MODULES - do - - module_name=$i${MODULE_EXT} - if [ ! -f $module_name ]; then - if [ $OSYSTEM = "Linux" ]; then - eval "echo $OPT_MODULES | grep $i > /dev/null 2> /dev/null" - if [ $? -ne 0 ]; then - mod_error $i - return 1 - fi - else - mod_error $i - return 1 - fi - fi - done - - [ "$ROUTER_BOOT" = "NO" -o -z "$WAN_DRIVERS" ] && { - - echo -e "\n\nERROR in $WAN_CONF_DIR/wanrouter.rc file !!!" - echo -e " ROUTER_BOOT is set to NO, OR" - echo -e " WAN_DRIVERS must be set to wanpipe\n" - echo -e " wanrouter start failed !!!\n" - return 1 - } - - if [ $DEPMOD = YES ]; then - if [ $opt != silent ]; then - echo -n "Loading WAN drivers: " - fi - for i in $WAN_DRIVERS - do - $MODULE_STAT | grep -q $i && continue - - if [ $opt != silent ]; then - echo -n "$i " - echo -n "Loading driver $i ... " >> $WAN_LOG - fi - - if load_driver $i - then - echo "ok" >> $WAN_LOG - else - if [ $opt != silent ]; then - echo -e "\nFailed to load wanpipe modules !\n" - echo "fail" >> $WAN_LOG - fi - unload_module - return 1 - fi - done - else - if [ $opt != silent ]; then - echo -n "Loading WAN drivers: " - fi - - for i in $MODULES - do - if load_driver "$i" - then - if [ $opt != silent ]; then - echo "ok" >> $WAN_LOG - fi - else - if [ $opt != silent ]; then - echo -e "\nFailed to load wanpipe modules !\n" - echo "fail" >> $WAN_LOG - fi - unload_module - return 1 - fi - done - fi - - if [ $OSYSTEM = "Linux" ]; then - wansock_config LOAD - annexg_config LOAD - fi - - if ! lip_config LOAD - then - unload_module - return 1 - fi - - if ! wanec_config LOAD - then - lip_config UNLOAD - unload_module - return 1 - fi - - if [ $opt != silent ]; then - echo "done." - fi - - # Create char devices (if needed) - create_cdev - - touch $WANPIPE_IS_RUNNING - return 0 -} - -router_config() -{ - # Configure router. - if [ $OSYSTEM != "Linux" ]; then - [ -e "$CDEV_WANROUTER" ] || { - return 1 - } - fi - - # $1 = /etc/wanpipe#.conf where # is an integer - if [ "$WAN_DYN_WANCONFIG" = YES ]; then - eval "/usr/sbin/wanconfig_client cmd=start,card=$2" - else - wanconfig -v -f $1 -a $WAN_ADSL_LIST >> $WAN_LOG - fi -} - -interf_config() -{ - local device=$1 - local WAN_CONF=$2 - local int_file - local INTERFACES - local voip_flag - - - #echo "============ iterf_config ================" - - # Configure network interfaces. - if [ ! -d "$WAN_INTR_DIR" ]; then - error "Directory $WAN_INTR_DIR not found" - return 1 - fi - - #If TTY is defined there are no network interfaces - eval "grep \"TTY.*=.*YES\" -i $WAN_CONF > /dev/null" - if [ $? -eq 0 ]; then - echo -e "done." - return 0 - fi - - #eval "grep \"WAN_EDU_KIT\" -i $WAN_CONF > /dev/null" - #if [ $? -eq 0 ]; then - # echo -e "done." - # return 0 - #fi - - eval "grep \"WAN_DEBUG\" -i $WAN_CONF > /dev/null" - if [ $? -eq 0 ]; then - echo -e "done." - return 0 - fi - - eval "grep \"WAN_MLINK_PPP\" -i $WAN_CONF > /dev/null" - if [ $? -eq 0 ]; then - echo -e "done." - return 0 - fi - -#NC: Used to be when we used PPPD but now we -# use syncppp for PPPOA. This is just legacy -# the code should be deleted once we are sure -# we will never go back to tty model -# eval "grep \"WAN_ADSL\" -i $WAN_CONF > /dev/null" -# if [ $? -eq 0 ]; then -# eval "grep \"PPP_.*_OA\" -i $WAN_CONF > /dev/null" -# if [ $? -eq 0 ]; then -# echo -e "done." -# return 0 -# fi -# fi - - cd $WAN_INTR_DIR - -# if [ -f $WAN_INTERFACE_PROC_FILE ]; then -# INTERFACES=`cat $WAN_INTERFACE_PROC_FILE | grep $device | cut -d' ' -f1` -# else - INTERFACES=`grep ".*=.*$device" -i $WAN_CONF | cut -d' ' -f1 2> /dev/null` -# fi - - INTERFACES=${INTERFACES// /} - - - if [ -z "$INTERFACES" ]; then - error "No interface definitions found in $WAN_CONF" - return 1 - fi - - echo -n "Configuring interfaces: " - for i in $INTERFACES - do - int_file=${i%%=*} - - #Not every system has egrep. Egrep uses the regular expression matching. - - check_command_exist egrep - if [ $? -eq 0 ]; then - API=`egrep "$int_file[[:space:]]*=" -i $WAN_CONF | cut -d',' -f3 2> /dev/null` - else - API=`grep "$int_file =" -i $WAN_CONF | cut -d',' -f3 2> /dev/null` - fi - - #If the card is in backup mode, it will be used to monitor - #the primary link. We don't want IP information, thus - #we set the API field. This will cause the interface to - #come up without IP information. - eval "grep \"BACKUP.*=.*YES\" -i $WAN_CONF > /dev/null" - if [ $? -eq 0 ]; then - API=API - fi - - #Substitution and replacement are no supported - #on bash versions lower than 2.0 - - #if the card is configured as API, bring up all - #interfaces without IP information. - - if [ ! -z $API ]; then - - #Remove all white spaces - if [ "$AWK_SUPPORT" = YES ]; then - API=`echo $API | awk '{ gsub(" ", "") ; print }'` - elif [ "$BASH_SUPPORT" -gt 1 ]; then - API=${API// /} - fi - - if [ "$API" = API ] || [ "$API" = TDM_API ] || [ "$API" = TDM_VOICE_API ]; then - echo -n "$int_file " - ifconfig $int_file up - continue - fi - - - - if [ "$API" = TTY ]; then - continue - fi - - #brings up (for example wp1_fr16 and wp1_fr16e) - #with IP addresses 0.0.0.0 - if [ $API = "BRIDGE" ];then - - # Bring up BRIDGE interface - echo -n "$int_file " - ifconfig $int_file up - continue - fi - - if [ $API = "TRUNK" ];then - - # Bring up Trunk interface - echo -n "$int_file " - ifconfig $int_file up - continue - fi - - if [ $API = "SWITCH" ];then - - # Bring up SWITCH interface - echo -n "$int_file " - ifconfig $int_file up - continue - fi - - if [ $API = "ANNEXG" ];then - - # Bring up SWITCH interface - echo -n "$int_file " - ifconfig $int_file up - continue - fi - - if [ $API = "VoIP" ] || [ $API = "TDM_VOICE" ] || [ $API = "TDM_VOICE_API" ] ;then - - # Bring up VoIP interface - echo -n "$int_file " - ifconfig $int_file up - voip_flag=1 - continue - fi - - if [ $API = "PPPoE" ] || [ $API = "STACK" ];then - - # Bring up SWITCH interface - echo -n "$int_file " - ifconfig $int_file up - continue - fi - - fi - if [ $NEW_IF_TYPE = YES ]; then - if_file=ifcfg-$int_file; - else - if_file=$int_file; - fi - - if [ -s $if_file ]; then - echo -n "$int_file " - interface_up $int_file || { - error "Failed to configure interface $int_file" - continue - } - else - echo "Error Interface File $int_file not found" - return 1; - fi - - done - echo -e "\ndone." - - return 0 -} - -# ---------------------------------------------------------------------------- -# Stop WAN router. -# o shut down interfaces -# o unload WAN drivers -# o remove lock file -# ---------------------------------------------------------------------------- -interf_down() -{ - local device=$1 - local WAN_CONF=$2 - local int_file - local INTERFACES - - # Shut down network interfaces. - [ -d "$WAN_INTR_DIR" ] && { - cd $WAN_INTR_DIR - INTERFACES=`grep ".*=.*$device" -i $WAN_CONF | cut -d' ' -f1 2> /dev/null` - for i in $INTERFACES - do - int_file=${i%%=*} - echo "Shutting down $device interface: $int_file" - ifconfig $int_file down - done - } -} - -# ---------------------------------------------------------------------------- -# Configure devices (all or single). -# ---------------------------------------------------------------------------- -config_devices() -{ - local devices=$* - - for dev in $devices; do - if [ $OSYSTEM = "Linux" ] && [ ! -e "$ROUTER_PROC/$dev" ]; then - echo -e "Error: Device $dev is not supported by kernel\n" - continue - fi - WAN_CONF=$WAN_CONF_DIR/$dev.conf - - check_file $WAN_CONF || cleanup 1 - - check_exists $dev - if [ $? -ne 0 ]; then - echo "Error: Device $dev does not exist/not allocated." - echo " Check the messages log for the number of probed " - echo " devices." - echo - continue - fi - - check_dev_running $dev - if [ $? -eq 0 ]; then - echo "Error: Device $dev is already running" - echo -e " Run 'wanrouter stop $dev' first\n" - continue - fi - - #Since we changed the name of dev above, - #we must check if we are running ft1 device, - #output a correct message - if [ $ft1_or_wanpipe -gt 0 ]; then - echo "Starting up device: $dev, FT1 config mode" - echo "Starting up device: $dev, FT1 config mode" >> $WAN_LOG - else - echo "Starting up device: $dev" - echo "Starting up device: $dev" >> $WAN_LOG - fi - - router_config $WAN_CONF $dev -#NC: Jul 22 2003 -#Just because one card -#fails to load do not stop -#other cards from loading -# if [ $? -ne 0 ]; then -# #echo "Exiting rc = 3" -# cleanup 3 -# fi - done - - return 0 -} - -# ---------------------------------------------------------------------------- -# Unconfigure devices (all or single). -# ---------------------------------------------------------------------------- -unconfig_devices() -{ - local devices=$* - - #Stop all routers but check if device - #is running first - for dev in $devices; do - WAN_CONF=$WAN_CONF_DIR/$dev.conf - - #If we are starting ft1 device there are no - #interfaces. - if [ $ft1_or_wanpipe -gt 0 ]; then - echo "Shutting down device: $dev, FT1 config mode" - echo "Shutting down device: $dev, FT1 config mode" >> $WAN_LOG - else - echo "Shutting down device: $dev" - echo "Shutting down device: $dev" >> $WAN_LOG - fi - router_unconfig $WAN_CONF $dev - - done - - #Check if any devices are still running - # If YES: don't unload the modules, just printout - # the list of active devices - # If NO: unload modules - - check_and_print_still_running && cleanup 0 - - cd $WAN_HOME - echo -e "No devices running, Unloading Modules" - remove_cdev - unload_module - - for dev in $devices; do - WAN_CONF=$WAN_CONF_DIR/$dev.conf - - INTERFACES=`grep ".*=.*$dev" -i $WAN_CONF | cut -d' ' -f1 2> /dev/null` - for ifname in $INTERFACES; do - ifname=${ifname%%=*} - wanrouter_script stop $dev $ifname - done - wanrouter_script stop $dev - - done - - return 0 -} - -# ---------------------------------------------------------------------------- -# Configure wan interfaces (all or single). -# ---------------------------------------------------------------------------- -config_interfaces() -{ - local devices=$* - - for dev in $devices; do - - WAN_CONF=$WAN_CONF_DIR/$dev.conf - - check_file $WAN_CONF || cleanup 1 - - interf_config $dev $WAN_CONF - -#NC: Jul 22 2003 -#Just because one interface -#fails to load, do not stop all -#other interfaces. -# if [ $? -ne 0 ]; then -# cleanup 4 -# fi - done - - for dev in $devices; do - WAN_CONF=$WAN_CONF_DIR/$dev.conf - INTERFACES=`grep ".*=.*$dev" -i $WAN_CONF | cut -d' ' -f1 2> /dev/null` - for ifname in $INTERFACES; do - ifname=${ifname%%=*} - wanrouter_script start $dev $ifname - done - wanrouter_script start $dev - done - - return 0 -} - -# ---------------------------------------------------------------------------- -# unconfigure interface (all or single). -# ---------------------------------------------------------------------------- -unconfig_interfaces() -{ - local devices=$* - - #Stop all interfaces, but check whether - #device is running first - for dev in $devices; do - - if [ "$dev" = "" ]; then - continue; - fi - - WAN_CONF=$WAN_CONF_DIR/$dev.conf - - #Check that all configuration files exist - check_file $WAN_CONF || cleanup 1 - - check_exists $dev - if [ $? -eq 0 ]; then - check_dev_running $dev - if [ $? -eq 0 ]; then - WAN_CONF=$WAN_CONF_DIR/$dev.conf - interf_down $dev $WAN_CONF - fi - fi - done - - return 0 -} - - -router_unconfig() -{ - if [ $OSYSTEM != "Linux" ]; then - [ -e "$CDEV_WANROUTER" ] || { - return - } - fi - - - if [ "$WAN_DYN_WANCONFIG" = YES ]; then - eval "/usr/sbin/wanconfig_client cmd=stop,card=$2" - else - wanconfig -v -d $1 -a $WAN_ADSL_LIST >> $WAN_LOG - fi - # Unload WAN drivers. -} - - -#---------------------------------------------------------------------------- -# Remove character device /dev/wanrouter -#---------------------------------------------------------------------------- -remove_cdev() -{ - if [ $OSYSTEM = "FreeBSD" ]; then - [ -e "$CDEV_WANROUTER" ] && { - rm $CDEV_WANROUTER - } - fi -} - -unload_module() -{ - cd $WAN_HOME - - rm -f $WANPIPE_IS_RUNNING - if [ $RUGGEDCOM = "Yes" ]; then - sleep 2 - if lsof | grep '/proc/net/wanrouter' -q; then - echo "/proc/net/wanrouter still busy! Failed to make ledtask release..." - touch $WANPIPE_IS_RUNNING - return 0 - fi - fi - - if [ $OSYSTEM = "Linux" ]; then - check_and_print_still_running && cleanup 1 - wansock_config UNLOAD - annexg_config UNLOAD - elif [ $OSYSTEM = "OpenBSD" ]; then - if [ $SECURELEVEL -gt 0 ]; then -echo "Error: Your securelevel does not allow to load kernel modules!" - return 1 - fi - fi - - wanec_config UNLOAD - lip_config UNLOAD - - if [ $DEPMOD = YES ]; then - - for i in $WAN_DRIVERS - do $MODULE_STAT | grep -q $i && { - unload_driver $i - } - done - - else - for i in $UMODULES - do - unload_driver $i - done - fi - - wan_force_unload_modules -} - - -wanec_config () -{ - local opt=$1 - - if [ "$WANEC_LOAD" != "YES" ]; then - return 0 - fi - - if [ $OSYSTEM != "FreeBSD" -a $OSYSTEM != "Linux" ]; then - return 0 - fi - - file_exist $MOD10 - if [ $? -ne 0 ]; then - return 0 - fi - - if [ $DEPMOD != YES ]; then - return 0 - fi - - if [ $opt = UNLOAD ]; then - lsmods=`$MODULE_STAT` - - for i in $WANEC_UNLOAD_DRIVERS - do - echo "$lsmods" | grep -q "$i" && { - if ! unload_driver $i - then - return 1 - fi - } - done - else - - for i in $WANEC_LOAD_DRIVERS - do - $MODULE_STAT | grep -q $i && continue - - if ! load_driver $i - then - return 1 - fi - done - fi - - return 0 -} - - -lip_config () -{ - local opt=$1 - - if [ "$WAN_LIP_LOAD" != "YES" ]; then - return 0 - fi - - if [ $OSYSTEM != "FreeBSD" -a $OSYSTEM != "Linux" ]; then - return 0 - fi - - - file_exist $MOD9 - if [ $? -ne 0 ]; then - return 0 - fi - - if [ $DEPMOD != YES ]; then - return 0 - fi - - if [ $opt = UNLOAD ]; then - lsmods=`$MODULE_STAT` - - for i in $LIP_UNLOAD_DRIVERS - do - echo "$lsmods" | grep -q "$i" && { - if ! unload_driver $i - then - return 1 - fi - } - done - else - - for i in $LIP_LOAD_DRIVERS - do - $MODULE_STAT | grep -q $i && continue - - if ! load_driver $i - then - return 1 - fi - done - fi - - return 0 -} - - - -mod_error() -{ - echo -e "\n" - error "Wanpipe Module: $1 not found !!!" - if [ $OSYSTEM = "Linux" ]; then - echo -e " WANPIPE drivers must be compiled as modules" - echo -e " Check kernel configuration in /usr/src/linux/.config: " - echo -e " CONFIG_WAN_ROUTER=m" - echo -e " CONFIG_VENDOR_SANGOMA=m\n" - else - echo -e "WANPIPE drivers are modules files. " - echo -e "Try to re-compile WANPIPE drivers." - fi -} - -get_distrib() -{ - grep -i "red *hat" "/etc/issue" > /dev/null - if [ $? -eq 0 ] - then - return 1; #RedHat Found - else - return 0; - fi - -} - -check_config() -{ - for dev in $WAN_DEVICES; do - check_file "$WAN_CONF_DIR/$dev.conf" || { - echo -e "\n$SCRIPT: Error, $WAN_CONF_DIR/$dev.conf not found!\n"; - return 1; - } - done - return 0; -} - -check_file() -{ - local file=$1 - - [ ! -f "$file" ] && { - if [ ! -z $file ]; - then - echo -e "ERROR: Wanpipe configuration file not found: $file\n" - else - echo -e "ERROR: Wanpipe configuration file not found in $WAN_CONF_DIR\n" - fi - return 1; - } - return 0; -} - -print_active_devices() -{ - local ac_list; - local ac_wan; - local rc=0; - local silent=${1:-0} - local devices - - echo -e "Devices currently active:" - echo -en "\t" - - if [ $OSYSTEM = "Linux" ]; then - #If /proc directory doesn't exist nothing - #to print, thus exit - [ ! -d "$ROUTER_PROC" ] && return 0 - - devices=`cat $ROUTER_PROC/status | cut -d' ' -f1 | grep wanpipe | sort` - else - check_module - if [ $? -ne 0 ]; then - return 0 - fi - devices=`wanconfig status | cut -d' ' -f1 | grep wanpipe | sort` - fi - - if [ ! -z "$devices" ]; then - if [ $silent -ne 0 ]; then - echo $devices - fi - rc=1; - fi - - echo -e "\n" - - return $rc -} - -function check_exists () { - - local device=$1 - - if [ $OSYSTEM = "Linux" ]; then - [ ! -d "$ROUTER_PROC" ] && return 1 #Device not running - - if [ ! -f $ROUTER_PROC/$device ]; then - echo "Error: Device $device does not exist/not allocated." - echo " Check the messages log for the number of probed devices." - echo - return 1 - fi - fi - - # Device exists - return 0 - -} - -function check_dev_running () -{ - local device=$1 - local res - - if [ $OSYSTEM = "Linux" ]; then - [ ! -d "$ROUTER_PROC" ] && return 1 #Device not running - - res=`cat $ROUTER_PROC/status | grep "$device "` - else - check_module - if [ $? -ne 0 ]; then - return 1 - fi - res=`wanconfig status | grep "$device "` - fi - - [ ! -z "$res" ] && { - #Device running - return 0 - } - - #Device not running - return 1; -} - -check_and_print_still_running () -{ - local devices - - if [ $OSYSTEM = "Linux" ]; then - if [ ! -d $ROUTER_PROC ]; then - return 1 - fi - - devices=`cat $ROUTER_PROC/status | cut -d' ' -f1 | grep wanpipe | sort` - else - check_module - if [ $? -ne 0 ]; then - return 1 - fi - - devices=`wanconfig status | cut -d' ' -f1 | grep wanpipe | sort` - fi - - if [ ! -z "$devices" ]; then - echo "Devices Still Running:" - echo -ne "\t" - echo $devices - echo - return 0 - fi - - return 1 -} - -create_ft1_conf () { - - local dev=$1 - local res - - wandev=`grep "wanpipe.*=" $WAN_CONF_DIR/$dev.conf 2> /dev/null` - res=$? - if [ $res -eq 0 ]; then - wandev=${wandev%%=*} - if [ $AWK_SUPPORT = YES ]; then - eval "wandev=`echo $wandev | awk '{ gsub(" ", "") ; print }'`" - elif [ $BASH_SUPPORT -gt 1 ]; then - wandev=${wandev// /} - fi - else - echo -e "Error: Device name not found in $WAN_CONF_DIR/$dev.conf\n" - cleanup 1 - fi - - wancard=`grep "CARD_TYPE.*=.*" -i $WAN_CONF_DIR/$dev.conf 2> /dev/null` - wancpu=`grep "S514CPU.*=.*" -i $WAN_CONF_DIR/$dev.conf 2> /dev/null` - wanslot_auto=`grep "AUTO_PCISLOT.*=.*" -i $WAN_CONF_DIR/$dev.conf 2> /dev/null` - wanslot=`grep "PCISLOT.*=.*" -i $WAN_CONF_DIR/$dev.conf 2> /dev/null` - wanbus=`grep "PCIBUS.*=.*" -i $WAN_CONF_DIR/$dev.conf 2> /dev/null` - wanio=`grep "IOPORT.*=.*" -i $WAN_CONF_DIR/$dev.conf 2> /dev/null` - wanirq=`grep "IRQ.*=.*" -i $WAN_CONF_DIR/$dev.conf 2> /dev/null` - - if [ -z "$wancard" ]; then - echo -e "Error: Missing fileds in $WAN_CONF_DIR/$dev.conf" - echo -e " configuraton file, in [$wandev] section.\n " - cleanup 1 - fi - - if [ -z "$wancpu" -o -z "$wanslot" ]; then - if [ -z "$wanio" -o -z "$wanirq" ]; then - echo -e "Error: Missing fileds in $WAN_CONF_DIR/$dev.conf" - echo -e " configuraton file, in [$wandev] section.\n " - cleanup 1 - fi - fi - - cat < $WAN_CONF_DIR/$FT1_CONF - -#FT1 Configuration File -# -# Note: This file was automatically generated by wanrouter -# script. -# DO NOT CHANGE IT -# -# CHDLC Protocol is used since, its firmware is the -# only one with FT1 configuration functions. - -[devices] - -$wandev = WAN_CHDLC, Cisco HDLC Firmware - -[$wandev] - -$wancard -$wancpu -$wanslot_auto -$wanslot -$wanbus - -$wanio -$wanirq - -Firmware = $WAN_HOME/firmware/cdual514.sfm # adapter firmware - -#--------------------- END OF FT1 CONFIGURATION ------------------------ - -EOM - -} - - -check_config_opt () -{ - local dev=$1 - local opt=$2 - - case $dev in - - ft1_wanpipe*) - - #Strip off 'ft1_' from 'ft1_wanpipe#' - dev=${dev##ft1_} - - #Check if wanpipe#.conf file exists - check_file "$WAN_CONF_DIR/$dev.conf" - if [ $? -gt 0 ]; then - cleanup 1 - fi - - #If we are starting the router up, create - #the ft1.conf file in $WAN_CONF_DIR directory - if [ $opt -eq 0 ]; then - create_ft1_conf $dev - fi - - #Return string ft1 - result "ft1" - - #Get the wanpipe device number, and return it - #as a return code. This indicates that we want - #to setup ft1 device - dev=${dev##wanpipe} - if [ $AWK_SUPPORT = YES ]; then - dev=`echo $dev | awk '{ gsub(" ", "") ; print }'` - elif [ $BASH_SUPPORT -gt 1 ]; then - dev=${dev// /} - fi - return $dev - ;; - - wanpipe*) - #Check if wanpipe#.conf file exists - check_file "$WAN_CONF_DIR/$dev.conf" - if [ $? -gt 0 ]; then - cleanup 1 - fi - - #return string wanpipe# - result $dev - - #return zero which indicates that we - #want to startup reglar wanpipe device - #not ft1 device - return 0 - ;; - - *) - #Illegal syntax obtained - echo "Error: Incorrect device name syntax !" - cleanup 1 - ;; - esac - -} - -check_ft1_config () -{ - local ft1=$1 - - if [ $ft1 = ft1 ]; then - return 0 - else - return 1 - fi -} - -result () { - echo $1 > $RC -} - -check_osystem () { - - if [ $OSYSTEM = "Linux" ]; then - - if [ -d $WAN_LOCK_DIR ]; then - return 0 - else - echo - echo "Warning: WAN_LOCK_DIR = $WAN_LOCK_DIR does not exist!" - echo "Please update the WAN_LOCK_DIR in /etc/wanpipe/wanrouter.rc" - echo - fi - - if [ -d /var/lock/subsys ]; then - WAN_LOCK_DIR=/var/lock/subsys - elif [ -d /var/lock ]; then - WAN_LOCK_DIR=/var/lock - else - WAN_LOCK_DIR=$WAN_CONF_DIR - fi - fi - -} - -wansock_config () -{ - local opt=$1 - - if [ $OSYSTEM != "Linux" ]; then - return 0 - fi - - file_exist $MOD5 - if [ $? -ne 0 ]; then - return 0 - fi - - if [ $DEPMOD != YES ]; then - return 0 - fi - - if [ $opt = UNLOAD ]; then - $MODULE_STAT | grep -q "$AF_WANPIPE" && { - unload_driver $AF_WANPIPE - } - else - load_driver $AF_WANPIPE - fi - return 0 -} - -annexg_config () -{ - local opt=$1 - - if [ $OSYSTEM != "Linux" ]; then - return 0 - fi - - if [ "$WAN_ANNEXG_LOAD" != "YES" ]; then - return 0 - fi - - file_exist $MOD6 - if [ $? -ne 0 ]; then - return 0 - fi - - file_exist $MOD7 - if [ $? -ne 0 ]; then - return 0 - fi - - file_exist $MOD8 - if [ $? -ne 0 ]; then - return 0 - fi - - if [ $DEPMOD != YES ]; then - return 0 - fi - - if [ $opt = UNLOAD ]; then - lsmods=`$MODULE_STAT` - - for i in $ANNEXG_UNLOAD_DRIVERS - do - echo "$lsmods" | grep -q "$i" && { - unload_driver $i - } - done - else - - for i in $ANNEXG_LOAD_DRIVERS - do - load_driver $i - done - fi - - return 0 -} - - -function print_wanpipe_config () { - - echo -e "Wanpipe Config:\n" - if [ $OSYSTEM = "Linux" ]; then - cat /proc/net/wanrouter/config | sort - else - wanconfig config - fi -} - -function print_wanrouter_status () { - - echo -e "\nWanrouter Status:\n" - if [ $OSYSTEM = "Linux" ]; then - cat /proc/net/wanrouter/status | sort - else - wanconfig status - fi -} - - -function print_config_summary () -{ - local pfiles; - local pfile; - local pdev; - - cd $WAN_HOME - - pfiles=`ls wanpipe*\.conf 2> /dev/null` - if [ $? -ne 0 ]; then - echo "No Wanpipe configuration files found in $WAN_HOME"; - return; - fi - - echo -e "Configuration File Summary in : $WAN_HOME\n" - - echo -e "Device\t\tProtocol\tType Cpu/Io Slot/Irq Bus\tState" - echo -e "------------------------------------------------------------------------" - - for pfile in $pfiles - do - - #Test for invalid file: wanpipe1.conf.tmp" - echo $pfile | grep ".*\..*\..*" > /dev/null 2> /dev/null - if [ $? -eq 0 ]; then - continue - fi - - - pdev=`grep "^wanpipe*=*" $pfile | cut -d'=' -f1 | cut -d' ' -f1 2> /dev/null` - if [ $? -ne 0 ]; then - continue - fi - if [ -z "$pdev" ]; then - continue - fi - - echo -e -n "$pdev\t" - - pprot=`grep "^wanpiped*=*" $pfile | cut -d'=' -f2 | awk '{ gsub(" ", "") ; print }' | cut -d',' -f1` - if [ $? -ne 0 ]; then - continue - fi - - if [ -z $pprot ]; then - continue - fi - - if [ $pprot = WAN_X25 ] || [ $pprot = WAN_PPP ] || [ $pprot = WAN_FR ] || [ $pprot = WAN_MFR ] || [ $pprot = WAN_BSC ] || [ $pprot = WAN_AFT ] || [ $pprot = WAN_SS7 ] || [ $pprot = WAN_POS ] || [ $pprot = WAN_ATM ]; then - echo -e -n "$pprot\t\t" - else - echo -e -n "$pprot\t" - fi - - phw=`grep "^S514CPU*" $pfile` - if [ $? -eq 0 ]; then - echo -e -n "PCI\t" - - pcpu=`grep -i "^S514CPU*" $pfile | cut -d'=' -f2 | awk '{ gsub(" ", "") ; print }' | cut -d',' -f1` - echo -e -n "$pcpu\t" - - pslot=`grep -i "^PCISLOT*" $pfile | cut -d'=' -f2 | awk '{ gsub(" ", "") ; print }' | cut -d',' -f1` - echo -e -n "$pslot\t" - pbus=`grep -i "^PCIBUS*" $pfile | cut -d'=' -f2 | awk '{ gsub(" ", "") ; print }' | cut -d',' -f1` - if [ -z $pbus ]; then - echo -e -n "0\t" - else - echo -e -n "$pbus\t" - fi - - else - if [ $pprot = WAN_ADSL ]; then - - echo -e -n "PCI\t" - - echo -e -n "N/A\t" - - pslot=`grep -i "^PCISLOT*" $pfile | cut -d'=' -f2 | awk '{ gsub(" ", "") ; print }' | cut -d',' -f1` - echo -e -n "$pslot\t" - pbus=`grep -i "^PCIBUS*" $pfile | cut -d'=' -f2 | awk '{ gsub(" ", "") ; print }' | cut -d',' -f1` - if [ -z $pbus ]; then - echo -e -n "0\t" - else - echo -e -n "$pbus\t" - fi - - else - - echo -n -e "ISA\t" - pport=`grep -i "^IOPORT*" $pfile | cut -d'=' -f2 | awk '{ gsub(" ", "") ; print }' | cut -d',' -f1` - echo -e -n "$pport\t" - pport=`grep -i "^IRQ*" $pfile | cut -d'=' -f2 | awk '{ gsub(" ", "") ; print }' | cut -d',' -f1` - echo -e -n "$pport\t" - - echo -e -n "n/a\t" - - fi - fi - - if [ $OSYSTEM = "Linux" ]; then - if [ -e /proc/net/wanrouter ]; then - pstate=`cat /proc/net/wanrouter/status | grep $pdev | cut -d'|' -f4 | awk '{ gsub(" ", "") ; print }'` - else - pstate="" - fi - else - - check_module - if [ $? -eq 0 ]; then - pstate=`wanconfig status | grep $pdev | cut -d'|' -f4 | awk '{ gsub(" ", "") ; print }'` - else - pstate="" - fi - fi - if [ -z $pstate ]; then - echo -e -n "Inactive\t" - else - echo -e -n "$pstate\t" - fi - - echo - - done -} - -function wanrouter_if_debug() -{ - echo - echo "Debug Info for $1" - echo - - echo "WANPIPE Release: $ROUTER_VERSION" - echo - echo - - eval "$IFCONFIG_LIST | grep -w $1 >> /dev/null 2>>/dev/null" - if [ $? -ne 0 ]; then - check_dev_running $1 - if [ $? -eq 0 ]; then - wanconfig -D $1 - return; - fi - - echo - echo "Error: Interface $1 does not exist!" - echo - cleanup 1 - return; - fi - - if [ ! -f /usr/sbin/wanpipemon ]; then - echo - echo "Error: /usr/sbin/wanpipemon not found" - echo "Solution: Re-install latest wanpipe release" - echo - return; - fi - - eval "/usr/sbin/wanpipemon -i $1 -c xm 2>> /dev/null" - if [ $? -ne 0 ]; then - echo - echo "Error: /usr/sbin/wanpipemon failed!" - echo " Make sure $1 is a valid wanpipe interface" - echo " Otherwise call Sangoma Tech Support" - echo - return - fi - - sleep 3 - - eval "/usr/sbin/wanpipemon -i $1 -c sc" - if [ $? -ne 0 ]; then - echo - echo "Error: /usr/sbin/wanpipemon failed!" - echo " Make sure $1 is a valid wanpipe interface" - echo " Otherwise call Sangoma Tech Support" - echo - return - fi - sleep 2 - eval "/usr/sbin/wanpipemon -i $1 -c sc" - if [ $? -ne 0 ]; then - echo - echo "Error: /usr/sbin/wanpipemon failed!" - echo " Make sure $1 is a valid wanpipe interface" - echo " Otherwise call Sangoma Tech Support" - echo - return - fi - - sleep 5 - - echo "Start WANPIPE /var/log/messages" - echo - if [ $OSYSTEM = "Linux" ]; then - eval "tail -n 200 /var/log/messages | grep -i \"[wanpipe|sdladrv]\" " - else - eval "tail -n 200 /var/log/messages | grep -i \"wanpipe\|sdladrv\" " - fi - echo - echo "End of WANPIPE /var/log/messages" - echo - - sleep 5 - - - echo - echo "---------- Starting Trace [ PRESS ENTER TO STOP ] ---------" - echo - sleep 3 - - eval "/usr/sbin/wanpipemon -i $1 -c tr" - if [ $? -ne 0 ]; then - echo - echo "Error: /usr/sbin/wanpipemon failed!" - echo " Make sure $1 is a valid wanpipe interface" - echo " Otherwise call Sangoma Tech Support" - echo - fi -} - -function wanrouter_debug () -{ - local err=0 - echo - - if [ ! -d ${WAN_HOME} ]; then - echo "Error: ${WAN_HOME} not found" - echo "Reason: Wanpipe not installed properly" - echo "Solution: Re-install wanpipe" - return - fi - - check_module - if [ $? -ne 0 ]; then - load_module - if [ $? -ne 0 ]; then - if [ $OSYSTEM = "Linux" ]; then - echo "Error: /proc/net/wanrouter not found" - fi - echo "Reason: Wanpipe kernel modules failed to load" - echo "Solution: Run 'wanrouter hwprobe' or 'wanrouter start'" - echo " Contact Sangoma Tech Support" - echo - return - fi - unload_module - fi - - if [ ! -f ${WAN_HOME}/wanpipe1.conf ]; then - echo "Warning: wanpipe1.conf configuration file not found" - echo "Reason: did not run /usr/sbin/wancfg to create it" - echo "Solution: run /usr/sbin/wancfg :)" - echo - err=1 - fi - - eval "grep -i invalid $WAN_LOG" - if [ $? -eq 0 ]; then - echo - echo "Error: Configuration file syntax error in $WAN_LOG" - echo "Reason: Miss-configuration: run 'wanrouter conflog'" - echo "Solution: Re-run /usr/sbin/wancfg and configure all variables " - echo - err=1 - fi - - eval "tail -n 20 /var/log/messages | grep -i \"wanpipe.*error[,:]\" " - if [ $? -eq 0 ]; then - echo "------------------------------------------" - echo "Error: Error occured during wanrouter startup/shutdown" - echo "Reason: Check /var/log/messages file: run 'wanrouter messages'" - echo "Solution: Review /var/log/messages and contact Sangoma Tech Support" - echo - err=1 - else - - eval "tail -n 20 /var/log/messages | grep -i \"sdladrv.*invalid[,:]\"" - if [ $? -eq 0 ]; then - echo "------------------------------------------" - echo "Error: Config error occured during wanrouter startup/shutdown" - echo "Reason: Check /var/log/messages file: run 'wanrouter messages'" - echo "Solution: Review /var/log/messages and contact Sangoma Tech Support" - echo - err=1 - else - - eval "tail -n 20 /var/log/messages | grep -i \"wanpipe.*warning\" " - if [ $? -eq 0 ]; then - echo "------------------------------------------" - echo "Warning: Warning occured during wanrouter startup/shutdown" - echo "Reason: Check /var/log/messages file" - echo "Solution: Review /var/log/messages and contact Sangoma Tech Support" - echo - err=1 - fi - fi - fi - - if [ $err -eq 0 ]; then - echo "Wanpipe environment/utilites/modules/operation OK" - fi - echo -} - -function check_command_exist () -{ - local cmd=$1 - local cmd_rc - - if [ $OSYSTEM = "Linux" ]; then - eval "type $1 > /dev/null 2> /dev/null" - else - eval "which $1 > /dev/null 2> /dev/null" - fi - cmd_rc=$? - - return $cmd_rc -} - -function init_meta_conf () -{ - ROUTER_BOOT= - WANPIPE_CONF_DIR= - WANPIPE_INTR_DIR= - ROUTER_LOG= - ROUTER_LOCK= - ROUTER_IP_FORWARD= - NEW_IF_TYPE= - WANCFG_LIB= - WAN_DEVICES= - - ROUTER_BOOT= - WAN_CONF_DIR= - WAN_INTR_DIR= - WAN_LOG= - WAN_LOCK= - WAN_LOCK_DIR= - WAN_IP_FORWARD= - NEW_IF_TYPE= - WAN_LIB_DIR= - WAN_ADSL_LIST= - WAN_DEVICES= -} - -function read_meta_conf () -{ - - if [ $OSYSTEM = "Linux" ]; then - WAN_HOME=/etc/wanpipe - elif [ $OSYSTEM = "FreeBSD" -o $OSYSTEM = "OpenBSD" ]; then - WAN_HOME=/usr/local/etc/wanpipe - wanrouter_rc_file="" - if [ -r /etc/rc.conf ]; then - . /etc/rc.conf - fi - if [ -n "$wanrouter_rc_file" ]; then - WAN_HOME=${wanrouter_rc_file%/*} - fi - fi - WAN_CONF_DIR=$WAN_HOME - META_CONF=$WAN_HOME/wanrouter.rc - WAN_INTR_DIR=$WAN_HOME/interfaces - - # Read meta-configuration file. - if [ -f $META_CONF ] - then . $META_CONF - else - return 1 - fi - return 0 -} - -function meta_conf_compatiblity () -{ - WAN_CONF_DIR=$WANPIPE_CONF_DIR - WAN_INTR_DIR=$WANPIPE_INTR_DIR - WAN_LOG=$ROUTER_LOG - WAN_LOCK=$ROUTER_LOCK - WAN_LOCK_DIR=${ROUTER_LOCK%/*} - WAN_IP_FORWARD=$ROUTER_IP_FORWARD - WAN_LIB_DIR=$WANCFG_LIB - WAN_ADSL_LIST=$WANPIPE_CONF_DIR/wan_adsl.list - -} - -function wanrouter_script() -{ - local cmd=$1 - local dev=$2 - local ifname=$3 - - #echo "Starting Script: $WAN_SCRIPTS_DIR/$dev-$ifname-$cmd" - - if [ "$ifname" != "" ]; then - #Interface name exists - if [ -f "$WAN_SCRIPTS_DIR/$dev-$ifname-$cmd" ]; then - eval "sh $WAN_SCRIPTS_DIR/$dev-$ifname-$cmd $dev $ifname" - fi - - elif [ "$dev" != "" ]; then - #Device name exists - if [ -f "$WAN_SCRIPTS_DIR/$dev-$cmd" ]; then - eval "sh $WAN_SCRIPTS_DIR/$dev-$cmd $dev" - fi - else - #Global Cmd - if [ -f "$WAN_SCRIPTS_DIR/$cmd" ]; then - eval "sh $WAN_SCRIPTS_DIR/$cmd" - fi - fi -} - -function generate_adsl_list() -{ - local vci=0; - local vpi=0; - - echo "35 0" > $WAN_ADSL_LIST - echo "35 8" >> $WAN_ADSL_LIST - - vci=30 - vpi=0 - while [ 1 ]; do - while [ 1 ]; do - - echo "$vci $vpi" >> $WAN_ADSL_LIST - - vpi=$((vpi+1)) - if [ $vpi = 10 ]; then - vpi=0 - break; - fi - done - - vci=$((vci+1)) - - if [ $vci -eq 40 ]; then - vci=30 - break; - fi - done -} - -# FIXME: Add code for BSD -function wan_force_unload_modules() -{ - if [ $OSYSTEM = "Linux" ]; then - if [ -e "$ROUTER_PROC/status" ]; then - wp_list=`cat $ROUTER_PROC/status | cut -d' ' -f1 | grep wanpipe | sort -r` - if [ -z $list ]; then - mod_list=`cat /proc/modules | grep wan | cut -d ' ' -f1 | xargs` - for tmp_mod in $mod_list - do - eval "rmmod $tmp_mod >> /dev/null 2>> /dev/null" - done - fi - fi - fi -} - -# FIXME: Add code for BSD -function stop_running_wanpipes () -{ - - if [ $OSYSTEM = "Linux" ]; then - if [ -e "$ROUTER_PROC/status" ]; then - wp_list=`cat $ROUTER_PROC/status | cut -d' ' -f1 | grep wanpipe | sort -r` - - for list in $wp_list - do - list=${list// /}; - if [ ! -z $list ]; then - eval "rm -f $WAN_PROG_LOCK 2> /dev/null > /dev/null" - wanrouter stop $list - fi - done - - wan_force_unload_modules - fi - fi -} - -function config_wanrouter_rc () -{ - local sequence - local num - local val - - cat << EOM - -WANPIPE STARTUP CONFIG - -Current Wanpipe devices configured -to start on bootup: - -$WAN_DEVICES - - Please specify new startup string: - eg: wanpipe1 wanpipe2 ... - - Note: Single space must exist between - device names. - -EOM - -echo -n "Enter Wanpipe Startup Sequence: " - -read sequence - -if [ -z "$sequence" ]; then - echo - echo "Error: startup sequence must contain at least one device name" - echo " eg: wanpipe1" - echo - return -fi - -eval "echo $sequence | grep \"wanpipe\d*\" > /dev/null 2> /dev/null" -if [ $? -ne 0 ]; then - echo - echo "Error: startup sequence must contain at least one device name" - echo " eg: wanpipe1" - echo - return -fi - -echo -echo "New Sequence is: $sequence" -echo - -getyn "Is the above sequence correct ?" - -if [ $? -eq 0 ]; then - echo - echo "Setting wanpipe startup sequence to: $sequence" - echo - cat $META_CONF | grep "WAN_DEVICES=" -v > $WAN_HOME/tmp.$$ - echo "WAN_DEVICES=\"$sequence\"" >> $WAN_HOME/tmp.$$ - cat $WAN_HOME/tmp.$$ > $META_CONF -fi - -} - - -####### MAIN ################################################################# -# set -x - -RCDLINKS="0,K10 1,K10 2,S20 3,S20 4,S20 5,S20 6,K10" - - -export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/loca/bin:/usr/local/sbin -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib - -OSYSTEM=`uname -s` -RELEASE=`uname -r` -PROD=wanpipe -SCRIPT=wanrouter -REDHAT=/usr/src/redhat -ROUTER_PROC=/proc/net/wanrouter -AF_WANPIPE=af_wanpipe -ANNEXG_LOAD_DRIVERS="wanpipe_lapb wanpipe_x25 wanpipe_dsp" -ANNEXG_UNLOAD_DRIVERS="wanpipe_dsp wanpipe_x25 wanpipe_lapb" -LIP_LOAD_DRIVERS="wanpipe_lip" -LIP_UNLOAD_DRIVERS="wanpipe_lip" -WANEC_LOAD_DRIVERS="wanec" -WANEC_UNLOAD_DRIVERS="wanec" -WAN_PROG_LOCK=/var/lock/wanrouter_lock -DEPMOD=YES -LINEPROBE_PATH=/usr/sbin/lineprobe -WANPIPE_IS_RUNNING=/var/run/wanpipe_is_running - -RUGGEDCOM=No - -if [ $OSYSTEM = "Linux" ]; then - ROUTER_VERSION=3.2.1 - IFCONFIG_LIST=ifconfig - MODULE_STAT=lsmod - WAN_DRIVERS="wanpipe" - MODULE_LOAD=modprobe - MODULE_UNLOAD="modprobe -r" - MODULE_EXT=".*" - DEPMOD=YES - - check_command_exist modprobe - if [ $? -ne 0 ]; then - check_command_exist insmod - if [ $? -eq 0 ]; then - DEPMOD=NO - MODULE_LOAD=insmod - MODULE_UNLOAD=rmmod - fi - fi - - MOD1=/lib/modules/sdladrv - MOD2=/lib/modules/wanrouter - MOD3=/lib/modules/wanpipe_syncppp - MOD4=/lib/modules/wanpipe - MOD5=/lib/modules/af_wanpipe - - if [ -d /lib/modules/$(uname -r) ]; then - uname -r | grep "^2.4.*" > /dev/null - if [ $? -eq 0 ]; then - if [ -d /lib/modules/$(uname -r)/kernel ]; then - MOD1=/lib/modules/$(uname -r)/kernel/drivers/net/wan/sdladrv - MOD2=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanrouter - MOD3=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_syncppp - MOD4=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe - MOD5=/lib/modules/$(uname -r)/kernel/net/wanrouter/af_wanpipe - - MOD6=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_lapb - MOD7=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_x25 - MOD8=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_dsp - MOD9=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanpipe_lip - MOD10=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanec - fi - else - - uname -r | grep "^2.6.*" > /dev/null - if [ $? -eq 0 ]; then - if [ -d /lib/modules/$(uname -r)/kernel ]; then - MOD1=/lib/modules/$(uname -r)/kernel/drivers/net/wan/sdladrv - MOD2=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanrouter - MOD3=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_syncppp - MOD4=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe - MOD5=/lib/modules/$(uname -r)/kernel/net/wanrouter/af_wanpipe - - MOD6=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_lapb - MOD7=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_x25 - MOD8=/lib/modules/$(uname -r)/kernel/drivers/net/wan/wanpipe_dsp - MOD9=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanpipe_lip - MOD10=/lib/modules/$(uname -r)/kernel/net/wanrouter/wanec - fi - else - if [ -d /lib/modules/$(uname -r)/net ]; then - MOD1=/lib/modules/$(uname -r)/net/sdladrv - MOD2=/lib/modules/$(uname -r)/misc/wanrouter - MOD3=/lib/modules/$(uname -r)/net/wanpipe_syncppp - MOD4=/lib/modules/$(uname -r)/net/wanpipe - MOD5=/lib/modules/$(uname -r)/misc/af_wanpipe - - MOD6=/lib/modules/$(uname -r)/net/wanpipe_lapb - MOD7=/lib/modules/$(uname -r)/net/wanpipe_x25 - MOD8=/lib/modules/$(uname -r)/net/wanpipe_dsp - MOD9=/lib/modules/$(uname -r)/misc/wanpipe_lip - MOD10=/lib/modules/$(uname -r)/misc/wanec - fi - fi - fi - fi - - MODULES="$MOD1 $MOD2 $MOD3 $MOD4 $MOD5" - OPT_MODULES="$MOD3 $MOD5" - UMODULES="af_wanpipe wanpipe wanpipe_syncppp wanrouter sdladrv" - -elif [ $OSYSTEM = "FreeBSD" ]; then - - SYSCTL=/sbin/sysctl - AWK=/usr/bin/awk - PKGINFO=/usr/sbin/pkg_info - major_ver=${RELEASE%%.*} - ROUTER_VERSION=`$PKGINFO | $AWK '$1~/wanpipe/ {$1=""; print }'` - IFCONFIG_LIST=ifconfig - CDEV_WANROUTER=/dev/$SCRIPT - CDEV_MAJOR=139 - CDEV_MINOR=0 - MODULE_STAT=kldstat - MODULE_LOAD=kldload - MODULE_UNLOAD=kldunload - MODULE_EXT=".*" - - if [ "$major_ver" = "5" -o "$major_ver" = "6" ]; then - MODULE_DIR=/boot/modules - else - MODULE_DIR=/modules - fi - MOD9="$MODULE_DIR/wanpipe_lip" - MOD10="$MODULE_DIR/wanec" - MODULES="$MODULE_DIR/wanrouter $MODULE_DIR/sdladrv $MODULE_DIR/wanpipe" - WAN_DRIVERS="wanpipe" - -elif [ $OSYSTEM = "OpenBSD" ]; then - - SYSCTL=/sbin/sysctl - AWK=/usr/bin/awk - PKGINFO=/usr/sbin/pkg_info - SECURELEVEL=`$SYSCTL -n kern.securelevel` - ROUTER_VERSION=`$PKGINFO | $AWK '$1~/wanpipe/ {$1=""; print }'` - IFCONFIG_LIST="ifconfig -a" - CDEV_WANROUTER=/dev/$SCRIPT - CDEV_MAJOR=139 - CDEV_MINOR=0 - POSTINSTALL=create_cdev - MODULE_STAT=modstat - MODULE_LOAD=modload - MODULE_UNLOAD=modunload - MODULE_DIR=/usr/lkm - MODULE_EXT=".o" - MODULES="$MODULE_DIR/wanpipe" - WAN_DRIVERS="wanpipe" -elif [ $OSYSTEM = "NetBSD" ]; then - - SYSCTL=/sbin/sysctl - AWK=/usr/bin/awk - PKGINFO=/usr/sbin/pkg_info - SECURELEVEL=`$SYSCTL -n kern.securelevel` - ROUTER_VERSION=`$PKGINFO | $AWK '$1~/wanpipe/ {$1=""; print }'` - IFCONFIG_LIST="ifconfig -a" - CDEV_WANROUTER=/dev/$SCRIPT - CDEV_MAJOR=139 - CDEV_MINOR=0 - POSTINSTALL=create_cdev - MODULE_STAT=modstat - MODULE_LOAD=modload - MODULE_UNLOAD=modunload - MODULE_DIR=/usr/lkm - MODULE_EXT=".o" - MODULES="$MODULE_DIR/wanpipe" - WAN_DRIVERS="wanpipe" -fi - -check_bash -check_awk - - -# Return code -RC=$(pwd)/return_code -GET_RC="cat $RC" -FT1_CONF=ft1.conf - -# Ignore interrupt signals. -trap '' 2 - -init_meta_conf -read_meta_conf -if [ $? -ne 0 ]; then - echo "$SCRIPT: Error: $META_CONF not found!" - exit 1; -fi - -if [ "$WANPIPE_CONF_DIR" != "" -a "$WAN_CONF_DIR" = "" ] || [ "$WAN_ADSL_LIST" = "" ]; then - meta_conf_compatiblity -fi - -WAN_LIP_LOAD=YES -WANEC_LOAD=YES -WAN_ANNEXG_LOAD=${WAN_ANNEXG_LOAD:-NO} -WAN_DYN_WANCONFIG=${WAN_DYN_WANCONFIG:-NO} -NEW_IF_TYPE=${NEW_IF_TYPE:-NO} -WAN_INTR_DIR=$WAN_INTR_DIR -LINUX_DISTR=unknown - - -if [ -f $WAN_PROG_LOCK ]; then - echo -e "\nERROR: wanrouter script already running!\n"; - cleanup 0; -fi - -touch $WAN_PROG_LOCK - -check_osystem - -#Check osystem confirms the WAN_LOCK directory -WAN_LOCK=$WAN_LOCK_DIR/wanrouter - - -if [ ! -f $WAN_ADSL_LIST ]; then - generate_adsl_list -fi - -if [ $OSYSTEM = "Linux" ]; then - eval "grep \"Debian\" -i /etc/issue > /dev/null" - if [ $? -eq 0 ]; then - LINUX_DISTR=debian - fi - eval "grep \"Red *Hat\" -i /etc/issue > /dev/null" - if [ $? -eq 0 ]; then - LINUX_DISTR=redhat - fi - eval "grep \"Mandrake\" -i /etc/issue > /dev/null" - if [ $? -eq 0 ]; then - LINUX_DISTR=redhat - fi - - if [ "$WAN_DYN_WANCONFIG" = "YES" ]; then - if [ ! -e "/etc/wanpipe/wanconfig_socket" ]; then - echo "Starting wanconfig dameon" - eval "/usr/sbin/wanconfig -x >> $WAN_LOG 2>> $WAN_LOG &" - if [ $? -ne 0 ]; then - echo "Failed to start wanconfig daemon!" - cleanup 0; - fi - else - if [ ! -e "/var/run/wanconfig.pid" ]; then - echo "Starting wanconfig dameon" - \rm -f /etc/wanpipe/wanconfig_socket - eval "/usr/sbin/wanconfig -x >> $WAN_LOG 2>> $WAN_LOG &" - if [ $? -ne 0 ]; then - echo "Failed to start wanconfig daemon!" - cleanup 0; - fi - else - kill -USR1 $(cat /var/run/wanconfig.pid) >> /dev/null 2>> /dev/null - if [ $? -ne 0 ]; then - echo "Starting wanconfig dameon" - \rm -f /etc/wanpipe/wanconfig_socket - eval "/usr/sbin/wanconfig -x >> $WAN_LOG 2>> $WAN_LOG &" - if [ $? -ne 0 ]; then - echo "Failed to start wanconfig daemon!" - cleanup 0; - fi - fi - fi - fi - else - if [ -e "/etc/wanpipe/wanconfig_socket" ]; then - if [ -f /var/run/wanconfig.pid ]; then - eval "kill -TERM $(cat /var/run/wanconfig.pid)" - echo "Killing wanconfig daemon" - fi - fi - fi -fi - - -echo -# If modules doesn't loaded remove all lock file from WAN_LOCK_DIR. -check_module - -ft1_or_wanpipe=0 -# See how we were called. -case "$1" in - start) - - # WANROUTER START - if [ -z $2 ]; then - - check_config || cleanup 1 - - load_module - if [ $? -ne 0 ]; then - cleanup 2 - fi - - config_devices $WAN_DEVICES - - config_interfaces $WAN_DEVICES - - wanrouter_script start - - elif [ -z $3 ]; then - #ROUTER START WANPIPE - - [ -f $WAN_CONF_DIR/$FT1_CONF ] && rm -f $WAN_CONF_DIR/$FT1_CONF - dev=$2 - - #Parse the dev name, and if it starts with - #ft1 than it means we should load the ft1 - #driver. - check_config_opt $dev 0 - ft1_or_wanpipe=$? - dev=$($GET_RC) - rm -f $RC - - WAN_CONF=$WAN_CONF_DIR/$dev.conf - - check_file $WAN_CONF || cleanup 1 - - load_module - if [ $? -ne 0 ]; then - cleanup 2 - fi - - #If we are starting FT1 driver, we have to check - #wether the actual wanpipe# device is running or - #not, thus name dev has to be changed to 'wanpipe#' - if [ $ft1_or_wanpipe -gt 0 ]; then - dev="wanpipe$ft1_or_wanpipe" - fi - - config_devices $dev - if [ $? -ne 0 ]; then - cleanup 3 - fi - - #When loading ft1 device there are not interfaces - if [ $ft1_or_wanpipe -eq 0 ]; then - config_interfaces $dev - if [ $? -ne 0 ]; then - cleanup 4 - fi - fi - - else - #ROUTER START WANPIPE INTERFACE - - if [ $OSYSTEM != "Linux" ]; then - echo " This option doesn't supported yet!" - cleanup 0 - fi - dev=$2 - if_name=$3 - - #Parse the dev name, and if it starts with - #ft1 than it means we should load the ft1 - #driver. - check_config_opt $dev 0 - ft1_or_wanpipe=$? - dev=$($GET_RC) - rm -f $RC - - WAN_CONF=$WAN_CONF_DIR/$dev.conf - - check_file $WAN_CONF || cleanup 1 - - load_module - if [ $? -ne 0 ]; then - cleanup 2 - fi - - eval "$IFCONFIG_LIST | grep -w $if_name > /dev/null 2> /dev/null" - if [ $? -eq 0 ]; then - echo -e "\nInterface $if_name is already up!\n" - cleanup 1 - fi - - echo "Configuring interface: $if_name" - - if [ "$WAN_DYN_WANCONFIG" = YES ]; then - eval "/usr/sbin/wanconfig_client cmd=start,card=$dev,dev=$if_name" - else - eval "/usr/sbin/wanconfig -v card $dev dev $if_name up >> $WAN_LOG" - fi - - - #Regardles of config try to bring up the interface - #Interface up command will fail on its own - #if [ $? -ne 0 ]; then - # cleanup 1 - #fi - - interface_up $if_name - if [ $? -ne 0 ]; then - echo -e "\nInterface $if_name start error: ip setup failure!\n" - cleanup 1 - else - echo "Interface $if_name up." - fi - - wanrouter_script start $dev $if_name - fi - ;; - stop) - - #WANROUTER STOP - if [ -z $2 ]; then - - check_module - if [ $? -ne 0 ]; then - unload_module - remove_cdev - echo -e "Router is already stopped !\n" - cleanup 1 - fi - - #Check that all wanpipe#.conf file defined in - # WAN_DEVICES exist - check_config || { - unload_module - remove_cdev - echo -e "No devices running, Unloading Modules" - cleanup 1 - } - - if [ "$WAN_DEVICES_REV_STOP_ORDER" = "YES" ]; then - tmp_dev_list= - for dev in $WAN_DEVICES; do - tmp_dev_list="$dev ""$tmp_dev_list" - done - WAN_DEVICES=$tmp_dev_list - fi - - unconfig_interfaces $WAN_DEVICES - - unconfig_devices $WAN_DEVICES - - wanrouter_script stop - - elif [ -z $3 ]; then - #WANROUTER STOP WANPIPE - - dev=$2 - - if [ "$dev" = "all" ]; then - stop_running_wanpipes - cleanup 0 - fi - - check_config_opt $dev 1 - ft1_or_wanpipe=$? - dev=$($GET_RC) - rm -f $RC - - #Check that modules are up and running - check_module - if [ $? -ne 0 ]; then - unload_module - echo -e "Router is already stopped !\n"; - cleanup 1; - fi - - #If we are stopping FT1 driver, we have to check - #whether the actual wanpipe# device is running or - #not, thus name dev has to be changed to 'wanpipe#' - if [ $ft1_or_wanpipe -gt 0 ]; then - dev="wanpipe$ft1_or_wanpipe" - fi - - if [ $ft1_or_wanpipe -eq 0 ]; then - unconfig_interfaces $dev - fi - - unconfig_devices $dev - - [ -f $WAN_CONF_DIR/$FT1_CONF ] && rm -f $WAN_CONF_DIR/$FT1_CONF - - else - if [ $OSYSTEM != "Linux" ]; then - echo " This option doesn't supported yet!" - cleanup 0 - fi - dev=$2 - if_name=$3 - - #Parse the dev name, and if it starts with - #ft1 than it means we should load the ft1 - #driver. - check_config_opt $dev 0 - ft1_or_wanpipe=$? - dev=$($GET_RC) - rm -f $RC - - WAN_CONF=$WAN_CONF_DIR/$dev.conf - - check_file $WAN_CONF || cleanup 1 - - eval "$IFCONFIG_LIST | grep -w $if_name > /dev/null 2> /dev/null" - if [ $? -eq 0 ]; then - echo "Interface $if_name down" - eval "ifconfig $if_name down" - fi - - echo "Unconfiguring interface: $if_name" - if [ "$WAN_DYN_WANCONFIG" = YES ]; then - eval "/usr/sbin/wanconfig_client cmd=stop,card=$dev,dev=$if_name" - else - eval "/usr/sbin/wanconfig -v card $dev dev $if_name down >> $WAN_LOG" - fi - if [ $? -ne 0 ]; then - cleanup 1 - fi - - check_and_print_still_running && cleanup 0 - - cd $WAN_HOME - echo -e "No devices running, Unloading Modules" - unload_module - - wanrouter_script stop $dev $if_name - fi - ;; - - start_dev) - - if [ -z $2 ]; then - # WANROUTER START_DEV - - check_config || cleanup 1 - - load_module - if [ $? -ne 0 ]; then - cleanup 2 - fi - - config_devices $WAN_DEVICES - - elif [ -z $3 ]; then - #ROUTER START_DEV WANPIPE - - dev=$2 - - load_module - if [ $? -ne 0 ]; then - cleanup 2 - fi - - config_devices $dev - if [ $? -ne 0 ]; then - cleanup 3 - fi - fi - ;; - - stop_dev) - - if [ -z $2 ]; then - #WANROUTER STOP_DEV - - check_module - if [ $? -ne 0 ]; then - unload_module - remove_cdev - echo -e "Router is already stopped !\n" - cleanup 1 - fi - - #Check that all wanpipe#.conf file defined in - # WAN_DEVICES exist - check_config || { - unload_module - remove_cdev - echo -e "No devices running, Unloading Modules" - cleanup 1 - } - - if [ "$WAN_DEVICES_REV_STOP_ORDER" = "YES" ]; then - tmp_dev_list= - for dev in $WAN_DEVICES; do - tmp_dev_list="$dev ""$tmp_dev_list" - done - WAN_DEVICES=$tmp_dev_list - fi - - unconfig_devices $WAN_DEVICES - - wanrouter_script stop - - elif [ -z $3 ]; then - #WANROUTER STOP_DEV WANPIPE - - dev=$2 - - if [ "$dev" = "all" ]; then - stop_running_wanpipes - cleanup 0 - fi - - #Check that modules are up and running - check_module - if [ $? -ne 0 ]; then - unload_module - echo -e "Router is already stopped !\n"; - cleanup 1; - fi - - unconfig_devices $dev - fi - ;; - - start_ip) - - if [ -z $2 ]; then - # WANROUTER START_IP - check_config || cleanup 1 - - config_interfaces $WAN_DEVICES - - wanrouter_script start - - elif [ -z $3 ]; then - #ROUTER START_IP WANPIPE - config_interfaces $2 - fi - ;; - - stop_ip) - - if [ -z $2 ]; then - #WANROUTER STOP_IP - unconfig_interfaces $WAN_DEVICES - - elif [ -z $3 ]; then - #WANROUTER STOP_IP WANPIPE - unconfig_interfaces $2 - fi - ;; - - script) - - #Debug Statement, used to test the script option - #echo "WAN_ACTION=$WAN_ACTION WAN_DEVICE=$WAN_DEVICE WAN_INTERFACE=$WAN_INTERFACE" >> /var/log/messages - - #wanrouter script - if [ ! -z $WAN_ACTION ]; then - if [ ! -z $WAN_INTERFACE ]; then - wanrouter_script $WAN_ACTION $WAN_DEVICE $WAN_INTERFACE - elif [ ! -z $WAN_DEVICE ]; then - wanrouter_script $WAN_ACTION $WAN_DEVICE - else - wanrouter_script $WAN_ACTION - fi - fi - ;; - - list) - - check_module - if [ $? -ne 0 ]; then - echo -e "Router is stopped !\n"; - cleanup 0; - fi - - print_active_devices 1; - cleanup 0; - ;; - - restart) - eval "rm -f $WAN_PROG_LOCK 2> /dev/null > /dev/null" - if [ "$2" = "" ]; then - $0 stop; - $0 start; - elif [ "$3" = "" ]; then - $0 stop $2; - $0 start $2; - else - $0 stop $2 $3; - $0 start $2 $3; - fi - cleanup 0; - ;; - - restart_dev) - eval "rm -f $WAN_PROG_LOCK 2> /dev/null > /dev/null" - if [ "$2" = "" ]; then - $0 stop_dev; - $0 start_dev; - elif [ "$3" = "" ]; then - $0 stop_dev $2; - $0 start_dev $2; - fi - cleanup 0; - ;; - - restart_ip) - eval "rm -f $WAN_PROG_LOCK 2> /dev/null > /dev/null" - if [ "$2" = "" ]; then - $0 stop_ip; - $0 start_ip; - elif [ "$3" = "" ]; then - $0 stop_ip $2; - $0 start_ip $2; - fi - cleanup 0; - ;; - - modules) - - if [ $OSYSTEM = "Linux" ]; then - cat /proc/modules | grep wan; - else - $MODULE_STAT | grep -i "wan\|sdla"; - #$MODULE_STAT | grep sdla; - fi - cleanup 0; - - ;; - status) - - check_module - if [ $? -ne 0 ]; then - echo -e "Router is stopped !\n"; - cleanup 0; - fi - - print_active_devices 1; - print_wanpipe_config - print_wanrouter_status - echo "" - - cleanup 0; - ;; - - - summary) - print_config_summary; - cleanup 0; - ;; - - hwprobe) - load_module silent - if [ $? -ne 0 ]; then - cleanup 1 - fi - if [ "$2" = "verbose" ]; then - if [ $OSYSTEM = "Linux" ]; then - cat /proc/net/wanrouter/hwprobe_verbose - else - wanconfig hwprobe verbose - fi - else - if [ $OSYSTEM = "Linux" ]; then - cat /proc/net/wanrouter/hwprobe - else - wanconfig hwprobe - fi - fi - cleanup 0; - ;; - - debug) - if [ -z $2 ]; then - wanrouter_debug; - else - wanrouter_if_debug $2; - fi - cleanup 0; - ;; - - wanrc) - - config_wanrouter_rc - cleanup 0; - ;; - - messages) - echo - echo "Start WANPIPE /var/log/messages" - echo - if [ $OSYSTEM = "Linux" ]; then - eval "tail -n 200 /var/log/messages | grep -i \"[wanpipe|sdladrv]\" " - else - eval "tail -n 200 /var/log/messages | grep -i \"wanpipe\|sdladrv\" " - fi - echo - echo "End of WANPIPE /var/log/messages" - echo - cleanup 0; - ;; - - conflog) - echo - echo "Start WANPIPE $WAN_LOG" - echo - eval "cat $WAN_LOG" - echo - echo "End of WANPIPE $WAN_LOG" - echo - cleanup 0; - ;; - - version) - echo "WANPIPE Release: $ROUTER_VERSION" - ;; - - lineprobe) - if [ $OSYSTEM != "Linux" ]; then - echo -e "The 'lineprobe' option supported on Linux OS only.\n" - cleanup 1; - fi - - echo -e "Starting the lineprobe ...\n" - - #The lineprobe calls wanrouter internally. - #This instance of wanrouter will prevent the other from starting. - #Remove the lock. - eval "rm -f $WAN_PROG_LOCK 2> /dev/null > /dev/null" - - #Remove name of the program from command line. - shift 1 - #Pass rest of the arguments to lineprobe. - if [ -e $LINEPROBE_PATH ]; then - eval "lineprobe" "$@" - else - echo -e "File $LINEPROBE_PATH does not exist!" - echo -e "Please check 'lineprobe' was successfully compiled.\n" - fi - - ;; - - *) echo -e "\nWANPIPE: WAN Router startup script\n" - echo -e "Usage: $SCRIPT: {options} \n" - - echo -e " wanrouter start : Starts all devices specified in" - echo -e " $WAN_CONF_DIR/wanrouter.rc WAN_DEVICES\n" - echo -e " wanrouter stop : Stops all devices specified in" - echo -e " $WAN_CONF_DIR/wanrouter.rc WAN_DEVICES\n" - echo -e " wanrouter start wanpipe# : Start a single device\n" - echo -e " wanrouter stop wanpipe# : Stops a single device" - echo -e " (# can range from 1 to 16)\n" - if [ $OSYSTEM = "Linux" ]; then - echo -e " wanrouter start wanpipe# if_name : Start a single interface on device\n" - echo -e " wanrouter stop wanpipe# if_name : Stops a single interface on device" - echo -e " (# can range from 1 to 16)\n" - - fi - echo -e " wanrouter restart : Restart all devices specified in" - echo -e " $WAN_CONF_DIR/wanrouter.rc WAN_DEVICES\n" - echo -e " wanrouter restart wanpipe# : Restart a single device" - echo -e " (# can range from 1 to 16)\n" - echo - if [ $OSYSTEM = "Linux" ]; then - echo -e " wanrouter restart wanpipe# if_name : Restart a single interface on device" - echo -e " (# can range from 1 to 16)\n" - echo - fi - echo -e " wanrouter list : List all active devices\n" - echo -e " wanrouter modules : Show wanpipe kernel modules\n" - echo -e " wanrouter status : Display status for all active devices\n" - echo -e " wanrouter summary : Summary of config files in $WAN_HOME\n" - echo -e " wanrouter hwprobe : Display wanpipe hardware probe info.\n" - echo -e " wanrouter debug : Check current wanpipe environment." - echo -e " After a startup error run this command to" - echo -e " get a possible solution" - echo -e " i.e. wanrouter start; wanrouter debug;\n" - if [ $OSYSTEM = "Linux" ]; then - echo -e " wanrouter debug if_name : Display common debugging statistics" - echo -e " In case of line problems save to file," - echo -e " wait 2-5mi and send to Sangoma Tech Support" - echo -e " i.e. wanrouter debug wp1fr16 > debug_file;\n" - fi - echo -e " wanrouter messages : Display wanpipe kernel event messages" - echo -e " i.e. /var/log/messages\n" - echo -e " wanrouter conflog : Display wanpipe configuration parsing messages" - echo -e " i.e. $WAN_LOG\n" - echo -e " wanrouter wanrc : Configure the wanpipe boot startup order" - echo -e " in $META_CONF\n" - echo -e " wanrouter version : wanpipe version information.\n" - - if [ $OSYSTEM = "Linux" ]; then - echo -e " wanrouter lineprobe [-c wanpipe#] [options] " - echo -e " : Monitor/Debug a line connected to an" - echo -e " automatically detected or preconfigured card." - echo -e " i.e.: wanrouter lineprobe; or" - echo -e " : wanrouter lineprobe -c wanpipe1;" - echo -e " Type 'wanrouter lineprobe -help' to get the" - echo -e " list of 'lineprobe' options." - fi - cleanup 0 - ;; -esac -echo -cleanup 0 -exit 0 diff --git a/ssmg/sangoma_bri/Makefile b/ssmg/sangoma_bri/Makefile new file mode 100644 index 0000000..7f4df7d --- /dev/null +++ b/ssmg/sangoma_bri/Makefile @@ -0,0 +1,22 @@ + +INSTALLPREFIX= +ifndef ARCH + ARCH=$(shell uname -m) +endif + +SANGOMA_BRID=sangoma_brid.i686 +ifeq ($(ARCH),x86_64) + SANGOMA_BRID=sangoma_brid.x86_64 +endif +all: + +install: + install -D smg_ctrl $(INSTALLPREFIX)/usr/sbin/smg_ctrl + install -D $(SANGOMA_BRID) $(INSTALLPREFIX)/usr/sbin/sangoma_brid + + @echo + @echo "Sangoma BRI Install Done" + @echo "Run: /usr/sbin/wancfg_smg to configure wanpipe BRI" + @echo + + diff --git a/ssmg/sangoma_bri/install.sh b/ssmg/sangoma_bri/install.sh new file mode 100755 index 0000000..7c1a522 --- /dev/null +++ b/ssmg/sangoma_bri/install.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +home=$(pwd) +arch=`uname -m` + +echo "Installing Sangoma BRI Daemon for $arch" +case $arch in + i686) + install -D sangoma_brid.i686 /usr/sbin/sangoma_brid + ;; + x86_64) + install -D sangoma_brid.x86_64 /usr/sbin/sangoma_brid + ;; + *) + echo "Unsupported architecture $arch" + exit 1 + ;; +esac + +echo "Sangoma BRI Install Done" +echo +echo "Run: wancfg_smg to configure wanpipe BRI" +echo diff --git a/ssmg/sangoma_bri/sangoma_brid.i686 b/ssmg/sangoma_bri/sangoma_brid.i686 new file mode 100755 index 0000000..7d41862 Binary files /dev/null and b/ssmg/sangoma_bri/sangoma_brid.i686 differ diff --git a/ssmg/sangoma_bri/sangoma_brid.x86_64 b/ssmg/sangoma_bri/sangoma_brid.x86_64 new file mode 100755 index 0000000..e48f770 Binary files /dev/null and b/ssmg/sangoma_bri/sangoma_brid.x86_64 differ diff --git a/ssmg/sangoma_bri/smg_ctrl b/ssmg/sangoma_bri/smg_ctrl new file mode 100755 index 0000000..abbca3e --- /dev/null +++ b/ssmg/sangoma_bri/smg_ctrl @@ -0,0 +1,199 @@ +#!/bin/sh +cmd=$1; +cnt=0; +max_retry=5; +function stop_all() +{ + + echo " " + echo "Stopping running processes..." + + stop_sangoma_brid + stop_sangoma_mgd +} + + + +function stop_sangoma_brid() +{ + #stop sangoma_brid + eval "pidof sangoma_brid >/dev/null 2>/dev/null" + if [ $? -eq 0 ]; then + echo -n "Sending TERM signal to sangoma_brid..." + eval "kill -TERM $(pidof sangoma_brid) 2>/dev/null >/dev/null" + if [ $? -eq 0 ]; then + echo "OK" + else + echo "FAILED" + break; + fi + fi + for ((i=0;i<$max_retry;i++)) + do + eval "pidof sangoma_brid >/dev/null 2>/dev/null" + if [ $? -ne 0 ]; then + echo "sangoma_brid is stopped" + return; + else + echo "waiting for sangoma_brid to finish($i/$max_retry)...." + sleep 1 + fi + done + eval "pidof sangoma_brid >/dev/null 2>/dev/null" + if [ $? -eq 0 ]; then + echo -n "Sending KILL signal to sangoma_brid..." + eval "kill -KILL $(pidof sangoma_brid) 2>/dev/null >/dev/null" + if [ $? -eq 0 ]; then + echo "OK" + else + echo "FAILED" + break; + fi + fi + for ((i=0;i<$max_retry;i++)) + do + eval "pidof sangoma_brid >/dev/null 2>/dev/null" + if [ $? -ne 0 ]; then + echo "sangoma_brid is stopped" + break; + else + echo "waiting for sangoma_brid to finish($i/$max_retry)...." + sleep 1 + fi + done +} + +function stop_sangoma_mgd() +{ + #stop sangoma media gateway + eval "pidof sangoma_mgd >/dev/null 2>/dev/null" + if [ $? -eq 0 ]; then + echo -n "Sending TERM signal to sangoma_mgd..." + eval "sangoma_mgd -term 2>/dev/null >/dev/null" + if [ $? -eq 0 ]; then + echo "OK" + return; + else + echo "FAILED" + echo "Failed to stop sangoma_mgd" + exit 1 + fi + else + echo "sangoma_mgd not running..." + return; + fi + + + #stop sangoma media gateway + eval "pidof sangoma_mgd >/dev/null 2>/dev/null" + if [ $? -eq 0 ]; then + echo -n "Sending TERM signal to sangoma_mgd..." + eval "kill -KILL $(pidof sangoma_mgd) 2>/dev/null >/dev/null" + if [ $? -eq 0 ]; then + echo "OK" + else + echo "FAILED" + echo "Failed to stop sangoma_mgd" + exit 1 + fi + else + echo "sangoma_mgd not running..." + fi + + +} + +function start_all() +{ + + echo " " + echo "Starting processes..." + echo -n "Loading SCTP..." + eval "modprobe sctp >>/var/log/sangoma_mgd.log 2>>/var/log/sangoma_mgd.log" + if [ $? -eq 0 ]; then + echo "OK" + else + echo "Failed" + echo "Failed to load SCTP module, check /var/log/sangoma_mgd.log" + exit 1; + fi + sleep 1 + + eval "ls /dev/wptdm* >>/dev/null 2>>/dev/null" + + if [ $? -ne 0 ]; then + echo "No Sangoma TDM API interfaces running" + echo "Did you start wanrouter? " + exit 1; + fi + + echo -n "Starting sangoma_brid..." + eval "sangoma_brid >/dev/null 2>/dev/null &" + if [ $? -eq 0 ]; then + echo "OK" + else + echo "Failed" + echo "Failed to start sangoma_brid, check /var/log/sangoma_mgd.log for errors" + exit 1; + fi + sleep 2 + if [ ! $(pidof sangoma_brid) ]; then + echo "sangoma_brid failed to start" + echo "check /var/log/sangoma_mgd.log for errors" + exit 1; + fi + + echo -n "Starting sangoma_mgd..." + eval "sangoma_mgd -bg >/dev/null 2>/dev/null" + if [ $? -eq 0 ]; then + echo "OK" + else + echo "Failed" + echo "Failed to start sangoma_mgd, check /var/log/sangoma_mgd.log for errors" + exit 1; + fi + + sleep 2 + if [ ! $(pidof sangoma_mgd) ]; then + echo "sangoma_mgd failed to start" + echo "check /var/log/sangoma_mgd.log for errors" + exit 1; + fi + + echo "Sangoma SMG running.." + echo "log file: /var/log/sangoma_mgd.log" + echo " " +} + +if [ "$cmd" = "start" ]; then + if [ $(pidof sangoma_brid) ]; then + echo "sangoma_brid is currently running" + echo "exiting..." + exit 0 + fi + + if [ $(pidof sangoma_mgd) ]; then + echo "sangoma_mgd is currently running" + echo "exiting..." + exit 0 + fi + + start_all +elif [ "$cmd" = "stop" ]; then + + stop_all +elif [ "$cmd" = "restart" ]; then + stop_all + start_all +else + echo " " + echo "Usage: smg_ctrl " + echo " options:" + echo " " + echo "start :start sangoma_brid and sangoma media gateway" + echo "stop :stop sangoma_brid and sangoma media gateway" + echo "restart :restart sangoma_brid and sangoma media gateway" + echo " " +fi + + diff --git a/ssmg/sangoma_mgd.trunk/.svn/all-wcprops b/ssmg/sangoma_mgd.trunk/.svn/all-wcprops index 0fba5f0..f7cd42e 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/all-wcprops +++ b/ssmg/sangoma_mgd.trunk/.svn/all-wcprops @@ -1,7 +1,7 @@ K 25 svn:wc:ra_dav:version-url V 34 -/svn/sangoma_mgd/!svn/ver/65/trunk +/svn/sangoma_mgd/!svn/ver/66/trunk END sigboost.h K 25 diff --git a/ssmg/sangoma_mgd.trunk/.svn/entries b/ssmg/sangoma_mgd.trunk/.svn/entries index f0054bd..98d36fd 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/entries +++ b/ssmg/sangoma_mgd.trunk/.svn/entries @@ -1,14 +1,14 @@ 8 dir -65 -https://www.sangomapbx.com:/svn/sangoma_mgd/trunk -https://www.sangomapbx.com:/svn/sangoma_mgd +66 +https://www.sangomapbx.com/svn/sangoma_mgd/trunk +https://www.sangomapbx.com/svn/sangoma_mgd -2008-02-07T18:15:41.313227Z -65 +2008-02-08T17:46:54.335012Z +66 ncorbic @@ -32,7 +32,7 @@ file -2008-01-11T19:07:46.000000Z +2007-11-26T18:06:19.000000Z d2023784f5d89a5623927a366705e22a 2007-11-24T22:45:32.820698Z 36 @@ -47,7 +47,7 @@ file -2008-01-11T19:07:46.000000Z +2007-11-30T16:39:49.000000Z da36acc78b83d5047481df0cca63d969 2007-09-21T20:53:51.260136Z 1 @@ -60,7 +60,7 @@ file -2008-02-07T18:07:12.000000Z +2008-02-13T19:12:32.000000Z 31bd051e4281dc2e6e705cded0c30971 2008-02-07T18:04:31.680485Z 64 @@ -72,7 +72,7 @@ file -2008-01-11T19:07:46.000000Z +2007-11-30T16:39:49.000000Z f4832443a621cbb88e92535898d11b83 2007-09-21T20:53:51.260136Z 1 @@ -84,7 +84,7 @@ file -2008-01-11T19:07:46.000000Z +2007-11-30T16:39:49.000000Z 2403f191bdc1959c4cfd186b5030b9b1 2007-09-21T20:53:51.260136Z 1 @@ -100,7 +100,7 @@ file -2008-01-11T19:07:46.000000Z +2008-01-14T17:24:55.000000Z f20dab977386b2508903e24a307ca2d6 2007-09-21T20:53:51.260136Z 1 @@ -119,11 +119,19 @@ file -2008-01-11T19:07:46.000000Z +2008-01-14T15:56:22.000000Z bcf6ba51a26281d7a0963c364f8610f1 2007-11-28T21:12:42.416435Z 42 ncorbic + + + + + +call_signal.c.r40 +call_signal.c.r53 +call_signal.c.mine re-sync.sh file @@ -131,44 +139,52 @@ file -2008-01-11T19:07:46.000000Z +2007-10-12T19:24:17.000000Z 1cd822495b7d97b8e089c93bac1ad71a 2007-09-25T02:04:57.936973Z 20 ncorbic has-props -sangoma_mgd.c -file -66 - - - -2008-02-08T17:53:31.000000Z -fb2f3311aca106d27d61957211903a0d -2008-02-08T17:46:54.335012Z -66 -ncorbic - woomera.conf file -2008-01-11T19:07:46.000000Z +2007-10-11T20:07:11.000000Z 356d6fc18e0670efac6de6001e58648e 2007-09-21T20:53:51.260136Z 1 root +sangoma_mgd.c +file + + + + +2007-09-25T06:19:28.000000Z +fb2f3311aca106d27d61957211903a0d +2008-02-08T17:46:54.335012Z +66 +ncorbic + + + + + +sangoma_mgd.c.r33 +sangoma_mgd.c.r40 +sangoma_mgd.c.mine + call_signal.h file -2008-01-11T19:07:46.000000Z +2007-10-11T20:07:11.000000Z 1a8b734edbabbe1e04c0086460cf1565 2007-09-21T20:53:51.260136Z 1 @@ -180,19 +196,27 @@ file -2008-02-07T18:07:44.000000Z +2008-01-14T15:37:07.000000Z 0e349003dfb2ecb954424d503cee4c9e 2008-02-07T18:04:31.680485Z 64 ncorbic + + + + + +sangoma_mgd.h.r56 +sangoma_mgd.h.r59 +sangoma_mgd.h.mine Changelog.sangoma_mgd file -66 -2008-02-08T17:54:19.000000Z + +2008-02-13T19:12:32.000000Z 24d92bda7769867980fd44e68f2eb422 2008-02-08T17:46:54.335012Z 66 @@ -204,7 +228,7 @@ file -2008-01-11T19:07:46.000000Z +2007-10-11T20:07:11.000000Z a31121fb876e49155ae5d77812b68cc3 2007-09-21T20:53:51.260136Z 1 @@ -216,7 +240,7 @@ file -2008-01-11T19:07:46.000000Z +2007-10-11T20:07:11.000000Z 0f725f95ced42af15dcaef21f3a1722b 2007-09-21T20:53:51.260136Z 1 @@ -231,7 +255,7 @@ file -2008-01-11T19:07:46.000000Z +2007-09-25T06:34:30.000000Z 0e00003cd276e523b9b6e6df6a2f823f 2007-12-20T00:59:56.095828Z 51 @@ -244,7 +268,7 @@ file -2008-02-06T22:45:23.000000Z +2008-02-13T19:12:32.000000Z c97ea5c4ee482db2409549e9c320d633 2008-02-06T22:23:25.673829Z 62 @@ -256,7 +280,7 @@ file -2008-01-18T21:45:09.000000Z +2008-01-18T22:26:34.000000Z 305c8fe9341c230ec32af102688736fd 2008-01-18T20:47:52.049290Z 56 @@ -269,7 +293,7 @@ file -2008-02-06T22:45:23.000000Z +2008-02-13T19:12:32.000000Z c8cc3aa052980e6c7cb766ae564882d1 2008-02-06T22:22:53.766395Z 61 @@ -281,7 +305,7 @@ file -2008-02-07T18:23:40.000000Z +2008-01-14T15:59:16.000000Z d03c6e24e68df0f99cee78567a623583 2008-02-07T18:15:41.313227Z 65 @@ -293,7 +317,7 @@ file -2008-02-06T22:45:23.000000Z +2008-02-13T19:12:32.000000Z 81957c6e3d9a6caa2e223e954c15c49c 2008-02-06T22:23:25.673829Z 62 diff --git a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.10.tmp b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.10.tmp new file mode 100644 index 0000000..4a55b8b --- /dev/null +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.10.tmp @@ -0,0 +1,306 @@ +#!/bin/sh + +# ---------------------------------------------------------------------------- +# Prompt user for input. +# ---------------------------------------------------------------------------- +prompt() +{ + if test $NONINTERACTIVE; then + return 0 + fi + + echo -ne "$*" >&2 + read CMD rest + return 0 +} + +# ---------------------------------------------------------------------------- +# Get Yes/No +# ---------------------------------------------------------------------------- +getyn() +{ + if test $NONINTERACTIVE; then + return 0 + fi + + while prompt "$* (y/n) " + do case $CMD in + [yY]) return 0 + ;; + [nN]) return 1 + ;; + *) echo -e "\nPlease answer y or n" >&2 + ;; + esac + done +} + + + +home=`pwd`; + +force="false" +noss7="true" +rootdir="" +pbxdir=/usr/src/asterisk +pbxd="asterisk" +cfgdir="/etc/asterisk" + + + +while [ ! -z $1 ] +do + if [ $1 = '-force' ]; then + force="force" + elif [ $1 = '-noss7' ]; then + noss7="true" + elif [ $1 = '-pbxdir' ]; then + shift + pbxdir=$1 + if [ "$pbxdir" = "" ]; then + echo "Error: Invalid $pbxd dir: $pbxdir!"; + exit 1 + elif [ ! -d $pbxdir ]; then + echo "Error: $pbxd dir does not exist: $pbxdir!"; + exit 1 + fi + + elif [ $1 = '-rootdir' ]; then + shift + rootdir=$1 + if [ "$rootdir" = "" ]; then + echo "Error: Invalid root dir: $rootdir!"; + exit 1 + elif [ ! -d $rootdir ]; then + echo "Error: root dir does not exist: $rootdir!"; + exit 1 + fi + + else + echo "Invalid option: $1"; + echo + echo "Usage: ./install " + echo + exit 1 + fi + shift +done + +if [ -f $pbxdir/include/callweaver.h ]; then + echo "PBXD=callweaver" > /etc/wanpipe/pbxd + pbxd="callweaver" + cfgdir="/usr/local/etc/callweaver" +else + echo "PBXD=asterisk" > /etc/wanpipe/pbxd + pbxd="asterisk" + cfgdir="/etc/asterisk" +fi + +if [ $noss7 != 'true' ]; then + if [ ! -e /usr/local/ss7box/$ss7boost ]; then + echo "Error: ss7boost not found in /usr/local/ss7box dir"; + exit 1 + fi + if [ ! -e /usr/local/ss7box/$ss7boxd ]; then + echo "Error: ss7boxd not found in /usr/local/ss7box dir"; + exit 1 + fi +fi + +if [ $force = "force" ]; then + echo "Stopping SMG..." + eval "sangoma_mgd -term" + kill -TERM $(pidof asterisk); + echo "OK." + echo +else + if [ -f /var/run/sangoma_mgd.pid ]; then + echo "Warning: sangoma_mgd is running!" + getyn "Would you like to stop sangoma_mgd?" + if [ $? -ne 0 ]; then + exit 1 + fi + + eval "sangoma_mgd -term" + if [ -f /var/run/sangoma_mgd.pid ];then + echo "Failed to stop sangoma_mgd" + exit 1 + fi + fi + if [ -f /var/run/asterisk.pid ]; then + echo "Warning: asterisk is running" + getyn "Would you like to stop asterisk?" + if [ $? -ne 0 ]; then + exit 1 + fi + eval "asterisk -rx \"stop now\" >/dev/null 2>/dev/null" + sleep 2 + if [ -f /var/run/asterisk.pid ]; then + kill -TERM $(pidof asterisk); + sleep 2 + if [ -f /var/run/asterisk.pid ]; then + echo "Failed to stop asterisk" + exit 1 + fi + fi + fi +fi + +echo +echo "Checking Syslog ...." +if [ -e /etc/syslog.conf ]; then + eval "grep "local2.*sangoma_mgd" /etc/syslog.conf" > /dev/null 2> /dev/null + if [ $? -ne 0 ]; then + eval "grep "local2" /etc/syslog.conf " > /dev/null 2> /dev/null + if [ $? -eq 0 ]; then + echo + echo "Warning : local2 is already used in syslog.conf" + echo + fi + echo -e "\n# Sangoma Media Gateway log" > tmp.$$ + echo -e "local2.* /var/log/sangoma_mgd.log\n" >> tmp.$$ + eval "cat /etc/syslog.conf tmp.$$ > tmp1.$$" + \cp -f tmp1.$$ /etc/syslog.conf + eval "/etc/init.d/syslog restart" + fi + eval "grep "local3.*sangoma_bri" /etc/syslog.conf" > /dev/null 2> /dev/null + if [ $? -ne 0 ]; then + eval "grep "local3" /etc/syslog.conf " > /dev/null 2> /dev/null + if [ $? -eq 0 ]; then + echo + echo "Warning : local3 is already used in syslog.conf" + echo + fi + echo -e "\n# Sangoma BRI Daemon (smg_bri) log" > tmp.$$ + echo -e "local3.* /var/log/sangoma_bri.log\n" >> tmp.$$ + eval "cat /etc/syslog.conf tmp.$$ > tmp1.$$" + \cp -f tmp1.$$ /etc/syslog.conf + eval "/etc/init.d/syslog restart" + fi +else + echo "Warning: /etc/syslog.conf not found" +fi + +if [ -f tmp1.$$ ]; then + rm -f tmp1.$$ +fi +if [ -f tmp.$$ ]; then + rm -f tmp.$$ +fi + +echo "Ok" +echo + +echo "Checking logrotate ..." +eval "type logrotate" > /dev/null 2> /dev/null +if [ $? -ne 0 ]; then + echo "Error: Logrotate not found !" +fi + +if [ -e /etc/logrotate.d ] && [ -e /etc/logrotate.d/syslog ]; then + + eval "grep sangoma_mgd /etc/logrotate.d/syslog" > /dev/null 2> /dev/null + if [ $? -ne 0 ]; then + eval "sed -e 's/messages/messages \/var\/log\/sangoma_mgd.log/' /etc/logrotate.d/syslog >tmp2.$$ 2>/dev/null" + eval "cp -f tmp2.$$ /etc/logrotate.d/syslog" + eval "logrotate -f /etc/logrotate.d/syslog" + if [ $? -ne 0 ]; then + echo "Error: logrotate restart failed!"; + exit 1; + fi + echo "Logrotate is being changed and restarted!" + else + echo "Logrotate is configured!" + fi + +else + echo "Error: Logrotate dir: /etc/logrotate.d not found !" +fi +echo "OK." +echo + +echo "Checking for SCTP Utilities...." +if [ ! -e /usr/include/netinet/sctp.h ] && [ ! -e /usr/include/sctp.h ]; then + echo "Error: lksctp-tools-devel package missing" + exit 1 +fi +echo "OK." +echo + +echo "Checking for SCTP modules..." +eval "modprobe -l | grep \"\/sctp.ko\" >/dev/null 2>/dev/null" +if [ $? -ne 0 ]; then + if [ ! -e /proc/net/sctp ]; then + echo "Warning: Your Kernel does not support SCTP Protocol!" + echo "SCTP is needed by SMG!" + echo + echo "Please contact sangoma support!" + echo + exit 1 + fi +fi +echo "OK." +echo + + +echo "Compiling Sangoma MGD ..." +eval "make clean 2> /dev/null > /dev/null" +eval "make" +if [ $? -ne 0 ]; then + exit 1; +fi + +if [ $noss7 == 'true' ]; then + make INSTALLPREFIX=$rootdir NO_SS7=YES install +else + make INSTALLPREFIX=$rootdir install +fi +echo "Ok." + +if [ -d chan_woomera.trunk ]; then + + cd chan_woomera.trunk + + echo "Compiling Woomera Channel ..." + + if [ ! -e $pbxdir ]; then + echo + echo "Error: $pbxdir directory does not exist!" + echo " Please create symlink /usr/src/asterisk and" + echo " point to existing asterisk source!" + echo " Then re run ./install.sh " + echo + exit 1 + fi + + eval "make clean 2> /dev/null > /dev/null" + eval "make PBXDIR=$pbxdir" + if [ $? -ne 0 ]; then + exit 1; + fi + + make INSTALLPREFIX=$rootdir install + echo "Ok." + +else + echo "Warning: chan_woomera directory does not exist!" + exit 1 +fi + + +echo "---------------------------------" +echo +echo " SMG Install Done" +echo +echo "--> Config: /etc/sangoma_mgd.conf" +echo "--> Start: sangoma_mgd -bg" +echo +echo " Chan Woomera Install Done" +echo +echo "--> Config: $cfgdir/woomera.conf" +echo "--> Start: start $pbxd (part of $pbxd)" +echo +echo "---------------------------------" + +exit 0 + diff --git a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.11.tmp b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.11.tmp new file mode 100644 index 0000000..9c96639 --- /dev/null +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.11.tmp @@ -0,0 +1,119 @@ +################################################################################ +# Sangoma MGD +# +# Author: Anthony Minessale II +# Nenad Corbic +# +# Copyright: (c) 2005 Anthony Minessale II +# +# 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. +################################################################################ + +SMG_DTMF=YES + +#Default kernel directory to be overwritten by user +#Kernel version and location +ifndef KVER + KVER=$(shell uname -r) +endif +ifndef KMOD + KMOD=/lib/modules/$(KVER) +endif +ifndef KDIR + KDIR=$(KMOD)/build +endif +ifndef KINSTDIR + KINSTDIR=$(KMOD)/kernel +endif + +CC = gcc +INSTALLPREFIX= + +INCLUDES = -I$(KDIR)/include -I ../../ssmg/libsangoma.trunk -I. -I ../../patches/kdrivers/include -I ../../patches/kdrivers/wanec/oct6100_api/include -I ../../patches/kdrivers/wanec -I/usr/local/include -I../../patches/kdrivers/include -I/usr/include/wanpipe -Ilib/libteletone/src + +CFLAGS = -D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O6 +CCFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes -g +LDFLAGS=-L lib/libteletone/.libs -L. -L/usr/local/lib -L ../../ssmg/libsangoma.trunk/.libs -lpthread -lsangoma -lm + + +ifeq "${SMG_DTMF}" "YES" +LDFLAGS+= -lteletone +CFLAGS+= -DSMG_DTMF_ENABLE +endif + + +all: sangoma_mgd + +libs: + $(shell cd lib/libteletone; ./configure --prefix=$(INSTALLPREFIX); cd ../../; ) + $(MAKE) -C lib/libteletone all + +switch_buffer.o: switch_buffer.c switch_buffer.h + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o switch_buffer.o switch_buffer.c + +call_signal.o: call_signal.c call_signal.h + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o call_signal.o call_signal.c + +sangoma_mgd: sangoma_mgd.o call_signal.o switch_buffer.o sigboost.h + rm -fr core* + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -o sangoma_mgd sangoma_mgd.o switch_buffer.o call_signal.o $(LDFLAGS) + +sangoma_mgd.o: sangoma_mgd.c sangoma_mgd.h sigboost.h + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd.o sangoma_mgd.c + + +clean: old_cleanup + make -C lib/libteletone clean + find . -name '*.o' | xargs rm -f + rm -fr sangoma_mgd pritest *.o *.so *~ *core* *.so* *.a + +distclean: clean + @echo OK + +install: all install_smg old_cleanup + +install_smg: old_cleanup + install -D -m 755 sangoma_mgd $(INSTALLPREFIX)/usr/sbin/sangoma_mgd + +ifeq "${NO_SS7}" "YES" + @echo "BRI control scripts installed" + @if [ ! -e $(INSTALLPREFIX)/etc/sangoma_mgd.conf ]; then \ + install -D -m 755 sangoma_mgd.conf.sample.bri $(INSTALLPREFIX)/etc/sangoma_mgd.conf; \ + fi +<<<<<<< .mine + install -D -m 755 ../sangoma_bri/smg_ctrl $(INSTALLPREFIX)/usr/sbin/smg_ctrl +else + @echo "SS7 control scripts installed" + @if [ ! -e $(INSTALLPREFIX)/etc/sangoma_mgd.conf ]; then \ + install -D -m 755 sangoma_mgd.conf.sample.ss7 $(INSTALLPREFIX)/etc/sangoma_mgd.conf; \ + fi +======= +ifeq "${NO_SS7}" "YES" + @echo"SS7 control and service script not installed" +else +>>>>>>> .r53 + install -D -m 755 smg_ctrl $(INSTALLPREFIX)/usr/sbin/smg_ctrl + install -D -m 755 scripts/init.d/smgss7_init_ctrl $(INSTALLPREFIX)/etc/init.d/smgss7_init_ctrl + install -D -m 755 scripts/init.d/smgss7_init_ctrl $(INSTALLPREFIX)/usr/sbin/smgss7_init_ctrl +<<<<<<< .mine +endif + +======= +endif +>>>>>>> .r53 + @echo "sangoma_mgd Installed" + +old_cleanup: + ./scripts/old_cleanup.sh + + +install_all: all install_smg + +uninstall: + /bin/rm $(INSTALLPREFIX)/usr/sbin/sangoma_mgd $(INSTALLPREFIX)/etc/sangoma_mgd.conf + + + diff --git a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.12.tmp b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.12.tmp new file mode 100644 index 0000000..974de84 --- /dev/null +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.12.tmp @@ -0,0 +1,5018 @@ +/********************************************************************************* + * sangoma_mgd.c -- Sangoma Media Gateway Daemon for Sangoma/Wanpipe Cards + * + * Copyright 05-08, Nenad Corbic + * Anthony Minessale II + * + * This program is free software, distributed under the terms of + * the GNU General Public License + * + * ============================================= + * v1.26 Nenad Corbic + * Jan 18 2007 + * Fixed hangup after invalid Answer or Ack Session + * Can cause double use of setup id - now fixed + * + * v1.25 Nenad Corbic + * Dec 31 2007 + * Removed UDP Resync it can cause skb_over errors. + * Moved RDNIS message to higher debug level + * + * v1.24 Nenad Corbic + * Nov 30 2007 + * Bug fix on return code on ALL ckt busy + * + * v1.23 Nenad Corbic + * Bug fix on socket open. Check for retun code >= 0 + * + * v1.22 Nenad Corbic + * Nov 27 2007 + * Updated DTMF Tx function + * Fixed - dtmf tx without voice + * Fxied - dtmf clipping. + * + * v1.21 Nenad Corbic + * Nov 25 2007 + * Major unit testing of each state + * Numerous bug fixes for non autoacm mode. + * Changed "Channel-Name" to tg/cic + * Added compile option WANPIPE_CHAN_NAME to change Asterisk channel + * name of chan_woomera.so. So one can use Dial(SS7/g1/${EXTE}) + * instead of WOOMERA (for example) + * + * v1.20 Nenad Corbic + * Added option for Auto ACM response mode. + * + * v1.19 Nenad Corbic + * Configurable DTMF + * Bug fix in release codes (all ckt busy) + * + * v1.18 Nenad Corbic + * Added new rel cause support based on + * digits instead of strings. + * + * v1.17 Nenad Corbic + * Added session support + * + * v1.16 Nenad Corbic + * Added hwec disable on loop ccr + * + * v1.15 Nenad Corbic + * Updated DTMF Locking + * Added delay between digits + * + * v1.14 Nenad Corbic + * Updated DTMF Library + * Fixed DTMF synchronization + * + * v1.13 Nenad Corbic + * Woomera OPAL Dialect + * Added Congestion control + * Added SCTP + * Added priority ISUP queue + * Fixed presentation + * + * v1.12 Nenad Corbic + * Fixed CCR + * Removed socket shutdown on end call. + * Let Media thread shutodwn sockets. + * + * v1.11 Nenad Corbic + * Fixed Remote asterisk/woomera connection + * Increased socket timeouts + * + * v1.10 Nenad Corbic + * Added Woomera OPAL dialect. + * Start montor thread in priority + * + * v1.9 Nenad Corbic + * Added Loop mode for ccr + * Added remote debug enable + * Fixed syslog logging. + * + * v1.8 Nenad Corbic + * Added a ccr loop mode for each channel. + * Boost can set any channel in loop mode + * + * v1.7 Nenad Corbic + * Pass trunk group number to incoming call + * chan woomera will use it to append to context + * name. Added presentation feature. + * + * v1.6 Nenad Corbic + * Use only ALAW and MLAW not SLIN. + * This reduces the load quite a bit. + * Send out ALAW/ULAW format on HELLO message. + * RxTx Gain is done now in chan_woomera. + * + * v1.5 Nenad Corbic + * Bug fix in START_NACK_ACK handling. + * When we receive START_NACK we must alwasy pull tank before + * we send out NACK_ACK this way we will not try to send NACK + * ourself. + *********************************************************************************/ + +#include "sangoma_mgd.h" +#include "q931_cause.h" + + +#define USE_SYSLOG 1 +#define CODEC_LAW_DEFAULT 1 + +#ifdef CODEC_LAW_DEFAULT +static uint32_t codec_sample=8; +#else +static uint32_t codec_sample=16; +#endif + +static char ps_progname[]="sangoma_mgd"; + +static struct woomera_interface woomera_dead_dev; + +#if 0 +#define DOTRACE +#endif + + +#define SMG_VERSION "v1.26" + +/* enable early media */ +#if 1 +#define WOOMERA_EARLY_MEDIA 1 +#endif + + +#define SMG_DTMF_ON 60 +#define SMG_DTMF_OFF 10 +#define SMG_DTMF_RATE 8000 + +#if 0 +#define MEDIA_SOCK_SHUTDOWN 1 +#endif + +#ifdef DOTRACE +static int tc = 0; +#endif + +#if 0 +#warning "NENAD: HPTDM API" +#define WP_HPTDM_API 1 +#else +#undef WP_HPTDM_API +#endif + +#ifdef WP_HPTDM_API +hp_tdm_api_span_t *hptdmspan[WOOMERA_MAX_SPAN]; +#endif + +#define SMG_CALLING_NAME 1 + +const char WELCOME_TEXT[] = +"================================================================================\n" +"Sangoma Media Gateway Daemon v1.26 \n" +"TDM Signal Media Gateway for Sangoma/Wanpipe Cards\n" +"Copyright 2005, 2006, 2007 \n" +"Nenad Corbic , Anthony Minessale II \n" +"This program is free software, distributed under the terms of\n" +"the GNU General Public License\n" +"================================================================================\n" +""; + + +static int master_reset=0; + +static int coredump=1; +static int autoacm=1; + +static int launch_media_tdm_thread(struct woomera_interface *woomera); +static int launch_woomera_thread(struct woomera_interface *woomera); +static struct woomera_interface *alloc_woomera(void); + +q931_cause_to_str_array_t q931_cause_to_str_array[255]; + + +#if 0 +static uint32_t string_to_release(char *code) +{ + if (code) { + if (!strcasecmp(code, "CHANUNAVAIL")) { + return SIGBOOST_RELEASE_CAUSE_NOANSWER; + } + + if (!strcasecmp(code, "INVALID")) { + return SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST; + } + + if (!strcasecmp(code, "ERROR")) { + return SIGBOOST_RELEASE_CAUSE_UNDEFINED; + } + + if (!strcasecmp(code, "CONGESTION")) { + //return SIGBOOST_RELEASE_CAUSE_BUSY; + return SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST; + } + + if (!strcasecmp(code, "BUSY")) { + return SIGBOOST_RELEASE_CAUSE_BUSY; + } + + if (!strcasecmp(code, "NOANSWER")) { + return SIGBOOST_RELEASE_CAUSE_NOANSWER; + } + + if (!strcasecmp(code, "ANSWER")) { + return SIGBOOST_RELEASE_CAUSE_NORMAL; + } + + if (!strcasecmp(code, "CANCEL")) { + return SIGBOOST_RELEASE_CAUSE_BUSY; + } + + if (!strcasecmp(code, "UNKNOWN")) { + return SIGBOOST_RELEASE_CAUSE_UNDEFINED; + } + + } + return SIGBOOST_RELEASE_CAUSE_NORMAL; +} + +static char * release_to_string(uint32_t rel_cause) +{ + switch (rel_cause) { + + case SIGBOOST_RELEASE_CAUSE_UNDEFINED: + return "UNKNOWN"; + case SIGBOOST_RELEASE_CAUSE_NORMAL: + return "NORMAL"; + case SIGBOOST_RELEASE_CAUSE_BUSY: + return "BUSY"; + case SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST: + return "CHANUNAVAIL"; + case SIGBOOST_RELEASE_CAUSE_CIRCUIT_RESET: + return "CANCEL"; + case SIGBOOST_RELEASE_CAUSE_NOANSWER: + return "NOANSWER"; + case SIGBOOST_CALL_SETUP_NACK_CKT_START_TIMEOUT: + return "TIMEOUT"; + case SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY: + return "CONGESTION"; + case SIGBOOST_CALL_SETUP_NACK_CALLED_NUM_TOO_BIG: + return "ERROR"; + case SIGBOOST_CALL_SETUP_NACK_CALLING_NUM_TOO_BIG: + return "ERROR"; + case SIGBOOST_CALL_SETUP_NACK_CALLED_NUM_TOO_SMALL: + return "ERROR"; + case SIGBOOST_CALL_SETUP_NACK_CALLING_NUM_TOO_SMALL: + return "ERROR"; + } + + return "NORMAL"; +} +#endif + + + +void __log_printf(int level, FILE *fp, char *file, const char *func, int line, char *fmt, ...) +{ + char *data; + int ret = 0; + va_list ap; + + if (socket < 0) { + return; + } + + if (level && level > server.debug) { + return; + } + + va_start(ap, fmt); +#ifdef SOLARIS + data = (char *) malloc(2048); + vsnprintf(data, 2048, fmt, ap); +#else + ret = vasprintf(&data, fmt, ap); +#endif + va_end(ap); + if (ret == -1) { + fprintf(stderr, "Memory Error\n"); + } else { + char date[80] = ""; + struct tm now; + time_t epoch; + + if (time(&epoch) && localtime_r(&epoch, &now)) { + strftime(date, sizeof(date), "%Y-%m-%d %T", &now); + } + +#ifdef USE_SYSLOG + syslog(LOG_DEBUG | LOG_LOCAL2, data); +#else + fprintf(fp, "[%d] %s %s:%d %s() %s", getpid(), date, file, line, func, data); +#endif + free(data); + } +#ifndef USE_SYSLOG + fflush(fp); +#endif +} + + + + +static int isup_exec_command(int span, int chan, int id, int cmd, int cause) +{ + call_signal_event_t oevent; + int retry=5; + + call_signal_event_init(&oevent, cmd, chan, span); + oevent.release_cause = cause; + + if (id >= 0) { + oevent.call_setup_id = id; + } +isup_exec_cmd_retry: + if (call_signal_connection_write(&server.mcon, &oevent) <= 0){ + + --retry; + if (retry <= 0) { + log_printf(0, server.log, + "Critical System Error: Failed to tx on ISUP socket: %s\n", + strerror(errno)); + return -1; + } else { + log_printf(0, server.log, + "System Warning: Failed to tx on ISUP socket: %s :retry %i\n", + strerror(errno),retry); + } + + goto isup_exec_cmd_retry; + } + + return 0; +} + +static int socket_printf(int socket, char *fmt, ...) +{ + char *data; + int ret = 0; + va_list ap; + + if (socket < 0) { + return -1; + } + + va_start(ap, fmt); +#ifdef SOLARIS + data = (char *) malloc(2048); + vsnprintf(data, 2048, fmt, ap); +#else + ret = vasprintf(&data, fmt, ap); +#endif + va_end(ap); + if (ret == -1) { + fprintf(stderr, "Memory Error\n"); + log_printf(0, server.log, "Crtical ERROR: Memory Error!\n"); + } else { + int err; + int len = strlen(data); + err=send(socket, data, strlen(data), 0); + if (err != strlen(data)) { + log_printf(2, server.log, "ERROR: Failed to send data to woomera socket(%i): err=%i len=%d %s\n", + socket,err,len,strerror(errno)); + ret = err; + } else { + ret = 0; + } + + free(data); + } + + return ret; +} + + + +static int woomera_next_pair(struct woomera_config *cfg, char **var, char **val) +{ + int ret = 0; + char *p, *end; + + *var = *val = NULL; + + for(;;) { + cfg->lineno++; + + if (!fgets(cfg->buf, sizeof(cfg->buf), cfg->file)) { + ret = 0; + break; + } + + *var = cfg->buf; + + if (**var == '[' && (end = strchr(*var, ']'))) { + *end = '\0'; + (*var)++; + strncpy(cfg->category, *var, sizeof(cfg->category) - 1); + continue; + } + + if (**var == '#' || **var == '\n' || **var == '\r') { + continue; + } + + if ((end = strchr(*var, '#'))) { + *end = '\0'; + end--; + } else if ((end = strchr(*var, '\n'))) { + if (*end - 1 == '\r') { + end--; + } + *end = '\0'; + } + + p = *var; + while ((*p == ' ' || *p == '\t') && p != end) { + *p = '\0'; + p++; + } + *var = p; + + if (!(*val = strchr(*var, '='))) { + ret = -1; + log_printf(0, server.log, "Invalid syntax on %s: line %d\n", cfg->path, cfg->lineno); + continue; + } else { + p = *val - 1; + *(*val) = '\0'; + (*val)++; + if (*(*val) == '>') { + *(*val) = '\0'; + (*val)++; + } + + while ((*p == ' ' || *p == '\t') && p != *var) { + *p = '\0'; + p--; + } + + p = *val; + while ((*p == ' ' || *p == '\t') && p != end) { + *p = '\0'; + p++; + } + *val = p; + ret = 1; + break; + } + } + + return ret; + +} + + +#if 0 +static void woomera_set_span_chan(struct woomera_interface *woomera, int span, int chan) +{ + pthread_mutex_lock(&woomera->vlock); + woomera->span = span; + woomera->chan = chan; + pthread_mutex_unlock(&woomera->vlock); + +} +#endif + + +static struct woomera_event *new_woomera_event_printf(struct woomera_event *ebuf, char *fmt, ...) +{ + struct woomera_event *event = NULL; + int ret = 0; + va_list ap; + + if (ebuf) { + event = ebuf; + } else if (!(event = new_woomera_event())) { + log_printf(0, server.log, "Memory Error queuing event!\n"); + return NULL; + } else { + return NULL; + } + + va_start(ap, fmt); +#ifdef SOLARIS + event->data = (char *) malloc(2048); + vsnprintf(event->data, 2048, fmt, ap); +#else + ret = vasprintf(&event->data, fmt, ap); +#endif + va_end(ap); + if (ret == -1) { + log_printf(0, server.log, "Memory Error queuing event!\n"); + destroy_woomera_event(&event, EVENT_FREE_DATA); + return NULL; + } + + return event; + +} + +static struct woomera_event *woomera_clone_event(struct woomera_event *event) +{ + struct woomera_event *clone; + + if (!(clone = new_woomera_event())) { + return NULL; + } + + memcpy(clone, event, sizeof(*event)); + clone->next = NULL; + clone->data = strdup(event->data); + + return clone; +} + +static void enqueue_event(struct woomera_interface *woomera, + struct woomera_event *event, + event_args free_data) +{ + struct woomera_event *ptr, *clone = NULL; + + assert(woomera != NULL); + assert(event != NULL); + + if (!(clone = woomera_clone_event(event))) { + log_printf(0, server.log, "Error Cloning Event\n"); + return; + } + + pthread_mutex_lock(&woomera->queue_lock); + + for (ptr = woomera->event_queue; ptr && ptr->next ; ptr = ptr->next); + + if (ptr) { + ptr->next = clone; + } else { + woomera->event_queue = clone; + } + + pthread_mutex_unlock(&woomera->queue_lock); + + woomera_set_flag(woomera, WFLAG_EVENT); + + if (free_data && event->data) { + /* The event has been duplicated, the original data + * should be freed */ + free(event->data); + event->data=NULL; + } +} + +static char *dequeue_event(struct woomera_interface *woomera) +{ + struct woomera_event *event; + char *data = NULL; + + if (!woomera) { + return NULL; + } + + pthread_mutex_lock(&woomera->queue_lock); + if (woomera->event_queue) { + event = woomera->event_queue; + woomera->event_queue = event->next; + data = event->data; + pthread_mutex_unlock(&woomera->queue_lock); + + destroy_woomera_event(&event, EVENT_KEEP_DATA); + return data; + } + pthread_mutex_unlock(&woomera->queue_lock); + + return data; +} + + +static int enqueue_event_on_listeners(struct woomera_event *event) +{ + struct woomera_listener *ptr; + int x = 0; + + assert(event != NULL); + + pthread_mutex_lock(&server.listen_lock); + for (ptr = server.listeners ; ptr ; ptr = ptr->next) { + enqueue_event(ptr->woomera, event, EVENT_KEEP_DATA); + x++; + } + pthread_mutex_unlock(&server.listen_lock); + + return x; +} + + +static void del_listener(struct woomera_interface *woomera) +{ + struct woomera_listener *ptr, *last = NULL; + + pthread_mutex_lock(&server.listen_lock); + for (ptr = server.listeners ; ptr ; ptr = ptr->next) { + if (ptr->woomera == woomera) { + if (last) { + last->next = ptr->next; + } else { + server.listeners = ptr->next; + } + free(ptr); + break; + } + last = ptr; + } + pthread_mutex_unlock(&server.listen_lock); +} + +static void add_listener(struct woomera_interface *woomera) +{ + struct woomera_listener *new; + + pthread_mutex_lock(&server.listen_lock); + + if ((new = malloc(sizeof(*new)))) { + memset(new, 0, sizeof(*new)); + new->woomera = woomera; + new->next = server.listeners; + server.listeners = new; + } else { + log_printf(0, server.log, "Memory Error adding listener!\n"); + } + + pthread_mutex_unlock(&server.listen_lock); +} + + + +static int wanpipe_send_dtmf(struct woomera_interface *woomera, char *digits) +{ + struct media_session *ms = woomera_get_ms(woomera); + char *cur = NULL; + int wrote = 0; + int err; + + if (!ms) { + return -EINVAL; + } + + if (!ms->dtmf_buffer) { + log_printf(3, woomera->log, "Allocate DTMF Buffer...."); + + err=switch_buffer_create_dynamic(&ms->dtmf_buffer, 1024, server.dtmf_size, 0); + + if (err != 0) { + log_printf(0, woomera->log, "Failed to allocate DTMF Buffer!\n"); + return -ENOMEM; + } else { + log_printf(3, woomera->log, "SUCCESS!\n"); + } + + } + + log_printf(3, woomera->log, "Sending DTMF %s\n",digits); + for (cur = digits; *cur; cur++) { + if ((wrote = teletone_mux_tones(&ms->tone_session, + &ms->tone_session.TONES[(int)*cur]))) { + + pthread_mutex_lock(&woomera->dtmf_lock); + + err=switch_buffer_write(ms->dtmf_buffer, ms->tone_session.buffer, wrote * 2); + + pthread_mutex_unlock(&woomera->dtmf_lock); + + log_printf(3, woomera->log, "Sending DTMF %s Wrote=%i (err=%i)\n", + digits,wrote*2,err); + } else { + log_printf(0, woomera->log, "Error: Sending DTMF %s (err=%i)\n", + digits,wrote); + } + } + + ms->skip_read_frames = 200; + return 0; +} + +static struct woomera_interface *alloc_woomera(void) +{ + struct woomera_interface *woomera = NULL; + + if ((woomera = malloc(sizeof(struct woomera_interface)))) { + + memset(woomera, 0, sizeof(struct woomera_interface)); + + woomera->chan = -1; + woomera->span = -1; + woomera->log = server.log; + woomera->debug = server.debug; + woomera->call_id = 1; + woomera->event_queue = NULL; + woomera->q931_rel_cause_topbx=SIGBOOST_RELEASE_CAUSE_NORMAL; + woomera->q931_rel_cause_tosig=SIGBOOST_RELEASE_CAUSE_NORMAL; + + woomera_set_interface(woomera, "w-1g-1"); + + + + } + + return woomera; + +} + + +static struct woomera_interface *new_woomera_interface(int socket, struct sockaddr_in *sock_addr, int len) +{ + struct woomera_interface *woomera = NULL; + + if (socket < 0) { + log_printf(0, server.log, "Critical: Invalid Socket on new interface!\n"); + return NULL; + } + + if ((woomera = alloc_woomera())) { + if (socket >= 0) { + no_nagle(socket); + woomera->socket = socket; + } + + if (sock_addr && len) { + memcpy(&woomera->addr, sock_addr, len); + } + } + + return woomera; + +} + +static char *woomera_message_header(struct woomera_message *wmsg, char *key) +{ + int x = 0; + char *value = NULL; + + for (x = 0 ; x < wmsg->last ; x++) { + if (!strcasecmp(wmsg->names[x], key)) { + value = wmsg->values[x]; + break; + } + } + + return value; +} + + +#if 1 + +static int waitfor_socket(int fd, int timeout, int flags) +{ + struct pollfd pfds[1]; + int res; + + memset(&pfds[0], 0, sizeof(pfds[0])); + pfds[0].fd = fd; + pfds[0].events = flags; + res = poll(pfds, 1, timeout); + + if (res > 0) { + if(pfds[0].revents & POLLIN) { + res = 1; + } else if ((pfds[0].revents & POLLERR)) { + res = -1; + } else if ((pfds[0].revents & POLLNVAL)) { + res = -2; +#if 0 + log_printf(0, server.log,"System Warning: Poll Event NVAL (0x%X) (fd=%i)!\n", + pfds[0].revents, fd); +#endif + } else { +#if 0 + log_printf(0, server.log,"System Error: Poll Event Error no event (0x%X) (fd=%i)!\n", + pfds[0].revents,fd); +#endif + res = -1; + } + } + + return res; +} + + +static int waitfor_tx_socket(int fd, int timeout, int flags) +{ + struct pollfd pfds[1]; + int res; + + memset(&pfds[0], 0, sizeof(pfds[0])); + pfds[0].fd = fd; + pfds[0].events = flags; + res = poll(pfds, 1, timeout); + + if (res > 0) { + if (pfds[0].revents & POLLOUT) { + res = 1; + } else if ((pfds[0].revents & POLLERR)) { + res = -1; + } else if ((pfds[0].revents & POLLNVAL)) { + res = -2; +#if 0 + log_printf(0, server.log,"System Warning: Poll Event NVAL (0x%X) (fd=%i)!\n", + pfds[0].revents, fd); +#endif + } else { +#if 0 + log_printf(0, server.log,"System Error: Poll Event Error no event (0x%X) (fd=%i)!\n", + pfds[0].revents,fd); +#endif + res = -1; + } + } + + return res; +} + + +#else + +static int waitfor_socket(int fd, int timeout, int flags) +{ + struct pollfd pfds[1]; + int res; + int errflags = (POLLERR | POLLHUP | POLLNVAL); + + memset(&pfds[0], 0, sizeof(pfds[0])); + pfds[0].fd = fd; + pfds[0].events = flags | errflags; + res = poll(pfds, 1, timeout); + + if (res > 0) { + if(pfds[0].revents & POLLIN) { + res = 1; + } else if ((pfds[0].revents & errflags)) { + res = -1; + } else { +#if 0 + log_printf(0, server.log,"System Error: Poll Event Error no event (0x%X)!\n", + pfds[0].revents); +#endif + res = -1; + } + } + + return res; +} + +#endif + +#if 1 +static int waitfor_2sockets(int fda, int fdb, char *a, char *b, int timeout) +{ + struct pollfd pfds[2]; + int res = 0; + int errflags = (POLLERR | POLLHUP | POLLNVAL); + + if (fda < 0 || fdb < 0) { + return -1; + } + + *a=0; + *b=0; + + memset(pfds, 0, sizeof(pfds)); + pfds[0].fd = fda; + pfds[1].fd = fdb; + pfds[0].events = POLLIN | errflags; + pfds[1].events = POLLIN | errflags; + if ((res = poll(pfds, 2, timeout)) > 0) { + res = 1; + if ((pfds[0].revents & errflags) || (pfds[1].revents & errflags)) { + res = -1; + } else { + if ((pfds[0].revents & POLLIN)) { + *a=1; + res++; + } + if ((pfds[1].revents & POLLIN)) { + *b=1; + res++; + } + } + + if (res == 1) { + /* No event found what to do */ + res=-1; + } + } + + return res; +} +#endif + + +static struct media_session *media_session_new(struct woomera_interface *woomera) +{ + struct media_session *ms = NULL; + int x; + char *p; + int span,chan; + + span=woomera->span; + chan=woomera->chan; + + log_printf(2, server.log,"Starting new MEDIA session [%s] [%s]\n", + woomera->interface,woomera->raw?woomera->raw:"N/A"); + + if ((ms = malloc(sizeof(struct media_session)))) { + memset(ms, 0, sizeof(struct media_session)); + + if (woomera->loop_tdm != 1) { + for(x = 0; x < strlen(woomera->raw) ; x++) { + if (woomera->raw[x] == ':') { + break; + } + if (woomera->raw[x] == '/') { + break; + } + } + + ms->ip = strndup(woomera->raw, x); + time(&ms->started); + p = woomera->raw + (x+1); + ms->port = atoi(p); + } + + time(&ms->started); + woomera_set_ms(woomera,ms); + ms->woomera = woomera; + + /* Setup artificial DTMF stuff */ + memset(&ms->tone_session, 0, sizeof(ms->tone_session)); + if (teletone_init_session(&ms->tone_session, 0, NULL, NULL)) { + log_printf(0, server.log, "ERROR: Failed to initialize TONE [w%ig%i]!\n", + span+1,chan+1); + } + + ms->tone_session.rate = SMG_DTMF_RATE; + ms->tone_session.duration = server.dtmf_on * (ms->tone_session.rate / 1000); + ms->tone_session.wait = server.dtmf_off * (ms->tone_session.rate / 1000); + + teletone_dtmf_detect_init (&ms->dtmf_detect, SMG_DTMF_RATE); + + } else { + log_printf(0, server.log, "ERROR: Memory Alloc Failed [w%ig%i]!\n", + span+1,chan+1); + } + + return ms; +} + +static void media_session_free(struct media_session *ms) +{ + if (ms->ip) { + free(ms->ip); + } + + teletone_destroy_session(&ms->tone_session); + switch_buffer_destroy(&ms->dtmf_buffer); + + ms->woomera = NULL; + + free(ms); +} + + +static int create_udp_socket(struct media_session *ms, char *local_ip, int local_port, char *ip, int port) +{ + int rc; + struct hostent *result, *local_result; + char buf[512], local_buf[512]; + int err = 0; + + log_printf(5,server.log,"LocalIP %s:%d IP %s:%d \n",local_ip, local_port, ip, port); + + memset(&ms->remote_hp, 0, sizeof(ms->remote_hp)); + memset(&ms->local_hp, 0, sizeof(ms->local_hp)); + if ((ms->socket = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) { + gethostbyname_r(ip, &ms->remote_hp, buf, sizeof(buf), &result, &err); + gethostbyname_r(local_ip, &ms->local_hp, local_buf, sizeof(local_buf), &local_result, &err); + if (result && local_result) { + ms->remote_addr.sin_family = ms->remote_hp.h_addrtype; + memcpy((char *) &ms->remote_addr.sin_addr.s_addr, ms->remote_hp.h_addr_list[0], ms->remote_hp.h_length); + ms->remote_addr.sin_port = htons(port); + + ms->local_addr.sin_family = ms->local_hp.h_addrtype; + memcpy((char *) &ms->local_addr.sin_addr.s_addr, ms->local_hp.h_addr_list[0], ms->local_hp.h_length); + ms->local_addr.sin_port = htons(local_port); + + rc = bind(ms->socket, (struct sockaddr *) &ms->local_addr, sizeof(ms->local_addr)); + if (rc < 0) { + close(ms->socket); + ms->socket = -1; + + log_printf(5,server.log, + "Failed to bind LocalIP %s:%d IP %s:%d (%s)\n", + local_ip, local_port, ip, port,strerror(errno)); + } + + /* OK */ + + } else { + log_printf(0,server.log, + "Failed to get hostbyname LocalIP %s:%d IP %s:%d (%s)\n", + local_ip, local_port, ip, port,strerror(errno)); + } + } else { + log_printf(0,server.log, + "Failed to create/allocate UDP socket\n"); + } + + return ms->socket; +} + +static int next_media_port(void) +{ + int port; + + pthread_mutex_lock(&server.media_udp_port_lock); + port = ++server.next_media_port; + if (port > WOOMERA_MAX_MEDIA_PORT) { + server.next_media_port = WOOMERA_MIN_MEDIA_PORT; + port = WOOMERA_MIN_MEDIA_PORT; + } + pthread_mutex_unlock(&server.media_udp_port_lock); + + return port; +} + + + +static int woomera_dtmf_transmit(struct media_session *ms, int mtu) +{ + struct woomera_interface *woomera = ms->woomera; + int bread; + unsigned char dtmf[1024]; + unsigned char dtmf_law[1024]; + sangoma_api_hdr_t hdrframe; + int i; + int slin_len = mtu*2; + short *data; + int used; + int res; + int err; + int txdtmf=0; + memset(&hdrframe,0,sizeof(hdrframe)); + + if (!ms->dtmf_buffer) { + return -1; + } + + for (;;) { + + if ((used=switch_buffer_inuse(ms->dtmf_buffer)) <= 0) { + break; + } + + res = waitfor_tx_socket(ms->sangoma_sock, -1, POLLERR | POLLOUT); + if (res <= 0) { + break; + } + +#ifdef CODEC_LAW_DEFAULT + + pthread_mutex_lock(&woomera->dtmf_lock); + if ((used=switch_buffer_inuse(ms->dtmf_buffer)) <= 0) { + pthread_mutex_unlock(&woomera->dtmf_lock); + break; + } + + bread = switch_buffer_read(ms->dtmf_buffer, dtmf, slin_len); + pthread_mutex_unlock(&woomera->dtmf_lock); + + if (bread <= 0) { + break; + } + + log_printf(3,woomera->log,"%s: Write DTMF Got %d bytes MTU=%i Coding=%i Used=%i\n", + woomera->interface,bread,mtu,ms->hw_coding,used); + + data=(short*)dtmf; + for (i=0;ihw_coding) { + /* ALAW */ + dtmf_law[i] = linear_to_alaw((int)data[i]); + } else { + /* ULAW */ + dtmf_law[i] = linear_to_ulaw((int)data[i]); + } + } + + err=sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + dtmf_law, mtu, 0); + + if (err != mtu) { + log_printf(0, woomera->log, "Error: Failed to TX to TDM API on DTMF (err=%i mtu=%i)!\n",err,mtu); + } + + txdtmf++; + ms->skip_write_frames++; +#else +... + pthread_mutex_lock(&woomera->dtmf_lock); + bread = switch_buffer_read(ms->dtmf_buffer, dtmf, mtu); + pthread_mutex_unlock(&woomera->dtmf_lock); + + log_printf(3,woomera->log,"%s: Write DTMF Got %d bytes\n", + woomera->interface,bread); + + sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + dtmf, mtu, 0); + txdtmf++; + ms->skip_write_frames++; +#endif + + } + + if (txdtmf) { + return 0; + } else { + return -1; + } +} + +static void media_loop_run(struct media_session *ms) +{ + struct woomera_interface *woomera = ms->woomera; + int sangoma_frame_len = 160; + int errs=0; + int res=0; + wanpipe_tdm_api_t tdm_api; + unsigned char circuit_frame[1024]; + char filename[100]; + FILE *filed=NULL; + int loops=0; + + sangoma_api_hdr_t hdrframe; + memset(&hdrframe,0,sizeof(hdrframe)); + memset(circuit_frame,0,sizeof(circuit_frame)); + + ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1); + + log_printf(1, server.log, "Media Loop Started %s fd=%i\n", + woomera->interface,ms->sangoma_sock); + + if (ms->sangoma_sock < 0) { + log_printf(0, server.log, "WANPIPE MEDIA Socket Error (%s) if=[%s] [w%ig%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); + errs++; + } else { + + + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_NONE) < 0 ) { + errs++; + } + + if (sangoma_tdm_flush_bufs(ms->sangoma_sock, &tdm_api)) { + errs++; + } + + if (sangoma_tdm_set_usr_period(ms->sangoma_sock, &tdm_api, 20) < 0 ) { + errs++; + } + + sangoma_frame_len = sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + sangoma_tdm_disable_hwec(ms->sangoma_sock,&tdm_api); + + } + + if (errs) { + + log_printf(0, server.log, "Media Loop: failed to open tdm device %s\n", + woomera->interface); + return; + } + + if (server.loop_trace) { + sprintf(filename,"/smg/w%ig%i-loop.trace",woomera->span+1,woomera->chan+1); + unlink(filename); + filed = safe_fopen(filename, "w"); + } + + while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + ((res = waitfor_socket(ms->sangoma_sock, 1000, POLLERR | POLLIN)) >= -2)) { + + if (res == 0) { + //log_printf(4, server.log, "%s: TDM UDP Timeout !!!\n", + // woomera->interface); + /* NENAD Timeout thus just continue */ + continue; + } + + if (res == -2) { + close_socket(&ms->sangoma_sock); + ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1); + log_printf(0, server.log, "Media Loop Restart %s\n", + woomera->interface); + continue; + } + + if (res < 0 ){ + log_printf(0, server.log, "Media Loop Socket error %s\n", + woomera->interface); + break; + } + + res = sangoma_readmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + sizeof(circuit_frame), 0); + if (res < 0) { + log_printf(0, server.log, "TDM Loop ReadMsg Error: %s\n", + strerror(errno), woomera->interface); + break; + } + + if (server.loop_trace && filed != NULL) { + int i; + for (i=0;isangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + res, 0); + + res=0; + + loops++; + } + + + if (res < 0) { + log_printf(2, server.log, "Media Loop: socket error %s (fd=%i)!\n", + woomera->interface, ms->sangoma_sock); + } + + + if (server.loop_trace && filed != NULL) { + fclose(filed); + } + + sangoma_tdm_enable_hwec(ms->sangoma_sock,&tdm_api); + + sleep(1); + + close_socket(&ms->sangoma_sock); + + log_printf(1, server.log, "Media Loop Finished %s Master=%i MediaEnd=%i Loops=%i\n", + woomera->interface, + woomera_test_flag(&server.master_connection, WFLAG_RUNNING), + woomera_test_flag(woomera, WFLAG_MEDIA_END),loops); + + return; + +} + +#ifdef WP_HPTDM_API +static int media_rx_ready(void *p, unsigned char *data, int len) +{ + struct media_session *ms = (struct media_session *)p; + + if (ms->udp_sock < 0) { + return -1; + } + + return sendto(ms->udp_sock, + data,len, 0, + (struct sockaddr *) &ms->remote_addr, + sizeof(ms->remote_addr)); + + +} +#endif + +static void *media_thread_run(void *obj) +{ + struct media_session *ms = obj; + struct woomera_interface *woomera = ms->woomera; + int sangoma_frame_len = 160; + int local_port, x = 0, errs = 0, res = 0, packet_len = 0; + //int udp_cnt=0; + struct woomera_event wevent; + wanpipe_tdm_api_t tdm_api; + FILE *tx_fd=NULL; + int sock_timeout=200; + + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || + !woomera->interface || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(2, server.log, + "MEDIA session for [%s] Cancelled! (ptr=%p)\n", + woomera->interface,woomera); + /* In this case the call will be closed via woomera_thread_run + * function. And the process table will be cleard there */ + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + media_session_free(ms); + pthread_exit(NULL); + return NULL; + } + + + log_printf(2, server.log, "MEDIA session for [%s] started (ptr=%p loop=%i)\n", + woomera->interface,woomera,woomera->loop_tdm); + + if (woomera->loop_tdm) { + media_loop_run(ms); + ms->udp_sock=-1; + woomera_set_flag(woomera, WFLAG_HANGUP); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + goto media_thread_exit; + } + + for(x = 0; x < 1000 ; x++) { + local_port = next_media_port(); + if ((ms->udp_sock = create_udp_socket(ms, server.media_ip, local_port, ms->ip, ms->port)) > -1) { + break; + } + } + + if (ms->udp_sock < 0) { + log_printf(0, server.log, "UDP Socket Error (%s) [%s] LocalPort=%d\n", + strerror(errno), woomera->interface, local_port); + + errs++; + } else { + +#ifdef WP_HPTDM_API + hp_tdm_api_span_t *span=hptdmspan[woomera->span+1]; + if (!span || !span->init) { + errs++; + } else { + hp_tdm_api_usr_callback_t usr_callback; + memset(&usr_callback,0,sizeof(usr_callback)); + usr_callback.p = ms; + usr_callback.rx_avail = media_rx_ready; + if (span->open_chan(span, &usr_callback, &ms->tdmchan,woomera->chan+1)) { + errs++; + } + } +#else + if ((ms->sangoma_sock = sangoma_create_socket_by_name(woomera->interface, NULL)) < 0) { + log_printf(0, server.log, "WANPIPE Socket Error (%s) if=[%s] [w%ig%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); + errs++; + } else { + +# ifdef CODEC_LAW_DEFAULT + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_NONE) < 0 ) { + errs++; + } +# else + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_SLINEAR) < 0 ) { + errs++; + } +# endif + if (sangoma_tdm_flush_bufs(ms->sangoma_sock, &tdm_api)) { + errs++; + } + + if (sangoma_tdm_set_usr_period(ms->sangoma_sock, &tdm_api, 20) < 0 ) { + errs++; + } + +# ifdef CODEC_LAW_DEFAULT +# ifdef LIBSANGOMA_GET_HWCODING + ms->hw_coding=sangoma_tdm_get_hw_coding(ms->sangoma_sock, &tdm_api); + if (ms->hw_coding < 0) { + errs++; + } +# else +# error "libsangoma missing hwcoding feature: not up to date!" +# endif +# endif + + sangoma_frame_len = sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + } +#endif + } + + + +#ifdef WP_HPTDM_API + /* No tdm thread */ +#else + if (!errs && + launch_media_tdm_thread(woomera)) { + errs++; + } +#endif + + if (!errs) { + + unsigned char udp_frame[4096]; + sangoma_api_hdr_t hdrframe; + memset(&hdrframe,0,sizeof(hdrframe)); + memset(udp_frame,0,sizeof(udp_frame)); +#ifdef DOTRACE + int fdin, fdout; + char path_in[512], path_out[512]; +#endif + + + +#if 0 + new_woomera_event_printf(&wevent, + "EVENT MEDIA %s AUDIO%s" + "Raw-Audio: %s:%d%s" + "Call-ID: %s%s" + "Raw-Format: %s%s" + , + woomera->interface, + WOOMERA_LINE_SEPERATOR, + server.media_ip, + local_port, + WOOMERA_LINE_SEPERATOR, + woomera->interface, + WOOMERA_LINE_SEPERATOR, + ms->hw_coding ?"ALAW":"ULAW", + WOOMERA_RECORD_SEPERATOR + ); +#else + new_woomera_event_printf(&wevent, + "EVENT MEDIA %s AUDIO%s" + "Unique-Call-Id: %s%s" + "Raw-Audio: %s:%d%s" + "Call-ID: %s%s" + "Raw-Format: PCM-16%s" + , + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + server.media_ip, + local_port, + WOOMERA_LINE_SEPERATOR, + woomera->interface, + WOOMERA_LINE_SEPERATOR, + WOOMERA_RECORD_SEPERATOR + ); +#endif + + + enqueue_event(woomera, &wevent, EVENT_FREE_DATA); + +#ifdef DOTRACE + sprintf(path_in, "/tmp/debug-in.%d.raw", tc); + sprintf(path_out, "/tmp/debug-out.%d.raw", tc++); + fdin = open(path_in, O_WRONLY | O_CREAT, O_TRUNC, 0600); + fdout = open(path_out, O_WRONLY | O_CREAT, O_TRUNC, 0600); +#endif + + if (server.out_tx_test) { + tx_fd=fopen("/smg/sound.raw","rb"); + if (!tx_fd){ + log_printf(0,server.log, "FAILED TO OPEN Sound file!\n"); + } + } + + + while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + !woomera_test_flag(woomera, WFLAG_HANGUP) && + (res = waitfor_socket(ms->udp_sock, sock_timeout, POLLERR | POLLIN)) >= 0) { + + unsigned int fromlen = sizeof(struct sockaddr_in); + + + if (res == 0) { + + if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) { + sock_timeout=(sangoma_frame_len/codec_sample); + } else { + sock_timeout=200; + } + + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + } + + log_printf(4, server.log, "%s: UDP Sock Timeout !!!\n", + woomera->interface); + /* NENAD Timeout thus just continue */ + continue; + } + + if ((packet_len = recvfrom(ms->udp_sock, udp_frame, sizeof(udp_frame), + MSG_DONTWAIT, (struct sockaddr *) &ms->local_addr, &fromlen)) < 1) { + log_printf(2, server.log, "UDP Recv Error: %s\n",strerror(errno)); + break; + } + +#if 0 + log_printf(6, server.log, "%s: UDP Receive %i !!!\n", + woomera->interface,packet_len); +#endif + + if (packet_len > 0) { + +#if 0 +/* NC: This can cause skb_over panic must be retested */ + if (packet_len != sangoma_frame_len && ms->udp_sync_cnt <= 5) { + /* Assume that we will always receive SLINEAR here */ + sangoma_tdm_set_usr_period(ms->sangoma_sock, + &tdm_api, packet_len/codec_sample); + sangoma_frame_len = + sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + log_printf(3, server.log, + "%s: UDP TDM Period ReSync to Len=%i %ims (udp=%i) \n", + woomera->interface,sangoma_frame_len, + sangoma_frame_len/codec_sample,packet_len); + + + if (++ms->udp_sync_cnt >= 6) { + sangoma_tdm_set_usr_period(ms->sangoma_sock, + &tdm_api, 20); + sangoma_frame_len = + sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + log_printf(0, server.log, + "%s: UDP TDM Period Force ReSync to 20ms \n", + woomera->interface); + } + + } +#endif + if (!server.out_tx_test) { + + if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) { + sock_timeout=(sangoma_frame_len/codec_sample); + /* For sanity sake if we are doing the out test + * dont take any chances force tx udp data */ + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + } + continue; + } else { + sock_timeout=200; + } + + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + continue; + } + + } + + if (server.out_tx_test && tx_fd && + fread((void*)udp_frame, + sizeof(char), + packet_len,tx_fd) <= 0) { + + sangoma_get_full_cfg(ms->sangoma_sock,&tdm_api); + fclose(tx_fd); + tx_fd=NULL; + } + +#ifdef WP_HPTDM_API + if (ms->tdmchan->push) { + ms->tdmchan->push(ms->tdmchan,udp_frame,packet_len); + } +#else + sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + udp_frame, + packet_len, 0); +#endif + + } + +#if 0 + if (woomera->span == 1 && woomera->chan == 1) { + udp_cnt++; + if (udp_cnt && udp_cnt % 1000 == 0) { + log_printf(0, server.log, "%s: MEDIA UDP TX RX CNT %i %i\n", + woomera->interface,udp_cnt,packet_len); + } + } +#endif + } + + if (res < 0) { + log_printf(2, server.log, "Media Thread: socket error !\n"); + } + } + + + + new_woomera_event_printf(&wevent, + "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Start-Time: %ld%s" + "End-Time: %ld%s" + "Answer-Time: %ld%s" + "Call-ID: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + + woomera->session, + WOOMERA_LINE_SEPERATOR, + + time(&ms->started), + WOOMERA_LINE_SEPERATOR, + + time(NULL), + WOOMERA_LINE_SEPERATOR, + + time(&ms->answered), + WOOMERA_LINE_SEPERATOR, + + woomera->interface, + WOOMERA_LINE_SEPERATOR, + + q931_rel_to_str(woomera->q931_rel_cause_topbx), + WOOMERA_LINE_SEPERATOR, + + woomera->q931_rel_cause_topbx, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + +media_thread_exit: + + if (woomera_test_flag(woomera, WFLAG_MEDIA_TDM_RUNNING)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + while(woomera_test_flag(woomera, WFLAG_MEDIA_TDM_RUNNING)) { + usleep(1000); + sched_yield(); + } + } + + + close_socket(&ms->udp_sock); + close_socket(&ms->sangoma_sock); + + if (tx_fd){ + fclose(tx_fd); + tx_fd=NULL; + } + + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + + woomera_set_ms(woomera,NULL); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + + media_session_free(ms); + + log_printf(2, server.log, "MEDIA session for [%s] ended (ptr=%p)\n", + woomera->interface,woomera); + + + pthread_exit(NULL); + return NULL; +} + + + + +static void *media_tdm_thread_run(void *obj) +{ + struct media_session *ms = obj; + struct woomera_interface *woomera = ms->woomera; + int res = 0; + //int tdm_cnt=0; + //wanpipe_tdm_api_t tdm_api; + unsigned char circuit_frame[1024]; + sangoma_api_hdr_t hdrframe; + + memset(&hdrframe,0,sizeof(hdrframe)); + memset(circuit_frame,0,sizeof(circuit_frame)); + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || !woomera->interface) { + log_printf(2, server.log, "MEDIA TDM session for [%s] Cancelled! (ptr=%p)\n", + woomera->interface,woomera); + /* In this case the call will be closed via woomera_thread_run + * function. And the process table will be cleard there */ + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + pthread_exit(NULL); + return NULL; + } + + log_printf(2, server.log, "MEDIA TDM session for [%s] started (ptr=%p)\n", + woomera->interface,woomera); + + + while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + (res = waitfor_socket(ms->sangoma_sock, 1000, POLLERR | POLLIN)) >= -2) { + + if (res == 0) { + //log_printf(4, server.log, "%s: TDM UDP Timeout !!!\n", + // woomera->interface); + /* NENAD Timeout thus just continue */ + continue; + } else if (res == -2) { + close_socket(&ms->sangoma_sock); + ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1); + if (ms->sangoma_sock < 0) { + log_printf(0, server.log, "Media TDM Restart Failed%s\n", + woomera->interface); + break; + } + log_printf(0, server.log, "Media TDM Restart %s\n", + woomera->interface); + continue; + } else if (res < 0) { + log_printf(0, server.log, "Media TDM Sangoma Socket Error %s\n", + woomera->interface); + break; + } + + res = sangoma_readmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + sizeof(circuit_frame), 0); + if (res < 0) { + log_printf(0, server.log, "TDM ReadMsg Error: %s\n", strerror(errno)); + break; + } + + res = sendto(ms->udp_sock, + circuit_frame, + res, 0, + (struct sockaddr *) &ms->remote_addr, + sizeof(ms->remote_addr)); + + if (res < 0) { + log_printf(2, server.log, "UDP Sento Error: %s\n", strerror(errno)); + break; + } +#if 0 + if (woomera->span == 1 && woomera->chan == 1) { + tdm_cnt++; + if (tdm_cnt && tdm_cnt % 1000 == 0) { + log_printf(0, server.log, "%s: MEDIA TDM TX RX CNT %i %i\n", + woomera->interface,tdm_cnt,res); + } + } +#endif + } + + if (res < 0) { + log_printf(2, server.log, "Media TDM Thread: socket error !\n"); + } + + log_printf(2, server.log, "MEDIA TDM session for [%s] ended (ptr=%p)\n", + woomera->interface,woomera); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + + pthread_exit(NULL); + return NULL; + +} + + +/* This function must be called with process_lock + * because it modifies shared process_table */ + +static int launch_media_thread(struct woomera_interface *woomera) +{ + pthread_attr_t attr; + int result = -1; + struct media_session *ms; + + if ((ms = media_session_new(woomera))) { + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_MEDIA_RUNNING); + result = pthread_create(&ms->thread, &attr, media_thread_run, ms); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + media_session_free(woomera->ms); + + } + pthread_attr_destroy(&attr); + + } else { + log_printf(0, server.log, "Failed to start new media session\n"); + } + + return result; + +} + +static int launch_media_tdm_thread(struct woomera_interface *woomera) +{ + pthread_attr_t attr; + int result = -1; + struct media_session *ms = woomera_get_ms(woomera); + + if (!ms) { + return result; + } + + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + result = pthread_create(&ms->thread, &attr, media_tdm_thread_run, ms); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + + +static struct woomera_interface * launch_woomera_loop_thread(call_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + char callid[20]; + + sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + + if ((woomera = alloc_woomera())) { + + woomera->chan = event->chan; + woomera->span = event->span; + woomera->log = server.log; + woomera->debug = server.debug; + woomera->call_id = 1; + woomera->event_queue = NULL; + woomera->loop_tdm=1; + + } else { + log_printf(0, server.log, "Critical ERROR: memory/socket error\n"); + return NULL; + } + + woomera_set_interface(woomera,callid); + + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = woomera; + pthread_mutex_unlock(&server.process_lock); + + if (launch_woomera_thread(woomera)) { + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + free(woomera); + log_printf(0, server.log, "Critical ERROR: memory/socket error\n"); + return NULL; + } + + return woomera; +} + +static int woomera_message_parse(struct woomera_interface *woomera, struct woomera_message *wmsg, int timeout) +{ + char *cur, *cr, *next = NULL, *eor = NULL; + char buf[2048]; + int res = 0, bytes = 0, sanity = 0; + struct timeval started, ended; + int elapsed, loops = 0; + int failto = 0; + int packet = 0; + + memset(wmsg, 0, sizeof(*wmsg)); + + if (woomera->socket < 0 ) { + log_printf(2, woomera->log, WOOMERA_DEBUG_PREFIX "%s Invalid Socket! %d\n", + woomera->interface,woomera->socket); + return -1; + } + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(5, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MEDIA END or HANGUP !\n", + woomera->interface); + return -1; + } + + gettimeofday(&started, NULL); + memset(buf, 0, sizeof(buf)); + + if (timeout < 0) { + timeout = abs(timeout); + failto = 1; + } else if (timeout == 0) { + timeout = -1; + } + + + while (!(eor = strstr(buf, WOOMERA_RECORD_SEPERATOR))) { + if (sanity > 1000) { + log_printf(2, woomera->log, WOOMERA_DEBUG_PREFIX "%s Failed Sanity Check!\n[%s]\n\n", woomera->interface, buf); + return -1; + } + + if ((res = waitfor_socket(woomera->socket, 1000, POLLERR | POLLIN) > 0)) { + res = recv(woomera->socket, buf, sizeof(buf), MSG_PEEK); + + if (res > 1) { + packet++; + } + if (!strncmp(buf, WOOMERA_LINE_SEPERATOR, 2)) { + res = read(woomera->socket, buf, 2); + return 0; + } + if (res == 0) { + sanity++; + /* Looks Like it's time to go! */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(5, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MEDIA END or HANGUP \n", woomera->interface); + return -1; + } + ysleep(1000); + continue; + + } else if (res < 0) { + log_printf(3, woomera->log, WOOMERA_DEBUG_PREFIX + "%s error during packet retry (err=%i) Loops#%d (%s)\n", + woomera->interface, res, loops, + strerror(errno)); + return res; + } else if (loops) { + ysleep(100000); + } + } + + gettimeofday(&ended, NULL); + elapsed = (((ended.tv_sec * 1000) + ended.tv_usec / 1000) - ((started.tv_sec * 1000) + started.tv_usec / 1000)); + + if (res < 0) { + log_printf(2, woomera->log, WOOMERA_DEBUG_PREFIX "%s Bad RECV\n", + woomera->interface); + return res; + } else if (res == 0) { + sanity++; + /* Looks Like it's time to go! */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(5, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MEDIA END or HANGUP \n", woomera->interface); + return -1; + } + ysleep(1000); + continue; + } + + if (packet && loops > 150) { + log_printf(1, woomera->log, WOOMERA_DEBUG_PREFIX + "%s Timeout waiting for packet.\n", + woomera->interface); + return -1; + } + + if (timeout > 0 && (elapsed > timeout)) { + log_printf(1, woomera->log, WOOMERA_DEBUG_PREFIX + "%s Timeout [%d] reached\n", + woomera->interface, timeout); + return failto ? -1 : 0; + } + + if (woomera_test_flag(woomera, WFLAG_EVENT)) { + /* BRB! we have an Event to deliver....*/ + return 0; + } + + /* what're we still doing here? */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + !woomera_test_flag(woomera, WFLAG_RUNNING)) { + log_printf(2, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MASTER RUNNING or RUNNING!\n", woomera->interface); + return -1; + } + loops++; + } + + *eor = '\0'; + bytes = strlen(buf) + 4; + + memset(buf, 0, sizeof(buf)); + res = read(woomera->socket, buf, bytes); + next = buf; + + if (woomera->debug > 1) { + log_printf(3, woomera->log, "%s:WOOMERA RX MSG: %s\n",woomera->interface,buf); + + } + + while ((cur = next)) { + + if ((cr = strstr(cur, WOOMERA_LINE_SEPERATOR))) { + *cr = '\0'; + next = cr + (sizeof(WOOMERA_LINE_SEPERATOR) - 1); + if (!strcmp(next, WOOMERA_RECORD_SEPERATOR)) { + break; + } + } + if (!cur || !*cur) { + break; + } + + if (!wmsg->last) { + char *cmd, *id, *args; + woomera_set_flag(wmsg, MFLAG_EXISTS); + cmd = cur; + + if ((id = strchr(cmd, ' '))) { + *id = '\0'; + id++; + if ((args = strchr(id, ' '))) { + *args = '\0'; + args++; + strncpy(wmsg->command_args, args, sizeof(wmsg->command_args)-1); + } + strncpy(wmsg->callid, id, sizeof(wmsg->callid)-1); + } + + strncpy(wmsg->command, cmd, sizeof(wmsg->command)-1); + } else { + char *name, *val; + name = cur; + + if ((val = strchr(name, ':'))) { + *val = '\0'; + val++; + while (*val == ' ') { + *val = '\0'; + val++; + } + strncpy(wmsg->values[wmsg->last-1], val, WOOMERA_STRLEN); + } + strncpy(wmsg->names[wmsg->last-1], name, WOOMERA_STRLEN); + if (name && val && !strcasecmp(name, "content-type")) { + woomera_set_flag(wmsg, MFLAG_CONTENT); + bytes = atoi(val); + } + if (name && val && !strcasecmp(name, "content-length")) { + woomera_set_flag(wmsg, MFLAG_CONTENT); + bytes = atoi(val); + } + + + } + wmsg->last++; + } + + wmsg->last--; + + if (bytes && woomera_test_flag(wmsg, MFLAG_CONTENT)) { + read(woomera->socket, wmsg->body, + (bytes > sizeof(wmsg->body)) ? sizeof(wmsg->body) : bytes); + } + + return woomera_test_flag(wmsg, MFLAG_EXISTS); + +} + +static struct woomera_interface *pull_from_holding_tank(int index, int span , int chan) +{ + struct woomera_interface *woomera = NULL; + + if (index < 1 || index >= CORE_TANK_LEN) { + if (index != 0) { + log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return NULL; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] && + server.holding_tank[index] != &woomera_dead_dev) { + woomera = server.holding_tank[index]; + + /* Block this index until the call is completed */ + server.holding_tank[index] = &woomera_dead_dev; + + woomera->timeout = 0; + woomera->index = 0; + woomera->span=span; + woomera->chan=chan; + } + pthread_mutex_unlock(&server.ht_lock); + + return woomera; +} + +static void clear_from_holding_tank(int index, struct woomera_interface *woomera) +{ + + if (index < 1 || index >= CORE_TANK_LEN) { + if (index != 0) { + log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] == &woomera_dead_dev) { + server.holding_tank[index] = NULL; + } else if (woomera && server.holding_tank[index] == woomera) { + server.holding_tank[index] = NULL; + } else if (server.holding_tank[index]) { + log_printf(0, server.log, "Error: Holding tank index %i not cleared %p !\n", + index, server.holding_tank[index]); + } + pthread_mutex_unlock(&server.ht_lock); + + return; +} + +static struct woomera_interface *peek_from_holding_tank(int index) +{ + struct woomera_interface *woomera = NULL; + + if (index < 1 || index >= CORE_TANK_LEN) { + if (index != 0) { + log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return NULL; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] && + server.holding_tank[index] != &woomera_dead_dev) { + woomera = server.holding_tank[index]; + } + pthread_mutex_unlock(&server.ht_lock); + + return woomera; +} + +static int add_to_holding_tank(struct woomera_interface *woomera) +{ + int next, i, found=0; + + pthread_mutex_lock(&server.ht_lock); + + for (i=0;i= CORE_TANK_LEN) { + next = server.holding_tank_index = 1; + } + + if (next == 0) { + log_printf(0, server.log, "\nCritical Error on TANK INDEX == 0\n"); + continue; + } + + if (server.holding_tank[next]) { + continue; + } + + found=1; + break; + } + + if (!found) { + /* This means all tank vales are busy + * should never happend */ + pthread_mutex_unlock(&server.ht_lock); + log_printf(0, server.log, "\nCritical Error failed to obtain a TANK INDEX\n"); + return 0; + } + + server.holding_tank[next] = woomera; + woomera->timeout = time(NULL) + 100; + + pthread_mutex_unlock(&server.ht_lock); + return next; +} + +static int handle_woomera_media_accept_answer(struct woomera_interface *woomera, + struct woomera_message *wmsg, + int media, int answer, int accept) +{ + char *raw = woomera_message_header(wmsg, "raw-audio"); + + log_printf(4, woomera->log, "WOOMERA CMD: %s [%s]\n", + wmsg->command, woomera->interface); + + + if (woomera_test_flag(woomera, WFLAG_HANGUP) || + !woomera_test_flag(woomera, WFLAG_RUNNING) || + woomera_test_flag(woomera, WFLAG_MEDIA_END)) { + + log_printf(2, server.log, + "ERROR! call was cancelled MEDIA on HANGUP or MEDIA END!\n"); + + woomera->timeout=0; + return -1; + } + + log_printf(3, server.log,"WOOMERA: GOT %s EVENT: [%s] RAW=%s\n", + wmsg->command,wmsg->callid,raw); + + + if (raw && + woomera->raw == NULL && + !woomera_test_flag(woomera, WFLAG_RAW_MEDIA_STARTED)) { + + woomera_set_flag(woomera, WFLAG_RAW_MEDIA_STARTED); + + woomera_set_raw(woomera, raw); + + if (launch_media_thread(woomera)) { + struct woomera_event wevent; + + log_printf(4, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); + +#if 0 + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); +#endif + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_RECORD_SEPERATOR + ); + + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + woomera->timeout=0; + return -1; + } + } + + if (!woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + log_printf(0, server.log,"ERROR! Monitor Thread not running!\n"); + + } else { + + if (accept) { + if (!autoacm) { + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + isup_exec_command(woomera->span, + woomera->chan, + -1, + SIGBOOST_EVENT_CALL_START_ACK, + 0); + } + } + + if (answer) { + struct media_session *ms; + + pthread_mutex_lock(&woomera->ms_lock); + if ((ms=woomera->ms)) { + time(&woomera->ms->answered); + } + pthread_mutex_unlock(&woomera->ms_lock); + + if (ms) { + + if (!autoacm && !woomera_test_flag(woomera,WFLAG_CALL_ACKED)) { + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + isup_exec_command(woomera->span, + woomera->chan, + -1, + SIGBOOST_EVENT_CALL_START_ACK, + 0); + } + + isup_exec_command(woomera->span, + woomera->chan, + -1, + SIGBOOST_EVENT_CALL_ANSWERED, + 0); + log_printf(2, server.log, + "Sent SIGBOOST_EVENT_CALL_ANSWERED [w%dg%d]\n", + woomera->span+1,woomera->chan+1); + } else { + struct woomera_event wevent; + log_printf(0, server.log, + "WOOMERA ANSWER: FAILED [%s] no Media \n", + wmsg->command,wmsg->callid); + + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + woomera->timeout=0; + return -1; + } + } + } + + { + struct woomera_event wevent; + new_woomera_event_printf(&wevent, "200 %s OK%s" + "Unique-Call-Id: %s%s", + answer ? "ANSWER" : + accept ? "ACCEPT" : "MEDIA", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + } + + return 0; +} + +static int handle_woomera_call_start (struct woomera_interface *woomera, + struct woomera_message *wmsg) +{ + char *raw = woomera_message_header(wmsg, "raw-audio"); + call_signal_event_t event; + char *calling = woomera_message_header(wmsg, "local-number"); +#ifdef SMG_CALLING_NAME + char *calling_name = woomera_message_header(wmsg, "local-name"); +#endif + char *presentation = woomera_message_header(wmsg, "Presentation"); + char *screening = woomera_message_header(wmsg, "Screening"); + char *rdnis = woomera_message_header(wmsg, "RDNIS"); + char *called = wmsg->callid; + char *grp = wmsg->callid; + char *p; + int cause = 34; + int tg = 0; + + if (smg_check_all_busy()) { + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, + "405 SMG Server All Ckt Busy!%s", WOOMERA_RECORD_SEPERATOR); + log_printf(3, woomera->log, "SMG Server Full %d (ckt busy cnt=%i)\n", + server.call_count, server.all_ckt_busy); + return -1; + } + + log_printf(2, woomera->log, "New Call %d/%d\n", server.call_count, server.max_calls); + + if ((p = strchr(called, '/'))) { + *p = '\0'; + called = p+1; + tg = atoi(grp+1) - 1; + if (tg < 0) { + tg=0; + } + } + + woomera->trunk_group=tg; + + if (raw) { + woomera_set_raw(woomera, raw); + } + + woomera->index = add_to_holding_tank(woomera); + if (woomera->index < 1) { + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, + "405 SMG Server All Tanks Busy!%s", + WOOMERA_RECORD_SEPERATOR); + log_printf(0, woomera->log, "Error: Call Tank Full (Call Cnt=%i)\n", + server.call_count); + return -1; + } + + + woomera->index_hold = woomera->index; + + call_signal_call_init(&event, calling, called, woomera->index); + + if (presentation) { + event.calling_number_presentation = atoi(presentation); + } else { + event.calling_number_presentation = 0; + } + + if (screening) { + event.calling_number_screening_ind = atoi(screening); + } else { + event.calling_number_screening_ind = 0; + } + + if (rdnis && strlen(rdnis)) { + strncpy((char*)event.redirection_string,rdnis, + sizeof(event.redirection_string)-1); + log_printf(3,server.log,"RDNIS %s\n", rdnis); + + } + +#ifdef SMG_CALLING_NAME + if (calling_name) { + strncpy((char*)event.calling_name,calling_name, + sizeof(event.calling_name)-1); + } +#endif + + event.trunk_group = tg; + + + if (call_signal_connection_write(&server.mcon, &event) <= 0) { + log_printf(0, server.log, + "Critical System Error: Failed to tx on ISUP socket [%s]: %s\n", + strerror(errno)); + + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, + "405 SMG Signalling Contestion!%s", + WOOMERA_RECORD_SEPERATOR); + return -1; + } + + socket_printf(woomera->socket, "100 Trying%s", WOOMERA_RECORD_SEPERATOR); + + log_printf(2, server.log, "Call Called Event [Setup ID: %d] TG=%d\n", + woomera->index,tg); + + return 0; +} + + +static void interpret_command(struct woomera_interface *woomera, struct woomera_message *wmsg) +{ + int answer = 0, media = 0, accept=0; + char *unique_id; + int cause=0; + + + + if (!strcasecmp(wmsg->command, "call")) { + int err; + if (strlen(woomera->session) != 0) { + /* Call has already been placed */ + socket_printf(woomera->socket, "400 Error Call already in progress %s", + WOOMERA_RECORD_SEPERATOR); + log_printf(0,server.log,"Woomera RX Call Even while call in progress!\n"); + return; + } + + err=handle_woomera_call_start(woomera,wmsg); + if (err) { + woomera_set_flag(woomera, WFLAG_HANGUP); + } + + return; + + } else if (!strcasecmp(wmsg->command, "bye") || !strcasecmp(wmsg->command, "quit")) { + char *cause = woomera_message_header(wmsg, "cause"); + char *q931cause = woomera_message_header(wmsg, "Q931-Cause-Code"); + + if (cause) { + log_printf(3, woomera->log, "Bye Cause Received: [%s]\n", cause); + } + if (q931cause && atoi(q931cause)) { + woomera_set_cause_tosig(woomera,atoi(q931cause)); + } + + log_printf(2, woomera->log, "WOOMERA CMD: Bye Received: [%s]\n", woomera->interface); + + woomera_clear_flag(woomera, WFLAG_RUNNING); + socket_printf(woomera->socket, "200 Connection closed%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + return; + + } else if (!strcasecmp(wmsg->command, "listen")) { + + if (woomera_test_flag(woomera, WFLAG_LISTENING)) { + socket_printf(woomera->socket, "405 Listener already started%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + } else { + char *event_string; + + woomera_set_flag(woomera, WFLAG_LISTENING); + add_listener(woomera); + + if (!strcmp(wmsg->callid,"MASTER")) { + woomera_set_flag(woomera, WFLAG_MASTER_DEV); + log_printf(0,woomera->log, "Starting MASTER Listen Device!\n"); + master_reset=0; + } + + + socket_printf(woomera->socket, "%s", + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "200 Listener enabled%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + if ((event_string = dequeue_event(&server.master_connection))) { + socket_printf(woomera->socket, "%s", event_string); + free(event_string); + event_string = NULL; + } + } + return; + + } else if ((media = !strcasecmp(wmsg->command, "debug"))) { + + int debug_level=atoi(wmsg->callid); + + if (debug_level < 10) { + server.debug=debug_level; + log_printf(0,server.log,"SMG Debugging set to %i (window=%i)\n",server.debug,server.mcon.txwindow); + } + + return; + } + + + unique_id = woomera_message_header(wmsg, "Unique-Call-Id"); + if (!unique_id) { + + cause=111; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, "400 Woomera cmd without uniquie id%s" + WOOMERA_RECORD_SEPERATOR); + + log_printf(2,server.log,"Woomera RX Event (%s) without unique id!\n",wmsg->command); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + if (strlen(woomera->session) == 0) { + struct woomera_interface *session_woomera=NULL; + char *session=NULL; + int span, chan; + char ifname[100]; + /* If session does not exist this is an incoming call */ + sscanf(unique_id, "w%dg%d", &span, &chan); + span--; + chan--; + + log_printf(3, woomera->log, + "WOOMERA Got CMD %s Span=%d Chan=%d from session %s\n", + wmsg->command,span,chan,unique_id); + + if (smg_validate_span_chan(span,chan) != 0) { + + cause=34; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, "404 Invalid span/chan in session%s" + WOOMERA_RECORD_SEPERATOR); + + log_printf(2, woomera->log, + "WOOMERA Warning invalid span chan in session %s %s\n", + wmsg->command,unique_id); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + pthread_mutex_lock(&server.process_lock); + session = server.process_table[span][chan].session; + session_woomera = server.process_table[span][chan].dev; + + if (session_woomera) { + pthread_mutex_unlock(&server.process_lock); + + cause=34; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, "404 Session not found%s" + WOOMERA_RECORD_SEPERATOR); + + + log_printf(0, woomera->log, "WOOMERA Error channel in use %s %s\n", + wmsg->command,unique_id); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + if (!session || strlen(session) == 0 || + strncmp(session,unique_id,sizeof(woomera->session))){ + pthread_mutex_unlock(&server.process_lock); + + cause=34; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "404 Invalid/Expired Session%s" + WOOMERA_RECORD_SEPERATOR); + + log_printf(3, woomera->log, + "WOOMERA Warning: Cmd=%s with invalid session %s (orig=%s)\n", + wmsg->command,unique_id,session?session:"N/A"); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + server.process_table[span][chan].dev=woomera; + strncpy(woomera->session,unique_id,sizeof(woomera->session)); + sprintf(ifname,"w%dg%d",span+1,chan+1); + woomera_set_interface(woomera, ifname); + + woomera->span=span; + woomera->chan=chan; + + pthread_mutex_unlock(&server.process_lock); + + + log_printf(3, woomera->log, "WOOMERA Got New If=%s Session %s\n", + woomera->interface, woomera->session); + + + } else if (strncmp(woomera->session,unique_id,sizeof(woomera->session))) { + + cause=34; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "404 Session Mis-match%s" + WOOMERA_RECORD_SEPERATOR); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + + if (!strcasecmp(wmsg->command, "dtmf")) { + + log_printf(3, woomera->log, "WOOMERA CMD: DTMF Received: [%s] Digit %s Body %s\n", + woomera->interface, wmsg->command_args, wmsg->body); + + wanpipe_send_dtmf(woomera,wmsg->body); + + socket_printf(woomera->socket, "200 DTMF OK%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + + } else if (!strcasecmp(wmsg->command, "hangup")) { + + int chan = -1, span = -1; + char *cause = woomera_message_header(wmsg, "cause"); + char *q931cause = woomera_message_header(wmsg, "Q931-Cause-Code"); + + + if (q931cause && atoi(q931cause)) { + woomera_set_cause_tosig(woomera,atoi(q931cause)); + } + + span=woomera->span; + chan=woomera->chan; + + log_printf(3, woomera->log, "WOOMERA CMD: Hangup Received: [%s] MEDIA EXIST Cause=%s\n", + woomera->interface,cause); + + if (smg_validate_span_chan(span,chan) != 0) { + + socket_printf(woomera->socket, "405 No Such Channel%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + return; + } + + + log_printf(2, woomera->log, "Hangup Received: [w%dg%d]\n", + span+1,chan+1); + + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + + socket_printf(woomera->socket, "200 HANGUP OK%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + + } else if (!strcasecmp(wmsg->command, "proceed")) { + + log_printf(3, woomera->log, "WOOMERA CMD: %s [%s]\n", + wmsg->command, woomera->interface); + + socket_printf(woomera->socket, + "200 %s PROCEED OK%s" + "Unique-Call-Id: %s%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + } else if ((media = !strcasecmp(wmsg->command, "media")) || + (answer = !strcasecmp(wmsg->command, "answer")) || + (accept = !strcasecmp(wmsg->command, "accept"))) { + + handle_woomera_media_accept_answer(woomera, wmsg, media,answer,accept); + + + + } else { + log_printf(0, server.log,"WOOMERA INVALID EVENT: %s [%s] \n", + wmsg->command,wmsg->callid); + socket_printf(woomera->socket, "501 Command '%s' not implemented%s", + wmsg->command, WOOMERA_RECORD_SEPERATOR); + } +} + + +/* + EVENT INCOMING 1 + Remote-Address: 10.3.3.104 + Remote-Number: + Remote-Name: Anthony Minessale!8668630501 + Protocol: H.323 + User-Agent: Post Increment Woomera 1.0alpha1 (OpenH323 v1.17.2) 9/61 + H323-Call-Id: 887b1ff8-bb1f-da11-85c0-0007e98988c4 + Local-Number: 996 + Start-Time: Fri, 09 Sep 2005 12:25:14 -0400 + Local-Name: root +*/ + + +static void handle_call_answer(call_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + int kill = 0; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + char callid[80]; + struct woomera_event wevent; + + if (!woomera->raw) { + log_printf(1, server.log, "Refusing to answer call with no media!\n"); + kill++; + goto handle_call_answer_end; + } + + if (woomera_test_flag(woomera, WFLAG_ANSWER)) { + log_printf(1, server.log, "Refusing to double-answer a call!\n"); + kill++; + goto handle_call_answer_end; + } + + woomera_set_flag(woomera, WFLAG_ANSWER); + + if (woomera->span != event->span || woomera->chan != event->chan) { + log_printf(1, server.log, "Refusing to start media on a different channel from the one we agreed on.!\n"); + kill++; + goto handle_call_answer_end; + } + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(1, server.log, "Refusing to answer a dead call!\n"); + kill++; + } else { + int err; + err=0; + sprintf(callid, "w%dg%d", event->span + 1, event->chan + 1); + woomera_set_interface(woomera, callid); +#ifndef WOOMERA_EARLY_MEDIA + err=launch_media_thread(woomera); + if (err) { + log_printf(0, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); +#if 0 + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); +#endif + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Q931-Cause-Code: %d%s" + "Cause: %s%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + + + kill++; + } +#endif + + if (!kill) { + new_woomera_event_printf(&wevent, "EVENT CONNECT w%dg%d%s" + "Unique-Call-Id: %s%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + } + } + } else { + log_printf(1, server.log, "Answer requested on non-existant session. [w%dg%d]\n", + event->span+1, event->chan+1); + kill++; + } + +handle_call_answer_end: + + if (kill) { + if (woomera) { + woomera_set_flag(woomera,WFLAG_MEDIA_END); + } else { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + SIGBOOST_RELEASE_CAUSE_NORMAL); + + log_printf(1, server.log, "Sent CALL STOP to Answer without session [w%dg%d]\n", + event->span+1, event->chan+1); + } + } +} + +static void handle_call_start_ack(call_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + struct woomera_event wevent; + int kill = 0; + + if ((woomera = peek_from_holding_tank(event->call_setup_id))) { + char callid[80]; + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(1, server.log, "Refusing to ack a dead call!\n"); + kill++; + } else { + int err, span, chan; + + pull_from_holding_tank(event->call_setup_id,event->span,event->chan); + sprintf(callid, "w%dg%d", event->span + 1, event->chan + 1); + + span = event->span; + chan = event->chan; + + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + woomera_set_interface(woomera, callid); + + pthread_mutex_lock(&server.process_lock); + server.process_table[span][chan].dev = woomera; + sprintf(woomera->session,"%s-%i-%i",callid,rand(),rand()); + sprintf(server.process_table[span][chan].session,"%s-%s", + callid,woomera->session); + pthread_mutex_unlock(&server.process_lock); + + + +#ifdef WOOMERA_EARLY_MEDIA + err=launch_media_thread(woomera); + if (err) { + log_printf(0, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); + + +#if 0 + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); +#endif + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id:%s%s" + "Q931-Cause-Code: %d%s" + "Cause: %s%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + kill++; + } +#endif + if (!kill) { + new_woomera_event_printf(&wevent, "201 Accepted%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "EVENT PROCEED w%dg%d%s" + "Channel-Name: g%d/%d%s" + "Unique-Call-Id: %s%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->trunk_group+1, + (event->span*31)+event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + log_printf(2, server.log, "Call Answered Event ID = %d Device = w%dg%d!\n", + event->call_setup_id,woomera->span+1,woomera->chan+1); + } + } + } else { + log_printf(1, server.log, + "Event (START ACK) %d referrs to a non-existant session (%d) [w%dg%d]!\n", + event->event_id, event->call_setup_id,event->span+1, event->chan+1); + kill++; + } + + if (kill) { + if (woomera) { + woomera_set_flag(woomera,WFLAG_MEDIA_END); + } else { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + SIGBOOST_RELEASE_CAUSE_NORMAL); + + log_printf(1, server.log, "Sent CALL STOP to CALL START ACK without session [w%dg%d]\n", + event->span+1, event->chan+1); + } + } +} + +static void handle_call_start_nack(call_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + int span=-1, chan=-1; + int ack=0; + + /* Always ACK the incoming NACK + * Send out the NACK ACK before pulling the TANK, because + * if we send after the pull, the outgoing call could send + * a message to boost with the pulled TANK value before + * we send a NACK ACK */ + + if (smg_validate_span_chan(event->span,event->chan) == 0) { + span=event->span; + chan=event->chan; + } + + if (event->call_setup_id > 0) { + woomera=peek_from_holding_tank(event->call_setup_id); + } + + if (woomera) { + + struct woomera_event wevent; + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(0, server.log, "Event CALL START NACK on hungup call [%d]!\n", + event->call_setup_id); + ack++; + } else { + + woomera_set_cause_topbx(woomera,event->release_cause); + woomera_set_flag(woomera, (WFLAG_HANGUP|WFLAG_HANGUP_NACK_ACK)); + + new_woomera_event_printf(&wevent, "EVENT HANGUP w%dg%d%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(woomera->q931_rel_cause_topbx), + WOOMERA_LINE_SEPERATOR, + woomera->q931_rel_cause_topbx, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + + woomera_set_flag(woomera, WFLAG_HANGUP); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + /* Do not ack here, let woomera thread ack it */ + ack=0; + } + + + } else if (event->call_setup_id == 0 && + smg_validate_span_chan(event->span,event->chan) == 0) { + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + + if (woomera) { + if (!woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT) && + !woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK_SENT)) { + /* Only if we are not already waiting for hangup */ + server.process_table[event->span][event->chan].dev=NULL; + } else if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + /* At this point call is already hang up */ + woomera=NULL; + } else { + /* At this point call is already hang up */ + woomera=NULL; + } + } + + memset(server.process_table[event->span][event->chan].session, + 0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + + if (woomera) { + + log_printf(2, server.log, "Event START NACK on w%dg%d ptr=%p ms=%p\n", + woomera->span+1,woomera->chan+1,woomera,woomera->ms); + + if (!woomera_test_flag(woomera,WFLAG_HANGUP)){ + woomera_set_cause_topbx(woomera,event->release_cause); + } + + woomera_set_flag(woomera, + (WFLAG_HANGUP|WFLAG_MEDIA_END|WFLAG_HANGUP_NACK_ACK)); + + /* Nack Ack will be sent by the woomera thread */ + ack=0; + } else { + /* Valid state when we are not in autoacm mode */ + ack++; + log_printf(3, server.log, "Event: NACK no woomera on span chan [w%dg%d]!\n", + event->span+1, event->chan+1); + } + + } else { + log_printf(0, server.log, + "Error: Start Nack Invalid State Should not happen [%d] [w%dg%d]!\n", + event->call_setup_id, event->span+1, event->chan+1); + ack++; + } + + if (event->release_cause == SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY) { + log_printf(0, server.log, "WARNING: All ckt busy!\n"); + smg_all_ckt_busy(); + } + + +#warning "Ignoring CALL GAP" +#if 0 + if (event->release_cause == SIGBOOST_CALL_SETUP_NACK_AUTO_CALL_GAP) { + log_printf(0, server.log, "WARNING: Call Gapping Detected!\n"); + smg_all_ckt_gap(); + } +#endif + + if (ack) { + span=0; + chan=0; + if (smg_validate_span_chan(event->span,event->chan) == 0) { + span=event->span; + chan=event->chan; + } + + isup_exec_command(span, + chan, + event->call_setup_id, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + 0); + + if (!woomera) { + log_printf(2, server.log, "Event (NACK ACK) %d referrs to a non-existant session (%d) [w%dg%d]!\n", + event->event_id,event->call_setup_id, event->span+1, event->chan+1); + } + } +} + +static void handle_call_loop_start(call_signal_event_t *event) +{ + struct woomera_interface *woomera; + char callid[20]; + char *session; + + pthread_mutex_lock(&server.process_lock); + if (server.process_table[event->span][event->chan].dev) { + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + SIGBOOST_RELEASE_CAUSE_BUSY); + + + log_printf(1, server.log, + "Sent (From Handle Loop START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg] ptr=%d\n", + event->span+1, event->chan+1, server.process_table[event->span][event->chan].dev); + + pthread_mutex_unlock(&server.process_lock); + return; + + } + + sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + sprintf(server.process_table[event->span][event->chan].session, + "%s-%i-%i",callid,rand(),rand()); + session=server.process_table[event->span][event->chan].session; + server.process_table[event->span][event->chan].dev = NULL; + pthread_mutex_unlock(&server.process_lock); + + + woomera=launch_woomera_loop_thread(event); + if (woomera == NULL) { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + SIGBOOST_RELEASE_CAUSE_BUSY); + log_printf(1, server.log, + "Sent (From Handle Loop START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg] ptr=%d\n", + event->span+1, event->chan+1, server.process_table[event->span][event->chan].dev); + } + + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + + return; +} + +static void handle_call_start(call_signal_event_t *event) +{ + struct woomera_event wevent; + char callid[20]; + char *session; + + pthread_mutex_lock(&server.process_lock); + + if (server.process_table[event->span][event->chan].dev) { + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + SIGBOOST_RELEASE_CAUSE_BUSY); + + + log_printf(0, server.log, + "Sent (From Handle START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg%d]\n", + event->span+1, event->chan+1); + + pthread_mutex_unlock(&server.process_lock); + return; + } + + sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + sprintf(server.process_table[event->span][event->chan].session, + "%s-%i-%i",callid,rand(),rand()); + session=server.process_table[event->span][event->chan].session; + server.process_table[event->span][event->chan].dev = NULL; + pthread_mutex_unlock(&server.process_lock); + + if (autoacm) { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_ACK, + 0); + } + + new_woomera_event_printf(&wevent, "EVENT INCOMING w%dg%d%s" + "Unique-Call-Id: %s%s" + "Remote-Number: %s%s" + "Remote-Name: %s%s" + "Protocol: SS7%s" + "User-Agent: sangoma_mgd%s" + "Local-Number: %s%s" + "Channel-Name: g%d/%d%s" + "Trunk-Group: %d%s" + "Presentation: %d%s" + "Screening: %d%s" + "RDNIS: %s%s" + , + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + session, + WOOMERA_LINE_SEPERATOR, + event->calling_number_digits, + WOOMERA_LINE_SEPERATOR, +#ifdef SMG_CALLING_NAME + event->calling_name, +#else + "", +#endif + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + event->called_number_digits, + WOOMERA_LINE_SEPERATOR, + event->trunk_group+1, + (event->span*31)+event->chan+1, + WOOMERA_LINE_SEPERATOR, + event->trunk_group+1, + WOOMERA_LINE_SEPERATOR, + event->calling_number_presentation, + WOOMERA_LINE_SEPERATOR, + event->calling_number_screening_ind, + WOOMERA_LINE_SEPERATOR, + event->redirection_string, + WOOMERA_RECORD_SEPERATOR + ); + + if (enqueue_event_on_listeners(&wevent)) { + enqueue_event(&server.master_connection, &wevent, EVENT_KEEP_DATA); + } else { + + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (autoacm) { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + SIGBOOST_RELEASE_CAUSE_BUSY); + log_printf(0, server.log, + "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_STOPPED [w%dg%d]\n", + event->span+1, event->chan+1); + + } else { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + SIGBOOST_RELEASE_CAUSE_BUSY); + log_printf(0, server.log, + "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_START_NACK [w%dg%d]\n", + event->span+1, event->chan+1); + + } + + } + + destroy_woomera_event_data(&wevent); + +} + +static void handle_gap_abate(call_signal_event_t *event) +{ + log_printf(0, server.log, "NOTICE: GAP Cleared!\n", + event->span+1, event->chan+1); + smg_clear_ckt_gap(); +} + +static void handle_restart_ack(call_signal_connection_t *mcon,call_signal_event_t *event) +{ + mcon->rxseq_reset =0; +} + +static void handle_call_stop(call_signal_event_t *event) +{ + struct woomera_interface *woomera; + int ack=0; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + if (woomera) { + if (!woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT) && + !woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK_SENT)) { + /* Only if we are not already waiting for hangup */ + server.process_table[event->span][event->chan].dev=NULL; + } else if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + /* At this point call is already hangup */ + woomera=NULL; + } else { + /* At this point call is already hangup */ + woomera=NULL; + } + } + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + + woomera_set_cause_topbx(woomera,event->release_cause); + + woomera_set_flag(woomera, + (WFLAG_MEDIA_END|WFLAG_HANGUP|WFLAG_HANGUP_ACK)); + + /* We have to close the socket because + At this point we are release span chan */ + + log_printf(3, server.log, "Event CALL STOP on w%dg%d ptr=%p ms=%p\n", + woomera->span+1,woomera->chan+1,woomera,woomera->ms); + + } else { + ack++; + } + + + if (ack) { + /* At this point we have already sent our STOP so its safe to ACK */ + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED_ACK, + 0); + } + + if (!woomera){ + /* This is allowed on incoming call if remote app does not answer it */ + log_printf(3, server.log, "Event CALL STOP referrs to a non-existant session [w%dg%d]!\n", + event->span+1, event->chan+1); + } +} + +static void handle_heartbeat(call_signal_event_t *event) +{ + if (!woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + log_printf(0, server.log,"ERROR! Monitor Thread not running!\n"); + } else { + int err=call_signal_connection_write(&server.mcon, event); + if (err <= 0) { + log_printf(0, server.log, + "Critical System Error: Failed to tx on ISUP socket [%s]: %s\n", + strerror(errno)); + } + } + return; +} + +static void handle_call_stop_ack(call_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + server.process_table[event->span][event->chan].dev=NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + + if (woomera) { + log_printf(2, server.log, "Stop Ack on [w%dg%d] [Setup ID: %d] [%s]!\n", + event->span+1, event->chan+1, event->call_setup_id, + woomera->interface); + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + + } else { + log_printf(2, server.log, "Event CALL_STOP_ACK(%d) referrs to a non-existant session [w%dg%d] [Setup ID: %d]!\n", + event->event_id, event->span+1, event->chan+1, event->call_setup_id); + } + + /* No need for us to do any thing here */ + return; +} + + +static void handle_call_start_nack_ack(call_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + + if ((woomera=pull_from_holding_tank(event->call_setup_id,-1,-1))) { + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + + } else if (event->call_setup_id == 0 && + smg_validate_span_chan(event->span,event->chan) == 0) { + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + server.process_table[event->span][event->chan].dev=NULL; + memset(server.process_table[event->span][event->chan].session, + 0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + } else if (autoacm==0){ + log_printf(2, server.log, "Nack Ack on [w%dg%d] [Setup ID: %d] [%s]!\n", + event->span+1, event->chan+1, event->call_setup_id); + } else { + log_printf(0, server.log, + "Event NACK ACK [w%dg%d] with valid span/chan no dev!\n", + event->span+1, event->chan+1); + } + + } else { + log_printf(2, server.log, + "Event NACK ACK referrs to a non-existant session [w%dg%d] [Setup ID: %d]!\n", + event->span+1, event->chan+1, event->call_setup_id); + } + + if (event->call_setup_id > 0) { + clear_from_holding_tank(event->call_setup_id, NULL); + } + + /* No need for us to do any thing here */ + return; +} + +#if 0 +static void validate_number(unsigned char *s) +{ + unsigned char *p; + for (p = s; *p; p++) { + if (*p < 48 || *p > 57) { + log_printf(2, server.log, "Encountered a non-numeric character [%c]!\n", *p); + *p = '\0'; + break; + } + } +} +#endif + +static int parse_ss7_event(call_signal_connection_t *mcon, call_signal_event_t *event) +{ + int ret = 0; + +#if 0 + validate_number((unsigned char*)event->called_number_digits); + validate_number((unsigned char*)event->calling_number_digits); +#endif + +#if 1 + log_printf(2, server.log, + "RX EVENT: %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i Cd=[%s] Ci=[%s]\n", + call_signal_event_id_name(event->event_id), + event->event_id, + event->span+1, + event->chan+1, + event->release_cause, + event->call_setup_id, + event->fseqno, + (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"), + (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A") + ); +#endif + +#if 0 + log_printf(2, server.log, "RX EVENT\n"); + log_printf(2, server.log, "===================================\n"); + log_printf(2, server.log, " rType: %s (%0x HEX)\n", + call_signal_event_id_name(event->event_id),event->event_id); + log_printf(2, server.log, " rSpan: [%d]\n",event->span+1); + log_printf(2, server.log, " rChan: [%d]\n",event->chan+1); + log_printf(2, server.log, " rCalledNum: %s\n", + (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A")); + log_printf(2, server.log, " rCallingNum: %s\n", + (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A")); + log_printf(2, server.log, " rCause: %d\n",event->release_cause); + log_printf(2, server.log, " rInterface: [w%dg%d]\n",event->span+1,event->chan+1); + log_printf(2, server.log, " rEvent ID: [%d]\n",event->event_id); + log_printf(2, server.log, " rSetup ID: [%d]\n",event->call_setup_id); + log_printf(2, server.log, " rSeq: [%d]\n",event->fseqno); + log_printf(2, server.log, "===================================\n"); + +#endif + +#if 0 + log_printf(2, server.log, + "\nRX EVENT\n" + "===================================\n" + " rType: %s (%0x HEX)\n" + " rSpan: [%d]\n" + " rChan: [%d]\n" + " rCalledNum: %s\n" + " rCallingNum: %s\n" + " rCause: %s\n" + " rInterface : [w%dg%d]\n" + " rEvent ID : [%d]\n" + " rSetup ID: [%d]\n" + " rSeq: [%d]\n" + "===================================\n" + "\n", + call_signal_event_id_name(event->event_id), + event->event_id, + event->span+1, + event->chan+1, + (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"), + (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A"), + release_to_string(event->release_cause), + event->span+1, + event->chan+1, + event->event_id, + event->call_setup_id, + event->fseqno + ); +#endif + + + switch(event->event_id) { + + case SIGBOOST_EVENT_CALL_START: + handle_call_start(event); + break; + case SIGBOOST_EVENT_CALL_STOPPED: + handle_call_stop(event); + break; + case SIGBOOST_EVENT_CALL_START_ACK: + handle_call_start_ack(event); + break; + case SIGBOOST_EVENT_CALL_START_NACK: + handle_call_start_nack(event); + break; + case SIGBOOST_EVENT_CALL_ANSWERED: + handle_call_answer(event); + break; + case SIGBOOST_EVENT_HEARTBEAT: + handle_heartbeat(event); + break; + case SIGBOOST_EVENT_CALL_START_NACK_ACK: + handle_call_start_nack_ack(event); + break; + case SIGBOOST_EVENT_CALL_STOPPED_ACK: + handle_call_stop_ack(event); + break; + case SIGBOOST_EVENT_INSERT_CHECK_LOOP: + handle_call_loop_start(event); + break; + case SIGBOOST_EVENT_REMOVE_CHECK_LOOP: + handle_call_stop(event); + break; + case SIGBOOST_EVENT_SYSTEM_RESTART_ACK: + handle_restart_ack(mcon,event); + break; + case SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE: + handle_gap_abate(event); + break; + default: + log_printf(0, server.log, "Warning no handler implemented for [%s]\n", + call_signal_event_id_name(event->event_id)); + break; + } + + return ret; +} + + +static void *monitor_thread_run(void *obj) +{ + int ss = 0; + int policy=0,priority=0; + char a=0,b=0; + call_signal_connection_t *mcon=&server.mcon; + call_signal_connection_t *mconp=&server.mconp; + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count++; + pthread_mutex_unlock(&server.thread_count_lock); + + woomera_set_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + + if (call_signal_connection_open(mcon, + mcon->cfg.local_ip, + mcon->cfg.local_port, + mcon->cfg.remote_ip, + mcon->cfg.remote_port) < 0) { + log_printf(0, server.log, "Error: Opening MCON Socket [%d] %s\n", + mcon->socket,strerror(errno)); + exit(-1); + } + + if (call_signal_connection_open(mconp, + mconp->cfg.local_ip, + mconp->cfg.local_port, + mconp->cfg.remote_ip, + mconp->cfg.remote_port) < 0) { + log_printf(0, server.log, "Error: Opening MCONP Socket [%d] %s\n", + mconp->socket,strerror(errno)); + exit(-1); + } + + mcon->log = server.log; + mconp->log = server.log; + + isup_exec_command(0, + 0, + -1, + SIGBOOST_EVENT_SYSTEM_RESTART, + 0); + + mcon->rxseq_reset=1; + + smg_get_current_priority(&policy,&priority); + + log_printf(1, server.log, "Open udp socket [%d] [%d]\n", + mcon->socket,mconp->socket); + log_printf(1, server.log, "Monitor Thread Started (%i:%i)\n",policy,priority); + + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { +#if 0 + ss = waitfor_socket(server.mcon.socket, 1000, POLLERR | POLLIN); +#else + ss = waitfor_2sockets(mcon->socket, + mconp->socket, + &a, &b, 1000); +#endif + + if (ss > 0) { + + call_signal_event_t *event=NULL; + int i=0; + + if (b) { +mcon_retry_priority: + if ((event = call_signal_connection_readp(mconp,i))) { + struct timeval current; + struct timeval difftime; + gettimeofday(¤t,NULL); + timersub (¤t, &event->tv, &difftime); + log_printf(3, server.log, "Socket Event P [%s] T=%d:%d\n", + call_signal_event_id_name(event->event_id), + difftime.tv_sec, difftime.tv_usec); + parse_ss7_event(mconp,event); + if (++i < 10) { + goto mcon_retry_priority; + } + + } else if (errno != EAGAIN) { + ss=-1; + log_printf(0, server.log, + "Error: Reading from Boost P Socket! (%i) %s\n", + errno,strerror(errno)); + break; + } + } + + i=0; + + if (a) { +mcon_retry: + if ((event = call_signal_connection_read(mcon,i))) { + struct timeval current; + struct timeval difftime; + gettimeofday(¤t,NULL); + timersub (¤t, &event->tv, &difftime); + log_printf(3, server.log, "Socket Event [%s] T=%d:%d\n", + call_signal_event_id_name(event->event_id), + difftime.tv_sec, difftime.tv_usec); + parse_ss7_event(mcon,event); + + if (++i < 50) { + goto mcon_retry; + } + } else if (errno != EAGAIN) { + ss=-1; + log_printf(0, server.log, + "Error: Reading from Boost Socket! (%i) %s\n", + errno,strerror(errno)); + break; + } + } + + } + + if (ss < 0){ + log_printf(0, server.log, "Thread Run: Select Socket Error!\n"); + break; + } + + } + + log_printf(1, server.log, "Close udp socket [%d] [%d]\n", + mcon->socket,mconp->socket); + call_signal_connection_close(&server.mcon); + call_signal_connection_close(&server.mconp); + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count--; + pthread_mutex_unlock(&server.thread_count_lock); + + woomera_clear_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + log_printf(0, server.log, "Monitor Thread Ended\n"); + + return NULL; +} + +static void woomera_loop_thread_run(struct woomera_interface *woomera) +{ + int err=launch_media_thread(woomera); + if (err) { + log_printf(0, server.log, "Failed to start loop media thread\n"); + woomera_set_flag(woomera, + (WFLAG_HANGUP|WFLAG_MEDIA_END)); + woomera_clear_flag(woomera, WFLAG_RUNNING); + return; + } + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + !woomera_test_flag(woomera, WFLAG_HANGUP)) { + + sleep(1); + continue; + + } + + woomera_clear_flag(woomera, WFLAG_RUNNING); + + log_printf(2, server.log, "Woomera Session: For Loop Test exiting %s\n",woomera->interface); + + + + return; +} + +static void *woomera_thread_run(void *obj) +{ + struct woomera_interface *woomera = obj; + struct woomera_message wmsg; + struct woomera_event wevent; + char *event_string; + int mwi; + int err; + int policy=0, priority=0; + int span = -1, chan = -1; + + woomera_message_init(&wmsg); + + //smg_get_current_priority(&policy,&priority); + + log_printf(2, server.log, "WOOMERA session started (ptr=%p : loop=%i)(%i:%i) Index=%i\n", + woomera,woomera->loop_tdm,policy,priority, woomera->index); + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count++; + pthread_mutex_unlock(&server.thread_count_lock); + + pthread_mutex_init(&woomera->queue_lock, NULL); + pthread_mutex_init(&woomera->ms_lock, NULL); + pthread_mutex_init(&woomera->dtmf_lock, NULL); + pthread_mutex_init(&woomera->vlock, NULL); + pthread_mutex_init(&woomera->flags_lock, NULL); + + if (woomera->loop_tdm) { + woomera_loop_thread_run(woomera); + goto woomera_session_close; + } + + err=socket_printf(woomera->socket, + "EVENT HELLO Sangoma Media Gateway%s" + "Supported-Protocols: TDM%s" + "Version: %s%s" + "Remote-Address: %s%s" + "Remote-Port: %d%s" + "Raw-Format: %s%s", + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + SMG_VERSION, WOOMERA_LINE_SEPERATOR, + inet_ntoa(woomera->addr.sin_addr), WOOMERA_LINE_SEPERATOR, + ntohs(woomera->addr.sin_port), WOOMERA_LINE_SEPERATOR, + server.hw_coding?"ALAW":"ULAW", WOOMERA_RECORD_SEPERATOR + ); + + if (err) { + log_printf(0, server.log, "Woomera session socket failure! (ptr=%p)\n", + woomera); + woomera_clear_flag(woomera, WFLAG_RUNNING); + goto woomera_session_close; + } + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING) && + woomera_test_flag(woomera, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + !woomera_test_flag(woomera, WFLAG_HANGUP) && + !master_reset) { + + + mwi = woomera_message_parse(woomera, &wmsg, WOOMERA_HARD_TIMEOUT); + if (mwi >= 0) { + + if (mwi) { + interpret_command(woomera, &wmsg); + } else if (woomera_test_flag(woomera, WFLAG_EVENT)){ + while ((event_string = dequeue_event(woomera))) { + if (socket_printf(woomera->socket, "%s", event_string)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + free(event_string); + log_printf(4, server.log, + "WOOMERA session (ptr=%p) print string error\n", + woomera); + break; + } + free(event_string); + } + woomera_clear_flag(woomera, WFLAG_EVENT); + } + + if (woomera->timeout > 0 && time(NULL) >= woomera->timeout) { + + /* Sent the hangup only after we sent a NACK */ + + log_printf(2, server.log, + "WOOMERA session (ptr=%p) Call Timedout ! [%s] (Timeout=%d)\n", + woomera,woomera->interface,woomera->timeout); + + /* Let the Index check below send a NACK */ + if (woomera->index) { + woomera_set_flag(woomera, WFLAG_HANGUP); + } + break; + } + + } else { + log_printf(3, server.log, "WOOMERA session (ptr=%p) [%s] READ MSG Error %i \n", + woomera,woomera->interface,mwi); + break; + } + + } + +woomera_session_close: + + log_printf(2, server.log, "WOOMERA session (ptr=%p) is dying [%s]: SR=%d WR=%d WF=0x%04X\n", + woomera,woomera->interface, + woomera_test_flag(&server.master_connection, WFLAG_RUNNING), + woomera_test_flag(woomera, WFLAG_RUNNING), + woomera->flags); + + + if (woomera_test_flag(woomera, WFLAG_MEDIA_RUNNING)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + while(woomera_test_flag(woomera, WFLAG_MEDIA_RUNNING)) { + usleep(100); + sched_yield(); + } + } + + + /*********************************************** + * Identify the SPAN CHAN to be used below + ***********************************************/ + + chan = woomera->chan; + span = woomera->span; + + + if (!woomera_test_flag(woomera, WFLAG_HANGUP)) { + + /* The call was not HUNGUP. This is the last check, + If the call is valid, hungup the call if the call + was never up the keep going */ + + + if (smg_validate_span_chan(span,chan) == 0) { + + if (!woomera->index) { + + if (autoacm || woomera_test_flag(woomera,WFLAG_CALL_ACKED)) { + + woomera_set_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + woomera->q931_rel_cause_tosig); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK_SENT); + + + log_printf(3, woomera->log, "Woomera Sent SIGBOOST_EVENT_CALL_STOPPED [w%dg%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + } else { + + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + woomera->q931_rel_cause_tosig); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT); + + log_printf(3, woomera->log, "Woomera Sent SIGBOOST_EVENT_CALL_START_NACK [w%dg%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + } + } else { + log_printf(0, woomera->log, "Woomera Not Sent CALL STOPPED - Instead NACK [w%dg%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + + } + }else{ + /* This can happend if an outgoing call times out + or gets hungup before it gets acked. Its not a + failure */ + if (!woomera->index) { + + /* In this case we really failed to tx STOP */ + log_printf(0, woomera->log, "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + } + + woomera_set_flag(woomera, WFLAG_HANGUP); + + } + +woo_re_hangup: + + /* We must send a STOP ACK to boost telling it that we are done */ + if (woomera_test_flag(woomera, WFLAG_HANGUP_ACK)) { + + /* SMG received a HANGUP from boost. + We must now send back the ACK to the HANGUP. + Boost will not release channel until we + ACK the hangup */ + + if (smg_validate_span_chan(span,chan) == 0) { + + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED_ACK, + woomera->q931_rel_cause_tosig); + + log_printf(3, woomera->log, + "Sent (Ack) to SIGBOOST_EVENT_CALL_STOPPED_ACK [w%dg%d] [%s] ptr=%p\n", + span+1,chan+1,woomera->interface,woomera); + + }else{ + /* This should never happen! If it does + we broke protocol */ + log_printf(0, woomera->log, + "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED_ACK [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + + woomera_clear_flag(woomera, WFLAG_HANGUP_ACK); + woomera_set_flag(woomera, WFLAG_HANGUP); + } + + if (woomera_test_flag(woomera, WFLAG_HANGUP_NACK_ACK)) { + + /* SMG received a NACK from boost during call startup. + We must now send back the ACK to the NACK. + Boost will not release channel until we + ACK the NACK */ + + if (smg_validate_span_chan(span,chan) == 0) { + + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + woomera->q931_rel_cause_tosig); + + log_printf(3, woomera->log, + "Sent (Nack Ack) to SIGBOOST_EVENT_CALL_START_NACK_ACK [w%dg%d] [%s] ptr=%p\n", + span+1,chan+1,woomera->interface,woomera); + + woomera->index=0; + + } else if (woomera->index) { + isup_exec_command(0, + 0, + woomera->index, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + woomera->q931_rel_cause_tosig); + + woomera->index=0; + + } else { + log_printf(0, woomera->log, + "FAILED: Sent (Nack Ack) SIGBOOST_EVENT_CALL_START_NACK_ACK [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + + woomera_clear_flag(woomera, WFLAG_HANGUP_NACK_ACK); + + } + + if (woomera->index) { + + int index = woomera->index; + + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Timeout: %ld%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + woomera->timeout, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(18), + WOOMERA_LINE_SEPERATOR, + 18, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + while ((event_string = dequeue_event(woomera))) { + socket_printf(woomera->socket, "%s", event_string); + free(event_string); + } + + if (peek_from_holding_tank(index)) { + + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + isup_exec_command(0, + 0, + index, + SIGBOOST_EVENT_CALL_START_NACK, + 0); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT); + + log_printf(2, woomera->log, + "Sent SIGBOOST_EVENT_CALL_START_NACK [Setup ID: %d] .. WAITING FOR NACK ACK\n", + index); + } else { + log_printf(1, woomera->log, + "Error Failed to Sent SIGBOOST_EVENT_CALL_START_NACK [Setup ID: %d] - index stale!\n", + index); + } + } + + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK)) { + int timeout_cnt=0; + int overall_cnt=0; + + /* SMG sent NACK to boost, however we have to wait + for boost to give us the ACK back before we + release resources. */ + + while (woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK)) { + timeout_cnt++; + if (timeout_cnt > 4000) { //30sec timeout + timeout_cnt=0; + overall_cnt++; + log_printf(0, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] ... \n", + woomera->index); + } + + if (overall_cnt > 10) { //300sec timeotu + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + break; + } + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING)) { + break; + } + + usleep(5000); + sched_yield(); + } + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + if (overall_cnt > 10) { + log_printf(0, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] .. TIMEOUT on NACK ACK\n", + index); + + } else { + log_printf(2, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] .. GOT NACK ACK\n", + index); + + } + } + + if (woomera_test_flag(woomera, WFLAG_EVENT)){ + while ((event_string = dequeue_event(woomera))) { + socket_printf(woomera->socket, "%s", event_string); + free(event_string); + } + woomera_clear_flag(woomera, WFLAG_EVENT); + } + + + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + int timeout_cnt=0; + int overall_cnt=0; + + /* SMG sent HANGUP to boost, however we have to wait + for boost to give us the ACK back before we + release resources. */ + + log_printf(2, woomera->log, + "Waiting for STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + + while (woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + timeout_cnt++; + if (timeout_cnt > 4000) { //10sec timeout + timeout_cnt=0; + overall_cnt++; + log_printf(0, woomera->log, + "Waiting for STOPPED ACK [%s] [id=%i] ... \n", + woomera->interface,woomera->index_hold); + } + + if (overall_cnt > 10) { //100sec + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + break; + } + + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + server.process_table[span][chan].dev != woomera) { + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + break; + } + + usleep(5000); + sched_yield(); + } + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + + if (overall_cnt > 10) { + log_printf(0, woomera->log, + "Wait TIMEDOUT on STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + + } else { + log_printf(2, woomera->log, + "Wait GOT STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + } + } + + /***************************************************** + * We must wait for WFLAG_WAIT_FOR_STOPPED_ACK here + * so that STOP_ACK can access the woomera + *****************************************************/ + + if (smg_validate_span_chan(span,chan) == 0) { + log_printf(2, woomera->log, + "WOOMERA Clearing Processs Table ... \n", + woomera->interface); + pthread_mutex_lock(&server.process_lock); + if (server.process_table[span][chan].dev == woomera){ + server.process_table[span][chan].dev = NULL; + memset(server.process_table[span][chan].session,0,SMG_SESSION_NAME_SZ); + } + pthread_mutex_unlock(&server.process_lock); + } + +#if 0 +//Used for testing + if (1) { + int chan = woomera->chan; + int span = woomera->span; + if (smg_validate_span_chan(span,chan) == 0) { + pthread_mutex_lock(&server.process_lock); + /* This is possible in case media thread dies on startup */ + + if (server.process_table[span][chan]){ + log_printf(0, server.log, + "Sanity Span Chan Still in use: [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + //server.process_table[span][chan] = NULL; + } + pthread_mutex_unlock(&server.process_lock); + } + } +#endif + + usleep(3000000); + + /* Sanity Check */ + if (woomera_test_flag(woomera, WFLAG_HANGUP_ACK)) { + log_printf(0, woomera->log, + "Woomera MISSED HANGUP ACK: Retry HANGUP ACK\n"); + goto woo_re_hangup; + } + if (woomera_test_flag(woomera, WFLAG_HANGUP_NACK_ACK)) { + log_printf(0, woomera->log, + "Woomera MISSED HANGUP ACK: Retry HANGUP NACK ACK\n"); + goto woo_re_hangup; + } + + /* This is where we actually pull the index + * out of the tank. We had to keep the tank + * value until the end of the call. Tank is only + * used on outgoing calls. */ + if (woomera->index_hold >= 1) { + clear_from_holding_tank(woomera->index_hold, woomera); + woomera->index_hold=0; + } + + log_printf(2, woomera->log, "Woomera Thread Finished %u\n", (unsigned long) woomera->thread); + close_socket(&woomera->socket); + woomera->socket=-1; + + /* delete queue */ + while ((event_string = dequeue_event(woomera))) { + free(event_string); + } + + if (woomera_test_flag(woomera, WFLAG_LISTENING)) { + del_listener(woomera); + } + + log_printf(2, server.log, "WOOMERA session for [%s] stopped (ptr=%p)\n", + woomera->interface,woomera); + + if (woomera_test_flag(woomera, WFLAG_MASTER_DEV)) { + log_printf(0,server.log,"MASTER Thread Stopped (ptr=%p)\n",woomera); + master_reset=0; + } + + + pthread_mutex_destroy(&woomera->queue_lock); + pthread_mutex_destroy(&woomera->ms_lock); + pthread_mutex_destroy(&woomera->dtmf_lock); + pthread_mutex_destroy(&woomera->vlock); + pthread_mutex_destroy(&woomera->flags_lock); + woomera_set_raw(woomera, NULL); + woomera_set_interface(woomera, NULL); + + woomera_message_clear(&wmsg); + + free(woomera); + pthread_mutex_lock(&server.thread_count_lock); + server.call_count--; + server.thread_count--; + pthread_mutex_unlock(&server.thread_count_lock); + + pthread_exit(NULL); + return NULL; +} + + +static int launch_woomera_thread(struct woomera_interface *woomera) +{ + int result = 0; + pthread_attr_t attr; + + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_RUNNING); + result = pthread_create(&woomera->thread, &attr, woomera_thread_run, woomera); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! (%i) %s\n", + __FUNCTION__,result,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + +static int launch_monitor_thread(void) +{ + pthread_attr_t attr; + int result = 0; + struct sched_param param; + + param.sched_priority = 10; + result = pthread_attr_init(&attr); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + result = pthread_attr_setschedparam (&attr, ¶m); + + log_printf(0,server.log,"%s: Old Priority =%i res=%i \n",__FUNCTION__, + param.sched_priority,result); + + + woomera_set_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + result = pthread_create(&server.monitor_thread, &attr, monitor_thread_run, NULL); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + + +#ifdef WP_HPTDM_API +static void *hp_tdmapi_span_run(void *obj) +{ + hp_tdm_api_span_t *span = obj; + int err; + + log_printf(0,server.log,"Starting %s span!\n",span->ifname); + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + + if (!span->run_span) { + break; + } + + err = span->run_span(span); + if (err) { + break; + } + + } + + if (span->close_span) { + span->close_span(span); + } + + sleep(3); + log_printf(0,server.log,"Stopping %s span!\n",span->ifname); + + pthread_exit(NULL); +} + + +static int launch_hptdm_api_span_thread(int span) +{ + pthread_attr_t attr; + int result = 0; + struct sched_param param; + + param.sched_priority = 5; + result = pthread_attr_init(&attr); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + result = pthread_attr_setschedparam (&attr, ¶m); + + result = pthread_create(&server.monitor_thread, &attr, hp_tdmapi_span_run, &hptdmspan[span]); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + } + pthread_attr_destroy(&attr); + + return result; +} +#endif + +static int configure_server(void) +{ + struct woomera_config cfg; + char *var, *val; + int cnt = 0; + + server.dtmf_intr_ch = -1; + + if (!woomera_open_file(&cfg, server.config_file)) { + log_printf(0, server.log, "open of %s failed\n", server.config_file); + return 0; + } + + while (woomera_next_pair(&cfg, &var, &val)) { + if (!strcasecmp(var, "boost_local_ip")) { + strncpy(server.mcon.cfg.local_ip, val, + sizeof(server.mcon.cfg.local_ip) -1); + strncpy(server.mconp.cfg.local_ip, val, + sizeof(server.mconp.cfg.local_ip) -1); + cnt++; + } else if (!strcasecmp(var, "boost_local_port")) { + server.mcon.cfg.local_port = atoi(val); + server.mconp.cfg.local_port = + server.mcon.cfg.local_port+1; + cnt++; + } else if (!strcasecmp(var, "boost_remote_ip")) { + strncpy(server.mcon.cfg.remote_ip, val, + sizeof(server.mcon.cfg.remote_ip) -1); + strncpy(server.mconp.cfg.remote_ip, val, + sizeof(server.mconp.cfg.remote_ip) -1); + cnt++; + } else if (!strcasecmp(var, "boost_remote_port")) { + server.mcon.cfg.remote_port = atoi(val); + server.mconp.cfg.remote_port = + server.mcon.cfg.remote_port+1; + cnt++; + } else if (!strcasecmp(var, "logfile_path")) { + if (!server.logfile_path) { + server.logfile_path = strdup(val); + } + } else if (!strcasecmp(var, "woomera_port")) { + server.port = atoi(val); + } else if (!strcasecmp(var, "debug_level")) { + server.debug = atoi(val); + } else if (!strcasecmp(var, "out_tx_test")) { + server.out_tx_test = atoi(val); + } else if (!strcasecmp(var, "loop_trace")) { + server.loop_trace = atoi(val); + } else if (!strcasecmp(var, "rxgain")) { + server.rxgain = atoi(val); + } else if (!strcasecmp(var, "txgain")) { + server.txgain = atoi(val); + } else if (!strcasecmp(var, "dtmf_on_duration")){ + server.dtmf_on = atoi(val); + } else if (!strcasecmp(var, "dtmf_off_duration")){ + server.dtmf_off = atoi(val); + } else if (!strcasecmp(var, "dtmf_inter_ch_duration")){ + server.dtmf_intr_ch = atoi(val); + } else if (!strcasecmp(var, "max_calls")) { + int max = atoi(val); + if (max > 0) { + server.max_calls = max; + } + } else if (!strcasecmp(var, "autoacm")) { + int max = atoi(val); + if (max >= 0) { + autoacm=max; + } + + } else if (!strcasecmp(var, "media_ip")) { + strncpy(server.media_ip, val, sizeof(server.media_ip) -1); + } else { + log_printf(0, server.log, "Invalid Option %s at line %d!\n", var, cfg.lineno); + } + } + + /* Post initialize */ + if (server.dtmf_on == 0){ + server.dtmf_on=SMG_DTMF_ON; + } + if (server.dtmf_off == 0) { + server.dtmf_off=SMG_DTMF_OFF; + } + if (server.dtmf_intr_ch == -1) { + server.dtmf_intr_ch = 0; + } + server.dtmf_size=(server.dtmf_on+server.dtmf_off)*10*2; + + log_printf(0,server.log, "DTMF On=%i Off=%i IntrCh=%i Size=%i\n", + server.dtmf_on,server.dtmf_off,server.dtmf_intr_ch,server.dtmf_size); + + woomera_close_file(&cfg); + return cnt == 4 ? 1 : 0; +} + + + +static int main_thread(void) +{ + + struct sockaddr_in sock_addr, client_addr; + struct woomera_interface *new_woomera; + int client_sock = -1, pid = 0; + unsigned int len = 0; + FILE *tmp; + + if ((server.master_connection.socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { + log_printf(0, server.log, "socket() failed\n"); + return 1; + } + + memset(&sock_addr, 0, sizeof(sock_addr)); /* Zero out structure */ + sock_addr.sin_family = AF_INET; /* Internet address family */ + sock_addr.sin_addr.s_addr = htonl(INADDR_ANY); /* Any incoming interface */ + sock_addr.sin_port = htons(server.port); /* Local port */ + + /* Bind to the local address */ + if (bind(server.master_connection.socket, (struct sockaddr *) &sock_addr, sizeof(sock_addr)) < 0) { + log_printf(0, server.log, "bind(%d) failed\n", server.port); + return 1; + } + + /* Mark the socket so it will listen for incoming connections */ + if (listen(server.master_connection.socket, MAXPENDING) < 0) { + log_printf(0, server.log, "listen() failed\n"); + return 1; + } + + if ((pid = get_pid_from_file(PIDFILE))) { + log_printf(0, stderr, "pid %d already exists.\n", pid); + exit(0); + } + + if (!(tmp = safe_fopen(PIDFILE, "w"))) { + log_printf(0, stderr, "Error creating pidfile %s\n", PIDFILE); + return 1; + } else { + fprintf(tmp, "%d", getpid()); + fclose(tmp); + tmp = NULL; + } + + no_nagle(server.master_connection.socket); + +#if 0 + if (1) { + int span,chan; + call_signal_event_t event; +#if 0 + span=1; + chan=30; + event.span=span; + event.chan=chan; + launch_woomera_loop_thread(&event); +#else + for (span=0;span<8;span++) { + for (chan=0;chan<31;chan++) { + event.span=span; + event.chan=chan; + launch_woomera_loop_thread(&event); + } + } +#endif + } +#endif + +#ifdef WP_HPTDM_API + if (1) { + int span; + for (span=0;span<16;span++) { + hptdmspan[span] = sangoma_hptdm_api_span_init(span); + if (!hptdmspan[span]) { + break; + } else { + log_printf(0, server.log, "HP TDM API Span: %d configured...\n", + span); + launch_hptdm_api_span_thread(span); + } + } + } +#endif + + log_printf(1, server.log, "Main Process Started: Woomera Ready port: %d\n", server.port); + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + + /* Set the size of the in-out parameter */ + len = sizeof(client_addr); + + /* Wait for a client to connect */ + if ((client_sock = accept(server.master_connection.socket, (struct sockaddr *) &client_addr, &len)) < 0) { + log_printf(0, server.log, "accpet() failed\n"); + return 1; + } + + if ((new_woomera = new_woomera_interface(client_sock, &client_addr, len))) { + log_printf(2, server.log, "Starting Thread for New Connection %s:%d Sock=%d\n", + inet_ntoa(new_woomera->addr.sin_addr), + ntohs(new_woomera->addr.sin_port), + client_sock); + pthread_mutex_lock(&server.thread_count_lock); + server.call_count++; + pthread_mutex_unlock(&server.thread_count_lock); + if (launch_woomera_thread(new_woomera)) { + socket_printf(new_woomera->socket, + "501 call was cancelled!%s", + WOOMERA_RECORD_SEPERATOR); + + close_socket(&new_woomera->socket); + new_woomera->socket=-1; + free(new_woomera); + } + } else { + log_printf(0, server.log, "Critical ERROR: memory/socket error\n"); + } + } + + log_printf(1, server.log, "Main Process End\n"); + + return 0; +} + +static int do_ignore(int sig) +{ + return 0; +} + +static int do_shut(int sig) +{ + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + close_socket(&server.master_connection.socket); + log_printf(1, server.log, "Caught SIG %d, Closing Master Socket!\n", sig); + return 0; +} + +static int sangoma_tdm_init (int span) +{ +#ifdef LIBSANGOMA_GET_HWCODING + wanpipe_tdm_api_t tdm_api; + int fd=sangoma_open_tdmapi_span(span); + if (fd < 0 ){ + return -1; + } else { + server.hw_coding=sangoma_tdm_get_hw_coding(fd,&tdm_api); + close_socket(&fd); + } +#else +#error "libsangoma missing hwcoding feature: not up to date!" +#endif + return 0; +} + + +static int woomera_startup(int argc, char **argv) +{ + int x = 0, pid = 0, bg = 0; + char *cfg=NULL, *debug=NULL, *arg=NULL; + + while((arg = argv[x++])) { + + if (!strcasecmp(arg, "-hup")) { + if (! (pid = get_pid_from_file(PIDFILE))) { + log_printf(0, stderr, "Error reading pidfile %s\n", PIDFILE); + exit(1); + } else { + log_printf(0, stderr, "Killing PID %d\n", pid); + kill(pid, SIGHUP); + sleep(1); + exit(0); + } + + } else if (!strcasecmp(arg, "-term") || !strcasecmp(arg, "--term")) { + if (! (pid = get_pid_from_file(PIDFILE))) { + log_printf(0, stderr, "Error reading pidfile %s\n", PIDFILE); + exit(1); + } else { + log_printf(0, stderr, "Killing PID %d\n", pid); + kill(pid, SIGTERM); + unlink(PIDFILE); + sleep(1); + exit(0); + } + + } else if (!strcasecmp(arg, "-version")) { + fprintf(stdout, "\nSangoma Media Gateway: Version %s\n\n", SMG_VERSION); + exit(0); + + } else if (!strcasecmp(arg, "-help")) { + fprintf(stdout, "%s\n%s [-help] | [ -version] | [-hup] | [-wipe] | [[-bg] | [-debug ] | [-cfg ] | [-log ]]\n\n", WELCOME_TEXT, argv[0]); + exit(0); + } else if (!strcasecmp(arg, "-wipe")) { + unlink(PIDFILE); + } else if (!strcasecmp(arg, "-bg")) { + bg = 1; + + } else if (!strcasecmp(arg, "-g")) { + coredump = 1; + + } else if (!strcasecmp(arg, "-debug")) { + if (argv[x] && *(argv[x]) != '-') { + debug = argv[x++]; + } + } else if (!strcasecmp(arg, "-cfg")) { + if (argv[x] && *(argv[x]) != '-') { + cfg = argv[x++]; + } + } else if (!strcasecmp(arg, "-log")) { + if (argv[x] && *(argv[x]) != '-') { + server.logfile_path = strdup(argv[x++]); + } + } else if (*arg == '-') { + log_printf(0, stderr, "Unknown Option %s\n", arg); + fprintf(stdout, "%s\n%s [-help] | [-hup] | [-wipe] | [[-bg] | [-debug ] | [-cfg ] | [-log ]]\n\n", WELCOME_TEXT, argv[0]); + exit(1); + } + } + + if (1){ + int spn; + for (spn=1;spn<=WOOMERA_MAX_SPAN;spn++) { + if (sangoma_tdm_init(spn) == 0) { + break; + } + } + if (spn>WOOMERA_MAX_SPAN) { + printf("\nError: Failed to access a channel on spans 1-16\n"); + printf(" Please start Wanpipe TDM API drivers\n"); + return 0; + } + } + + if (bg && (pid = fork())) { + log_printf(0, stderr, "Backgrounding!\n"); + return 0; + } + + q931_cause_setup(); + + server.port = 42420; + server.debug = 0; + strcpy(server.media_ip, "127.0.0.1"); + server.next_media_port = WOOMERA_MIN_MEDIA_PORT; + server.log = stdout; + server.master_connection.socket = -1; + server.master_connection.event_queue = NULL; + server.config_file = cfg ? cfg : "/etc/sangoma_mgd.conf"; + pthread_mutex_init(&server.listen_lock, NULL); + pthread_mutex_init(&server.ht_lock, NULL); + pthread_mutex_init(&server.process_lock, NULL); + pthread_mutex_init(&server.media_udp_port_lock, NULL); + pthread_mutex_init(&server.thread_count_lock, NULL); + pthread_mutex_init(&server.master_connection.queue_lock, NULL); + pthread_mutex_init(&server.master_connection.flags_lock, NULL); + pthread_mutex_init(&server.mcon.lock, NULL); + server.master_connection.chan = -1; + server.master_connection.span = -1; + + if (!configure_server()) { + log_printf(0, server.log, "configuration failed!\n"); + return 0; + } + +#ifndef USE_SYSLOG + if (server.logfile_path) { + if (!(server.log = safe_fopen(server.logfile_path, "a"))) { + log_printf(0, stderr, "Error setting logfile %s!\n", server.logfile_path); + server.log = stderr; + return 0; + } + } +#endif + + + if (debug) { + server.debug = atoi(debug); + } + + if (coredump) { + struct rlimit l; + memset(&l, 0, sizeof(l)); + l.rlim_cur = RLIM_INFINITY; + l.rlim_max = RLIM_INFINITY; + if (setrlimit(RLIMIT_CORE, &l)) { + log_printf(0, stderr, "Warning: Failed to disable core size limit: %s\n", + strerror(errno)); + } + } + +#ifdef __LINUX__ + if (geteuid() && coredump) { + if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) < 0) { + log_printf(0, stderr, "Warning: Failed to disable core size limit for non-root: %s\n", + strerror(errno)); + } + } +#endif + + + + (void) signal(SIGINT,(void *) do_shut); + (void) signal(SIGPIPE,(void *) do_ignore); + (void) signal(SIGHUP,(void *) do_shut); + + + woomera_set_flag(&server.master_connection, WFLAG_RUNNING); + if (launch_monitor_thread()) { + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + return 0; + } + + fprintf(stderr, "%s", WELCOME_TEXT); + log_printf(0, stderr, "Woomera STARTUP Complete. [AutoACM=%i]\n",autoacm); + + return 1; +} + +static int woomera_shutdown(void) +{ + char *event_string; + int told = 0, loops = 0; + + close_socket(&server.master_connection.socket); + pthread_mutex_destroy(&server.listen_lock); + pthread_mutex_destroy(&server.ht_lock); + pthread_mutex_destroy(&server.process_lock); + pthread_mutex_destroy(&server.media_udp_port_lock); + pthread_mutex_destroy(&server.thread_count_lock); + pthread_mutex_destroy(&server.master_connection.queue_lock); + pthread_mutex_destroy(&server.master_connection.flags_lock); + pthread_mutex_destroy(&server.mcon.lock); + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + + + if (server.logfile_path) { + free(server.logfile_path); + server.logfile_path = NULL; + } + + /* delete queue */ + while ((event_string = dequeue_event(&server.master_connection))) { + free(event_string); + } + + while(server.thread_count > 0) { + loops++; + + if (loops % 1000 == 0) { + told = 0; + } + + if (loops > 10000) { + log_printf(0, server.log, "Red Alert! threads did not stop\n"); + assert(server.thread_count == 0); + } + + if (told != server.thread_count) { + log_printf(1, server.log, "Waiting For %d thread%s.\n", + server.thread_count, server.thread_count == 1 ? "" : "s"); + told = server.thread_count; + } + ysleep(10000); + } + unlink(PIDFILE); + log_printf(0, stderr, "Woomera SHUTDOWN Complete.\n"); + return 0; +} + +int main(int argc, char *argv[]) +{ + int ret = 0; + + mlockall(MCL_FUTURE); + + + server.hw_coding=0; + + openlog (ps_progname ,LOG_PID, LOG_LOCAL2); + + if (! (ret = woomera_startup(argc, argv))) { + exit(0); + } + ret = main_thread(); + + woomera_shutdown(); + + return ret; +} + +/** EMACS ** + * Local variables: + * mode: C + * c-basic-offset: 4 + * End: + */ + diff --git a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.13.tmp b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.13.tmp new file mode 100644 index 0000000..ae92204 --- /dev/null +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.13.tmp @@ -0,0 +1,5020 @@ +/********************************************************************************* + * sangoma_mgd.c -- Sangoma Media Gateway Daemon for Sangoma/Wanpipe Cards + * + * Copyright 05-08, Nenad Corbic + * Anthony Minessale II + * + * This program is free software, distributed under the terms of + * the GNU General Public License + * + * ============================================= + * v1.27 Nenad Corbic + * Jan 24 2007 + * Fixed a memory leak on incoming calls + * Removed the use of server listener which + * was not used + * + * v1.26 Nenad Corbic + * Jan 18 2007 + * Fixed hangup after invalid Answer or Ack Session + * Can cause double use of setup id - now fixed + * Update on autoacm on accept check for acked. + * + * v1.25 Nenad Corbic + * Dec 31 2007 + * Removed UDP Resync it can cause skb_over errors. + * Moved RDNIS message to higher debug level + * + * v1.24 Nenad Corbic + * Nov 30 2007 + * Bug fix on return code on ALL ckt busy + * + * v1.23 Nenad Corbic + * Bug fix on socket open. Check for retun code >= 0 + * + * v1.22 Nenad Corbic + * Nov 27 2007 + * Updated DTMF Tx function + * Fixed - dtmf tx without voice + * Fxied - dtmf clipping. + * + * v1.21 Nenad Corbic + * Nov 25 2007 + * Major unit testing of each state + * Numerous bug fixes for non autoacm mode. + * Changed "Channel-Name" to tg/cic + * Added compile option WANPIPE_CHAN_NAME to change Asterisk channel + * name of chan_woomera.so. So one can use Dial(SS7/g1/${EXTE}) + * instead of WOOMERA (for example) + * + * v1.20 Nenad Corbic + * Added option for Auto ACM response mode. + * + * v1.19 Nenad Corbic + * Configurable DTMF + * Bug fix in release codes (all ckt busy) + * + * v1.18 Nenad Corbic + * Added new rel cause support based on + * digits instead of strings. + * + * v1.17 Nenad Corbic + * Added session support + * + * v1.16 Nenad Corbic + * Added hwec disable on loop ccr + * + * v1.15 Nenad Corbic + * Updated DTMF Locking + * Added delay between digits + * + * v1.14 Nenad Corbic + * Updated DTMF Library + * Fixed DTMF synchronization + * + * v1.13 Nenad Corbic + * Woomera OPAL Dialect + * Added Congestion control + * Added SCTP + * Added priority ISUP queue + * Fixed presentation + * + * v1.12 Nenad Corbic + * Fixed CCR + * Removed socket shutdown on end call. + * Let Media thread shutodwn sockets. + * + * v1.11 Nenad Corbic + * Fixed Remote asterisk/woomera connection + * Increased socket timeouts + * + * v1.10 Nenad Corbic + * Added Woomera OPAL dialect. + * Start montor thread in priority + * + * v1.9 Nenad Corbic + * Added Loop mode for ccr + * Added remote debug enable + * Fixed syslog logging. + * + * v1.8 Nenad Corbic + * Added a ccr loop mode for each channel. + * Boost can set any channel in loop mode + * + * v1.7 Nenad Corbic + * Pass trunk group number to incoming call + * chan woomera will use it to append to context + * name. Added presentation feature. + * + * v1.6 Nenad Corbic + * Use only ALAW and MLAW not SLIN. + * This reduces the load quite a bit. + * Send out ALAW/ULAW format on HELLO message. + * RxTx Gain is done now in chan_woomera. + * + * v1.5 Nenad Corbic + * Bug fix in START_NACK_ACK handling. + * When we receive START_NACK we must alwasy pull tank before + * we send out NACK_ACK this way we will not try to send NACK + * ourself. + *********************************************************************************/ + +#include "sangoma_mgd.h" +#include "q931_cause.h" + + +#define USE_SYSLOG 1 +#define CODEC_LAW_DEFAULT 1 + +#ifdef CODEC_LAW_DEFAULT +static uint32_t codec_sample=8; +#else +static uint32_t codec_sample=16; +#endif + +static char ps_progname[]="sangoma_mgd"; + +static struct woomera_interface woomera_dead_dev; + +#if 0 +#define DOTRACE +#endif + + +#define SMG_VERSION "v1.27" + +/* enable early media */ +#if 1 +#define WOOMERA_EARLY_MEDIA 1 +#endif + + +#define SMG_DTMF_ON 60 +#define SMG_DTMF_OFF 10 +#define SMG_DTMF_RATE 8000 + +#if 0 +#define MEDIA_SOCK_SHUTDOWN 1 +#endif + +#ifdef DOTRACE +static int tc = 0; +#endif + +#if 0 +#warning "NENAD: HPTDM API" +#define WP_HPTDM_API 1 +#else +#undef WP_HPTDM_API +#endif + +#ifdef WP_HPTDM_API +hp_tdm_api_span_t *hptdmspan[WOOMERA_MAX_SPAN]; +#endif + +#define SMG_CALLING_NAME 1 + +const char WELCOME_TEXT[] = +"================================================================================\n" +"Sangoma Media Gateway Daemon v1.27 \n" +"TDM Signal Media Gateway for Sangoma/Wanpipe Cards\n" +"Copyright 2005, 2006, 2007 \n" +"Nenad Corbic , Anthony Minessale II \n" +"This program is free software, distributed under the terms of\n" +"the GNU General Public License\n" +"================================================================================\n" +""; + + +static int master_reset=0; + +static int coredump=1; +static int autoacm=1; + +static int launch_media_tdm_thread(struct woomera_interface *woomera); +static int launch_woomera_thread(struct woomera_interface *woomera); +static struct woomera_interface *alloc_woomera(void); + +q931_cause_to_str_array_t q931_cause_to_str_array[255]; + + +#if 0 +static uint32_t string_to_release(char *code) +{ + if (code) { + if (!strcasecmp(code, "CHANUNAVAIL")) { + return SIGBOOST_RELEASE_CAUSE_NOANSWER; + } + + if (!strcasecmp(code, "INVALID")) { + return SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST; + } + + if (!strcasecmp(code, "ERROR")) { + return SIGBOOST_RELEASE_CAUSE_UNDEFINED; + } + + if (!strcasecmp(code, "CONGESTION")) { + //return SIGBOOST_RELEASE_CAUSE_BUSY; + return SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST; + } + + if (!strcasecmp(code, "BUSY")) { + return SIGBOOST_RELEASE_CAUSE_BUSY; + } + + if (!strcasecmp(code, "NOANSWER")) { + return SIGBOOST_RELEASE_CAUSE_NOANSWER; + } + + if (!strcasecmp(code, "ANSWER")) { + return SIGBOOST_RELEASE_CAUSE_NORMAL; + } + + if (!strcasecmp(code, "CANCEL")) { + return SIGBOOST_RELEASE_CAUSE_BUSY; + } + + if (!strcasecmp(code, "UNKNOWN")) { + return SIGBOOST_RELEASE_CAUSE_UNDEFINED; + } + + } + return SIGBOOST_RELEASE_CAUSE_NORMAL; +} + +static char * release_to_string(uint32_t rel_cause) +{ + switch (rel_cause) { + + case SIGBOOST_RELEASE_CAUSE_UNDEFINED: + return "UNKNOWN"; + case SIGBOOST_RELEASE_CAUSE_NORMAL: + return "NORMAL"; + case SIGBOOST_RELEASE_CAUSE_BUSY: + return "BUSY"; + case SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST: + return "CHANUNAVAIL"; + case SIGBOOST_RELEASE_CAUSE_CIRCUIT_RESET: + return "CANCEL"; + case SIGBOOST_RELEASE_CAUSE_NOANSWER: + return "NOANSWER"; + case SIGBOOST_CALL_SETUP_NACK_CKT_START_TIMEOUT: + return "TIMEOUT"; + case SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY: + return "CONGESTION"; + case SIGBOOST_CALL_SETUP_NACK_CALLED_NUM_TOO_BIG: + return "ERROR"; + case SIGBOOST_CALL_SETUP_NACK_CALLING_NUM_TOO_BIG: + return "ERROR"; + case SIGBOOST_CALL_SETUP_NACK_CALLED_NUM_TOO_SMALL: + return "ERROR"; + case SIGBOOST_CALL_SETUP_NACK_CALLING_NUM_TOO_SMALL: + return "ERROR"; + } + + return "NORMAL"; +} +#endif + + + +void __log_printf(int level, FILE *fp, char *file, const char *func, int line, char *fmt, ...) +{ + char *data; + int ret = 0; + va_list ap; + + if (socket < 0) { + return; + } + + if (level && level > server.debug) { + return; + } + + va_start(ap, fmt); +#ifdef SOLARIS + data = (char *) malloc(2048); + vsnprintf(data, 2048, fmt, ap); +#else + ret = vasprintf(&data, fmt, ap); +#endif + va_end(ap); + if (ret == -1) { + fprintf(stderr, "Memory Error\n"); + } else { + char date[80] = ""; + struct tm now; + time_t epoch; + + if (time(&epoch) && localtime_r(&epoch, &now)) { + strftime(date, sizeof(date), "%Y-%m-%d %T", &now); + } + +#ifdef USE_SYSLOG + syslog(LOG_DEBUG | LOG_LOCAL2, data); +#else + fprintf(fp, "[%d] %s %s:%d %s() %s", getpid(), date, file, line, func, data); +#endif + free(data); + } +#ifndef USE_SYSLOG + fflush(fp); +#endif +} + + + + +static int isup_exec_command(int span, int chan, int id, int cmd, int cause) +{ + call_signal_event_t oevent; + int retry=5; + + call_signal_event_init(&oevent, cmd, chan, span); + oevent.release_cause = cause; + + if (id >= 0) { + oevent.call_setup_id = id; + } +isup_exec_cmd_retry: + if (call_signal_connection_write(&server.mcon, &oevent) <= 0){ + + --retry; + if (retry <= 0) { + log_printf(0, server.log, + "Critical System Error: Failed to tx on ISUP socket: %s\n", + strerror(errno)); + return -1; + } else { + log_printf(0, server.log, + "System Warning: Failed to tx on ISUP socket: %s :retry %i\n", + strerror(errno),retry); + } + + goto isup_exec_cmd_retry; + } + + return 0; +} + +static int socket_printf(int socket, char *fmt, ...) +{ + char *data; + int ret = 0; + va_list ap; + + if (socket < 0) { + return -1; + } + + va_start(ap, fmt); +#ifdef SOLARIS + data = (char *) malloc(2048); + vsnprintf(data, 2048, fmt, ap); +#else + ret = vasprintf(&data, fmt, ap); +#endif + va_end(ap); + if (ret == -1) { + fprintf(stderr, "Memory Error\n"); + log_printf(0, server.log, "Crtical ERROR: Memory Error!\n"); + } else { + int err; + int len = strlen(data); + err=send(socket, data, strlen(data), 0); + if (err != strlen(data)) { + log_printf(2, server.log, "ERROR: Failed to send data to woomera socket(%i): err=%i len=%d %s\n", + socket,err,len,strerror(errno)); + ret = err; + } else { + ret = 0; + } + + free(data); + } + + return ret; +} + + + +static int woomera_next_pair(struct woomera_config *cfg, char **var, char **val) +{ + int ret = 0; + char *p, *end; + + *var = *val = NULL; + + for(;;) { + cfg->lineno++; + + if (!fgets(cfg->buf, sizeof(cfg->buf), cfg->file)) { + ret = 0; + break; + } + + *var = cfg->buf; + + if (**var == '[' && (end = strchr(*var, ']'))) { + *end = '\0'; + (*var)++; + strncpy(cfg->category, *var, sizeof(cfg->category) - 1); + continue; + } + + if (**var == '#' || **var == '\n' || **var == '\r') { + continue; + } + + if ((end = strchr(*var, '#'))) { + *end = '\0'; + end--; + } else if ((end = strchr(*var, '\n'))) { + if (*end - 1 == '\r') { + end--; + } + *end = '\0'; + } + + p = *var; + while ((*p == ' ' || *p == '\t') && p != end) { + *p = '\0'; + p++; + } + *var = p; + + if (!(*val = strchr(*var, '='))) { + ret = -1; + log_printf(0, server.log, "Invalid syntax on %s: line %d\n", cfg->path, cfg->lineno); + continue; + } else { + p = *val - 1; + *(*val) = '\0'; + (*val)++; + if (*(*val) == '>') { + *(*val) = '\0'; + (*val)++; + } + + while ((*p == ' ' || *p == '\t') && p != *var) { + *p = '\0'; + p--; + } + + p = *val; + while ((*p == ' ' || *p == '\t') && p != end) { + *p = '\0'; + p++; + } + *val = p; + ret = 1; + break; + } + } + + return ret; + +} + + +#if 0 +static void woomera_set_span_chan(struct woomera_interface *woomera, int span, int chan) +{ + pthread_mutex_lock(&woomera->vlock); + woomera->span = span; + woomera->chan = chan; + pthread_mutex_unlock(&woomera->vlock); + +} +#endif + + +static struct woomera_event *new_woomera_event_printf(struct woomera_event *ebuf, char *fmt, ...) +{ + struct woomera_event *event = NULL; + int ret = 0; + va_list ap; + + if (ebuf) { + event = ebuf; + } else if (!(event = new_woomera_event())) { + log_printf(0, server.log, "Memory Error queuing event!\n"); + return NULL; + } else { + return NULL; + } + + va_start(ap, fmt); +#ifdef SOLARIS + event->data = (char *) malloc(2048); + vsnprintf(event->data, 2048, fmt, ap); +#else + ret = vasprintf(&event->data, fmt, ap); +#endif + va_end(ap); + if (ret == -1) { + log_printf(0, server.log, "Memory Error queuing event!\n"); + destroy_woomera_event(&event, EVENT_FREE_DATA); + return NULL; + } + + return event; + +} + +static struct woomera_event *woomera_clone_event(struct woomera_event *event) +{ + struct woomera_event *clone; + + if (!(clone = new_woomera_event())) { + return NULL; + } + + memcpy(clone, event, sizeof(*event)); + clone->next = NULL; + clone->data = strdup(event->data); + + return clone; +} + +static void enqueue_event(struct woomera_interface *woomera, + struct woomera_event *event, + event_args free_data) +{ + struct woomera_event *ptr, *clone = NULL; + + assert(woomera != NULL); + assert(event != NULL); + + if (!(clone = woomera_clone_event(event))) { + log_printf(0, server.log, "Error Cloning Event\n"); + return; + } + + pthread_mutex_lock(&woomera->queue_lock); + + for (ptr = woomera->event_queue; ptr && ptr->next ; ptr = ptr->next); + + if (ptr) { + ptr->next = clone; + } else { + woomera->event_queue = clone; + } + + pthread_mutex_unlock(&woomera->queue_lock); + + woomera_set_flag(woomera, WFLAG_EVENT); + + if (free_data && event->data) { + /* The event has been duplicated, the original data + * should be freed */ + free(event->data); + event->data=NULL; + } +} + +static char *dequeue_event(struct woomera_interface *woomera) +{ + struct woomera_event *event; + char *data = NULL; + + if (!woomera) { + return NULL; + } + + pthread_mutex_lock(&woomera->queue_lock); + if (woomera->event_queue) { + event = woomera->event_queue; + woomera->event_queue = event->next; + data = event->data; + pthread_mutex_unlock(&woomera->queue_lock); + + destroy_woomera_event(&event, EVENT_KEEP_DATA); + return data; + } + pthread_mutex_unlock(&woomera->queue_lock); + + return data; +} + + +static int enqueue_event_on_listeners(struct woomera_event *event) +{ + struct woomera_listener *ptr; + int x = 0; + + assert(event != NULL); + + pthread_mutex_lock(&server.listen_lock); + for (ptr = server.listeners ; ptr ; ptr = ptr->next) { + enqueue_event(ptr->woomera, event, EVENT_KEEP_DATA); + x++; + } + pthread_mutex_unlock(&server.listen_lock); + + return x; +} + + +static void del_listener(struct woomera_interface *woomera) +{ + struct woomera_listener *ptr, *last = NULL; + + pthread_mutex_lock(&server.listen_lock); + for (ptr = server.listeners ; ptr ; ptr = ptr->next) { + if (ptr->woomera == woomera) { + if (last) { + last->next = ptr->next; + } else { + server.listeners = ptr->next; + } + free(ptr); + break; + } + last = ptr; + } + pthread_mutex_unlock(&server.listen_lock); +} + +static void add_listener(struct woomera_interface *woomera) +{ + struct woomera_listener *new; + + pthread_mutex_lock(&server.listen_lock); + + if ((new = malloc(sizeof(*new)))) { + memset(new, 0, sizeof(*new)); + new->woomera = woomera; + new->next = server.listeners; + server.listeners = new; + } else { + log_printf(0, server.log, "Memory Error adding listener!\n"); + } + + pthread_mutex_unlock(&server.listen_lock); +} + + + +static int wanpipe_send_dtmf(struct woomera_interface *woomera, char *digits) +{ + struct media_session *ms = woomera_get_ms(woomera); + char *cur = NULL; + int wrote = 0; + int err; + + if (!ms) { + return -EINVAL; + } + + if (!ms->dtmf_buffer) { + log_printf(3, woomera->log, "Allocate DTMF Buffer...."); + + err=switch_buffer_create_dynamic(&ms->dtmf_buffer, 1024, server.dtmf_size, 0); + + if (err != 0) { + log_printf(0, woomera->log, "Failed to allocate DTMF Buffer!\n"); + return -ENOMEM; + } else { + log_printf(3, woomera->log, "SUCCESS!\n"); + } + + } + + log_printf(3, woomera->log, "Sending DTMF %s\n",digits); + for (cur = digits; *cur; cur++) { + if ((wrote = teletone_mux_tones(&ms->tone_session, + &ms->tone_session.TONES[(int)*cur]))) { + + pthread_mutex_lock(&woomera->dtmf_lock); + + err=switch_buffer_write(ms->dtmf_buffer, ms->tone_session.buffer, wrote * 2); + + pthread_mutex_unlock(&woomera->dtmf_lock); + + log_printf(3, woomera->log, "Sending DTMF %s Wrote=%i (err=%i)\n", + digits,wrote*2,err); + } else { + log_printf(0, woomera->log, "Error: Sending DTMF %s (err=%i)\n", + digits,wrote); + } + } + + ms->skip_read_frames = 200; + return 0; +} + +static struct woomera_interface *alloc_woomera(void) +{ + struct woomera_interface *woomera = NULL; + + if ((woomera = malloc(sizeof(struct woomera_interface)))) { + + memset(woomera, 0, sizeof(struct woomera_interface)); + + woomera->chan = -1; + woomera->span = -1; + woomera->log = server.log; + woomera->debug = server.debug; + woomera->call_id = 1; + woomera->event_queue = NULL; + woomera->q931_rel_cause_topbx=SIGBOOST_RELEASE_CAUSE_NORMAL; + woomera->q931_rel_cause_tosig=SIGBOOST_RELEASE_CAUSE_NORMAL; + + woomera_set_interface(woomera, "w-1g-1"); + + + + } + + return woomera; + +} + + +static struct woomera_interface *new_woomera_interface(int socket, struct sockaddr_in *sock_addr, int len) +{ + struct woomera_interface *woomera = NULL; + + if (socket < 0) { + log_printf(0, server.log, "Critical: Invalid Socket on new interface!\n"); + return NULL; + } + + if ((woomera = alloc_woomera())) { + if (socket >= 0) { + no_nagle(socket); + woomera->socket = socket; + } + + if (sock_addr && len) { + memcpy(&woomera->addr, sock_addr, len); + } + } + + return woomera; + +} + +static char *woomera_message_header(struct woomera_message *wmsg, char *key) +{ + int x = 0; + char *value = NULL; + + for (x = 0 ; x < wmsg->last ; x++) { + if (!strcasecmp(wmsg->names[x], key)) { + value = wmsg->values[x]; + break; + } + } + + return value; +} + + +#if 1 + +static int waitfor_socket(int fd, int timeout, int flags) +{ + struct pollfd pfds[1]; + int res; + + memset(&pfds[0], 0, sizeof(pfds[0])); + pfds[0].fd = fd; + pfds[0].events = flags; + res = poll(pfds, 1, timeout); + + if (res > 0) { + if(pfds[0].revents & POLLIN) { + res = 1; + } else if ((pfds[0].revents & POLLERR)) { + res = -1; + } else if ((pfds[0].revents & POLLNVAL)) { + res = -2; +#if 0 + log_printf(0, server.log,"System Warning: Poll Event NVAL (0x%X) (fd=%i)!\n", + pfds[0].revents, fd); +#endif + } else { +#if 0 + log_printf(0, server.log,"System Error: Poll Event Error no event (0x%X) (fd=%i)!\n", + pfds[0].revents,fd); +#endif + res = -1; + } + } + + return res; +} + + +static int waitfor_tx_socket(int fd, int timeout, int flags) +{ + struct pollfd pfds[1]; + int res; + + memset(&pfds[0], 0, sizeof(pfds[0])); + pfds[0].fd = fd; + pfds[0].events = flags; + res = poll(pfds, 1, timeout); + + if (res > 0) { + if (pfds[0].revents & POLLOUT) { + res = 1; + } else if ((pfds[0].revents & POLLERR)) { + res = -1; + } else if ((pfds[0].revents & POLLNVAL)) { + res = -2; +#if 0 + log_printf(0, server.log,"System Warning: Poll Event NVAL (0x%X) (fd=%i)!\n", + pfds[0].revents, fd); +#endif + } else { +#if 0 + log_printf(0, server.log,"System Error: Poll Event Error no event (0x%X) (fd=%i)!\n", + pfds[0].revents,fd); +#endif + res = -1; + } + } + + return res; +} + + +#else + +static int waitfor_socket(int fd, int timeout, int flags) +{ + struct pollfd pfds[1]; + int res; + int errflags = (POLLERR | POLLHUP | POLLNVAL); + + memset(&pfds[0], 0, sizeof(pfds[0])); + pfds[0].fd = fd; + pfds[0].events = flags | errflags; + res = poll(pfds, 1, timeout); + + if (res > 0) { + if(pfds[0].revents & POLLIN) { + res = 1; + } else if ((pfds[0].revents & errflags)) { + res = -1; + } else { +#if 0 + log_printf(0, server.log,"System Error: Poll Event Error no event (0x%X)!\n", + pfds[0].revents); +#endif + res = -1; + } + } + + return res; +} + +#endif + +#if 1 +static int waitfor_2sockets(int fda, int fdb, char *a, char *b, int timeout) +{ + struct pollfd pfds[2]; + int res = 0; + int errflags = (POLLERR | POLLHUP | POLLNVAL); + + if (fda < 0 || fdb < 0) { + return -1; + } + + *a=0; + *b=0; + + memset(pfds, 0, sizeof(pfds)); + pfds[0].fd = fda; + pfds[1].fd = fdb; + pfds[0].events = POLLIN | errflags; + pfds[1].events = POLLIN | errflags; + if ((res = poll(pfds, 2, timeout)) > 0) { + res = 1; + if ((pfds[0].revents & errflags) || (pfds[1].revents & errflags)) { + res = -1; + } else { + if ((pfds[0].revents & POLLIN)) { + *a=1; + res++; + } + if ((pfds[1].revents & POLLIN)) { + *b=1; + res++; + } + } + + if (res == 1) { + /* No event found what to do */ + res=-1; + } + } + + return res; +} +#endif + + +static struct media_session *media_session_new(struct woomera_interface *woomera) +{ + struct media_session *ms = NULL; + int x; + char *p; + int span,chan; + + span=woomera->span; + chan=woomera->chan; + + log_printf(2, server.log,"Starting new MEDIA session [%s] [%s]\n", + woomera->interface,woomera->raw?woomera->raw:"N/A"); + + if ((ms = malloc(sizeof(struct media_session)))) { + memset(ms, 0, sizeof(struct media_session)); + + if (woomera->loop_tdm != 1) { + for(x = 0; x < strlen(woomera->raw) ; x++) { + if (woomera->raw[x] == ':') { + break; + } + if (woomera->raw[x] == '/') { + break; + } + } + + ms->ip = strndup(woomera->raw, x); + time(&ms->started); + p = woomera->raw + (x+1); + ms->port = atoi(p); + } + + time(&ms->started); + woomera_set_ms(woomera,ms); + ms->woomera = woomera; + + /* Setup artificial DTMF stuff */ + memset(&ms->tone_session, 0, sizeof(ms->tone_session)); + if (teletone_init_session(&ms->tone_session, 0, NULL, NULL)) { + log_printf(0, server.log, "ERROR: Failed to initialize TONE [w%ig%i]!\n", + span+1,chan+1); + } + + ms->tone_session.rate = SMG_DTMF_RATE; + ms->tone_session.duration = server.dtmf_on * (ms->tone_session.rate / 1000); + ms->tone_session.wait = server.dtmf_off * (ms->tone_session.rate / 1000); + + teletone_dtmf_detect_init (&ms->dtmf_detect, SMG_DTMF_RATE); + + } else { + log_printf(0, server.log, "ERROR: Memory Alloc Failed [w%ig%i]!\n", + span+1,chan+1); + } + + return ms; +} + +static void media_session_free(struct media_session *ms) +{ + if (ms->ip) { + free(ms->ip); + } + + teletone_destroy_session(&ms->tone_session); + switch_buffer_destroy(&ms->dtmf_buffer); + + ms->woomera = NULL; + + free(ms); +} + + +static int create_udp_socket(struct media_session *ms, char *local_ip, int local_port, char *ip, int port) +{ + int rc; + struct hostent *result, *local_result; + char buf[512], local_buf[512]; + int err = 0; + + log_printf(5,server.log,"LocalIP %s:%d IP %s:%d \n",local_ip, local_port, ip, port); + + memset(&ms->remote_hp, 0, sizeof(ms->remote_hp)); + memset(&ms->local_hp, 0, sizeof(ms->local_hp)); + if ((ms->socket = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) { + gethostbyname_r(ip, &ms->remote_hp, buf, sizeof(buf), &result, &err); + gethostbyname_r(local_ip, &ms->local_hp, local_buf, sizeof(local_buf), &local_result, &err); + if (result && local_result) { + ms->remote_addr.sin_family = ms->remote_hp.h_addrtype; + memcpy((char *) &ms->remote_addr.sin_addr.s_addr, ms->remote_hp.h_addr_list[0], ms->remote_hp.h_length); + ms->remote_addr.sin_port = htons(port); + + ms->local_addr.sin_family = ms->local_hp.h_addrtype; + memcpy((char *) &ms->local_addr.sin_addr.s_addr, ms->local_hp.h_addr_list[0], ms->local_hp.h_length); + ms->local_addr.sin_port = htons(local_port); + + rc = bind(ms->socket, (struct sockaddr *) &ms->local_addr, sizeof(ms->local_addr)); + if (rc < 0) { + close(ms->socket); + ms->socket = -1; + + log_printf(5,server.log, + "Failed to bind LocalIP %s:%d IP %s:%d (%s)\n", + local_ip, local_port, ip, port,strerror(errno)); + } + + /* OK */ + + } else { + log_printf(0,server.log, + "Failed to get hostbyname LocalIP %s:%d IP %s:%d (%s)\n", + local_ip, local_port, ip, port,strerror(errno)); + } + } else { + log_printf(0,server.log, + "Failed to create/allocate UDP socket\n"); + } + + return ms->socket; +} + +static int next_media_port(void) +{ + int port; + + pthread_mutex_lock(&server.media_udp_port_lock); + port = ++server.next_media_port; + if (port > WOOMERA_MAX_MEDIA_PORT) { + server.next_media_port = WOOMERA_MIN_MEDIA_PORT; + port = WOOMERA_MIN_MEDIA_PORT; + } + pthread_mutex_unlock(&server.media_udp_port_lock); + + return port; +} + + + +static int woomera_dtmf_transmit(struct media_session *ms, int mtu) +{ + struct woomera_interface *woomera = ms->woomera; + int bread; + unsigned char dtmf[1024]; + unsigned char dtmf_law[1024]; + sangoma_api_hdr_t hdrframe; + int i; + int slin_len = mtu*2; + short *data; + int used; + int res; + int err; + int txdtmf=0; + memset(&hdrframe,0,sizeof(hdrframe)); + + if (!ms->dtmf_buffer) { + return -1; + } + + for (;;) { + + if ((used=switch_buffer_inuse(ms->dtmf_buffer)) <= 0) { + break; + } + + res = waitfor_tx_socket(ms->sangoma_sock, -1, POLLERR | POLLOUT); + if (res <= 0) { + break; + } + +#ifdef CODEC_LAW_DEFAULT + + pthread_mutex_lock(&woomera->dtmf_lock); + if ((used=switch_buffer_inuse(ms->dtmf_buffer)) <= 0) { + pthread_mutex_unlock(&woomera->dtmf_lock); + break; + } + + bread = switch_buffer_read(ms->dtmf_buffer, dtmf, slin_len); + pthread_mutex_unlock(&woomera->dtmf_lock); + + if (bread <= 0) { + break; + } + + log_printf(3,woomera->log,"%s: Write DTMF Got %d bytes MTU=%i Coding=%i Used=%i\n", + woomera->interface,bread,mtu,ms->hw_coding,used); + + data=(short*)dtmf; + for (i=0;ihw_coding) { + /* ALAW */ + dtmf_law[i] = linear_to_alaw((int)data[i]); + } else { + /* ULAW */ + dtmf_law[i] = linear_to_ulaw((int)data[i]); + } + } + + err=sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + dtmf_law, mtu, 0); + + if (err != mtu) { + log_printf(0, woomera->log, "Error: Failed to TX to TDM API on DTMF (err=%i mtu=%i)!\n",err,mtu); + } + + txdtmf++; + ms->skip_write_frames++; +#else +... + pthread_mutex_lock(&woomera->dtmf_lock); + bread = switch_buffer_read(ms->dtmf_buffer, dtmf, mtu); + pthread_mutex_unlock(&woomera->dtmf_lock); + + log_printf(3,woomera->log,"%s: Write DTMF Got %d bytes\n", + woomera->interface,bread); + + sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + dtmf, mtu, 0); + txdtmf++; + ms->skip_write_frames++; +#endif + + } + + if (txdtmf) { + return 0; + } else { + return -1; + } +} + +static void media_loop_run(struct media_session *ms) +{ + struct woomera_interface *woomera = ms->woomera; + int sangoma_frame_len = 160; + int errs=0; + int res=0; + wanpipe_tdm_api_t tdm_api; + unsigned char circuit_frame[1024]; + char filename[100]; + FILE *filed=NULL; + int loops=0; + + sangoma_api_hdr_t hdrframe; + memset(&hdrframe,0,sizeof(hdrframe)); + memset(circuit_frame,0,sizeof(circuit_frame)); + + ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1); + + log_printf(1, server.log, "Media Loop Started %s fd=%i\n", + woomera->interface,ms->sangoma_sock); + + if (ms->sangoma_sock < 0) { + log_printf(0, server.log, "WANPIPE MEDIA Socket Error (%s) if=[%s] [w%ig%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); + errs++; + } else { + + + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_NONE) < 0 ) { + errs++; + } + + if (sangoma_tdm_flush_bufs(ms->sangoma_sock, &tdm_api)) { + errs++; + } + + if (sangoma_tdm_set_usr_period(ms->sangoma_sock, &tdm_api, 20) < 0 ) { + errs++; + } + + sangoma_frame_len = sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + sangoma_tdm_disable_hwec(ms->sangoma_sock,&tdm_api); + + } + + if (errs) { + + log_printf(0, server.log, "Media Loop: failed to open tdm device %s\n", + woomera->interface); + return; + } + + if (server.loop_trace) { + sprintf(filename,"/smg/w%ig%i-loop.trace",woomera->span+1,woomera->chan+1); + unlink(filename); + filed = safe_fopen(filename, "w"); + } + + while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + ((res = waitfor_socket(ms->sangoma_sock, 1000, POLLERR | POLLIN)) >= -2)) { + + if (res == 0) { + //log_printf(4, server.log, "%s: TDM UDP Timeout !!!\n", + // woomera->interface); + /* NENAD Timeout thus just continue */ + continue; + } + + if (res == -2) { + close_socket(&ms->sangoma_sock); + ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1); + log_printf(0, server.log, "Media Loop Restart %s\n", + woomera->interface); + continue; + } + + if (res < 0 ){ + log_printf(0, server.log, "Media Loop Socket error %s\n", + woomera->interface); + break; + } + + res = sangoma_readmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + sizeof(circuit_frame), 0); + if (res < 0) { + log_printf(0, server.log, "TDM Loop ReadMsg Error: %s\n", + strerror(errno), woomera->interface); + break; + } + + if (server.loop_trace && filed != NULL) { + int i; + for (i=0;isangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + res, 0); + + res=0; + + loops++; + } + + + if (res < 0) { + log_printf(2, server.log, "Media Loop: socket error %s (fd=%i)!\n", + woomera->interface, ms->sangoma_sock); + } + + + if (server.loop_trace && filed != NULL) { + fclose(filed); + } + + sangoma_tdm_enable_hwec(ms->sangoma_sock,&tdm_api); + + sleep(1); + + close_socket(&ms->sangoma_sock); + + log_printf(1, server.log, "Media Loop Finished %s Master=%i MediaEnd=%i Loops=%i\n", + woomera->interface, + woomera_test_flag(&server.master_connection, WFLAG_RUNNING), + woomera_test_flag(woomera, WFLAG_MEDIA_END),loops); + + return; + +} + +#ifdef WP_HPTDM_API +static int media_rx_ready(void *p, unsigned char *data, int len) +{ + struct media_session *ms = (struct media_session *)p; + + if (ms->udp_sock < 0) { + return -1; + } + + return sendto(ms->udp_sock, + data,len, 0, + (struct sockaddr *) &ms->remote_addr, + sizeof(ms->remote_addr)); + + +} +#endif + +static void *media_thread_run(void *obj) +{ + struct media_session *ms = obj; + struct woomera_interface *woomera = ms->woomera; + int sangoma_frame_len = 160; + int local_port, x = 0, errs = 0, res = 0, packet_len = 0; + //int udp_cnt=0; + struct woomera_event wevent; + wanpipe_tdm_api_t tdm_api; + FILE *tx_fd=NULL; + int sock_timeout=200; + + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || + !woomera->interface || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(2, server.log, + "MEDIA session for [%s] Cancelled! (ptr=%p)\n", + woomera->interface,woomera); + /* In this case the call will be closed via woomera_thread_run + * function. And the process table will be cleard there */ + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + media_session_free(ms); + pthread_exit(NULL); + return NULL; + } + + + log_printf(2, server.log, "MEDIA session for [%s] started (ptr=%p loop=%i)\n", + woomera->interface,woomera,woomera->loop_tdm); + + if (woomera->loop_tdm) { + media_loop_run(ms); + ms->udp_sock=-1; + woomera_set_flag(woomera, WFLAG_HANGUP); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + goto media_thread_exit; + } + + for(x = 0; x < 1000 ; x++) { + local_port = next_media_port(); + if ((ms->udp_sock = create_udp_socket(ms, server.media_ip, local_port, ms->ip, ms->port)) > -1) { + break; + } + } + + if (ms->udp_sock < 0) { + log_printf(0, server.log, "UDP Socket Error (%s) [%s] LocalPort=%d\n", + strerror(errno), woomera->interface, local_port); + + errs++; + } else { + +#ifdef WP_HPTDM_API + hp_tdm_api_span_t *span=hptdmspan[woomera->span+1]; + if (!span || !span->init) { + errs++; + } else { + hp_tdm_api_usr_callback_t usr_callback; + memset(&usr_callback,0,sizeof(usr_callback)); + usr_callback.p = ms; + usr_callback.rx_avail = media_rx_ready; + if (span->open_chan(span, &usr_callback, &ms->tdmchan,woomera->chan+1)) { + errs++; + } + } +#else + if ((ms->sangoma_sock = sangoma_create_socket_by_name(woomera->interface, NULL)) < 0) { + log_printf(0, server.log, "WANPIPE Socket Error (%s) if=[%s] [w%ig%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); + errs++; + } else { + +# ifdef CODEC_LAW_DEFAULT + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_NONE) < 0 ) { + errs++; + } +# else + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_SLINEAR) < 0 ) { + errs++; + } +# endif + if (sangoma_tdm_flush_bufs(ms->sangoma_sock, &tdm_api)) { + errs++; + } + + if (sangoma_tdm_set_usr_period(ms->sangoma_sock, &tdm_api, 20) < 0 ) { + errs++; + } + +# ifdef CODEC_LAW_DEFAULT +# ifdef LIBSANGOMA_GET_HWCODING + ms->hw_coding=sangoma_tdm_get_hw_coding(ms->sangoma_sock, &tdm_api); + if (ms->hw_coding < 0) { + errs++; + } +# else +# error "libsangoma missing hwcoding feature: not up to date!" +# endif +# endif + + sangoma_frame_len = sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + } +#endif + } + + + +#ifdef WP_HPTDM_API + /* No tdm thread */ +#else + if (!errs && + launch_media_tdm_thread(woomera)) { + errs++; + } +#endif + + if (!errs) { + + unsigned char udp_frame[4096]; + sangoma_api_hdr_t hdrframe; + memset(&hdrframe,0,sizeof(hdrframe)); + memset(udp_frame,0,sizeof(udp_frame)); +#ifdef DOTRACE + int fdin, fdout; + char path_in[512], path_out[512]; +#endif + + + +#if 0 + new_woomera_event_printf(&wevent, + "EVENT MEDIA %s AUDIO%s" + "Raw-Audio: %s:%d%s" + "Call-ID: %s%s" + "Raw-Format: %s%s" + , + woomera->interface, + WOOMERA_LINE_SEPERATOR, + server.media_ip, + local_port, + WOOMERA_LINE_SEPERATOR, + woomera->interface, + WOOMERA_LINE_SEPERATOR, + ms->hw_coding ?"ALAW":"ULAW", + WOOMERA_RECORD_SEPERATOR + ); +#else + new_woomera_event_printf(&wevent, + "EVENT MEDIA %s AUDIO%s" + "Unique-Call-Id: %s%s" + "Raw-Audio: %s:%d%s" + "Call-ID: %s%s" + "Raw-Format: PCM-16%s" + , + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + server.media_ip, + local_port, + WOOMERA_LINE_SEPERATOR, + woomera->interface, + WOOMERA_LINE_SEPERATOR, + WOOMERA_RECORD_SEPERATOR + ); +#endif + + + enqueue_event(woomera, &wevent, EVENT_FREE_DATA); + +#ifdef DOTRACE + sprintf(path_in, "/tmp/debug-in.%d.raw", tc); + sprintf(path_out, "/tmp/debug-out.%d.raw", tc++); + fdin = open(path_in, O_WRONLY | O_CREAT, O_TRUNC, 0600); + fdout = open(path_out, O_WRONLY | O_CREAT, O_TRUNC, 0600); +#endif + + if (server.out_tx_test) { + tx_fd=fopen("/smg/sound.raw","rb"); + if (!tx_fd){ + log_printf(0,server.log, "FAILED TO OPEN Sound file!\n"); + } + } + + + while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + !woomera_test_flag(woomera, WFLAG_HANGUP) && + (res = waitfor_socket(ms->udp_sock, sock_timeout, POLLERR | POLLIN)) >= 0) { + + unsigned int fromlen = sizeof(struct sockaddr_in); + + + if (res == 0) { + + if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) { + sock_timeout=(sangoma_frame_len/codec_sample); + } else { + sock_timeout=200; + } + + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + } + + log_printf(4, server.log, "%s: UDP Sock Timeout !!!\n", + woomera->interface); + /* NENAD Timeout thus just continue */ + continue; + } + + if ((packet_len = recvfrom(ms->udp_sock, udp_frame, sizeof(udp_frame), + MSG_DONTWAIT, (struct sockaddr *) &ms->local_addr, &fromlen)) < 1) { + log_printf(2, server.log, "UDP Recv Error: %s\n",strerror(errno)); + break; + } + +#if 0 + log_printf(6, server.log, "%s: UDP Receive %i !!!\n", + woomera->interface,packet_len); +#endif + + if (packet_len > 0) { + +#if 0 +/* NC: This can cause skb_over panic must be retested */ + if (packet_len != sangoma_frame_len && ms->udp_sync_cnt <= 5) { + /* Assume that we will always receive SLINEAR here */ + sangoma_tdm_set_usr_period(ms->sangoma_sock, + &tdm_api, packet_len/codec_sample); + sangoma_frame_len = + sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + log_printf(3, server.log, + "%s: UDP TDM Period ReSync to Len=%i %ims (udp=%i) \n", + woomera->interface,sangoma_frame_len, + sangoma_frame_len/codec_sample,packet_len); + + + if (++ms->udp_sync_cnt >= 6) { + sangoma_tdm_set_usr_period(ms->sangoma_sock, + &tdm_api, 20); + sangoma_frame_len = + sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + log_printf(0, server.log, + "%s: UDP TDM Period Force ReSync to 20ms \n", + woomera->interface); + } + + } +#endif + if (!server.out_tx_test) { + + if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) { + sock_timeout=(sangoma_frame_len/codec_sample); + /* For sanity sake if we are doing the out test + * dont take any chances force tx udp data */ + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + } + continue; + } else { + sock_timeout=200; + } + + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + continue; + } + + } + + if (server.out_tx_test && tx_fd && + fread((void*)udp_frame, + sizeof(char), + packet_len,tx_fd) <= 0) { + + sangoma_get_full_cfg(ms->sangoma_sock,&tdm_api); + fclose(tx_fd); + tx_fd=NULL; + } + +#ifdef WP_HPTDM_API + if (ms->tdmchan->push) { + ms->tdmchan->push(ms->tdmchan,udp_frame,packet_len); + } +#else + sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + udp_frame, + packet_len, 0); +#endif + + } + +#if 0 + if (woomera->span == 1 && woomera->chan == 1) { + udp_cnt++; + if (udp_cnt && udp_cnt % 1000 == 0) { + log_printf(0, server.log, "%s: MEDIA UDP TX RX CNT %i %i\n", + woomera->interface,udp_cnt,packet_len); + } + } +#endif + } + + if (res < 0) { + log_printf(2, server.log, "Media Thread: socket error !\n"); + } + } + + + + new_woomera_event_printf(&wevent, + "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Start-Time: %ld%s" + "End-Time: %ld%s" + "Answer-Time: %ld%s" + "Call-ID: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + + woomera->session, + WOOMERA_LINE_SEPERATOR, + + time(&ms->started), + WOOMERA_LINE_SEPERATOR, + + time(NULL), + WOOMERA_LINE_SEPERATOR, + + time(&ms->answered), + WOOMERA_LINE_SEPERATOR, + + woomera->interface, + WOOMERA_LINE_SEPERATOR, + + q931_rel_to_str(woomera->q931_rel_cause_topbx), + WOOMERA_LINE_SEPERATOR, + + woomera->q931_rel_cause_topbx, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + +media_thread_exit: + + if (woomera_test_flag(woomera, WFLAG_MEDIA_TDM_RUNNING)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + while(woomera_test_flag(woomera, WFLAG_MEDIA_TDM_RUNNING)) { + usleep(1000); + sched_yield(); + } + } + + + close_socket(&ms->udp_sock); + close_socket(&ms->sangoma_sock); + + if (tx_fd){ + fclose(tx_fd); + tx_fd=NULL; + } + + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + + woomera_set_ms(woomera,NULL); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + + media_session_free(ms); + + log_printf(2, server.log, "MEDIA session for [%s] ended (ptr=%p)\n", + woomera->interface,woomera); + + + pthread_exit(NULL); + return NULL; +} + + + + +static void *media_tdm_thread_run(void *obj) +{ + struct media_session *ms = obj; + struct woomera_interface *woomera = ms->woomera; + int res = 0; + //int tdm_cnt=0; + //wanpipe_tdm_api_t tdm_api; + unsigned char circuit_frame[1024]; + sangoma_api_hdr_t hdrframe; + + memset(&hdrframe,0,sizeof(hdrframe)); + memset(circuit_frame,0,sizeof(circuit_frame)); + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || !woomera->interface) { + log_printf(2, server.log, "MEDIA TDM session for [%s] Cancelled! (ptr=%p)\n", + woomera->interface,woomera); + /* In this case the call will be closed via woomera_thread_run + * function. And the process table will be cleard there */ + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + pthread_exit(NULL); + return NULL; + } + + log_printf(2, server.log, "MEDIA TDM session for [%s] started (ptr=%p)\n", + woomera->interface,woomera); + + + while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + (res = waitfor_socket(ms->sangoma_sock, 1000, POLLERR | POLLIN)) >= -2) { + + if (res == 0) { + //log_printf(4, server.log, "%s: TDM UDP Timeout !!!\n", + // woomera->interface); + /* NENAD Timeout thus just continue */ + continue; + } else if (res == -2) { + close_socket(&ms->sangoma_sock); + ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1); + if (ms->sangoma_sock < 0) { + log_printf(0, server.log, "Media TDM Restart Failed%s\n", + woomera->interface); + break; + } + log_printf(0, server.log, "Media TDM Restart %s\n", + woomera->interface); + continue; + } else if (res < 0) { + log_printf(0, server.log, "Media TDM Sangoma Socket Error %s\n", + woomera->interface); + break; + } + + res = sangoma_readmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + sizeof(circuit_frame), 0); + if (res < 0) { + log_printf(0, server.log, "TDM ReadMsg Error: %s\n", strerror(errno)); + break; + } + + res = sendto(ms->udp_sock, + circuit_frame, + res, 0, + (struct sockaddr *) &ms->remote_addr, + sizeof(ms->remote_addr)); + + if (res < 0) { + log_printf(2, server.log, "UDP Sento Error: %s\n", strerror(errno)); + break; + } +#if 0 + if (woomera->span == 1 && woomera->chan == 1) { + tdm_cnt++; + if (tdm_cnt && tdm_cnt % 1000 == 0) { + log_printf(0, server.log, "%s: MEDIA TDM TX RX CNT %i %i\n", + woomera->interface,tdm_cnt,res); + } + } +#endif + } + + if (res < 0) { + log_printf(2, server.log, "Media TDM Thread: socket error !\n"); + } + + log_printf(2, server.log, "MEDIA TDM session for [%s] ended (ptr=%p)\n", + woomera->interface,woomera); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + + pthread_exit(NULL); + return NULL; + +} + + +/* This function must be called with process_lock + * because it modifies shared process_table */ + +static int launch_media_thread(struct woomera_interface *woomera) +{ + pthread_attr_t attr; + int result = -1; + struct media_session *ms; + + if ((ms = media_session_new(woomera))) { + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_MEDIA_RUNNING); + result = pthread_create(&ms->thread, &attr, media_thread_run, ms); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + media_session_free(woomera->ms); + + } + pthread_attr_destroy(&attr); + + } else { + log_printf(0, server.log, "Failed to start new media session\n"); + } + + return result; + +} + +static int launch_media_tdm_thread(struct woomera_interface *woomera) +{ + pthread_attr_t attr; + int result = -1; + struct media_session *ms = woomera_get_ms(woomera); + + if (!ms) { + return result; + } + + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + result = pthread_create(&ms->thread, &attr, media_tdm_thread_run, ms); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + + +static struct woomera_interface * launch_woomera_loop_thread(call_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + char callid[20]; + + sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + + if ((woomera = alloc_woomera())) { + + woomera->chan = event->chan; + woomera->span = event->span; + woomera->log = server.log; + woomera->debug = server.debug; + woomera->call_id = 1; + woomera->event_queue = NULL; + woomera->loop_tdm=1; + + } else { + log_printf(0, server.log, "Critical ERROR: memory/socket error\n"); + return NULL; + } + + woomera_set_interface(woomera,callid); + + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = woomera; + pthread_mutex_unlock(&server.process_lock); + + if (launch_woomera_thread(woomera)) { + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + free(woomera); + log_printf(0, server.log, "Critical ERROR: memory/socket error\n"); + return NULL; + } + + return woomera; +} + +static int woomera_message_parse(struct woomera_interface *woomera, struct woomera_message *wmsg, int timeout) +{ + char *cur, *cr, *next = NULL, *eor = NULL; + char buf[2048]; + int res = 0, bytes = 0, sanity = 0; + struct timeval started, ended; + int elapsed, loops = 0; + int failto = 0; + int packet = 0; + + memset(wmsg, 0, sizeof(*wmsg)); + + if (woomera->socket < 0 ) { + log_printf(2, woomera->log, WOOMERA_DEBUG_PREFIX "%s Invalid Socket! %d\n", + woomera->interface,woomera->socket); + return -1; + } + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(5, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MEDIA END or HANGUP !\n", + woomera->interface); + return -1; + } + + gettimeofday(&started, NULL); + memset(buf, 0, sizeof(buf)); + + if (timeout < 0) { + timeout = abs(timeout); + failto = 1; + } else if (timeout == 0) { + timeout = -1; + } + + + while (!(eor = strstr(buf, WOOMERA_RECORD_SEPERATOR))) { + if (sanity > 1000) { + log_printf(2, woomera->log, WOOMERA_DEBUG_PREFIX "%s Failed Sanity Check!\n[%s]\n\n", woomera->interface, buf); + return -1; + } + + if ((res = waitfor_socket(woomera->socket, 1000, POLLERR | POLLIN) > 0)) { + res = recv(woomera->socket, buf, sizeof(buf), MSG_PEEK); + + if (res > 1) { + packet++; + } + if (!strncmp(buf, WOOMERA_LINE_SEPERATOR, 2)) { + res = read(woomera->socket, buf, 2); + return 0; + } + if (res == 0) { + sanity++; + /* Looks Like it's time to go! */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(5, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MEDIA END or HANGUP \n", woomera->interface); + return -1; + } + ysleep(1000); + continue; + + } else if (res < 0) { + log_printf(3, woomera->log, WOOMERA_DEBUG_PREFIX + "%s error during packet retry (err=%i) Loops#%d (%s)\n", + woomera->interface, res, loops, + strerror(errno)); + return res; + } else if (loops) { + ysleep(100000); + } + } + + gettimeofday(&ended, NULL); + elapsed = (((ended.tv_sec * 1000) + ended.tv_usec / 1000) - ((started.tv_sec * 1000) + started.tv_usec / 1000)); + + if (res < 0) { + log_printf(2, woomera->log, WOOMERA_DEBUG_PREFIX "%s Bad RECV\n", + woomera->interface); + return res; + } else if (res == 0) { + sanity++; + /* Looks Like it's time to go! */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(5, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MEDIA END or HANGUP \n", woomera->interface); + return -1; + } + ysleep(1000); + continue; + } + + if (packet && loops > 150) { + log_printf(1, woomera->log, WOOMERA_DEBUG_PREFIX + "%s Timeout waiting for packet.\n", + woomera->interface); + return -1; + } + + if (timeout > 0 && (elapsed > timeout)) { + log_printf(1, woomera->log, WOOMERA_DEBUG_PREFIX + "%s Timeout [%d] reached\n", + woomera->interface, timeout); + return failto ? -1 : 0; + } + + if (woomera_test_flag(woomera, WFLAG_EVENT)) { + /* BRB! we have an Event to deliver....*/ + return 0; + } + + /* what're we still doing here? */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + !woomera_test_flag(woomera, WFLAG_RUNNING)) { + log_printf(2, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MASTER RUNNING or RUNNING!\n", woomera->interface); + return -1; + } + loops++; + } + + *eor = '\0'; + bytes = strlen(buf) + 4; + + memset(buf, 0, sizeof(buf)); + res = read(woomera->socket, buf, bytes); + next = buf; + + if (woomera->debug > 1) { + log_printf(3, woomera->log, "%s:WOOMERA RX MSG: %s\n",woomera->interface,buf); + + } + + while ((cur = next)) { + + if ((cr = strstr(cur, WOOMERA_LINE_SEPERATOR))) { + *cr = '\0'; + next = cr + (sizeof(WOOMERA_LINE_SEPERATOR) - 1); + if (!strcmp(next, WOOMERA_RECORD_SEPERATOR)) { + break; + } + } + if (!cur || !*cur) { + break; + } + + if (!wmsg->last) { + char *cmd, *id, *args; + woomera_set_flag(wmsg, MFLAG_EXISTS); + cmd = cur; + + if ((id = strchr(cmd, ' '))) { + *id = '\0'; + id++; + if ((args = strchr(id, ' '))) { + *args = '\0'; + args++; + strncpy(wmsg->command_args, args, sizeof(wmsg->command_args)-1); + } + strncpy(wmsg->callid, id, sizeof(wmsg->callid)-1); + } + + strncpy(wmsg->command, cmd, sizeof(wmsg->command)-1); + } else { + char *name, *val; + name = cur; + + if ((val = strchr(name, ':'))) { + *val = '\0'; + val++; + while (*val == ' ') { + *val = '\0'; + val++; + } + strncpy(wmsg->values[wmsg->last-1], val, WOOMERA_STRLEN); + } + strncpy(wmsg->names[wmsg->last-1], name, WOOMERA_STRLEN); + if (name && val && !strcasecmp(name, "content-type")) { + woomera_set_flag(wmsg, MFLAG_CONTENT); + bytes = atoi(val); + } + if (name && val && !strcasecmp(name, "content-length")) { + woomera_set_flag(wmsg, MFLAG_CONTENT); + bytes = atoi(val); + } + + + } + wmsg->last++; + } + + wmsg->last--; + + if (bytes && woomera_test_flag(wmsg, MFLAG_CONTENT)) { + read(woomera->socket, wmsg->body, + (bytes > sizeof(wmsg->body)) ? sizeof(wmsg->body) : bytes); + } + + return woomera_test_flag(wmsg, MFLAG_EXISTS); + +} + +static struct woomera_interface *pull_from_holding_tank(int index, int span , int chan) +{ + struct woomera_interface *woomera = NULL; + + if (index < 1 || index >= CORE_TANK_LEN) { + if (index != 0) { + log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return NULL; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] && + server.holding_tank[index] != &woomera_dead_dev) { + woomera = server.holding_tank[index]; + + /* Block this index until the call is completed */ + server.holding_tank[index] = &woomera_dead_dev; + + woomera->timeout = 0; + woomera->index = 0; + woomera->span=span; + woomera->chan=chan; + } + pthread_mutex_unlock(&server.ht_lock); + + return woomera; +} + +static void clear_from_holding_tank(int index, struct woomera_interface *woomera) +{ + + if (index < 1 || index >= CORE_TANK_LEN) { + if (index != 0) { + log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] == &woomera_dead_dev) { + server.holding_tank[index] = NULL; + } else if (woomera && server.holding_tank[index] == woomera) { + server.holding_tank[index] = NULL; + } else if (server.holding_tank[index]) { + log_printf(0, server.log, "Error: Holding tank index %i not cleared %p !\n", + index, server.holding_tank[index]); + } + pthread_mutex_unlock(&server.ht_lock); + + return; +} + +static struct woomera_interface *peek_from_holding_tank(int index) +{ + struct woomera_interface *woomera = NULL; + + if (index < 1 || index >= CORE_TANK_LEN) { + if (index != 0) { + log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return NULL; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] && + server.holding_tank[index] != &woomera_dead_dev) { + woomera = server.holding_tank[index]; + } + pthread_mutex_unlock(&server.ht_lock); + + return woomera; +} + +static int add_to_holding_tank(struct woomera_interface *woomera) +{ + int next, i, found=0; + + pthread_mutex_lock(&server.ht_lock); + + for (i=0;i= CORE_TANK_LEN) { + next = server.holding_tank_index = 1; + } + + if (next == 0) { + log_printf(0, server.log, "\nCritical Error on TANK INDEX == 0\n"); + continue; + } + + if (server.holding_tank[next]) { + continue; + } + + found=1; + break; + } + + if (!found) { + /* This means all tank vales are busy + * should never happend */ + pthread_mutex_unlock(&server.ht_lock); + log_printf(0, server.log, "\nCritical Error failed to obtain a TANK INDEX\n"); + return 0; + } + + server.holding_tank[next] = woomera; + woomera->timeout = time(NULL) + 100; + + pthread_mutex_unlock(&server.ht_lock); + return next; +} + +static int handle_woomera_media_accept_answer(struct woomera_interface *woomera, + struct woomera_message *wmsg, + int media, int answer, int accept) +{ + char *raw = woomera_message_header(wmsg, "raw-audio"); + + log_printf(4, woomera->log, "WOOMERA CMD: %s [%s]\n", + wmsg->command, woomera->interface); + + + if (woomera_test_flag(woomera, WFLAG_HANGUP) || + !woomera_test_flag(woomera, WFLAG_RUNNING) || + woomera_test_flag(woomera, WFLAG_MEDIA_END)) { + + log_printf(2, server.log, + "ERROR! call was cancelled MEDIA on HANGUP or MEDIA END!\n"); + + woomera->timeout=0; + return -1; + } + + log_printf(3, server.log,"WOOMERA: GOT %s EVENT: [%s] RAW=%s\n", + wmsg->command,wmsg->callid,raw); + + + if (raw && + woomera->raw == NULL && + !woomera_test_flag(woomera, WFLAG_RAW_MEDIA_STARTED)) { + + woomera_set_flag(woomera, WFLAG_RAW_MEDIA_STARTED); + + woomera_set_raw(woomera, raw); + + if (launch_media_thread(woomera)) { + struct woomera_event wevent; + + log_printf(4, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); + +#if 0 + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); +#endif + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_RECORD_SEPERATOR + ); + + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + woomera->timeout=0; + return -1; + } + } + + if (!woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + log_printf(0, server.log,"ERROR! Monitor Thread not running!\n"); + + } else { + + if (accept) { + if (!autoacm && !woomera_test_flag(woomera,WFLAG_CALL_ACKED)) { + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + isup_exec_command(woomera->span, + woomera->chan, + -1, + SIGBOOST_EVENT_CALL_START_ACK, + 0); + } + } + + if (answer) { + struct media_session *ms; + + pthread_mutex_lock(&woomera->ms_lock); + if ((ms=woomera->ms)) { + time(&woomera->ms->answered); + } + pthread_mutex_unlock(&woomera->ms_lock); + + if (ms) { + + if (!autoacm && !woomera_test_flag(woomera,WFLAG_CALL_ACKED)) { + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + isup_exec_command(woomera->span, + woomera->chan, + -1, + SIGBOOST_EVENT_CALL_START_ACK, + 0); + } + + isup_exec_command(woomera->span, + woomera->chan, + -1, + SIGBOOST_EVENT_CALL_ANSWERED, + 0); + log_printf(2, server.log, + "Sent SIGBOOST_EVENT_CALL_ANSWERED [w%dg%d]\n", + woomera->span+1,woomera->chan+1); + } else { + struct woomera_event wevent; + log_printf(0, server.log, + "WOOMERA ANSWER: FAILED [%s] no Media \n", + wmsg->command,wmsg->callid); + + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + woomera->timeout=0; + return -1; + } + } + } + + { + struct woomera_event wevent; + new_woomera_event_printf(&wevent, "200 %s OK%s" + "Unique-Call-Id: %s%s", + answer ? "ANSWER" : + accept ? "ACCEPT" : "MEDIA", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + } + + return 0; +} + +static int handle_woomera_call_start (struct woomera_interface *woomera, + struct woomera_message *wmsg) +{ + char *raw = woomera_message_header(wmsg, "raw-audio"); + call_signal_event_t event; + char *calling = woomera_message_header(wmsg, "local-number"); +#ifdef SMG_CALLING_NAME + char *calling_name = woomera_message_header(wmsg, "local-name"); +#endif + char *presentation = woomera_message_header(wmsg, "Presentation"); + char *screening = woomera_message_header(wmsg, "Screening"); + char *rdnis = woomera_message_header(wmsg, "RDNIS"); + char *called = wmsg->callid; + char *grp = wmsg->callid; + char *p; + int cause = 34; + int tg = 0; + + if (smg_check_all_busy()) { + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, + "405 SMG Server All Ckt Busy!%s", WOOMERA_RECORD_SEPERATOR); + log_printf(3, woomera->log, "SMG Server Full %d (ckt busy cnt=%i)\n", + server.call_count, server.all_ckt_busy); + return -1; + } + + log_printf(2, woomera->log, "New Call %d/%d\n", server.call_count, server.max_calls); + + if ((p = strchr(called, '/'))) { + *p = '\0'; + called = p+1; + tg = atoi(grp+1) - 1; + if (tg < 0) { + tg=0; + } + } + + woomera->trunk_group=tg; + + if (raw) { + woomera_set_raw(woomera, raw); + } + + woomera->index = add_to_holding_tank(woomera); + if (woomera->index < 1) { + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, + "405 SMG Server All Tanks Busy!%s", + WOOMERA_RECORD_SEPERATOR); + log_printf(0, woomera->log, "Error: Call Tank Full (Call Cnt=%i)\n", + server.call_count); + return -1; + } + + + woomera->index_hold = woomera->index; + + call_signal_call_init(&event, calling, called, woomera->index); + + if (presentation) { + event.calling_number_presentation = atoi(presentation); + } else { + event.calling_number_presentation = 0; + } + + if (screening) { + event.calling_number_screening_ind = atoi(screening); + } else { + event.calling_number_screening_ind = 0; + } + + if (rdnis && strlen(rdnis)) { + strncpy((char*)event.redirection_string,rdnis, + sizeof(event.redirection_string)-1); + log_printf(3,server.log,"RDNIS %s\n", rdnis); + + } + +#ifdef SMG_CALLING_NAME + if (calling_name) { + strncpy((char*)event.calling_name,calling_name, + sizeof(event.calling_name)-1); + } +#endif + + event.trunk_group = tg; + + + if (call_signal_connection_write(&server.mcon, &event) <= 0) { + log_printf(0, server.log, + "Critical System Error: Failed to tx on ISUP socket [%s]: %s\n", + strerror(errno)); + + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, + "405 SMG Signalling Contestion!%s", + WOOMERA_RECORD_SEPERATOR); + return -1; + } + + socket_printf(woomera->socket, "100 Trying%s", WOOMERA_RECORD_SEPERATOR); + + log_printf(2, server.log, "Call Called Event [Setup ID: %d] TG=%d\n", + woomera->index,tg); + + return 0; +} + + +static void interpret_command(struct woomera_interface *woomera, struct woomera_message *wmsg) +{ + int answer = 0, media = 0, accept=0; + char *unique_id; + int cause=0; + + + + if (!strcasecmp(wmsg->command, "call")) { + int err; + if (strlen(woomera->session) != 0) { + /* Call has already been placed */ + socket_printf(woomera->socket, "400 Error Call already in progress %s", + WOOMERA_RECORD_SEPERATOR); + log_printf(0,server.log,"Woomera RX Call Even while call in progress!\n"); + return; + } + + err=handle_woomera_call_start(woomera,wmsg); + if (err) { + woomera_set_flag(woomera, WFLAG_HANGUP); + } + + return; + + } else if (!strcasecmp(wmsg->command, "bye") || !strcasecmp(wmsg->command, "quit")) { + char *cause = woomera_message_header(wmsg, "cause"); + char *q931cause = woomera_message_header(wmsg, "Q931-Cause-Code"); + + if (cause) { + log_printf(3, woomera->log, "Bye Cause Received: [%s]\n", cause); + } + if (q931cause && atoi(q931cause)) { + woomera_set_cause_tosig(woomera,atoi(q931cause)); + } + + log_printf(2, woomera->log, "WOOMERA CMD: Bye Received: [%s]\n", woomera->interface); + + woomera_clear_flag(woomera, WFLAG_RUNNING); + socket_printf(woomera->socket, "200 Connection closed%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + return; + + } else if (!strcasecmp(wmsg->command, "listen")) { + + if (woomera_test_flag(woomera, WFLAG_LISTENING)) { + socket_printf(woomera->socket, "405 Listener already started%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + } else { + + woomera_set_flag(woomera, WFLAG_LISTENING); + add_listener(woomera); + + if (!strcmp(wmsg->callid,"MASTER")) { + woomera_set_flag(woomera, WFLAG_MASTER_DEV); + log_printf(0,woomera->log, "Starting MASTER Listen Device!\n"); + master_reset=0; + } + + + socket_printf(woomera->socket, "%s", + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "200 Listener enabled%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + } + return; + + } else if ((media = !strcasecmp(wmsg->command, "debug"))) { + + int debug_level=atoi(wmsg->callid); + + if (debug_level < 10) { + server.debug=debug_level; + log_printf(0,server.log,"SMG Debugging set to %i (window=%i)\n",server.debug,server.mcon.txwindow); + } + + return; + } + + + unique_id = woomera_message_header(wmsg, "Unique-Call-Id"); + if (!unique_id) { + + cause=111; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, "400 Woomera cmd without uniquie id%s" + WOOMERA_RECORD_SEPERATOR); + + log_printf(2,server.log,"Woomera RX Event (%s) without unique id!\n",wmsg->command); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + if (strlen(woomera->session) == 0) { + struct woomera_interface *session_woomera=NULL; + char *session=NULL; + int span, chan; + char ifname[100]; + /* If session does not exist this is an incoming call */ + sscanf(unique_id, "w%dg%d", &span, &chan); + span--; + chan--; + + log_printf(3, woomera->log, + "WOOMERA Got CMD %s Span=%d Chan=%d from session %s\n", + wmsg->command,span,chan,unique_id); + + if (smg_validate_span_chan(span,chan) != 0) { + + cause=34; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, "404 Invalid span/chan in session%s" + WOOMERA_RECORD_SEPERATOR); + + log_printf(2, woomera->log, + "WOOMERA Warning invalid span chan in session %s %s\n", + wmsg->command,unique_id); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + pthread_mutex_lock(&server.process_lock); + session = server.process_table[span][chan].session; + session_woomera = server.process_table[span][chan].dev; + + if (session_woomera) { + pthread_mutex_unlock(&server.process_lock); + + cause=34; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, "404 Session not found%s" + WOOMERA_RECORD_SEPERATOR); + + + log_printf(0, woomera->log, "WOOMERA Error channel in use %s %s\n", + wmsg->command,unique_id); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + if (!session || strlen(session) == 0 || + strncmp(session,unique_id,sizeof(woomera->session))){ + pthread_mutex_unlock(&server.process_lock); + + cause=34; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "404 Invalid/Expired Session%s" + WOOMERA_RECORD_SEPERATOR); + + log_printf(3, woomera->log, + "WOOMERA Warning: Cmd=%s with invalid session %s (orig=%s)\n", + wmsg->command,unique_id,session?session:"N/A"); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + server.process_table[span][chan].dev=woomera; + strncpy(woomera->session,unique_id,sizeof(woomera->session)); + sprintf(ifname,"w%dg%d",span+1,chan+1); + woomera_set_interface(woomera, ifname); + + woomera->span=span; + woomera->chan=chan; + + pthread_mutex_unlock(&server.process_lock); + + + log_printf(3, woomera->log, "WOOMERA Got New If=%s Session %s\n", + woomera->interface, woomera->session); + + + } else if (strncmp(woomera->session,unique_id,sizeof(woomera->session))) { + + cause=34; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "404 Session Mis-match%s" + WOOMERA_RECORD_SEPERATOR); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + + if (!strcasecmp(wmsg->command, "dtmf")) { + + log_printf(3, woomera->log, "WOOMERA CMD: DTMF Received: [%s] Digit %s Body %s\n", + woomera->interface, wmsg->command_args, wmsg->body); + + wanpipe_send_dtmf(woomera,wmsg->body); + + socket_printf(woomera->socket, "200 DTMF OK%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + + } else if (!strcasecmp(wmsg->command, "hangup")) { + + int chan = -1, span = -1; + char *cause = woomera_message_header(wmsg, "cause"); + char *q931cause = woomera_message_header(wmsg, "Q931-Cause-Code"); + + + if (q931cause && atoi(q931cause)) { + woomera_set_cause_tosig(woomera,atoi(q931cause)); + } + + span=woomera->span; + chan=woomera->chan; + + log_printf(3, woomera->log, "WOOMERA CMD: Hangup Received: [%s] MEDIA EXIST Cause=%s\n", + woomera->interface,cause); + + if (smg_validate_span_chan(span,chan) != 0) { + + socket_printf(woomera->socket, "405 No Such Channel%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + return; + } + + + log_printf(2, woomera->log, "Hangup Received: [w%dg%d]\n", + span+1,chan+1); + + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + + socket_printf(woomera->socket, "200 HANGUP OK%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + + } else if (!strcasecmp(wmsg->command, "proceed")) { + + log_printf(3, woomera->log, "WOOMERA CMD: %s [%s]\n", + wmsg->command, woomera->interface); + + socket_printf(woomera->socket, + "200 %s PROCEED OK%s" + "Unique-Call-Id: %s%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + } else if ((media = !strcasecmp(wmsg->command, "media")) || + (answer = !strcasecmp(wmsg->command, "answer")) || + (accept = !strcasecmp(wmsg->command, "accept"))) { + + handle_woomera_media_accept_answer(woomera, wmsg, media,answer,accept); + + + + } else { + log_printf(0, server.log,"WOOMERA INVALID EVENT: %s [%s] \n", + wmsg->command,wmsg->callid); + socket_printf(woomera->socket, "501 Command '%s' not implemented%s", + wmsg->command, WOOMERA_RECORD_SEPERATOR); + } +} + + +/* + EVENT INCOMING 1 + Remote-Address: 10.3.3.104 + Remote-Number: + Remote-Name: Anthony Minessale!8668630501 + Protocol: H.323 + User-Agent: Post Increment Woomera 1.0alpha1 (OpenH323 v1.17.2) 9/61 + H323-Call-Id: 887b1ff8-bb1f-da11-85c0-0007e98988c4 + Local-Number: 996 + Start-Time: Fri, 09 Sep 2005 12:25:14 -0400 + Local-Name: root +*/ + + +static void handle_call_answer(call_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + int kill = 0; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + char callid[80]; + struct woomera_event wevent; + + if (!woomera->raw) { + log_printf(1, server.log, "Refusing to answer call with no media!\n"); + kill++; + goto handle_call_answer_end; + } + + if (woomera_test_flag(woomera, WFLAG_ANSWER)) { + log_printf(1, server.log, "Refusing to double-answer a call!\n"); + kill++; + goto handle_call_answer_end; + } + + woomera_set_flag(woomera, WFLAG_ANSWER); + + if (woomera->span != event->span || woomera->chan != event->chan) { + log_printf(1, server.log, "Refusing to start media on a different channel from the one we agreed on.!\n"); + kill++; + goto handle_call_answer_end; + } + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(1, server.log, "Refusing to answer a dead call!\n"); + kill++; + } else { + int err; + err=0; + sprintf(callid, "w%dg%d", event->span + 1, event->chan + 1); + woomera_set_interface(woomera, callid); +#ifndef WOOMERA_EARLY_MEDIA + err=launch_media_thread(woomera); + if (err) { + log_printf(0, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); +#if 0 + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); +#endif + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Q931-Cause-Code: %d%s" + "Cause: %s%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + + + kill++; + } +#endif + + if (!kill) { + new_woomera_event_printf(&wevent, "EVENT CONNECT w%dg%d%s" + "Unique-Call-Id: %s%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + } + } + } else { + log_printf(1, server.log, "Answer requested on non-existant session. [w%dg%d]\n", + event->span+1, event->chan+1); + kill++; + } + +handle_call_answer_end: + + if (kill) { + if (woomera) { + woomera_set_flag(woomera,WFLAG_MEDIA_END); + } else { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + SIGBOOST_RELEASE_CAUSE_NORMAL); + + log_printf(1, server.log, "Sent CALL STOP to Answer without session [w%dg%d]\n", + event->span+1, event->chan+1); + } + } +} + +static void handle_call_start_ack(call_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + struct woomera_event wevent; + int kill = 0; + + if ((woomera = peek_from_holding_tank(event->call_setup_id))) { + char callid[80]; + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(1, server.log, "Refusing to ack a dead call!\n"); + kill++; + } else { + int err, span, chan; + + pull_from_holding_tank(event->call_setup_id,event->span,event->chan); + sprintf(callid, "w%dg%d", event->span + 1, event->chan + 1); + + span = event->span; + chan = event->chan; + + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + woomera_set_interface(woomera, callid); + + pthread_mutex_lock(&server.process_lock); + server.process_table[span][chan].dev = woomera; + sprintf(woomera->session,"%s-%i-%i",callid,rand(),rand()); + sprintf(server.process_table[span][chan].session,"%s-%s", + callid,woomera->session); + pthread_mutex_unlock(&server.process_lock); + + + +#ifdef WOOMERA_EARLY_MEDIA + err=launch_media_thread(woomera); + if (err) { + log_printf(0, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); + + +#if 0 + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); +#endif + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id:%s%s" + "Q931-Cause-Code: %d%s" + "Cause: %s%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + kill++; + } +#endif + if (!kill) { + new_woomera_event_printf(&wevent, "201 Accepted%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "EVENT PROCEED w%dg%d%s" + "Channel-Name: g%d/%d%s" + "Unique-Call-Id: %s%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->trunk_group+1, + (event->span*31)+event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + log_printf(2, server.log, "Call Answered Event ID = %d Device = w%dg%d!\n", + event->call_setup_id,woomera->span+1,woomera->chan+1); + } + } + } else { + log_printf(1, server.log, + "Event (START ACK) %d referrs to a non-existant session (%d) [w%dg%d]!\n", + event->event_id, event->call_setup_id,event->span+1, event->chan+1); + kill++; + } + + if (kill) { + if (woomera) { + woomera_set_flag(woomera,WFLAG_MEDIA_END); + } else { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + SIGBOOST_RELEASE_CAUSE_NORMAL); + + log_printf(1, server.log, "Sent CALL STOP to CALL START ACK without session [w%dg%d]\n", + event->span+1, event->chan+1); + } + } +} + +static void handle_call_start_nack(call_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + int span=-1, chan=-1; + int ack=0; + + /* Always ACK the incoming NACK + * Send out the NACK ACK before pulling the TANK, because + * if we send after the pull, the outgoing call could send + * a message to boost with the pulled TANK value before + * we send a NACK ACK */ + + if (smg_validate_span_chan(event->span,event->chan) == 0) { + span=event->span; + chan=event->chan; + } + + if (event->call_setup_id > 0) { + woomera=peek_from_holding_tank(event->call_setup_id); + } + + if (woomera) { + + struct woomera_event wevent; + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(0, server.log, "Event CALL START NACK on hungup call [%d]!\n", + event->call_setup_id); + ack++; + } else { + + woomera_set_cause_topbx(woomera,event->release_cause); + woomera_set_flag(woomera, (WFLAG_HANGUP|WFLAG_HANGUP_NACK_ACK)); + + new_woomera_event_printf(&wevent, "EVENT HANGUP w%dg%d%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(woomera->q931_rel_cause_topbx), + WOOMERA_LINE_SEPERATOR, + woomera->q931_rel_cause_topbx, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + + woomera_set_flag(woomera, WFLAG_HANGUP); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + /* Do not ack here, let woomera thread ack it */ + ack=0; + } + + + } else if (event->call_setup_id == 0 && + smg_validate_span_chan(event->span,event->chan) == 0) { + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + + if (woomera) { + if (!woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT) && + !woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK_SENT)) { + /* Only if we are not already waiting for hangup */ + server.process_table[event->span][event->chan].dev=NULL; + } else if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + /* At this point call is already hang up */ + woomera=NULL; + } else { + /* At this point call is already hang up */ + woomera=NULL; + } + } + + memset(server.process_table[event->span][event->chan].session, + 0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + + if (woomera) { + + log_printf(2, server.log, "Event START NACK on w%dg%d ptr=%p ms=%p\n", + woomera->span+1,woomera->chan+1,woomera,woomera->ms); + + if (!woomera_test_flag(woomera,WFLAG_HANGUP)){ + woomera_set_cause_topbx(woomera,event->release_cause); + } + + woomera_set_flag(woomera, + (WFLAG_HANGUP|WFLAG_MEDIA_END|WFLAG_HANGUP_NACK_ACK)); + + /* Nack Ack will be sent by the woomera thread */ + ack=0; + } else { + /* Valid state when we are not in autoacm mode */ + ack++; + log_printf(3, server.log, "Event: NACK no woomera on span chan [w%dg%d]!\n", + event->span+1, event->chan+1); + } + + } else { + log_printf(0, server.log, + "Error: Start Nack Invalid State Should not happen [%d] [w%dg%d]!\n", + event->call_setup_id, event->span+1, event->chan+1); + ack++; + } + + if (event->release_cause == SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY) { + log_printf(0, server.log, "WARNING: All ckt busy!\n"); + smg_all_ckt_busy(); + } + + +#warning "Ignoring CALL GAP" +#if 0 + if (event->release_cause == SIGBOOST_CALL_SETUP_NACK_AUTO_CALL_GAP) { + log_printf(0, server.log, "WARNING: Call Gapping Detected!\n"); + smg_all_ckt_gap(); + } +#endif + + if (ack) { + span=0; + chan=0; + if (smg_validate_span_chan(event->span,event->chan) == 0) { + span=event->span; + chan=event->chan; + } + + isup_exec_command(span, + chan, + event->call_setup_id, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + 0); + + if (!woomera) { + log_printf(2, server.log, "Event (NACK ACK) %d referrs to a non-existant session (%d) [w%dg%d]!\n", + event->event_id,event->call_setup_id, event->span+1, event->chan+1); + } + } +} + +static void handle_call_loop_start(call_signal_event_t *event) +{ + struct woomera_interface *woomera; + char callid[20]; + char *session; + + pthread_mutex_lock(&server.process_lock); + if (server.process_table[event->span][event->chan].dev) { + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + SIGBOOST_RELEASE_CAUSE_BUSY); + + + log_printf(1, server.log, + "Sent (From Handle Loop START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg] ptr=%d\n", + event->span+1, event->chan+1, server.process_table[event->span][event->chan].dev); + + pthread_mutex_unlock(&server.process_lock); + return; + + } + + sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + sprintf(server.process_table[event->span][event->chan].session, + "%s-%i-%i",callid,rand(),rand()); + session=server.process_table[event->span][event->chan].session; + server.process_table[event->span][event->chan].dev = NULL; + pthread_mutex_unlock(&server.process_lock); + + + woomera=launch_woomera_loop_thread(event); + if (woomera == NULL) { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + SIGBOOST_RELEASE_CAUSE_BUSY); + log_printf(1, server.log, + "Sent (From Handle Loop START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg] ptr=%d\n", + event->span+1, event->chan+1, server.process_table[event->span][event->chan].dev); + } + + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + + return; +} + +static void handle_call_start(call_signal_event_t *event) +{ + struct woomera_event wevent; + char callid[20]; + char *session; + + pthread_mutex_lock(&server.process_lock); + + if (server.process_table[event->span][event->chan].dev) { + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + SIGBOOST_RELEASE_CAUSE_BUSY); + + + log_printf(0, server.log, + "Sent (From Handle START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg%d]\n", + event->span+1, event->chan+1); + + pthread_mutex_unlock(&server.process_lock); + return; + } + + sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + sprintf(server.process_table[event->span][event->chan].session, + "%s-%i-%i",callid,rand(),rand()); + session=server.process_table[event->span][event->chan].session; + server.process_table[event->span][event->chan].dev = NULL; + pthread_mutex_unlock(&server.process_lock); + + if (autoacm) { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_ACK, + 0); + } + + new_woomera_event_printf(&wevent, "EVENT INCOMING w%dg%d%s" + "Unique-Call-Id: %s%s" + "Remote-Number: %s%s" + "Remote-Name: %s%s" +#if defined(BRI_PROT) + "Protocol: BRI%s" +#else + "Protocol: SS7%s" +#endif + "User-Agent: sangoma_mgd%s" + "Local-Number: %s%s" + "Channel-Name: g%d/%d%s" + "Trunk-Group: %d%s" + "Presentation: %d%s" + "Screening: %d%s" + "RDNIS: %s%s" + , + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + session, + WOOMERA_LINE_SEPERATOR, + event->calling_number_digits, + WOOMERA_LINE_SEPERATOR, +#ifdef SMG_CALLING_NAME + event->calling_name, +#else + "", +#endif + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + event->called_number_digits, + WOOMERA_LINE_SEPERATOR, + event->trunk_group+1, + (event->span*31)+event->chan+1, + WOOMERA_LINE_SEPERATOR, + event->trunk_group+1, + WOOMERA_LINE_SEPERATOR, + event->calling_number_presentation, + WOOMERA_LINE_SEPERATOR, + event->calling_number_screening_ind, + WOOMERA_LINE_SEPERATOR, + event->redirection_string, + WOOMERA_RECORD_SEPERATOR + ); + + if (!enqueue_event_on_listeners(&wevent)) { + + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (autoacm) { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + SIGBOOST_RELEASE_CAUSE_BUSY); + log_printf(0, server.log, + "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_STOPPED [w%dg%d]\n", + event->span+1, event->chan+1); + + } else { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + SIGBOOST_RELEASE_CAUSE_BUSY); + log_printf(0, server.log, + "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_START_NACK [w%dg%d]\n", + event->span+1, event->chan+1); + + } + + } + + destroy_woomera_event_data(&wevent); + +} + +static void handle_gap_abate(call_signal_event_t *event) +{ + log_printf(0, server.log, "NOTICE: GAP Cleared!\n", + event->span+1, event->chan+1); + smg_clear_ckt_gap(); +} + +static void handle_restart_ack(call_signal_connection_t *mcon,call_signal_event_t *event) +{ + mcon->rxseq_reset =0; +} + +static void handle_call_stop(call_signal_event_t *event) +{ + struct woomera_interface *woomera; + int ack=0; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + if (woomera) { + if (!woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT) && + !woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK_SENT)) { + /* Only if we are not already waiting for hangup */ + server.process_table[event->span][event->chan].dev=NULL; + } else if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + /* At this point call is already hangup */ + woomera=NULL; + } else { + /* At this point call is already hangup */ + woomera=NULL; + } + } + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + + woomera_set_cause_topbx(woomera,event->release_cause); + + woomera_set_flag(woomera, + (WFLAG_MEDIA_END|WFLAG_HANGUP|WFLAG_HANGUP_ACK)); + + /* We have to close the socket because + At this point we are release span chan */ + + log_printf(3, server.log, "Event CALL STOP on w%dg%d ptr=%p ms=%p\n", + woomera->span+1,woomera->chan+1,woomera,woomera->ms); + + } else { + ack++; + } + + + if (ack) { + /* At this point we have already sent our STOP so its safe to ACK */ + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED_ACK, + 0); + } + + if (!woomera){ + /* This is allowed on incoming call if remote app does not answer it */ + log_printf(3, server.log, "Event CALL STOP referrs to a non-existant session [w%dg%d]!\n", + event->span+1, event->chan+1); + } +} + +static void handle_heartbeat(call_signal_event_t *event) +{ + if (!woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + log_printf(0, server.log,"ERROR! Monitor Thread not running!\n"); + } else { + int err=call_signal_connection_write(&server.mcon, event); + if (err <= 0) { + log_printf(0, server.log, + "Critical System Error: Failed to tx on ISUP socket [%s]: %s\n", + strerror(errno)); + } + } + return; +} + +static void handle_call_stop_ack(call_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + server.process_table[event->span][event->chan].dev=NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + + if (woomera) { + log_printf(2, server.log, "Stop Ack on [w%dg%d] [Setup ID: %d] [%s]!\n", + event->span+1, event->chan+1, event->call_setup_id, + woomera->interface); + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + + } else { + log_printf(2, server.log, "Event CALL_STOP_ACK(%d) referrs to a non-existant session [w%dg%d] [Setup ID: %d]!\n", + event->event_id, event->span+1, event->chan+1, event->call_setup_id); + } + + /* No need for us to do any thing here */ + return; +} + + +static void handle_call_start_nack_ack(call_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + + if ((woomera=pull_from_holding_tank(event->call_setup_id,-1,-1))) { + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + + } else if (event->call_setup_id == 0 && + smg_validate_span_chan(event->span,event->chan) == 0) { + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + server.process_table[event->span][event->chan].dev=NULL; + memset(server.process_table[event->span][event->chan].session, + 0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + } else if (autoacm==0){ + log_printf(2, server.log, "Nack Ack on [w%dg%d] [Setup ID: %d] [%s]!\n", + event->span+1, event->chan+1, event->call_setup_id); + } else { + log_printf(0, server.log, + "Event NACK ACK [w%dg%d] with valid span/chan no dev!\n", + event->span+1, event->chan+1); + } + + } else { + log_printf(2, server.log, + "Event NACK ACK referrs to a non-existant session [w%dg%d] [Setup ID: %d]!\n", + event->span+1, event->chan+1, event->call_setup_id); + } + + if (event->call_setup_id > 0) { + clear_from_holding_tank(event->call_setup_id, NULL); + } + + /* No need for us to do any thing here */ + return; +} + +#if 0 +static void validate_number(unsigned char *s) +{ + unsigned char *p; + for (p = s; *p; p++) { + if (*p < 48 || *p > 57) { + log_printf(2, server.log, "Encountered a non-numeric character [%c]!\n", *p); + *p = '\0'; + break; + } + } +} +#endif + +static int parse_ss7_event(call_signal_connection_t *mcon, call_signal_event_t *event) +{ + int ret = 0; + +#if 0 + validate_number((unsigned char*)event->called_number_digits); + validate_number((unsigned char*)event->calling_number_digits); +#endif + +#if 1 + log_printf(2, server.log, + "RX EVENT: %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i Cd=[%s] Ci=[%s]\n", + call_signal_event_id_name(event->event_id), + event->event_id, + event->span+1, + event->chan+1, + event->release_cause, + event->call_setup_id, + event->fseqno, + (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"), + (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A") + ); +#endif + +#if 0 + log_printf(2, server.log, "RX EVENT\n"); + log_printf(2, server.log, "===================================\n"); + log_printf(2, server.log, " rType: %s (%0x HEX)\n", + call_signal_event_id_name(event->event_id),event->event_id); + log_printf(2, server.log, " rSpan: [%d]\n",event->span+1); + log_printf(2, server.log, " rChan: [%d]\n",event->chan+1); + log_printf(2, server.log, " rCalledNum: %s\n", + (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A")); + log_printf(2, server.log, " rCallingNum: %s\n", + (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A")); + log_printf(2, server.log, " rCause: %d\n",event->release_cause); + log_printf(2, server.log, " rInterface: [w%dg%d]\n",event->span+1,event->chan+1); + log_printf(2, server.log, " rEvent ID: [%d]\n",event->event_id); + log_printf(2, server.log, " rSetup ID: [%d]\n",event->call_setup_id); + log_printf(2, server.log, " rSeq: [%d]\n",event->fseqno); + log_printf(2, server.log, "===================================\n"); + +#endif + +#if 0 + log_printf(2, server.log, + "\nRX EVENT\n" + "===================================\n" + " rType: %s (%0x HEX)\n" + " rSpan: [%d]\n" + " rChan: [%d]\n" + " rCalledNum: %s\n" + " rCallingNum: %s\n" + " rCause: %s\n" + " rInterface : [w%dg%d]\n" + " rEvent ID : [%d]\n" + " rSetup ID: [%d]\n" + " rSeq: [%d]\n" + "===================================\n" + "\n", + call_signal_event_id_name(event->event_id), + event->event_id, + event->span+1, + event->chan+1, + (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"), + (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A"), + release_to_string(event->release_cause), + event->span+1, + event->chan+1, + event->event_id, + event->call_setup_id, + event->fseqno + ); +#endif + + + switch(event->event_id) { + + case SIGBOOST_EVENT_CALL_START: + handle_call_start(event); + break; + case SIGBOOST_EVENT_CALL_STOPPED: + handle_call_stop(event); + break; + case SIGBOOST_EVENT_CALL_START_ACK: + handle_call_start_ack(event); + break; + case SIGBOOST_EVENT_CALL_START_NACK: + handle_call_start_nack(event); + break; + case SIGBOOST_EVENT_CALL_ANSWERED: + handle_call_answer(event); + break; + case SIGBOOST_EVENT_HEARTBEAT: + handle_heartbeat(event); + break; + case SIGBOOST_EVENT_CALL_START_NACK_ACK: + handle_call_start_nack_ack(event); + break; + case SIGBOOST_EVENT_CALL_STOPPED_ACK: + handle_call_stop_ack(event); + break; + case SIGBOOST_EVENT_INSERT_CHECK_LOOP: + handle_call_loop_start(event); + break; + case SIGBOOST_EVENT_REMOVE_CHECK_LOOP: + handle_call_stop(event); + break; + case SIGBOOST_EVENT_SYSTEM_RESTART_ACK: + handle_restart_ack(mcon,event); + break; + case SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE: + handle_gap_abate(event); + break; + default: + log_printf(0, server.log, "Warning no handler implemented for [%s]\n", + call_signal_event_id_name(event->event_id)); + break; + } + + return ret; +} + + +static void *monitor_thread_run(void *obj) +{ + int ss = 0; + int policy=0,priority=0; + char a=0,b=0; + call_signal_connection_t *mcon=&server.mcon; + call_signal_connection_t *mconp=&server.mconp; + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count++; + pthread_mutex_unlock(&server.thread_count_lock); + + woomera_set_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + + if (call_signal_connection_open(mcon, + mcon->cfg.local_ip, + mcon->cfg.local_port, + mcon->cfg.remote_ip, + mcon->cfg.remote_port) < 0) { + log_printf(0, server.log, "Error: Opening MCON Socket [%d] %s\n", + mcon->socket,strerror(errno)); + exit(-1); + } + + if (call_signal_connection_open(mconp, + mconp->cfg.local_ip, + mconp->cfg.local_port, + mconp->cfg.remote_ip, + mconp->cfg.remote_port) < 0) { + log_printf(0, server.log, "Error: Opening MCONP Socket [%d] %s\n", + mconp->socket,strerror(errno)); + exit(-1); + } + + mcon->log = server.log; + mconp->log = server.log; + + isup_exec_command(0, + 0, + -1, + SIGBOOST_EVENT_SYSTEM_RESTART, + 0); + + mcon->rxseq_reset=1; + + smg_get_current_priority(&policy,&priority); + + log_printf(1, server.log, "Open udp socket [%d] [%d]\n", + mcon->socket,mconp->socket); + log_printf(1, server.log, "Monitor Thread Started (%i:%i)\n",policy,priority); + + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { +#if 0 + ss = waitfor_socket(server.mcon.socket, 1000, POLLERR | POLLIN); +#else + ss = waitfor_2sockets(mcon->socket, + mconp->socket, + &a, &b, 1000); +#endif + + if (ss > 0) { + + call_signal_event_t *event=NULL; + int i=0; + + if (b) { +mcon_retry_priority: + if ((event = call_signal_connection_readp(mconp,i))) { + struct timeval current; + struct timeval difftime; + gettimeofday(¤t,NULL); + timersub (¤t, &event->tv, &difftime); + log_printf(3, server.log, "Socket Event P [%s] T=%d:%d\n", + call_signal_event_id_name(event->event_id), + difftime.tv_sec, difftime.tv_usec); + parse_ss7_event(mconp,event); + if (++i < 10) { + goto mcon_retry_priority; + } + + } else if (errno != EAGAIN) { + ss=-1; + log_printf(0, server.log, + "Error: Reading from Boost P Socket! (%i) %s\n", + errno,strerror(errno)); + break; + } + } + + i=0; + + if (a) { +mcon_retry: + if ((event = call_signal_connection_read(mcon,i))) { + struct timeval current; + struct timeval difftime; + gettimeofday(¤t,NULL); + timersub (¤t, &event->tv, &difftime); + log_printf(3, server.log, "Socket Event [%s] T=%d:%d\n", + call_signal_event_id_name(event->event_id), + difftime.tv_sec, difftime.tv_usec); + parse_ss7_event(mcon,event); + + if (++i < 50) { + goto mcon_retry; + } + } else if (errno != EAGAIN) { + ss=-1; + log_printf(0, server.log, + "Error: Reading from Boost Socket! (%i) %s\n", + errno,strerror(errno)); + break; + } + } + + } + + if (ss < 0){ + log_printf(0, server.log, "Thread Run: Select Socket Error!\n"); + break; + } + + } + + log_printf(1, server.log, "Close udp socket [%d] [%d]\n", + mcon->socket,mconp->socket); + call_signal_connection_close(&server.mcon); + call_signal_connection_close(&server.mconp); + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count--; + pthread_mutex_unlock(&server.thread_count_lock); + + woomera_clear_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + log_printf(0, server.log, "Monitor Thread Ended\n"); + + return NULL; +} + +static void woomera_loop_thread_run(struct woomera_interface *woomera) +{ + int err=launch_media_thread(woomera); + if (err) { + log_printf(0, server.log, "Failed to start loop media thread\n"); + woomera_set_flag(woomera, + (WFLAG_HANGUP|WFLAG_MEDIA_END)); + woomera_clear_flag(woomera, WFLAG_RUNNING); + return; + } + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + !woomera_test_flag(woomera, WFLAG_HANGUP)) { + + sleep(1); + continue; + + } + + woomera_clear_flag(woomera, WFLAG_RUNNING); + + log_printf(2, server.log, "Woomera Session: For Loop Test exiting %s\n",woomera->interface); + + + + return; +} + +static void *woomera_thread_run(void *obj) +{ + struct woomera_interface *woomera = obj; + struct woomera_message wmsg; + struct woomera_event wevent; + char *event_string; + int mwi; + int err; + int policy=0, priority=0; + int span = -1, chan = -1; + + woomera_message_init(&wmsg); + + smg_get_current_priority(&policy,&priority); + + log_printf(2, server.log, "WOOMERA session started (ptr=%p : loop=%i)(%i:%i) Index=%i\n", + woomera,woomera->loop_tdm,policy,priority, woomera->index); + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count++; + pthread_mutex_unlock(&server.thread_count_lock); + + pthread_mutex_init(&woomera->queue_lock, NULL); + pthread_mutex_init(&woomera->ms_lock, NULL); + pthread_mutex_init(&woomera->dtmf_lock, NULL); + pthread_mutex_init(&woomera->vlock, NULL); + pthread_mutex_init(&woomera->flags_lock, NULL); + + if (woomera->loop_tdm) { + woomera_loop_thread_run(woomera); + goto woomera_session_close; + } + + err=socket_printf(woomera->socket, + "EVENT HELLO Sangoma Media Gateway%s" + "Supported-Protocols: TDM%s" + "Version: %s%s" + "Remote-Address: %s%s" + "Remote-Port: %d%s" + "Raw-Format: %s%s", + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + SMG_VERSION, WOOMERA_LINE_SEPERATOR, + inet_ntoa(woomera->addr.sin_addr), WOOMERA_LINE_SEPERATOR, + ntohs(woomera->addr.sin_port), WOOMERA_LINE_SEPERATOR, + server.hw_coding?"ALAW":"ULAW", WOOMERA_RECORD_SEPERATOR + ); + + if (err) { + log_printf(0, server.log, "Woomera session socket failure! (ptr=%p)\n", + woomera); + woomera_clear_flag(woomera, WFLAG_RUNNING); + goto woomera_session_close; + } + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING) && + woomera_test_flag(woomera, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + !woomera_test_flag(woomera, WFLAG_HANGUP) && + !master_reset) { + + + mwi = woomera_message_parse(woomera, &wmsg, WOOMERA_HARD_TIMEOUT); + if (mwi >= 0) { + + if (mwi) { + interpret_command(woomera, &wmsg); + } else if (woomera_test_flag(woomera, WFLAG_EVENT)){ + while ((event_string = dequeue_event(woomera))) { + if (socket_printf(woomera->socket, "%s", event_string)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + free(event_string); + log_printf(4, server.log, + "WOOMERA session (ptr=%p) print string error\n", + woomera); + break; + } + free(event_string); + } + woomera_clear_flag(woomera, WFLAG_EVENT); + } + + if (woomera->timeout > 0 && time(NULL) >= woomera->timeout) { + + /* Sent the hangup only after we sent a NACK */ + + log_printf(2, server.log, + "WOOMERA session (ptr=%p) Call Timedout ! [%s] (Timeout=%d)\n", + woomera,woomera->interface,woomera->timeout); + + /* Let the Index check below send a NACK */ + if (woomera->index) { + woomera_set_flag(woomera, WFLAG_HANGUP); + } + break; + } + + } else { + log_printf(3, server.log, "WOOMERA session (ptr=%p) [%s] READ MSG Error %i \n", + woomera,woomera->interface,mwi); + break; + } + + } + +woomera_session_close: + + log_printf(2, server.log, "WOOMERA session (ptr=%p) is dying [%s]: SR=%d WR=%d WF=0x%04X\n", + woomera,woomera->interface, + woomera_test_flag(&server.master_connection, WFLAG_RUNNING), + woomera_test_flag(woomera, WFLAG_RUNNING), + woomera->flags); + + + if (woomera_test_flag(woomera, WFLAG_MEDIA_RUNNING)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + while(woomera_test_flag(woomera, WFLAG_MEDIA_RUNNING)) { + usleep(100); + sched_yield(); + } + } + + + /*********************************************** + * Identify the SPAN CHAN to be used below + ***********************************************/ + + chan = woomera->chan; + span = woomera->span; + + + if (!woomera_test_flag(woomera, WFLAG_HANGUP)) { + + /* The call was not HUNGUP. This is the last check, + If the call is valid, hungup the call if the call + was never up the keep going */ + + + if (smg_validate_span_chan(span,chan) == 0) { + + if (!woomera->index) { + + if (autoacm || woomera_test_flag(woomera,WFLAG_CALL_ACKED)) { + + woomera_set_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + woomera->q931_rel_cause_tosig); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK_SENT); + + + log_printf(3, woomera->log, "Woomera Sent SIGBOOST_EVENT_CALL_STOPPED [w%dg%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + } else { + + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + woomera->q931_rel_cause_tosig); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT); + + log_printf(3, woomera->log, "Woomera Sent SIGBOOST_EVENT_CALL_START_NACK [w%dg%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + } + } else { + log_printf(0, woomera->log, "Woomera Not Sent CALL STOPPED - Instead NACK [w%dg%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + + } + }else{ + /* This can happend if an outgoing call times out + or gets hungup before it gets acked. Its not a + failure */ + if (!woomera->index) { + + /* In this case we really failed to tx STOP */ + log_printf(0, woomera->log, "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + } + + woomera_set_flag(woomera, WFLAG_HANGUP); + + } + +woo_re_hangup: + + /* We must send a STOP ACK to boost telling it that we are done */ + if (woomera_test_flag(woomera, WFLAG_HANGUP_ACK)) { + + /* SMG received a HANGUP from boost. + We must now send back the ACK to the HANGUP. + Boost will not release channel until we + ACK the hangup */ + + if (smg_validate_span_chan(span,chan) == 0) { + + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED_ACK, + woomera->q931_rel_cause_tosig); + + log_printf(3, woomera->log, + "Sent (Ack) to SIGBOOST_EVENT_CALL_STOPPED_ACK [w%dg%d] [%s] ptr=%p\n", + span+1,chan+1,woomera->interface,woomera); + + }else{ + /* This should never happen! If it does + we broke protocol */ + log_printf(0, woomera->log, + "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED_ACK [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + + woomera_clear_flag(woomera, WFLAG_HANGUP_ACK); + woomera_set_flag(woomera, WFLAG_HANGUP); + } + + if (woomera_test_flag(woomera, WFLAG_HANGUP_NACK_ACK)) { + + /* SMG received a NACK from boost during call startup. + We must now send back the ACK to the NACK. + Boost will not release channel until we + ACK the NACK */ + + if (smg_validate_span_chan(span,chan) == 0) { + + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + woomera->q931_rel_cause_tosig); + + log_printf(3, woomera->log, + "Sent (Nack Ack) to SIGBOOST_EVENT_CALL_START_NACK_ACK [w%dg%d] [%s] ptr=%p\n", + span+1,chan+1,woomera->interface,woomera); + + woomera->index=0; + + } else if (woomera->index) { + isup_exec_command(0, + 0, + woomera->index, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + woomera->q931_rel_cause_tosig); + + woomera->index=0; + + } else { + log_printf(0, woomera->log, + "FAILED: Sent (Nack Ack) SIGBOOST_EVENT_CALL_START_NACK_ACK [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + + woomera_clear_flag(woomera, WFLAG_HANGUP_NACK_ACK); + + } + + if (woomera->index) { + + int index = woomera->index; + + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Timeout: %ld%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + woomera->timeout, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(18), + WOOMERA_LINE_SEPERATOR, + 18, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + while ((event_string = dequeue_event(woomera))) { + socket_printf(woomera->socket, "%s", event_string); + free(event_string); + } + + if (peek_from_holding_tank(index)) { + + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + isup_exec_command(0, + 0, + index, + SIGBOOST_EVENT_CALL_START_NACK, + 0); + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK_SENT); + + log_printf(2, woomera->log, + "Sent SIGBOOST_EVENT_CALL_START_NACK [Setup ID: %d] .. WAITING FOR NACK ACK\n", + index); + } else { + log_printf(1, woomera->log, + "Error Failed to Sent SIGBOOST_EVENT_CALL_START_NACK [Setup ID: %d] - index stale!\n", + index); + } + } + + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK)) { + int timeout_cnt=0; + int overall_cnt=0; + + /* SMG sent NACK to boost, however we have to wait + for boost to give us the ACK back before we + release resources. */ + + while (woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK)) { + timeout_cnt++; + if (timeout_cnt > 4000) { //30sec timeout + timeout_cnt=0; + overall_cnt++; + log_printf(0, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] ... \n", + woomera->index); + } + + if (overall_cnt > 10) { //300sec timeotu + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + break; + } + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING)) { + break; + } + + usleep(5000); + sched_yield(); + } + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + if (overall_cnt > 10) { + log_printf(0, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] .. TIMEOUT on NACK ACK\n", + index); + + } else { + log_printf(2, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] .. GOT NACK ACK\n", + index); + + } + } + + if (woomera_test_flag(woomera, WFLAG_EVENT)){ + while ((event_string = dequeue_event(woomera))) { + socket_printf(woomera->socket, "%s", event_string); + free(event_string); + } + woomera_clear_flag(woomera, WFLAG_EVENT); + } + + + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + int timeout_cnt=0; + int overall_cnt=0; + + /* SMG sent HANGUP to boost, however we have to wait + for boost to give us the ACK back before we + release resources. */ + + log_printf(2, woomera->log, + "Waiting for STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + + while (woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + timeout_cnt++; + if (timeout_cnt > 4000) { //10sec timeout + timeout_cnt=0; + overall_cnt++; + log_printf(0, woomera->log, + "Waiting for STOPPED ACK [%s] [id=%i] ... \n", + woomera->interface,woomera->index_hold); + } + + if (overall_cnt > 10) { //100sec + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + break; + } + + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + server.process_table[span][chan].dev != woomera) { + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + break; + } + + usleep(5000); + sched_yield(); + } + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + + if (overall_cnt > 10) { + log_printf(0, woomera->log, + "Wait TIMEDOUT on STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + + } else { + log_printf(2, woomera->log, + "Wait GOT STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + } + } + + /***************************************************** + * We must wait for WFLAG_WAIT_FOR_STOPPED_ACK here + * so that STOP_ACK can access the woomera + *****************************************************/ + + if (smg_validate_span_chan(span,chan) == 0) { + log_printf(2, woomera->log, + "WOOMERA Clearing Processs Table ... \n", + woomera->interface); + pthread_mutex_lock(&server.process_lock); + if (server.process_table[span][chan].dev == woomera){ + server.process_table[span][chan].dev = NULL; + memset(server.process_table[span][chan].session,0,SMG_SESSION_NAME_SZ); + } + pthread_mutex_unlock(&server.process_lock); + } + +#if 0 +//Used for testing + if (1) { + int chan = woomera->chan; + int span = woomera->span; + if (smg_validate_span_chan(span,chan) == 0) { + pthread_mutex_lock(&server.process_lock); + /* This is possible in case media thread dies on startup */ + + if (server.process_table[span][chan]){ + log_printf(0, server.log, + "Sanity Span Chan Still in use: [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + //server.process_table[span][chan] = NULL; + } + pthread_mutex_unlock(&server.process_lock); + } + } +#endif + + usleep(3000000); + + /* Sanity Check */ + if (woomera_test_flag(woomera, WFLAG_HANGUP_ACK)) { + log_printf(0, woomera->log, + "Woomera MISSED HANGUP ACK: Retry HANGUP ACK\n"); + goto woo_re_hangup; + } + if (woomera_test_flag(woomera, WFLAG_HANGUP_NACK_ACK)) { + log_printf(0, woomera->log, + "Woomera MISSED HANGUP ACK: Retry HANGUP NACK ACK\n"); + goto woo_re_hangup; + } + + /* This is where we actually pull the index + * out of the tank. We had to keep the tank + * value until the end of the call. Tank is only + * used on outgoing calls. */ + if (woomera->index_hold >= 1) { + clear_from_holding_tank(woomera->index_hold, woomera); + woomera->index_hold=0; + } + + log_printf(2, woomera->log, "Woomera Thread Finished %u\n", (unsigned long) woomera->thread); + close_socket(&woomera->socket); + woomera->socket=-1; + + /* delete queue */ + while ((event_string = dequeue_event(woomera))) { + free(event_string); + } + + if (woomera_test_flag(woomera, WFLAG_LISTENING)) { + del_listener(woomera); + } + + log_printf(2, server.log, "WOOMERA session for [%s] stopped (ptr=%p)\n", + woomera->interface,woomera); + + if (woomera_test_flag(woomera, WFLAG_MASTER_DEV)) { + log_printf(0,server.log,"MASTER Thread Stopped (ptr=%p)\n",woomera); + master_reset=0; + } + + + pthread_mutex_destroy(&woomera->queue_lock); + pthread_mutex_destroy(&woomera->ms_lock); + pthread_mutex_destroy(&woomera->dtmf_lock); + pthread_mutex_destroy(&woomera->vlock); + pthread_mutex_destroy(&woomera->flags_lock); + woomera_set_raw(woomera, NULL); + woomera_set_interface(woomera, NULL); + + woomera_message_clear(&wmsg); + + free(woomera); + pthread_mutex_lock(&server.thread_count_lock); + server.call_count--; + server.thread_count--; + pthread_mutex_unlock(&server.thread_count_lock); + + pthread_exit(NULL); + return NULL; +} + + +static int launch_woomera_thread(struct woomera_interface *woomera) +{ + int result = 0; + pthread_attr_t attr; + + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_RUNNING); + result = pthread_create(&woomera->thread, &attr, woomera_thread_run, woomera); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! (%i) %s\n", + __FUNCTION__,result,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + +static int launch_monitor_thread(void) +{ + pthread_attr_t attr; + int result = 0; + struct sched_param param; + + param.sched_priority = 10; + result = pthread_attr_init(&attr); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + result = pthread_attr_setschedparam (&attr, ¶m); + + log_printf(0,server.log,"%s: Old Priority =%i res=%i \n",__FUNCTION__, + param.sched_priority,result); + + + woomera_set_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + result = pthread_create(&server.monitor_thread, &attr, monitor_thread_run, NULL); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + + +#ifdef WP_HPTDM_API +static void *hp_tdmapi_span_run(void *obj) +{ + hp_tdm_api_span_t *span = obj; + int err; + + log_printf(0,server.log,"Starting %s span!\n",span->ifname); + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + + if (!span->run_span) { + break; + } + + err = span->run_span(span); + if (err) { + break; + } + + } + + if (span->close_span) { + span->close_span(span); + } + + sleep(3); + log_printf(0,server.log,"Stopping %s span!\n",span->ifname); + + pthread_exit(NULL); +} + + +static int launch_hptdm_api_span_thread(int span) +{ + pthread_attr_t attr; + int result = 0; + struct sched_param param; + + param.sched_priority = 5; + result = pthread_attr_init(&attr); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + result = pthread_attr_setschedparam (&attr, ¶m); + + result = pthread_create(&server.monitor_thread, &attr, hp_tdmapi_span_run, &hptdmspan[span]); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + } + pthread_attr_destroy(&attr); + + return result; +} +#endif + +static int configure_server(void) +{ + struct woomera_config cfg; + char *var, *val; + int cnt = 0; + + server.dtmf_intr_ch = -1; + + if (!woomera_open_file(&cfg, server.config_file)) { + log_printf(0, server.log, "open of %s failed\n", server.config_file); + return 0; + } + + while (woomera_next_pair(&cfg, &var, &val)) { + if (!strcasecmp(var, "boost_local_ip")) { + strncpy(server.mcon.cfg.local_ip, val, + sizeof(server.mcon.cfg.local_ip) -1); + strncpy(server.mconp.cfg.local_ip, val, + sizeof(server.mconp.cfg.local_ip) -1); + cnt++; + } else if (!strcasecmp(var, "boost_local_port")) { + server.mcon.cfg.local_port = atoi(val); + server.mconp.cfg.local_port = + server.mcon.cfg.local_port+1; + cnt++; + } else if (!strcasecmp(var, "boost_remote_ip")) { + strncpy(server.mcon.cfg.remote_ip, val, + sizeof(server.mcon.cfg.remote_ip) -1); + strncpy(server.mconp.cfg.remote_ip, val, + sizeof(server.mconp.cfg.remote_ip) -1); + cnt++; + } else if (!strcasecmp(var, "boost_remote_port")) { + server.mcon.cfg.remote_port = atoi(val); + server.mconp.cfg.remote_port = + server.mcon.cfg.remote_port+1; + cnt++; + } else if (!strcasecmp(var, "logfile_path")) { + if (!server.logfile_path) { + server.logfile_path = strdup(val); + } + } else if (!strcasecmp(var, "woomera_port")) { + server.port = atoi(val); + } else if (!strcasecmp(var, "debug_level")) { + server.debug = atoi(val); + } else if (!strcasecmp(var, "out_tx_test")) { + server.out_tx_test = atoi(val); + } else if (!strcasecmp(var, "loop_trace")) { + server.loop_trace = atoi(val); + } else if (!strcasecmp(var, "rxgain")) { + server.rxgain = atoi(val); + } else if (!strcasecmp(var, "txgain")) { + server.txgain = atoi(val); + } else if (!strcasecmp(var, "dtmf_on_duration")){ + server.dtmf_on = atoi(val); + } else if (!strcasecmp(var, "dtmf_off_duration")){ + server.dtmf_off = atoi(val); + } else if (!strcasecmp(var, "dtmf_inter_ch_duration")){ + server.dtmf_intr_ch = atoi(val); + } else if (!strcasecmp(var, "max_calls")) { + int max = atoi(val); + if (max > 0) { + server.max_calls = max; + } + } else if (!strcasecmp(var, "autoacm")) { + int max = atoi(val); + if (max >= 0) { + autoacm=max; + } + + } else if (!strcasecmp(var, "media_ip")) { + strncpy(server.media_ip, val, sizeof(server.media_ip) -1); + } else { + log_printf(0, server.log, "Invalid Option %s at line %d!\n", var, cfg.lineno); + } + } + + /* Post initialize */ + if (server.dtmf_on == 0){ + server.dtmf_on=SMG_DTMF_ON; + } + if (server.dtmf_off == 0) { + server.dtmf_off=SMG_DTMF_OFF; + } + if (server.dtmf_intr_ch == -1) { + server.dtmf_intr_ch = 0; + } + server.dtmf_size=(server.dtmf_on+server.dtmf_off)*10*2; + + log_printf(0,server.log, "DTMF On=%i Off=%i IntrCh=%i Size=%i\n", + server.dtmf_on,server.dtmf_off,server.dtmf_intr_ch,server.dtmf_size); + + woomera_close_file(&cfg); + return cnt == 4 ? 1 : 0; +} + + + +static int main_thread(void) +{ + + struct sockaddr_in sock_addr, client_addr; + struct woomera_interface *new_woomera; + int client_sock = -1, pid = 0; + unsigned int len = 0; + FILE *tmp; + + if ((server.master_connection.socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { + log_printf(0, server.log, "socket() failed\n"); + return 1; + } + + memset(&sock_addr, 0, sizeof(sock_addr)); /* Zero out structure */ + sock_addr.sin_family = AF_INET; /* Internet address family */ + sock_addr.sin_addr.s_addr = htonl(INADDR_ANY); /* Any incoming interface */ + sock_addr.sin_port = htons(server.port); /* Local port */ + + /* Bind to the local address */ + if (bind(server.master_connection.socket, (struct sockaddr *) &sock_addr, sizeof(sock_addr)) < 0) { + log_printf(0, server.log, "bind(%d) failed\n", server.port); + return 1; + } + + /* Mark the socket so it will listen for incoming connections */ + if (listen(server.master_connection.socket, MAXPENDING) < 0) { + log_printf(0, server.log, "listen() failed\n"); + return 1; + } + + if ((pid = get_pid_from_file(PIDFILE))) { + log_printf(0, stderr, "pid %d already exists.\n", pid); + exit(0); + } + + if (!(tmp = safe_fopen(PIDFILE, "w"))) { + log_printf(0, stderr, "Error creating pidfile %s\n", PIDFILE); + return 1; + } else { + fprintf(tmp, "%d", getpid()); + fclose(tmp); + tmp = NULL; + } + + no_nagle(server.master_connection.socket); + +#if 0 + if (1) { + int span,chan; + call_signal_event_t event; +#if 0 + span=1; + chan=30; + event.span=span; + event.chan=chan; + launch_woomera_loop_thread(&event); +#else + for (span=0;span<8;span++) { + for (chan=0;chan<31;chan++) { + event.span=span; + event.chan=chan; + launch_woomera_loop_thread(&event); + } + } +#endif + } +#endif + +#ifdef WP_HPTDM_API + if (1) { + int span; + for (span=0;span<16;span++) { + hptdmspan[span] = sangoma_hptdm_api_span_init(span); + if (!hptdmspan[span]) { + break; + } else { + log_printf(0, server.log, "HP TDM API Span: %d configured...\n", + span); + launch_hptdm_api_span_thread(span); + } + } + } +#endif + + log_printf(1, server.log, "Main Process Started: Woomera Ready port: %d\n", server.port); + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + + /* Set the size of the in-out parameter */ + len = sizeof(client_addr); + + /* Wait for a client to connect */ + if ((client_sock = accept(server.master_connection.socket, (struct sockaddr *) &client_addr, &len)) < 0) { + log_printf(0, server.log, "accpet() failed\n"); + return 1; + } + + if ((new_woomera = new_woomera_interface(client_sock, &client_addr, len))) { + log_printf(2, server.log, "Starting Thread for New Connection %s:%d Sock=%d\n", + inet_ntoa(new_woomera->addr.sin_addr), + ntohs(new_woomera->addr.sin_port), + client_sock); + pthread_mutex_lock(&server.thread_count_lock); + server.call_count++; + pthread_mutex_unlock(&server.thread_count_lock); + if (launch_woomera_thread(new_woomera)) { + socket_printf(new_woomera->socket, + "501 call was cancelled!%s", + WOOMERA_RECORD_SEPERATOR); + + close_socket(&new_woomera->socket); + new_woomera->socket=-1; + free(new_woomera); + } + } else { + log_printf(0, server.log, "Critical ERROR: memory/socket error\n"); + } + } + + log_printf(1, server.log, "Main Process End\n"); + + return 0; +} + +static int do_ignore(int sig) +{ + return 0; +} + +static int do_shut(int sig) +{ + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + close_socket(&server.master_connection.socket); + log_printf(1, server.log, "Caught SIG %d, Closing Master Socket!\n", sig); + return 0; +} + +static int sangoma_tdm_init (int span) +{ +#ifdef LIBSANGOMA_GET_HWCODING + wanpipe_tdm_api_t tdm_api; + int fd=sangoma_open_tdmapi_span(span); + if (fd < 0 ){ + return -1; + } else { + server.hw_coding=sangoma_tdm_get_hw_coding(fd,&tdm_api); + close_socket(&fd); + } +#else +#error "libsangoma missing hwcoding feature: not up to date!" +#endif + return 0; +} + + +static int woomera_startup(int argc, char **argv) +{ + int x = 0, pid = 0, bg = 0; + char *cfg=NULL, *debug=NULL, *arg=NULL; + + while((arg = argv[x++])) { + + if (!strcasecmp(arg, "-hup")) { + if (! (pid = get_pid_from_file(PIDFILE))) { + log_printf(0, stderr, "Error reading pidfile %s\n", PIDFILE); + exit(1); + } else { + log_printf(0, stderr, "Killing PID %d\n", pid); + kill(pid, SIGHUP); + sleep(1); + exit(0); + } + + } else if (!strcasecmp(arg, "-term") || !strcasecmp(arg, "--term")) { + if (! (pid = get_pid_from_file(PIDFILE))) { + log_printf(0, stderr, "Error reading pidfile %s\n", PIDFILE); + exit(1); + } else { + log_printf(0, stderr, "Killing PID %d\n", pid); + kill(pid, SIGTERM); + unlink(PIDFILE); + sleep(1); + exit(0); + } + + } else if (!strcasecmp(arg, "-version")) { + fprintf(stdout, "\nSangoma Media Gateway: Version %s\n\n", SMG_VERSION); + exit(0); + + } else if (!strcasecmp(arg, "-help")) { + fprintf(stdout, "%s\n%s [-help] | [ -version] | [-hup] | [-wipe] | [[-bg] | [-debug ] | [-cfg ] | [-log ]]\n\n", WELCOME_TEXT, argv[0]); + exit(0); + } else if (!strcasecmp(arg, "-wipe")) { + unlink(PIDFILE); + } else if (!strcasecmp(arg, "-bg")) { + bg = 1; + + } else if (!strcasecmp(arg, "-g")) { + coredump = 1; + + } else if (!strcasecmp(arg, "-debug")) { + if (argv[x] && *(argv[x]) != '-') { + debug = argv[x++]; + } + } else if (!strcasecmp(arg, "-cfg")) { + if (argv[x] && *(argv[x]) != '-') { + cfg = argv[x++]; + } + } else if (!strcasecmp(arg, "-log")) { + if (argv[x] && *(argv[x]) != '-') { + server.logfile_path = strdup(argv[x++]); + } + } else if (*arg == '-') { + log_printf(0, stderr, "Unknown Option %s\n", arg); + fprintf(stdout, "%s\n%s [-help] | [-hup] | [-wipe] | [[-bg] | [-debug ] | [-cfg ] | [-log ]]\n\n", WELCOME_TEXT, argv[0]); + exit(1); + } + } + + if (1){ + int spn; + for (spn=1;spn<=WOOMERA_MAX_SPAN;spn++) { + if (sangoma_tdm_init(spn) == 0) { + break; + } + } + if (spn>WOOMERA_MAX_SPAN) { + printf("\nError: Failed to access a channel on spans 1-16\n"); + printf(" Please start Wanpipe TDM API drivers\n"); + return 0; + } + } + + if (bg && (pid = fork())) { + log_printf(0, stderr, "Backgrounding!\n"); + return 0; + } + + q931_cause_setup(); + + server.port = 42420; + server.debug = 0; + strcpy(server.media_ip, "127.0.0.1"); + server.next_media_port = WOOMERA_MIN_MEDIA_PORT; + server.log = stdout; + server.master_connection.socket = -1; + server.master_connection.event_queue = NULL; + server.config_file = cfg ? cfg : "/etc/sangoma_mgd.conf"; + pthread_mutex_init(&server.listen_lock, NULL); + pthread_mutex_init(&server.ht_lock, NULL); + pthread_mutex_init(&server.process_lock, NULL); + pthread_mutex_init(&server.media_udp_port_lock, NULL); + pthread_mutex_init(&server.thread_count_lock, NULL); + pthread_mutex_init(&server.master_connection.queue_lock, NULL); + pthread_mutex_init(&server.master_connection.flags_lock, NULL); + pthread_mutex_init(&server.mcon.lock, NULL); + server.master_connection.chan = -1; + server.master_connection.span = -1; + + if (!configure_server()) { + log_printf(0, server.log, "configuration failed!\n"); + return 0; + } + +#ifndef USE_SYSLOG + if (server.logfile_path) { + if (!(server.log = safe_fopen(server.logfile_path, "a"))) { + log_printf(0, stderr, "Error setting logfile %s!\n", server.logfile_path); + server.log = stderr; + return 0; + } + } +#endif + + + if (debug) { + server.debug = atoi(debug); + } + + if (coredump) { + struct rlimit l; + memset(&l, 0, sizeof(l)); + l.rlim_cur = RLIM_INFINITY; + l.rlim_max = RLIM_INFINITY; + if (setrlimit(RLIMIT_CORE, &l)) { + log_printf(0, stderr, "Warning: Failed to disable core size limit: %s\n", + strerror(errno)); + } + } + +#ifdef __LINUX__ + if (geteuid() && coredump) { + if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) < 0) { + log_printf(0, stderr, "Warning: Failed to disable core size limit for non-root: %s\n", + strerror(errno)); + } + } +#endif + + + + (void) signal(SIGINT,(void *) do_shut); + (void) signal(SIGPIPE,(void *) do_ignore); + (void) signal(SIGHUP,(void *) do_shut); + + + woomera_set_flag(&server.master_connection, WFLAG_RUNNING); + if (launch_monitor_thread()) { + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + return 0; + } + + fprintf(stderr, "%s", WELCOME_TEXT); + log_printf(0, stderr, "Woomera STARTUP Complete. [AutoACM=%i]\n",autoacm); + + return 1; +} + +static int woomera_shutdown(void) +{ + char *event_string; + int told = 0, loops = 0; + + close_socket(&server.master_connection.socket); + pthread_mutex_destroy(&server.listen_lock); + pthread_mutex_destroy(&server.ht_lock); + pthread_mutex_destroy(&server.process_lock); + pthread_mutex_destroy(&server.media_udp_port_lock); + pthread_mutex_destroy(&server.thread_count_lock); + pthread_mutex_destroy(&server.master_connection.queue_lock); + pthread_mutex_destroy(&server.master_connection.flags_lock); + pthread_mutex_destroy(&server.mcon.lock); + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + + + if (server.logfile_path) { + free(server.logfile_path); + server.logfile_path = NULL; + } + + /* delete queue */ + while ((event_string = dequeue_event(&server.master_connection))) { + free(event_string); + } + + while(server.thread_count > 0) { + loops++; + + if (loops % 1000 == 0) { + told = 0; + } + + if (loops > 10000) { + log_printf(0, server.log, "Red Alert! threads did not stop\n"); + assert(server.thread_count == 0); + } + + if (told != server.thread_count) { + log_printf(1, server.log, "Waiting For %d thread%s.\n", + server.thread_count, server.thread_count == 1 ? "" : "s"); + told = server.thread_count; + } + ysleep(10000); + } + unlink(PIDFILE); + log_printf(0, stderr, "Woomera SHUTDOWN Complete.\n"); + return 0; +} + +int main(int argc, char *argv[]) +{ + int ret = 0; + + mlockall(MCL_FUTURE); + + + server.hw_coding=0; + + openlog (ps_progname ,LOG_PID, LOG_LOCAL2); + + if (! (ret = woomera_startup(argc, argv))) { + exit(0); + } + ret = main_thread(); + + woomera_shutdown(); + + return ret; +} + +/** EMACS ** + * Local variables: + * mode: C + * c-basic-offset: 4 + * End: + */ + diff --git a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.14.tmp b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.14.tmp new file mode 100644 index 0000000..b20fd53 --- /dev/null +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.14.tmp @@ -0,0 +1,602 @@ +/********************************************************************************* + * sangoma_mgd.h -- Sangoma Media Gateway Daemon for Sangoma/Wanpipe Cards + * + * Copyright 05-07, Nenad Corbic + * Anthony Minessale II + * + * This program is free software, distributed under the terms of + * the GNU General Public License + * + * =============================================*/ + +#ifndef __SANGOMA_MGD_H_ +#define __SANGOMA_MGD_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifdef __LINUX__ +#include +#endif + + +#include +#include + + +#define WOOMERA_MAX_SPAN 16 +#define WOOMERA_MAX_CHAN 31 + +#define SMG_SESSION_NAME_SZ 100 +#define SMG_CHAN_NAME_SZ 20 + +#define PIDFILE "/var/run/sangoma_mgd.pid" +#define CORE_EVENT_LEN 512 +#define WOOMERA_STRLEN 256 +#define WOOMERA_ARRAY_LEN 50 +#define WOOMERA_BODYLEN 2048 +#define WOOMERA_MIN_MEDIA_PORT 9000 +#define WOOMERA_MAX_MEDIA_PORT 9899 +#define WOOMERA_HARD_TIMEOUT 0 +#define WOOMERA_LINE_SEPERATOR "\r\n" +#define WOOMERA_RECORD_SEPERATOR "\r\n\r\n" +#define WOOMERA_DEBUG_PREFIX "[DEBUG] " +#define WOOMERA_DEBUG_LINE "------------------------------------------------------------------------------------------------" + + + + + +#define STDERR fileno(stderr) +#define MAXPENDING 500 +#define MGD_STACK_SIZE 1024 * 240 + + +typedef enum { + WFLAG_RUNNING = (1 << 0), + WFLAG_LISTENING = (1 << 1), + WFLAG_MASTER_DEV = (1 << 2), + WFLAG_EVENT = (1 << 3), + WFLAG_MALLOC = (1 << 4), + WFLAG_MEDIA_RUNNING = (1 << 5), + WFLAG_MEDIA_END = (1 << 6), + WFLAG_MONITOR_RUNNING = (1 << 7), + WFLAG_HANGUP = (1 << 8), + WFLAG_ANSWER = (1 << 9), + WFLAG_MEDIA_TDM_RUNNING = (1 << 10), + WFLAG_HANGUP_ACK = (1 << 11), + WFLAG_HANGUP_NACK_ACK = (1 << 12), + WFLAG_WAIT_FOR_NACK_ACK = (1 << 13), + WFLAG_WAIT_FOR_STOPPED_ACK = (1 << 14), + WFLAG_RAW_MEDIA_STARTED = (1 << 15), + WFLAG_CALL_ACKED = (1 << 16), + WFLAG_WAIT_FOR_NACK_ACK_SENT = (1 << 17), + WFLAG_WAIT_FOR_STOPPED_ACK_SENT = (1 << 18), +} WFLAGS; + +typedef enum { + MFLAG_EXISTS = (1 << 0), + MFLAG_CONTENT = (1 << 1), +} MFLAGS; + +typedef enum { + EVENT_FREE_DATA = 1, + EVENT_KEEP_DATA = 0 +} event_args; + + +void __log_printf(int level, FILE *fp, char *file, const char *func, int line, char *fmt, ...); + +#define ysleep(usec) sched_yield() ; usleep(usec); +#define log_printf(level, fp, fmt, ...) __log_printf(level, fp, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__) + + +#define woomera_test_flag(p,flag) ({ \ + ((p)->flags & (flag)); \ + }) + +#define _woomera_set_flag(p,flag) do { \ + ((p)->flags |= (flag)); \ + } while (0) + +#define _woomera_clear_flag(p,flag) do { \ + ((p)->flags &= ~(flag)); \ + } while (0) + +#define woomera_set_flag(p,flag) do { \ + pthread_mutex_lock(&(p)->flags_lock); \ + ((p)->flags |= (flag)); \ + pthread_mutex_unlock(&(p)->flags_lock); \ + } while (0) + +#define woomera_clear_flag(p,flag) do { \ + pthread_mutex_lock(&(p)->flags_lock); \ + ((p)->flags &= ~(flag)); \ + pthread_mutex_unlock(&(p)->flags_lock); \ + } while (0) + +#define woomera_copy_flags(dest,src,flagz) do { \ + pthread_mutex_lock(&(p)->flags_lock); \ + (dest)->flags &= ~(flagz); \ + (dest)->flags |= ((src)->flags & (flagz)); \ + pthread_mutex_unlock(&(p)->flags_lock); \ + } while (0) + + +struct media_session { + int udp_sock; + int sangoma_sock; + char *ip; + int port; + time_t started; + time_t answered; + pthread_t thread; + int socket; + struct woomera_interface *woomera; + struct sockaddr_in local_addr; + struct sockaddr_in remote_addr; + struct hostent remote_hp; + struct hostent local_hp; + int skip_read_frames; + int skip_write_frames; + int hw_coding; + int udp_sync_cnt; + +#ifdef WP_HPTDM_API + hp_tdm_api_chan_t *tdmchan; +#endif + + teletone_dtmf_detect_state_t dtmf_detect; + teletone_generation_session_t tone_session; + switch_buffer_t *dtmf_buffer; + +}; + +struct woomera_message { + char callid[WOOMERA_STRLEN]; + char command[WOOMERA_STRLEN]; + char command_args[WOOMERA_STRLEN]; + char names[WOOMERA_STRLEN][WOOMERA_ARRAY_LEN]; + char values[WOOMERA_STRLEN][WOOMERA_ARRAY_LEN]; + char body[WOOMERA_BODYLEN]; + uint32_t flags; + pthread_mutex_t flags_lock; + int last; + struct woomera_message *next; +}; + +struct woomera_event { + char *data; + uint32_t flags; + struct woomera_event *next; +}; + +struct woomera_listener { + struct woomera_interface *woomera; + struct woomera_listener *next; +}; + +struct woomera_interface { + int socket; + char *raw; + char *interface; + time_t timeout; + struct sockaddr_in addr; + struct media_session *ms; + pthread_mutex_t queue_lock; + pthread_mutex_t ms_lock; + pthread_mutex_t dtmf_lock; + struct woomera_event *event_queue; + struct woomera_event *incoming_event_queue; + pthread_t thread; + uint32_t flags; + pthread_mutex_t flags_lock; + int debug; + int call_id; + FILE *log; + pthread_mutex_t vlock; + int index; + int index_hold; + int span; + int chan; + int trunk_group; + int call_count; + int q931_rel_cause_tosig; + int q931_rel_cause_topbx; + int loop_tdm; + char session[SMG_SESSION_NAME_SZ]; + struct woomera_interface *next; +}; + +struct woomera_session { + struct woomera_interface *dev; + char session[SMG_SESSION_NAME_SZ]; +}; + +#define CORE_TANK_LEN CORE_MAX_CHAN_PER_SPAN*CORE_MAX_SPANS + +struct woomera_server { + struct woomera_session process_table[CORE_MAX_CHAN_PER_SPAN][CORE_MAX_SPANS]; + struct woomera_interface *holding_tank[CORE_TANK_LEN]; + int holding_tank_index; + struct woomera_interface master_connection; + pthread_mutex_t listen_lock; + pthread_mutex_t ht_lock; + pthread_mutex_t process_lock; + pthread_mutex_t media_udp_port_lock; + pthread_mutex_t thread_count_lock; + call_signal_connection_t mcon; + call_signal_connection_t mconp; + struct woomera_listener *listeners; + char media_ip[WOOMERA_STRLEN]; + int port; + int next_media_port; + int debug; + int panic; + int thread_count; + char *logfile_path; + FILE *log; + char boost_local_ip[25]; + int boost_local_port; + char boost_remote_ip[25]; + int boost_remote_port; + pthread_t monitor_thread; + char *config_file; + int max_calls; + int call_count; + uint32_t out_tx_test; + uint32_t rxgain; + uint32_t txgain; + uint32_t hw_coding; + uint32_t loop_trace; + uint32_t hungup_waiting; + int all_ckt_gap; + int all_ckt_busy; + struct timeval all_ckt_busy_time; + int dtmf_on; + int dtmf_off; + int dtmf_intr_ch; + int dtmf_size; +} server; + +struct woomera_config { + FILE *file; + char *path; + char category[256]; + char buf[1024]; + int lineno; +}; + + +static inline void smg_get_current_priority(int *policy, int *priority) +{ + struct sched_param param; + pthread_getschedparam(pthread_self(), policy, ¶m); + *priority = param.sched_priority; + return; +} + +static inline int smg_calc_elapsed(struct timeval *started, struct timeval *ended) +{ + return (((ended->tv_sec * 1000) + ended->tv_usec / 1000) - + ((started->tv_sec * 1000) + started->tv_usec / 1000)); +} + +static inline int smg_check_all_busy(void) +{ + struct timeval ended; + int elapsed; + + if (server.all_ckt_gap) { + return server.all_ckt_gap; + } + + if (server.all_ckt_busy==0) { + return 0; + } + + gettimeofday(&ended,NULL); + elapsed = smg_calc_elapsed(&server.all_ckt_busy_time,&ended); + + /* seconds elapsed */ + if (elapsed > server.all_ckt_busy) { + server.all_ckt_busy=0; + return 0; + } else { + return 1; + } + +#if 0 + + if (server.all_ckt_busy > 50) { + /* When in GAP mode wait 10s */ + return server.all_ckt_busy; + } + + --server.all_ckt_busy; + if (server.all_ckt_busy < 0) { + server.all_ckt_busy=0; + } + + return server.all_ckt_busy; +#endif +} + + +static inline void smg_all_ckt_busy(void) +{ + + if (server.call_count*10 < 1500) { + server.all_ckt_busy+=1500; + } else { + server.all_ckt_busy+=server.call_count*15; + } +<<<<<<< .mine + +#if defined(BRI_PROT) + if (server.all_ckt_busy > 5000) { + server.all_ckt_busy = 5000; + } +#endif + +======= +>>>>>>> .r59 + + if (server.all_ckt_busy > 60000) { + server.all_ckt_busy = 60000; + } + +#if 0 + if (server.all_ckt_busy >= 5) { + server.all_ckt_busy=10; + } else if (server.all_ckt_busy >= 10) { + server.all_ckt_busy=15; + } else if (server.all_ckt_busy == 0) { + server.all_ckt_busy=5; + } +#endif + gettimeofday(&server.all_ckt_busy_time,NULL); +} + +static inline void smg_all_ckt_gap(void) +{ + server.all_ckt_gap=1; +} + +static inline void smg_clear_ckt_gap(void) +{ + server.all_ckt_gap=0; + gettimeofday(&server.all_ckt_busy_time,NULL); +} + + +static inline int smg_validate_span_chan(int span, int chan) +{ + if (span < 0 || span > WOOMERA_MAX_SPAN) { + return -1; + } + + if (chan < 0 || chan > WOOMERA_MAX_CHAN) { + return -1; + } + + return 0; +} + + +static inline void close_socket(int *sp) +{ + if (*sp > -1) { + close(*sp); + *sp = -1; + } +} + +static inline FILE *safe_fopen(char *path, char *flags) +{ + char buf[512] = ""; + + if (readlink(path, buf, sizeof(buf)) > 0) { + fprintf(stderr, "Symlinks not allowed! [%s] != [%s]\n", buf, path); + return NULL; + } + + return fopen(path, flags); + +} + +static inline int get_pid_from_file(char *path) +{ + FILE *tmp; + int pid; + + if (!(tmp = safe_fopen(path, "r"))) { + return 0; + } else { + fscanf(tmp, "%d", &pid); + fclose(tmp); + tmp = NULL; + } + + return pid; +} + + +static inline int woomera_open_file(struct woomera_config *cfg, char *path) +{ + FILE *f; + + if (!(f = fopen(path, "r"))) { + log_printf(0, stderr, "Cannot open file %s\n", path); + return 0; + } + + memset(cfg, 0, sizeof(*cfg)); + cfg->file = f; + cfg->path = path; + return 1; + +} + + +static inline void woomera_close_file(struct woomera_config *cfg) +{ + + if (cfg->file) { + fclose(cfg->file); + } + + memset(cfg, 0, sizeof(*cfg)); +} + + +static inline void woomera_message_init (struct woomera_message *wmsg) +{ + memset (wmsg,0,sizeof(struct woomera_message)); + pthread_mutex_init(&wmsg->flags_lock, NULL); +} + +static inline void woomera_message_clear (struct woomera_message *wmsg) +{ + pthread_mutex_destroy(&wmsg->flags_lock); +} + + +static inline void woomera_set_raw(struct woomera_interface *woomera, char *raw) +{ + char *oldraw=woomera->raw; + + if (raw) { + woomera->raw = strdup(raw); + } else { + woomera->raw = NULL; + } + + if (oldraw) { + free(oldraw); + } +} + +static inline struct media_session * woomera_get_ms(struct woomera_interface *woomera) +{ + struct media_session *ms; + pthread_mutex_lock(&woomera->ms_lock); + ms=woomera->ms; + pthread_mutex_unlock(&woomera->ms_lock); + return ms; +} + +static inline void woomera_set_ms(struct woomera_interface *woomera,struct media_session *ms) +{ + pthread_mutex_lock(&woomera->ms_lock); + woomera->ms=ms; + pthread_mutex_unlock(&woomera->ms_lock); + return; +} + +static inline void woomera_set_interface(struct woomera_interface *woomera, char *interface) +{ + char *iface = woomera->interface; + + if (interface) { + woomera->interface = strdup(interface); + } else { + woomera->interface = NULL; + } + + if (iface) { + free(iface); + } +} + +static inline void woomera_set_cause_tosig(struct woomera_interface *woomera, int cause) +{ + if (!cause) { + cause=SIGBOOST_RELEASE_CAUSE_NORMAL; + } + + woomera->q931_rel_cause_tosig=cause; +} + +static inline void woomera_set_cause_topbx(struct woomera_interface *woomera, int cause) +{ + + if (!cause) { + cause=SIGBOOST_RELEASE_CAUSE_NORMAL; + } + + if (cause == SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY) { + cause=34; + } + + woomera->q931_rel_cause_topbx=cause; + +} + + +static inline struct woomera_event *new_woomera_event(void) +{ + struct woomera_event *event = NULL; + + if ((event = malloc(sizeof(*event)))) { + memset(event, 0, sizeof(*event)); + _woomera_set_flag(event, WFLAG_MALLOC); + } + + return event; +} + + +static inline void destroy_woomera_event_data(struct woomera_event *event) +{ + if (event->data) { + free (event->data); + event->data=NULL; + } +} + +static inline void destroy_woomera_event(struct woomera_event **event, event_args free_data) +{ + if (free_data) { + free ((*event)->data); + } + if (woomera_test_flag((*event), WFLAG_MALLOC)) { + free (*event); + *event = NULL; + } +} + + +/* disable nagle's algorythm */ +static inline void no_nagle(int socket) +{ + int flag = 1; + setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int)); +} + + + + +#endif + diff --git a/ssmg/sangoma_mgd.trunk/sangoma_mgd-2008-03-07.c b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.15.tmp similarity index 99% rename from ssmg/sangoma_mgd.trunk/sangoma_mgd-2008-03-07.c rename to ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.15.tmp index 83e4a35..c105874 100644 --- a/ssmg/sangoma_mgd.trunk/sangoma_mgd-2008-03-07.c +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.15.tmp @@ -189,7 +189,7 @@ static int tc = 0; hp_tdm_api_span_t *hptdmspan[WOOMERA_MAX_SPAN]; #endif -#undef SMG_CALLING_NAME +#define SMG_CALLING_NAME 1 const char WELCOME_TEXT[] = "================================================================================\n" @@ -3246,7 +3246,6 @@ static void handle_call_start_nack(call_signal_event_t *event) ack++; } - if (event->release_cause == SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY) { log_printf(0, server.log, "WARNING: All ckt busy!\n"); smg_all_ckt_busy(); @@ -3376,7 +3375,11 @@ static void handle_call_start(call_signal_event_t *event) "Unique-Call-Id: %s%s" "Remote-Number: %s%s" "Remote-Name: %s%s" +#if defined(BRI_PROT) + "Protocol: BRI%s" +#else "Protocol: SS7%s" +#endif "User-Agent: sangoma_mgd%s" "Local-Number: %s%s" "Channel-Name: g%d/%d%s" @@ -3428,17 +3431,22 @@ static void handle_call_start(call_signal_event_t *event) -1, SIGBOOST_EVENT_CALL_STOPPED, SIGBOOST_RELEASE_CAUSE_BUSY); + log_printf(0, server.log, + "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_STOPPED [w%dg%d]\n", + event->span+1, event->chan+1); + } else { isup_exec_command(event->span, event->chan, -1, SIGBOOST_EVENT_CALL_START_NACK, SIGBOOST_RELEASE_CAUSE_BUSY); + log_printf(0, server.log, + "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_START_NACK [w%dg%d]\n", + event->span+1, event->chan+1); + } - log_printf(0, server.log, - "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_STOPPED [w%dg%d]\n", - event->span+1, event->chan+1); } destroy_woomera_event_data(&wevent); @@ -3579,6 +3587,9 @@ static void handle_call_start_nack_ack(call_signal_event_t *event) if (woomera) { woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + } else if (autoacm==0){ + log_printf(2, server.log, "Nack Ack on [w%dg%d] [Setup ID: %d] [%s]!\n", + event->span+1, event->chan+1, event->call_setup_id); } else { log_printf(0, server.log, "Event NACK ACK [w%dg%d] with valid span/chan no dev!\n", diff --git a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.16.tmp b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.16.tmp new file mode 100644 index 0000000..41e24d0 --- /dev/null +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.16.tmp @@ -0,0 +1,600 @@ +/********************************************************************************* + * sangoma_mgd.h -- Sangoma Media Gateway Daemon for Sangoma/Wanpipe Cards + * + * Copyright 05-07, Nenad Corbic + * Anthony Minessale II + * + * This program is free software, distributed under the terms of + * the GNU General Public License + * + * =============================================*/ + +#ifndef __SANGOMA_MGD_H_ +#define __SANGOMA_MGD_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "sangoma_mgd_memdbg.h" + +#ifdef __LINUX__ +#include +#endif + + +#include +#include + + +#define WOOMERA_MAX_SPAN 16 +#define WOOMERA_MAX_CHAN 31 + +#define SMG_SESSION_NAME_SZ 100 +#define SMG_CHAN_NAME_SZ 20 + +#define PIDFILE "/var/run/sangoma_mgd.pid" +#define CORE_EVENT_LEN 512 +#define WOOMERA_STRLEN 256 +#define WOOMERA_ARRAY_LEN 50 +#define WOOMERA_BODYLEN 2048 +#define WOOMERA_MIN_MEDIA_PORT 9000 +#define WOOMERA_MAX_MEDIA_PORT 9899 +#define WOOMERA_HARD_TIMEOUT 0 +#define WOOMERA_LINE_SEPERATOR "\r\n" +#define WOOMERA_RECORD_SEPERATOR "\r\n\r\n" +#define WOOMERA_DEBUG_PREFIX "[DEBUG] " +#define WOOMERA_DEBUG_LINE "------------------------------------------------------------------------------------------------" + + + + +#define STDERR fileno(stderr) +#define MAXPENDING 500 +#define MGD_STACK_SIZE 1024 * 240 + + +typedef enum { + WFLAG_RUNNING = (1 << 0), + WFLAG_LISTENING = (1 << 1), + WFLAG_MASTER_DEV = (1 << 2), + WFLAG_EVENT = (1 << 3), + WFLAG_MALLOC = (1 << 4), + WFLAG_MEDIA_RUNNING = (1 << 5), + WFLAG_MEDIA_END = (1 << 6), + WFLAG_MONITOR_RUNNING = (1 << 7), + WFLAG_HANGUP = (1 << 8), + WFLAG_ANSWER = (1 << 9), + WFLAG_MEDIA_TDM_RUNNING = (1 << 10), + WFLAG_HANGUP_ACK = (1 << 11), + WFLAG_HANGUP_NACK_ACK = (1 << 12), + WFLAG_WAIT_FOR_NACK_ACK = (1 << 13), + WFLAG_WAIT_FOR_STOPPED_ACK = (1 << 14), + WFLAG_RAW_MEDIA_STARTED = (1 << 15), + WFLAG_CALL_ACKED = (1 << 16), + WFLAG_WAIT_FOR_NACK_ACK_SENT = (1 << 17), + WFLAG_WAIT_FOR_STOPPED_ACK_SENT = (1 << 18), +} WFLAGS; + +typedef enum { + MFLAG_EXISTS = (1 << 0), + MFLAG_CONTENT = (1 << 1), +} MFLAGS; + +typedef enum { + EVENT_FREE_DATA = 1, + EVENT_KEEP_DATA = 0 +} event_args; + + +void __log_printf(int level, FILE *fp, char *file, const char *func, int line, char *fmt, ...); + +#define ysleep(usec) sched_yield() ; usleep(usec); +#define log_printf(level, fp, fmt, ...) __log_printf(level, fp, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__) + + +#define woomera_test_flag(p,flag) ({ \ + ((p)->flags & (flag)); \ + }) + +#define _woomera_set_flag(p,flag) do { \ + ((p)->flags |= (flag)); \ + } while (0) + +#define _woomera_clear_flag(p,flag) do { \ + ((p)->flags &= ~(flag)); \ + } while (0) + +#define woomera_set_flag(p,flag) do { \ + pthread_mutex_lock(&(p)->flags_lock); \ + ((p)->flags |= (flag)); \ + pthread_mutex_unlock(&(p)->flags_lock); \ + } while (0) + +#define woomera_clear_flag(p,flag) do { \ + pthread_mutex_lock(&(p)->flags_lock); \ + ((p)->flags &= ~(flag)); \ + pthread_mutex_unlock(&(p)->flags_lock); \ + } while (0) + +#define woomera_copy_flags(dest,src,flagz) do { \ + pthread_mutex_lock(&(p)->flags_lock); \ + (dest)->flags &= ~(flagz); \ + (dest)->flags |= ((src)->flags & (flagz)); \ + pthread_mutex_unlock(&(p)->flags_lock); \ + } while (0) + + +struct media_session { + int udp_sock; + int sangoma_sock; + char *ip; + int port; + time_t started; + time_t answered; + pthread_t thread; + int socket; + struct woomera_interface *woomera; + struct sockaddr_in local_addr; + struct sockaddr_in remote_addr; + struct hostent remote_hp; + struct hostent local_hp; + int skip_read_frames; + int skip_write_frames; + int hw_coding; + int udp_sync_cnt; + +#ifdef WP_HPTDM_API + hp_tdm_api_chan_t *tdmchan; +#endif + + teletone_dtmf_detect_state_t dtmf_detect; + teletone_generation_session_t tone_session; + switch_buffer_t *dtmf_buffer; + +}; + +struct woomera_message { + char callid[WOOMERA_STRLEN]; + char command[WOOMERA_STRLEN]; + char command_args[WOOMERA_STRLEN]; + char names[WOOMERA_STRLEN][WOOMERA_ARRAY_LEN]; + char values[WOOMERA_STRLEN][WOOMERA_ARRAY_LEN]; + char body[WOOMERA_BODYLEN]; + uint32_t flags; + pthread_mutex_t flags_lock; + int last; + struct woomera_message *next; +}; + +struct woomera_event { + char *data; + uint32_t flags; + struct woomera_event *next; +}; + +struct woomera_listener { + struct woomera_interface *woomera; + struct woomera_listener *next; +}; + +struct woomera_interface { + int socket; + char *raw; + char *interface; + time_t timeout; + struct sockaddr_in addr; + struct media_session *ms; + pthread_mutex_t queue_lock; + pthread_mutex_t ms_lock; + pthread_mutex_t dtmf_lock; + struct woomera_event *event_queue; + struct woomera_event *incoming_event_queue; + pthread_t thread; + uint32_t flags; + pthread_mutex_t flags_lock; + int debug; + int call_id; + FILE *log; + pthread_mutex_t vlock; + int index; + int index_hold; + int span; + int chan; + int trunk_group; + int call_count; + int q931_rel_cause_tosig; + int q931_rel_cause_topbx; + int loop_tdm; + char session[SMG_SESSION_NAME_SZ]; + struct woomera_interface *next; +}; + +struct woomera_session { + struct woomera_interface *dev; + char session[SMG_SESSION_NAME_SZ]; +}; + +#define CORE_TANK_LEN CORE_MAX_CHAN_PER_SPAN*CORE_MAX_SPANS + +struct woomera_server { + struct woomera_session process_table[CORE_MAX_CHAN_PER_SPAN][CORE_MAX_SPANS]; + struct woomera_interface *holding_tank[CORE_TANK_LEN]; + int holding_tank_index; + struct woomera_interface master_connection; + pthread_mutex_t listen_lock; + pthread_mutex_t ht_lock; + pthread_mutex_t process_lock; + pthread_mutex_t media_udp_port_lock; + pthread_mutex_t thread_count_lock; + call_signal_connection_t mcon; + call_signal_connection_t mconp; + struct woomera_listener *listeners; + char media_ip[WOOMERA_STRLEN]; + int port; + int next_media_port; + int debug; + int panic; + int thread_count; + char *logfile_path; + FILE *log; + char boost_local_ip[25]; + int boost_local_port; + char boost_remote_ip[25]; + int boost_remote_port; + pthread_t monitor_thread; + char *config_file; + int max_calls; + int call_count; + uint32_t out_tx_test; + uint32_t rxgain; + uint32_t txgain; + uint32_t hw_coding; + uint32_t loop_trace; + uint32_t hungup_waiting; + int all_ckt_gap; + int all_ckt_busy; + struct timeval all_ckt_busy_time; + int dtmf_on; + int dtmf_off; + int dtmf_intr_ch; + int dtmf_size; + int strip_cid_non_digits; +} server; + +struct woomera_config { + FILE *file; + char *path; + char category[256]; + char buf[1024]; + int lineno; +}; + + +static inline void smg_get_current_priority(int *policy, int *priority) +{ + struct sched_param param; + pthread_getschedparam(pthread_self(), policy, ¶m); + *priority = param.sched_priority; + return; +} + +static inline int smg_calc_elapsed(struct timeval *started, struct timeval *ended) +{ + return (((ended->tv_sec * 1000) + ended->tv_usec / 1000) - + ((started->tv_sec * 1000) + started->tv_usec / 1000)); +} + +static inline int smg_check_all_busy(void) +{ + struct timeval ended; + int elapsed; + + if (server.all_ckt_gap) { + return server.all_ckt_gap; + } + + if (server.all_ckt_busy==0) { + return 0; + } + + gettimeofday(&ended,NULL); + elapsed = smg_calc_elapsed(&server.all_ckt_busy_time,&ended); + + /* seconds elapsed */ + if (elapsed > server.all_ckt_busy) { + server.all_ckt_busy=0; + return 0; + } else { + return 1; + } + +#if 0 + + if (server.all_ckt_busy > 50) { + /* When in GAP mode wait 10s */ + return server.all_ckt_busy; + } + + --server.all_ckt_busy; + if (server.all_ckt_busy < 0) { + server.all_ckt_busy=0; + } + + return server.all_ckt_busy; +#endif +} + + +static inline void smg_all_ckt_busy(void) +{ + + if (server.call_count*10 < 1500) { + server.all_ckt_busy+=1500; + } else { + server.all_ckt_busy+=server.call_count*15; + } +#if defined(BRI_PROT) + if (server.all_ckt_busy > 5000) { + server.all_ckt_busy = 5000; + } +#endif + + if (server.all_ckt_busy > 60000) { + server.all_ckt_busy = 60000; + } + +#if 0 + if (server.all_ckt_busy >= 5) { + server.all_ckt_busy=10; + } else if (server.all_ckt_busy >= 10) { + server.all_ckt_busy=15; + } else if (server.all_ckt_busy == 0) { + server.all_ckt_busy=5; + } +#endif + gettimeofday(&server.all_ckt_busy_time,NULL); +} + +static inline void smg_all_ckt_gap(void) +{ + server.all_ckt_gap=1; +} + +static inline void smg_clear_ckt_gap(void) +{ + server.all_ckt_gap=0; + gettimeofday(&server.all_ckt_busy_time,NULL); +} + + +static inline int smg_validate_span_chan(int span, int chan) +{ + if (span < 0 || span > WOOMERA_MAX_SPAN) { + return -1; + } + + if (chan < 0 || chan > WOOMERA_MAX_CHAN) { + return -1; + } + + return 0; +} + + +static inline void close_socket(int *sp) +{ + if (*sp > -1) { + close(*sp); + *sp = -1; + } +} + +static inline FILE *safe_fopen(char *path, char *flags) +{ + char buf[512] = ""; + + if (readlink(path, buf, sizeof(buf)) > 0) { + fprintf(stderr, "Symlinks not allowed! [%s] != [%s]\n", buf, path); + return NULL; + } + + return fopen(path, flags); + +} + +static inline int get_pid_from_file(char *path) +{ + FILE *tmp; + int pid; + + if (!(tmp = safe_fopen(path, "r"))) { + return 0; + } else { + fscanf(tmp, "%d", &pid); + fclose(tmp); + tmp = NULL; + } + + return pid; +} + + +static inline int woomera_open_file(struct woomera_config *cfg, char *path) +{ + FILE *f; + + if (!(f = fopen(path, "r"))) { + log_printf(0, stderr, "Cannot open file %s\n", path); + return 0; + } + + memset(cfg, 0, sizeof(*cfg)); + cfg->file = f; + cfg->path = path; + return 1; + +} + + +static inline void woomera_close_file(struct woomera_config *cfg) +{ + + if (cfg->file) { + fclose(cfg->file); + } + + memset(cfg, 0, sizeof(*cfg)); +} + + +static inline void woomera_message_init (struct woomera_message *wmsg) +{ + memset (wmsg,0,sizeof(struct woomera_message)); + pthread_mutex_init(&wmsg->flags_lock, NULL); +} + +static inline void woomera_message_clear (struct woomera_message *wmsg) +{ + pthread_mutex_destroy(&wmsg->flags_lock); +} + + +static inline void woomera_set_raw(struct woomera_interface *woomera, char *raw) +{ + char *oldraw=woomera->raw; + + if (raw) { + woomera->raw = smg_strdup(raw); + } else { + woomera->raw = NULL; + } + + if (oldraw) { + smg_free(oldraw); + } +} + +static inline struct media_session * woomera_get_ms(struct woomera_interface *woomera) +{ + struct media_session *ms; + pthread_mutex_lock(&woomera->ms_lock); + ms=woomera->ms; + pthread_mutex_unlock(&woomera->ms_lock); + return ms; +} + +static inline void woomera_set_ms(struct woomera_interface *woomera,struct media_session *ms) +{ + pthread_mutex_lock(&woomera->ms_lock); + woomera->ms=ms; + pthread_mutex_unlock(&woomera->ms_lock); + return; +} + +static inline void woomera_set_interface(struct woomera_interface *woomera, char *interface) +{ + char *iface = woomera->interface; + + if (interface) { + woomera->interface = smg_strdup(interface); + } else { + woomera->interface = NULL; + } + + if (iface) { + smg_free(iface); + } +} + +static inline void woomera_set_cause_tosig(struct woomera_interface *woomera, int cause) +{ + if (!cause) { + cause=SIGBOOST_RELEASE_CAUSE_NORMAL; + } + + woomera->q931_rel_cause_tosig=cause; +} + +static inline void woomera_set_cause_topbx(struct woomera_interface *woomera, int cause) +{ + + if (!cause) { + cause=SIGBOOST_RELEASE_CAUSE_NORMAL; + } + + if (cause == SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY) { + cause=34; + } + + woomera->q931_rel_cause_topbx=cause; + +} + + +static inline struct woomera_event *new_woomera_event(void) +{ + struct woomera_event *event = NULL; + + if ((event = smg_malloc(sizeof(*event)))) { + memset(event, 0, sizeof(*event)); + _woomera_set_flag(event, WFLAG_MALLOC); + } + + return event; +} + + +static inline void destroy_woomera_event_data(struct woomera_event *event) +{ + if (event->data) { + smg_free (event->data); + event->data=NULL; + } +} + +static inline void destroy_woomera_event(struct woomera_event **event, event_args free_data) +{ + if (free_data) { + smg_free ((*event)->data); + } + + (*event)->data=NULL; + if (woomera_test_flag((*event), WFLAG_MALLOC)) { + smg_free (*event); + *event = NULL; + } +} + + +/* disable nagle's algorythm */ +static inline void no_nagle(int socket) +{ + int flag = 1; + setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int)); +} + + + + +#endif + diff --git a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.17.tmp b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.17.tmp new file mode 100644 index 0000000..3deebd9 --- /dev/null +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.17.tmp @@ -0,0 +1,119 @@ +################################################################################ +# Sangoma MGD +# +# Author: Anthony Minessale II +# Nenad Corbic +# +# Copyright: (c) 2005 Anthony Minessale II +# +# 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. +################################################################################ + +SMG_DTMF=YES + +#Default kernel directory to be overwritten by user +#Kernel version and location +ifndef KVER + KVER=$(shell uname -r) +endif +ifndef KMOD + KMOD=/lib/modules/$(KVER) +endif +ifndef KDIR + KDIR=$(KMOD)/build +endif +ifndef KINSTDIR + KINSTDIR=$(KMOD)/kernel +endif + +CC = gcc +INSTALLPREFIX= + +INCLUDES = -I$(KDIR)/include -I ../../ssmg/libsangoma.trunk -I. -I ../../patches/kdrivers/include -I ../../patches/kdrivers/wanec/oct6100_api/include -I ../../patches/kdrivers/wanec -I/usr/local/include -I../../patches/kdrivers/include -I/usr/include/wanpipe -Ilib/libteletone/src + +CFLAGS = -D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O6 +CCFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes -g +LDFLAGS=-L lib/libteletone/.libs -L. -L/usr/local/lib -L ../../ssmg/libsangoma.trunk/.libs -lpthread -lsangoma -lm + +#Enable memory leak subsystem +#Not to be used in production +#CFLAGS += -DSMG_MEMORY_DEBUG + + +ifeq "${SMG_DTMF}" "YES" +LDFLAGS+= -lteletone +CFLAGS+= -DSMG_DTMF_ENABLE +endif + + +all: sangoma_mgd + +libs: + $(shell cd lib/libteletone; ./configure --prefix=$(INSTALLPREFIX); cd ../../; ) + $(MAKE) -C lib/libteletone all + +switch_buffer.o: switch_buffer.c switch_buffer.h + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o switch_buffer.o switch_buffer.c + +call_signal.o: call_signal.c call_signal.h + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o call_signal.o call_signal.c + +sangoma_mgd_memdbg.o: sangoma_mgd_memdbg.c sangoma_mgd_memdbg.h + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd_memdbg.o sangoma_mgd_memdbg.c + +sangoma_mgd.o: sangoma_mgd.c sangoma_mgd.h sigboost.h + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd.o sangoma_mgd.c + +sangoma_mgd: sangoma_mgd.o sangoma_mgd_memdbg.o call_signal.o switch_buffer.o sigboost.h sangoma_mgd_memdbg.h + rm -fr core* + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -o sangoma_mgd sangoma_mgd.o sangoma_mgd_memdbg.o switch_buffer.o call_signal.o $(LDFLAGS) + + + +clean: old_cleanup + make -C lib/libteletone clean + find . -name '*.o' | xargs rm -f + rm -fr sangoma_mgd pritest *.o *.so *~ *core* *.so* *.a + +distclean: clean + @echo OK + +install: all install_smg old_cleanup + +install_smg: old_cleanup + install -D -m 755 sangoma_mgd $(INSTALLPREFIX)/usr/sbin/sangoma_mgd + @if [ ! -e $(INSTALLPREFIX)/etc/sangoma_mgd.conf ]; then \ + install -D -m 755 sangoma_mgd.conf.sample $(INSTALLPREFIX)/etc/sangoma_mgd.conf; \ + fi +ifeq "${NO_SS7}" "YES" + @echo "BRI control scripts installed" + @if [ ! -e $(INSTALLPREFIX)/etc/sangoma_mgd.conf ]; then \ + install -D -m 755 sangoma_mgd.conf.sample.bri $(INSTALLPREFIX)/etc/sangoma_mgd.conf; \ + fi + install -D -m 755 ../sangoma_bri/smg_ctrl $(INSTALLPREFIX)/usr/sbin/smg_ctrl +else + @echo "SS7 control scripts installed" + @if [ ! -e $(INSTALLPREFIX)/etc/sangoma_mgd.conf ]; then \ + install -D -m 755 sangoma_mgd.conf.sample.ss7 $(INSTALLPREFIX)/etc/sangoma_mgd.conf; \ + fi + install -D -m 755 smg_ctrl $(INSTALLPREFIX)/usr/sbin/smg_ctrl + install -D -m 755 scripts/init.d/smgss7_init_ctrl $(INSTALLPREFIX)/etc/init.d/smgss7_init_ctrl + install -D -m 755 scripts/init.d/smgss7_init_ctrl $(INSTALLPREFIX)/usr/sbin/smgss7_init_ctrl + +endif + @echo "sangoma_mgd Installed" + +old_cleanup: + ./scripts/old_cleanup.sh + + +install_all: all install_smg + +uninstall: + /bin/rm $(INSTALLPREFIX)/usr/sbin/sangoma_mgd $(INSTALLPREFIX)/etc/sangoma_mgd.conf + + + diff --git a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.2.tmp b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.2.tmp index 9bc5b49..2d0c940 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.2.tmp +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.2.tmp @@ -1,108 +1,4711 @@ -################################################################################ -# Sangoma MGD -# -# Author: Anthony Minessale II -# Nenad Corbic -# -# Copyright: (c) 2005 Anthony Minessale II -# -# 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. -################################################################################ +/********************************************************************************* + * sangoma_mgd.c -- Sangoma Media Gateway Daemon for Sangoma/Wanpipe Cards + * + * Copyright 05-07, Nenad Corbic + * Anthony Minessale II + * + * This program is free software, distributed under the terms of + * the GNU General Public License + * + * ============================================= + * v1.19 Nenad Corbic + * Configurable DTMF + * Bug fix in release codes (all ckt busy) + * + * v1.18 Nenad Corbic + * Added new rel cause support based on + * digits instead of strings. + * + * v1.17 Nenad Corbic + * Added session support + * + * v1.16 Nenad Corbic + * Added hwec disable on loop ccr + * + * v1.15 Nenad Corbic + * Updated DTMF Locking + * Added delay between digits + * + * v1.14 Nenad Corbic + * Updated DTMF Library + * Fixed DTMF synchronization + * + * v1.13 Nenad Corbic + * Woomera OPAL Dialect + * Added Congestion control + * Added SCTP + * Added priority ISUP queue + * Fixed presentation + * + * v1.12 Nenad Corbic + * Fixed CCR + * Removed socket shutdown on end call. + * Let Media thread shutodwn sockets. + * + * v1.11 Nenad Corbic + * Fixed Remote asterisk/woomera connection + * Increased socket timeouts + * + * v1.10 Nenad Corbic + * Added Woomera OPAL dialect. + * Start montor thread in priority + * + * v1.9 Nenad Corbic + * Added Loop mode for ccr + * Added remote debug enable + * Fixed syslog logging. + * + * v1.8 Nenad Corbic + * Added a ccr loop mode for each channel. + * Boost can set any channel in loop mode + * + * v1.7 Nenad Corbic + * Pass trunk group number to incoming call + * chan woomera will use it to append to context + * name. Added presentation feature. + * + * v1.6 Nenad Corbic + * Use only ALAW and MLAW not SLIN. + * This reduces the load quite a bit. + * Send out ALAW/ULAW format on HELLO message. + * RxTx Gain is done now in chan_woomera. + * + * v1.5 Nenad Corbic + * Bug fix in START_NACK_ACK handling. + * When we receive START_NACK we must alwasy pull tank before + * we send out NACK_ACK this way we will not try to send NACK + * ourself. + *********************************************************************************/ + +#include "sangoma_mgd.h" +#include "q931_cause.h" + + +#define USE_SYSLOG 1 +#define CODEC_LAW_DEFAULT 1 + +#ifdef CODEC_LAW_DEFAULT +static uint32_t codec_sample=8; +#else +static uint32_t codec_sample=16; +#endif + +static char ps_progname[]="sangoma_mgd"; + +static struct woomera_interface woomera_dead_dev; + +#if 0 +#define DOTRACE +#endif + + +#define SMG_VERSION "v1.19" + +/* enable early media */ +#if 1 +#define WOOMERA_EARLY_MEDIA 1 +#endif + + +#define SMG_DTMF_ON 60 +#define SMG_DTMF_OFF 10 +#define SMG_DTMF_RATE 8000 + +#if 0 +#warning "NENAD: MEDIA SHUTDOWN" +#define MEDIA_SOCK_SHUTDOWN 1 +#endif + + +#ifdef DOTRACE +static int tc = 0; +#endif + +#if 0 +#warning "NENAD: HPTDM API" +#define WP_HPTDM_API 1 +#else +#undef WP_HPTDM_API +#endif + +#ifdef WP_HPTDM_API +hp_tdm_api_span_t *hptdmspan[WOOMERA_MAX_SPAN]; +#endif + +const char WELCOME_TEXT[] = +"================================================================================\n" +"Sangoma Media Gateway Daemon v1.19 \n" +"TDM Signal Media Gateway for Sangoma/Wanpipe Cards\n" +"Copyright 2005, 2006, 2007 \n" +"Nenad Corbic , Anthony Minessale II \n" +"This program is free software, distributed under the terms of\n" +"the GNU General Public License\n" +"================================================================================\n" +""; + + +static int master_reset=0; + +static int coredump=1; + +static int launch_media_tdm_thread(struct woomera_interface *woomera); +static int launch_woomera_thread(struct woomera_interface *woomera); +static struct woomera_interface *alloc_woomera(void); + +q931_cause_to_str_array_t q931_cause_to_str_array[255]; + + +#if 0 +static uint32_t string_to_release(char *code) +{ + if (code) { + if (!strcasecmp(code, "CHANUNAVAIL")) { + return SIGBOOST_RELEASE_CAUSE_NOANSWER; + } + + if (!strcasecmp(code, "INVALID")) { + return SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST; + } + + if (!strcasecmp(code, "ERROR")) { + return SIGBOOST_RELEASE_CAUSE_UNDEFINED; + } + + if (!strcasecmp(code, "CONGESTION")) { + //return SIGBOOST_RELEASE_CAUSE_BUSY; + return SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST; + } + + if (!strcasecmp(code, "BUSY")) { + return SIGBOOST_RELEASE_CAUSE_BUSY; + } + + if (!strcasecmp(code, "NOANSWER")) { + return SIGBOOST_RELEASE_CAUSE_NOANSWER; + } + + if (!strcasecmp(code, "ANSWER")) { + return SIGBOOST_RELEASE_CAUSE_NORMAL; + } + + if (!strcasecmp(code, "CANCEL")) { + return SIGBOOST_RELEASE_CAUSE_BUSY; + } + + if (!strcasecmp(code, "UNKNOWN")) { + return SIGBOOST_RELEASE_CAUSE_UNDEFINED; + } + + } + return SIGBOOST_RELEASE_CAUSE_NORMAL; +} + +static char * release_to_string(uint32_t rel_cause) +{ + switch (rel_cause) { + + case SIGBOOST_RELEASE_CAUSE_UNDEFINED: + return "UNKNOWN"; + case SIGBOOST_RELEASE_CAUSE_NORMAL: + return "NORMAL"; + case SIGBOOST_RELEASE_CAUSE_BUSY: + return "BUSY"; + case SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST: + return "CHANUNAVAIL"; + case SIGBOOST_RELEASE_CAUSE_CIRCUIT_RESET: + return "CANCEL"; + case SIGBOOST_RELEASE_CAUSE_NOANSWER: + return "NOANSWER"; + case SIGBOOST_CALL_SETUP_NACK_CKT_START_TIMEOUT: + return "TIMEOUT"; + case SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY: + return "CONGESTION"; + case SIGBOOST_CALL_SETUP_NACK_CALLED_NUM_TOO_BIG: + return "ERROR"; + case SIGBOOST_CALL_SETUP_NACK_CALLING_NUM_TOO_BIG: + return "ERROR"; + case SIGBOOST_CALL_SETUP_NACK_CALLED_NUM_TOO_SMALL: + return "ERROR"; + case SIGBOOST_CALL_SETUP_NACK_CALLING_NUM_TOO_SMALL: + return "ERROR"; + } + + return "NORMAL"; +} +#endif + + + +void __log_printf(int level, FILE *fp, char *file, const char *func, int line, char *fmt, ...) +{ + char *data; + int ret = 0; + va_list ap; + + if (socket < 0) { + return; + } + + if (level && level > server.debug) { + return; + } + + va_start(ap, fmt); +#ifdef SOLARIS + data = (char *) malloc(2048); + vsnprintf(data, 2048, fmt, ap); +#else + ret = vasprintf(&data, fmt, ap); +#endif + va_end(ap); + if (ret == -1) { + fprintf(stderr, "Memory Error\n"); + } else { + char date[80] = ""; + struct tm now; + time_t epoch; + + if (time(&epoch) && localtime_r(&epoch, &now)) { + strftime(date, sizeof(date), "%Y-%m-%d %T", &now); + } + +#ifdef USE_SYSLOG + syslog(LOG_DEBUG | LOG_LOCAL2, data); +#else + fprintf(fp, "[%d] %s %s:%d %s() %s", getpid(), date, file, line, func, data); +#endif + free(data); + } +#ifndef USE_SYSLOG + fflush(fp); +#endif +} + + + + +static int isup_exec_command(int span, int chan, int id, int cmd, int cause) +{ + call_signal_event_t oevent; + int retry=5; + + call_signal_event_init(&oevent, cmd, chan, span); + oevent.release_cause = cause; + + if (id >= 0) { + oevent.call_setup_id = id; + } +isup_exec_cmd_retry: + if (call_signal_connection_write(&server.mcon, &oevent) <= 0){ + + --retry; + if (retry <= 0) { + log_printf(0, server.log, + "Critical System Error: Failed to tx on ISUP socket: %s\n", + strerror(errno)); + return -1; + } else { + log_printf(0, server.log, + "System Warning: Failed to tx on ISUP socket: %s :retry %i\n", + strerror(errno),retry); + } + + goto isup_exec_cmd_retry; + } + + return 0; +} + +static int socket_printf(int socket, char *fmt, ...) +{ + char *data; + int ret = 0; + va_list ap; + + if (socket < 0) { + return -1; + } + + va_start(ap, fmt); +#ifdef SOLARIS + data = (char *) malloc(2048); + vsnprintf(data, 2048, fmt, ap); +#else + ret = vasprintf(&data, fmt, ap); +#endif + va_end(ap); + if (ret == -1) { + fprintf(stderr, "Memory Error\n"); + log_printf(0, server.log, "Crtical ERROR: Memory Error!\n"); + } else { + int err; + int len = strlen(data); + err=send(socket, data, strlen(data), 0); + if (err != strlen(data)) { + log_printf(2, server.log, "ERROR: Failed to send data to woomera socket(%i): err=%i len=%d %s\n", + socket,err,len,strerror(errno)); + ret = err; + } else { + ret = 0; + } + + free(data); + } + + return ret; +} + + + +static int woomera_next_pair(struct woomera_config *cfg, char **var, char **val) +{ + int ret = 0; + char *p, *end; + + *var = *val = NULL; + + for(;;) { + cfg->lineno++; + + if (!fgets(cfg->buf, sizeof(cfg->buf), cfg->file)) { + ret = 0; + break; + } + + *var = cfg->buf; + + if (**var == '[' && (end = strchr(*var, ']'))) { + *end = '\0'; + (*var)++; + strncpy(cfg->category, *var, sizeof(cfg->category) - 1); + continue; + } + + if (**var == '#' || **var == '\n' || **var == '\r') { + continue; + } + + if ((end = strchr(*var, '#'))) { + *end = '\0'; + end--; + } else if ((end = strchr(*var, '\n'))) { + if (*end - 1 == '\r') { + end--; + } + *end = '\0'; + } + + p = *var; + while ((*p == ' ' || *p == '\t') && p != end) { + *p = '\0'; + p++; + } + *var = p; + + if (!(*val = strchr(*var, '='))) { + ret = -1; + log_printf(0, server.log, "Invalid syntax on %s: line %d\n", cfg->path, cfg->lineno); + continue; + } else { + p = *val - 1; + *(*val) = '\0'; + (*val)++; + if (*(*val) == '>') { + *(*val) = '\0'; + (*val)++; + } + + while ((*p == ' ' || *p == '\t') && p != *var) { + *p = '\0'; + p--; + } + + p = *val; + while ((*p == ' ' || *p == '\t') && p != end) { + *p = '\0'; + p++; + } + *val = p; + ret = 1; + break; + } + } + + return ret; + +} + + +#if 0 +static void woomera_set_span_chan(struct woomera_interface *woomera, int span, int chan) +{ + pthread_mutex_lock(&woomera->vlock); + woomera->span = span; + woomera->chan = chan; + pthread_mutex_unlock(&woomera->vlock); + +} +#endif + + +static struct woomera_event *new_woomera_event_printf(struct woomera_event *ebuf, char *fmt, ...) +{ + struct woomera_event *event = NULL; + int ret = 0; + va_list ap; + + if (ebuf) { + event = ebuf; + } else if (!(event = new_woomera_event())) { + log_printf(0, server.log, "Memory Error queuing event!\n"); + return NULL; + } else { + return NULL; + } + + va_start(ap, fmt); +#ifdef SOLARIS + event->data = (char *) malloc(2048); + vsnprintf(event->data, 2048, fmt, ap); +#else + ret = vasprintf(&event->data, fmt, ap); +#endif + va_end(ap); + if (ret == -1) { + log_printf(0, server.log, "Memory Error queuing event!\n"); + destroy_woomera_event(&event, EVENT_FREE_DATA); + return NULL; + } + + return event; + +} + +static struct woomera_event *woomera_clone_event(struct woomera_event *event) +{ + struct woomera_event *clone; + + if (!(clone = new_woomera_event())) { + return NULL; + } + + memcpy(clone, event, sizeof(*event)); + clone->next = NULL; + clone->data = strdup(event->data); + + return clone; +} + +static void enqueue_event(struct woomera_interface *woomera, + struct woomera_event *event, + event_args free_data) +{ + struct woomera_event *ptr, *clone = NULL; + + assert(woomera != NULL); + assert(event != NULL); + + if (!(clone = woomera_clone_event(event))) { + log_printf(0, server.log, "Error Cloning Event\n"); + return; + } + + pthread_mutex_lock(&woomera->queue_lock); + + for (ptr = woomera->event_queue; ptr && ptr->next ; ptr = ptr->next); + + if (ptr) { + ptr->next = clone; + } else { + woomera->event_queue = clone; + } + + pthread_mutex_unlock(&woomera->queue_lock); + + woomera_set_flag(woomera, WFLAG_EVENT); + + if (free_data && event->data) { + /* The event has been duplicated, the original data + * should be freed */ + free(event->data); + event->data=NULL; + } +} + +static char *dequeue_event(struct woomera_interface *woomera) +{ + struct woomera_event *event; + char *data = NULL; + + if (!woomera) { + return NULL; + } + + pthread_mutex_lock(&woomera->queue_lock); + if (woomera->event_queue) { + event = woomera->event_queue; + woomera->event_queue = event->next; + data = event->data; + pthread_mutex_unlock(&woomera->queue_lock); + + destroy_woomera_event(&event, EVENT_KEEP_DATA); + return data; + } + pthread_mutex_unlock(&woomera->queue_lock); + + return data; +} + + +static int enqueue_event_on_listeners(struct woomera_event *event) +{ + struct woomera_listener *ptr; + int x = 0; + + assert(event != NULL); + + pthread_mutex_lock(&server.listen_lock); + for (ptr = server.listeners ; ptr ; ptr = ptr->next) { + enqueue_event(ptr->woomera, event, EVENT_KEEP_DATA); + x++; + } + pthread_mutex_unlock(&server.listen_lock); + + return x; +} + + +static void del_listener(struct woomera_interface *woomera) +{ + struct woomera_listener *ptr, *last = NULL; + + pthread_mutex_lock(&server.listen_lock); + for (ptr = server.listeners ; ptr ; ptr = ptr->next) { + if (ptr->woomera == woomera) { + if (last) { + last->next = ptr->next; + } else { + server.listeners = ptr->next; + } + free(ptr); + break; + } + last = ptr; + } + pthread_mutex_unlock(&server.listen_lock); +} + +static void add_listener(struct woomera_interface *woomera) +{ + struct woomera_listener *new; + + pthread_mutex_lock(&server.listen_lock); + + if ((new = malloc(sizeof(*new)))) { + memset(new, 0, sizeof(*new)); + new->woomera = woomera; + new->next = server.listeners; + server.listeners = new; + } else { + log_printf(0, server.log, "Memory Error adding listener!\n"); + } + + pthread_mutex_unlock(&server.listen_lock); +} + + +#ifdef SMG_DTMF_ENABLE +static int wanpipe_send_dtmf(struct woomera_interface *woomera, char *digits) +{ + struct media_session *ms = woomera_get_ms(woomera); + char *cur = NULL; + int wrote = 0; + int err; + + if (!ms) { + return -EINVAL; + } + + if (!ms->dtmf_buffer) { + log_printf(3, woomera->log, "Allocate DTMF Buffer...."); + + err=switch_buffer_create_dynamic(&ms->dtmf_buffer, 1024, server.dtmf_size, 0); + + if (err != 0) { + log_printf(0, woomera->log, "Failed to allocate DTMF Buffer!\n"); + return -ENOMEM; + } else { + log_printf(3, woomera->log, "SUCCESS!\n"); + } + + } + + log_printf(3, woomera->log, "Sending DTMF %s\n",digits); + for (cur = digits; *cur; cur++) { + if ((wrote = teletone_mux_tones(&ms->tone_session, + &ms->tone_session.TONES[(int)*cur]))) { + + pthread_mutex_lock(&woomera->dtmf_lock); + + err=switch_buffer_write(ms->dtmf_buffer, ms->tone_session.buffer, wrote * 2); + + pthread_mutex_unlock(&woomera->dtmf_lock); + + log_printf(3, woomera->log, "Sending DTMF %s Wrote=%i (err=%i)\n", + digits,wrote*2,err); + } else { + log_printf(0, woomera->log, "Error: Sending DTMF %s (err=%i)\n", + digits,wrote); + } + } + + ms->skip_read_frames = 200; + return 0; +} +#endif + +static struct woomera_interface *alloc_woomera(void) +{ + struct woomera_interface *woomera = NULL; + + if ((woomera = malloc(sizeof(struct woomera_interface)))) { + + memset(woomera, 0, sizeof(struct woomera_interface)); + + woomera->chan = -1; + woomera->span = -1; + woomera->log = server.log; + woomera->debug = server.debug; + woomera->call_id = 1; + woomera->event_queue = NULL; + woomera->q931_rel_cause_topbx=SIGBOOST_RELEASE_CAUSE_NORMAL; + woomera->q931_rel_cause_tosig=SIGBOOST_RELEASE_CAUSE_NORMAL; + + woomera_set_interface(woomera, "w-1g-1"); + + + + } + + return woomera; + +} + + +static struct woomera_interface *new_woomera_interface(int socket, struct sockaddr_in *sock_addr, int len) +{ + struct woomera_interface *woomera = NULL; + + if (socket < 0) { + log_printf(0, server.log, "Critical: Invalid Socket on new interface!\n"); + return NULL; + } + + if ((woomera = alloc_woomera())) { + if (socket >= 0) { + no_nagle(socket); + woomera->socket = socket; + } + + if (sock_addr && len) { + memcpy(&woomera->addr, sock_addr, len); + } + } + + return woomera; + +} + +static char *woomera_message_header(struct woomera_message *wmsg, char *key) +{ + int x = 0; + char *value = NULL; + + for (x = 0 ; x < wmsg->last ; x++) { + if (!strcasecmp(wmsg->names[x], key)) { + value = wmsg->values[x]; + break; + } + } + + return value; +} + + +#if 1 + +static int waitfor_socket(int fd, int timeout, int flags) +{ + struct pollfd pfds[1]; + int res; + + memset(&pfds[0], 0, sizeof(pfds[0])); + pfds[0].fd = fd; + pfds[0].events = flags; + res = poll(pfds, 1, timeout); + + if (res > 0) { + if(pfds[0].revents & POLLIN) { + res = 1; + } else if ((pfds[0].revents & POLLERR)) { + res = -1; + } else if ((pfds[0].revents & POLLNVAL)) { + res = -2; +#if 0 + log_printf(0, server.log,"System Warning: Poll Event NVAL (0x%X) (fd=%i)!\n", + pfds[0].revents, fd); +#endif + } else { +#if 0 + log_printf(0, server.log,"System Error: Poll Event Error no event (0x%X) (fd=%i)!\n", + pfds[0].revents,fd); +#endif + res = -1; + } + } + + return res; +} + +#else + +static int waitfor_socket(int fd, int timeout, int flags) +{ + struct pollfd pfds[1]; + int res; + int errflags = (POLLERR | POLLHUP | POLLNVAL); + + memset(&pfds[0], 0, sizeof(pfds[0])); + pfds[0].fd = fd; + pfds[0].events = flags | errflags; + res = poll(pfds, 1, timeout); + + if (res > 0) { + if(pfds[0].revents & POLLIN) { + res = 1; + } else if ((pfds[0].revents & errflags)) { + res = -1; + } else { +#if 0 + log_printf(0, server.log,"System Error: Poll Event Error no event (0x%X)!\n", + pfds[0].revents); +#endif + res = -1; + } + } + + return res; +} + +#endif + +#if 1 +static int waitfor_2sockets(int fda, int fdb, char *a, char *b, int timeout) +{ + struct pollfd pfds[2]; + int res = 0; + int errflags = (POLLERR | POLLHUP | POLLNVAL); + + if (fda < 0 || fdb < 0) { + return -1; + } + + *a=0; + *b=0; + + memset(pfds, 0, sizeof(pfds)); + pfds[0].fd = fda; + pfds[1].fd = fdb; + pfds[0].events = POLLIN | errflags; + pfds[1].events = POLLIN | errflags; + if ((res = poll(pfds, 2, timeout)) > 0) { + res = 1; + if ((pfds[0].revents & errflags) || (pfds[1].revents & errflags)) { + res = -1; + } else { + if ((pfds[0].revents & POLLIN)) { + *a=1; + res++; + } + if ((pfds[1].revents & POLLIN)) { + *b=1; + res++; + } + } + + if (res == 1) { + /* No event found what to do */ + res=-1; + } + } + + return res; +} +#endif + + +static struct media_session *media_session_new(struct woomera_interface *woomera) +{ + struct media_session *ms = NULL; + int x; + char *p; + int span,chan; + + span=woomera->span; + chan=woomera->chan; + + log_printf(2, server.log,"Starting new MEDIA session [%s] [%s]\n", + woomera->interface,woomera->raw?woomera->raw:"N/A"); + + if ((ms = malloc(sizeof(struct media_session)))) { + memset(ms, 0, sizeof(struct media_session)); + + if (woomera->loop_tdm != 1) { + for(x = 0; x < strlen(woomera->raw) ; x++) { + if (woomera->raw[x] == ':') { + break; + } + if (woomera->raw[x] == '/') { + break; + } + } + + ms->ip = strndup(woomera->raw, x); + time(&ms->started); + p = woomera->raw + (x+1); + ms->port = atoi(p); + } + + time(&ms->started); + woomera_set_ms(woomera,ms); + ms->woomera = woomera; + +#ifdef SMG_DTMF_ENABLE + /* Setup artificial DTMF stuff */ + memset(&ms->tone_session, 0, sizeof(ms->tone_session)); + if (teletone_init_session(&ms->tone_session, 0, NULL, NULL)) { + log_printf(0, server.log, "ERROR: Failed to initialize TONE [w%ig%i]!\n", + span+1,chan+1); + } + + ms->tone_session.rate = SMG_DTMF_RATE; + ms->tone_session.duration = server.dtmf_on * (ms->tone_session.rate / 1000); + ms->tone_session.wait = server.dtmf_off * (ms->tone_session.rate / 1000); + + teletone_dtmf_detect_init (&ms->dtmf_detect, SMG_DTMF_RATE); +#endif + + } else { + log_printf(0, server.log, "ERROR: Memory Alloc Failed [w%ig%i]!\n", + span+1,chan+1); + } + + return ms; +} + +static void media_session_free(struct media_session *ms) +{ + if (ms->ip) { + free(ms->ip); + } + +#ifdef SMG_DTMF_ENABLE + teletone_destroy_session(&ms->tone_session); + switch_buffer_destroy(&ms->dtmf_buffer); +#endif + + ms->woomera = NULL; + + free(ms); +} + + +static int create_udp_socket(struct media_session *ms, char *local_ip, int local_port, char *ip, int port) +{ + int rc; + struct hostent *result, *local_result; + char buf[512], local_buf[512]; + int err = 0; + + log_printf(5,server.log,"LocalIP %s:%d IP %s:%d \n",local_ip, local_port, ip, port); + + memset(&ms->remote_hp, 0, sizeof(ms->remote_hp)); + memset(&ms->local_hp, 0, sizeof(ms->local_hp)); + if ((ms->socket = socket(AF_INET, SOCK_DGRAM, 0))) { + gethostbyname_r(ip, &ms->remote_hp, buf, sizeof(buf), &result, &err); + gethostbyname_r(local_ip, &ms->local_hp, local_buf, sizeof(local_buf), &local_result, &err); + if (result && local_result) { + ms->remote_addr.sin_family = ms->remote_hp.h_addrtype; + memcpy((char *) &ms->remote_addr.sin_addr.s_addr, ms->remote_hp.h_addr_list[0], ms->remote_hp.h_length); + ms->remote_addr.sin_port = htons(port); + + ms->local_addr.sin_family = ms->local_hp.h_addrtype; + memcpy((char *) &ms->local_addr.sin_addr.s_addr, ms->local_hp.h_addr_list[0], ms->local_hp.h_length); + ms->local_addr.sin_port = htons(local_port); + + rc = bind(ms->socket, (struct sockaddr *) &ms->local_addr, sizeof(ms->local_addr)); + if (rc < 0) { + close(ms->socket); + ms->socket = -1; + + log_printf(5,server.log, + "Failed to bind LocalIP %s:%d IP %s:%d (%s)\n", + local_ip, local_port, ip, port,strerror(errno)); + } + + /* OK */ + + } else { + log_printf(0,server.log, + "Failed to get hostbyname LocalIP %s:%d IP %s:%d (%s)\n", + local_ip, local_port, ip, port,strerror(errno)); + } + } else { + log_printf(0,server.log, + "Failed to create/allocate UDP socket\n"); + } + + return ms->socket; +} + +static int next_media_port(void) +{ + int port; + + pthread_mutex_lock(&server.media_udp_port_lock); + port = ++server.next_media_port; + if (port > WOOMERA_MAX_MEDIA_PORT) { + server.next_media_port = WOOMERA_MIN_MEDIA_PORT; + port = WOOMERA_MIN_MEDIA_PORT; + } + pthread_mutex_unlock(&server.media_udp_port_lock); + + return port; +} + +#ifdef SMG_DTMF_ENABLE + +static int woomera_dtmf_transmit(struct media_session *ms, int mtu) +{ + struct woomera_interface *woomera = ms->woomera; + int bread; + unsigned char dtmf[1024]; + unsigned char dtmf_law[1024]; + sangoma_api_hdr_t hdrframe; + int i; + int slin_len = mtu*2; + short *data; + int used; + memset(&hdrframe,0,sizeof(hdrframe)); + + if (!ms->dtmf_buffer) { + return -1; + } + + for (;;) { + +#ifdef CODEC_LAW_DEFAULT + + pthread_mutex_lock(&woomera->dtmf_lock); + if ((used=switch_buffer_inuse(ms->dtmf_buffer)) <= 0) { + pthread_mutex_unlock(&woomera->dtmf_lock); + break; + } + + bread = switch_buffer_read(ms->dtmf_buffer, dtmf, slin_len); + pthread_mutex_unlock(&woomera->dtmf_lock); + + if (bread <= 0) { + break; + } + +#if 0 + if (bread < slin_len) { + while (bread < slin_len) { + dtmf[bread++] = 0xFF; + } + } +#endif + + log_printf(3,woomera->log,"%s: Write DTMF Got %d bytes MTU=%i Coding=%i Used=%i\n", + woomera->interface,bread,mtu,ms->hw_coding,used); + + data=(short*)dtmf; + for (i=0;ihw_coding) { + /* ALAW */ + dtmf_law[i] = linear_to_alaw((int)data[i]); + } else { + /* ULAW */ + dtmf_law[i] = linear_to_ulaw((int)data[i]); + } + } + + sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + dtmf_law, mtu, 0); + + ms->skip_write_frames+=server.dtmf_intr_ch; +#else +... + pthread_mutex_lock(&woomera->dtmf_lock); + bread = switch_buffer_read(ms->dtmf_buffer, dtmf, mtu); + pthread_mutex_unlock(&woomera->dtmf_lock); + + if (bread < mtu) { + while (bread < mtu) { + dtmf[bread++] = 0; + } + } + + log_printf(3,woomera->log,"%s: Write DTMF Got %d bytes\n", + woomera->interface,bread); + + sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + dtmf, mtu, 0); + ms->skip_write_frames++; +#endif + return 0; + } + + return -1; +} +#endif + +static void media_loop_run(struct media_session *ms) +{ + struct woomera_interface *woomera = ms->woomera; + int sangoma_frame_len = 160; + int errs=0; + int res=0; + wanpipe_tdm_api_t tdm_api; + unsigned char circuit_frame[1024]; + char filename[100]; + FILE *filed=NULL; + int loops=0; + + sangoma_api_hdr_t hdrframe; + memset(&hdrframe,0,sizeof(hdrframe)); + memset(circuit_frame,0,sizeof(circuit_frame)); + + ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1); + + log_printf(1, server.log, "Media Loop Started %s fd=%i\n", + woomera->interface,ms->sangoma_sock); + + if (ms->sangoma_sock < 0) { + log_printf(0, server.log, "WANPIPE MEDIA Socket Error (%s) if=[%s] [w%ig%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); + errs++; + } else { + + + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_NONE) < 0 ) { + errs++; + } + + if (sangoma_tdm_flush_bufs(ms->sangoma_sock, &tdm_api)) { + errs++; + } + + if (sangoma_tdm_set_usr_period(ms->sangoma_sock, &tdm_api, 20) < 0 ) { + errs++; + } + + sangoma_frame_len = sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + sangoma_tdm_disable_hwec(ms->sangoma_sock,&tdm_api); + + } + + if (errs) { + + log_printf(0, server.log, "Media Loop: failed to open tdm device %s\n", + woomera->interface); + return; + } + + if (server.loop_trace) { + sprintf(filename,"/smg/w%ig%i-loop.trace",woomera->span+1,woomera->chan+1); + unlink(filename); + filed = safe_fopen(filename, "w"); + } + + while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + ((res = waitfor_socket(ms->sangoma_sock, 1000, POLLERR | POLLIN)) >= -2)) { + + if (res == 0) { + //log_printf(4, server.log, "%s: TDM UDP Timeout !!!\n", + // woomera->interface); + /* NENAD Timeout thus just continue */ + continue; + } + + if (res == -2) { + close_socket(&ms->sangoma_sock); + ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1); + log_printf(0, server.log, "Media Loop Restart %s\n", + woomera->interface); + continue; + } + + if (res < 0 ){ + log_printf(0, server.log, "Media Loop Socket error %s\n", + woomera->interface); + break; + } + + res = sangoma_readmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + sizeof(circuit_frame), 0); + if (res < 0) { + log_printf(0, server.log, "TDM Loop ReadMsg Error: %s\n", + strerror(errno), woomera->interface); + break; + } + + if (server.loop_trace && filed != NULL) { + int i; + for (i=0;isangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + res, 0); + + res=0; + + loops++; + } + + + if (res < 0) { + log_printf(2, server.log, "Media Loop: socket error %s (fd=%i)!\n", + woomera->interface, ms->sangoma_sock); + } + + + if (server.loop_trace && filed != NULL) { + fclose(filed); + } + + sangoma_tdm_enable_hwec(ms->sangoma_sock,&tdm_api); + + sleep(1); + + close_socket(&ms->sangoma_sock); + + log_printf(1, server.log, "Media Loop Finished %s Master=%i MediaEnd=%i Loops=%i\n", + woomera->interface, + woomera_test_flag(&server.master_connection, WFLAG_RUNNING), + woomera_test_flag(woomera, WFLAG_MEDIA_END),loops); + + return; + +} + +#ifdef WP_HPTDM_API +static int media_rx_ready(void *p, unsigned char *data, int len) +{ + struct media_session *ms = (struct media_session *)p; + + if (ms->udp_sock < 0) { + return -1; + } + + return sendto(ms->udp_sock, + data,len, 0, + (struct sockaddr *) &ms->remote_addr, + sizeof(ms->remote_addr)); + + +} +#endif + +static void *media_thread_run(void *obj) +{ + struct media_session *ms = obj; + struct woomera_interface *woomera = ms->woomera; + int sangoma_frame_len = 160; + int local_port, x = 0, errs = 0, res = 0, packet_len = 0; + //int udp_cnt=0; + struct woomera_event wevent; + wanpipe_tdm_api_t tdm_api; + FILE *tx_fd=NULL; + + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || + !woomera->interface || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(2, server.log, + "MEDIA session for [%s] Cancelled! (ptr=%p)\n", + woomera->interface,woomera); + /* In this case the call will be closed via woomera_thread_run + * function. And the process table will be cleard there */ + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + media_session_free(ms); + pthread_exit(NULL); + return NULL; + } + + + log_printf(2, server.log, "MEDIA session for [%s] started (ptr=%p loop=%i)\n", + woomera->interface,woomera,woomera->loop_tdm); + + if (woomera->loop_tdm) { + media_loop_run(ms); + ms->udp_sock=-1; + woomera_set_flag(woomera, WFLAG_HANGUP); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + goto media_thread_exit; + } + + for(x = 0; x < 1000 ; x++) { + local_port = next_media_port(); + if ((ms->udp_sock = create_udp_socket(ms, server.media_ip, local_port, ms->ip, ms->port)) > -1) { + break; + } + } + + if (ms->udp_sock < 0) { + log_printf(0, server.log, "UDP Socket Error (%s) [%s] LocalPort=%d\n", + strerror(errno), woomera->interface, local_port); + + errs++; + } else { + +#ifdef WP_HPTDM_API + hp_tdm_api_span_t *span=hptdmspan[woomera->span+1]; + if (!span || !span->init) { + errs++; + } else { + hp_tdm_api_usr_callback_t usr_callback; + memset(&usr_callback,0,sizeof(usr_callback)); + usr_callback.p = ms; + usr_callback.rx_avail = media_rx_ready; + if (span->open_chan(span, &usr_callback, &ms->tdmchan,woomera->chan+1)) { + errs++; + } + } +#else + if ((ms->sangoma_sock = sangoma_create_socket_by_name(woomera->interface, NULL)) < 0) { + log_printf(0, server.log, "WANPIPE Socket Error (%s) if=[%s] [w%ig%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); + errs++; + } else { + +# ifdef CODEC_LAW_DEFAULT + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_NONE) < 0 ) { + errs++; + } +# else + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_SLINEAR) < 0 ) { + errs++; + } +# endif + if (sangoma_tdm_flush_bufs(ms->sangoma_sock, &tdm_api)) { + errs++; + } + + if (sangoma_tdm_set_usr_period(ms->sangoma_sock, &tdm_api, 20) < 0 ) { + errs++; + } + +# ifdef CODEC_LAW_DEFAULT +# ifdef LIBSANGOMA_GET_HWCODING + ms->hw_coding=sangoma_tdm_get_hw_coding(ms->sangoma_sock, &tdm_api); + if (ms->hw_coding < 0) { + errs++; + } +# else +# error "libsangoma missing hwcoding feature: not up to date!" +# endif +# endif + + sangoma_frame_len = sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + } +#endif + } + + + +#ifdef WP_HPTDM_API + /* No tdm thread */ +#else + if (!errs && + launch_media_tdm_thread(woomera)) { + errs++; + } +#endif + + if (!errs) { + + unsigned char udp_frame[4096]; + sangoma_api_hdr_t hdrframe; + memset(&hdrframe,0,sizeof(hdrframe)); + memset(udp_frame,0,sizeof(udp_frame)); +#ifdef DOTRACE + int fdin, fdout; + char path_in[512], path_out[512]; +#endif + + + +#if 0 + new_woomera_event_printf(&wevent, + "EVENT MEDIA %s AUDIO%s" + "Raw-Audio: %s:%d%s" + "Call-ID: %s%s" + "Raw-Format: %s%s" + , + woomera->interface, + WOOMERA_LINE_SEPERATOR, + server.media_ip, + local_port, + WOOMERA_LINE_SEPERATOR, + woomera->interface, + WOOMERA_LINE_SEPERATOR, + ms->hw_coding ?"ALAW":"ULAW", + WOOMERA_RECORD_SEPERATOR + ); +#else + new_woomera_event_printf(&wevent, + "EVENT MEDIA %s AUDIO%s" + "Unique-Call-Id: %s%s" + "Raw-Audio: %s:%d%s" + "Call-ID: %s%s" + "Raw-Format: PCM-16%s" + , + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + server.media_ip, + local_port, + WOOMERA_LINE_SEPERATOR, + woomera->interface, + WOOMERA_LINE_SEPERATOR, + WOOMERA_RECORD_SEPERATOR + ); +#endif + + + enqueue_event(woomera, &wevent, EVENT_FREE_DATA); + +#ifdef DOTRACE + sprintf(path_in, "/tmp/debug-in.%d.raw", tc); + sprintf(path_out, "/tmp/debug-out.%d.raw", tc++); + fdin = open(path_in, O_WRONLY | O_CREAT, O_TRUNC, 0600); + fdout = open(path_out, O_WRONLY | O_CREAT, O_TRUNC, 0600); +#endif + + if (server.out_tx_test) { + tx_fd=fopen("/smg/sound.raw","rb"); + if (!tx_fd){ + log_printf(0,server.log, "FAILED TO OPEN Sound file!\n"); + } + } + + + while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + !woomera_test_flag(woomera, WFLAG_HANGUP) && + (res = waitfor_socket(ms->udp_sock, 1000, POLLERR | POLLIN)) >= 0) { + + unsigned int fromlen = sizeof(struct sockaddr_in); + + + if (res == 0) { + log_printf(4, server.log, "%s: UDP Sock Timeout !!!\n", + woomera->interface); + /* NENAD Timeout thus just continue */ + continue; + } + + if ((packet_len = recvfrom(ms->udp_sock, udp_frame, sizeof(udp_frame), + MSG_DONTWAIT, (struct sockaddr *) &ms->local_addr, &fromlen)) < 1) { + log_printf(2, server.log, "UDP Recv Error: %s\n",strerror(errno)); + break; + } + +#if 0 + log_printf(6, server.log, "%s: UDP Receive %i !!!\n", + woomera->interface,packet_len); +#endif + + if (packet_len > 0) { + + if (packet_len != sangoma_frame_len && ms->udp_sync_cnt <= 5) { + /* Assume that we will always receive SLINEAR here */ + sangoma_tdm_set_usr_period(ms->sangoma_sock, + &tdm_api, packet_len/codec_sample); + sangoma_frame_len = + sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + log_printf(0, server.log, + "%s: UDP TDM Period ReSync to Len=%i %ims (udp=%i) \n", + woomera->interface,sangoma_frame_len, + sangoma_frame_len/codec_sample,packet_len); + + + if (++ms->udp_sync_cnt >= 6) { + sangoma_tdm_set_usr_period(ms->sangoma_sock, + &tdm_api, 20); + sangoma_frame_len = + sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + log_printf(0, server.log, + "%s: UDP TDM Period Force ReSync to 20ms \n", + woomera->interface); + } + + } + +#ifdef SMG_DTMF_ENABLE + if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) { + /* For sanity sake if we are doing the out test + * dont take any chances force tx udp data */ + if (!server.out_tx_test) { + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + } + continue; + } + } + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + continue; + } +#endif + + if (server.out_tx_test && tx_fd && + fread((void*)udp_frame, + sizeof(char), + packet_len,tx_fd) <= 0) { + + sangoma_get_full_cfg(ms->sangoma_sock,&tdm_api); + fclose(tx_fd); + tx_fd=NULL; + } + +#ifdef WP_HPTDM_API + if (ms->tdmchan->push) { + ms->tdmchan->push(ms->tdmchan,udp_frame,packet_len); + } +#else + sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + udp_frame, + packet_len, 0); +#endif + + } + +#if 0 + if (woomera->span == 1 && woomera->chan == 1) { + udp_cnt++; + if (udp_cnt && udp_cnt % 1000 == 0) { + log_printf(0, server.log, "%s: MEDIA UDP TX RX CNT %i %i\n", + woomera->interface,udp_cnt,packet_len); + } + } +#endif + } + + if (res < 0) { + log_printf(2, server.log, "Media Thread: socket error !\n"); + } + } + + + + new_woomera_event_printf(&wevent, + "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Start-Time: %ld%s" + "End-Time: %ld%s" + "Answer-Time: %ld%s" + "Call-ID: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + + woomera->session, + WOOMERA_LINE_SEPERATOR, + + time(&ms->started), + WOOMERA_LINE_SEPERATOR, + + time(NULL), + WOOMERA_LINE_SEPERATOR, + + time(&ms->answered), + WOOMERA_LINE_SEPERATOR, + + woomera->interface, + WOOMERA_LINE_SEPERATOR, + + q931_rel_to_str(woomera->q931_rel_cause_topbx), + WOOMERA_LINE_SEPERATOR, + + woomera->q931_rel_cause_topbx, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + +media_thread_exit: + + if (woomera_test_flag(woomera, WFLAG_MEDIA_TDM_RUNNING)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + while(woomera_test_flag(woomera, WFLAG_MEDIA_TDM_RUNNING)) { + usleep(1000); + sched_yield(); + } + } + + + close_socket(&ms->udp_sock); + close_socket(&ms->sangoma_sock); + + if (tx_fd){ + fclose(tx_fd); + tx_fd=NULL; + } + + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + + woomera_set_ms(woomera,NULL); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + + media_session_free(ms); + + log_printf(2, server.log, "MEDIA session for [%s] ended (ptr=%p)\n", + woomera->interface,woomera); + + + pthread_exit(NULL); + return NULL; +} + + + + +static void *media_tdm_thread_run(void *obj) +{ + struct media_session *ms = obj; + struct woomera_interface *woomera = ms->woomera; + int res = 0; + //int tdm_cnt=0; + //wanpipe_tdm_api_t tdm_api; + unsigned char circuit_frame[1024]; + sangoma_api_hdr_t hdrframe; + + memset(&hdrframe,0,sizeof(hdrframe)); + memset(circuit_frame,0,sizeof(circuit_frame)); + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || !woomera->interface) { + log_printf(2, server.log, "MEDIA TDM session for [%s] Cancelled! (ptr=%p)\n", + woomera->interface,woomera); + /* In this case the call will be closed via woomera_thread_run + * function. And the process table will be cleard there */ + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + pthread_exit(NULL); + return NULL; + } + + log_printf(2, server.log, "MEDIA TDM session for [%s] started (ptr=%p)\n", + woomera->interface,woomera); + + + while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + (res = waitfor_socket(ms->sangoma_sock, 1000, POLLERR | POLLIN)) >= -2) { + + if (res == 0) { + //log_printf(4, server.log, "%s: TDM UDP Timeout !!!\n", + // woomera->interface); + /* NENAD Timeout thus just continue */ + continue; + } else if (res == -2) { + close_socket(&ms->sangoma_sock); + ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1); + if (ms->sangoma_sock < 0) { + log_printf(0, server.log, "Media TDM Restart Failed%s\n", + woomera->interface); + break; + } + log_printf(0, server.log, "Media TDM Restart %s\n", + woomera->interface); + continue; + } else if (res < 0) { + log_printf(0, server.log, "Media TDM Sangoma Socket Error %s\n", + woomera->interface); + break; + } + + res = sangoma_readmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + sizeof(circuit_frame), 0); + if (res < 0) { + log_printf(0, server.log, "TDM ReadMsg Error: %s\n", strerror(errno)); + break; + } + + res = sendto(ms->udp_sock, + circuit_frame, + res, 0, + (struct sockaddr *) &ms->remote_addr, + sizeof(ms->remote_addr)); + + if (res < 0) { + log_printf(2, server.log, "UDP Sento Error: %s\n", strerror(errno)); + break; + } +#if 0 + if (woomera->span == 1 && woomera->chan == 1) { + tdm_cnt++; + if (tdm_cnt && tdm_cnt % 1000 == 0) { + log_printf(0, server.log, "%s: MEDIA TDM TX RX CNT %i %i\n", + woomera->interface,tdm_cnt,res); + } + } +#endif + } + + if (res < 0) { + log_printf(2, server.log, "Media TDM Thread: socket error !\n"); + } + + log_printf(2, server.log, "MEDIA TDM session for [%s] ended (ptr=%p)\n", + woomera->interface,woomera); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + + pthread_exit(NULL); + return NULL; + +} + + +/* This function must be called with process_lock + * because it modifies shared process_table */ + +static int launch_media_thread(struct woomera_interface *woomera) +{ + pthread_attr_t attr; + int result = -1; + struct media_session *ms; + + if ((ms = media_session_new(woomera))) { + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_MEDIA_RUNNING); + result = pthread_create(&ms->thread, &attr, media_thread_run, ms); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + media_session_free(woomera->ms); + + } + pthread_attr_destroy(&attr); + + } else { + log_printf(0, server.log, "Failed to start new media session\n"); + } + + return result; + +} + +static int launch_media_tdm_thread(struct woomera_interface *woomera) +{ + pthread_attr_t attr; + int result = -1; + struct media_session *ms = woomera_get_ms(woomera); + + if (!ms) { + return result; + } + + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + result = pthread_create(&ms->thread, &attr, media_tdm_thread_run, ms); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + + +static struct woomera_interface * launch_woomera_loop_thread(call_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + char callid[20]; + + sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + + if ((woomera = alloc_woomera())) { + + woomera->chan = event->chan; + woomera->span = event->span; + woomera->log = server.log; + woomera->debug = server.debug; + woomera->call_id = 1; + woomera->event_queue = NULL; + woomera->loop_tdm=1; + + } else { + log_printf(0, server.log, "Critical ERROR: memory/socket error\n"); + return NULL; + } + + woomera_set_interface(woomera,callid); + + if (launch_woomera_thread(woomera)) { + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + free(woomera); + log_printf(0, server.log, "Critical ERROR: memory/socket error\n"); + return NULL; + } + + return woomera; +} + +static int woomera_message_parse(struct woomera_interface *woomera, struct woomera_message *wmsg, int timeout) +{ + char *cur, *cr, *next = NULL, *eor = NULL; + char buf[2048]; + int res = 0, bytes = 0, sanity = 0; + struct timeval started, ended; + int elapsed, loops = 0; + int failto = 0; + int packet = 0; + + memset(wmsg, 0, sizeof(*wmsg)); + + if (woomera->socket < 0 ) { + log_printf(2, woomera->log, WOOMERA_DEBUG_PREFIX "%s Invalid Socket! %d\n", + woomera->interface,woomera->socket); + return -1; + } + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(5, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MEDIA END or HANGUP !\n", + woomera->interface); + return -1; + } + + gettimeofday(&started, NULL); + memset(buf, 0, sizeof(buf)); + + if (timeout < 0) { + timeout = abs(timeout); + failto = 1; + } else if (timeout == 0) { + timeout = -1; + } + + + while (!(eor = strstr(buf, WOOMERA_RECORD_SEPERATOR))) { + if (sanity > 1000) { + log_printf(2, woomera->log, WOOMERA_DEBUG_PREFIX "%s Failed Sanity Check!\n[%s]\n\n", woomera->interface, buf); + return -1; + } + + if ((res = waitfor_socket(woomera->socket, 1000, POLLERR | POLLIN) > 0)) { + res = recv(woomera->socket, buf, sizeof(buf), MSG_PEEK); + + if (res > 1) { + packet++; + } + if (!strncmp(buf, WOOMERA_LINE_SEPERATOR, 2)) { + res = read(woomera->socket, buf, 2); + return 0; + } + if (res == 0) { + sanity++; + /* Looks Like it's time to go! */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(5, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MEDIA END or HANGUP \n", woomera->interface); + return -1; + } + ysleep(1000); + continue; + } else if (res < 0) { + log_printf(3, woomera->log, WOOMERA_DEBUG_PREFIX + "%s error during packet retry #%d\n", + woomera->interface, loops); + return res; + } else if (loops) { + ysleep(100000); + } + } + + gettimeofday(&ended, NULL); + elapsed = (((ended.tv_sec * 1000) + ended.tv_usec / 1000) - ((started.tv_sec * 1000) + started.tv_usec / 1000)); + + if (res < 0) { + log_printf(2, woomera->log, WOOMERA_DEBUG_PREFIX "%s Bad RECV\n", + woomera->interface); + return res; + } else if (res == 0) { + sanity++; + /* Looks Like it's time to go! */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(5, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MEDIA END or HANGUP \n", woomera->interface); + return -1; + } + ysleep(1000); + continue; + } + + if (packet && loops > 150) { + log_printf(1, woomera->log, WOOMERA_DEBUG_PREFIX + "%s Timeout waiting for packet.\n", + woomera->interface); + return -1; + } + + if (timeout > 0 && (elapsed > timeout)) { + log_printf(1, woomera->log, WOOMERA_DEBUG_PREFIX + "%s Timeout [%d] reached\n", + woomera->interface, timeout); + return failto ? -1 : 0; + } + + if (woomera_test_flag(woomera, WFLAG_EVENT)) { + /* BRB! we have an Event to deliver....*/ + return 0; + } + + /* what're we still doing here? */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + !woomera_test_flag(woomera, WFLAG_RUNNING)) { + log_printf(2, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MASTER RUNNING or RUNNING!\n", woomera->interface); + return -1; + } + loops++; + } + + *eor = '\0'; + bytes = strlen(buf) + 4; + + memset(buf, 0, sizeof(buf)); + res = read(woomera->socket, buf, bytes); + next = buf; + + if (woomera->debug > 1) { + log_printf(3, woomera->log, "%s:WOOMERA RX MSG: %s\n",woomera->interface,buf); + + } + + while ((cur = next)) { + + if ((cr = strstr(cur, WOOMERA_LINE_SEPERATOR))) { + *cr = '\0'; + next = cr + (sizeof(WOOMERA_LINE_SEPERATOR) - 1); + if (!strcmp(next, WOOMERA_RECORD_SEPERATOR)) { + break; + } + } + if (!cur || !*cur) { + break; + } + + if (!wmsg->last) { + char *cmd, *id, *args; + woomera_set_flag(wmsg, MFLAG_EXISTS); + cmd = cur; + + if ((id = strchr(cmd, ' '))) { + *id = '\0'; + id++; + if ((args = strchr(id, ' '))) { + *args = '\0'; + args++; + strncpy(wmsg->command_args, args, sizeof(wmsg->command_args)-1); + } + strncpy(wmsg->callid, id, sizeof(wmsg->callid)-1); + } + + strncpy(wmsg->command, cmd, sizeof(wmsg->command)-1); + } else { + char *name, *val; + name = cur; + + if ((val = strchr(name, ':'))) { + *val = '\0'; + val++; + while (*val == ' ') { + *val = '\0'; + val++; + } + strncpy(wmsg->values[wmsg->last-1], val, WOOMERA_STRLEN); + } + strncpy(wmsg->names[wmsg->last-1], name, WOOMERA_STRLEN); + if (name && val && !strcasecmp(name, "content-type")) { + woomera_set_flag(wmsg, MFLAG_CONTENT); + bytes = atoi(val); + } + if (name && val && !strcasecmp(name, "content-length")) { + woomera_set_flag(wmsg, MFLAG_CONTENT); + bytes = atoi(val); + } + + + } + wmsg->last++; + } + + wmsg->last--; + + if (bytes && woomera_test_flag(wmsg, MFLAG_CONTENT)) { + read(woomera->socket, wmsg->body, + (bytes > sizeof(wmsg->body)) ? sizeof(wmsg->body) : bytes); + } + + return woomera_test_flag(wmsg, MFLAG_EXISTS); + +} + +static struct woomera_interface *pull_from_holding_tank(int index, int span , int chan) +{ + struct woomera_interface *woomera = NULL; + + if (index < 1 || index >= CORE_TANK_LEN) { + log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + return NULL; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] && + server.holding_tank[index] != &woomera_dead_dev) { + woomera = server.holding_tank[index]; + + /* Block this index until the call is completed */ + server.holding_tank[index] = &woomera_dead_dev; + + woomera->timeout = 0; + woomera->index = 0; + woomera->span=span; + woomera->chan=chan; + } + pthread_mutex_unlock(&server.ht_lock); + + return woomera; +} + +static void clear_from_holding_tank(int index) +{ + + if (index < 1 || index >= CORE_TANK_LEN) { + log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + return; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] == &woomera_dead_dev) { + server.holding_tank[index] = NULL; + } + pthread_mutex_unlock(&server.ht_lock); + + return; +} + +static struct woomera_interface *peek_from_holding_tank(int index) +{ + struct woomera_interface *woomera = NULL; + + if (index < 1 || index >= CORE_TANK_LEN) { + log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + return NULL; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] && + server.holding_tank[index] != &woomera_dead_dev) { + woomera = server.holding_tank[index]; + } + pthread_mutex_unlock(&server.ht_lock); + + return woomera; +} + +static int add_to_holding_tank(struct woomera_interface *woomera) +{ + int next, i, found=0; + + pthread_mutex_lock(&server.ht_lock); + + for (i=0;i= CORE_TANK_LEN) { + next = server.holding_tank_index = 1; + } + + if (next == 0) { + log_printf(0, server.log, "\nCritical Error on TANK INDEX == 0\n"); + continue; + } + + if (server.holding_tank[next]) { + continue; + } + + found=1; + break; + } + + if (!found) { + /* This means all tank vales are busy + * should never happend */ + pthread_mutex_unlock(&server.ht_lock); + log_printf(0, server.log, "\nCritical Error failed to obtain a TANK INDEX\n"); + return 0; + } + + server.holding_tank[next] = woomera; + woomera->timeout = time(NULL) + 100; + + pthread_mutex_unlock(&server.ht_lock); + return next; +} + +static int handle_woomera_media_accept_answer(struct woomera_interface *woomera, + struct woomera_message *wmsg, + int media, int answer, int accept) +{ + char *raw = woomera_message_header(wmsg, "raw-audio"); + + log_printf(4, woomera->log, "WOOMERA CMD: %s [%s]\n", + wmsg->command, woomera->interface); + + + if (woomera_test_flag(woomera, WFLAG_HANGUP) || + !woomera_test_flag(woomera, WFLAG_RUNNING) || + woomera_test_flag(woomera, WFLAG_MEDIA_END)) { + + log_printf(2, server.log, + "ERROR! call was cancelled MEDIA on HANGUP or MEDIA END!\n"); + + woomera->timeout=0; + return -1; + } + + log_printf(3, server.log,"WOOMERA: GOT %s EVENT: [%s] RAW=%s\n", + wmsg->command,wmsg->callid,raw); + + + if (raw && + woomera->raw == NULL && + !woomera_test_flag(woomera, WFLAG_RAW_MEDIA_STARTED)) { + + woomera_set_flag(woomera, WFLAG_RAW_MEDIA_STARTED); + + woomera_set_raw(woomera, raw); + + if (launch_media_thread(woomera)) { + struct woomera_event wevent; + + log_printf(4, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); + + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_RECORD_SEPERATOR + ); + + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + woomera->timeout=0; + return -1; + } + } + + if (!woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + log_printf(0, server.log,"ERROR! Monitor Thread not running!\n"); + + } else { + if (answer) { + struct media_session *ms; + + pthread_mutex_lock(&woomera->ms_lock); + if ((ms=woomera->ms)) { + time(&woomera->ms->answered); + } + pthread_mutex_unlock(&woomera->ms_lock); + + if (ms) { + isup_exec_command(woomera->span, + woomera->chan, + -1, + SIGBOOST_EVENT_CALL_ANSWERED, + 0); + log_printf(2, server.log, + "Sent SIGBOOST_EVENT_CALL_ANSWERED [w%dg%d]\n", + woomera->span+1,woomera->chan+1); + } else { + struct woomera_event wevent; + log_printf(0, server.log, + "WOOMERA ANSWER: FAILED [%s] no Media \n", + wmsg->command,wmsg->callid); + + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + woomera->timeout=0; + return -1; + } + } + } + + { + struct woomera_event wevent; + new_woomera_event_printf(&wevent, "200 %s OK%s" + "Unique-Call-Id: %s%s", + answer ? "ANSWER" : + accept ? "ACCEPT" : "MEDIA", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + } + + return 0; +} + +static int handle_woomera_call_start (struct woomera_interface *woomera, + struct woomera_message *wmsg) +{ + char *raw = woomera_message_header(wmsg, "raw-audio"); + call_signal_event_t event; + char *calling = woomera_message_header(wmsg, "local-number"); + char *presentation = woomera_message_header(wmsg, "Presentation"); + char *screening = woomera_message_header(wmsg, "Screening"); + char *rdnis = woomera_message_header(wmsg, "RDNIS"); + //char *callerid = woomera_message_header(wmsg, "local-name"); + char *called = wmsg->callid; + char *grp = wmsg->callid; + char *p; + int tg = 0; + + if (smg_check_all_busy()) { + socket_printf(woomera->socket, + "405 SMG Server All Ckt Busy!%s", WOOMERA_RECORD_SEPERATOR); + log_printf(3, woomera->log, "SMG Server Full %d (ckt busy cnt=%i)\n", + server.call_count, server.all_ckt_busy); + return -1; + } + + log_printf(2, woomera->log, "New Call %d/%d\n", server.call_count, server.max_calls); + + if ((p = strchr(called, '/'))) { + *p = '\0'; + called = p+1; + tg = atoi(grp+1) - 1; + if (tg < 0) { + tg=0; + } + } + + if (raw) { + woomera_set_raw(woomera, raw); + } + + woomera->index = add_to_holding_tank(woomera); + if (woomera->index < 1) { + socket_printf(woomera->socket, + "405 SMG Server All Tanks Busy!%s", + WOOMERA_RECORD_SEPERATOR); + log_printf(0, woomera->log, "Error: Call Tank Full (Call Cnt=%i)\n", + server.call_count); + return -1; + } + + + woomera->index_hold = woomera->index; + + call_signal_call_init(&event, calling, called, woomera->index); + + if (presentation) { + event.calling_number_presentation = atoi(presentation); + } else { + event.calling_number_presentation = 0; + } + + if (screening) { + event.calling_number_screening_ind = atoi(screening); + } else { + event.calling_number_screening_ind = 0; + } + + if (rdnis && strlen(rdnis)) { + strncpy((char*)event.redirection_string,rdnis, + sizeof(event.redirection_string)-1); + log_printf(0,server.log,"RDNIS %s\n", rdnis); + + } + + event.trunk_group = tg; + + if (call_signal_connection_write(&server.mcon, &event) <= 0) { + log_printf(0, server.log, + "Critical System Error: Failed to tx on ISUP socket [%s]: %s\n", + strerror(errno)); + socket_printf(woomera->socket, + "405 SMG Signalling Contestion!%s", + WOOMERA_RECORD_SEPERATOR); + return -1; + } + + socket_printf(woomera->socket, "100 Trying%s", WOOMERA_RECORD_SEPERATOR); + + log_printf(2, server.log, "Call Called Event [Setup ID: %d] TG=%d\n", + woomera->index,tg); + + return 0; +} + + +static void interpret_command(struct woomera_interface *woomera, struct woomera_message *wmsg) +{ + int answer = 0, media = 0, accept=0; + char *unique_id; + + + if (!strcasecmp(wmsg->command, "call")) { + int err; + if (strlen(woomera->session) != 0) { + /* Call has already been placed */ + socket_printf(woomera->socket, "400 Error Call already in progress %s", + WOOMERA_RECORD_SEPERATOR); + log_printf(0,server.log,"Woomera RX Call Even while call in progress!\n"); + return; + } + + err=handle_woomera_call_start(woomera,wmsg); + if (err) { + woomera_clear_flag(woomera, WFLAG_RUNNING); + } + return; + + } else if (!strcasecmp(wmsg->command, "bye") || !strcasecmp(wmsg->command, "quit")) { + char *cause = woomera_message_header(wmsg, "cause"); + char *q931cause = woomera_message_header(wmsg, "Q931-Cause-Code"); + + if (cause) { + log_printf(3, woomera->log, "Bye Cause Received: [%s]\n", cause); + } + if (q931cause && atoi(q931cause)) { + woomera_set_cause_tosig(woomera,atoi(q931cause)); + } + + log_printf(2, woomera->log, "WOOMERA CMD: Bye Received: [%s]\n", woomera->interface); + + woomera_clear_flag(woomera, WFLAG_RUNNING); + socket_printf(woomera->socket, "200 Connection closed%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + return; + + } else if (!strcasecmp(wmsg->command, "listen")) { + + if (woomera_test_flag(woomera, WFLAG_LISTENING)) { + socket_printf(woomera->socket, "405 Listener already started%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + } else { + char *event_string; + + woomera_set_flag(woomera, WFLAG_LISTENING); + add_listener(woomera); + + if (!strcmp(wmsg->callid,"MASTER")) { + woomera_set_flag(woomera, WFLAG_MASTER_DEV); + log_printf(0,woomera->log, "Starting MASTER Listen Device!\n"); + master_reset=0; + } + + + socket_printf(woomera->socket, "%s", + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "200 Listener enabled%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + if ((event_string = dequeue_event(&server.master_connection))) { + socket_printf(woomera->socket, "%s", event_string); + free(event_string); + event_string = NULL; + } + } + return; + + } else if ((media = !strcasecmp(wmsg->command, "debug"))) { + + int debug_level=atoi(wmsg->callid); + + if (debug_level < 10) { + server.debug=debug_level; + log_printf(0,server.log,"SMG Debugging set to %i (window=%i)\n",server.debug,server.mcon.txwindow); + } + + return; + } + + unique_id = woomera_message_header(wmsg, "Unique-Call-Id"); + if (!unique_id) { + socket_printf(woomera->socket, "400 Error no unique id found %s", + WOOMERA_RECORD_SEPERATOR); + log_printf(0,server.log,"Woomera RX Even (%s) without unique id!\n",wmsg->command); + + if (!strcasecmp(wmsg->command, "hangup")) { + woomera_clear_flag(woomera, WFLAG_RUNNING); + } + return; + } + + if (strlen(woomera->session) == 0) { + struct woomera_interface *session_woomera=NULL; + char *session=NULL; + int span, chan; + char ifname[100]; + /* If session does not exist this is an incoming call */ + sscanf(unique_id, "w%dg%d", &span, &chan); + span--; + chan--; + + log_printf(3, woomera->log, + "WOOMERA Got CMD %s Span=%d Chan=%d from session %s\n", + wmsg->command,span,chan,unique_id); + + + if (smg_validate_span_chan(span,chan) != 0) { + socket_printf(woomera->socket, + "400 Error invalid span chan in session! %s", + WOOMERA_RECORD_SEPERATOR); + + log_printf(0, woomera->log, + "WOOMERA Error invalid span chan in session %s\n", + wmsg->command,unique_id); + return; + } + + pthread_mutex_lock(&server.process_lock); + session = server.process_table[span][chan].session; + session_woomera = server.process_table[span][chan].dev; + + if (session_woomera) { + pthread_mutex_unlock(&server.process_lock); + + socket_printf(woomera->socket, "400 Error channel in use! %s", + WOOMERA_RECORD_SEPERATOR); + + log_printf(0, woomera->log, "WOOMERA Error channel in use %s\n", + wmsg->command,unique_id); + return; + } + + if (!session || strlen(session) == 0 || + strncmp(session,unique_id,sizeof(woomera->session))){ + pthread_mutex_unlock(&server.process_lock); + + socket_printf(woomera->socket, "400 Error no such session %s", + WOOMERA_RECORD_SEPERATOR); + log_printf(0, woomera->log, + "WOOMERA Warning: Cmd=%s with invalid session %s (orig=%s)\n", + wmsg->command,unique_id,session?session:"N/A"); + return; + } + + server.process_table[span][chan].dev=woomera; + strncpy(woomera->session,unique_id,sizeof(woomera->session)); + sprintf(ifname,"w%dg%d",span+1,chan+1); + woomera_set_interface(woomera, ifname); + + woomera->span=span; + woomera->chan=chan; + + pthread_mutex_unlock(&server.process_lock); + + + log_printf(3, woomera->log, "WOOMERA Got New If=%s Session %s\n", + woomera->interface, woomera->session); + + + } else if (strncmp(woomera->session,unique_id,sizeof(woomera->session))) { + socket_printf(woomera->socket, "400 Error session missmatch %s", + WOOMERA_RECORD_SEPERATOR); + return; + } + + + if (!strcasecmp(wmsg->command, "dtmf")) { + + log_printf(3, woomera->log, "WOOMERA CMD: DTMF Received: [%s] Digit %s Body %s\n", + woomera->interface, wmsg->command_args, wmsg->body); + +#ifdef SMG_DTMF_ENABLE + wanpipe_send_dtmf(woomera,wmsg->body); +#endif + socket_printf(woomera->socket, "200 DTMF OK%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + + } else if (!strcasecmp(wmsg->command, "hangup")) { + + int chan = -1, span = -1; + char *cause = woomera_message_header(wmsg, "cause"); + char *q931cause = woomera_message_header(wmsg, "Q931-Cause-Code"); + + + if (q931cause && atoi(q931cause)) { + woomera_set_cause_tosig(woomera,atoi(q931cause)); + } + + span=woomera->span; + chan=woomera->chan; + + log_printf(3, woomera->log, "WOOMERA CMD: Hangup Received: [%s] MEDIA EXIST Cause=%s\n", + woomera->interface,cause); + + if (smg_validate_span_chan(span,chan) != 0) { + socket_printf(woomera->socket, "405 No Such Channel%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + return; + } + + + log_printf(2, woomera->log, "Hangup Received: [w%dg%d]\n", + span+1,chan+1); + + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + + socket_printf(woomera->socket, "200 HANGUP OK%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + + } else if (!strcasecmp(wmsg->command, "proceed")) { + + log_printf(3, woomera->log, "WOOMERA CMD: %s [%s]\n", + wmsg->command, woomera->interface); + + socket_printf(woomera->socket, + "200 %s PROCEED OK%s" + "Unique-Call-Id: %s%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + } else if ((media = !strcasecmp(wmsg->command, "media")) || + (answer = !strcasecmp(wmsg->command, "answer")) || + (accept = !strcasecmp(wmsg->command, "accept"))) { + + handle_woomera_media_accept_answer(woomera, wmsg, media,answer,accept); + + + + } else { + log_printf(0, server.log,"WOOMERA INVALID EVENT: %s [%s] \n", + wmsg->command,wmsg->callid); + socket_printf(woomera->socket, "501 Command '%s' not implemented%s", + wmsg->command, WOOMERA_RECORD_SEPERATOR); + } +} + + +/* + EVENT INCOMING 1 + Remote-Address: 10.3.3.104 + Remote-Number: + Remote-Name: Anthony Minessale!8668630501 + Protocol: H.323 + User-Agent: Post Increment Woomera 1.0alpha1 (OpenH323 v1.17.2) 9/61 + H323-Call-Id: 887b1ff8-bb1f-da11-85c0-0007e98988c4 + Local-Number: 996 + Start-Time: Fri, 09 Sep 2005 12:25:14 -0400 + Local-Name: root +*/ + + +static void handle_call_answer(call_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + int kill = 0; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + pthread_mutex_unlock(&server.process_lock); + + if (woomera && woomera->raw) { + char callid[80]; + struct woomera_event wevent; + + if (woomera_test_flag(woomera, WFLAG_ANSWER)) { + log_printf(1, server.log, "Refusing to double-answer a call!\n"); + return; + } + + woomera_set_flag(woomera, WFLAG_ANSWER); + + if (woomera->span != event->span || woomera->chan != event->chan) { + log_printf(1, server.log, "Refusing to start media on a different channel from the one we agreed on.!\n"); + kill++; + return; + } + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(1, server.log, "Refusing to answer a dead call!\n"); + kill++; + } else { + int err; + err=0; + sprintf(callid, "w%dg%d", event->span + 1, event->chan + 1); + woomera_set_interface(woomera, callid); +#ifndef WOOMERA_EARLY_MEDIA + err=launch_media_thread(woomera); + if (err) { + log_printf(0, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Q931-Cause-Code: %d%s" + "Cause: %s%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + + + woomera_set_flag(woomera, + (WFLAG_HANGUP|WFLAG_MEDIA_END)); + woomera_clear_flag(woomera, WFLAG_RUNNING); + kill++; + } +#endif + + if (!kill) { + new_woomera_event_printf(&wevent, "EVENT CONNECT w%dg%d%s" + "Unique-Call-Id: %s%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + } + } + } else { + log_printf(1, server.log, "Answer requested on non-existant session. [w%dg%d]\n", + event->span+1, event->chan+1); + kill++; + } + +#if 0 + if (kill) { + call_signal_event_t oevent; + + if (woomera) { + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + /* Do not hangup if this call was already hungup */ + return; + } + + woomera_set_flag(woomera, WFLAG_HANGUP); + } + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + SIGBOOST_RELEASE_CAUSE_NORMAL); + + log_printf(2, server.log, "Sent Refusal SIGBOOST_EVENT_CALL_STOPPED [w%dg%d]\n", + event->span+1, event->chan+1); + } +#endif + +} + +static void handle_call_start_ack(call_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + struct woomera_event wevent; + int kill = 0; + + if ((woomera = pull_from_holding_tank(event->call_setup_id,event->span,event->chan))) { + char callid[80]; + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(1, server.log, "Refusing to ack a dead call!\n"); + kill++; + } else { + int err, span, chan; + sprintf(callid, "w%dg%d", event->span + 1, event->chan + 1); + + span = event->span; + chan = event->chan; + + woomera_set_interface(woomera, callid); + + pthread_mutex_lock(&server.process_lock); + server.process_table[span][chan].dev = woomera; + sprintf(woomera->session,"%s-%i-%i",callid,rand(),rand()); + sprintf(server.process_table[span][chan].session,"%s-%s", + callid,woomera->session); + pthread_mutex_unlock(&server.process_lock); + + + +#ifdef WOOMERA_EARLY_MEDIA + err=launch_media_thread(woomera); + if (err) { + log_printf(0, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); + + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id:%s%s" + "Q931-Cause-Code: %d%s" + "Cause: %s%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera,WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + kill++; + } +#endif + if (!kill) { + new_woomera_event_printf(&wevent, "201 Accepted%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "EVENT PROCEED w%dg%d%s" + "Unique-Call-Id: %s%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + log_printf(2, server.log, "Call Answered Event ID = %d Device = w%dg%d!\n", + event->call_setup_id,woomera->span+1,woomera->chan+1); + } + } + } else { + log_printf(1, server.log, + "Event (START ACK) %d referrs to a non-existant session (%d) [w%dg%d]!\n", + event->event_id, event->call_setup_id,event->span+1, event->chan+1); + kill++; + } + +#if 0 + if (kill) { + call_signal_event_t oevent; + + if (woomera) { + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + /* Do not hangup if this call was already hungup */ + return; + } + + woomera_set_flag(woomera, WFLAG_HANGUP); + } + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + SIGBOOST_RELEASE_CAUSE_NORMAL); + + log_printf(2, server.log, "Sent Refusal SIGBOOST_EVENT_CALL_STOPPED [w%dg%d]\n", + event->span+1, event->chan+1); + } +#endif + +} + +static void handle_call_start_nack(call_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + int span=-1, chan=-1; + int ack=0; + + /* Always ACK the incoming NACK + * Send out the NACK ACK before pulling the TANK, because + * if we send after the pull, the outgoing call could send + * a message to boost with the pulled TANK value before + * we send a NACK ACK */ + + if (smg_validate_span_chan(event->span,event->chan) == 0) { + span=event->span; + chan=event->chan; + } + + if (event->call_setup_id > 0) { + woomera=pull_from_holding_tank(event->call_setup_id,-1,-1); + } + + if (woomera) { + + struct woomera_event wevent; + + woomera_clear_flag(woomera, WFLAG_HANGUP_NACK_ACK); + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + isup_exec_command(0, + 0, + event->call_setup_id, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + 0); + + + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(0, server.log, "Event CALL START NACK on hungup call [%d]!\n", + event->call_setup_id); + } else { + + woomera_set_cause_topbx(woomera,event->release_cause); + + new_woomera_event_printf(&wevent, "501 Error!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "EVENT HANGUP w%dg%d%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(woomera->q931_rel_cause_topbx), + WOOMERA_LINE_SEPERATOR, + woomera->q931_rel_cause_topbx, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera, WFLAG_HANGUP); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + } + + /* We already did the NACK */ + ack=0; + + } else if (event->call_setup_id == 0 && + smg_validate_span_chan(event->span,event->chan) == 0) { + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + server.process_table[event->span][event->chan].dev=NULL; + memset(server.process_table[event->span][event->chan].session, + 0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + + log_printf(0, server.log, "Event START NACK on w%dg%d ptr=%p ms=%p\n", + woomera->span+1,woomera->chan+1,woomera,woomera->ms); + + woomera_clear_flag(woomera, WFLAG_HANGUP_NACK_ACK); + woomera_set_flag(woomera, + (WFLAG_HANGUP|WFLAG_MEDIA_END)); + + isup_exec_command(event->span, + event->chan, + event->call_setup_id, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + 0); + +#ifdef MEDIA_SOCK_SHUTDOWN + pthread_mutex_lock(&woomera->ms_lock); + if (woomera->ms) { + shutdown(woomera->ms->sangoma_sock, SHUT_RDWR); + shutdown(woomera->ms->udp_sock, SHUT_RDWR); + } + pthread_mutex_unlock(&woomera->ms_lock); +#endif + + + /* We already did the NACK */ + ack=0; + } else { + + ack++; + log_printf(0, server.log, "Error: No Device on valid Span Chan [w%dg%d]!\n", + event->span+1, event->chan+1); + } + + } else { + log_printf(0, server.log, + "Error: Start Nack Invalid State Should not happen [%d] [w%dg%d]!\n", + event->call_setup_id, event->span+1, event->chan+1); + ack++; + } +#if 0 + if (event->release_cause == SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY) { + log_printf(0, server.log, "WARNING: All ckt busy!\n"); + smg_all_ckt_busy(); + } +#endif +#warning "Ignoring CALL GAP" +#if 0 + if (event->release_cause == SIGBOOST_CALL_SETUP_NACK_AUTO_CALL_GAP) { + log_printf(0, server.log, "WARNING: Call Gapping Detected!\n"); + smg_all_ckt_gap(); + } +#endif + + if (ack) { + span=0; + chan=0; + if (smg_validate_span_chan(event->span,event->chan) == 0) { + span=event->span; + chan=event->chan; + } + isup_exec_command(span, + chan, + event->call_setup_id, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + 0); + + + log_printf(2, server.log, "Event (NACK ACK) %d referrs to a non-existant session (%d) [w%dg%d]!\n", + event->event_id,event->call_setup_id, event->span+1, event->chan+1); + } +} + +static void handle_call_loop_start(call_signal_event_t *event) +{ + + struct woomera_interface *woomera; + + pthread_mutex_lock(&server.process_lock); + if (server.process_table[event->span][event->chan].dev) { + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + SIGBOOST_RELEASE_CAUSE_BUSY); + + + log_printf(1, server.log, + "Sent (From Handle Loop START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg] ptr=%d\n", + event->span+1, event->chan+1, server.process_table[event->span][event->chan].dev); + + pthread_mutex_unlock(&server.process_lock); + return; + + } + pthread_mutex_unlock(&server.process_lock); + + woomera=launch_woomera_loop_thread(event); + if (woomera == NULL) { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + SIGBOOST_RELEASE_CAUSE_BUSY); + log_printf(1, server.log, + "Sent (From Handle Loop START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg] ptr=%d\n", + event->span+1, event->chan+1, server.process_table[event->span][event->chan].dev); + } + + + return; +} + +static void handle_call_start(call_signal_event_t *event) +{ + struct woomera_event wevent; + char callid[20]; + char *session; + + pthread_mutex_lock(&server.process_lock); + if (server.process_table[event->span][event->chan].dev) { + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + SIGBOOST_RELEASE_CAUSE_BUSY); + + + log_printf(0, server.log, + "Sent (From Handle START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg%d]\n", + event->span+1, event->chan+1); + + pthread_mutex_unlock(&server.process_lock); + return; + + } + + sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + sprintf(server.process_table[event->span][event->chan].session, + "%s-%i-%i",callid,rand(),rand()); + session=server.process_table[event->span][event->chan].session; + server.process_table[event->span][event->chan].dev = NULL; + pthread_mutex_unlock(&server.process_lock); + + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_ACK, + 0); + + + new_woomera_event_printf(&wevent, "EVENT INCOMING w%dg%d%s" + "Unique-Call-Id: %s%s" + "Remote-Number: %s%s" + "Remote-Name: %s%s" + "Protocol: SS7%s" + "User-Agent: sangoma_mgd%s" + "Local-Number: %s%s" + "Channel-Name: SMG-g%ds%dc%d%s" + "Trunk-Group: %d%s" + "Presentation: %d%s" + "Screening: %d%s" + "RDNIS: %s%s" + , + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + session, + WOOMERA_LINE_SEPERATOR, + event->calling_number_digits, + WOOMERA_LINE_SEPERATOR, + "", + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + event->called_number_digits, + WOOMERA_LINE_SEPERATOR, + event->trunk_group+1, + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + event->trunk_group+1, + WOOMERA_LINE_SEPERATOR, + event->calling_number_presentation, + WOOMERA_LINE_SEPERATOR, + event->calling_number_screening_ind, + WOOMERA_LINE_SEPERATOR, + event->redirection_string, + WOOMERA_RECORD_SEPERATOR + ); + + if (enqueue_event_on_listeners(&wevent)) { + enqueue_event(&server.master_connection, &wevent, EVENT_KEEP_DATA); + } else { + + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + SIGBOOST_RELEASE_CAUSE_BUSY); + + log_printf(0, server.log, + "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_STOPPED [w%dg%d]\n", + event->span+1, event->chan+1); + } + + destroy_woomera_event_data(&wevent); + +} + +static void handle_gap_abate(call_signal_event_t *event) +{ + log_printf(0, server.log, "NOTICE: GAP Cleared!\n", + event->span+1, event->chan+1); + smg_clear_ckt_gap(); +} + +static void handle_restart_ack(call_signal_connection_t *mcon,call_signal_event_t *event) +{ + mcon->rxseq_reset =0; +} + +static void handle_call_stop(call_signal_event_t *event) +{ + struct woomera_interface *woomera; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + server.process_table[event->span][event->chan].dev=NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + + woomera_set_cause_topbx(woomera,event->release_cause); + + woomera_set_flag(woomera, + (WFLAG_MEDIA_END|WFLAG_HANGUP)); + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED_ACK, + 0); + +#ifdef MEDIA_SOCK_SHUTDOWN + pthread_mutex_lock(&woomera->ms_lock); + if (woomera->ms) { + shutdown(woomera->ms->sangoma_sock, SHUT_RDWR); + shutdown(woomera->ms->udp_sock, SHUT_RDWR); + } + pthread_mutex_unlock(&woomera->ms_lock); +#endif + + log_printf(3, server.log, "Event CALL STOP on w%dg%d ptr=%p ms=%p\n", + woomera->span+1,woomera->chan+1,woomera,woomera->ms); + + } else { + + /* At this point we have already sent our STOP so its safe to ACK */ + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED_ACK, + 0); + } + + if (!woomera){ + /* This is allowed on incoming call if remote app does not answer it */ + log_printf(3, server.log, "Event CALL STOP referrs to a non-existant session [w%dg%d]!\n", + event->span+1, event->chan+1); + } +} + +static void handle_heartbeat(call_signal_event_t *event) +{ + if (!woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + log_printf(0, server.log,"ERROR! Monitor Thread not running!\n"); + } else { + int err=call_signal_connection_write(&server.mcon, event); + if (err <= 0) { + log_printf(0, server.log, + "Critical System Error: Failed to tx on ISUP socket [%s]: %s\n", + strerror(errno)); + } + } + return; +} + +static void handle_call_stop_ack(call_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + server.process_table[event->span][event->chan].dev=NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + + if (woomera) { + log_printf(2, server.log, "Stop Ack on [w%dg%d] [Setup ID: %d] [%s]!\n", + event->span+1, event->chan+1, event->call_setup_id, + woomera->interface); + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + + } else { + log_printf(2, server.log, "Event CALL_STOP_ACK(%d) referrs to a non-existant session [w%dg%d] [Setup ID: %d]!\n", + event->event_id, event->span+1, event->chan+1, event->call_setup_id); + } + + /* No need for us to do any thing here */ + return; +} + +static void handle_call_start_nack_ack(call_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + + if ((woomera=pull_from_holding_tank(event->call_setup_id,-1,-1))) { + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + + } else { + log_printf(2, server.log, + "Event NACK ACK referrs to a non-existant session [w%dg%d] [Setup ID: %d]!\n", + event->span+1, event->chan+1, event->call_setup_id); + } + +#if 1 + if (event->call_setup_id > 0) { + clear_from_holding_tank(event->call_setup_id); + } +#endif + + /* No need for us to do any thing here */ + return; +} + +#if 0 +static void validate_number(unsigned char *s) +{ + unsigned char *p; + for (p = s; *p; p++) { + if (*p < 48 || *p > 57) { + log_printf(2, server.log, "Encountered a non-numeric character [%c]!\n", *p); + *p = '\0'; + break; + } + } +} +#endif + +static int parse_ss7_event(call_signal_connection_t *mcon, call_signal_event_t *event) +{ + int ret = 0; + +#if 0 + validate_number((unsigned char*)event->called_number_digits); + validate_number((unsigned char*)event->calling_number_digits); +#endif + +#if 1 + log_printf(2, server.log, + "RX EVENT: %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i Cd=[%s] Ci=[%s]\n", + call_signal_event_id_name(event->event_id), + event->event_id, + event->span+1, + event->chan+1, + event->release_cause, + event->call_setup_id, + event->fseqno, + (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"), + (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A") + ); +#endif + +#if 0 + log_printf(2, server.log, "RX EVENT\n"); + log_printf(2, server.log, "===================================\n"); + log_printf(2, server.log, " rType: %s (%0x HEX)\n", + call_signal_event_id_name(event->event_id),event->event_id); + log_printf(2, server.log, " rSpan: [%d]\n",event->span+1); + log_printf(2, server.log, " rChan: [%d]\n",event->chan+1); + log_printf(2, server.log, " rCalledNum: %s\n", + (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A")); + log_printf(2, server.log, " rCallingNum: %s\n", + (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A")); + log_printf(2, server.log, " rCause: %d\n",event->release_cause); + log_printf(2, server.log, " rInterface: [w%dg%d]\n",event->span+1,event->chan+1); + log_printf(2, server.log, " rEvent ID: [%d]\n",event->event_id); + log_printf(2, server.log, " rSetup ID: [%d]\n",event->call_setup_id); + log_printf(2, server.log, " rSeq: [%d]\n",event->fseqno); + log_printf(2, server.log, "===================================\n"); + +#endif + +#if 0 + log_printf(2, server.log, + "\nRX EVENT\n" + "===================================\n" + " rType: %s (%0x HEX)\n" + " rSpan: [%d]\n" + " rChan: [%d]\n" + " rCalledNum: %s\n" + " rCallingNum: %s\n" + " rCause: %s\n" + " rInterface : [w%dg%d]\n" + " rEvent ID : [%d]\n" + " rSetup ID: [%d]\n" + " rSeq: [%d]\n" + "===================================\n" + "\n", + call_signal_event_id_name(event->event_id), + event->event_id, + event->span+1, + event->chan+1, + (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"), + (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A"), + release_to_string(event->release_cause), + event->span+1, + event->chan+1, + event->event_id, + event->call_setup_id, + event->fseqno + ); +#endif + + + switch(event->event_id) { + + case SIGBOOST_EVENT_CALL_START: + handle_call_start(event); + break; + case SIGBOOST_EVENT_CALL_STOPPED: + handle_call_stop(event); + break; + case SIGBOOST_EVENT_CALL_START_ACK: + handle_call_start_ack(event); + break; + case SIGBOOST_EVENT_CALL_START_NACK: + handle_call_start_nack(event); + break; + case SIGBOOST_EVENT_CALL_ANSWERED: + handle_call_answer(event); + break; + case SIGBOOST_EVENT_HEARTBEAT: + handle_heartbeat(event); + break; + case SIGBOOST_EVENT_CALL_START_NACK_ACK: + handle_call_start_nack_ack(event); + break; + case SIGBOOST_EVENT_CALL_STOPPED_ACK: + handle_call_stop_ack(event); + break; + case SIGBOOST_EVENT_INSERT_CHECK_LOOP: + handle_call_loop_start(event); + break; + case SIGBOOST_EVENT_REMOVE_CHECK_LOOP: + handle_call_stop(event); + break; + case SIGBOOST_EVENT_SYSTEM_RESTART_ACK: + handle_restart_ack(mcon,event); + break; + case SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE: + handle_gap_abate(event); + break; + default: + log_printf(0, server.log, "Warning no handler implemented for [%s]\n", + call_signal_event_id_name(event->event_id)); + break; + } + + return ret; +} + + +static void *monitor_thread_run(void *obj) +{ + int ss = 0; + int policy=0,priority=0; + char a=0,b=0; + call_signal_connection_t *mcon=&server.mcon; + call_signal_connection_t *mconp=&server.mconp; + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count++; + pthread_mutex_unlock(&server.thread_count_lock); + + woomera_set_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + + if (call_signal_connection_open(mcon, + mcon->cfg.local_ip, + mcon->cfg.local_port, + mcon->cfg.remote_ip, + mcon->cfg.remote_port) < 0) { + log_printf(0, server.log, "Error: Opening MCON Socket [%d] %s\n", + mcon->socket,strerror(errno)); + exit(-1); + } + + if (call_signal_connection_open(mconp, + mconp->cfg.local_ip, + mconp->cfg.local_port, + mconp->cfg.remote_ip, + mconp->cfg.remote_port) < 0) { + log_printf(0, server.log, "Error: Opening MCONP Socket [%d] %s\n", + mconp->socket,strerror(errno)); + exit(-1); + } + + mcon->log = server.log; + mconp->log = server.log; + + isup_exec_command(0, + 0, + -1, + SIGBOOST_EVENT_SYSTEM_RESTART, + 0); + + mcon->rxseq_reset=1; + + smg_get_current_priority(&policy,&priority); + + log_printf(1, server.log, "Open udp socket [%d] [%d]\n", + mcon->socket,mconp->socket); + log_printf(1, server.log, "Monitor Thread Started (%i:%i)\n",policy,priority); + + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { +#if 0 + ss = waitfor_socket(server.mcon.socket, 1000, POLLERR | POLLIN); +#else + ss = waitfor_2sockets(mcon->socket, + mconp->socket, + &a, &b, 1000); +#endif + + if (ss > 0) { + + call_signal_event_t *event=NULL; + int i=0; + + if (b) { +mcon_retry_priority: + if ((event = call_signal_connection_readp(mconp,i))) { + struct timeval current; + struct timeval difftime; + gettimeofday(¤t,NULL); + timersub (¤t, &event->tv, &difftime); + log_printf(3, server.log, "Socket Event P [%s] T=%d:%d\n", + call_signal_event_id_name(event->event_id), + difftime.tv_sec, difftime.tv_usec); + parse_ss7_event(mconp,event); + if (++i < 10) { + goto mcon_retry_priority; + } + + } else if (errno != EAGAIN) { + ss=-1; + log_printf(0, server.log, + "Error: Reading from Boost P Socket! (%i) %s\n", + errno,strerror(errno)); + break; + } + } + + i=0; + + if (a) { +mcon_retry: + if ((event = call_signal_connection_read(mcon,i))) { + struct timeval current; + struct timeval difftime; + gettimeofday(¤t,NULL); + timersub (¤t, &event->tv, &difftime); + log_printf(3, server.log, "Socket Event [%s] T=%d:%d\n", + call_signal_event_id_name(event->event_id), + difftime.tv_sec, difftime.tv_usec); + parse_ss7_event(mcon,event); + + if (++i < 50) { + goto mcon_retry; + } + } else if (errno != EAGAIN) { + ss=-1; + log_printf(0, server.log, + "Error: Reading from Boost Socket! (%i) %s\n", + errno,strerror(errno)); + break; + } + } + + } + + if (ss < 0){ + log_printf(0, server.log, "Thread Run: Select Socket Error!\n"); + break; + } + + } + + log_printf(1, server.log, "Close udp socket [%d] [%d]\n", + mcon->socket,mconp->socket); + call_signal_connection_close(&server.mcon); + call_signal_connection_close(&server.mconp); + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count--; + pthread_mutex_unlock(&server.thread_count_lock); + + woomera_clear_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + log_printf(0, server.log, "Monitor Thread Ended\n"); + + return NULL; +} + +static void woomera_loop_thread_run(struct woomera_interface *woomera) +{ + int err=launch_media_thread(woomera); + if (err) { + log_printf(0, server.log, "Failed to start loop media thread\n"); + woomera_set_flag(woomera, + (WFLAG_HANGUP|WFLAG_MEDIA_END)); + woomera_clear_flag(woomera, WFLAG_RUNNING); + return; + } + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + !woomera_test_flag(woomera, WFLAG_HANGUP)) { + + sleep(1); + continue; + + } + + log_printf(2, server.log, "Woomera Session: For Loop Test exiting %s\n",woomera->interface); + + + + return; +} + +static void *woomera_thread_run(void *obj) +{ + struct woomera_interface *woomera = obj; + struct woomera_message wmsg; + struct woomera_event wevent; + char *event_string; + int mwi; + int err; + int policy=0, priority=0; + int span = -1, chan = -1; + + woomera_message_init(&wmsg); + + //smg_get_current_priority(&policy,&priority); + + log_printf(2, server.log, "WOOMERA session for started (ptr=%p : loop=%i)(%i:%i)\n", + woomera,woomera->loop_tdm,policy,priority); + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count++; + pthread_mutex_unlock(&server.thread_count_lock); + + pthread_mutex_init(&woomera->queue_lock, NULL); + pthread_mutex_init(&woomera->ms_lock, NULL); + pthread_mutex_init(&woomera->dtmf_lock, NULL); + pthread_mutex_init(&woomera->vlock, NULL); + pthread_mutex_init(&woomera->flags_lock, NULL); + + if (woomera->loop_tdm) { + woomera_loop_thread_run(woomera); + goto woomera_session_close; + } + + err=socket_printf(woomera->socket, + "EVENT HELLO Sangoma Media Gateway%s" + "Supported-Protocols: TDM%s" + "Version: %s%s" + "Remote-Address: %s%s" + "Remote-Port: %d%s" + "Raw-Format: %s%s", + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + SMG_VERSION, WOOMERA_LINE_SEPERATOR, + inet_ntoa(woomera->addr.sin_addr), WOOMERA_LINE_SEPERATOR, + ntohs(woomera->addr.sin_port), WOOMERA_LINE_SEPERATOR, + server.hw_coding?"ALAW":"ULAW", WOOMERA_RECORD_SEPERATOR + ); + + if (err) { + log_printf(0, server.log, "Woomera session socket failure! (ptr=%p)\n", + woomera); + woomera_clear_flag(woomera, WFLAG_RUNNING); + goto woomera_session_close; + } + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING) && + woomera_test_flag(woomera, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + !woomera_test_flag(woomera, WFLAG_HANGUP) && + !master_reset) { + + + mwi = woomera_message_parse(woomera, &wmsg, WOOMERA_HARD_TIMEOUT); + if (mwi >= 0) { + + if (mwi) { + interpret_command(woomera, &wmsg); + } else if (woomera_test_flag(woomera, WFLAG_EVENT)){ + while ((event_string = dequeue_event(woomera))) { + if (socket_printf(woomera->socket, "%s", event_string)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + free(event_string); + log_printf(4, server.log, + "WOOMERA session (ptr=%p) print string error\n", + woomera); + break; + } + free(event_string); + } + woomera_clear_flag(woomera, WFLAG_EVENT); + } + + if (woomera->timeout > 0 && time(NULL) >= woomera->timeout) { + + /* Sent the hangup only after we sent a NACK */ + + log_printf(2, server.log, + "WOOMERA session (ptr=%p) Call Timedout ! [%s] (Timeout=%d)\n", + woomera,woomera->interface,woomera->timeout); + + /* NENAD Let the Index check run a nak */ + if (woomera->index) { + woomera_set_flag(woomera, WFLAG_HANGUP); + } + break; + } + + } else { + log_printf(3, server.log, "WOOMERA session (ptr=%p) [%s] READ MSG Error %i \n", + woomera,woomera->interface,mwi); + break; + } + + } + +woomera_session_close: + + log_printf(2, server.log, "WOOMERA session (ptr=%p) is dying [%s]: SR=%d WR=%d WF=0x%04X\n", + woomera,woomera->interface, + woomera_test_flag(&server.master_connection, WFLAG_RUNNING), + woomera_test_flag(woomera, WFLAG_RUNNING), + woomera->flags); + + + if (woomera_test_flag(woomera, WFLAG_MEDIA_RUNNING)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + while(woomera_test_flag(woomera, WFLAG_MEDIA_RUNNING)) { + usleep(100); + sched_yield(); + } + } + + + /*********************************************** + * Identify the SPAN CHAN to be used below + ***********************************************/ + + chan = woomera->chan; + span = woomera->span; + + + if (!woomera_test_flag(woomera, WFLAG_HANGUP)) { + + /* The call was not HUNGUP. This is the last check, + If the call is valid, hungup the call if the call + was never up the keep going */ + woomera_set_flag(woomera, WFLAG_HANGUP); + + if (smg_validate_span_chan(span,chan) == 0) { + + if (!woomera->index) { + woomera_set_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + woomera->q931_rel_cause_tosig); + + + log_printf(3, woomera->log, "Woomera Sent SIGBOOST_EVENT_CALL_STOPPED [w%dg%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + } else { + log_printf(0, woomera->log, "Woomera Not Sent CALL STOPPED - Instead NACK [w%dg%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + + } + }else{ + /* This can happend if an outgoing call times out + or gets hungup before it gets acked. Its not a + failure */ + + log_printf(3, woomera->log, "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + + } + +woo_re_hangup: + + + /* We must send a STOP ACK to boost telling it that we are done */ + if (woomera_test_flag(woomera, WFLAG_HANGUP_ACK)) { + + /* SMG received a HANGUP from boost. + We must now send back the ACK to the HANGUP. + Boost will not release channel until we + ACK the hangup */ + + if (smg_validate_span_chan(span,chan) == 0) { + + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED_ACK, + woomera->q931_rel_cause_tosig); + + log_printf(3, woomera->log, + "Sent (Ack) to SIGBOOST_EVENT_CALL_STOPPED_ACK [w%dg%d] [%s] ptr=%p\n", + span+1,chan+1,woomera->interface,woomera); + + }else{ + /* This should never happen! If it does + we broke protocol */ + log_printf(0, woomera->log, + "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED_ACK [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + + woomera_clear_flag(woomera, WFLAG_HANGUP_ACK); + + } + + if (woomera_test_flag(woomera, WFLAG_HANGUP_NACK_ACK)) { + + /* SMG received a NACK from boost during call startup. + We must now send back the ACK to the NACK. + Boost will not release channel until we + ACK the NACK */ + + if (smg_validate_span_chan(span,chan) == 0) { + + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + woomera->q931_rel_cause_tosig); + + log_printf(3, woomera->log, + "Sent (Nack Ack) to SIGBOOST_EVENT_CALL_START_NACK_ACK [w%dg%d] [%s] ptr=%p\n", + span+1,chan+1,woomera->interface,woomera); + + + } else { + log_printf(0, woomera->log, + "FAILED: Sent (Nack Ack) SIGBOOST_EVENT_CALL_START_NACK_ACK [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + + woomera_clear_flag(woomera, WFLAG_HANGUP_NACK_ACK); + + } + + if (woomera->index) { + + int index = woomera->index; + int timeout_cnt=0; + int overall_cnt=0; + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Timeout: %ld%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + woomera->timeout, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(18), + WOOMERA_LINE_SEPERATOR, + 18, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + while ((event_string = dequeue_event(woomera))) { + socket_printf(woomera->socket, "%s", event_string); + free(event_string); + } + + if (peek_from_holding_tank(index)) { + + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + isup_exec_command(0, + 0, + index, + SIGBOOST_EVENT_CALL_START_NACK, + 0); + + log_printf(2, woomera->log, + "Sent SIGBOOST_EVENT_CALL_START_NACK [Setup ID: %d] .. WAITING FOR NACK ACK\n", + index); + + /* SMG sent NACK to boost, however we have to wait + for boost to give us the ACK back before we + release resources. */ + + while (woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK)) { + timeout_cnt++; + if (timeout_cnt > 40000) { //10sec timeout + timeout_cnt=0; + overall_cnt++; + log_printf(0, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] ... \n", + index); + } + + if (overall_cnt > 10) { //100sec timeotu + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + break; + } + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING)) { + break; + } + + usleep(5000); + sched_yield(); + } + + if (overall_cnt > 10) { + log_printf(0, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] .. TIMEOUT on NACK ACK\n", + index); + + } else { + log_printf(2, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] .. GOT NACK ACK\n", + index); + + } + } + + } + + if (woomera_test_flag(woomera, WFLAG_EVENT)){ + while ((event_string = dequeue_event(woomera))) { + socket_printf(woomera->socket, "%s", event_string); + free(event_string); + } + woomera_clear_flag(woomera, WFLAG_EVENT); + } + + + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + int timeout_cnt=0; + int overall_cnt=0; + + /* SMG sent HANGUP to boost, however we have to wait + for boost to give us the ACK back before we + release resources. */ + + log_printf(2, woomera->log, + "Waiting for STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + + while (woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + timeout_cnt++; + if (timeout_cnt > 40000) { //10sec timeout + timeout_cnt=0; + overall_cnt++; + log_printf(0, woomera->log, + "Waiting for STOPPED ACK [%s] [id=%i] ... \n", + woomera->interface,woomera->index_hold); + } + + if (overall_cnt > 10) { //100sec + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + break; + } + + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + server.process_table[span][chan].dev != woomera) { + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + break; + } + + usleep(5000); + sched_yield(); + } + + if (!woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + if (overall_cnt > 10) { + log_printf(0, woomera->log, + "Wait TIMEDOUT on STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + + } else { + log_printf(2, woomera->log, + "Wait GOT STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + } + } + } + + /***************************************************** + * We must wait for WFLAG_WAIT_FOR_STOPPED_ACK here + * so that STOP_ACK can access the woomera + *****************************************************/ + + if (smg_validate_span_chan(span,chan) == 0) { + log_printf(2, woomera->log, + "WOOMERA Clearing Processs Table ... \n", + woomera->interface); + pthread_mutex_lock(&server.process_lock); + if (server.process_table[span][chan].dev == woomera){ + server.process_table[span][chan].dev = NULL; + memset(server.process_table[span][chan].session,0,SMG_SESSION_NAME_SZ); + } + pthread_mutex_unlock(&server.process_lock); + } + +#if 0 +//Used for testing + if (1) { + int chan = woomera->chan; + int span = woomera->span; + if (smg_validate_span_chan(span,chan) == 0) { + pthread_mutex_lock(&server.process_lock); + /* This is possible in case media thread dies on startup */ + + if (server.process_table[span][chan]){ + log_printf(0, server.log, + "Sanity Span Chan Still in use: [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + //server.process_table[span][chan] = NULL; + } + pthread_mutex_unlock(&server.process_lock); + } + } +#endif + + usleep(3000000); + + /* Sanity Check */ + if (woomera_test_flag(woomera, WFLAG_HANGUP_ACK)) { + log_printf(0, woomera->log, + "Woomera MISSED HANGUP ACK: Retry HANGUP ACK\n"); + goto woo_re_hangup; + } + if (woomera_test_flag(woomera, WFLAG_HANGUP_NACK_ACK)) { + log_printf(0, woomera->log, + "Woomera MISSED HANGUP ACK: Retry HANGUP NACK ACK\n"); + goto woo_re_hangup; + } + + /* This is where we actually pull the index + * out of the tank. We had to keep the tank + * value until the end of the call. Tank is only + * used on outgoing calls. */ + if (woomera->index_hold >= 1) { + clear_from_holding_tank(woomera->index_hold); + woomera->index_hold=0; + } + + log_printf(2, woomera->log, "Woomera Thread Finished %u\n", (unsigned long) woomera->thread); + close_socket(&woomera->socket); + woomera->socket=-1; + + /* delete queue */ + while ((event_string = dequeue_event(woomera))) { + free(event_string); + } + + if (woomera_test_flag(woomera, WFLAG_LISTENING)) { + del_listener(woomera); + } + + log_printf(2, server.log, "WOOMERA session for [%s] stopped (ptr=%p)\n", + woomera->interface,woomera); + + if (woomera_test_flag(woomera, WFLAG_MASTER_DEV)) { + log_printf(0,server.log,"MASTER Thread Stopped (ptr=%p)\n",woomera); + master_reset=0; + } + + + pthread_mutex_destroy(&woomera->queue_lock); + pthread_mutex_destroy(&woomera->ms_lock); + pthread_mutex_destroy(&woomera->dtmf_lock); + pthread_mutex_destroy(&woomera->vlock); + pthread_mutex_destroy(&woomera->flags_lock); + woomera_set_raw(woomera, NULL); + woomera_set_interface(woomera, NULL); + + woomera_message_clear(&wmsg); + + free(woomera); + pthread_mutex_lock(&server.thread_count_lock); + server.call_count--; + server.thread_count--; + pthread_mutex_unlock(&server.thread_count_lock); + + pthread_exit(NULL); + return NULL; +} + + +static int launch_woomera_thread(struct woomera_interface *woomera) +{ + int result = 0; + pthread_attr_t attr; + + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_RUNNING); + result = pthread_create(&woomera->thread, &attr, woomera_thread_run, woomera); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! (%i) %s\n", + __FUNCTION__,result,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + +static int launch_monitor_thread(void) +{ + pthread_attr_t attr; + int result = 0; + struct sched_param param; + + param.sched_priority = 10; + result = pthread_attr_init(&attr); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + result = pthread_attr_setschedparam (&attr, ¶m); + + log_printf(0,server.log,"%s: Old Priority =%i res=%i \n",__FUNCTION__, + param.sched_priority,result); + + + woomera_set_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + result = pthread_create(&server.monitor_thread, &attr, monitor_thread_run, NULL); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + + +#ifdef WP_HPTDM_API +static void *hp_tdmapi_span_run(void *obj) +{ + hp_tdm_api_span_t *span = obj; + int err; + + log_printf(0,server.log,"Starting %s span!\n",span->ifname); + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + + if (!span->run_span) { + break; + } + + err = span->run_span(span); + if (err) { + break; + } + + } + + if (span->close_span) { + span->close_span(span); + } + + sleep(3); + log_printf(0,server.log,"Stopping %s span!\n",span->ifname); + + pthread_exit(NULL); +} + + +static int launch_hptdm_api_span_thread(int span) +{ + pthread_attr_t attr; + int result = 0; + struct sched_param param; + + param.sched_priority = 5; + result = pthread_attr_init(&attr); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + result = pthread_attr_setschedparam (&attr, ¶m); + + result = pthread_create(&server.monitor_thread, &attr, hp_tdmapi_span_run, &hptdmspan[span]); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + } + pthread_attr_destroy(&attr); + + return result; +} +#endif + +static int configure_server(void) +{ + struct woomera_config cfg; + char *var, *val; + int cnt = 0; + + server.dtmf_intr_ch = -1; + + if (!woomera_open_file(&cfg, server.config_file)) { + log_printf(0, server.log, "open of %s failed\n", server.config_file); + return 0; + } + + while (woomera_next_pair(&cfg, &var, &val)) { + if (!strcasecmp(var, "boost_local_ip")) { + strncpy(server.mcon.cfg.local_ip, val, + sizeof(server.mcon.cfg.local_ip) -1); + strncpy(server.mconp.cfg.local_ip, val, + sizeof(server.mconp.cfg.local_ip) -1); + cnt++; + } else if (!strcasecmp(var, "boost_local_port")) { + server.mcon.cfg.local_port = atoi(val); + server.mconp.cfg.local_port = + server.mcon.cfg.local_port+1; + cnt++; + } else if (!strcasecmp(var, "boost_remote_ip")) { + strncpy(server.mcon.cfg.remote_ip, val, + sizeof(server.mcon.cfg.remote_ip) -1); + strncpy(server.mconp.cfg.remote_ip, val, + sizeof(server.mconp.cfg.remote_ip) -1); + cnt++; + } else if (!strcasecmp(var, "boost_remote_port")) { + server.mcon.cfg.remote_port = atoi(val); + server.mconp.cfg.remote_port = + server.mcon.cfg.remote_port+1; + cnt++; + } else if (!strcasecmp(var, "logfile_path")) { + if (!server.logfile_path) { + server.logfile_path = strdup(val); + } + } else if (!strcasecmp(var, "woomera_port")) { + server.port = atoi(val); + } else if (!strcasecmp(var, "debug_level")) { + server.debug = atoi(val); + } else if (!strcasecmp(var, "out_tx_test")) { + server.out_tx_test = atoi(val); + } else if (!strcasecmp(var, "loop_trace")) { + server.loop_trace = atoi(val); + } else if (!strcasecmp(var, "rxgain")) { + server.rxgain = atoi(val); + } else if (!strcasecmp(var, "txgain")) { + server.txgain = atoi(val); + } else if (!strcasecmp(var, "dtmf_on_duration")){ + server.dtmf_on = atoi(val); + } else if (!strcasecmp(var, "dtmf_off_duration")){ + server.dtmf_off = atoi(val); + } else if (!strcasecmp(var, "dtmf_inter_ch_duration")){ + server.dtmf_intr_ch = atoi(val); + } else if (!strcasecmp(var, "max_calls")) { + int max = atoi(val); + if (max > 0) { + server.max_calls = max; + } + } else if (!strcasecmp(var, "media_ip")) { + strncpy(server.media_ip, val, sizeof(server.media_ip) -1); + } else { + log_printf(0, server.log, "Invalid Option %s at line %d!\n", var, cfg.lineno); + } + } + + /* Post initialize */ + if (server.dtmf_on == 0){ + server.dtmf_on=SMG_DTMF_ON; + } + if (server.dtmf_off == 0) { + server.dtmf_off=SMG_DTMF_OFF; + } + if (server.dtmf_intr_ch == -1) { + server.dtmf_intr_ch = server.dtmf_on/server.dtmf_off; + } + server.dtmf_size=(server.dtmf_on+server.dtmf_off)*10*2; + + log_printf(0,server.log, "DTMF On=%i Off=%i IntrCh=%i Size=%i\n", + server.dtmf_on,server.dtmf_off,server.dtmf_intr_ch,server.dtmf_size); + + woomera_close_file(&cfg); + return cnt == 4 ? 1 : 0; +} + + + +static int main_thread(void) +{ + + struct sockaddr_in sock_addr, client_addr; + struct woomera_interface *new_woomera; + int client_sock = -1, pid = 0; + unsigned int len = 0; + FILE *tmp; + + if ((server.master_connection.socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { + log_printf(0, server.log, "socket() failed\n"); + return 1; + } + + memset(&sock_addr, 0, sizeof(sock_addr)); /* Zero out structure */ + sock_addr.sin_family = AF_INET; /* Internet address family */ + sock_addr.sin_addr.s_addr = htonl(INADDR_ANY); /* Any incoming interface */ + sock_addr.sin_port = htons(server.port); /* Local port */ + + /* Bind to the local address */ + if (bind(server.master_connection.socket, (struct sockaddr *) &sock_addr, sizeof(sock_addr)) < 0) { + log_printf(0, server.log, "bind(%d) failed\n", server.port); + return 1; + } + + /* Mark the socket so it will listen for incoming connections */ + if (listen(server.master_connection.socket, MAXPENDING) < 0) { + log_printf(0, server.log, "listen() failed\n"); + return 1; + } + + if ((pid = get_pid_from_file(PIDFILE))) { + log_printf(0, stderr, "pid %d already exists.\n", pid); + exit(0); + } + + if (!(tmp = safe_fopen(PIDFILE, "w"))) { + log_printf(0, stderr, "Error creating pidfile %s\n", PIDFILE); + return 1; + } else { + fprintf(tmp, "%d", getpid()); + fclose(tmp); + tmp = NULL; + } + + no_nagle(server.master_connection.socket); + +#if 0 + if (1) { + int span,chan; + call_signal_event_t event; +#if 0 + span=1; + chan=30; + event.span=span; + event.chan=chan; + launch_woomera_loop_thread(&event); +#else + for (span=0;span<8;span++) { + for (chan=0;chan<31;chan++) { + event.span=span; + event.chan=chan; + launch_woomera_loop_thread(&event); + } + } +#endif + } +#endif + +#ifdef WP_HPTDM_API + if (1) { + int span; + for (span=0;span<16;span++) { + hptdmspan[span] = sangoma_hptdm_api_span_init(span); + if (!hptdmspan[span]) { + break; + } else { + log_printf(0, server.log, "HP TDM API Span: %d configured...\n", + span); + launch_hptdm_api_span_thread(span); + } + } + } +#endif + + log_printf(1, server.log, "Main Process Started: Woomera Ready port: %d\n", server.port); + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + + /* Set the size of the in-out parameter */ + len = sizeof(client_addr); + + /* Wait for a client to connect */ + if ((client_sock = accept(server.master_connection.socket, (struct sockaddr *) &client_addr, &len)) < 0) { + log_printf(0, server.log, "accpet() failed\n"); + return 1; + } + + if ((new_woomera = new_woomera_interface(client_sock, &client_addr, len))) { + log_printf(2, server.log, "Starting Thread for New Connection %s:%d Sock=%d\n", + inet_ntoa(new_woomera->addr.sin_addr), + ntohs(new_woomera->addr.sin_port), + client_sock); + pthread_mutex_lock(&server.thread_count_lock); + server.call_count++; + pthread_mutex_unlock(&server.thread_count_lock); + if (launch_woomera_thread(new_woomera)) { + socket_printf(new_woomera->socket, + "501 call was cancelled!%s", + WOOMERA_RECORD_SEPERATOR); + + close_socket(&new_woomera->socket); + new_woomera->socket=-1; + free(new_woomera); + } + } else { + log_printf(0, server.log, "Critical ERROR: memory/socket error\n"); + } + } + + log_printf(1, server.log, "Main Process End\n"); + + return 0; +} + +static int do_ignore(int sig) +{ + return 0; +} + +static int do_shut(int sig) +{ + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + close_socket(&server.master_connection.socket); + log_printf(1, server.log, "Caught SIG %d, Closing Master Socket!\n", sig); + return 0; +} + +static int sangoma_tdm_init (int span) +{ +#ifdef LIBSANGOMA_GET_HWCODING + wanpipe_tdm_api_t tdm_api; + int fd=sangoma_open_tdmapi_span(span); + if (fd < 0 ){ + return -1; + } else { + server.hw_coding=sangoma_tdm_get_hw_coding(fd,&tdm_api); + close_socket(&fd); + } +#else +#error "libsangoma missing hwcoding feature: not up to date!" +#endif + return 0; +} + + +static int woomera_startup(int argc, char **argv) +{ + int x = 0, pid = 0, bg = 0; + char *cfg=NULL, *debug=NULL, *arg=NULL; + + while((arg = argv[x++])) { + + if (!strcasecmp(arg, "-hup")) { + if (! (pid = get_pid_from_file(PIDFILE))) { + log_printf(0, stderr, "Error reading pidfile %s\n", PIDFILE); + exit(1); + } else { + log_printf(0, stderr, "Killing PID %d\n", pid); + kill(pid, SIGHUP); + sleep(1); + exit(0); + } + + } else if (!strcasecmp(arg, "-term") || !strcasecmp(arg, "--term")) { + if (! (pid = get_pid_from_file(PIDFILE))) { + log_printf(0, stderr, "Error reading pidfile %s\n", PIDFILE); + exit(1); + } else { + log_printf(0, stderr, "Killing PID %d\n", pid); + kill(pid, SIGTERM); + unlink(PIDFILE); + sleep(1); + exit(0); + } + + } else if (!strcasecmp(arg, "-version")) { + fprintf(stdout, "\nSangoma Media Gateway: Version %s\n\n", SMG_VERSION); + exit(0); + + } else if (!strcasecmp(arg, "-help")) { + fprintf(stdout, "%s\n%s [-help] | [ -version] | [-hup] | [-wipe] | [[-bg] | [-debug ] | [-cfg ] | [-log ]]\n\n", WELCOME_TEXT, argv[0]); + exit(0); + } else if (!strcasecmp(arg, "-wipe")) { + unlink(PIDFILE); + } else if (!strcasecmp(arg, "-bg")) { + bg = 1; + + } else if (!strcasecmp(arg, "-g")) { + coredump = 1; + + } else if (!strcasecmp(arg, "-debug")) { + if (argv[x] && *(argv[x]) != '-') { + debug = argv[x++]; + } + } else if (!strcasecmp(arg, "-cfg")) { + if (argv[x] && *(argv[x]) != '-') { + cfg = argv[x++]; + } + } else if (!strcasecmp(arg, "-log")) { + if (argv[x] && *(argv[x]) != '-') { + server.logfile_path = strdup(argv[x++]); + } + } else if (*arg == '-') { + log_printf(0, stderr, "Unknown Option %s\n", arg); + fprintf(stdout, "%s\n%s [-help] | [-hup] | [-wipe] | [[-bg] | [-debug ] | [-cfg ] | [-log ]]\n\n", WELCOME_TEXT, argv[0]); + exit(1); + } + } + + if (1){ + int spn; + for (spn=1;spn<=WOOMERA_MAX_SPAN;spn++) { + if (sangoma_tdm_init(spn) == 0) { + break; + } + } + if (spn>WOOMERA_MAX_SPAN) { + printf("\nError: Failed to access a channel on spans 1-16\n"); + printf(" Please start Wanpipe TDM API drivers\n"); + return 0; + } + } + + if (bg && (pid = fork())) { + log_printf(0, stderr, "Backgrounding!\n"); + return 0; + } + + q931_cause_setup(); + + server.port = 42420; + server.debug = 0; + strcpy(server.media_ip, "127.0.0.1"); + server.next_media_port = WOOMERA_MIN_MEDIA_PORT; + server.log = stdout; + server.master_connection.socket = -1; + server.master_connection.event_queue = NULL; + server.config_file = cfg ? cfg : "/etc/sangoma_mgd.conf"; + pthread_mutex_init(&server.listen_lock, NULL); + pthread_mutex_init(&server.ht_lock, NULL); + pthread_mutex_init(&server.process_lock, NULL); + pthread_mutex_init(&server.media_udp_port_lock, NULL); + pthread_mutex_init(&server.thread_count_lock, NULL); + pthread_mutex_init(&server.master_connection.queue_lock, NULL); + pthread_mutex_init(&server.master_connection.flags_lock, NULL); + pthread_mutex_init(&server.mcon.lock, NULL); + server.master_connection.chan = -1; + server.master_connection.span = -1; + + if (!configure_server()) { + log_printf(0, server.log, "configuration failed!\n"); + return 0; + } + +#ifndef USE_SYSLOG + if (server.logfile_path) { + if (!(server.log = safe_fopen(server.logfile_path, "a"))) { + log_printf(0, stderr, "Error setting logfile %s!\n", server.logfile_path); + server.log = stderr; + return 0; + } + } +#endif + + + if (debug) { + server.debug = atoi(debug); + } + + if (coredump) { + struct rlimit l; + memset(&l, 0, sizeof(l)); + l.rlim_cur = RLIM_INFINITY; + l.rlim_max = RLIM_INFINITY; + if (setrlimit(RLIMIT_CORE, &l)) { + log_printf(0, stderr, "Warning: Failed to disable core size limit: %s\n", + strerror(errno)); + } + } + +#ifdef __LINUX__ + if (geteuid() && coredump) { + if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) < 0) { + log_printf(0, stderr, "Warning: Failed to disable core size limit for non-root: %s\n", + strerror(errno)); + } + } +#endif + + + + (void) signal(SIGINT,(void *) do_shut); + (void) signal(SIGPIPE,(void *) do_ignore); + (void) signal(SIGHUP,(void *) do_shut); + -SMG_DTMF=YES -<<<<<<< .mine + woomera_set_flag(&server.master_connection, WFLAG_RUNNING); + if (launch_monitor_thread()) { + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + return 0; + } + + fprintf(stderr, "%s", WELCOME_TEXT); + log_printf(0, stderr, "Woomera STARTUP Complete.\n"); -======= - ->>>>>>> .r15 -#Default kernel directory to be overwritten by user -#Kernel version and location -ifndef KVER - KVER=$(shell uname -r) -endif -ifndef KMOD - KMOD=/lib/modules/$(KVER) -endif -ifndef KDIR - KDIR=$(KMOD)/build -endif -ifndef KINSTDIR - KINSTDIR=$(KMOD)/kernel -endif + return 1; +} -CC = gcc +static int woomera_shutdown(void) +{ + char *event_string; + int told = 0, loops = 0; -INCLUDES = -I$(KDIR)/include -I ../../ssmg/libsangoma.trunk -I. -I ../../patches/kdrivers/include -I ../../patches/kdrivers/wanec/oct6100_api/include -I ../../patches/kdrivers/wanec -I/usr/local/include -I../../patches/kdrivers/include -I/usr/include/wanpipe -Ilib/libteletone/src - -CFLAGS = -D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O6 -march=i686 -CCFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes -g -LDFLAGS=-L lib/libteletone/.libs -L. -L/usr/local/lib -L ../../ssmg/libsangoma.trunk/.libs -lpthread -lsangoma -lm + close_socket(&server.master_connection.socket); + pthread_mutex_destroy(&server.listen_lock); + pthread_mutex_destroy(&server.ht_lock); + pthread_mutex_destroy(&server.process_lock); + pthread_mutex_destroy(&server.media_udp_port_lock); + pthread_mutex_destroy(&server.thread_count_lock); + pthread_mutex_destroy(&server.master_connection.queue_lock); + pthread_mutex_destroy(&server.master_connection.flags_lock); + pthread_mutex_destroy(&server.mcon.lock); + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); -ifeq "${SMG_DTMF}" "YES" -LDFLAGS+= -lteletone -CFLAGS+= -DSMG_DTMF_ENABLE -endif + if (server.logfile_path) { + free(server.logfile_path); + server.logfile_path = NULL; + } + /* delete queue */ + while ((event_string = dequeue_event(&server.master_connection))) { + free(event_string); + } -all: sangoma_mgd + while(server.thread_count > 0) { + loops++; -libs: - $(shell cd lib/libteletone; ./configure; cd ../../; ) - $(MAKE) -C lib/libteletone all + if (loops % 1000 == 0) { + told = 0; + } -switch_buffer.o: switch_buffer.c switch_buffer.h - $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o switch_buffer.o switch_buffer.c + if (loops > 10000) { + log_printf(0, server.log, "Red Alert! threads did not stop\n"); + assert(server.thread_count == 0); + } -call_signal.o: call_signal.c call_signal.h - $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o call_signal.o call_signal.c + if (told != server.thread_count) { + log_printf(1, server.log, "Waiting For %d thread%s.\n", + server.thread_count, server.thread_count == 1 ? "" : "s"); + told = server.thread_count; + } + ysleep(10000); + } + unlink(PIDFILE); + log_printf(0, stderr, "Woomera SHUTDOWN Complete.\n"); + return 0; +} -sangoma_mgd: sangoma_mgd.o call_signal.o switch_buffer.o sigboost.h - rm -fr core* - $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -o sangoma_mgd sangoma_mgd.o switch_buffer.o call_signal.o $(LDFLAGS) +int main(int argc, char *argv[]) +{ + int ret = 0; + + mlockall(MCL_FUTURE); + -sangoma_mgd.o: sangoma_mgd.c sangoma_mgd.h sigboost.h - $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd.o sangoma_mgd.c + server.hw_coding=0; + openlog (ps_progname ,LOG_PID, LOG_LOCAL2); + + if (! (ret = woomera_startup(argc, argv))) { + exit(0); + } + ret = main_thread(); -clean: old_cleanup - make -C lib/libteletone clean - find . -name '*.o' | xargs rm -f - rm -fr sangoma_mgd pritest *.o *.so *~ *core* *.so* *.a - -distclean: clean - @echo OK - -install: all install_smg old_cleanup - -install_smg: old_cleanup - install -D -m 755 sangoma_mgd $(INSTALLPREFIX)/usr/sbin/sangoma_mgd - @if [ ! -e $(INSTALLPREFIX)/etc/sangoma_mgd.conf ]; then \ - install -D -m 755 sangoma_mgd.conf.sample $(INSTALLPREFIX)/etc/sangoma_mgd.conf; \ - fi - install -D -m 755 smg_ctrl /usr/sbin/smg_ctrl - install -D -m 755 scripts/init.d/smgss7_init_ctrl /etc/init.d - @echo "sangoma_mgd Installed" - -old_cleanup: - ./scripts/old_cleanup.sh - - -install_woomera: - install -D -m 755 chan_woomera.so $(INSTALLPREFIX)/usr/lib/asterisk/modules/chan_woomera.so - @if [ ! -e $(INSTALLPREFIX)/etc/asterisk/woomera.conf ]; then \ - install -D -m 755 woomera.conf $(INSTALLPREFIX)/etc/asterisk/woomera.conf; \ - fi - @echo "chan_woomera Installed" - - -install_all: all install_smg install_woomera - -uninstall: - /bin/rm /usr/sbin/sangoma_mgd /etc/sangoma_mgd.conf + woomera_shutdown(); + return ret; +} +/** EMACS ** + * Local variables: + * mode: C + * c-basic-offset: 4 + * End: + */ diff --git a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.3.tmp b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.3.tmp index c8d853a..b9f500e 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.3.tmp +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.3.tmp @@ -30,7 +30,6 @@ ifndef KINSTDIR endif CC = gcc -INSTALLPREFIX= INCLUDES = -I$(KDIR)/include -I ../../ssmg/libsangoma.trunk -I. -I ../../patches/kdrivers/include -I ../../patches/kdrivers/wanec/oct6100_api/include -I ../../patches/kdrivers/wanec -I/usr/local/include -I../../patches/kdrivers/include -I/usr/include/wanpipe -Ilib/libteletone/src @@ -48,7 +47,7 @@ endif all: sangoma_mgd libs: - $(shell cd lib/libteletone; ./configure --prefix=$(INSTALLPREFIX); cd ../../; ) + $(shell cd lib/libteletone; ./configure; cd ../../; ) $(MAKE) -C lib/libteletone all switch_buffer.o: switch_buffer.c switch_buffer.h @@ -80,16 +79,26 @@ install_smg: old_cleanup @if [ ! -e $(INSTALLPREFIX)/etc/sangoma_mgd.conf ]; then \ install -D -m 755 sangoma_mgd.conf.sample $(INSTALLPREFIX)/etc/sangoma_mgd.conf; \ fi +<<<<<<< .mine +======= install -D -m 755 smg_ctrl $(INSTALLPREFIX)/usr/sbin/smg_ctrl install -D -m 755 scripts/init.d/smgss7_init_ctrl $(INSTALLPREFIX)/etc/init.d/smgss7_init_ctrl - install -D -m 755 scripts/init.d/smgss7_init_ctrl $(INSTALLPREFIX)/usr/sbin/smgss7_init_ctrl +>>>>>>> .r24 @echo "sangoma_mgd Installed" old_cleanup: ./scripts/old_cleanup.sh -install_all: all install_smg +install_woomera: + install -D -m 755 chan_woomera.so $(INSTALLPREFIX)/usr/lib/asterisk/modules/chan_woomera.so + @if [ ! -e $(INSTALLPREFIX)/etc/asterisk/woomera.conf ]; then \ + install -D -m 755 woomera.conf $(INSTALLPREFIX)/etc/asterisk/woomera.conf; \ + fi + @echo "chan_woomera Installed" + + +install_all: all install_smg install_woomera uninstall: /bin/rm $(INSTALLPREFIX)/usr/sbin/sangoma_mgd $(INSTALLPREFIX)/etc/sangoma_mgd.conf diff --git a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.4.tmp b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.4.tmp index 3599227..c8061da 100644 --- a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.4.tmp +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.4.tmp @@ -8,27 +8,6 @@ * the GNU General Public License * * ============================================= -<<<<<<< .mine - * v1.22 Nenad Corbic - * Bug fix on socket open. Check for retun code >= 0 - * -======= - * v1.22 Nenad Corbic - * Nov 27 2007 - * Updated DTMF Tx function - * Fixed - dtmf tx without voice - * Fxied - dtmf clipping. - * ->>>>>>> .r41 - * v1.21 Nenad Corbic - * Nov 25 2007 - * Major unit testing of each state - * Numerous bug fixes for non autoacm mode. - * Changed "Channel-Name" to tg/cic - * Added compile option WANPIPE_CHAN_NAME to change Asterisk channel - * name of chan_woomera.so. So one can use Dial(SS7/g1/${EXTE}) - * instead of WOOMERA (for example) - * * v1.20 Nenad Corbic * Added option for Auto ACM response mode. * @@ -123,7 +102,7 @@ static struct woomera_interface woomera_dead_dev; #endif -#define SMG_VERSION "v1.22" +#define SMG_VERSION "v1.20" /* enable early media */ #if 1 @@ -136,9 +115,11 @@ static struct woomera_interface woomera_dead_dev; #define SMG_DTMF_RATE 8000 #if 0 +#warning "NENAD: MEDIA SHUTDOWN" #define MEDIA_SOCK_SHUTDOWN 1 #endif + #ifdef DOTRACE static int tc = 0; #endif @@ -154,11 +135,9 @@ static int tc = 0; hp_tdm_api_span_t *hptdmspan[WOOMERA_MAX_SPAN]; #endif -#undef SMG_CALLING_NAME - const char WELCOME_TEXT[] = "================================================================================\n" -"Sangoma Media Gateway Daemon v1.22 \n" +"Sangoma Media Gateway Daemon v1.20 \n" "TDM Signal Media Gateway for Sangoma/Wanpipe Cards\n" "Copyright 2005, 2006, 2007 \n" "Nenad Corbic , Anthony Minessale II \n" @@ -639,7 +618,7 @@ static void add_listener(struct woomera_interface *woomera) } - +#ifdef SMG_DTMF_ENABLE static int wanpipe_send_dtmf(struct woomera_interface *woomera, char *digits) { struct media_session *ms = woomera_get_ms(woomera); @@ -687,6 +666,7 @@ static int wanpipe_send_dtmf(struct woomera_interface *woomera, char *digits) ms->skip_read_frames = 200; return 0; } +#endif static struct woomera_interface *alloc_woomera(void) { @@ -791,41 +771,6 @@ static int waitfor_socket(int fd, int timeout, int flags) return res; } - -static int waitfor_tx_socket(int fd, int timeout, int flags) -{ - struct pollfd pfds[1]; - int res; - - memset(&pfds[0], 0, sizeof(pfds[0])); - pfds[0].fd = fd; - pfds[0].events = flags; - res = poll(pfds, 1, timeout); - - if (res > 0) { - if (pfds[0].revents & POLLOUT) { - res = 1; - } else if ((pfds[0].revents & POLLERR)) { - res = -1; - } else if ((pfds[0].revents & POLLNVAL)) { - res = -2; -#if 0 - log_printf(0, server.log,"System Warning: Poll Event NVAL (0x%X) (fd=%i)!\n", - pfds[0].revents, fd); -#endif - } else { -#if 0 - log_printf(0, server.log,"System Error: Poll Event Error no event (0x%X) (fd=%i)!\n", - pfds[0].revents,fd); -#endif - res = -1; - } - } - - return res; -} - - #else static int waitfor_socket(int fd, int timeout, int flags) @@ -939,6 +884,7 @@ static struct media_session *media_session_new(struct woomera_interface *woomera woomera_set_ms(woomera,ms); ms->woomera = woomera; +#ifdef SMG_DTMF_ENABLE /* Setup artificial DTMF stuff */ memset(&ms->tone_session, 0, sizeof(ms->tone_session)); if (teletone_init_session(&ms->tone_session, 0, NULL, NULL)) { @@ -951,6 +897,7 @@ static struct media_session *media_session_new(struct woomera_interface *woomera ms->tone_session.wait = server.dtmf_off * (ms->tone_session.rate / 1000); teletone_dtmf_detect_init (&ms->dtmf_detect, SMG_DTMF_RATE); +#endif } else { log_printf(0, server.log, "ERROR: Memory Alloc Failed [w%ig%i]!\n", @@ -966,8 +913,10 @@ static void media_session_free(struct media_session *ms) free(ms->ip); } +#ifdef SMG_DTMF_ENABLE teletone_destroy_session(&ms->tone_session); switch_buffer_destroy(&ms->dtmf_buffer); +#endif ms->woomera = NULL; @@ -986,7 +935,7 @@ static int create_udp_socket(struct media_session *ms, char *local_ip, int local memset(&ms->remote_hp, 0, sizeof(ms->remote_hp)); memset(&ms->local_hp, 0, sizeof(ms->local_hp)); - if ((ms->socket = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) { + if ((ms->socket = socket(AF_INET, SOCK_DGRAM, 0))) { gethostbyname_r(ip, &ms->remote_hp, buf, sizeof(buf), &result, &err); gethostbyname_r(local_ip, &ms->local_hp, local_buf, sizeof(local_buf), &local_result, &err); if (result && local_result) { @@ -1038,7 +987,7 @@ static int next_media_port(void) return port; } - +#ifdef SMG_DTMF_ENABLE static int woomera_dtmf_transmit(struct media_session *ms, int mtu) { @@ -1051,9 +1000,6 @@ static int woomera_dtmf_transmit(struct media_session *ms, int mtu) int slin_len = mtu*2; short *data; int used; - int res; - int err; - int txdtmf=0; memset(&hdrframe,0,sizeof(hdrframe)); if (!ms->dtmf_buffer) { @@ -1061,17 +1007,8 @@ static int woomera_dtmf_transmit(struct media_session *ms, int mtu) } for (;;) { - - if ((used=switch_buffer_inuse(ms->dtmf_buffer)) <= 0) { - break; - } - res = waitfor_tx_socket(ms->sangoma_sock, -1, POLLERR | POLLOUT); - if (res <= 0) { - break; - } - -#ifdef CODEC_LAW_DEFAULT +#ifdef CODEC_LAW_DEFAULT pthread_mutex_lock(&woomera->dtmf_lock); if ((used=switch_buffer_inuse(ms->dtmf_buffer)) <= 0) { @@ -1085,6 +1022,14 @@ static int woomera_dtmf_transmit(struct media_session *ms, int mtu) if (bread <= 0) { break; } + +#if 0 + if (bread < slin_len) { + while (bread < slin_len) { + dtmf[bread++] = 0xFF; + } + } +#endif log_printf(3,woomera->log,"%s: Write DTMF Got %d bytes MTU=%i Coding=%i Used=%i\n", woomera->interface,bread,mtu,ms->hw_coding,used); @@ -1100,23 +1045,24 @@ static int woomera_dtmf_transmit(struct media_session *ms, int mtu) } } - err=sangoma_sendmsg_socket(ms->sangoma_sock, + sangoma_sendmsg_socket(ms->sangoma_sock, &hdrframe, sizeof(hdrframe), dtmf_law, mtu, 0); - - if (err != mtu) { - log_printf(0, woomera->log, "Error: Failed to TX to TDM API on DTMF (err=%i mtu=%i)!\n",err,mtu); - } - - txdtmf++; - ms->skip_write_frames++; + + ms->skip_write_frames+=server.dtmf_intr_ch; #else ... pthread_mutex_lock(&woomera->dtmf_lock); bread = switch_buffer_read(ms->dtmf_buffer, dtmf, mtu); pthread_mutex_unlock(&woomera->dtmf_lock); + if (bread < mtu) { + while (bread < mtu) { + dtmf[bread++] = 0; + } + } + log_printf(3,woomera->log,"%s: Write DTMF Got %d bytes\n", woomera->interface,bread); @@ -1124,18 +1070,14 @@ static int woomera_dtmf_transmit(struct media_session *ms, int mtu) &hdrframe, sizeof(hdrframe), dtmf, mtu, 0); - txdtmf++; ms->skip_write_frames++; #endif - - } - - if (txdtmf) { return 0; - } else { - return -1; - } + } + + return -1; } +#endif static void media_loop_run(struct media_session *ms) { @@ -1308,7 +1250,6 @@ static void *media_thread_run(void *obj) struct woomera_event wevent; wanpipe_tdm_api_t tdm_api; FILE *tx_fd=NULL; - int sock_timeout=200; if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || @@ -1463,7 +1404,7 @@ static void *media_thread_run(void *obj) local_port, WOOMERA_LINE_SEPERATOR, woomera->interface, - WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, WOOMERA_RECORD_SEPERATOR ); #endif @@ -1489,23 +1430,12 @@ static void *media_thread_run(void *obj) while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && !woomera_test_flag(woomera, WFLAG_MEDIA_END) && !woomera_test_flag(woomera, WFLAG_HANGUP) && - (res = waitfor_socket(ms->udp_sock, sock_timeout, POLLERR | POLLIN)) >= 0) { + (res = waitfor_socket(ms->udp_sock, 1000, POLLERR | POLLIN)) >= 0) { unsigned int fromlen = sizeof(struct sockaddr_in); if (res == 0) { - - if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) { - sock_timeout=(sangoma_frame_len/codec_sample); - } else { - sock_timeout=200; - } - - if (ms->skip_write_frames > 0) { - ms->skip_write_frames--; - } - log_printf(4, server.log, "%s: UDP Sock Timeout !!!\n", woomera->interface); /* NENAD Timeout thus just continue */ @@ -1550,26 +1480,22 @@ static void *media_thread_run(void *obj) } - if (!server.out_tx_test) { - - if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) { - sock_timeout=(sangoma_frame_len/codec_sample); - /* For sanity sake if we are doing the out test - * dont take any chances force tx udp data */ +#ifdef SMG_DTMF_ENABLE + if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) { + /* For sanity sake if we are doing the out test + * dont take any chances force tx udp data */ + if (!server.out_tx_test) { if (ms->skip_write_frames > 0) { - ms->skip_write_frames--; + ms->skip_write_frames--; } continue; - } else { - sock_timeout=200; } - - if (ms->skip_write_frames > 0) { - ms->skip_write_frames--; - continue; - } - - } + } + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + continue; + } +#endif if (server.out_tx_test && tx_fd && fread((void*)udp_frame, @@ -1877,10 +1803,6 @@ static struct woomera_interface * launch_woomera_loop_thread(call_signal_event_t } woomera_set_interface(woomera,callid); - - pthread_mutex_lock(&server.process_lock); - server.process_table[event->span][event->chan].dev = woomera; - pthread_mutex_unlock(&server.process_lock); if (launch_woomera_thread(woomera)) { pthread_mutex_lock(&server.process_lock); @@ -2106,10 +2028,8 @@ static struct woomera_interface *pull_from_holding_tank(int index, int span , in struct woomera_interface *woomera = NULL; if (index < 1 || index >= CORE_TANK_LEN) { - if (index != 0) { - log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", - __FUNCTION__,index); - } + log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); return NULL; } @@ -2131,25 +2051,18 @@ static struct woomera_interface *pull_from_holding_tank(int index, int span , in return woomera; } -static void clear_from_holding_tank(int index, struct woomera_interface *woomera) +static void clear_from_holding_tank(int index) { if (index < 1 || index >= CORE_TANK_LEN) { - if (index != 0) { - log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", - __FUNCTION__,index); - } + log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); return; } pthread_mutex_lock(&server.ht_lock); if (server.holding_tank[index] == &woomera_dead_dev) { - server.holding_tank[index] = NULL; - } else if (woomera && server.holding_tank[index] == woomera) { - server.holding_tank[index] = NULL; - } else if (server.holding_tank[index]) { - log_printf(0, server.log, "Error: Holding tank index %i not cleared %p !\n", - index, server.holding_tank[index]); + server.holding_tank[index] = NULL; } pthread_mutex_unlock(&server.ht_lock); @@ -2161,10 +2074,8 @@ static struct woomera_interface *peek_from_holding_tank(int index) struct woomera_interface *woomera = NULL; if (index < 1 || index >= CORE_TANK_LEN) { - if (index != 0) { - log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", - __FUNCTION__,index); - } + log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); return NULL; } @@ -2257,7 +2168,6 @@ static int handle_woomera_media_accept_answer(struct woomera_interface *woomera, log_printf(4, server.log,"ERROR: Failed to Launch Call [%s]\n", woomera->interface); -#if 0 new_woomera_event_printf(&wevent, "501 call was cancelled!%s" "Unique-Call-Id: %s%s", WOOMERA_LINE_SEPERATOR, @@ -2265,7 +2175,7 @@ static int handle_woomera_media_accept_answer(struct woomera_interface *woomera, WOOMERA_RECORD_SEPERATOR); enqueue_event(woomera, &wevent,EVENT_FREE_DATA); -#endif + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" "Unique-Call-Id: %s%s" @@ -2378,20 +2288,18 @@ static int handle_woomera_media_accept_answer(struct woomera_interface *woomera, WOOMERA_RECORD_SEPERATOR); enqueue_event(woomera, &wevent,EVENT_FREE_DATA); - } + } - return 0; + return 0; } -static int handle_woomera_call_start (struct woomera_interface *woomera, - struct woomera_message *wmsg) +static int handle_woomera_call_start (struct woomera_interface *woomera, + struct woomera_message *wmsg) { - char *raw = woomera_message_header(wmsg, "raw-audio"); - call_signal_event_t event; - char *calling = woomera_message_header(wmsg, "local-number"); -#ifdef SMG_CALLING_NAME - char *calling_name = woomera_message_header(wmsg, "local-name"); -#endif + char *raw = woomera_message_header(wmsg, "raw-audio"); + call_signal_event_t event; + char *calling = woomera_message_header(wmsg, "local-number"); + char *calling_name = woomera_message_header(wmsg, "local-name"); char *presentation = woomera_message_header(wmsg, "Presentation"); char *screening = woomera_message_header(wmsg, "Screening"); char *rdnis = woomera_message_header(wmsg, "RDNIS"); @@ -2419,8 +2327,6 @@ static int handle_woomera_call_start (struct woomera_interface *woomera, } } - woomera->trunk_group=tg; - if (raw) { woomera_set_raw(woomera, raw); } @@ -2459,12 +2365,10 @@ static int handle_woomera_call_start (struct woomera_interface *woomera, } -#ifdef SMG_CALLING_NAME if (calling_name) { strncpy((char*)event.calling_name,calling_name, sizeof(event.calling_name)-1); } -#endif event.trunk_group = tg; @@ -2492,7 +2396,6 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_ { int answer = 0, media = 0, accept=0; char *unique_id; - int cause=0; if (!strcasecmp(wmsg->command, "call")) { @@ -2507,7 +2410,7 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_ err=handle_woomera_call_start(woomera,wmsg); if (err) { - woomera_set_flag(woomera, WFLAG_HANGUP); + woomera_clear_flag(woomera, WFLAG_RUNNING); } return; @@ -2584,21 +2487,13 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_ unique_id = woomera_message_header(wmsg, "Unique-Call-Id"); if (!unique_id) { - - cause=111; - socket_printf(woomera->socket, "EVENT HANGUP %s" - "Cause: %s%s" - "Q931-Cause-Code: %d%s", - WOOMERA_LINE_SEPERATOR, - q931_rel_to_str(cause), - WOOMERA_LINE_SEPERATOR, - cause, - WOOMERA_RECORD_SEPERATOR); - socket_printf(woomera->socket, "400 Woomera cmd without uniquie id%s" + socket_printf(woomera->socket, "400 Error no unique id found %s", WOOMERA_RECORD_SEPERATOR); + log_printf(2,server.log,"Woomera RX Even (%s) without unique id!\n",wmsg->command); - log_printf(2,server.log,"Woomera RX Event (%s) without unique id!\n",wmsg->command); - woomera_set_flag(woomera, WFLAG_HANGUP); + if (!strcasecmp(wmsg->command, "hangup")) { + woomera_clear_flag(woomera, WFLAG_RUNNING); + } return; } @@ -2616,24 +2511,15 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_ "WOOMERA Got CMD %s Span=%d Chan=%d from session %s\n", wmsg->command,span,chan,unique_id); + if (smg_validate_span_chan(span,chan) != 0) { - - cause=34; - socket_printf(woomera->socket, "EVENT HANGUP %s" - "Cause: %s%s" - "Q931-Cause-Code: %d%s", - WOOMERA_LINE_SEPERATOR, - q931_rel_to_str(cause), - WOOMERA_LINE_SEPERATOR, - cause, - WOOMERA_RECORD_SEPERATOR); - socket_printf(woomera->socket, "404 Invalid span/chan in session%s" + socket_printf(woomera->socket, + "400 Error invalid span chan in session! %s", WOOMERA_RECORD_SEPERATOR); - + log_printf(2, woomera->log, "WOOMERA Warning invalid span chan in session %s %s\n", wmsg->command,unique_id); - woomera_set_flag(woomera, WFLAG_HANGUP); return; } @@ -2644,22 +2530,11 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_ if (session_woomera) { pthread_mutex_unlock(&server.process_lock); - cause=34; - socket_printf(woomera->socket, "EVENT HANGUP %s" - "Cause: %s%s" - "Q931-Cause-Code: %d%s", - WOOMERA_LINE_SEPERATOR, - q931_rel_to_str(cause), - WOOMERA_LINE_SEPERATOR, - cause, - WOOMERA_RECORD_SEPERATOR); - socket_printf(woomera->socket, "404 Session not found%s" + socket_printf(woomera->socket, "400 Error channel in use! %s", WOOMERA_RECORD_SEPERATOR); - log_printf(0, woomera->log, "WOOMERA Error channel in use %s %s\n", wmsg->command,unique_id); - woomera_set_flag(woomera, WFLAG_HANGUP); return; } @@ -2667,23 +2542,11 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_ strncmp(session,unique_id,sizeof(woomera->session))){ pthread_mutex_unlock(&server.process_lock); - cause=34; - socket_printf(woomera->socket, "EVENT HANGUP %s" - "Cause: %s%s" - "Q931-Cause-Code: %d%s", - WOOMERA_LINE_SEPERATOR, - q931_rel_to_str(cause), - WOOMERA_LINE_SEPERATOR, - cause, - WOOMERA_RECORD_SEPERATOR); - - socket_printf(woomera->socket, "404 Invalid/Expired Session%s" + socket_printf(woomera->socket, "400 Error no such session %s", WOOMERA_RECORD_SEPERATOR); - - log_printf(3, woomera->log, + log_printf(2, woomera->log, "WOOMERA Warning: Cmd=%s with invalid session %s (orig=%s)\n", wmsg->command,unique_id,session?session:"N/A"); - woomera_set_flag(woomera, WFLAG_HANGUP); return; } @@ -2703,20 +2566,8 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_ } else if (strncmp(woomera->session,unique_id,sizeof(woomera->session))) { - - cause=34; - socket_printf(woomera->socket, "EVENT HANGUP %s" - "Cause: %s%s" - "Q931-Cause-Code: %d%s", - WOOMERA_LINE_SEPERATOR, - q931_rel_to_str(cause), - WOOMERA_LINE_SEPERATOR, - cause, - WOOMERA_RECORD_SEPERATOR); - - socket_printf(woomera->socket, "404 Session Mis-match%s" + socket_printf(woomera->socket, "400 Error session missmatch %s", WOOMERA_RECORD_SEPERATOR); - woomera_set_flag(woomera, WFLAG_HANGUP); return; } @@ -2726,8 +2577,9 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_ log_printf(3, woomera->log, "WOOMERA CMD: DTMF Received: [%s] Digit %s Body %s\n", woomera->interface, wmsg->command_args, wmsg->body); +#ifdef SMG_DTMF_ENABLE wanpipe_send_dtmf(woomera,wmsg->body); - +#endif socket_printf(woomera->socket, "200 DTMF OK%s" "Unique-Call-Id: %s%s", WOOMERA_LINE_SEPERATOR, @@ -2753,7 +2605,6 @@ static void interpret_command(struct woomera_interface *woomera, struct woomera_ woomera->interface,cause); if (smg_validate_span_chan(span,chan) != 0) { - socket_printf(woomera->socket, "405 No Such Channel%s" "Unique-Call-Id: %s%s", WOOMERA_LINE_SEPERATOR, @@ -2861,7 +2712,6 @@ static void handle_call_answer(call_signal_event_t *event) if (err) { log_printf(0, server.log,"ERROR: Failed to Launch Call [%s]\n", woomera->interface); -#if 0 new_woomera_event_printf(&wevent, "501 call was cancelled!%s" "Unique-Call-Id: %s%s", WOOMERA_LINE_SEPERATOR, @@ -2869,8 +2719,7 @@ static void handle_call_answer(call_signal_event_t *event) WOOMERA_RECORD_SEPERATOR); enqueue_event(woomera, &wevent,EVENT_FREE_DATA); -#endif - + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" "Unique-Call-Id: %s%s" "Q931-Cause-Code: %d%s" @@ -2946,7 +2795,7 @@ static void handle_call_start_ack(call_signal_event_t *event) struct woomera_event wevent; int kill = 0; - if ((woomera = peek_from_holding_tank(event->call_setup_id))) { + if ((woomera = pull_from_holding_tank(event->call_setup_id,event->span,event->chan))) { char callid[80]; if (woomera_test_flag(woomera, WFLAG_HANGUP)) { @@ -2954,14 +2803,11 @@ static void handle_call_start_ack(call_signal_event_t *event) kill++; } else { int err, span, chan; - - pull_from_holding_tank(event->call_setup_id,event->span,event->chan); sprintf(callid, "w%dg%d", event->span + 1, event->chan + 1); span = event->span; chan = event->chan; - woomera_set_flag(woomera,WFLAG_CALL_ACKED); woomera_set_interface(woomera, callid); pthread_mutex_lock(&server.process_lock); @@ -2979,8 +2825,6 @@ static void handle_call_start_ack(call_signal_event_t *event) log_printf(0, server.log,"ERROR: Failed to Launch Call [%s]\n", woomera->interface); - -#if 0 new_woomera_event_printf(&wevent, "501 call was cancelled!%s" "Unique-Call-Id: %s%s", WOOMERA_LINE_SEPERATOR, @@ -2988,8 +2832,7 @@ static void handle_call_start_ack(call_signal_event_t *event) WOOMERA_RECORD_SEPERATOR); enqueue_event(woomera, &wevent,EVENT_FREE_DATA); -#endif - + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" "Unique-Call-Id:%s%s" "Q931-Cause-Code: %d%s" @@ -3021,14 +2864,10 @@ static void handle_call_start_ack(call_signal_event_t *event) enqueue_event(woomera, &wevent,EVENT_FREE_DATA); new_woomera_event_printf(&wevent, "EVENT PROCEED w%dg%d%s" - "Channel-Name: g%d/%d%s" "Unique-Call-Id: %s%s", event->span+1, event->chan+1, WOOMERA_LINE_SEPERATOR, - woomera->trunk_group+1, - (event->span*31)+event->chan+1, - WOOMERA_LINE_SEPERATOR, woomera->session, WOOMERA_RECORD_SEPERATOR ); @@ -3090,7 +2929,7 @@ static void handle_call_start_nack(call_signal_event_t *event) } if (event->call_setup_id > 0) { - woomera=peek_from_holding_tank(event->call_setup_id); + woomera=pull_from_holding_tank(event->call_setup_id,-1,-1); } if (woomera) { @@ -3098,20 +2937,15 @@ static void handle_call_start_nack(call_signal_event_t *event) struct woomera_event wevent; woomera_clear_flag(woomera, WFLAG_HANGUP_NACK_ACK); - - /* Only pull the index if we have not sent a NACK. - If NACK was already sent out we must wait for ACK - from the other side */ - if (!woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK)) { - pull_from_holding_tank(event->call_setup_id,-1,-1); - } - + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); isup_exec_command(0, 0, event->call_setup_id, SIGBOOST_EVENT_CALL_START_NACK_ACK, 0); + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { log_printf(0, server.log, "Event CALL START NACK on hungup call [%d]!\n", event->call_setup_id); @@ -3119,6 +2953,14 @@ static void handle_call_start_nack(call_signal_event_t *event) woomera_set_cause_topbx(woomera,event->release_cause); + new_woomera_event_printf(&wevent, "501 Error!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + new_woomera_event_printf(&wevent, "EVENT HANGUP w%dg%d%s" "Unique-Call-Id: %s%s" "Cause: %s%s" @@ -3135,7 +2977,6 @@ static void handle_call_start_nack(call_signal_event_t *event) ); enqueue_event(woomera, &wevent,EVENT_FREE_DATA); - woomera_set_flag(woomera, WFLAG_HANGUP); woomera_clear_flag(woomera, WFLAG_RUNNING); @@ -3149,36 +2990,37 @@ static void handle_call_start_nack(call_signal_event_t *event) pthread_mutex_lock(&server.process_lock); woomera = server.process_table[event->span][event->chan].dev; - - if (woomera && - !woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK) && - !woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { - /* Only if we are not already waiting for hangup */ - server.process_table[event->span][event->chan].dev=NULL; - } - + server.process_table[event->span][event->chan].dev=NULL; memset(server.process_table[event->span][event->chan].session, 0,SMG_SESSION_NAME_SZ); pthread_mutex_unlock(&server.process_lock); - if (woomera) { log_printf(2, server.log, "Event START NACK on w%dg%d ptr=%p ms=%p\n", woomera->span+1,woomera->chan+1,woomera,woomera->ms); - - if (woomera_test_flag(woomera,WFLAG_HANGUP)){ - ack++; - goto handle_call_start_nack_skip; - } - - - woomera_set_cause_topbx(woomera,event->release_cause); - + + woomera_clear_flag(woomera, WFLAG_HANGUP_NACK_ACK); woomera_set_flag(woomera, - (WFLAG_HANGUP|WFLAG_MEDIA_END|WFLAG_HANGUP_NACK_ACK)); + (WFLAG_HANGUP|WFLAG_MEDIA_END)); - /* Nack Ack will be sent by the woomera thread */ + isup_exec_command(event->span, + event->chan, + event->call_setup_id, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + 0); + +#ifdef MEDIA_SOCK_SHUTDOWN + pthread_mutex_lock(&woomera->ms_lock); + if (woomera->ms) { + shutdown(woomera->ms->sangoma_sock, SHUT_RDWR); + shutdown(woomera->ms->udp_sock, SHUT_RDWR); + } + pthread_mutex_unlock(&woomera->ms_lock); +#endif + + + /* We already did the NACK */ ack=0; } else { /* Valid state when we are not in autoacm mode */ @@ -3193,14 +3035,16 @@ static void handle_call_start_nack(call_signal_event_t *event) event->call_setup_id, event->span+1, event->chan+1); ack++; } +<<<<<<< .mine +#if 0 +======= -handle_call_start_nack_skip: - +>>>>>>> .r33 if (event->release_cause == SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY) { log_printf(0, server.log, "WARNING: All ckt busy!\n"); smg_all_ckt_busy(); } - +#endif #warning "Ignoring CALL GAP" #if 0 if (event->release_cause == SIGBOOST_CALL_SETUP_NACK_AUTO_CALL_GAP) { @@ -3222,18 +3066,16 @@ handle_call_start_nack_skip: SIGBOOST_EVENT_CALL_START_NACK_ACK, 0); - if (!woomera) { + log_printf(2, server.log, "Event (NACK ACK) %d referrs to a non-existant session (%d) [w%dg%d]!\n", event->event_id,event->call_setup_id, event->span+1, event->chan+1); - } } } static void handle_call_loop_start(call_signal_event_t *event) { + struct woomera_interface *woomera; - char callid[20]; - char *session; pthread_mutex_lock(&server.process_lock); if (server.process_table[event->span][event->chan].dev) { @@ -3253,14 +3095,7 @@ static void handle_call_loop_start(call_signal_event_t *event) return; } - - sprintf(callid, "w%dg%d", event->span+1,event->chan+1); - sprintf(server.process_table[event->span][event->chan].session, - "%s-%i-%i",callid,rand(),rand()); - session=server.process_table[event->span][event->chan].session; - server.process_table[event->span][event->chan].dev = NULL; - pthread_mutex_unlock(&server.process_lock); - + pthread_mutex_unlock(&server.process_lock); woomera=launch_woomera_loop_thread(event); if (woomera == NULL) { @@ -3274,7 +3109,6 @@ static void handle_call_loop_start(call_signal_event_t *event) event->span+1, event->chan+1, server.process_table[event->span][event->chan].dev); } - woomera_set_flag(woomera,WFLAG_CALL_ACKED); return; } @@ -3326,7 +3160,7 @@ static void handle_call_start(call_signal_event_t *event) "Protocol: SS7%s" "User-Agent: sangoma_mgd%s" "Local-Number: %s%s" - "Channel-Name: g%d/%d%s" + "Channel-Name: SMG-g%ds%dc%d%s" "Trunk-Group: %d%s" "Presentation: %d%s" "Screening: %d%s" @@ -3339,18 +3173,15 @@ static void handle_call_start(call_signal_event_t *event) WOOMERA_LINE_SEPERATOR, event->calling_number_digits, WOOMERA_LINE_SEPERATOR, -#ifdef SMG_CALLING_NAME event->calling_name, -#else - "", -#endif WOOMERA_LINE_SEPERATOR, WOOMERA_LINE_SEPERATOR, WOOMERA_LINE_SEPERATOR, event->called_number_digits, WOOMERA_LINE_SEPERATOR, event->trunk_group+1, - (event->span*31)+event->chan+1, + event->span+1, + event->chan+1, WOOMERA_LINE_SEPERATOR, event->trunk_group+1, WOOMERA_LINE_SEPERATOR, @@ -3409,44 +3240,33 @@ static void handle_restart_ack(call_signal_connection_t *mcon,call_signal_event_ static void handle_call_stop(call_signal_event_t *event) { struct woomera_interface *woomera; - int ack=0; - + pthread_mutex_lock(&server.process_lock); woomera = server.process_table[event->span][event->chan].dev; - if (woomera && - !woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK) && - !woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { - /* Only if we are not already waiting for hangup */ - server.process_table[event->span][event->chan].dev=NULL; - } + server.process_table[event->span][event->chan].dev=NULL; memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); pthread_mutex_unlock(&server.process_lock); if (woomera) { - - if (woomera_test_flag(woomera,WFLAG_HANGUP)) { - ack++; - goto handle_call_stop_skip; - } - + woomera_set_cause_topbx(woomera,event->release_cause); - - woomera_set_flag(woomera, - (WFLAG_MEDIA_END|WFLAG_HANGUP|WFLAG_HANGUP_ACK)); - /* We have to close the socket because - At this point we are release span chan */ + woomera_set_flag(woomera, + (WFLAG_MEDIA_END|WFLAG_HANGUP)); + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED_ACK, + 0); #ifdef MEDIA_SOCK_SHUTDOWN pthread_mutex_lock(&woomera->ms_lock); if (woomera->ms) { - log_printf(3, server.log, "Event CALL STOP [w%dg%d] closing sockets\n", - woomera->span+1,woomera->chan+1); - - close_socket(&woomera->ms->sangoma_sock); - close_socket(&woomera->ms->udp_sock); - // shutdown(woomera->ms->sangoma_sock, SHUT_RDWR); - // shutdown(woomera->ms->udp_sock, SHUT_RDWR); + shutdown(woomera->ms->sangoma_sock, SHUT_RDWR); + shutdown(woomera->ms->udp_sock, SHUT_RDWR); } pthread_mutex_unlock(&woomera->ms_lock); #endif @@ -3455,12 +3275,7 @@ static void handle_call_stop(call_signal_event_t *event) woomera->span+1,woomera->chan+1,woomera,woomera->ms); } else { - ack++; - } - -handle_call_stop_skip: - - if (ack) { + /* At this point we have already sent our STOP so its safe to ACK */ isup_exec_command(event->span, event->chan, @@ -3519,7 +3334,6 @@ static void handle_call_stop_ack(call_signal_event_t *event) return; } - static void handle_call_start_nack_ack(call_signal_event_t *event) { @@ -3529,33 +3343,17 @@ static void handle_call_start_nack_ack(call_signal_event_t *event) woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); - } else if (event->call_setup_id == 0 && - smg_validate_span_chan(event->span,event->chan) == 0) { - - pthread_mutex_lock(&server.process_lock); - woomera = server.process_table[event->span][event->chan].dev; - server.process_table[event->span][event->chan].dev=NULL; - memset(server.process_table[event->span][event->chan].session, - 0,SMG_SESSION_NAME_SZ); - pthread_mutex_unlock(&server.process_lock); - - if (woomera) { - woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); - } else { - log_printf(0, server.log, - "Event NACK ACK [w%dg%d] with valid span/chan no dev!\n", - event->span+1, event->chan+1); - } - } else { log_printf(2, server.log, "Event NACK ACK referrs to a non-existant session [w%dg%d] [Setup ID: %d]!\n", event->span+1, event->chan+1, event->call_setup_id); } +#if 1 if (event->call_setup_id > 0) { - clear_from_holding_tank(event->call_setup_id, NULL); + clear_from_holding_tank(event->call_setup_id); } +#endif /* No need for us to do any thing here */ return; @@ -3860,8 +3658,6 @@ static void woomera_loop_thread_run(struct woomera_interface *woomera) continue; } - - woomera_clear_flag(woomera, WFLAG_RUNNING); log_printf(2, server.log, "Woomera Session: For Loop Test exiting %s\n",woomera->interface); @@ -3962,7 +3758,7 @@ static void *woomera_thread_run(void *obj) "WOOMERA session (ptr=%p) Call Timedout ! [%s] (Timeout=%d)\n", woomera,woomera->interface,woomera->timeout); - /* Let the Index check below send a NACK */ + /* NENAD Let the Index check run a nak */ if (woomera->index) { woomera_set_flag(woomera, WFLAG_HANGUP); } @@ -4046,12 +3842,9 @@ woomera_session_close: /* This can happend if an outgoing call times out or gets hungup before it gets acked. Its not a failure */ - if (!woomera->index) { - /* In this case we really failed to tx STOP */ - log_printf(0, woomera->log, "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED [w%dg%d] [%s] Index=%d ptr=%p\n", + log_printf(3, woomera->log, "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED [w%dg%d] [%s] Index=%d ptr=%p\n", span+1, chan+1, woomera->interface, woomera->index, woomera); - } } } @@ -4124,7 +3917,8 @@ woo_re_hangup: if (woomera->index) { int index = woomera->index; - + int timeout_cnt=0; + int overall_cnt=0; new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" "Unique-Call-Id: %s%s" @@ -4161,53 +3955,47 @@ woo_re_hangup: log_printf(2, woomera->log, "Sent SIGBOOST_EVENT_CALL_START_NACK [Setup ID: %d] .. WAITING FOR NACK ACK\n", index); - } - } - - if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK)) { - int timeout_cnt=0; - int overall_cnt=0; + /* SMG sent NACK to boost, however we have to wait + for boost to give us the ACK back before we + release resources. */ + + while (woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK)) { + timeout_cnt++; + if (timeout_cnt > 40000) { //10sec timeout + timeout_cnt=0; + overall_cnt++; + log_printf(0, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] ... \n", + index); + } - /* SMG sent NACK to boost, however we have to wait - for boost to give us the ACK back before we - release resources. */ - - while (woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK)) { - timeout_cnt++; - if (timeout_cnt > 4000) { //30sec timeout - timeout_cnt=0; - overall_cnt++; + if (overall_cnt > 10) { //100sec timeotu + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + break; + } + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING)) { + break; + } + + usleep(5000); + sched_yield(); + } + + if (overall_cnt > 10) { log_printf(0, woomera->log, - "Waiting for NACK ACK [Setup ID: %d] ... \n", + "Waiting for NACK ACK [Setup ID: %d] .. TIMEOUT on NACK ACK\n", + index); + + } else { + log_printf(2, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] .. GOT NACK ACK\n", index); - } - if (overall_cnt > 10) { //300sec timeotu - woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); - break; } - - if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING)) { - break; - } - - usleep(5000); - sched_yield(); } - woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); - if (overall_cnt > 10) { - log_printf(0, woomera->log, - "Waiting for NACK ACK [Setup ID: %d] .. TIMEOUT on NACK ACK\n", - index); - - } else { - log_printf(2, woomera->log, - "Waiting for NACK ACK [Setup ID: %d] .. GOT NACK ACK\n", - index); - - } } if (woomera_test_flag(woomera, WFLAG_EVENT)){ @@ -4233,7 +4021,7 @@ woo_re_hangup: while (woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { timeout_cnt++; - if (timeout_cnt > 4000) { //10sec timeout + if (timeout_cnt > 40000) { //10sec timeout timeout_cnt=0; overall_cnt++; log_printf(0, woomera->log, @@ -4256,18 +4044,18 @@ woo_re_hangup: usleep(5000); sched_yield(); } - - woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); - if (overall_cnt > 10) { - log_printf(0, woomera->log, - "Wait TIMEDOUT on STOPPED ACK [%s] [id=%i]... \n", - woomera->interface,woomera->index_hold); + if (!woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + if (overall_cnt > 10) { + log_printf(0, woomera->log, + "Wait TIMEDOUT on STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); - } else { - log_printf(2, woomera->log, - "Wait GOT STOPPED ACK [%s] [id=%i]... \n", - woomera->interface,woomera->index_hold); + } else { + log_printf(2, woomera->log, + "Wait GOT STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + } } } @@ -4327,7 +4115,7 @@ woo_re_hangup: * value until the end of the call. Tank is only * used on outgoing calls. */ if (woomera->index_hold >= 1) { - clear_from_holding_tank(woomera->index_hold, woomera); + clear_from_holding_tank(woomera->index_hold); woomera->index_hold=0; } @@ -4572,7 +4360,7 @@ static int configure_server(void) server.dtmf_off=SMG_DTMF_OFF; } if (server.dtmf_intr_ch == -1) { - server.dtmf_intr_ch = 0; + server.dtmf_intr_ch = server.dtmf_on/server.dtmf_off; } server.dtmf_size=(server.dtmf_on+server.dtmf_off)*10*2; diff --git a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.5.tmp b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.5.tmp new file mode 100644 index 0000000..b9316c8 --- /dev/null +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.5.tmp @@ -0,0 +1,228 @@ +#!/bin/sh + +home=`pwd`; + +force="false" +noss7="true" +rootdir="" +pbxdir=/usr/src/asterisk + +while [ ! -z $1 ] +do + if [ $1 = '-force' ]; then + force="force" + elif [ $1 = '-noss7' ]; then + noss7="true" + elif [ $1 = '-pbxdir' ]; then + shift + pbxdir=$1 + if [ "$pbxdir" = "" ]; then + echo "Error: Invalid Asterisk dir: $pbxdir!"; + exit 1 + elif [ ! -d $pbxdir ]; then + echo "Error: Asterisk dir does not exist: $pbxdir!"; + exit 1 + fi + + elif [ $1 = '-rootdir' ]; then + shift + rootdir=$1 + if [ "$rootdir" = "" ]; then + echo "Error: Invalid root dir: $rootdir!"; + exit 1 + elif [ ! -d $rootdir ]; then + echo "Error: root dir does not exist: $rootdir!"; + exit 1 + fi + + else + echo "Invalid option: $1"; + echo + echo "Usage: ./install " + echo + exit 1 + fi + shift +done + +if [ $noss7 != 'true' ]; then + if [ ! -e /usr/local/ss7box/$ss7boost ]; then + echo "Error: ss7boost not found in /usr/local/ss7box dir"; + exit 1 + fi + if [ ! -e /usr/local/ss7box/$ss7boxd ]; then + echo "Error: ss7boxd not found in /usr/local/ss7box dir"; + exit 1 + fi +fi + +if [ $force = "force" ]; then + echo "Stopping SMG..." + eval "sangoma_mgd -term" + kill -TERM $(pidof asterisk); + echo "OK." + echo +else + if [ -f /var/run/sangoma_mgd.pid ]; then + echo "Error: sangoma_mgd is running!" + exit 1 + fi + if [ -f /var/run/asterisk.pid ]; then + echo "Error: asterisk is running" + exit 1 + fi +fi + +echo +echo "Checking Syslog ...." +if [ -e /etc/syslog.conf ]; then +eval "grep "local2.*sangoma_mgd" /etc/syslog.conf" > /dev/null 2> /dev/null +if [ $? -ne 0 ]; then + eval "grep "local2" /etc/syslog.conf " > /dev/null 2> /dev/null + if [ $? -eq 0 ]; then + echo + echo "Warning : local2 is already used in syslog.conf" + echo + fi + echo -e "\nlocal2.* /var/log/sangoma_mgd.log\n" > tmp.$$ + eval "cat /etc/syslog.conf tmp.$$ > tmp1.$$" + \cp -f tmp1.$$ /etc/syslog.conf + eval "/etc/init.d/syslog restart" +fi + +else + echo "Warning: /etc/syslog.conf not found" +fi + +if [ -f tmp1.$$ ]; then + rm -f tmp1.$$ +fi +if [ -f tmp.$$ ]; then + rm -f tmp.$$ +fi + +echo "Ok" +echo + +echo "Checking logrotate ..." +eval "type logrotate" > /dev/null 2> /dev/null +if [ $? -ne 0 ]; then + echo "Error: Logrotate not found !" +fi + +if [ -e /etc/logrotate.d ] && [ -e /etc/logrotate.d/syslog ]; then + + eval "grep sangoma_mgd /etc/logrotate.d/syslog" > /dev/null 2> /dev/null + if [ $? -ne 0 ]; then + eval "sed -e 's/messages/messages \/var\/log\/sangoma_mgd.log/' /etc/logrotate.d/syslog >tmp2.$$ 2>/dev/null" + eval "cp -f tmp2.$$ /etc/logrotate.d/syslog" + eval "logrotate -f /etc/logrotate.d/syslog" + if [ $? -ne 0 ]; then + echo "Error: logrotate restart failed!"; + exit 1; + fi + echo "Logrotate is being changed and restarted!" + else + echo "Logrotate is configured!" + fi + +else + echo "Error: Logrotate dir: /etc/logrotate.d not found !" +fi +echo "OK." +echo + +echo "Checking for SCTP Utilities...." +if [ ! -e /usr/include/netinet/sctp.h ]; then + if [ -d ../libs ]; then + echo -n "Installing SCTP RPMS ..." + eval "rpm -i ../libs/lksctp-tools-1.0.6-1.el5.1.i386.rpm ../libs/lksctp-tools-devel-1.0.6-1.el5.1.i386.rpm" + if [ ! -e /usr/include/netinet/sctp.h ]; then + echo "Error" + echo + echo "Please install SCTP devel package: yum install lksctp-tools-devel" + echo + exit 1 + fi + echo "OK" + else + echo "Please install SCTP devel package: yum install lksctp-tools-devel" + echo + exit 1 + fi +fi +echo "OK." +echo + +echo "Checking for SCTP modules..." +eval "modprobe -l | grep \"\/sctp.ko\" >/dev/null 2>/dev/null" +if [ $? -ne 0 ]; then + if [ ! -e /proc/net/sctp ]; then + echo "Warning: Your Kernel does not support SCTP Protocol!" + echo "SCTP is needed by SMG!" + echo + echo "Please contact sangoma support!" + echo + exit 1 + fi +fi +echo "OK." +echo + + +echo "Compiling Sangoma MGD ..." +eval "make clean 2> /dev/null > /dev/null" +eval "make" +if [ $? -ne 0 ]; then + exit 1; +fi +make INSTALLPREFIX=$rootdir install +echo "Ok." + +if [ -d chan_woomera.trunk ]; then + + cd chan_woomera.trunk + + echo "Compiling Woomera Channel ..." + + if [ ! -e $pbxdir ]; then + echo + echo "Error: $pbxdir directory does not exist!" + echo " Please create symlink /usr/src/asterisk and" + echo " point to existing asterisk source!" + echo " Then re run ./install.sh " + echo + exit 1 + fi + + eval "make clean 2> /dev/null > /dev/null" + eval "make PBXDIR=$pbxdir" + if [ $? -ne 0 ]; then + exit 1; + fi + + make INSTALLPREFIX=$rootdir install + echo "Ok." + +else + echo "Warning: chan_woomera directory does not exist!" + exit 1 +fi + + +echo "---------------------------------" +echo +echo " SMG Install Done" +echo +echo "--> Config: /etc/sangoma_mgd.conf" +echo "--> Start: sangoma_mgd -bg" +echo +echo " Chan Woomera Install Done" +echo +echo "--> Config: /etc/asterisk/woomera.conf" +echo "--> Start: Part of Asterisk (start asterisk)" +echo +echo "---------------------------------" + +exit 0 + diff --git a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.6.tmp b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.6.tmp new file mode 100644 index 0000000..e6a8462 --- /dev/null +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.6.tmp @@ -0,0 +1,97 @@ +################################################################################ +# Sangoma MGD +# +# Author: Anthony Minessale II +# Nenad Corbic +# +# Copyright: (c) 2005 Anthony Minessale II +# +# 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. +################################################################################ + +SMG_DTMF=YES + +#Default kernel directory to be overwritten by user +#Kernel version and location +ifndef KVER + KVER=$(shell uname -r) +endif +ifndef KMOD + KMOD=/lib/modules/$(KVER) +endif +ifndef KDIR + KDIR=$(KMOD)/build +endif +ifndef KINSTDIR + KINSTDIR=$(KMOD)/kernel +endif + +CC = gcc +INSTALLPREFIX= + +INCLUDES = -I$(KDIR)/include -I ../../ssmg/libsangoma.trunk -I. -I ../../patches/kdrivers/include -I ../../patches/kdrivers/wanec/oct6100_api/include -I ../../patches/kdrivers/wanec -I/usr/local/include -I../../patches/kdrivers/include -I/usr/include/wanpipe -Ilib/libteletone/src + +CFLAGS = -D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O6 -march=i686 +CCFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes -g +LDFLAGS=-L lib/libteletone/.libs -L. -L/usr/local/lib -L ../../ssmg/libsangoma.trunk/.libs -lpthread -lsangoma -lm + + +ifeq "${SMG_DTMF}" "YES" +LDFLAGS+= -lteletone +CFLAGS+= -DSMG_DTMF_ENABLE +endif + + +all: sangoma_mgd + +libs: + $(shell cd lib/libteletone; ./configure --prefix=$(INSTALLPREFIX); cd ../../; ) + $(MAKE) -C lib/libteletone all + +switch_buffer.o: switch_buffer.c switch_buffer.h + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o switch_buffer.o switch_buffer.c + +call_signal.o: call_signal.c call_signal.h + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o call_signal.o call_signal.c + +sangoma_mgd: sangoma_mgd.o call_signal.o switch_buffer.o sigboost.h + rm -fr core* + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -o sangoma_mgd sangoma_mgd.o switch_buffer.o call_signal.o $(LDFLAGS) + +sangoma_mgd.o: sangoma_mgd.c sangoma_mgd.h sigboost.h + $(CC) $(CCFLAGS) $(INCLUDES) $(CFLAGS) -c -o sangoma_mgd.o sangoma_mgd.c + + +clean: old_cleanup + make -C lib/libteletone clean + find . -name '*.o' | xargs rm -f + rm -fr sangoma_mgd pritest *.o *.so *~ *core* *.so* *.a + +distclean: clean + @echo OK + +install: all install_smg old_cleanup + +install_smg: old_cleanup + install -D -m 755 sangoma_mgd $(INSTALLPREFIX)/usr/sbin/sangoma_mgd + @if [ ! -e $(INSTALLPREFIX)/etc/sangoma_mgd.conf ]; then \ + install -D -m 755 sangoma_mgd.conf.sample $(INSTALLPREFIX)/etc/sangoma_mgd.conf; \ + fi + install -D -m 755 smg_ctrl $(INSTALLPREFIX)/usr/sbin/smg_ctrl + install -D -m 755 scripts/init.d/smgss7_init_ctrl $(INSTALLPREFIX)/etc/init.d/smgss7_init_ctrl + @echo "sangoma_mgd Installed" + +old_cleanup: + ./scripts/old_cleanup.sh + + +install_all: all install_smg + +uninstall: + /bin/rm $(INSTALLPREFIX)/usr/sbin/sangoma_mgd $(INSTALLPREFIX)/etc/sangoma_mgd.conf + + + diff --git a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.7.tmp b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.7.tmp new file mode 100644 index 0000000..8cdf915 --- /dev/null +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.7.tmp @@ -0,0 +1,4940 @@ +/********************************************************************************* + * sangoma_mgd.c -- Sangoma Media Gateway Daemon for Sangoma/Wanpipe Cards + * + * Copyright 05-07, Nenad Corbic + * Anthony Minessale II + * + * This program is free software, distributed under the terms of + * the GNU General Public License + * + * ============================================= +<<<<<<< .mine + * v1.21 Nenad Corbic + * Added caller name option + * +======= + * v1.21 Nenad Corbic + * Major unit testing of each state + * Numerous bug fixes for non autoacm mode. + * Changed "Channel-Name" to tg/cic + * Added compile option WANPIPE_CHAN_NAME to change Asterisk channel + * name of chan_woomera.so. So one can use Dial(SS7/g1/${EXTE}) + * instead of WOOMERA (for example) + * +>>>>>>> .r40 + * v1.20 Nenad Corbic + * Added option for Auto ACM response mode. + * + * v1.19 Nenad Corbic + * Configurable DTMF + * Bug fix in release codes (all ckt busy) + * + * v1.18 Nenad Corbic + * Added new rel cause support based on + * digits instead of strings. + * + * v1.17 Nenad Corbic + * Added session support + * + * v1.16 Nenad Corbic + * Added hwec disable on loop ccr + * + * v1.15 Nenad Corbic + * Updated DTMF Locking + * Added delay between digits + * + * v1.14 Nenad Corbic + * Updated DTMF Library + * Fixed DTMF synchronization + * + * v1.13 Nenad Corbic + * Woomera OPAL Dialect + * Added Congestion control + * Added SCTP + * Added priority ISUP queue + * Fixed presentation + * + * v1.12 Nenad Corbic + * Fixed CCR + * Removed socket shutdown on end call. + * Let Media thread shutodwn sockets. + * + * v1.11 Nenad Corbic + * Fixed Remote asterisk/woomera connection + * Increased socket timeouts + * + * v1.10 Nenad Corbic + * Added Woomera OPAL dialect. + * Start montor thread in priority + * + * v1.9 Nenad Corbic + * Added Loop mode for ccr + * Added remote debug enable + * Fixed syslog logging. + * + * v1.8 Nenad Corbic + * Added a ccr loop mode for each channel. + * Boost can set any channel in loop mode + * + * v1.7 Nenad Corbic + * Pass trunk group number to incoming call + * chan woomera will use it to append to context + * name. Added presentation feature. + * + * v1.6 Nenad Corbic + * Use only ALAW and MLAW not SLIN. + * This reduces the load quite a bit. + * Send out ALAW/ULAW format on HELLO message. + * RxTx Gain is done now in chan_woomera. + * + * v1.5 Nenad Corbic + * Bug fix in START_NACK_ACK handling. + * When we receive START_NACK we must alwasy pull tank before + * we send out NACK_ACK this way we will not try to send NACK + * ourself. + *********************************************************************************/ + +#include "sangoma_mgd.h" +#include "q931_cause.h" + + +#define USE_SYSLOG 1 +#define CODEC_LAW_DEFAULT 1 + +#ifdef CODEC_LAW_DEFAULT +static uint32_t codec_sample=8; +#else +static uint32_t codec_sample=16; +#endif + +static char ps_progname[]="sangoma_mgd"; + +static struct woomera_interface woomera_dead_dev; + +#if 0 +#define DOTRACE +#endif + + +#define SMG_VERSION "v1.21" + +/* enable early media */ +#if 1 +#define WOOMERA_EARLY_MEDIA 1 +#endif + + +#define SMG_DTMF_ON 60 +#define SMG_DTMF_OFF 10 +#define SMG_DTMF_RATE 8000 + +#if 0 +#define MEDIA_SOCK_SHUTDOWN 1 +#endif + +#ifdef DOTRACE +static int tc = 0; +#endif + +#if 0 +#warning "NENAD: HPTDM API" +#define WP_HPTDM_API 1 +#else +#undef WP_HPTDM_API +#endif + +#ifdef WP_HPTDM_API +hp_tdm_api_span_t *hptdmspan[WOOMERA_MAX_SPAN]; +#endif + +#undef SMG_CALLING_NAME + +const char WELCOME_TEXT[] = +"================================================================================\n" +"Sangoma Media Gateway Daemon v1.21 \n" +"TDM Signal Media Gateway for Sangoma/Wanpipe Cards\n" +"Copyright 2005, 2006, 2007 \n" +"Nenad Corbic , Anthony Minessale II \n" +"This program is free software, distributed under the terms of\n" +"the GNU General Public License\n" +"================================================================================\n" +""; + + +static int master_reset=0; + +static int coredump=1; +static int autoacm=1; + +static int launch_media_tdm_thread(struct woomera_interface *woomera); +static int launch_woomera_thread(struct woomera_interface *woomera); +static struct woomera_interface *alloc_woomera(void); + +q931_cause_to_str_array_t q931_cause_to_str_array[255]; + + +#if 0 +static uint32_t string_to_release(char *code) +{ + if (code) { + if (!strcasecmp(code, "CHANUNAVAIL")) { + return SIGBOOST_RELEASE_CAUSE_NOANSWER; + } + + if (!strcasecmp(code, "INVALID")) { + return SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST; + } + + if (!strcasecmp(code, "ERROR")) { + return SIGBOOST_RELEASE_CAUSE_UNDEFINED; + } + + if (!strcasecmp(code, "CONGESTION")) { + //return SIGBOOST_RELEASE_CAUSE_BUSY; + return SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST; + } + + if (!strcasecmp(code, "BUSY")) { + return SIGBOOST_RELEASE_CAUSE_BUSY; + } + + if (!strcasecmp(code, "NOANSWER")) { + return SIGBOOST_RELEASE_CAUSE_NOANSWER; + } + + if (!strcasecmp(code, "ANSWER")) { + return SIGBOOST_RELEASE_CAUSE_NORMAL; + } + + if (!strcasecmp(code, "CANCEL")) { + return SIGBOOST_RELEASE_CAUSE_BUSY; + } + + if (!strcasecmp(code, "UNKNOWN")) { + return SIGBOOST_RELEASE_CAUSE_UNDEFINED; + } + + } + return SIGBOOST_RELEASE_CAUSE_NORMAL; +} + +static char * release_to_string(uint32_t rel_cause) +{ + switch (rel_cause) { + + case SIGBOOST_RELEASE_CAUSE_UNDEFINED: + return "UNKNOWN"; + case SIGBOOST_RELEASE_CAUSE_NORMAL: + return "NORMAL"; + case SIGBOOST_RELEASE_CAUSE_BUSY: + return "BUSY"; + case SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST: + return "CHANUNAVAIL"; + case SIGBOOST_RELEASE_CAUSE_CIRCUIT_RESET: + return "CANCEL"; + case SIGBOOST_RELEASE_CAUSE_NOANSWER: + return "NOANSWER"; + case SIGBOOST_CALL_SETUP_NACK_CKT_START_TIMEOUT: + return "TIMEOUT"; + case SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY: + return "CONGESTION"; + case SIGBOOST_CALL_SETUP_NACK_CALLED_NUM_TOO_BIG: + return "ERROR"; + case SIGBOOST_CALL_SETUP_NACK_CALLING_NUM_TOO_BIG: + return "ERROR"; + case SIGBOOST_CALL_SETUP_NACK_CALLED_NUM_TOO_SMALL: + return "ERROR"; + case SIGBOOST_CALL_SETUP_NACK_CALLING_NUM_TOO_SMALL: + return "ERROR"; + } + + return "NORMAL"; +} +#endif + + + +void __log_printf(int level, FILE *fp, char *file, const char *func, int line, char *fmt, ...) +{ + char *data; + int ret = 0; + va_list ap; + + if (socket < 0) { + return; + } + + if (level && level > server.debug) { + return; + } + + va_start(ap, fmt); +#ifdef SOLARIS + data = (char *) malloc(2048); + vsnprintf(data, 2048, fmt, ap); +#else + ret = vasprintf(&data, fmt, ap); +#endif + va_end(ap); + if (ret == -1) { + fprintf(stderr, "Memory Error\n"); + } else { + char date[80] = ""; + struct tm now; + time_t epoch; + + if (time(&epoch) && localtime_r(&epoch, &now)) { + strftime(date, sizeof(date), "%Y-%m-%d %T", &now); + } + +#ifdef USE_SYSLOG + syslog(LOG_DEBUG | LOG_LOCAL2, data); +#else + fprintf(fp, "[%d] %s %s:%d %s() %s", getpid(), date, file, line, func, data); +#endif + free(data); + } +#ifndef USE_SYSLOG + fflush(fp); +#endif +} + + + + +static int isup_exec_command(int span, int chan, int id, int cmd, int cause) +{ + call_signal_event_t oevent; + int retry=5; + + call_signal_event_init(&oevent, cmd, chan, span); + oevent.release_cause = cause; + + if (id >= 0) { + oevent.call_setup_id = id; + } +isup_exec_cmd_retry: + if (call_signal_connection_write(&server.mcon, &oevent) <= 0){ + + --retry; + if (retry <= 0) { + log_printf(0, server.log, + "Critical System Error: Failed to tx on ISUP socket: %s\n", + strerror(errno)); + return -1; + } else { + log_printf(0, server.log, + "System Warning: Failed to tx on ISUP socket: %s :retry %i\n", + strerror(errno),retry); + } + + goto isup_exec_cmd_retry; + } + + return 0; +} + +static int socket_printf(int socket, char *fmt, ...) +{ + char *data; + int ret = 0; + va_list ap; + + if (socket < 0) { + return -1; + } + + va_start(ap, fmt); +#ifdef SOLARIS + data = (char *) malloc(2048); + vsnprintf(data, 2048, fmt, ap); +#else + ret = vasprintf(&data, fmt, ap); +#endif + va_end(ap); + if (ret == -1) { + fprintf(stderr, "Memory Error\n"); + log_printf(0, server.log, "Crtical ERROR: Memory Error!\n"); + } else { + int err; + int len = strlen(data); + err=send(socket, data, strlen(data), 0); + if (err != strlen(data)) { + log_printf(2, server.log, "ERROR: Failed to send data to woomera socket(%i): err=%i len=%d %s\n", + socket,err,len,strerror(errno)); + ret = err; + } else { + ret = 0; + } + + free(data); + } + + return ret; +} + + + +static int woomera_next_pair(struct woomera_config *cfg, char **var, char **val) +{ + int ret = 0; + char *p, *end; + + *var = *val = NULL; + + for(;;) { + cfg->lineno++; + + if (!fgets(cfg->buf, sizeof(cfg->buf), cfg->file)) { + ret = 0; + break; + } + + *var = cfg->buf; + + if (**var == '[' && (end = strchr(*var, ']'))) { + *end = '\0'; + (*var)++; + strncpy(cfg->category, *var, sizeof(cfg->category) - 1); + continue; + } + + if (**var == '#' || **var == '\n' || **var == '\r') { + continue; + } + + if ((end = strchr(*var, '#'))) { + *end = '\0'; + end--; + } else if ((end = strchr(*var, '\n'))) { + if (*end - 1 == '\r') { + end--; + } + *end = '\0'; + } + + p = *var; + while ((*p == ' ' || *p == '\t') && p != end) { + *p = '\0'; + p++; + } + *var = p; + + if (!(*val = strchr(*var, '='))) { + ret = -1; + log_printf(0, server.log, "Invalid syntax on %s: line %d\n", cfg->path, cfg->lineno); + continue; + } else { + p = *val - 1; + *(*val) = '\0'; + (*val)++; + if (*(*val) == '>') { + *(*val) = '\0'; + (*val)++; + } + + while ((*p == ' ' || *p == '\t') && p != *var) { + *p = '\0'; + p--; + } + + p = *val; + while ((*p == ' ' || *p == '\t') && p != end) { + *p = '\0'; + p++; + } + *val = p; + ret = 1; + break; + } + } + + return ret; + +} + + +#if 0 +static void woomera_set_span_chan(struct woomera_interface *woomera, int span, int chan) +{ + pthread_mutex_lock(&woomera->vlock); + woomera->span = span; + woomera->chan = chan; + pthread_mutex_unlock(&woomera->vlock); + +} +#endif + + +static struct woomera_event *new_woomera_event_printf(struct woomera_event *ebuf, char *fmt, ...) +{ + struct woomera_event *event = NULL; + int ret = 0; + va_list ap; + + if (ebuf) { + event = ebuf; + } else if (!(event = new_woomera_event())) { + log_printf(0, server.log, "Memory Error queuing event!\n"); + return NULL; + } else { + return NULL; + } + + va_start(ap, fmt); +#ifdef SOLARIS + event->data = (char *) malloc(2048); + vsnprintf(event->data, 2048, fmt, ap); +#else + ret = vasprintf(&event->data, fmt, ap); +#endif + va_end(ap); + if (ret == -1) { + log_printf(0, server.log, "Memory Error queuing event!\n"); + destroy_woomera_event(&event, EVENT_FREE_DATA); + return NULL; + } + + return event; + +} + +static struct woomera_event *woomera_clone_event(struct woomera_event *event) +{ + struct woomera_event *clone; + + if (!(clone = new_woomera_event())) { + return NULL; + } + + memcpy(clone, event, sizeof(*event)); + clone->next = NULL; + clone->data = strdup(event->data); + + return clone; +} + +static void enqueue_event(struct woomera_interface *woomera, + struct woomera_event *event, + event_args free_data) +{ + struct woomera_event *ptr, *clone = NULL; + + assert(woomera != NULL); + assert(event != NULL); + + if (!(clone = woomera_clone_event(event))) { + log_printf(0, server.log, "Error Cloning Event\n"); + return; + } + + pthread_mutex_lock(&woomera->queue_lock); + + for (ptr = woomera->event_queue; ptr && ptr->next ; ptr = ptr->next); + + if (ptr) { + ptr->next = clone; + } else { + woomera->event_queue = clone; + } + + pthread_mutex_unlock(&woomera->queue_lock); + + woomera_set_flag(woomera, WFLAG_EVENT); + + if (free_data && event->data) { + /* The event has been duplicated, the original data + * should be freed */ + free(event->data); + event->data=NULL; + } +} + +static char *dequeue_event(struct woomera_interface *woomera) +{ + struct woomera_event *event; + char *data = NULL; + + if (!woomera) { + return NULL; + } + + pthread_mutex_lock(&woomera->queue_lock); + if (woomera->event_queue) { + event = woomera->event_queue; + woomera->event_queue = event->next; + data = event->data; + pthread_mutex_unlock(&woomera->queue_lock); + + destroy_woomera_event(&event, EVENT_KEEP_DATA); + return data; + } + pthread_mutex_unlock(&woomera->queue_lock); + + return data; +} + + +static int enqueue_event_on_listeners(struct woomera_event *event) +{ + struct woomera_listener *ptr; + int x = 0; + + assert(event != NULL); + + pthread_mutex_lock(&server.listen_lock); + for (ptr = server.listeners ; ptr ; ptr = ptr->next) { + enqueue_event(ptr->woomera, event, EVENT_KEEP_DATA); + x++; + } + pthread_mutex_unlock(&server.listen_lock); + + return x; +} + + +static void del_listener(struct woomera_interface *woomera) +{ + struct woomera_listener *ptr, *last = NULL; + + pthread_mutex_lock(&server.listen_lock); + for (ptr = server.listeners ; ptr ; ptr = ptr->next) { + if (ptr->woomera == woomera) { + if (last) { + last->next = ptr->next; + } else { + server.listeners = ptr->next; + } + free(ptr); + break; + } + last = ptr; + } + pthread_mutex_unlock(&server.listen_lock); +} + +static void add_listener(struct woomera_interface *woomera) +{ + struct woomera_listener *new; + + pthread_mutex_lock(&server.listen_lock); + + if ((new = malloc(sizeof(*new)))) { + memset(new, 0, sizeof(*new)); + new->woomera = woomera; + new->next = server.listeners; + server.listeners = new; + } else { + log_printf(0, server.log, "Memory Error adding listener!\n"); + } + + pthread_mutex_unlock(&server.listen_lock); +} + + +#ifdef SMG_DTMF_ENABLE +static int wanpipe_send_dtmf(struct woomera_interface *woomera, char *digits) +{ + struct media_session *ms = woomera_get_ms(woomera); + char *cur = NULL; + int wrote = 0; + int err; + + if (!ms) { + return -EINVAL; + } + + if (!ms->dtmf_buffer) { + log_printf(3, woomera->log, "Allocate DTMF Buffer...."); + + err=switch_buffer_create_dynamic(&ms->dtmf_buffer, 1024, server.dtmf_size, 0); + + if (err != 0) { + log_printf(0, woomera->log, "Failed to allocate DTMF Buffer!\n"); + return -ENOMEM; + } else { + log_printf(3, woomera->log, "SUCCESS!\n"); + } + + } + + log_printf(3, woomera->log, "Sending DTMF %s\n",digits); + for (cur = digits; *cur; cur++) { + if ((wrote = teletone_mux_tones(&ms->tone_session, + &ms->tone_session.TONES[(int)*cur]))) { + + pthread_mutex_lock(&woomera->dtmf_lock); + + err=switch_buffer_write(ms->dtmf_buffer, ms->tone_session.buffer, wrote * 2); + + pthread_mutex_unlock(&woomera->dtmf_lock); + + log_printf(3, woomera->log, "Sending DTMF %s Wrote=%i (err=%i)\n", + digits,wrote*2,err); + } else { + log_printf(0, woomera->log, "Error: Sending DTMF %s (err=%i)\n", + digits,wrote); + } + } + + ms->skip_read_frames = 200; + return 0; +} +#endif + +static struct woomera_interface *alloc_woomera(void) +{ + struct woomera_interface *woomera = NULL; + + if ((woomera = malloc(sizeof(struct woomera_interface)))) { + + memset(woomera, 0, sizeof(struct woomera_interface)); + + woomera->chan = -1; + woomera->span = -1; + woomera->log = server.log; + woomera->debug = server.debug; + woomera->call_id = 1; + woomera->event_queue = NULL; + woomera->q931_rel_cause_topbx=SIGBOOST_RELEASE_CAUSE_NORMAL; + woomera->q931_rel_cause_tosig=SIGBOOST_RELEASE_CAUSE_NORMAL; + + woomera_set_interface(woomera, "w-1g-1"); + + + + } + + return woomera; + +} + + +static struct woomera_interface *new_woomera_interface(int socket, struct sockaddr_in *sock_addr, int len) +{ + struct woomera_interface *woomera = NULL; + + if (socket < 0) { + log_printf(0, server.log, "Critical: Invalid Socket on new interface!\n"); + return NULL; + } + + if ((woomera = alloc_woomera())) { + if (socket >= 0) { + no_nagle(socket); + woomera->socket = socket; + } + + if (sock_addr && len) { + memcpy(&woomera->addr, sock_addr, len); + } + } + + return woomera; + +} + +static char *woomera_message_header(struct woomera_message *wmsg, char *key) +{ + int x = 0; + char *value = NULL; + + for (x = 0 ; x < wmsg->last ; x++) { + if (!strcasecmp(wmsg->names[x], key)) { + value = wmsg->values[x]; + break; + } + } + + return value; +} + + +#if 1 + +static int waitfor_socket(int fd, int timeout, int flags) +{ + struct pollfd pfds[1]; + int res; + + memset(&pfds[0], 0, sizeof(pfds[0])); + pfds[0].fd = fd; + pfds[0].events = flags; + res = poll(pfds, 1, timeout); + + if (res > 0) { + if(pfds[0].revents & POLLIN) { + res = 1; + } else if ((pfds[0].revents & POLLERR)) { + res = -1; + } else if ((pfds[0].revents & POLLNVAL)) { + res = -2; +#if 0 + log_printf(0, server.log,"System Warning: Poll Event NVAL (0x%X) (fd=%i)!\n", + pfds[0].revents, fd); +#endif + } else { +#if 0 + log_printf(0, server.log,"System Error: Poll Event Error no event (0x%X) (fd=%i)!\n", + pfds[0].revents,fd); +#endif + res = -1; + } + } + + return res; +} + +#else + +static int waitfor_socket(int fd, int timeout, int flags) +{ + struct pollfd pfds[1]; + int res; + int errflags = (POLLERR | POLLHUP | POLLNVAL); + + memset(&pfds[0], 0, sizeof(pfds[0])); + pfds[0].fd = fd; + pfds[0].events = flags | errflags; + res = poll(pfds, 1, timeout); + + if (res > 0) { + if(pfds[0].revents & POLLIN) { + res = 1; + } else if ((pfds[0].revents & errflags)) { + res = -1; + } else { +#if 0 + log_printf(0, server.log,"System Error: Poll Event Error no event (0x%X)!\n", + pfds[0].revents); +#endif + res = -1; + } + } + + return res; +} + +#endif + +#if 1 +static int waitfor_2sockets(int fda, int fdb, char *a, char *b, int timeout) +{ + struct pollfd pfds[2]; + int res = 0; + int errflags = (POLLERR | POLLHUP | POLLNVAL); + + if (fda < 0 || fdb < 0) { + return -1; + } + + *a=0; + *b=0; + + memset(pfds, 0, sizeof(pfds)); + pfds[0].fd = fda; + pfds[1].fd = fdb; + pfds[0].events = POLLIN | errflags; + pfds[1].events = POLLIN | errflags; + if ((res = poll(pfds, 2, timeout)) > 0) { + res = 1; + if ((pfds[0].revents & errflags) || (pfds[1].revents & errflags)) { + res = -1; + } else { + if ((pfds[0].revents & POLLIN)) { + *a=1; + res++; + } + if ((pfds[1].revents & POLLIN)) { + *b=1; + res++; + } + } + + if (res == 1) { + /* No event found what to do */ + res=-1; + } + } + + return res; +} +#endif + + +static struct media_session *media_session_new(struct woomera_interface *woomera) +{ + struct media_session *ms = NULL; + int x; + char *p; + int span,chan; + + span=woomera->span; + chan=woomera->chan; + + log_printf(2, server.log,"Starting new MEDIA session [%s] [%s]\n", + woomera->interface,woomera->raw?woomera->raw:"N/A"); + + if ((ms = malloc(sizeof(struct media_session)))) { + memset(ms, 0, sizeof(struct media_session)); + + if (woomera->loop_tdm != 1) { + for(x = 0; x < strlen(woomera->raw) ; x++) { + if (woomera->raw[x] == ':') { + break; + } + if (woomera->raw[x] == '/') { + break; + } + } + + ms->ip = strndup(woomera->raw, x); + time(&ms->started); + p = woomera->raw + (x+1); + ms->port = atoi(p); + } + + time(&ms->started); + woomera_set_ms(woomera,ms); + ms->woomera = woomera; + +#ifdef SMG_DTMF_ENABLE + /* Setup artificial DTMF stuff */ + memset(&ms->tone_session, 0, sizeof(ms->tone_session)); + if (teletone_init_session(&ms->tone_session, 0, NULL, NULL)) { + log_printf(0, server.log, "ERROR: Failed to initialize TONE [w%ig%i]!\n", + span+1,chan+1); + } + + ms->tone_session.rate = SMG_DTMF_RATE; + ms->tone_session.duration = server.dtmf_on * (ms->tone_session.rate / 1000); + ms->tone_session.wait = server.dtmf_off * (ms->tone_session.rate / 1000); + + teletone_dtmf_detect_init (&ms->dtmf_detect, SMG_DTMF_RATE); +#endif + + } else { + log_printf(0, server.log, "ERROR: Memory Alloc Failed [w%ig%i]!\n", + span+1,chan+1); + } + + return ms; +} + +static void media_session_free(struct media_session *ms) +{ + if (ms->ip) { + free(ms->ip); + } + +#ifdef SMG_DTMF_ENABLE + teletone_destroy_session(&ms->tone_session); + switch_buffer_destroy(&ms->dtmf_buffer); +#endif + + ms->woomera = NULL; + + free(ms); +} + + +static int create_udp_socket(struct media_session *ms, char *local_ip, int local_port, char *ip, int port) +{ + int rc; + struct hostent *result, *local_result; + char buf[512], local_buf[512]; + int err = 0; + + log_printf(5,server.log,"LocalIP %s:%d IP %s:%d \n",local_ip, local_port, ip, port); + + memset(&ms->remote_hp, 0, sizeof(ms->remote_hp)); + memset(&ms->local_hp, 0, sizeof(ms->local_hp)); + if ((ms->socket = socket(AF_INET, SOCK_DGRAM, 0))) { + gethostbyname_r(ip, &ms->remote_hp, buf, sizeof(buf), &result, &err); + gethostbyname_r(local_ip, &ms->local_hp, local_buf, sizeof(local_buf), &local_result, &err); + if (result && local_result) { + ms->remote_addr.sin_family = ms->remote_hp.h_addrtype; + memcpy((char *) &ms->remote_addr.sin_addr.s_addr, ms->remote_hp.h_addr_list[0], ms->remote_hp.h_length); + ms->remote_addr.sin_port = htons(port); + + ms->local_addr.sin_family = ms->local_hp.h_addrtype; + memcpy((char *) &ms->local_addr.sin_addr.s_addr, ms->local_hp.h_addr_list[0], ms->local_hp.h_length); + ms->local_addr.sin_port = htons(local_port); + + rc = bind(ms->socket, (struct sockaddr *) &ms->local_addr, sizeof(ms->local_addr)); + if (rc < 0) { + close(ms->socket); + ms->socket = -1; + + log_printf(5,server.log, + "Failed to bind LocalIP %s:%d IP %s:%d (%s)\n", + local_ip, local_port, ip, port,strerror(errno)); + } + + /* OK */ + + } else { + log_printf(0,server.log, + "Failed to get hostbyname LocalIP %s:%d IP %s:%d (%s)\n", + local_ip, local_port, ip, port,strerror(errno)); + } + } else { + log_printf(0,server.log, + "Failed to create/allocate UDP socket\n"); + } + + return ms->socket; +} + +static int next_media_port(void) +{ + int port; + + pthread_mutex_lock(&server.media_udp_port_lock); + port = ++server.next_media_port; + if (port > WOOMERA_MAX_MEDIA_PORT) { + server.next_media_port = WOOMERA_MIN_MEDIA_PORT; + port = WOOMERA_MIN_MEDIA_PORT; + } + pthread_mutex_unlock(&server.media_udp_port_lock); + + return port; +} + +#ifdef SMG_DTMF_ENABLE + +static int woomera_dtmf_transmit(struct media_session *ms, int mtu) +{ + struct woomera_interface *woomera = ms->woomera; + int bread; + unsigned char dtmf[1024]; + unsigned char dtmf_law[1024]; + sangoma_api_hdr_t hdrframe; + int i; + int slin_len = mtu*2; + short *data; + int used; + memset(&hdrframe,0,sizeof(hdrframe)); + + if (!ms->dtmf_buffer) { + return -1; + } + + for (;;) { + +#ifdef CODEC_LAW_DEFAULT + + pthread_mutex_lock(&woomera->dtmf_lock); + if ((used=switch_buffer_inuse(ms->dtmf_buffer)) <= 0) { + pthread_mutex_unlock(&woomera->dtmf_lock); + break; + } + + bread = switch_buffer_read(ms->dtmf_buffer, dtmf, slin_len); + pthread_mutex_unlock(&woomera->dtmf_lock); + + if (bread <= 0) { + break; + } + +#if 0 + if (bread < slin_len) { + while (bread < slin_len) { + dtmf[bread++] = 0xFF; + } + } +#endif + + log_printf(3,woomera->log,"%s: Write DTMF Got %d bytes MTU=%i Coding=%i Used=%i\n", + woomera->interface,bread,mtu,ms->hw_coding,used); + + data=(short*)dtmf; + for (i=0;ihw_coding) { + /* ALAW */ + dtmf_law[i] = linear_to_alaw((int)data[i]); + } else { + /* ULAW */ + dtmf_law[i] = linear_to_ulaw((int)data[i]); + } + } + + sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + dtmf_law, mtu, 0); + + ms->skip_write_frames+=server.dtmf_intr_ch; +#else +... + pthread_mutex_lock(&woomera->dtmf_lock); + bread = switch_buffer_read(ms->dtmf_buffer, dtmf, mtu); + pthread_mutex_unlock(&woomera->dtmf_lock); + + if (bread < mtu) { + while (bread < mtu) { + dtmf[bread++] = 0; + } + } + + log_printf(3,woomera->log,"%s: Write DTMF Got %d bytes\n", + woomera->interface,bread); + + sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + dtmf, mtu, 0); + ms->skip_write_frames++; +#endif + return 0; + } + + return -1; +} +#endif + +static void media_loop_run(struct media_session *ms) +{ + struct woomera_interface *woomera = ms->woomera; + int sangoma_frame_len = 160; + int errs=0; + int res=0; + wanpipe_tdm_api_t tdm_api; + unsigned char circuit_frame[1024]; + char filename[100]; + FILE *filed=NULL; + int loops=0; + + sangoma_api_hdr_t hdrframe; + memset(&hdrframe,0,sizeof(hdrframe)); + memset(circuit_frame,0,sizeof(circuit_frame)); + + ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1); + + log_printf(1, server.log, "Media Loop Started %s fd=%i\n", + woomera->interface,ms->sangoma_sock); + + if (ms->sangoma_sock < 0) { + log_printf(0, server.log, "WANPIPE MEDIA Socket Error (%s) if=[%s] [w%ig%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); + errs++; + } else { + + + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_NONE) < 0 ) { + errs++; + } + + if (sangoma_tdm_flush_bufs(ms->sangoma_sock, &tdm_api)) { + errs++; + } + + if (sangoma_tdm_set_usr_period(ms->sangoma_sock, &tdm_api, 20) < 0 ) { + errs++; + } + + sangoma_frame_len = sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + sangoma_tdm_disable_hwec(ms->sangoma_sock,&tdm_api); + + } + + if (errs) { + + log_printf(0, server.log, "Media Loop: failed to open tdm device %s\n", + woomera->interface); + return; + } + + if (server.loop_trace) { + sprintf(filename,"/smg/w%ig%i-loop.trace",woomera->span+1,woomera->chan+1); + unlink(filename); + filed = safe_fopen(filename, "w"); + } + + while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + ((res = waitfor_socket(ms->sangoma_sock, 1000, POLLERR | POLLIN)) >= -2)) { + + if (res == 0) { + //log_printf(4, server.log, "%s: TDM UDP Timeout !!!\n", + // woomera->interface); + /* NENAD Timeout thus just continue */ + continue; + } + + if (res == -2) { + close_socket(&ms->sangoma_sock); + ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1); + log_printf(0, server.log, "Media Loop Restart %s\n", + woomera->interface); + continue; + } + + if (res < 0 ){ + log_printf(0, server.log, "Media Loop Socket error %s\n", + woomera->interface); + break; + } + + res = sangoma_readmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + sizeof(circuit_frame), 0); + if (res < 0) { + log_printf(0, server.log, "TDM Loop ReadMsg Error: %s\n", + strerror(errno), woomera->interface); + break; + } + + if (server.loop_trace && filed != NULL) { + int i; + for (i=0;isangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + res, 0); + + res=0; + + loops++; + } + + + if (res < 0) { + log_printf(2, server.log, "Media Loop: socket error %s (fd=%i)!\n", + woomera->interface, ms->sangoma_sock); + } + + + if (server.loop_trace && filed != NULL) { + fclose(filed); + } + + sangoma_tdm_enable_hwec(ms->sangoma_sock,&tdm_api); + + sleep(1); + + close_socket(&ms->sangoma_sock); + + log_printf(1, server.log, "Media Loop Finished %s Master=%i MediaEnd=%i Loops=%i\n", + woomera->interface, + woomera_test_flag(&server.master_connection, WFLAG_RUNNING), + woomera_test_flag(woomera, WFLAG_MEDIA_END),loops); + + return; + +} + +#ifdef WP_HPTDM_API +static int media_rx_ready(void *p, unsigned char *data, int len) +{ + struct media_session *ms = (struct media_session *)p; + + if (ms->udp_sock < 0) { + return -1; + } + + return sendto(ms->udp_sock, + data,len, 0, + (struct sockaddr *) &ms->remote_addr, + sizeof(ms->remote_addr)); + + +} +#endif + +static void *media_thread_run(void *obj) +{ + struct media_session *ms = obj; + struct woomera_interface *woomera = ms->woomera; + int sangoma_frame_len = 160; + int local_port, x = 0, errs = 0, res = 0, packet_len = 0; + //int udp_cnt=0; + struct woomera_event wevent; + wanpipe_tdm_api_t tdm_api; + FILE *tx_fd=NULL; + int sock_timeout=200; + + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || + !woomera->interface || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(2, server.log, + "MEDIA session for [%s] Cancelled! (ptr=%p)\n", + woomera->interface,woomera); + /* In this case the call will be closed via woomera_thread_run + * function. And the process table will be cleard there */ + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + media_session_free(ms); + pthread_exit(NULL); + return NULL; + } + + + log_printf(2, server.log, "MEDIA session for [%s] started (ptr=%p loop=%i)\n", + woomera->interface,woomera,woomera->loop_tdm); + + if (woomera->loop_tdm) { + media_loop_run(ms); + ms->udp_sock=-1; + woomera_set_flag(woomera, WFLAG_HANGUP); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + goto media_thread_exit; + } + + for(x = 0; x < 1000 ; x++) { + local_port = next_media_port(); + if ((ms->udp_sock = create_udp_socket(ms, server.media_ip, local_port, ms->ip, ms->port)) > -1) { + break; + } + } + + if (ms->udp_sock < 0) { + log_printf(0, server.log, "UDP Socket Error (%s) [%s] LocalPort=%d\n", + strerror(errno), woomera->interface, local_port); + + errs++; + } else { + +#ifdef WP_HPTDM_API + hp_tdm_api_span_t *span=hptdmspan[woomera->span+1]; + if (!span || !span->init) { + errs++; + } else { + hp_tdm_api_usr_callback_t usr_callback; + memset(&usr_callback,0,sizeof(usr_callback)); + usr_callback.p = ms; + usr_callback.rx_avail = media_rx_ready; + if (span->open_chan(span, &usr_callback, &ms->tdmchan,woomera->chan+1)) { + errs++; + } + } +#else + if ((ms->sangoma_sock = sangoma_create_socket_by_name(woomera->interface, NULL)) < 0) { + log_printf(0, server.log, "WANPIPE Socket Error (%s) if=[%s] [w%ig%i]\n", + strerror(errno), woomera->interface, woomera->span+1, woomera->chan+1); + errs++; + } else { + +# ifdef CODEC_LAW_DEFAULT + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_NONE) < 0 ) { + errs++; + } +# else + if (sangoma_tdm_set_codec(ms->sangoma_sock, &tdm_api, WP_SLINEAR) < 0 ) { + errs++; + } +# endif + if (sangoma_tdm_flush_bufs(ms->sangoma_sock, &tdm_api)) { + errs++; + } + + if (sangoma_tdm_set_usr_period(ms->sangoma_sock, &tdm_api, 20) < 0 ) { + errs++; + } + +# ifdef CODEC_LAW_DEFAULT +# ifdef LIBSANGOMA_GET_HWCODING + ms->hw_coding=sangoma_tdm_get_hw_coding(ms->sangoma_sock, &tdm_api); + if (ms->hw_coding < 0) { + errs++; + } +# else +# error "libsangoma missing hwcoding feature: not up to date!" +# endif +# endif + + sangoma_frame_len = sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + } +#endif + } + + + +#ifdef WP_HPTDM_API + /* No tdm thread */ +#else + if (!errs && + launch_media_tdm_thread(woomera)) { + errs++; + } +#endif + + if (!errs) { + + unsigned char udp_frame[4096]; + sangoma_api_hdr_t hdrframe; + memset(&hdrframe,0,sizeof(hdrframe)); + memset(udp_frame,0,sizeof(udp_frame)); +#ifdef DOTRACE + int fdin, fdout; + char path_in[512], path_out[512]; +#endif + + + +#if 0 + new_woomera_event_printf(&wevent, + "EVENT MEDIA %s AUDIO%s" + "Raw-Audio: %s:%d%s" + "Call-ID: %s%s" + "Raw-Format: %s%s" + , + woomera->interface, + WOOMERA_LINE_SEPERATOR, + server.media_ip, + local_port, + WOOMERA_LINE_SEPERATOR, + woomera->interface, + WOOMERA_LINE_SEPERATOR, + ms->hw_coding ?"ALAW":"ULAW", + WOOMERA_RECORD_SEPERATOR + ); +#else + new_woomera_event_printf(&wevent, + "EVENT MEDIA %s AUDIO%s" + "Unique-Call-Id: %s%s" + "Raw-Audio: %s:%d%s" + "Call-ID: %s%s" + "Raw-Format: PCM-16%s" + , + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + server.media_ip, + local_port, + WOOMERA_LINE_SEPERATOR, + woomera->interface, + WOOMERA_LINE_SEPERATOR, + WOOMERA_RECORD_SEPERATOR + ); +#endif + + + enqueue_event(woomera, &wevent, EVENT_FREE_DATA); + +#ifdef DOTRACE + sprintf(path_in, "/tmp/debug-in.%d.raw", tc); + sprintf(path_out, "/tmp/debug-out.%d.raw", tc++); + fdin = open(path_in, O_WRONLY | O_CREAT, O_TRUNC, 0600); + fdout = open(path_out, O_WRONLY | O_CREAT, O_TRUNC, 0600); +#endif + + if (server.out_tx_test) { + tx_fd=fopen("/smg/sound.raw","rb"); + if (!tx_fd){ + log_printf(0,server.log, "FAILED TO OPEN Sound file!\n"); + } + } + + + while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + !woomera_test_flag(woomera, WFLAG_HANGUP) && + (res = waitfor_socket(ms->udp_sock, sock_timeout, POLLERR | POLLIN)) >= 0) { + + unsigned int fromlen = sizeof(struct sockaddr_in); + + + if (res == 0) { + + if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) { + sock_timeout=sangoma_frame_len/codec_sample; + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + } + } else { + sock_timeout=200; + } + + log_printf(4, server.log, "%s: UDP Sock Timeout !!!\n", + woomera->interface); + /* NENAD Timeout thus just continue */ + continue; + } + + if ((packet_len = recvfrom(ms->udp_sock, udp_frame, sizeof(udp_frame), + MSG_DONTWAIT, (struct sockaddr *) &ms->local_addr, &fromlen)) < 1) { + log_printf(2, server.log, "UDP Recv Error: %s\n",strerror(errno)); + break; + } + +#if 0 + log_printf(6, server.log, "%s: UDP Receive %i !!!\n", + woomera->interface,packet_len); +#endif + + if (packet_len > 0) { + + if (packet_len != sangoma_frame_len && ms->udp_sync_cnt <= 5) { + /* Assume that we will always receive SLINEAR here */ + sangoma_tdm_set_usr_period(ms->sangoma_sock, + &tdm_api, packet_len/codec_sample); + sangoma_frame_len = + sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + + log_printf(0, server.log, + "%s: UDP TDM Period ReSync to Len=%i %ims (udp=%i) \n", + woomera->interface,sangoma_frame_len, + sangoma_frame_len/codec_sample,packet_len); + + + if (++ms->udp_sync_cnt >= 6) { + sangoma_tdm_set_usr_period(ms->sangoma_sock, + &tdm_api, 20); + sangoma_frame_len = + sangoma_tdm_get_usr_mtu_mru(ms->sangoma_sock,&tdm_api); + log_printf(0, server.log, + "%s: UDP TDM Period Force ReSync to 20ms \n", + woomera->interface); + } + + } + +#ifdef SMG_DTMF_ENABLE + if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) { + sock_timeout=sangoma_frame_len/codec_sample; + /* For sanity sake if we are doing the out test + * dont take any chances force tx udp data */ + if (!server.out_tx_test) { + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + } + continue; + } + } else { + sock_timeout=200; + } + + if (ms->skip_write_frames > 0) { + ms->skip_write_frames--; + continue; + } +#endif + + if (server.out_tx_test && tx_fd && + fread((void*)udp_frame, + sizeof(char), + packet_len,tx_fd) <= 0) { + + sangoma_get_full_cfg(ms->sangoma_sock,&tdm_api); + fclose(tx_fd); + tx_fd=NULL; + } + +#ifdef WP_HPTDM_API + if (ms->tdmchan->push) { + ms->tdmchan->push(ms->tdmchan,udp_frame,packet_len); + } +#else + sangoma_sendmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + udp_frame, + packet_len, 0); +#endif + + } + +#if 0 + if (woomera->span == 1 && woomera->chan == 1) { + udp_cnt++; + if (udp_cnt && udp_cnt % 1000 == 0) { + log_printf(0, server.log, "%s: MEDIA UDP TX RX CNT %i %i\n", + woomera->interface,udp_cnt,packet_len); + } + } +#endif + } + + if (res < 0) { + log_printf(2, server.log, "Media Thread: socket error !\n"); + } + } + + + + new_woomera_event_printf(&wevent, + "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Start-Time: %ld%s" + "End-Time: %ld%s" + "Answer-Time: %ld%s" + "Call-ID: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + + woomera->session, + WOOMERA_LINE_SEPERATOR, + + time(&ms->started), + WOOMERA_LINE_SEPERATOR, + + time(NULL), + WOOMERA_LINE_SEPERATOR, + + time(&ms->answered), + WOOMERA_LINE_SEPERATOR, + + woomera->interface, + WOOMERA_LINE_SEPERATOR, + + q931_rel_to_str(woomera->q931_rel_cause_topbx), + WOOMERA_LINE_SEPERATOR, + + woomera->q931_rel_cause_topbx, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + +media_thread_exit: + + if (woomera_test_flag(woomera, WFLAG_MEDIA_TDM_RUNNING)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + while(woomera_test_flag(woomera, WFLAG_MEDIA_TDM_RUNNING)) { + usleep(1000); + sched_yield(); + } + } + + + close_socket(&ms->udp_sock); + close_socket(&ms->sangoma_sock); + + if (tx_fd){ + fclose(tx_fd); + tx_fd=NULL; + } + + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + + woomera_set_ms(woomera,NULL); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + + media_session_free(ms); + + log_printf(2, server.log, "MEDIA session for [%s] ended (ptr=%p)\n", + woomera->interface,woomera); + + + pthread_exit(NULL); + return NULL; +} + + + + +static void *media_tdm_thread_run(void *obj) +{ + struct media_session *ms = obj; + struct woomera_interface *woomera = ms->woomera; + int res = 0; + //int tdm_cnt=0; + //wanpipe_tdm_api_t tdm_api; + unsigned char circuit_frame[1024]; + sangoma_api_hdr_t hdrframe; + + memset(&hdrframe,0,sizeof(hdrframe)); + memset(circuit_frame,0,sizeof(circuit_frame)); + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || !woomera->interface) { + log_printf(2, server.log, "MEDIA TDM session for [%s] Cancelled! (ptr=%p)\n", + woomera->interface,woomera); + /* In this case the call will be closed via woomera_thread_run + * function. And the process table will be cleard there */ + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + pthread_exit(NULL); + return NULL; + } + + log_printf(2, server.log, "MEDIA TDM session for [%s] started (ptr=%p)\n", + woomera->interface,woomera); + + + while ( woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + (res = waitfor_socket(ms->sangoma_sock, 1000, POLLERR | POLLIN)) >= -2) { + + if (res == 0) { + //log_printf(4, server.log, "%s: TDM UDP Timeout !!!\n", + // woomera->interface); + /* NENAD Timeout thus just continue */ + continue; + } else if (res == -2) { + close_socket(&ms->sangoma_sock); + ms->sangoma_sock = sangoma_open_tdmapi_span_chan(woomera->span+1, woomera->chan+1); + if (ms->sangoma_sock < 0) { + log_printf(0, server.log, "Media TDM Restart Failed%s\n", + woomera->interface); + break; + } + log_printf(0, server.log, "Media TDM Restart %s\n", + woomera->interface); + continue; + } else if (res < 0) { + log_printf(0, server.log, "Media TDM Sangoma Socket Error %s\n", + woomera->interface); + break; + } + + res = sangoma_readmsg_socket(ms->sangoma_sock, + &hdrframe, + sizeof(hdrframe), + circuit_frame, + sizeof(circuit_frame), 0); + if (res < 0) { + log_printf(0, server.log, "TDM ReadMsg Error: %s\n", strerror(errno)); + break; + } + + res = sendto(ms->udp_sock, + circuit_frame, + res, 0, + (struct sockaddr *) &ms->remote_addr, + sizeof(ms->remote_addr)); + + if (res < 0) { + log_printf(2, server.log, "UDP Sento Error: %s\n", strerror(errno)); + break; + } +#if 0 + if (woomera->span == 1 && woomera->chan == 1) { + tdm_cnt++; + if (tdm_cnt && tdm_cnt % 1000 == 0) { + log_printf(0, server.log, "%s: MEDIA TDM TX RX CNT %i %i\n", + woomera->interface,tdm_cnt,res); + } + } +#endif + } + + if (res < 0) { + log_printf(2, server.log, "Media TDM Thread: socket error !\n"); + } + + log_printf(2, server.log, "MEDIA TDM session for [%s] ended (ptr=%p)\n", + woomera->interface,woomera); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + + pthread_exit(NULL); + return NULL; + +} + + +/* This function must be called with process_lock + * because it modifies shared process_table */ + +static int launch_media_thread(struct woomera_interface *woomera) +{ + pthread_attr_t attr; + int result = -1; + struct media_session *ms; + + if ((ms = media_session_new(woomera))) { + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_MEDIA_RUNNING); + result = pthread_create(&ms->thread, &attr, media_thread_run, ms); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_MEDIA_RUNNING); + media_session_free(woomera->ms); + + } + pthread_attr_destroy(&attr); + + } else { + log_printf(0, server.log, "Failed to start new media session\n"); + } + + return result; + +} + +static int launch_media_tdm_thread(struct woomera_interface *woomera) +{ + pthread_attr_t attr; + int result = -1; + struct media_session *ms = woomera_get_ms(woomera); + + if (!ms) { + return result; + } + + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + result = pthread_create(&ms->thread, &attr, media_tdm_thread_run, ms); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_MEDIA_TDM_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + + +static struct woomera_interface * launch_woomera_loop_thread(call_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + char callid[20]; + + sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + + if ((woomera = alloc_woomera())) { + + woomera->chan = event->chan; + woomera->span = event->span; + woomera->log = server.log; + woomera->debug = server.debug; + woomera->call_id = 1; + woomera->event_queue = NULL; + woomera->loop_tdm=1; + + } else { + log_printf(0, server.log, "Critical ERROR: memory/socket error\n"); + return NULL; + } + + woomera_set_interface(woomera,callid); + + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = woomera; + pthread_mutex_unlock(&server.process_lock); + + if (launch_woomera_thread(woomera)) { + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + free(woomera); + log_printf(0, server.log, "Critical ERROR: memory/socket error\n"); + return NULL; + } + + return woomera; +} + +static int woomera_message_parse(struct woomera_interface *woomera, struct woomera_message *wmsg, int timeout) +{ + char *cur, *cr, *next = NULL, *eor = NULL; + char buf[2048]; + int res = 0, bytes = 0, sanity = 0; + struct timeval started, ended; + int elapsed, loops = 0; + int failto = 0; + int packet = 0; + + memset(wmsg, 0, sizeof(*wmsg)); + + if (woomera->socket < 0 ) { + log_printf(2, woomera->log, WOOMERA_DEBUG_PREFIX "%s Invalid Socket! %d\n", + woomera->interface,woomera->socket); + return -1; + } + + if (woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(5, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MEDIA END or HANGUP !\n", + woomera->interface); + return -1; + } + + gettimeofday(&started, NULL); + memset(buf, 0, sizeof(buf)); + + if (timeout < 0) { + timeout = abs(timeout); + failto = 1; + } else if (timeout == 0) { + timeout = -1; + } + + + while (!(eor = strstr(buf, WOOMERA_RECORD_SEPERATOR))) { + if (sanity > 1000) { + log_printf(2, woomera->log, WOOMERA_DEBUG_PREFIX "%s Failed Sanity Check!\n[%s]\n\n", woomera->interface, buf); + return -1; + } + + if ((res = waitfor_socket(woomera->socket, 1000, POLLERR | POLLIN) > 0)) { + res = recv(woomera->socket, buf, sizeof(buf), MSG_PEEK); + + if (res > 1) { + packet++; + } + if (!strncmp(buf, WOOMERA_LINE_SEPERATOR, 2)) { + res = read(woomera->socket, buf, 2); + return 0; + } + if (res == 0) { + sanity++; + /* Looks Like it's time to go! */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(5, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MEDIA END or HANGUP \n", woomera->interface); + return -1; + } + ysleep(1000); + continue; + } else if (res < 0) { + log_printf(3, woomera->log, WOOMERA_DEBUG_PREFIX + "%s error during packet retry #%d\n", + woomera->interface, loops); + return res; + } else if (loops) { + ysleep(100000); + } + } + + gettimeofday(&ended, NULL); + elapsed = (((ended.tv_sec * 1000) + ended.tv_usec / 1000) - ((started.tv_sec * 1000) + started.tv_usec / 1000)); + + if (res < 0) { + log_printf(2, woomera->log, WOOMERA_DEBUG_PREFIX "%s Bad RECV\n", + woomera->interface); + return res; + } else if (res == 0) { + sanity++; + /* Looks Like it's time to go! */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + woomera_test_flag(woomera, WFLAG_MEDIA_END) || + woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(5, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MEDIA END or HANGUP \n", woomera->interface); + return -1; + } + ysleep(1000); + continue; + } + + if (packet && loops > 150) { + log_printf(1, woomera->log, WOOMERA_DEBUG_PREFIX + "%s Timeout waiting for packet.\n", + woomera->interface); + return -1; + } + + if (timeout > 0 && (elapsed > timeout)) { + log_printf(1, woomera->log, WOOMERA_DEBUG_PREFIX + "%s Timeout [%d] reached\n", + woomera->interface, timeout); + return failto ? -1 : 0; + } + + if (woomera_test_flag(woomera, WFLAG_EVENT)) { + /* BRB! we have an Event to deliver....*/ + return 0; + } + + /* what're we still doing here? */ + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + !woomera_test_flag(woomera, WFLAG_RUNNING)) { + log_printf(2, woomera->log, WOOMERA_DEBUG_PREFIX + "%s MASTER RUNNING or RUNNING!\n", woomera->interface); + return -1; + } + loops++; + } + + *eor = '\0'; + bytes = strlen(buf) + 4; + + memset(buf, 0, sizeof(buf)); + res = read(woomera->socket, buf, bytes); + next = buf; + + if (woomera->debug > 1) { + log_printf(3, woomera->log, "%s:WOOMERA RX MSG: %s\n",woomera->interface,buf); + + } + + while ((cur = next)) { + + if ((cr = strstr(cur, WOOMERA_LINE_SEPERATOR))) { + *cr = '\0'; + next = cr + (sizeof(WOOMERA_LINE_SEPERATOR) - 1); + if (!strcmp(next, WOOMERA_RECORD_SEPERATOR)) { + break; + } + } + if (!cur || !*cur) { + break; + } + + if (!wmsg->last) { + char *cmd, *id, *args; + woomera_set_flag(wmsg, MFLAG_EXISTS); + cmd = cur; + + if ((id = strchr(cmd, ' '))) { + *id = '\0'; + id++; + if ((args = strchr(id, ' '))) { + *args = '\0'; + args++; + strncpy(wmsg->command_args, args, sizeof(wmsg->command_args)-1); + } + strncpy(wmsg->callid, id, sizeof(wmsg->callid)-1); + } + + strncpy(wmsg->command, cmd, sizeof(wmsg->command)-1); + } else { + char *name, *val; + name = cur; + + if ((val = strchr(name, ':'))) { + *val = '\0'; + val++; + while (*val == ' ') { + *val = '\0'; + val++; + } + strncpy(wmsg->values[wmsg->last-1], val, WOOMERA_STRLEN); + } + strncpy(wmsg->names[wmsg->last-1], name, WOOMERA_STRLEN); + if (name && val && !strcasecmp(name, "content-type")) { + woomera_set_flag(wmsg, MFLAG_CONTENT); + bytes = atoi(val); + } + if (name && val && !strcasecmp(name, "content-length")) { + woomera_set_flag(wmsg, MFLAG_CONTENT); + bytes = atoi(val); + } + + + } + wmsg->last++; + } + + wmsg->last--; + + if (bytes && woomera_test_flag(wmsg, MFLAG_CONTENT)) { + read(woomera->socket, wmsg->body, + (bytes > sizeof(wmsg->body)) ? sizeof(wmsg->body) : bytes); + } + + return woomera_test_flag(wmsg, MFLAG_EXISTS); + +} + +static struct woomera_interface *pull_from_holding_tank(int index, int span , int chan) +{ + struct woomera_interface *woomera = NULL; + + if (index < 1 || index >= CORE_TANK_LEN) { + if (index != 0) { + log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return NULL; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] && + server.holding_tank[index] != &woomera_dead_dev) { + woomera = server.holding_tank[index]; + + /* Block this index until the call is completed */ + server.holding_tank[index] = &woomera_dead_dev; + + woomera->timeout = 0; + woomera->index = 0; + woomera->span=span; + woomera->chan=chan; + } + pthread_mutex_unlock(&server.ht_lock); + + return woomera; +} + +static void clear_from_holding_tank(int index, struct woomera_interface *woomera) +{ + + if (index < 1 || index >= CORE_TANK_LEN) { + if (index != 0) { + log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] == &woomera_dead_dev) { + server.holding_tank[index] = NULL; + } else if (woomera && server.holding_tank[index] == woomera) { + server.holding_tank[index] = NULL; + } else if (server.holding_tank[index]) { + log_printf(0, server.log, "Error: Holding tank index %i not cleared %p !\n", + index, server.holding_tank[index]); + } + pthread_mutex_unlock(&server.ht_lock); + + return; +} + +static struct woomera_interface *peek_from_holding_tank(int index) +{ + struct woomera_interface *woomera = NULL; + + if (index < 1 || index >= CORE_TANK_LEN) { + if (index != 0) { + log_printf(0, server.log, "%s Error on invalid TANK INDEX = %i\n", + __FUNCTION__,index); + } + return NULL; + } + + pthread_mutex_lock(&server.ht_lock); + if (server.holding_tank[index] && + server.holding_tank[index] != &woomera_dead_dev) { + woomera = server.holding_tank[index]; + } + pthread_mutex_unlock(&server.ht_lock); + + return woomera; +} + +static int add_to_holding_tank(struct woomera_interface *woomera) +{ + int next, i, found=0; + + pthread_mutex_lock(&server.ht_lock); + + for (i=0;i= CORE_TANK_LEN) { + next = server.holding_tank_index = 1; + } + + if (next == 0) { + log_printf(0, server.log, "\nCritical Error on TANK INDEX == 0\n"); + continue; + } + + if (server.holding_tank[next]) { + continue; + } + + found=1; + break; + } + + if (!found) { + /* This means all tank vales are busy + * should never happend */ + pthread_mutex_unlock(&server.ht_lock); + log_printf(0, server.log, "\nCritical Error failed to obtain a TANK INDEX\n"); + return 0; + } + + server.holding_tank[next] = woomera; + woomera->timeout = time(NULL) + 100; + + pthread_mutex_unlock(&server.ht_lock); + return next; +} + +static int handle_woomera_media_accept_answer(struct woomera_interface *woomera, + struct woomera_message *wmsg, + int media, int answer, int accept) +{ + char *raw = woomera_message_header(wmsg, "raw-audio"); + + log_printf(4, woomera->log, "WOOMERA CMD: %s [%s]\n", + wmsg->command, woomera->interface); + + + if (woomera_test_flag(woomera, WFLAG_HANGUP) || + !woomera_test_flag(woomera, WFLAG_RUNNING) || + woomera_test_flag(woomera, WFLAG_MEDIA_END)) { + + log_printf(2, server.log, + "ERROR! call was cancelled MEDIA on HANGUP or MEDIA END!\n"); + + woomera->timeout=0; + return -1; + } + + log_printf(3, server.log,"WOOMERA: GOT %s EVENT: [%s] RAW=%s\n", + wmsg->command,wmsg->callid,raw); + + + if (raw && + woomera->raw == NULL && + !woomera_test_flag(woomera, WFLAG_RAW_MEDIA_STARTED)) { + + woomera_set_flag(woomera, WFLAG_RAW_MEDIA_STARTED); + + woomera_set_raw(woomera, raw); + + if (launch_media_thread(woomera)) { + struct woomera_event wevent; + + log_printf(4, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); + +#if 0 + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); +#endif + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_RECORD_SEPERATOR + ); + + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + woomera->timeout=0; + return -1; + } + } + + if (!woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + log_printf(0, server.log,"ERROR! Monitor Thread not running!\n"); + + } else { + + if (accept) { + if (!autoacm) { + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + isup_exec_command(woomera->span, + woomera->chan, + -1, + SIGBOOST_EVENT_CALL_START_ACK, + 0); + } + } + + if (answer) { + struct media_session *ms; + + pthread_mutex_lock(&woomera->ms_lock); + if ((ms=woomera->ms)) { + time(&woomera->ms->answered); + } + pthread_mutex_unlock(&woomera->ms_lock); + + if (ms) { + + if (!autoacm && !woomera_test_flag(woomera,WFLAG_CALL_ACKED)) { + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + isup_exec_command(woomera->span, + woomera->chan, + -1, + SIGBOOST_EVENT_CALL_START_ACK, + 0); + } + + isup_exec_command(woomera->span, + woomera->chan, + -1, + SIGBOOST_EVENT_CALL_ANSWERED, + 0); + log_printf(2, server.log, + "Sent SIGBOOST_EVENT_CALL_ANSWERED [w%dg%d]\n", + woomera->span+1,woomera->chan+1); + } else { + struct woomera_event wevent; + log_printf(0, server.log, + "WOOMERA ANSWER: FAILED [%s] no Media \n", + wmsg->command,wmsg->callid); + + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + woomera->timeout=0; + return -1; + } + } + } + + { + struct woomera_event wevent; + new_woomera_event_printf(&wevent, "200 %s OK%s" + "Unique-Call-Id: %s%s", + answer ? "ANSWER" : + accept ? "ACCEPT" : "MEDIA", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + } + + return 0; +} + +static int handle_woomera_call_start (struct woomera_interface *woomera, + struct woomera_message *wmsg) +{ + char *raw = woomera_message_header(wmsg, "raw-audio"); + call_signal_event_t event; + char *calling = woomera_message_header(wmsg, "local-number"); +#ifdef SMG_CALLING_NAME + char *calling_name = woomera_message_header(wmsg, "local-name"); +#endif + char *presentation = woomera_message_header(wmsg, "Presentation"); + char *screening = woomera_message_header(wmsg, "Screening"); + char *rdnis = woomera_message_header(wmsg, "RDNIS"); + char *called = wmsg->callid; + char *grp = wmsg->callid; + char *p; + int tg = 0; + + if (smg_check_all_busy()) { + socket_printf(woomera->socket, + "405 SMG Server All Ckt Busy!%s", WOOMERA_RECORD_SEPERATOR); + log_printf(3, woomera->log, "SMG Server Full %d (ckt busy cnt=%i)\n", + server.call_count, server.all_ckt_busy); + return -1; + } + + log_printf(2, woomera->log, "New Call %d/%d\n", server.call_count, server.max_calls); + + if ((p = strchr(called, '/'))) { + *p = '\0'; + called = p+1; + tg = atoi(grp+1) - 1; + if (tg < 0) { + tg=0; + } + } + + woomera->trunk_group=tg; + + if (raw) { + woomera_set_raw(woomera, raw); + } + + woomera->index = add_to_holding_tank(woomera); + if (woomera->index < 1) { + socket_printf(woomera->socket, + "405 SMG Server All Tanks Busy!%s", + WOOMERA_RECORD_SEPERATOR); + log_printf(0, woomera->log, "Error: Call Tank Full (Call Cnt=%i)\n", + server.call_count); + return -1; + } + + + woomera->index_hold = woomera->index; + + call_signal_call_init(&event, calling, called, woomera->index); + + if (presentation) { + event.calling_number_presentation = atoi(presentation); + } else { + event.calling_number_presentation = 0; + } + + if (screening) { + event.calling_number_screening_ind = atoi(screening); + } else { + event.calling_number_screening_ind = 0; + } + + if (rdnis && strlen(rdnis)) { + strncpy((char*)event.redirection_string,rdnis, + sizeof(event.redirection_string)-1); + log_printf(0,server.log,"RDNIS %s\n", rdnis); + + } + +#ifdef SMG_CALLING_NAME + if (calling_name) { + strncpy((char*)event.calling_name,calling_name, + sizeof(event.calling_name)-1); + } +#endif + + event.trunk_group = tg; + + + if (call_signal_connection_write(&server.mcon, &event) <= 0) { + log_printf(0, server.log, + "Critical System Error: Failed to tx on ISUP socket [%s]: %s\n", + strerror(errno)); + socket_printf(woomera->socket, + "405 SMG Signalling Contestion!%s", + WOOMERA_RECORD_SEPERATOR); + return -1; + } + + socket_printf(woomera->socket, "100 Trying%s", WOOMERA_RECORD_SEPERATOR); + + log_printf(2, server.log, "Call Called Event [Setup ID: %d] TG=%d\n", + woomera->index,tg); + + return 0; +} + + +static void interpret_command(struct woomera_interface *woomera, struct woomera_message *wmsg) +{ + int answer = 0, media = 0, accept=0; + char *unique_id; + int cause=0; + + + if (!strcasecmp(wmsg->command, "call")) { + int err; + if (strlen(woomera->session) != 0) { + /* Call has already been placed */ + socket_printf(woomera->socket, "400 Error Call already in progress %s", + WOOMERA_RECORD_SEPERATOR); + log_printf(0,server.log,"Woomera RX Call Even while call in progress!\n"); + return; + } + + err=handle_woomera_call_start(woomera,wmsg); + if (err) { + woomera_set_flag(woomera, WFLAG_HANGUP); + } + return; + + } else if (!strcasecmp(wmsg->command, "bye") || !strcasecmp(wmsg->command, "quit")) { + char *cause = woomera_message_header(wmsg, "cause"); + char *q931cause = woomera_message_header(wmsg, "Q931-Cause-Code"); + + if (cause) { + log_printf(3, woomera->log, "Bye Cause Received: [%s]\n", cause); + } + if (q931cause && atoi(q931cause)) { + woomera_set_cause_tosig(woomera,atoi(q931cause)); + } + + log_printf(2, woomera->log, "WOOMERA CMD: Bye Received: [%s]\n", woomera->interface); + + woomera_clear_flag(woomera, WFLAG_RUNNING); + socket_printf(woomera->socket, "200 Connection closed%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + return; + + } else if (!strcasecmp(wmsg->command, "listen")) { + + if (woomera_test_flag(woomera, WFLAG_LISTENING)) { + socket_printf(woomera->socket, "405 Listener already started%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + } else { + char *event_string; + + woomera_set_flag(woomera, WFLAG_LISTENING); + add_listener(woomera); + + if (!strcmp(wmsg->callid,"MASTER")) { + woomera_set_flag(woomera, WFLAG_MASTER_DEV); + log_printf(0,woomera->log, "Starting MASTER Listen Device!\n"); + master_reset=0; + } + + + socket_printf(woomera->socket, "%s", + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "200 Listener enabled%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + if ((event_string = dequeue_event(&server.master_connection))) { + socket_printf(woomera->socket, "%s", event_string); + free(event_string); + event_string = NULL; + } + } + return; + + } else if ((media = !strcasecmp(wmsg->command, "debug"))) { + + int debug_level=atoi(wmsg->callid); + + if (debug_level < 10) { + server.debug=debug_level; + log_printf(0,server.log,"SMG Debugging set to %i (window=%i)\n",server.debug,server.mcon.txwindow); + } + + return; + } + + unique_id = woomera_message_header(wmsg, "Unique-Call-Id"); + if (!unique_id) { + + cause=111; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, "400 Woomera cmd without uniquie id%s" + WOOMERA_RECORD_SEPERATOR); + + log_printf(2,server.log,"Woomera RX Event (%s) without unique id!\n",wmsg->command); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + if (strlen(woomera->session) == 0) { + struct woomera_interface *session_woomera=NULL; + char *session=NULL; + int span, chan; + char ifname[100]; + /* If session does not exist this is an incoming call */ + sscanf(unique_id, "w%dg%d", &span, &chan); + span--; + chan--; + + log_printf(3, woomera->log, + "WOOMERA Got CMD %s Span=%d Chan=%d from session %s\n", + wmsg->command,span,chan,unique_id); + + if (smg_validate_span_chan(span,chan) != 0) { + + cause=34; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, "404 Invalid span/chan in session%s" + WOOMERA_RECORD_SEPERATOR); + + log_printf(2, woomera->log, + "WOOMERA Warning invalid span chan in session %s %s\n", + wmsg->command,unique_id); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + pthread_mutex_lock(&server.process_lock); + session = server.process_table[span][chan].session; + session_woomera = server.process_table[span][chan].dev; + + if (session_woomera) { + pthread_mutex_unlock(&server.process_lock); + + cause=34; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + socket_printf(woomera->socket, "404 Session not found%s" + WOOMERA_RECORD_SEPERATOR); + + + log_printf(0, woomera->log, "WOOMERA Error channel in use %s %s\n", + wmsg->command,unique_id); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + if (!session || strlen(session) == 0 || + strncmp(session,unique_id,sizeof(woomera->session))){ + pthread_mutex_unlock(&server.process_lock); + + cause=34; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "404 Invalid/Expired Session%s" + WOOMERA_RECORD_SEPERATOR); + + log_printf(3, woomera->log, + "WOOMERA Warning: Cmd=%s with invalid session %s (orig=%s)\n", + wmsg->command,unique_id,session?session:"N/A"); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + server.process_table[span][chan].dev=woomera; + strncpy(woomera->session,unique_id,sizeof(woomera->session)); + sprintf(ifname,"w%dg%d",span+1,chan+1); + woomera_set_interface(woomera, ifname); + + woomera->span=span; + woomera->chan=chan; + + pthread_mutex_unlock(&server.process_lock); + + + log_printf(3, woomera->log, "WOOMERA Got New If=%s Session %s\n", + woomera->interface, woomera->session); + + + } else if (strncmp(woomera->session,unique_id,sizeof(woomera->session))) { + + cause=34; + socket_printf(woomera->socket, "EVENT HANGUP %s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(cause), + WOOMERA_LINE_SEPERATOR, + cause, + WOOMERA_RECORD_SEPERATOR); + + socket_printf(woomera->socket, "404 Session Mis-match%s" + WOOMERA_RECORD_SEPERATOR); + woomera_set_flag(woomera, WFLAG_HANGUP); + return; + } + + + if (!strcasecmp(wmsg->command, "dtmf")) { + + log_printf(3, woomera->log, "WOOMERA CMD: DTMF Received: [%s] Digit %s Body %s\n", + woomera->interface, wmsg->command_args, wmsg->body); + +#ifdef SMG_DTMF_ENABLE + wanpipe_send_dtmf(woomera,wmsg->body); +#endif + socket_printf(woomera->socket, "200 DTMF OK%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + + } else if (!strcasecmp(wmsg->command, "hangup")) { + + int chan = -1, span = -1; + char *cause = woomera_message_header(wmsg, "cause"); + char *q931cause = woomera_message_header(wmsg, "Q931-Cause-Code"); + + + if (q931cause && atoi(q931cause)) { + woomera_set_cause_tosig(woomera,atoi(q931cause)); + } + + span=woomera->span; + chan=woomera->chan; + + log_printf(3, woomera->log, "WOOMERA CMD: Hangup Received: [%s] MEDIA EXIST Cause=%s\n", + woomera->interface,cause); + + if (smg_validate_span_chan(span,chan) != 0) { + + socket_printf(woomera->socket, "405 No Such Channel%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + return; + } + + + log_printf(2, woomera->log, "Hangup Received: [w%dg%d]\n", + span+1,chan+1); + + + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + + socket_printf(woomera->socket, "200 HANGUP OK%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + + } else if (!strcasecmp(wmsg->command, "proceed")) { + + log_printf(3, woomera->log, "WOOMERA CMD: %s [%s]\n", + wmsg->command, woomera->interface); + + socket_printf(woomera->socket, + "200 %s PROCEED OK%s" + "Unique-Call-Id: %s%s", + wmsg->callid, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + } else if ((media = !strcasecmp(wmsg->command, "media")) || + (answer = !strcasecmp(wmsg->command, "answer")) || + (accept = !strcasecmp(wmsg->command, "accept"))) { + + handle_woomera_media_accept_answer(woomera, wmsg, media,answer,accept); + + + + } else { + log_printf(0, server.log,"WOOMERA INVALID EVENT: %s [%s] \n", + wmsg->command,wmsg->callid); + socket_printf(woomera->socket, "501 Command '%s' not implemented%s", + wmsg->command, WOOMERA_RECORD_SEPERATOR); + } +} + + +/* + EVENT INCOMING 1 + Remote-Address: 10.3.3.104 + Remote-Number: + Remote-Name: Anthony Minessale!8668630501 + Protocol: H.323 + User-Agent: Post Increment Woomera 1.0alpha1 (OpenH323 v1.17.2) 9/61 + H323-Call-Id: 887b1ff8-bb1f-da11-85c0-0007e98988c4 + Local-Number: 996 + Start-Time: Fri, 09 Sep 2005 12:25:14 -0400 + Local-Name: root +*/ + + +static void handle_call_answer(call_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + int kill = 0; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + pthread_mutex_unlock(&server.process_lock); + + if (woomera && woomera->raw) { + char callid[80]; + struct woomera_event wevent; + + if (woomera_test_flag(woomera, WFLAG_ANSWER)) { + log_printf(1, server.log, "Refusing to double-answer a call!\n"); + return; + } + + woomera_set_flag(woomera, WFLAG_ANSWER); + + if (woomera->span != event->span || woomera->chan != event->chan) { + log_printf(1, server.log, "Refusing to start media on a different channel from the one we agreed on.!\n"); + kill++; + return; + } + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(1, server.log, "Refusing to answer a dead call!\n"); + kill++; + } else { + int err; + err=0; + sprintf(callid, "w%dg%d", event->span + 1, event->chan + 1); + woomera_set_interface(woomera, callid); +#ifndef WOOMERA_EARLY_MEDIA + err=launch_media_thread(woomera); + if (err) { + log_printf(0, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); +#if 0 + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); +#endif + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Q931-Cause-Code: %d%s" + "Cause: %s%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + + + woomera_set_flag(woomera, + (WFLAG_HANGUP|WFLAG_MEDIA_END)); + woomera_clear_flag(woomera, WFLAG_RUNNING); + kill++; + } +#endif + + if (!kill) { + new_woomera_event_printf(&wevent, "EVENT CONNECT w%dg%d%s" + "Unique-Call-Id: %s%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + } + } + } else { + log_printf(1, server.log, "Answer requested on non-existant session. [w%dg%d]\n", + event->span+1, event->chan+1); + kill++; + } + +#if 0 + if (kill) { + call_signal_event_t oevent; + + if (woomera) { + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + /* Do not hangup if this call was already hungup */ + return; + } + + woomera_set_flag(woomera, WFLAG_HANGUP); + } + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + SIGBOOST_RELEASE_CAUSE_NORMAL); + + log_printf(2, server.log, "Sent Refusal SIGBOOST_EVENT_CALL_STOPPED [w%dg%d]\n", + event->span+1, event->chan+1); + } +#endif + +} + +static void handle_call_start_ack(call_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + struct woomera_event wevent; + int kill = 0; + + if ((woomera = peek_from_holding_tank(event->call_setup_id))) { + char callid[80]; + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(1, server.log, "Refusing to ack a dead call!\n"); + kill++; + } else { + int err, span, chan; + + pull_from_holding_tank(event->call_setup_id,event->span,event->chan); + sprintf(callid, "w%dg%d", event->span + 1, event->chan + 1); + + span = event->span; + chan = event->chan; + + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + woomera_set_interface(woomera, callid); + + pthread_mutex_lock(&server.process_lock); + server.process_table[span][chan].dev = woomera; + sprintf(woomera->session,"%s-%i-%i",callid,rand(),rand()); + sprintf(server.process_table[span][chan].session,"%s-%s", + callid,woomera->session); + pthread_mutex_unlock(&server.process_lock); + + + +#ifdef WOOMERA_EARLY_MEDIA + err=launch_media_thread(woomera); + if (err) { + log_printf(0, server.log,"ERROR: Failed to Launch Call [%s]\n", + woomera->interface); + + +#if 0 + new_woomera_event_printf(&wevent, "501 call was cancelled!%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); +#endif + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id:%s%s" + "Q931-Cause-Code: %d%s" + "Cause: %s%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + 21, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(21), + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + woomera_set_flag(woomera,WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + kill++; + } +#endif + if (!kill) { + new_woomera_event_printf(&wevent, "201 Accepted%s" + "Unique-Call-Id: %s%s", + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + new_woomera_event_printf(&wevent, "EVENT PROCEED w%dg%d%s" + "Channel-Name: g%d/%d%s" + "Unique-Call-Id: %s%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->trunk_group+1, + (event->span*31)+event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_RECORD_SEPERATOR + ); + + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + log_printf(2, server.log, "Call Answered Event ID = %d Device = w%dg%d!\n", + event->call_setup_id,woomera->span+1,woomera->chan+1); + } + } + } else { + log_printf(1, server.log, + "Event (START ACK) %d referrs to a non-existant session (%d) [w%dg%d]!\n", + event->event_id, event->call_setup_id,event->span+1, event->chan+1); + kill++; + } + +#if 0 + if (kill) { + call_signal_event_t oevent; + + if (woomera) { + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + /* Do not hangup if this call was already hungup */ + return; + } + + woomera_set_flag(woomera, WFLAG_HANGUP); + } + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + SIGBOOST_RELEASE_CAUSE_NORMAL); + + log_printf(2, server.log, "Sent Refusal SIGBOOST_EVENT_CALL_STOPPED [w%dg%d]\n", + event->span+1, event->chan+1); + } +#endif + +} + +static void handle_call_start_nack(call_signal_event_t *event) +{ + struct woomera_interface *woomera = NULL; + int span=-1, chan=-1; + int ack=0; + + /* Always ACK the incoming NACK + * Send out the NACK ACK before pulling the TANK, because + * if we send after the pull, the outgoing call could send + * a message to boost with the pulled TANK value before + * we send a NACK ACK */ + + if (smg_validate_span_chan(event->span,event->chan) == 0) { + span=event->span; + chan=event->chan; + } + + if (event->call_setup_id > 0) { + woomera=peek_from_holding_tank(event->call_setup_id); + } + + if (woomera) { + + struct woomera_event wevent; + + woomera_clear_flag(woomera, WFLAG_HANGUP_NACK_ACK); + + /* Only pull the index if we have not sent a NACK. + If NACK was already sent out we must wait for ACK + from the other side */ + if (!woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK)) { + pull_from_holding_tank(event->call_setup_id,-1,-1); + } + + isup_exec_command(0, + 0, + event->call_setup_id, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + 0); + + if (woomera_test_flag(woomera, WFLAG_HANGUP)) { + log_printf(0, server.log, "Event CALL START NACK on hungup call [%d]!\n", + event->call_setup_id); + } else { + + woomera_set_cause_topbx(woomera,event->release_cause); + + new_woomera_event_printf(&wevent, "EVENT HANGUP w%dg%d%s" + "Unique-Call-Id: %s%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(woomera->q931_rel_cause_topbx), + WOOMERA_LINE_SEPERATOR, + woomera->q931_rel_cause_topbx, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + + woomera_set_flag(woomera, WFLAG_HANGUP); + woomera_clear_flag(woomera, WFLAG_RUNNING); + + } + + /* We already did the NACK */ + ack=0; + + } else if (event->call_setup_id == 0 && + smg_validate_span_chan(event->span,event->chan) == 0) { + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + + if (woomera && + !woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK) && + !woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + /* Only if we are not already waiting for hangup */ + server.process_table[event->span][event->chan].dev=NULL; + } + + memset(server.process_table[event->span][event->chan].session, + 0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + + if (woomera) { + + log_printf(2, server.log, "Event START NACK on w%dg%d ptr=%p ms=%p\n", + woomera->span+1,woomera->chan+1,woomera,woomera->ms); + + if (woomera_test_flag(woomera,WFLAG_HANGUP)){ + ack++; + goto handle_call_start_nack_skip; + } + + + woomera_set_cause_topbx(woomera,event->release_cause); + + woomera_set_flag(woomera, + (WFLAG_HANGUP|WFLAG_MEDIA_END|WFLAG_HANGUP_NACK_ACK)); + + /* Nack Ack will be sent by the woomera thread */ + ack=0; + } else { + /* Valid state when we are not in autoacm mode */ + ack++; + log_printf(3, server.log, "Event: NACK no woomera on span chan [w%dg%d]!\n", + event->span+1, event->chan+1); + } + + } else { + log_printf(0, server.log, + "Error: Start Nack Invalid State Should not happen [%d] [w%dg%d]!\n", + event->call_setup_id, event->span+1, event->chan+1); + ack++; + } +handle_call_start_nack_skip: + + if (event->release_cause == SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY) { + log_printf(0, server.log, "WARNING: All ckt busy!\n"); + smg_all_ckt_busy(); + } + +#warning "Ignoring CALL GAP" +#if 0 + if (event->release_cause == SIGBOOST_CALL_SETUP_NACK_AUTO_CALL_GAP) { + log_printf(0, server.log, "WARNING: Call Gapping Detected!\n"); + smg_all_ckt_gap(); + } +#endif + + if (ack) { + span=0; + chan=0; + if (smg_validate_span_chan(event->span,event->chan) == 0) { + span=event->span; + chan=event->chan; + } + isup_exec_command(span, + chan, + event->call_setup_id, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + 0); + + if (!woomera) { + log_printf(2, server.log, "Event (NACK ACK) %d referrs to a non-existant session (%d) [w%dg%d]!\n", + event->event_id,event->call_setup_id, event->span+1, event->chan+1); + } + } +} + +static void handle_call_loop_start(call_signal_event_t *event) +{ + struct woomera_interface *woomera; + char callid[20]; + char *session; + + pthread_mutex_lock(&server.process_lock); + if (server.process_table[event->span][event->chan].dev) { + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + SIGBOOST_RELEASE_CAUSE_BUSY); + + + log_printf(1, server.log, + "Sent (From Handle Loop START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg] ptr=%d\n", + event->span+1, event->chan+1, server.process_table[event->span][event->chan].dev); + + pthread_mutex_unlock(&server.process_lock); + return; + + } + + sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + sprintf(server.process_table[event->span][event->chan].session, + "%s-%i-%i",callid,rand(),rand()); + session=server.process_table[event->span][event->chan].session; + server.process_table[event->span][event->chan].dev = NULL; + pthread_mutex_unlock(&server.process_lock); + + + woomera=launch_woomera_loop_thread(event); + if (woomera == NULL) { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + SIGBOOST_RELEASE_CAUSE_BUSY); + log_printf(1, server.log, + "Sent (From Handle Loop START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg] ptr=%d\n", + event->span+1, event->chan+1, server.process_table[event->span][event->chan].dev); + } + + woomera_set_flag(woomera,WFLAG_CALL_ACKED); + + return; +} + +static void handle_call_start(call_signal_event_t *event) +{ + struct woomera_event wevent; + char callid[20]; + char *session; + + pthread_mutex_lock(&server.process_lock); + if (server.process_table[event->span][event->chan].dev) { + + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + SIGBOOST_RELEASE_CAUSE_BUSY); + + + log_printf(0, server.log, + "Sent (From Handle START) Call Busy SIGBOOST_EVENT_CALL_START_NACK [w%dg%d]\n", + event->span+1, event->chan+1); + + pthread_mutex_unlock(&server.process_lock); + return; + + } + + sprintf(callid, "w%dg%d", event->span+1,event->chan+1); + sprintf(server.process_table[event->span][event->chan].session, + "%s-%i-%i",callid,rand(),rand()); + session=server.process_table[event->span][event->chan].session; + server.process_table[event->span][event->chan].dev = NULL; + pthread_mutex_unlock(&server.process_lock); + + if (autoacm) { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_ACK, + 0); + } + + new_woomera_event_printf(&wevent, "EVENT INCOMING w%dg%d%s" + "Unique-Call-Id: %s%s" + "Remote-Number: %s%s" + "Remote-Name: %s%s" + "Protocol: SS7%s" + "User-Agent: sangoma_mgd%s" + "Local-Number: %s%s" + "Channel-Name: g%d/%d%s" + "Trunk-Group: %d%s" + "Presentation: %d%s" + "Screening: %d%s" + "RDNIS: %s%s" + , + event->span+1, + event->chan+1, + WOOMERA_LINE_SEPERATOR, + session, + WOOMERA_LINE_SEPERATOR, + event->calling_number_digits, + WOOMERA_LINE_SEPERATOR, +#ifdef SMG_CALLING_NAME + event->calling_name, +#else + "", +#endif + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + event->called_number_digits, + WOOMERA_LINE_SEPERATOR, + event->trunk_group+1, + (event->span*31)+event->chan+1, + WOOMERA_LINE_SEPERATOR, + event->trunk_group+1, + WOOMERA_LINE_SEPERATOR, + event->calling_number_presentation, + WOOMERA_LINE_SEPERATOR, + event->calling_number_screening_ind, + WOOMERA_LINE_SEPERATOR, + event->redirection_string, + WOOMERA_RECORD_SEPERATOR + ); + + if (enqueue_event_on_listeners(&wevent)) { + enqueue_event(&server.master_connection, &wevent, EVENT_KEEP_DATA); + } else { + + pthread_mutex_lock(&server.process_lock); + server.process_table[event->span][event->chan].dev = NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (autoacm) { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + SIGBOOST_RELEASE_CAUSE_BUSY); + } else { + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + SIGBOOST_RELEASE_CAUSE_BUSY); + } + + log_printf(0, server.log, + "CALL INCOMING: Enqueue Error Sent SIGBOOST_EVENT_CALL_STOPPED [w%dg%d]\n", + event->span+1, event->chan+1); + } + + destroy_woomera_event_data(&wevent); + +} + +static void handle_gap_abate(call_signal_event_t *event) +{ + log_printf(0, server.log, "NOTICE: GAP Cleared!\n", + event->span+1, event->chan+1); + smg_clear_ckt_gap(); +} + +static void handle_restart_ack(call_signal_connection_t *mcon,call_signal_event_t *event) +{ + mcon->rxseq_reset =0; +} + +static void handle_call_stop(call_signal_event_t *event) +{ + struct woomera_interface *woomera; + int ack=0; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + if (woomera && + !woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK) && + !woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + /* Only if we are not already waiting for hangup */ + server.process_table[event->span][event->chan].dev=NULL; + } + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + + if (woomera_test_flag(woomera,WFLAG_HANGUP)) { + ack++; + goto handle_call_stop_skip; + } + + woomera_set_cause_topbx(woomera,event->release_cause); + + woomera_set_flag(woomera, + (WFLAG_MEDIA_END|WFLAG_HANGUP|WFLAG_HANGUP_ACK)); + + /* We have to close the socket because + At this point we are release span chan */ + +#ifdef MEDIA_SOCK_SHUTDOWN + pthread_mutex_lock(&woomera->ms_lock); + if (woomera->ms) { + log_printf(3, server.log, "Event CALL STOP [w%dg%d] closing sockets\n", + woomera->span+1,woomera->chan+1); + + close_socket(&woomera->ms->sangoma_sock); + close_socket(&woomera->ms->udp_sock); + // shutdown(woomera->ms->sangoma_sock, SHUT_RDWR); + // shutdown(woomera->ms->udp_sock, SHUT_RDWR); + } + pthread_mutex_unlock(&woomera->ms_lock); +#endif + + log_printf(3, server.log, "Event CALL STOP on w%dg%d ptr=%p ms=%p\n", + woomera->span+1,woomera->chan+1,woomera,woomera->ms); + + } else { + ack++; + } + +handle_call_stop_skip: + + if (ack) { + /* At this point we have already sent our STOP so its safe to ACK */ + isup_exec_command(event->span, + event->chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED_ACK, + 0); + } + + if (!woomera){ + /* This is allowed on incoming call if remote app does not answer it */ + log_printf(3, server.log, "Event CALL STOP referrs to a non-existant session [w%dg%d]!\n", + event->span+1, event->chan+1); + } +} + +static void handle_heartbeat(call_signal_event_t *event) +{ + if (!woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + log_printf(0, server.log,"ERROR! Monitor Thread not running!\n"); + } else { + int err=call_signal_connection_write(&server.mcon, event); + if (err <= 0) { + log_printf(0, server.log, + "Critical System Error: Failed to tx on ISUP socket [%s]: %s\n", + strerror(errno)); + } + } + return; +} + +static void handle_call_stop_ack(call_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + server.process_table[event->span][event->chan].dev=NULL; + memset(server.process_table[event->span][event->chan].session,0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + + if (woomera) { + log_printf(2, server.log, "Stop Ack on [w%dg%d] [Setup ID: %d] [%s]!\n", + event->span+1, event->chan+1, event->call_setup_id, + woomera->interface); + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + + } else { + log_printf(2, server.log, "Event CALL_STOP_ACK(%d) referrs to a non-existant session [w%dg%d] [Setup ID: %d]!\n", + event->event_id, event->span+1, event->chan+1, event->call_setup_id); + } + + /* No need for us to do any thing here */ + return; +} + + +static void handle_call_start_nack_ack(call_signal_event_t *event) +{ + + struct woomera_interface *woomera = NULL; + + if ((woomera=pull_from_holding_tank(event->call_setup_id,-1,-1))) { + + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + + } else if (event->call_setup_id == 0 && + smg_validate_span_chan(event->span,event->chan) == 0) { + + pthread_mutex_lock(&server.process_lock); + woomera = server.process_table[event->span][event->chan].dev; + server.process_table[event->span][event->chan].dev=NULL; + memset(server.process_table[event->span][event->chan].session, + 0,SMG_SESSION_NAME_SZ); + pthread_mutex_unlock(&server.process_lock); + + if (woomera) { + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + } else { + log_printf(0, server.log, + "Event NACK ACK [w%dg%d] with valid span/chan no dev!\n", + event->span+1, event->chan+1); + } + + } else { + log_printf(2, server.log, + "Event NACK ACK referrs to a non-existant session [w%dg%d] [Setup ID: %d]!\n", + event->span+1, event->chan+1, event->call_setup_id); + } + + if (event->call_setup_id > 0) { + clear_from_holding_tank(event->call_setup_id, NULL); + } + + /* No need for us to do any thing here */ + return; +} + +#if 0 +static void validate_number(unsigned char *s) +{ + unsigned char *p; + for (p = s; *p; p++) { + if (*p < 48 || *p > 57) { + log_printf(2, server.log, "Encountered a non-numeric character [%c]!\n", *p); + *p = '\0'; + break; + } + } +} +#endif + +static int parse_ss7_event(call_signal_connection_t *mcon, call_signal_event_t *event) +{ + int ret = 0; + +#if 0 + validate_number((unsigned char*)event->called_number_digits); + validate_number((unsigned char*)event->calling_number_digits); +#endif + +#if 1 + log_printf(2, server.log, + "RX EVENT: %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i Cd=[%s] Ci=[%s]\n", + call_signal_event_id_name(event->event_id), + event->event_id, + event->span+1, + event->chan+1, + event->release_cause, + event->call_setup_id, + event->fseqno, + (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"), + (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A") + ); +#endif + +#if 0 + log_printf(2, server.log, "RX EVENT\n"); + log_printf(2, server.log, "===================================\n"); + log_printf(2, server.log, " rType: %s (%0x HEX)\n", + call_signal_event_id_name(event->event_id),event->event_id); + log_printf(2, server.log, " rSpan: [%d]\n",event->span+1); + log_printf(2, server.log, " rChan: [%d]\n",event->chan+1); + log_printf(2, server.log, " rCalledNum: %s\n", + (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A")); + log_printf(2, server.log, " rCallingNum: %s\n", + (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A")); + log_printf(2, server.log, " rCause: %d\n",event->release_cause); + log_printf(2, server.log, " rInterface: [w%dg%d]\n",event->span+1,event->chan+1); + log_printf(2, server.log, " rEvent ID: [%d]\n",event->event_id); + log_printf(2, server.log, " rSetup ID: [%d]\n",event->call_setup_id); + log_printf(2, server.log, " rSeq: [%d]\n",event->fseqno); + log_printf(2, server.log, "===================================\n"); + +#endif + +#if 0 + log_printf(2, server.log, + "\nRX EVENT\n" + "===================================\n" + " rType: %s (%0x HEX)\n" + " rSpan: [%d]\n" + " rChan: [%d]\n" + " rCalledNum: %s\n" + " rCallingNum: %s\n" + " rCause: %s\n" + " rInterface : [w%dg%d]\n" + " rEvent ID : [%d]\n" + " rSetup ID: [%d]\n" + " rSeq: [%d]\n" + "===================================\n" + "\n", + call_signal_event_id_name(event->event_id), + event->event_id, + event->span+1, + event->chan+1, + (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"), + (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A"), + release_to_string(event->release_cause), + event->span+1, + event->chan+1, + event->event_id, + event->call_setup_id, + event->fseqno + ); +#endif + + + switch(event->event_id) { + + case SIGBOOST_EVENT_CALL_START: + handle_call_start(event); + break; + case SIGBOOST_EVENT_CALL_STOPPED: + handle_call_stop(event); + break; + case SIGBOOST_EVENT_CALL_START_ACK: + handle_call_start_ack(event); + break; + case SIGBOOST_EVENT_CALL_START_NACK: + handle_call_start_nack(event); + break; + case SIGBOOST_EVENT_CALL_ANSWERED: + handle_call_answer(event); + break; + case SIGBOOST_EVENT_HEARTBEAT: + handle_heartbeat(event); + break; + case SIGBOOST_EVENT_CALL_START_NACK_ACK: + handle_call_start_nack_ack(event); + break; + case SIGBOOST_EVENT_CALL_STOPPED_ACK: + handle_call_stop_ack(event); + break; + case SIGBOOST_EVENT_INSERT_CHECK_LOOP: + handle_call_loop_start(event); + break; + case SIGBOOST_EVENT_REMOVE_CHECK_LOOP: + handle_call_stop(event); + break; + case SIGBOOST_EVENT_SYSTEM_RESTART_ACK: + handle_restart_ack(mcon,event); + break; + case SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE: + handle_gap_abate(event); + break; + default: + log_printf(0, server.log, "Warning no handler implemented for [%s]\n", + call_signal_event_id_name(event->event_id)); + break; + } + + return ret; +} + + +static void *monitor_thread_run(void *obj) +{ + int ss = 0; + int policy=0,priority=0; + char a=0,b=0; + call_signal_connection_t *mcon=&server.mcon; + call_signal_connection_t *mconp=&server.mconp; + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count++; + pthread_mutex_unlock(&server.thread_count_lock); + + woomera_set_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + + if (call_signal_connection_open(mcon, + mcon->cfg.local_ip, + mcon->cfg.local_port, + mcon->cfg.remote_ip, + mcon->cfg.remote_port) < 0) { + log_printf(0, server.log, "Error: Opening MCON Socket [%d] %s\n", + mcon->socket,strerror(errno)); + exit(-1); + } + + if (call_signal_connection_open(mconp, + mconp->cfg.local_ip, + mconp->cfg.local_port, + mconp->cfg.remote_ip, + mconp->cfg.remote_port) < 0) { + log_printf(0, server.log, "Error: Opening MCONP Socket [%d] %s\n", + mconp->socket,strerror(errno)); + exit(-1); + } + + mcon->log = server.log; + mconp->log = server.log; + + isup_exec_command(0, + 0, + -1, + SIGBOOST_EVENT_SYSTEM_RESTART, + 0); + + mcon->rxseq_reset=1; + + smg_get_current_priority(&policy,&priority); + + log_printf(1, server.log, "Open udp socket [%d] [%d]\n", + mcon->socket,mconp->socket); + log_printf(1, server.log, "Monitor Thread Started (%i:%i)\n",policy,priority); + + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { +#if 0 + ss = waitfor_socket(server.mcon.socket, 1000, POLLERR | POLLIN); +#else + ss = waitfor_2sockets(mcon->socket, + mconp->socket, + &a, &b, 1000); +#endif + + if (ss > 0) { + + call_signal_event_t *event=NULL; + int i=0; + + if (b) { +mcon_retry_priority: + if ((event = call_signal_connection_readp(mconp,i))) { + struct timeval current; + struct timeval difftime; + gettimeofday(¤t,NULL); + timersub (¤t, &event->tv, &difftime); + log_printf(3, server.log, "Socket Event P [%s] T=%d:%d\n", + call_signal_event_id_name(event->event_id), + difftime.tv_sec, difftime.tv_usec); + parse_ss7_event(mconp,event); + if (++i < 10) { + goto mcon_retry_priority; + } + + } else if (errno != EAGAIN) { + ss=-1; + log_printf(0, server.log, + "Error: Reading from Boost P Socket! (%i) %s\n", + errno,strerror(errno)); + break; + } + } + + i=0; + + if (a) { +mcon_retry: + if ((event = call_signal_connection_read(mcon,i))) { + struct timeval current; + struct timeval difftime; + gettimeofday(¤t,NULL); + timersub (¤t, &event->tv, &difftime); + log_printf(3, server.log, "Socket Event [%s] T=%d:%d\n", + call_signal_event_id_name(event->event_id), + difftime.tv_sec, difftime.tv_usec); + parse_ss7_event(mcon,event); + + if (++i < 50) { + goto mcon_retry; + } + } else if (errno != EAGAIN) { + ss=-1; + log_printf(0, server.log, + "Error: Reading from Boost Socket! (%i) %s\n", + errno,strerror(errno)); + break; + } + } + + } + + if (ss < 0){ + log_printf(0, server.log, "Thread Run: Select Socket Error!\n"); + break; + } + + } + + log_printf(1, server.log, "Close udp socket [%d] [%d]\n", + mcon->socket,mconp->socket); + call_signal_connection_close(&server.mcon); + call_signal_connection_close(&server.mconp); + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count--; + pthread_mutex_unlock(&server.thread_count_lock); + + woomera_clear_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + log_printf(0, server.log, "Monitor Thread Ended\n"); + + return NULL; +} + +static void woomera_loop_thread_run(struct woomera_interface *woomera) +{ + int err=launch_media_thread(woomera); + if (err) { + log_printf(0, server.log, "Failed to start loop media thread\n"); + woomera_set_flag(woomera, + (WFLAG_HANGUP|WFLAG_MEDIA_END)); + woomera_clear_flag(woomera, WFLAG_RUNNING); + return; + } + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + !woomera_test_flag(woomera, WFLAG_HANGUP)) { + + sleep(1); + continue; + + } + + woomera_clear_flag(woomera, WFLAG_RUNNING); + + log_printf(2, server.log, "Woomera Session: For Loop Test exiting %s\n",woomera->interface); + + + + return; +} + +static void *woomera_thread_run(void *obj) +{ + struct woomera_interface *woomera = obj; + struct woomera_message wmsg; + struct woomera_event wevent; + char *event_string; + int mwi; + int err; + int policy=0, priority=0; + int span = -1, chan = -1; + + woomera_message_init(&wmsg); + + //smg_get_current_priority(&policy,&priority); + + log_printf(2, server.log, "WOOMERA session for started (ptr=%p : loop=%i)(%i:%i)\n", + woomera,woomera->loop_tdm,policy,priority); + + pthread_mutex_lock(&server.thread_count_lock); + server.thread_count++; + pthread_mutex_unlock(&server.thread_count_lock); + + pthread_mutex_init(&woomera->queue_lock, NULL); + pthread_mutex_init(&woomera->ms_lock, NULL); + pthread_mutex_init(&woomera->dtmf_lock, NULL); + pthread_mutex_init(&woomera->vlock, NULL); + pthread_mutex_init(&woomera->flags_lock, NULL); + + if (woomera->loop_tdm) { + woomera_loop_thread_run(woomera); + goto woomera_session_close; + } + + err=socket_printf(woomera->socket, + "EVENT HELLO Sangoma Media Gateway%s" + "Supported-Protocols: TDM%s" + "Version: %s%s" + "Remote-Address: %s%s" + "Remote-Port: %d%s" + "Raw-Format: %s%s", + WOOMERA_LINE_SEPERATOR, + WOOMERA_LINE_SEPERATOR, + SMG_VERSION, WOOMERA_LINE_SEPERATOR, + inet_ntoa(woomera->addr.sin_addr), WOOMERA_LINE_SEPERATOR, + ntohs(woomera->addr.sin_port), WOOMERA_LINE_SEPERATOR, + server.hw_coding?"ALAW":"ULAW", WOOMERA_RECORD_SEPERATOR + ); + + if (err) { + log_printf(0, server.log, "Woomera session socket failure! (ptr=%p)\n", + woomera); + woomera_clear_flag(woomera, WFLAG_RUNNING); + goto woomera_session_close; + } + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING) && + woomera_test_flag(woomera, WFLAG_RUNNING) && + !woomera_test_flag(woomera, WFLAG_MEDIA_END) && + !woomera_test_flag(woomera, WFLAG_HANGUP) && + !master_reset) { + + + mwi = woomera_message_parse(woomera, &wmsg, WOOMERA_HARD_TIMEOUT); + if (mwi >= 0) { + + if (mwi) { + interpret_command(woomera, &wmsg); + } else if (woomera_test_flag(woomera, WFLAG_EVENT)){ + while ((event_string = dequeue_event(woomera))) { + if (socket_printf(woomera->socket, "%s", event_string)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + woomera_clear_flag(woomera, WFLAG_RUNNING); + free(event_string); + log_printf(4, server.log, + "WOOMERA session (ptr=%p) print string error\n", + woomera); + break; + } + free(event_string); + } + woomera_clear_flag(woomera, WFLAG_EVENT); + } + + if (woomera->timeout > 0 && time(NULL) >= woomera->timeout) { + + /* Sent the hangup only after we sent a NACK */ + + log_printf(2, server.log, + "WOOMERA session (ptr=%p) Call Timedout ! [%s] (Timeout=%d)\n", + woomera,woomera->interface,woomera->timeout); + + /* Let the Index check below send a NACK */ + if (woomera->index) { + woomera_set_flag(woomera, WFLAG_HANGUP); + } + break; + } + + } else { + log_printf(3, server.log, "WOOMERA session (ptr=%p) [%s] READ MSG Error %i \n", + woomera,woomera->interface,mwi); + break; + } + + } + +woomera_session_close: + + log_printf(2, server.log, "WOOMERA session (ptr=%p) is dying [%s]: SR=%d WR=%d WF=0x%04X\n", + woomera,woomera->interface, + woomera_test_flag(&server.master_connection, WFLAG_RUNNING), + woomera_test_flag(woomera, WFLAG_RUNNING), + woomera->flags); + + + if (woomera_test_flag(woomera, WFLAG_MEDIA_RUNNING)) { + woomera_set_flag(woomera, WFLAG_MEDIA_END); + while(woomera_test_flag(woomera, WFLAG_MEDIA_RUNNING)) { + usleep(100); + sched_yield(); + } + } + + + /*********************************************** + * Identify the SPAN CHAN to be used below + ***********************************************/ + + chan = woomera->chan; + span = woomera->span; + + + if (!woomera_test_flag(woomera, WFLAG_HANGUP)) { + + /* The call was not HUNGUP. This is the last check, + If the call is valid, hungup the call if the call + was never up the keep going */ + woomera_set_flag(woomera, WFLAG_HANGUP); + + if (smg_validate_span_chan(span,chan) == 0) { + + if (!woomera->index) { + + if (autoacm || woomera_test_flag(woomera,WFLAG_CALL_ACKED)) { + + woomera_set_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED, + woomera->q931_rel_cause_tosig); + + + log_printf(3, woomera->log, "Woomera Sent SIGBOOST_EVENT_CALL_STOPPED [w%dg%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + } else { + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK, + woomera->q931_rel_cause_tosig); + + log_printf(3, woomera->log, "Woomera Sent SIGBOOST_EVENT_CALL_START_NACK [w%dg%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + } + } else { + log_printf(0, woomera->log, "Woomera Not Sent CALL STOPPED - Instead NACK [w%dg%d] [%s] ptr=%p\n", + span+1, chan+1,woomera->interface,woomera); + + } + }else{ + /* This can happend if an outgoing call times out + or gets hungup before it gets acked. Its not a + failure */ + if (!woomera->index) { + + /* In this case we really failed to tx STOP */ + log_printf(0, woomera->log, "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + } + + } + +woo_re_hangup: + + + /* We must send a STOP ACK to boost telling it that we are done */ + if (woomera_test_flag(woomera, WFLAG_HANGUP_ACK)) { + + /* SMG received a HANGUP from boost. + We must now send back the ACK to the HANGUP. + Boost will not release channel until we + ACK the hangup */ + + if (smg_validate_span_chan(span,chan) == 0) { + + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_STOPPED_ACK, + woomera->q931_rel_cause_tosig); + + log_printf(3, woomera->log, + "Sent (Ack) to SIGBOOST_EVENT_CALL_STOPPED_ACK [w%dg%d] [%s] ptr=%p\n", + span+1,chan+1,woomera->interface,woomera); + + }else{ + /* This should never happen! If it does + we broke protocol */ + log_printf(0, woomera->log, + "FAILED: Woomera (R) SIGBOOST_EVENT_CALL_STOPPED_ACK [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + + woomera_clear_flag(woomera, WFLAG_HANGUP_ACK); + + } + + if (woomera_test_flag(woomera, WFLAG_HANGUP_NACK_ACK)) { + + /* SMG received a NACK from boost during call startup. + We must now send back the ACK to the NACK. + Boost will not release channel until we + ACK the NACK */ + + if (smg_validate_span_chan(span,chan) == 0) { + + isup_exec_command(span, + chan, + -1, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + woomera->q931_rel_cause_tosig); + + log_printf(3, woomera->log, + "Sent (Nack Ack) to SIGBOOST_EVENT_CALL_START_NACK_ACK [w%dg%d] [%s] ptr=%p\n", + span+1,chan+1,woomera->interface,woomera); + + + } else { + log_printf(0, woomera->log, + "FAILED: Sent (Nack Ack) SIGBOOST_EVENT_CALL_START_NACK_ACK [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + } + + woomera_clear_flag(woomera, WFLAG_HANGUP_NACK_ACK); + + } + + if (woomera->index) { + + int index = woomera->index; + + + new_woomera_event_printf(&wevent, "EVENT HANGUP %s%s" + "Unique-Call-Id: %s%s" + "Timeout: %ld%s" + "Cause: %s%s" + "Q931-Cause-Code: %d%s", + woomera->interface, + WOOMERA_LINE_SEPERATOR, + woomera->session, + WOOMERA_LINE_SEPERATOR, + woomera->timeout, + WOOMERA_LINE_SEPERATOR, + q931_rel_to_str(18), + WOOMERA_LINE_SEPERATOR, + 18, + WOOMERA_RECORD_SEPERATOR + ); + enqueue_event(woomera, &wevent,EVENT_FREE_DATA); + + while ((event_string = dequeue_event(woomera))) { + socket_printf(woomera->socket, "%s", event_string); + free(event_string); + } + + if (peek_from_holding_tank(index)) { + + woomera_set_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + isup_exec_command(0, + 0, + index, + SIGBOOST_EVENT_CALL_START_NACK, + 0); + + log_printf(2, woomera->log, + "Sent SIGBOOST_EVENT_CALL_START_NACK [Setup ID: %d] .. WAITING FOR NACK ACK\n", + index); + } + + } + + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK)) { + int timeout_cnt=0; + int overall_cnt=0; + + /* SMG sent NACK to boost, however we have to wait + for boost to give us the ACK back before we + release resources. */ + + while (woomera_test_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK)) { + timeout_cnt++; + if (timeout_cnt > 4000) { //30sec timeout + timeout_cnt=0; + overall_cnt++; + log_printf(0, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] ... \n", + index); + } + + if (overall_cnt > 10) { //300sec timeotu + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_NACK_ACK); + break; + } + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING)) { + break; + } + + usleep(5000); + sched_yield(); + } + + if (overall_cnt > 10) { + log_printf(0, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] .. TIMEOUT on NACK ACK\n", + index); + + } else { + log_printf(2, woomera->log, + "Waiting for NACK ACK [Setup ID: %d] .. GOT NACK ACK\n", + index); + + } + } + + if (woomera_test_flag(woomera, WFLAG_EVENT)){ + while ((event_string = dequeue_event(woomera))) { + socket_printf(woomera->socket, "%s", event_string); + free(event_string); + } + woomera_clear_flag(woomera, WFLAG_EVENT); + } + + + if (woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + int timeout_cnt=0; + int overall_cnt=0; + + /* SMG sent HANGUP to boost, however we have to wait + for boost to give us the ACK back before we + release resources. */ + + log_printf(2, woomera->log, + "Waiting for STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + + while (woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + timeout_cnt++; + if (timeout_cnt > 4000) { //10sec timeout + timeout_cnt=0; + overall_cnt++; + log_printf(0, woomera->log, + "Waiting for STOPPED ACK [%s] [id=%i] ... \n", + woomera->interface,woomera->index_hold); + } + + if (overall_cnt > 10) { //100sec + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + break; + } + + + if (!woomera_test_flag(&server.master_connection, WFLAG_RUNNING) || + server.process_table[span][chan].dev != woomera) { + woomera_clear_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK); + break; + } + + usleep(5000); + sched_yield(); + } + + if (!woomera_test_flag(woomera, WFLAG_WAIT_FOR_STOPPED_ACK)) { + if (overall_cnt > 10) { + log_printf(0, woomera->log, + "Wait TIMEDOUT on STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + + } else { + log_printf(2, woomera->log, + "Wait GOT STOPPED ACK [%s] [id=%i]... \n", + woomera->interface,woomera->index_hold); + } + } + } + + /***************************************************** + * We must wait for WFLAG_WAIT_FOR_STOPPED_ACK here + * so that STOP_ACK can access the woomera + *****************************************************/ + + if (smg_validate_span_chan(span,chan) == 0) { + log_printf(2, woomera->log, + "WOOMERA Clearing Processs Table ... \n", + woomera->interface); + pthread_mutex_lock(&server.process_lock); + if (server.process_table[span][chan].dev == woomera){ + server.process_table[span][chan].dev = NULL; + memset(server.process_table[span][chan].session,0,SMG_SESSION_NAME_SZ); + } + pthread_mutex_unlock(&server.process_lock); + } + +#if 0 +//Used for testing + if (1) { + int chan = woomera->chan; + int span = woomera->span; + if (smg_validate_span_chan(span,chan) == 0) { + pthread_mutex_lock(&server.process_lock); + /* This is possible in case media thread dies on startup */ + + if (server.process_table[span][chan]){ + log_printf(0, server.log, + "Sanity Span Chan Still in use: [w%dg%d] [%s] Index=%d ptr=%p\n", + span+1, chan+1, woomera->interface, woomera->index, woomera); + //server.process_table[span][chan] = NULL; + } + pthread_mutex_unlock(&server.process_lock); + } + } +#endif + + usleep(3000000); + + /* Sanity Check */ + if (woomera_test_flag(woomera, WFLAG_HANGUP_ACK)) { + log_printf(0, woomera->log, + "Woomera MISSED HANGUP ACK: Retry HANGUP ACK\n"); + goto woo_re_hangup; + } + if (woomera_test_flag(woomera, WFLAG_HANGUP_NACK_ACK)) { + log_printf(0, woomera->log, + "Woomera MISSED HANGUP ACK: Retry HANGUP NACK ACK\n"); + goto woo_re_hangup; + } + + /* This is where we actually pull the index + * out of the tank. We had to keep the tank + * value until the end of the call. Tank is only + * used on outgoing calls. */ + if (woomera->index_hold >= 1) { + clear_from_holding_tank(woomera->index_hold, woomera); + woomera->index_hold=0; + } + + log_printf(2, woomera->log, "Woomera Thread Finished %u\n", (unsigned long) woomera->thread); + close_socket(&woomera->socket); + woomera->socket=-1; + + /* delete queue */ + while ((event_string = dequeue_event(woomera))) { + free(event_string); + } + + if (woomera_test_flag(woomera, WFLAG_LISTENING)) { + del_listener(woomera); + } + + log_printf(2, server.log, "WOOMERA session for [%s] stopped (ptr=%p)\n", + woomera->interface,woomera); + + if (woomera_test_flag(woomera, WFLAG_MASTER_DEV)) { + log_printf(0,server.log,"MASTER Thread Stopped (ptr=%p)\n",woomera); + master_reset=0; + } + + + pthread_mutex_destroy(&woomera->queue_lock); + pthread_mutex_destroy(&woomera->ms_lock); + pthread_mutex_destroy(&woomera->dtmf_lock); + pthread_mutex_destroy(&woomera->vlock); + pthread_mutex_destroy(&woomera->flags_lock); + woomera_set_raw(woomera, NULL); + woomera_set_interface(woomera, NULL); + + woomera_message_clear(&wmsg); + + free(woomera); + pthread_mutex_lock(&server.thread_count_lock); + server.call_count--; + server.thread_count--; + pthread_mutex_unlock(&server.thread_count_lock); + + pthread_exit(NULL); + return NULL; +} + + +static int launch_woomera_thread(struct woomera_interface *woomera) +{ + int result = 0; + pthread_attr_t attr; + + result = pthread_attr_init(&attr); + //pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + //pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + woomera_set_flag(woomera, WFLAG_RUNNING); + result = pthread_create(&woomera->thread, &attr, woomera_thread_run, woomera); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! (%i) %s\n", + __FUNCTION__,result,strerror(errno)); + woomera_clear_flag(woomera, WFLAG_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + +static int launch_monitor_thread(void) +{ + pthread_attr_t attr; + int result = 0; + struct sched_param param; + + param.sched_priority = 10; + result = pthread_attr_init(&attr); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + result = pthread_attr_setschedparam (&attr, ¶m); + + log_printf(0,server.log,"%s: Old Priority =%i res=%i \n",__FUNCTION__, + param.sched_priority,result); + + + woomera_set_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + result = pthread_create(&server.monitor_thread, &attr, monitor_thread_run, NULL); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + woomera_clear_flag(&server.master_connection, WFLAG_MONITOR_RUNNING); + } + pthread_attr_destroy(&attr); + + return result; +} + + +#ifdef WP_HPTDM_API +static void *hp_tdmapi_span_run(void *obj) +{ + hp_tdm_api_span_t *span = obj; + int err; + + log_printf(0,server.log,"Starting %s span!\n",span->ifname); + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + + if (!span->run_span) { + break; + } + + err = span->run_span(span); + if (err) { + break; + } + + } + + if (span->close_span) { + span->close_span(span); + } + + sleep(3); + log_printf(0,server.log,"Stopping %s span!\n",span->ifname); + + pthread_exit(NULL); +} + + +static int launch_hptdm_api_span_thread(int span) +{ + pthread_attr_t attr; + int result = 0; + struct sched_param param; + + param.sched_priority = 5; + result = pthread_attr_init(&attr); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_setschedpolicy(&attr, SCHED_RR); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&attr, MGD_STACK_SIZE); + + result = pthread_attr_setschedparam (&attr, ¶m); + + result = pthread_create(&server.monitor_thread, &attr, hp_tdmapi_span_run, &hptdmspan[span]); + if (result) { + log_printf(0, server.log, "%s: Error: Creating Thread! %s\n", + __FUNCTION__,strerror(errno)); + } + pthread_attr_destroy(&attr); + + return result; +} +#endif + +static int configure_server(void) +{ + struct woomera_config cfg; + char *var, *val; + int cnt = 0; + + server.dtmf_intr_ch = -1; + + if (!woomera_open_file(&cfg, server.config_file)) { + log_printf(0, server.log, "open of %s failed\n", server.config_file); + return 0; + } + + while (woomera_next_pair(&cfg, &var, &val)) { + if (!strcasecmp(var, "boost_local_ip")) { + strncpy(server.mcon.cfg.local_ip, val, + sizeof(server.mcon.cfg.local_ip) -1); + strncpy(server.mconp.cfg.local_ip, val, + sizeof(server.mconp.cfg.local_ip) -1); + cnt++; + } else if (!strcasecmp(var, "boost_local_port")) { + server.mcon.cfg.local_port = atoi(val); + server.mconp.cfg.local_port = + server.mcon.cfg.local_port+1; + cnt++; + } else if (!strcasecmp(var, "boost_remote_ip")) { + strncpy(server.mcon.cfg.remote_ip, val, + sizeof(server.mcon.cfg.remote_ip) -1); + strncpy(server.mconp.cfg.remote_ip, val, + sizeof(server.mconp.cfg.remote_ip) -1); + cnt++; + } else if (!strcasecmp(var, "boost_remote_port")) { + server.mcon.cfg.remote_port = atoi(val); + server.mconp.cfg.remote_port = + server.mcon.cfg.remote_port+1; + cnt++; + } else if (!strcasecmp(var, "logfile_path")) { + if (!server.logfile_path) { + server.logfile_path = strdup(val); + } + } else if (!strcasecmp(var, "woomera_port")) { + server.port = atoi(val); + } else if (!strcasecmp(var, "debug_level")) { + server.debug = atoi(val); + } else if (!strcasecmp(var, "out_tx_test")) { + server.out_tx_test = atoi(val); + } else if (!strcasecmp(var, "loop_trace")) { + server.loop_trace = atoi(val); + } else if (!strcasecmp(var, "rxgain")) { + server.rxgain = atoi(val); + } else if (!strcasecmp(var, "txgain")) { + server.txgain = atoi(val); + } else if (!strcasecmp(var, "dtmf_on_duration")){ + server.dtmf_on = atoi(val); + } else if (!strcasecmp(var, "dtmf_off_duration")){ + server.dtmf_off = atoi(val); + } else if (!strcasecmp(var, "dtmf_inter_ch_duration")){ + server.dtmf_intr_ch = atoi(val); + } else if (!strcasecmp(var, "max_calls")) { + int max = atoi(val); + if (max > 0) { + server.max_calls = max; + } + } else if (!strcasecmp(var, "autoacm")) { + int max = atoi(val); + if (max >= 0) { + autoacm=max; + } + + } else if (!strcasecmp(var, "media_ip")) { + strncpy(server.media_ip, val, sizeof(server.media_ip) -1); + } else { + log_printf(0, server.log, "Invalid Option %s at line %d!\n", var, cfg.lineno); + } + } + + /* Post initialize */ + if (server.dtmf_on == 0){ + server.dtmf_on=SMG_DTMF_ON; + } + if (server.dtmf_off == 0) { + server.dtmf_off=SMG_DTMF_OFF; + } + if (server.dtmf_intr_ch == -1) { + server.dtmf_intr_ch = 0; + } + server.dtmf_size=(server.dtmf_on+server.dtmf_off)*10*2; + + log_printf(0,server.log, "DTMF On=%i Off=%i IntrCh=%i Size=%i\n", + server.dtmf_on,server.dtmf_off,server.dtmf_intr_ch,server.dtmf_size); + + woomera_close_file(&cfg); + return cnt == 4 ? 1 : 0; +} + + + +static int main_thread(void) +{ + + struct sockaddr_in sock_addr, client_addr; + struct woomera_interface *new_woomera; + int client_sock = -1, pid = 0; + unsigned int len = 0; + FILE *tmp; + + if ((server.master_connection.socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { + log_printf(0, server.log, "socket() failed\n"); + return 1; + } + + memset(&sock_addr, 0, sizeof(sock_addr)); /* Zero out structure */ + sock_addr.sin_family = AF_INET; /* Internet address family */ + sock_addr.sin_addr.s_addr = htonl(INADDR_ANY); /* Any incoming interface */ + sock_addr.sin_port = htons(server.port); /* Local port */ + + /* Bind to the local address */ + if (bind(server.master_connection.socket, (struct sockaddr *) &sock_addr, sizeof(sock_addr)) < 0) { + log_printf(0, server.log, "bind(%d) failed\n", server.port); + return 1; + } + + /* Mark the socket so it will listen for incoming connections */ + if (listen(server.master_connection.socket, MAXPENDING) < 0) { + log_printf(0, server.log, "listen() failed\n"); + return 1; + } + + if ((pid = get_pid_from_file(PIDFILE))) { + log_printf(0, stderr, "pid %d already exists.\n", pid); + exit(0); + } + + if (!(tmp = safe_fopen(PIDFILE, "w"))) { + log_printf(0, stderr, "Error creating pidfile %s\n", PIDFILE); + return 1; + } else { + fprintf(tmp, "%d", getpid()); + fclose(tmp); + tmp = NULL; + } + + no_nagle(server.master_connection.socket); + +#if 0 + if (1) { + int span,chan; + call_signal_event_t event; +#if 0 + span=1; + chan=30; + event.span=span; + event.chan=chan; + launch_woomera_loop_thread(&event); +#else + for (span=0;span<8;span++) { + for (chan=0;chan<31;chan++) { + event.span=span; + event.chan=chan; + launch_woomera_loop_thread(&event); + } + } +#endif + } +#endif + +#ifdef WP_HPTDM_API + if (1) { + int span; + for (span=0;span<16;span++) { + hptdmspan[span] = sangoma_hptdm_api_span_init(span); + if (!hptdmspan[span]) { + break; + } else { + log_printf(0, server.log, "HP TDM API Span: %d configured...\n", + span); + launch_hptdm_api_span_thread(span); + } + } + } +#endif + + log_printf(1, server.log, "Main Process Started: Woomera Ready port: %d\n", server.port); + + while (woomera_test_flag(&server.master_connection, WFLAG_RUNNING) && + woomera_test_flag(&server.master_connection, WFLAG_MONITOR_RUNNING)) { + + /* Set the size of the in-out parameter */ + len = sizeof(client_addr); + + /* Wait for a client to connect */ + if ((client_sock = accept(server.master_connection.socket, (struct sockaddr *) &client_addr, &len)) < 0) { + log_printf(0, server.log, "accpet() failed\n"); + return 1; + } + + if ((new_woomera = new_woomera_interface(client_sock, &client_addr, len))) { + log_printf(2, server.log, "Starting Thread for New Connection %s:%d Sock=%d\n", + inet_ntoa(new_woomera->addr.sin_addr), + ntohs(new_woomera->addr.sin_port), + client_sock); + pthread_mutex_lock(&server.thread_count_lock); + server.call_count++; + pthread_mutex_unlock(&server.thread_count_lock); + if (launch_woomera_thread(new_woomera)) { + socket_printf(new_woomera->socket, + "501 call was cancelled!%s", + WOOMERA_RECORD_SEPERATOR); + + close_socket(&new_woomera->socket); + new_woomera->socket=-1; + free(new_woomera); + } + } else { + log_printf(0, server.log, "Critical ERROR: memory/socket error\n"); + } + } + + log_printf(1, server.log, "Main Process End\n"); + + return 0; +} + +static int do_ignore(int sig) +{ + return 0; +} + +static int do_shut(int sig) +{ + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + close_socket(&server.master_connection.socket); + log_printf(1, server.log, "Caught SIG %d, Closing Master Socket!\n", sig); + return 0; +} + +static int sangoma_tdm_init (int span) +{ +#ifdef LIBSANGOMA_GET_HWCODING + wanpipe_tdm_api_t tdm_api; + int fd=sangoma_open_tdmapi_span(span); + if (fd < 0 ){ + return -1; + } else { + server.hw_coding=sangoma_tdm_get_hw_coding(fd,&tdm_api); + close_socket(&fd); + } +#else +#error "libsangoma missing hwcoding feature: not up to date!" +#endif + return 0; +} + + +static int woomera_startup(int argc, char **argv) +{ + int x = 0, pid = 0, bg = 0; + char *cfg=NULL, *debug=NULL, *arg=NULL; + + while((arg = argv[x++])) { + + if (!strcasecmp(arg, "-hup")) { + if (! (pid = get_pid_from_file(PIDFILE))) { + log_printf(0, stderr, "Error reading pidfile %s\n", PIDFILE); + exit(1); + } else { + log_printf(0, stderr, "Killing PID %d\n", pid); + kill(pid, SIGHUP); + sleep(1); + exit(0); + } + + } else if (!strcasecmp(arg, "-term") || !strcasecmp(arg, "--term")) { + if (! (pid = get_pid_from_file(PIDFILE))) { + log_printf(0, stderr, "Error reading pidfile %s\n", PIDFILE); + exit(1); + } else { + log_printf(0, stderr, "Killing PID %d\n", pid); + kill(pid, SIGTERM); + unlink(PIDFILE); + sleep(1); + exit(0); + } + + } else if (!strcasecmp(arg, "-version")) { + fprintf(stdout, "\nSangoma Media Gateway: Version %s\n\n", SMG_VERSION); + exit(0); + + } else if (!strcasecmp(arg, "-help")) { + fprintf(stdout, "%s\n%s [-help] | [ -version] | [-hup] | [-wipe] | [[-bg] | [-debug ] | [-cfg ] | [-log ]]\n\n", WELCOME_TEXT, argv[0]); + exit(0); + } else if (!strcasecmp(arg, "-wipe")) { + unlink(PIDFILE); + } else if (!strcasecmp(arg, "-bg")) { + bg = 1; + + } else if (!strcasecmp(arg, "-g")) { + coredump = 1; + + } else if (!strcasecmp(arg, "-debug")) { + if (argv[x] && *(argv[x]) != '-') { + debug = argv[x++]; + } + } else if (!strcasecmp(arg, "-cfg")) { + if (argv[x] && *(argv[x]) != '-') { + cfg = argv[x++]; + } + } else if (!strcasecmp(arg, "-log")) { + if (argv[x] && *(argv[x]) != '-') { + server.logfile_path = strdup(argv[x++]); + } + } else if (*arg == '-') { + log_printf(0, stderr, "Unknown Option %s\n", arg); + fprintf(stdout, "%s\n%s [-help] | [-hup] | [-wipe] | [[-bg] | [-debug ] | [-cfg ] | [-log ]]\n\n", WELCOME_TEXT, argv[0]); + exit(1); + } + } + + if (1){ + int spn; + for (spn=1;spn<=WOOMERA_MAX_SPAN;spn++) { + if (sangoma_tdm_init(spn) == 0) { + break; + } + } + if (spn>WOOMERA_MAX_SPAN) { + printf("\nError: Failed to access a channel on spans 1-16\n"); + printf(" Please start Wanpipe TDM API drivers\n"); + return 0; + } + } + + if (bg && (pid = fork())) { + log_printf(0, stderr, "Backgrounding!\n"); + return 0; + } + + q931_cause_setup(); + + server.port = 42420; + server.debug = 0; + strcpy(server.media_ip, "127.0.0.1"); + server.next_media_port = WOOMERA_MIN_MEDIA_PORT; + server.log = stdout; + server.master_connection.socket = -1; + server.master_connection.event_queue = NULL; + server.config_file = cfg ? cfg : "/etc/sangoma_mgd.conf"; + pthread_mutex_init(&server.listen_lock, NULL); + pthread_mutex_init(&server.ht_lock, NULL); + pthread_mutex_init(&server.process_lock, NULL); + pthread_mutex_init(&server.media_udp_port_lock, NULL); + pthread_mutex_init(&server.thread_count_lock, NULL); + pthread_mutex_init(&server.master_connection.queue_lock, NULL); + pthread_mutex_init(&server.master_connection.flags_lock, NULL); + pthread_mutex_init(&server.mcon.lock, NULL); + server.master_connection.chan = -1; + server.master_connection.span = -1; + + if (!configure_server()) { + log_printf(0, server.log, "configuration failed!\n"); + return 0; + } + +#ifndef USE_SYSLOG + if (server.logfile_path) { + if (!(server.log = safe_fopen(server.logfile_path, "a"))) { + log_printf(0, stderr, "Error setting logfile %s!\n", server.logfile_path); + server.log = stderr; + return 0; + } + } +#endif + + + if (debug) { + server.debug = atoi(debug); + } + + if (coredump) { + struct rlimit l; + memset(&l, 0, sizeof(l)); + l.rlim_cur = RLIM_INFINITY; + l.rlim_max = RLIM_INFINITY; + if (setrlimit(RLIMIT_CORE, &l)) { + log_printf(0, stderr, "Warning: Failed to disable core size limit: %s\n", + strerror(errno)); + } + } + +#ifdef __LINUX__ + if (geteuid() && coredump) { + if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) < 0) { + log_printf(0, stderr, "Warning: Failed to disable core size limit for non-root: %s\n", + strerror(errno)); + } + } +#endif + + + + (void) signal(SIGINT,(void *) do_shut); + (void) signal(SIGPIPE,(void *) do_ignore); + (void) signal(SIGHUP,(void *) do_shut); + + + woomera_set_flag(&server.master_connection, WFLAG_RUNNING); + if (launch_monitor_thread()) { + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + return 0; + } + + fprintf(stderr, "%s", WELCOME_TEXT); + log_printf(0, stderr, "Woomera STARTUP Complete. [AutoACM=%i]\n",autoacm); + + return 1; +} + +static int woomera_shutdown(void) +{ + char *event_string; + int told = 0, loops = 0; + + close_socket(&server.master_connection.socket); + pthread_mutex_destroy(&server.listen_lock); + pthread_mutex_destroy(&server.ht_lock); + pthread_mutex_destroy(&server.process_lock); + pthread_mutex_destroy(&server.media_udp_port_lock); + pthread_mutex_destroy(&server.thread_count_lock); + pthread_mutex_destroy(&server.master_connection.queue_lock); + pthread_mutex_destroy(&server.master_connection.flags_lock); + pthread_mutex_destroy(&server.mcon.lock); + woomera_clear_flag(&server.master_connection, WFLAG_RUNNING); + + + if (server.logfile_path) { + free(server.logfile_path); + server.logfile_path = NULL; + } + + /* delete queue */ + while ((event_string = dequeue_event(&server.master_connection))) { + free(event_string); + } + + while(server.thread_count > 0) { + loops++; + + if (loops % 1000 == 0) { + told = 0; + } + + if (loops > 10000) { + log_printf(0, server.log, "Red Alert! threads did not stop\n"); + assert(server.thread_count == 0); + } + + if (told != server.thread_count) { + log_printf(1, server.log, "Waiting For %d thread%s.\n", + server.thread_count, server.thread_count == 1 ? "" : "s"); + told = server.thread_count; + } + ysleep(10000); + } + unlink(PIDFILE); + log_printf(0, stderr, "Woomera SHUTDOWN Complete.\n"); + return 0; +} + +int main(int argc, char *argv[]) +{ + int ret = 0; + + mlockall(MCL_FUTURE); + + + server.hw_coding=0; + + openlog (ps_progname ,LOG_PID, LOG_LOCAL2); + + if (! (ret = woomera_startup(argc, argv))) { + exit(0); + } + ret = main_thread(); + + woomera_shutdown(); + + return ret; +} + +/** EMACS ** + * Local variables: + * mode: C + * c-basic-offset: 4 + * End: + */ + diff --git a/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.8.tmp b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.8.tmp new file mode 100644 index 0000000..f54443c --- /dev/null +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.8.tmp @@ -0,0 +1,388 @@ +/***************************************************************************** + * call_signal.c -- Signal Specifics + * + * Author(s): Anthony Minessale II + * Nenad Corbic + * + * Copyright: (c) 2005 Nenad Corbic + * Anthony Minessale II + * + * 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. + * ============================================================================ + */ + +#include + +extern void __log_printf(int level, FILE *fp, char *file, const char *func, int line, char *fmt, ...); +#define clog_printf(level, fp, fmt, ...) __log_printf(level, fp, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__) + + +struct call_signal_map { + uint32_t event_id; + char *name; +}; + +static struct call_signal_map call_signal_table[] = { + {SIGBOOST_EVENT_CALL_START, "CALL_START"}, + {SIGBOOST_EVENT_CALL_START_ACK, "CALL_START_ACK"}, + {SIGBOOST_EVENT_CALL_START_NACK, "CALL_START_NACK"}, + {SIGBOOST_EVENT_CALL_START_NACK_ACK, "CALL_START_NACK_ACK"}, + {SIGBOOST_EVENT_CALL_ANSWERED, "CALL_ANSWERED"}, + {SIGBOOST_EVENT_CALL_STOPPED, "CALL_STOPPED"}, + {SIGBOOST_EVENT_CALL_STOPPED_ACK, "CALL_STOPPED_ACK"}, + {SIGBOOST_EVENT_SYSTEM_RESTART, "SYSTEM_RESTART"}, + {SIGBOOST_EVENT_SYSTEM_RESTART_ACK, "SYSTEM_RESTART_ACK"}, + {SIGBOOST_EVENT_HEARTBEAT, "HEARTBEAT"}, + {SIGBOOST_EVENT_INSERT_CHECK_LOOP, "LOOP START"}, + {SIGBOOST_EVENT_REMOVE_CHECK_LOOP, "LOOP STOP"} +}; + +#define USE_SCTP 1 + +static int create_udp_socket(call_signal_connection_t *mcon, char *local_ip, int local_port, char *ip, int port) +{ + int rc; + struct hostent *result, *local_result; + char buf[512], local_buf[512]; + int err = 0; + + memset(&mcon->remote_hp, 0, sizeof(mcon->remote_hp)); + memset(&mcon->local_hp, 0, sizeof(mcon->local_hp)); +#ifdef USE_SCTP + mcon->socket = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP); +#else + mcon->socket = socket(AF_INET, SOCK_DGRAM, 0); +#endif + + clog_printf(3,mcon->log,"Creating L=%s:%d R=%s:%d\n", + local_ip,local_port,ip,port); + + if (mcon->socket >= 0) { + int flag=1; + gethostbyname_r(ip, &mcon->remote_hp, buf, sizeof(buf), &result, &err); + gethostbyname_r(local_ip, &mcon->local_hp, local_buf, sizeof(local_buf), &local_result, &err); + if (result && local_result) { + mcon->remote_addr.sin_family = mcon->remote_hp.h_addrtype; + memcpy((char *) &mcon->remote_addr.sin_addr.s_addr, mcon->remote_hp.h_addr_list[0], mcon->remote_hp.h_length); + mcon->remote_addr.sin_port = htons(port); + + mcon->local_addr.sin_family = mcon->local_hp.h_addrtype; + memcpy((char *) &mcon->local_addr.sin_addr.s_addr, mcon->local_hp.h_addr_list[0], mcon->local_hp.h_length); + mcon->local_addr.sin_port = htons(local_port); + +#ifdef USE_SCTP + setsockopt(mcon->socket, IPPROTO_SCTP, SCTP_NODELAY, + (char *)&flag, sizeof(int)); +#endif + + if ((rc = bind(mcon->socket, + (struct sockaddr *) &mcon->local_addr, + sizeof(mcon->local_addr))) < 0) { + close(mcon->socket); + mcon->socket = -1; + } else { +#ifdef USE_SCTP + rc=listen(mcon->socket,100); + if (rc) { + close(mcon->socket); + mcon->socket = -1; + } +#endif + } + } + } + + return mcon->socket; +} + +int call_signal_connection_close(call_signal_connection_t *mcon) +{ + close(mcon->socket); + mcon->socket = -1; + memset(mcon, 0, sizeof(*mcon)); + + return 0; +} + +int call_signal_connection_open(call_signal_connection_t *mcon, char *local_ip, int local_port, char *ip, int port) +{ + create_udp_socket(mcon, local_ip, local_port, ip, port); + return mcon->socket; +} + +call_signal_event_t *call_signal_connection_read(call_signal_connection_t *mcon, int iteration) +{ + unsigned int fromlen = sizeof(struct sockaddr_in); +<<<<<<< .mine + //call_signal_event_t *event = &mcon->event; +======= +#if 0 + call_signal_event_t *event = &mcon->event; +>>>>>>> .r53 +#endif + int bytes = 0; + + bytes = recvfrom(mcon->socket, &mcon->event, sizeof(mcon->event), MSG_DONTWAIT, + (struct sockaddr *) &mcon->local_addr, &fromlen); + + if (bytes == sizeof(mcon->event) || + bytes == (sizeof(mcon->event)-sizeof(uint32_t))) { + + if (mcon->rxseq_reset) { + if (mcon->event.event_id == SIGBOOST_EVENT_SYSTEM_RESTART_ACK) { + clog_printf(0,mcon->log,"Rx sync ok\n"); + mcon->rxseq=mcon->event.fseqno; + return &mcon->event; + } + errno=EAGAIN; + clog_printf(0,mcon->log,"Waiting for rx sync...\n"); + return NULL; + } + + mcon->txwindow = mcon->txseq - mcon->event.bseqno; + mcon->rxseq++; + + if (mcon->rxseq != mcon->event.fseqno) { + clog_printf(0, mcon->log, + "------------------------------------------\n"); + clog_printf(0, mcon->log, + "Critical Error: Invalid Sequence Number Expect=%i Rx=%i\n", + mcon->rxseq,mcon->event.fseqno); + clog_printf(0, mcon->log, + "------------------------------------------\n"); + } + +#if 0 +/* Debugging only not to be used in production because span/chan can be invalid */ + if (mcon->event.span < 0 || mcon->event.chan < 0 || mcon->event.span > 16 || mcon->event.chan > 31) { + clog_printf(0, mcon->log, + "------------------------------------------\n"); + clog_printf(0, mcon->log, + "Critical Error: RX Cmd=%s Invalid Span=%i Chan=%i\n", + call_signal_event_id_name(event->event_id), event->span,event->chan); + clog_printf(0, mcon->log, + "------------------------------------------\n"); + + errno=EAGAIN; + return NULL; + } +#endif + + + + + return &mcon->event; + } else { + if (iteration == 0) { + clog_printf(0, mcon->log, + "------------------------------------------\n"); + clog_printf(0, mcon->log, + "Critical Error: Invalid Event lenght from boost rxlen=%i evsz=%i\n", + bytes, sizeof(mcon->event)); + clog_printf(0, mcon->log, + "------------------------------------------\n"); + } + } + + return NULL; +} + +call_signal_event_t *call_signal_connection_readp(call_signal_connection_t *mcon, int iteration) +{ + unsigned int fromlen = sizeof(struct sockaddr_in); +<<<<<<< .mine + //call_signal_event_t *event = &mcon->event; +======= +#if 0 + call_signal_event_t *event = &mcon->event; +>>>>>>> .r53 +#endif + int bytes = 0; + + bytes = recvfrom(mcon->socket, &mcon->event, sizeof(mcon->event), MSG_DONTWAIT, + (struct sockaddr *) &mcon->local_addr, &fromlen); + + if (bytes == sizeof(mcon->event) || + bytes == (sizeof(mcon->event)-sizeof(uint32_t))) { + +#if 0 + /* Debugging only not to be used in production because span/chan can be invalid */ + if (mcon->event.span < 0 || mcon->event.chan < 0 || mcon->event.span > 16 || mcon->event.chan > 31) { + clog_printf(0, mcon->log, + "------------------------------------------\n"); + clog_printf(0, mcon->log, + "Critical Error: RXp Cmd=%s Invalid Span=%i Chan=%i\n", + call_signal_event_id_name(event->event_id), event->span,event->chan); + clog_printf(0, mcon->log, + "------------------------------------------\n"); + + errno=EAGAIN; + return NULL; + } +#endif + + return &mcon->event; + } else { + if (iteration == 0) { + clog_printf(0, mcon->log, + "------------------------------------------\n"); + clog_printf(0, mcon->log, + "Critical Error: PQ Invalid Event lenght from boost rxlen=%i evsz=%i\n", + bytes, sizeof(mcon->event)); + clog_printf(0, mcon->log, + "------------------------------------------\n"); + } + } + + return NULL; +} + + +int call_signal_connection_write(call_signal_connection_t *mcon, call_signal_event_t *event) +{ + int err; + if (!event) { + clog_printf(0, mcon->log, "Critical Error: No Event Device\n"); + return -EINVAL; + } + + if (event->span < 0 || event->chan < 0 || event->span > 16 || event->chan > 31) { + clog_printf(0, mcon->log, + "------------------------------------------\n"); + clog_printf(0, mcon->log, + "Critical Error: TX Cmd=%s Invalid Span=%i Chan=%i\n", + call_signal_event_id_name(event->event_id), event->span,event->chan); + clog_printf(0, mcon->log, + "------------------------------------------\n"); + + return -1; + } + + gettimeofday(&event->tv,NULL); + + pthread_mutex_lock(&mcon->lock); + event->fseqno=mcon->txseq++; + event->bseqno=mcon->rxseq; + err=sendto(mcon->socket, event, sizeof(call_signal_event_t), 0, + (struct sockaddr *) &mcon->remote_addr, sizeof(mcon->remote_addr)); + pthread_mutex_unlock(&mcon->lock); + + if (err != sizeof(call_signal_event_t)) { + err = -1; + } + +#if 0 + clog_printf(2, mcon->log, "TX EVENT\n"); + clog_printf(2, mcon->log, "===================================\n"); + clog_printf(2, mcon->log, " tType: %s (%0x HEX)\n", + call_signal_event_id_name(event->event_id),event->event_id); + clog_printf(2, mcon->log, " tSpan: [%d]\n",event->span+1); + clog_printf(2, mcon->log, " tChan: [%d]\n",event->chan+1); + clog_printf(2, mcon->log, " tCalledNum: %s\n", + (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A")); + clog_printf(2, mcon->log, " tCallingNum: %s\n", + (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A")); + clog_printf(2, mcon->log, " tCause: %d\n",event->release_cause); + clog_printf(2, mcon->log, " tInterface: [w%dg%d]\n",event->span+1,event->chan+1); + clog_printf(2, mcon->log, " tEvent ID: [%d]\n",event->event_id); + clog_printf(2, mcon->log, " tSetup ID: [%d]\n",event->call_setup_id); + clog_printf(2, mcon->log, " tSeq: [%d]\n",event->fseqno); + clog_printf(2, mcon->log, "===================================\n"); +#endif + +#if 1 + clog_printf(2, mcon->log, + "TX EVENT: %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i Cd=[%s] Ci=[%s]\n", + call_signal_event_id_name(event->event_id), + event->event_id, + event->span+1, + event->chan+1, + event->release_cause, + event->call_setup_id, + event->fseqno, + (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"), + (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A") + ); +#endif + + +#if 0 + + clog_printf(2, mcon->log, + "\nTX EVENT\n" + "===================================\n" + " tType: %s (%0x HEX)\n" + " tSpan: [%d]\n" + " tChan: [%d]\n" + " tCalledNum: %s\n" + " tCallingNum: %s\n" + " tCause: %d\n" + " tInterface: [w%dg%d]\n" + " tEvent ID: [%d]\n" + " tSetup ID: [%d]\n" + " tSeq: [%d]\n" + "===================================\n" + "\n", + call_signal_event_id_name(event->event_id), + event->event_id, + event->span+1, + event->chan+1, + (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"), + (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A"), + event->release_cause, + event->span+1, + event->chan+1, + event->event_id, + event->call_setup_id, + event->fseqno + ); +#endif + + + return err; +} + +void call_signal_call_init(call_signal_event_t *event, char *calling, char *called, int setup_id) +{ + memset(event, 0, sizeof(call_signal_event_t)); + event->event_id = SIGBOOST_EVENT_CALL_START; + + if (calling) { + strncpy((char*)event->calling_number_digits, calling, sizeof(event->calling_number_digits)-1); + event->calling_number_digits_count = strlen(calling); + } + + if (called) { + strncpy((char*)event->called_number_digits, called, sizeof(event->called_number_digits)-1); + event->called_number_digits_count = strlen(called); + } + + event->call_setup_id = setup_id; + +} + +void call_signal_event_init(call_signal_event_t *event, call_signal_event_id_t event_id, int chan, int span) +{ + memset(event, 0, sizeof(call_signal_event_t)); + event->event_id = event_id; + event->chan = chan; + event->span = span; +} + +char *call_signal_event_id_name(uint32_t event_id) +{ + int x; + char *ret = NULL; + + for (x = 0 ; x < sizeof(call_signal_table)/sizeof(struct call_signal_map); x++) { + if (call_signal_table[x].event_id == event_id) { + ret = call_signal_table[x].name; + break; + } + } + + return ret; +} diff --git a/ssmg/sangoma_mgd.trunk/sangoma_mgd.orig.c b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.9.tmp similarity index 99% rename from ssmg/sangoma_mgd.trunk/sangoma_mgd.orig.c rename to ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.9.tmp index ff7c8ca..dd1ea32 100644 --- a/ssmg/sangoma_mgd.trunk/sangoma_mgd.orig.c +++ b/ssmg/sangoma_mgd.trunk/.svn/tmp/tempfile.9.tmp @@ -8,6 +8,11 @@ * the GNU General Public License * * ============================================= + * v1.25 Nenad Corbic + * Dec 31 2007 + * Removed UDP Resync it can cause skb_over errors. + * Moved RDNIS message to higher debug level + * * v1.24 Nenad Corbic * Nov 30 2007 * Bug fix on return code on ALL ckt busy @@ -124,7 +129,7 @@ static struct woomera_interface woomera_dead_dev; #endif -#define SMG_VERSION "v1.24" +#define SMG_VERSION "v1.25" /* enable early media */ #if 1 @@ -155,11 +160,11 @@ static int tc = 0; hp_tdm_api_span_t *hptdmspan[WOOMERA_MAX_SPAN]; #endif -#undef SMG_CALLING_NAME +#define SMG_CALLING_NAME 1 const char WELCOME_TEXT[] = "================================================================================\n" -"Sangoma Media Gateway Daemon v1.24 \n" +"Sangoma Media Gateway Daemon v1.25 \n" "TDM Signal Media Gateway for Sangoma/Wanpipe Cards\n" "Copyright 2005, 2006, 2007 \n" "Nenad Corbic , Anthony Minessale II \n" @@ -1526,6 +1531,8 @@ static void *media_thread_run(void *obj) if (packet_len > 0) { +#if 0 +/* NC: This can cause skb_over panic must be retested */ if (packet_len != sangoma_frame_len && ms->udp_sync_cnt <= 5) { /* Assume that we will always receive SLINEAR here */ sangoma_tdm_set_usr_period(ms->sangoma_sock, @@ -1550,7 +1557,7 @@ static void *media_thread_run(void *obj) } } - +#endif if (!server.out_tx_test) { if (woomera_dtmf_transmit(ms,sangoma_frame_len) == 0) { @@ -2473,7 +2480,7 @@ static int handle_woomera_call_start (struct woomera_interface *woomera, if (rdnis && strlen(rdnis)) { strncpy((char*)event.redirection_string,rdnis, sizeof(event.redirection_string)-1); - log_printf(0,server.log,"RDNIS %s\n", rdnis); + log_printf(3,server.log,"RDNIS %s\n", rdnis); } @@ -3217,7 +3224,6 @@ static void handle_call_start_nack(call_signal_event_t *event) ack++; } - if (event->release_cause == SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY) { log_printf(0, server.log, "WARNING: All ckt busy!\n"); smg_all_ckt_busy(); diff --git a/ssmg/sangoma_mgd.trunk/Makefile b/ssmg/sangoma_mgd.trunk/Makefile index fac0dab..3deebd9 100644 --- a/ssmg/sangoma_mgd.trunk/Makefile +++ b/ssmg/sangoma_mgd.trunk/Makefile @@ -89,11 +89,20 @@ install_smg: old_cleanup install -D -m 755 sangoma_mgd.conf.sample $(INSTALLPREFIX)/etc/sangoma_mgd.conf; \ fi ifeq "${NO_SS7}" "YES" - @echo"SS7 control and service script not installed" -else + @echo "BRI control scripts installed" + @if [ ! -e $(INSTALLPREFIX)/etc/sangoma_mgd.conf ]; then \ + install -D -m 755 sangoma_mgd.conf.sample.bri $(INSTALLPREFIX)/etc/sangoma_mgd.conf; \ + fi + install -D -m 755 ../sangoma_bri/smg_ctrl $(INSTALLPREFIX)/usr/sbin/smg_ctrl +else + @echo "SS7 control scripts installed" + @if [ ! -e $(INSTALLPREFIX)/etc/sangoma_mgd.conf ]; then \ + install -D -m 755 sangoma_mgd.conf.sample.ss7 $(INSTALLPREFIX)/etc/sangoma_mgd.conf; \ + fi install -D -m 755 smg_ctrl $(INSTALLPREFIX)/usr/sbin/smg_ctrl install -D -m 755 scripts/init.d/smgss7_init_ctrl $(INSTALLPREFIX)/etc/init.d/smgss7_init_ctrl install -D -m 755 scripts/init.d/smgss7_init_ctrl $(INSTALLPREFIX)/usr/sbin/smgss7_init_ctrl + endif @echo "sangoma_mgd Installed" diff --git a/ssmg/sangoma_mgd.trunk/app/.svn/entries b/ssmg/sangoma_mgd.trunk/app/.svn/entries index 13580ac..a6cd174 100644 --- a/ssmg/sangoma_mgd.trunk/app/.svn/entries +++ b/ssmg/sangoma_mgd.trunk/app/.svn/entries @@ -1,9 +1,9 @@ 8 dir -65 -https://www.sangomapbx.com:/svn/sangoma_mgd/trunk/app -https://www.sangomapbx.com:/svn/sangoma_mgd +66 +https://www.sangomapbx.com/svn/sangoma_mgd/trunk/app +https://www.sangomapbx.com/svn/sangoma_mgd @@ -32,7 +32,7 @@ file -2008-01-11T19:07:46.000000Z +2007-11-30T16:39:49.000000Z 0b2da6b313f90b443457c4815ab95dab 2007-09-21T20:53:51.260136Z 1 @@ -45,7 +45,7 @@ file -2008-01-11T19:07:46.000000Z +2007-11-30T16:39:49.000000Z 604a892b5a763fef18fe92aa29f82bc9 2007-09-21T20:53:51.260136Z 1 diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.pbxdir b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.pbxdir index aa0d569..4d2816d 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.pbxdir +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.pbxdir @@ -1 +1 @@ -/usr/src/ast1.4/asterisk-1.4.11 +/usr/src/asterisk diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/all-wcprops b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/all-wcprops index f569430..2c50032 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/all-wcprops +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/all-wcprops @@ -1,13 +1,13 @@ K 25 svn:wc:ra_dav:version-url V 35 -/svn/chan_woomera/!svn/ver/44/trunk +/svn/chan_woomera/!svn/ver/45/trunk END chan_woomera.c K 25 svn:wc:ra_dav:version-url V 50 -/svn/chan_woomera/!svn/ver/44/trunk/chan_woomera.c +/svn/chan_woomera/!svn/ver/50/trunk/chan_woomera.c END g711.h K 25 @@ -19,19 +19,7 @@ Changelog.chan_woomera K 25 svn:wc:ra_dav:version-url V 58 -/svn/chan_woomera/!svn/ver/43/trunk/Changelog.chan_woomera -END -Makefile -K 25 -svn:wc:ra_dav:version-url -V 44 -/svn/chan_woomera/!svn/ver/29/trunk/Makefile -END -README -K 25 -svn:wc:ra_dav:version-url -V 42 -/svn/chan_woomera/!svn/ver/14/trunk/README +/svn/chan_woomera/!svn/ver/49/trunk/Changelog.chan_woomera END woomera.conf K 25 @@ -39,3 +27,15 @@ svn:wc:ra_dav:version-url V 47 /svn/chan_woomera/!svn/ver/2/trunk/woomera.conf END +README +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/chan_woomera/!svn/ver/14/trunk/README +END +Makefile +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/chan_woomera/!svn/ver/45/trunk/Makefile +END diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/entries b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/entries index 9a92d27..b5faea1 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/entries +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/entries @@ -1,14 +1,14 @@ 8 dir -44 -https://www.sangomapbx.com:/svn/chan_woomera/trunk -https://www.sangomapbx.com:/svn/chan_woomera +45 +https://www.sangomapbx.com/svn/chan_woomera/trunk +https://www.sangomapbx.com/svn/chan_woomera -2008-02-06T23:34:48.342150Z -44 +2008-02-13T18:54:06.884970Z +45 ncorbic @@ -28,14 +28,14 @@ b26a191e-ab3a-0410-a271-b1e04e243bf1 chan_woomera.c file +50 - -2008-02-06T23:42:07.000000Z -addee4a05c90a34d09faf9aa243d3a89 -2008-02-06T23:34:48.342150Z -44 +2008-02-13T21:58:55.000000Z +ba9205aebeac14f550d1ad25c67c6ffa +2008-02-13T21:50:57.705432Z +50 ncorbic g711.h @@ -44,7 +44,7 @@ file -2008-01-11T19:07:46.000000Z +2008-01-24T17:23:02.000000Z 0f725f95ced42af15dcaef21f3a1722b 2007-09-21T20:29:00.887216Z 1 @@ -52,26 +52,26 @@ root Changelog.chan_woomera file +49 - -2008-02-06T23:39:56.000000Z -f97db784fdeb41fcb933c91e083b6256 -2008-02-06T23:32:32.062055Z -43 +2008-02-13T21:01:28.000000Z +1fee9ae858e70d2fd245ecde0cb16425 +2008-02-13T20:52:53.736809Z +49 ncorbic -Makefile +woomera.conf file -2008-01-11T19:07:46.000000Z -39268f5baaa58f6391cba2f506e41f18 -2007-12-18T20:11:15.703141Z -29 +2008-01-24T17:23:02.000000Z +356d6fc18e0670efac6de6001e58648e +2007-09-24T15:52:51.889664Z +2 ncorbic README @@ -80,21 +80,21 @@ file -2008-01-11T19:07:46.000000Z +2008-01-24T17:23:02.000000Z 6b44396eddae33cda9cdb078e5030a1f 2007-10-30T20:04:39.055688Z 14 svnanon -woomera.conf +Makefile file -2008-01-11T19:07:46.000000Z -356d6fc18e0670efac6de6001e58648e -2007-09-24T15:52:51.889664Z -2 +2008-02-13T19:13:00.000000Z +03f330a361fe8308a90ff2aef6b7cd77 +2008-02-13T18:54:06.884970Z +45 ncorbic diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/Changelog.chan_woomera.svn-base b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/Changelog.chan_woomera.svn-base index a79010c..c857d67 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/Changelog.chan_woomera.svn-base +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/Changelog.chan_woomera.svn-base @@ -1,5 +1,16 @@ chan_woomera.c ====================================== + +Feb 13 2008 +* v1.27 David Yat Sin +* Fixed issue channel type not defined when calling tech_call +* + +Feb 13 2008 +* v1.26 Nenad Corbic +* Compilation Update for callweaver 1.2-rc5 +* + Feb 06 2008 * v1.25 Nenad Corbic * Bug fix in woomera message declaration diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/Makefile.svn-base b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/Makefile.svn-base index 3ac561c..3885b53 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/Makefile.svn-base +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/Makefile.svn-base @@ -26,10 +26,14 @@ $(shell echo $(PBXDIR) > .pbxdir) PBXMODDIR=/usr/lib/asterisk/modules PBXCFGDIR=/etc/asterisk + ifneq (,$(wildcard $(PBXDIR)/include/callweaver.h)) PBXFLAGS_EXTRA=-DCALLWEAVER -DHAVE_CONFIG_H PBXMODDIR=/usr/local/lib/callweaver/modules PBXCFGDIR=/usr/local/etc/callweaver + +#Enable this for callweaver 1.2-rc5 +# PBXFLAGS_EXTRA += -DCALLWEAVER_1_2 endif ifneq (,$(wildcard $(PBXDIR)/include/asterisk.h)) @@ -49,6 +53,7 @@ CFLAGS = -D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O6 CCFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes -g LDFLAGS=-L lib/libteletone/.libs -L. -L/usr/local/lib -L ../../ssmg/libsangoma.trunk/.libs -lpthread -lsangoma -lm + PBXFLAGS= $(INCLUDES) -I$(PBXDIR) -I$(PBXDIR)/include -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 -Iinclude -I../include -D_REENTRANT -DWOOMERA_CHAN_NAME=\"$(CHAN_NAME)\" -D_GNU_SOURCE -O6 -fomit-frame-pointer -fPIC diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/chan_woomera.c.svn-base b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/chan_woomera.c.svn-base index e2b5714..572cb63 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/chan_woomera.c.svn-base +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/text-base/chan_woomera.c.svn-base @@ -13,6 +13,16 @@ * This program is free software, distributed under the terms of * the GNU General Public License * ============================================= + * v1.27 David Yat Sin + * Feb 13 2008 + * Fix for ast_channel type not defined on + * outgoing calls, causing PHP agi scripts + * to fail + * + * v1.26 Nenad Corbic + * Feb 13 2008 + * Compilation Update for callweaver 1.2-rc5 + * * v1.25 Nenad Corbic * Feb 06 2008 * Bug fix in woomera message declaration @@ -155,7 +165,7 @@ #include "asterisk/dsp.h" #include "asterisk/musiconhold.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.25 $") +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.27 $") #else @@ -176,8 +186,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.25 $") #include "callweaver/causes.h" #include "callweaver/dsp.h" #include "callweaver.h" +#include "confdefs.h" -CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.25 $") +CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.27 $") // strings... @@ -191,10 +202,21 @@ CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.25 $") #define AST_CONTROL_UNHOLD OPBX_CONTROL_UNHOLD #define AST_CONTROL_VIDUPDATE OPBX_CONTROL_VIDUPDATE +#ifdef OPBX_LOG_NOTICE #define LOG_NOTICE OPBX_LOG_NOTICE +#endif + +#ifdef OPBX_LOG_DEBUG #define LOG_DEBUG OPBX_LOG_DEBUG +#endif + +#ifdef OPBX_LOG_ERROR #define LOG_ERROR OPBX_LOG_ERROR +#endif + +#ifdef OPBX_LOG_WARNING #define LOG_WARNING OPBX_LOG_WARNING +#endif #define AST_FORMAT_SLINEAR OPBX_FORMAT_SLINEAR #define AST_FORMAT_ULAW OPBX_FORMAT_ULAW @@ -300,7 +322,7 @@ CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.25 $") extern int option_verbose; -#define WOOMERA_VERSION "v1.25" +#define WOOMERA_VERSION "v1.27" #ifndef WOOMERA_CHAN_NAME #define WOOMERA_CHAN_NAME "SS7" #endif @@ -3165,6 +3187,9 @@ static int tech_call(struct ast_channel *self, char *dest, int timeout) char *p; char *c; +#ifndef AST14 + self->type = WOOMERA_CHAN_NAME; +#endif self->hangupcause = AST_CAUSE_NORMAL_CIRCUIT_CONGESTION; if (globals.panic) { @@ -3178,7 +3203,7 @@ static int tech_call(struct ast_channel *self, char *dest, int timeout) dest); } - + if (self->cid.cid_name) { strncpy(tech_pvt->cid_name, self->cid.cid_name, sizeof(tech_pvt->cid_name)-1); @@ -4035,7 +4060,11 @@ static int woomera_cli(int fd, int argc, char *argv[]) } #ifdef CALLWEAVER +#ifdef CALLWEAVER_1_2 +static struct opbx_cli_entry cli_woomera[] = { +# else static struct opbx_clicmd cli_woomera[] = { +#endif { .cmda = { "woomera", "default", "version", NULL }, .handler = woomera_cli, @@ -4044,6 +4073,7 @@ static struct opbx_clicmd cli_woomera[] = { //.generator = complete_span_4, }, }; + #else static struct ast_cli_entry cli_woomera = { { "woomera", NULL }, woomera_cli, "Woomera", "Woomera" }; #endif @@ -4652,7 +4682,16 @@ int unload_module(void) #ifdef CALLWEAVER +#ifdef CALLWEAVER_1_2 +char *description() +{ + return (char *) desc; +} + + +#else MODULE_INFO(load_module, reload, unload_module, NULL, desc); +#endif #else diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/tmp/tempfile.2.tmp b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/tmp/tempfile.2.tmp index 1545d06..c075d8c 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/tmp/tempfile.2.tmp +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/tmp/tempfile.2.tmp @@ -19,6 +19,8 @@ ifneq (,$(wildcard ./.pbxdir)) endif endif +CHAN_NAME=WOOMERA + $(shell echo $(PBXDIR) > .pbxdir) PBXMODDIR=/usr/lib/asterisk/modules @@ -43,11 +45,11 @@ CC = gcc INCLUDES= -I/usr/include -I./ -CFLAGS = -D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O6 -march=i686 +CFLAGS = -D__LINUX__ -D_REENTRANT -D_GNU_SOURCE -O6 -march=i686 CCFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes -g LDFLAGS=-L lib/libteletone/.libs -L. -L/usr/local/lib -L ../../ssmg/libsangoma.trunk/.libs -lpthread -lsangoma -lm -PBXFLAGS= $(INCLUDES) -I$(PBXDIR) -I$(PBXDIR)/include -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 -Iinclude -I../include -D_REENTRANT -D_GNU_SOURCE -O6 -march=i686 -fomit-frame-pointer -fPIC +PBXFLAGS= $(INCLUDES) -I$(PBXDIR) -I$(PBXDIR)/include -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 -Iinclude -I../include -D_REENTRANT -DWOOMERA_CHAN_NAME=\"$(CHAN_NAME)\" -D_GNU_SOURCE -O6 -march=i686 -fomit-frame-pointer -fPIC all: chan_woomera.so @@ -65,7 +67,13 @@ distclean: clean @echo OK install: all + @if [ ! -d $(INSTALLPREFIX)$(PBXMODDIR) ]; then \ + mkdir -p $(INSTALLPREFIX)$(PBXMODDIR); \ + fi; install -D -m 755 chan_woomera.so $(INSTALLPREFIX)$(PBXMODDIR)/chan_woomera.so + @if [ ! -d $(INSTALLPREFIX)$(PBXCFGDIR) ]; then \ + mkdir -p $(INSTALLPREFIX)$(PBXCFGDIR); \ + fi; @if [ -f woomera.conf ] && [ ! -e $(INSTALLPREFIX)$(PBXCFGDIR)/woomera.conf ]; then \ install -D -m 755 woomera.conf $(INSTALLPREFIX)$(PBXCFGDIR)/woomera.conf; \ fi diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/tmp/tempfile.3.tmp b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/tmp/tempfile.3.tmp index a70d7bf..eacf6f0 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/tmp/tempfile.3.tmp +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/tmp/tempfile.3.tmp @@ -13,21 +13,6 @@ * This program is free software, distributed under the terms of * the GNU General Public License * ============================================= - - * v1.22 David Yat Sin - * Jan 11 2007 - * rxgain and txgain configuration parameters - * are ignored if coding is not specified in woomera.conf - * - * v1.21 David Yat Sin - * Dec 27 2007 - * Support for language - * - * v1.20 David Yat Sin - * Dec 20 2007 - * Support for call confirmation - * Support for default context - * * v1.19 Nenad Corbic * Nov 30 2007 * Updated for latest CallWeaver @@ -139,9 +124,8 @@ #include "asterisk/translate.h" #include "asterisk/causes.h" #include "asterisk/dsp.h" -#include "asterisk/musiconhold.h" -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.21 $") +ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.19 $") #else @@ -163,7 +147,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.21 $") #include "callweaver/dsp.h" #include "callweaver.h" -CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.21 $") +CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.19 $") // strings... @@ -178,7 +162,6 @@ CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.21 $") #define AST_CONTROL_VIDUPDATE OPBX_CONTROL_VIDUPDATE #define LOG_NOTICE OPBX_LOG_NOTICE -#define LOG_DEBUG OPBX_LOG_DEBUG #define LOG_ERROR OPBX_LOG_ERROR #define LOG_WARNING OPBX_LOG_WARNING @@ -286,7 +269,7 @@ CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.21 $") extern int option_verbose; -#define WOOMERA_VERSION "v1.21" +#define WOOMERA_VERSION "v1.19" #ifndef WOOMERA_CHAN_NAME #define WOOMERA_CHAN_NAME "SS7" #endif @@ -399,10 +382,7 @@ typedef enum { TFLAG_DESTROYED = (1 << 13), TFLAG_UP = (1 << 14), TFLAG_ACCEPT = (1 << 15), - TFLAG_ACCEPTED = (1 << 16), - TFLAG_ANSWER_RECEIVED = (1 << 17), - TFLAG_CONFIRM_ANSWER = (1 << 18), - TFLAG_CONFIRM_ANSWER_ENABLED = (1 << 19) + TFLAG_ACCEPTED = (1 << 16) } TFLAGS; static int usecnt = 0; @@ -467,8 +447,6 @@ struct woomera_profile { int call_abort; char default_context[WOOMERA_STRLEN]; char* tg_context [WOOMERA_MAX_TRUNKGROUPS+1]; - char language[WOOMERA_STRLEN]; - char* tg_language [WOOMERA_MAX_TRUNKGROUPS+1]; }; @@ -493,8 +471,6 @@ struct private_object { char dtmfbuf[WOOMERA_STRLEN]; char cid_name[WOOMERA_STRLEN]; char cid_num[WOOMERA_STRLEN]; - char mohinterpret[MAX_MUSICCLASS]; - char mohsuggest[MAX_MUSICCLASS]; char *cid_rdnis; int cid_pres; char ds[WOOMERA_STRLEN]; @@ -511,6 +487,7 @@ struct private_object { struct woomera_event_queue event_queue; unsigned int coding; int pri_cause; + unsigned int confirmanswer; #ifdef AST_JB struct ast_jb_conf jbconf; #endif /* AST_JB */ @@ -1378,9 +1355,7 @@ static int tech_init(private_object *tech_pvt, woomera_profile *profile, int fla self->nativeformats = tech_pvt->coding; self->writeformat = self->rawwriteformat = self->readformat = tech_pvt->coding; tech_pvt->frame.subclass = tech_pvt->coding; - ast_clear_flag(tech_pvt, TFLAG_CONFIRM_ANSWER); - ast_clear_flag(tech_pvt, TFLAG_CONFIRM_ANSWER_ENABLED); - ast_clear_flag(tech_pvt, TFLAG_ANSWER_RECEIVED); + tech_pvt->confirmanswer=0; if (profile->dtmf_enable) { @@ -2461,13 +2436,7 @@ static void woomera_config_gain(woomera_profile *profile, float gain_val, int rx int k; float linear_gain = pow(10.0, gain_val / 20.0); unsigned char *gain; - - if (profile->coding == AST_FORMAT_SLINEAR){ - ast_log(LOG_WARNING, "Coding not specified, %s value ignored\n", (rx)? "rxgain":"txgain"); - return; - } - if (gain_val == 0) { goto woomera_config_gain_skip; } @@ -2523,9 +2492,6 @@ static void destroy_woomera_profile(woomera_profile *profile) if(profile->tg_context[i] != NULL){ free(profile->tg_context[i]); } - if(profile->tg_language[i] != NULL){ - free(profile->tg_language[i]); - } } ast_mutex_destroy(&profile->iolock); ast_mutex_destroy(&profile->call_count_lock); @@ -2655,16 +2621,7 @@ static int config_woomera(void) free(profile->tg_context[group_num]); } profile->tg_context[group_num] = strdup(profile->context); - - if(profile->tg_language[group_num] != NULL){ - free(profile->tg_language[group_num]); - } - if(strlen(profile->language)){ - profile->tg_language[group_num] = strdup(profile->language); - } } - } else if (!strcmp(v->name, "language")) { - strncpy(profile->language, v->value, sizeof(profile->language) - 1); } else if (!strcmp(v->name, "dtmf_enable")) { profile->dtmf_enable = atoi(v->value); } else if (!strcmp(v->name, "jb_enable")) { @@ -2996,10 +2953,8 @@ static struct ast_channel *woomera_new(const char *type, int format, chan->nativeformats = tech_pvt->coding; chan->writeformat = chan->rawwriteformat = chan->readformat = tech_pvt->coding; tech_pvt->frame.subclass = tech_pvt->coding; - + tech_pvt->pri_cause=AST_CAUSE_NORMAL_CLEARING; - - ast_copy_string(tech_pvt->mohinterpret,"default",sizeof(tech_pvt->mohinterpret)); ASTOBJ_CONTAINER_LINK(&private_object_list, tech_pvt); @@ -3235,8 +3190,7 @@ static int tech_call(struct ast_channel *self, char *dest, int timeout) if ((p = strrchr(self->name, '/'))) { c = p-1; if(*c == 'c' || *c== 'C'){ - ast_set_flag(tech_pvt, TFLAG_CONFIRM_ANSWER_ENABLED); - ast_set_flag(tech_pvt, TFLAG_CONFIRM_ANSWER); + tech_pvt->confirmanswer=1; } } #endif @@ -3517,44 +3471,36 @@ tech_read_again: if (tech_pvt->owner && (tech_pvt->faxdetect || tech_pvt->ast_dsp)) { f = ast_dsp_process(tech_pvt->owner, tech_pvt->dsp, &tech_pvt->frame); if (f && f->frametype == AST_FRAME_DTMF){ - int answer = 0; - if(ast_test_flag(tech_pvt, TFLAG_CONFIRM_ANSWER_ENABLED)){ - ast_mutex_lock(&tech_pvt->iolock); - if(ast_test_flag(tech_pvt, TFLAG_CONFIRM_ANSWER)){ - ast_clear_flag(tech_pvt, TFLAG_CONFIRM_ANSWER); - if(ast_test_flag(tech_pvt, TFLAG_ANSWER_RECEIVED)){ - answer = 1; - } - } - ast_mutex_unlock(&tech_pvt->iolock); - if(answer){ - struct ast_frame answer_frame = {AST_FRAME_CONTROL, AST_CONTROL_ANSWER}; - struct ast_channel *owner = tech_get_owner(tech_pvt); - ast_log(LOG_DEBUG, "Confirm answer on %s!\n", self->name); + if(tech_pvt->confirmanswer){ + struct ast_frame answer_frame = {AST_FRAME_CONTROL, AST_CONTROL_ANSWER}; + struct ast_channel *owner = tech_get_owner(tech_pvt); + ast_log(LOG_DEBUG, "Confirm answer on %s!\n", self->name); - if (owner) { - ast_setstate(owner, AST_STATE_UP); - ast_queue_frame(owner, &answer_frame); - ast_set_flag(tech_pvt, TFLAG_UP); + tech_pvt->confirmanswer = 0; + if (owner) { + ast_setstate(owner, AST_STATE_UP); + ast_queue_frame(owner, &answer_frame); + ast_set_flag(tech_pvt, TFLAG_UP); + + ast_mutex_lock(&tech_pvt->profile->call_count_lock); + tech_pvt->profile->call_ok++; + ast_mutex_unlock(&tech_pvt->profile->call_count_lock); + } else { + ast_copy_string(tech_pvt->ds, "REQUESTED_CHAN_UNAVAIL", sizeof(tech_pvt->ds)); + tech_pvt->pri_cause=44; + ast_set_flag(tech_pvt, TFLAG_ABORT); - ast_mutex_lock(&tech_pvt->profile->call_count_lock); - tech_pvt->profile->call_ok++; - ast_mutex_unlock(&tech_pvt->profile->call_count_lock); - } else { - ast_copy_string(tech_pvt->ds, "REQUESTED_CHAN_UNAVAIL", sizeof(tech_pvt->ds)); - tech_pvt->pri_cause=44; - ast_set_flag(tech_pvt, TFLAG_ABORT); - - } } - } - if (answer == 0 && globals.debug > 2) { + + + } else { + if (globals.debug > 2) { ast_log(LOG_NOTICE, "%s: Detected inband DTMF digit: %c\n", self->name, f->subclass); + } } } - //woomera_tx2ast_frm(tech_pvt, tech_pvt->frame.data, tech_pvt->frame.datalen); } @@ -3709,9 +3655,6 @@ static int tech_indicate(struct ast_channel *self, int condition) if (!ast_test_flag(tech_pvt,TFLAG_ACCEPTED)) { ast_set_flag(tech_pvt, TFLAG_ACCEPT); } -#ifdef AST14 - ast_moh_start(self, data, tech_pvt->mohinterpret); -#endif break; case AST_CONTROL_UNHOLD: if (globals.debug > 3) { @@ -3720,8 +3663,6 @@ static int tech_indicate(struct ast_channel *self, int condition) if (!ast_test_flag(tech_pvt,TFLAG_ACCEPTED)) { ast_set_flag(tech_pvt, TFLAG_ACCEPT); } - ast_moh_stop(self); - res=0; break; case AST_CONTROL_VIDUPDATE: if (globals.debug > 3) { @@ -4248,18 +4189,11 @@ static int woomera_event_incoming (private_object *tech_pvt) owner = tech_get_owner(tech_pvt); if (owner) { +#if 1 +/* Support for custom contextes per span */ int group = atoi(tg_string); - if(group >= 0 && - group <= WOOMERA_MAX_TRUNKGROUPS && - tech_pvt->profile->tg_context[group] != NULL){ - + if (tech_pvt->profile->tg_context[group] != NULL){ strncpy(owner->context, tech_pvt->profile->tg_context[group], sizeof(owner->context) - 1); - - if(tech_pvt->profile->tg_language[group] != NULL && - strlen(tech_pvt->profile->tg_language[group])){ - strncpy(owner->language, tech_pvt->profile->tg_language[group], sizeof(owner->language) - 1); - } - }else { snprintf(owner->context, sizeof(owner->context) - 1, "%s%s", @@ -4267,6 +4201,12 @@ static int woomera_event_incoming (private_object *tech_pvt) tg_string); } +#else + snprintf(owner->context, sizeof(owner->context) - 1, + "%s%s", + tech_pvt->profile->context, + tg_string); +#endif strncpy(owner->exten, exten, sizeof(owner->exten) - 1); ast_set_callerid(owner, cid_num, cid_name, cid_num); owner->cid.cid_pres=presentation; @@ -4297,24 +4237,33 @@ static int woomera_event_incoming (private_object *tech_pvt) if (validext == 0) { +#if 1 +/* Support for custom contextes per span */ if (globals.debug > 1){ - int group = atoi(tg_string); - if(group >= 0 && - group <= WOOMERA_MAX_TRUNKGROUPS && - tech_pvt->profile->tg_context[group] != NULL){ - + if(tech_pvt->profile->tg_context[atoi(tg_string)] != NULL){ ast_log(LOG_ERROR, "Error: Invalid exten %s@%s called %s!\n", exten, owner->context, tech_pvt->callid); - }else{ + }else{ ast_log(LOG_ERROR, "Error: Invalid exten %s@%s%s called %s!\n", exten, tech_pvt->profile->context, tg_string, tech_pvt->callid); - } - } + } + } +#else + if (globals.debug > 1){ + ast_log(LOG_ERROR, "Error: Invalid exten %s@%s%s called %s!\n", + exten, + tech_pvt->profile->context, + tg_string, + tech_pvt->callid); + } + +#endif + return -1; } @@ -4436,20 +4385,9 @@ static void woomera_check_event (private_object *tech_pvt, int res, woomera_mess struct ast_channel *owner = tech_get_owner(tech_pvt); if (owner) { - int answer = 0; - if(ast_test_flag(tech_pvt, TFLAG_CONFIRM_ANSWER_ENABLED)){ - ast_mutex_lock(&tech_pvt->iolock); - ast_set_flag(tech_pvt, TFLAG_ANSWER_RECEIVED); - if(ast_test_flag(tech_pvt, TFLAG_CONFIRM_ANSWER)){ - ast_log(LOG_DEBUG, "Waiting on answer confirmation on channel %s!\n", woomera_message_header(wmsg, "Channel-Name")); - } else { - answer = 1; - } - ast_mutex_unlock(&tech_pvt->iolock); + if(tech_pvt->confirmanswer){ + ast_log(LOG_DEBUG, "Waiting on answer confirmation on channel %s!\n", woomera_message_header(wmsg, "Channel-Name")); } else { - answer = 1; - } - if(answer){ ast_setstate(owner, AST_STATE_UP); ast_queue_frame(owner, &answer_frame); ast_set_flag(tech_pvt, TFLAG_UP); @@ -4457,7 +4395,8 @@ static void woomera_check_event (private_object *tech_pvt, int res, woomera_mess ast_mutex_lock(&tech_pvt->profile->call_count_lock); tech_pvt->profile->call_ok++; ast_mutex_unlock(&tech_pvt->profile->call_count_lock); - } + } + }else{ ast_copy_string(tech_pvt->ds, "REQUESTED_CHAN_UNAVAIL", sizeof(tech_pvt->ds)); tech_pvt->pri_cause=44; diff --git a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/tmp/tempfile.4.tmp b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/tmp/tempfile.4.tmp index 71fea38..3ac561c 100644 --- a/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/tmp/tempfile.4.tmp +++ b/ssmg/sangoma_mgd.trunk/chan_woomera.trunk/.svn/tmp/tempfile.4.tmp @@ -1,4687 +1,81 @@ - -/* - * Asterisk -- A telephony toolkit for Linux. - * - * Woomera Channel Driver - * - * Copyright (C) 05-08 Nenad Corbic - * Anthony Minessale II - * - * Nenad Corbic - * Anthony Minessale II - * - * This program is free software, distributed under the terms of - * the GNU General Public License - * ============================================= - * v1.24 Nenad Corbic - * Jan 23 2008 - * Removed LISTEN on every woomera channel. Listen - * only on master. Fixed jitterbuffer support on AST1.4 - * - * v1.23 Nenad Corbic - * Jan 22 2008 - * Implemented Music on Hold. - * - * v1.22 David Yat Sin - * Jan 11 2008 - * rxgain and txgain configuration parameters - * are ignored if coding is not specified in - * woomera.conf - * - * v1.21 David Yat Sin - * Dec 27 2007 - * Support for language - * - * v1.20 David Yat Sin - * Dec 20 2007 - * Support for call confirmation - * Support for default context - * - * v1.19 Nenad Corbic - * Nov 30 2007 - * Updated for latest CallWeaver - * Updated smgversion update on master socket - * restart. - * - * v1.18 Nenad Corbic - * Updated Channel-Name on outbound call - * Check queued events on ABORT - * Major Unit Testing done - * Ability to change chan name from Makefile - * - * v1.17 Nenad Corbic - * Updates for Asterisk 1.4 - * Updated the release causes - * Updated for tech_indication - * - * v1.16 Nenad Corbic - * Added support for Asterisk 1.4 - * Updated support for Callweaver - * - * v1.15 Nenad Corbic - * Added PRI_CAUSE and Q931-Cause-Code - * in woomera protocol. - * - * v1.14 Nenad Corbic - * Updated for session support - * - * v1.13 Nenad Corbic - * Added CallWeaver Support - * |->(thanks to Andre Schwaller) - * Updated codec negotiation for - * mutliple profiles. - * - * v1.12 Nenad Corbic - * Updated DTMF locking - * - * v1.11 Nenad Corbic - * Updated multiple profiles - * Updated Dialect for OPAL Woomera - * Added call logging/debugging - * - * v1.10 Nenad Corbic - * Bug fix in incoming hangup - * - * v1.9 Nenad Corbic - * Fixed remote asterisk/woomera - * setup. - * - * v1.8 Nenad Corbic - * Added Woomera OPAL dialect. - * Code cleanup. - * Added cli call_status - * - * v1.7 Nenad Corbic - * Added smgdebug to enable smg debugging - * Added rdnis - * - * v1.6 Nenad Corbic - * Added incoming trunk group context - * The trunk number will be added to the - * profile context name. - * Added presentation feature. - * - * v1.5 Nenad Corbic - * Use only ALAW and MLAW not SLIN. - * This reduces the load quite a bit. - * Autodetect Format from HELLO Message. - * RxTx Gain supported in woomera.conf as well - * from CLI. - */ - - -#if defined(CALLWEAVER) && defined(HAVE_CONFIG_H) -#include "confdefs.h" -#endif - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#ifndef CALLWEAVER - -#include "asterisk.h" -#include "asterisk/sched.h" -#include "asterisk/astobj.h" -#include "asterisk/lock.h" -#include "asterisk/manager.h" -#include "asterisk/pbx.h" -#include "asterisk/cli.h" -#include "asterisk/logger.h" -#include "asterisk/frame.h" -#include "asterisk/config.h" -#include "asterisk/module.h" -#include "asterisk/lock.h" -#include "asterisk/translate.h" -#include "asterisk/causes.h" -#include "asterisk/dsp.h" -#include "asterisk/musiconhold.h" - -ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.24 $") - -#else - -#include "callweaver.h" -#include "callweaver/sched.h" -#include "callweaver/astobj.h" -#include "callweaver/lock.h" -#include "callweaver/manager.h" -#include "callweaver/channel.h" -#include "callweaver/pbx.h" -#include "callweaver/cli.h" -#include "callweaver/logger.h" -#include "callweaver/frame.h" -#include "callweaver/config.h" -#include "callweaver/module.h" -#include "callweaver/lock.h" -#include "callweaver/translate.h" -#include "callweaver/causes.h" -#include "callweaver/dsp.h" -#include "callweaver.h" - -CALLWEAVER_FILE_VERSION(__FILE__, "$Revision: 1.24 $") - -// strings... - -#define ast_config opbx_config -#define AST_CONTROL_RINGING OPBX_CONTROL_RINGING -#define AST_CONTROL_BUSY OPBX_CONTROL_BUSY -#define AST_CONTROL_CONGESTION OPBX_CONTROL_CONGESTION -#define AST_CONTROL_PROCEEDING OPBX_CONTROL_PROCEEDING -#define AST_CONTROL_PROGRESS OPBX_CONTROL_PROGRESS -#define AST_CONTROL_HOLD OPBX_CONTROL_HOLD -#define AST_CONTROL_UNHOLD OPBX_CONTROL_UNHOLD -#define AST_CONTROL_VIDUPDATE OPBX_CONTROL_VIDUPDATE - -#define LOG_NOTICE OPBX_LOG_NOTICE -#define LOG_DEBUG OPBX_LOG_DEBUG -#define LOG_ERROR OPBX_LOG_ERROR -#define LOG_WARNING OPBX_LOG_WARNING - -#define AST_FORMAT_SLINEAR OPBX_FORMAT_SLINEAR -#define AST_FORMAT_ULAW OPBX_FORMAT_ULAW -#define AST_FORMAT_ALAW OPBX_FORMAT_ALAW -#define ast_mutex_t opbx_mutex_t -#define ast_frame opbx_frame -#define ast_verbose opbx_verbose -#define AST_FRIENDLY_OFFSET OPBX_FRIENDLY_OFFSET -#define AST_MUTEX_DEFINE_STATIC OPBX_MUTEX_DEFINE_STATIC -#define AST_CONTROL_PROGRESS OPBX_CONTROL_PROGRESS -#define AST_CAUSE_REQUESTED_CHAN_UNAVAIL OPBX_CAUSE_REQUESTED_CHAN_UNAVAIL -#define AST_CAUSE_NORMAL_CIRCUIT_CONGESTION OPBX_CAUSE_NORMAL_CIRCUIT_CONGESTION -#define AST_CAUSE_USER_BUSY OPBX_CAUSE_USER_BUSY -#define AST_CAUSE_NO_ANSWER OPBX_CAUSE_NO_ANSWER -#define AST_CAUSE_NORMAL_CLEARING OPBX_CAUSE_NORMAL_CLEARING -#define AST_SOFTHANGUP_EXPLICIT OPBX_SOFTHANGUP_EXPLICIT -#define AST_SOFTHANGUP_DEV OPBX_SOFTHANGUP_DEV -#define AST_CAUSE_NORMAL_CLEARING OPBX_CAUSE_NORMAL_CLEARING -#define AST_FRAME_DTMF OPBX_FRAME_DTMF -#define AST_FRAME_CONTROL OPBX_FRAME_CONTROL -#define AST_CONTROL_ANSWER OPBX_CONTROL_ANSWER -#define AST_STATE_UP OPBX_STATE_UP -#define AST_STATE_RINGING OPBX_STATE_RINGING -#define AST_STATE_DOWN OPBX_STATE_DOWN -#define AST_FLAGS_ALL OPBX_FLAGS_ALL -#define AST_FRAME_VOICE OPBX_FRAME_VOICE -#define ASTERISK_GPL_KEY 0 -#define ast_channel_tech opbx_channel_tech -#define ast_test_flag opbx_test_flag -#define ast_queue_frame opbx_queue_frame -#define ast_frdup opbx_frdup -#define ast_channel opbx_channel -#define ast_exists_extension opbx_exists_extension -#define ast_hostent opbx_hostent -#define ast_clear_flag opbx_clear_flag -#define ast_log opbx_log -#define ast_set_flag opbx_set_flag -#define ast_copy_string opbx_copy_string -#define ast_set_flag opbx_set_flag -#define ast_set2_flag opbx_set2_flag -#define ast_setstate opbx_setstate -#define ast_test_flag opbx_test_flag -#define ast_softhangup opbx_softhangup -#define ast_true opbx_true -#define ast_false opbx_false -#define ast_strlen_zero opbx_strlen_zero -#define ast_exists_extension opbx_exists_extension -#define ast_frame opbx_frame -#define ast_jb_conf opbx_jb_conf -#define ast_carefulwrite opbx_carefulwrite -#define ast_channel_unregister opbx_channel_unregister -#define ast_cli opbx_cli -#define ast_cli_register opbx_cli_register -#define ast_cli_unregister opbx_cli_unregister -#define ast_jb_read_conf opbx_jb_read_conf -#define ast_mutex_destroy opbx_mutex_destroy -#define ast_mutex_init opbx_mutex_init -#define ast_mutex_lock opbx_mutex_lock -#define ast_mutex_unlock opbx_mutex_unlock -#define ast_mutex_t opbx_mutex_t -#define ast_queue_control opbx_queue_control -#define ast_queue_frame opbx_queue_frame -#define ast_queue_hangup opbx_queue_hangup -#define ast_set_callerid opbx_set_callerid -#define ast_variable opbx_variable -#define ast_pthread_create opbx_pthread_create -#define ast_cli_entry opbx_cli_entry -#define ast_channel_register opbx_channel_register -#define ast_config_load opbx_config_load -#define ast_config_destroy opbx_config_destroy -#define ast_category_browse opbx_category_browse -#define ast_variable_browse opbx_variable_browse -#define ast_gethostbyname opbx_gethostbyname -#define ast_channel_alloc opbx_channel_alloc -#define ast_dsp_new opbx_dsp_new -#define ast_dsp opbx_dsp -#define ast_dsp_set_features opbx_dsp_set_features -#define ast_dsp_digitmode opbx_dsp_digitmode -#define ast_dsp_set_call_progress_zone opbx_dsp_set_call_progress_zone -#define ast_dsp_set_busy_count opbx_dsp_set_busy_count -#define ast_dsp_set_busy_pattern opbx_dsp_set_busy_pattern -#define ast_dsp_process opbx_dsp_process -#define ast_strdupa opbx_strdupa -#define ast_mutex_trylock opbx_mutex_trylock -#define ast_cause2str opbx_cause2str -#define ast_pbx_start opbx_pbx_start -#define ast_hangup opbx_hangup - -#endif - -#include "g711.h" -#include - -#define USE_TECH_INDICATE 1 -#ifdef USE_TECH_INDICATE - #define MEDIA_ANSWER "MEDIA" -#else - #define MEDIA_ANSWER "ACCEPT" -#endif - -#define USE_ANSWER 1 - - -extern int option_verbose; - -#define WOOMERA_VERSION "v1.24" -#ifndef WOOMERA_CHAN_NAME -#define WOOMERA_CHAN_NAME "SS7" -#endif - - -static int tech_count = 0; - -static const char desc[] = "Woomera Channel Driver"; -//static const char type[] = "WOOMERA"; -static const char tdesc[] = "Woomera Channel Driver"; -static char configfile[] = "woomera.conf"; -static char smgversion_init=0; -static char smgversion[100] = "N/A"; - -static char mohinterpret[MAX_MUSICCLASS] = "default"; -static char mohsuggest[MAX_MUSICCLASS] = ""; - -<<<<<<< .mine -#ifdef AST14 -# ifndef AST_JB -# define AST_JB 1 -# endif -#endif -======= -#ifdef AST14 - #ifndef AST_JB - #define AST_JB 1 - #endif -#endif ->>>>>>> .r41 - -#ifdef AST_JB -#include "asterisk/abstract_jb.h" -/* Global jitterbuffer configuration - by default, jb is disabled */ -static struct ast_jb_conf default_jbconf = -{ - .flags = 0, - .max_size = -1, - .resync_threshold = -1, - .impl = "" -}; -static struct ast_jb_conf global_jbconf; -#endif /* AST_JB */ - -#define WOOMERA_SLINEAR 0 -#define WOOMERA_ULAW 1 -#define WOOMERA_ALAW 2 - -#define WOOMERA_STRLEN 256 -#define WOOMERA_ARRAY_LEN 50 -#define WOOMERA_MIN_PORT 9900 -#define WOOMERA_MAX_PORT 10799 -#define WOOMERA_BODYLEN 2048 -#define WOOMERA_LINE_SEPARATOR "\r\n" -#define WOOMERA_RECORD_SEPARATOR "\r\n\r\n" -#define WOOMERA_DEBUG_PREFIX "**[WOOMERA]** " -#define WOOMERA_DEBUG_LINE "--------------------------------------------------------------------------------" -#define WOOMERA_HARD_TIMEOUT -2000 -#define WOOMERA_QLEN 10 -#define WOOMERA_MAX_TRUNKGROUPS 16 - -/* this macro is not in all versions of asterisk */ -#ifdef OLDERAST -#define ASTOBJ_CONTAINER_UNLINK(container,obj) \ - ({ \ - typeof((container)->head) found = NULL; \ - typeof((container)->head) prev = NULL; \ - ASTOBJ_CONTAINER_TRAVERSE(container, !found, do { \ - if (iterator== obj) { \ - found = iterator; \ - found->next[0] = NULL; \ - ASTOBJ_CONTAINER_WRLOCK(container); \ - if (prev) \ - prev->next[0] = next; \ - else \ - (container)->head = next; \ - ASTOBJ_CONTAINER_UNLOCK(container); \ - } \ - prev = iterator; \ - } while (0)); \ - found; \ - }) -#endif - - -#define FRAME_LEN 480 - -#if 0 -static int WFORMAT = AST_FORMAT_ALAW; //AST_FORMAT_SLINEAR; -#else -static int WFORMAT = AST_FORMAT_SLINEAR; -#endif - -typedef enum { - WFLAG_EXISTS = (1 << 0), - WFLAG_EVENT = (1 << 1), - WFLAG_CONTENT = (1 << 2), -} WFLAGS; - - -typedef enum { - WCFLAG_NOWAIT = (1 << 0) -} WCFLAGS; - - -typedef enum { - PFLAG_INBOUND = (1 << 0), - PFLAG_OUTBOUND = (1 << 1), - PFLAG_DYNAMIC = (1 << 2), - PFLAG_DISABLED = (1 << 3) -} PFLAGS; - -typedef enum { - TFLAG_MEDIA = (1 << 0), - TFLAG_INBOUND = (1 << 1), - TFLAG_OUTBOUND = (1 << 2), - TFLAG_INCOMING = (1 << 3), - TFLAG_PARSE_INCOMING = (1 << 4), - TFLAG_ACTIVATE = (1 << 5), - TFLAG_DTMF = (1 << 6), - TFLAG_DESTROY = (1 << 7), - TFLAG_ABORT = (1 << 8), - TFLAG_PBX = (1 << 9), - TFLAG_ANSWER = (1 << 10), - TFLAG_INTHREAD = (1 << 11), - TFLAG_TECHHANGUP = (1 << 12), - TFLAG_DESTROYED = (1 << 13), - TFLAG_UP = (1 << 14), - TFLAG_ACCEPT = (1 << 15), - TFLAG_ACCEPTED = (1 << 16), - TFLAG_ANSWER_RECEIVED = (1 << 17), - TFLAG_CONFIRM_ANSWER = (1 << 18), - TFLAG_CONFIRM_ANSWER_ENABLED = (1 << 19) -} TFLAGS; - -static int usecnt = 0; - -struct woomera_message { - char callid[WOOMERA_STRLEN]; - int mval; - char command[WOOMERA_STRLEN]; - char command_args[WOOMERA_STRLEN]; - char names[WOOMERA_STRLEN][WOOMERA_ARRAY_LEN]; - char values[WOOMERA_STRLEN][WOOMERA_ARRAY_LEN]; - char body[WOOMERA_BODYLEN]; - char cause[WOOMERA_STRLEN]; - unsigned int flags; - int last; - unsigned int queue_id; - struct woomera_message *next; -}; - - -static struct { - int next_woomera_port; - int debug; - int panic; - int more_threads; - ast_mutex_t woomera_port_lock; -} globals; - -struct woomera_event_queue { - struct woomera_message *head; - ast_mutex_t lock; -}; - -struct woomera_profile { - ASTOBJ_COMPONENTS(struct woomera_profile); - ast_mutex_t iolock; - ast_mutex_t call_count_lock; - char woomera_host[WOOMERA_STRLEN]; - int max_calls; - int call_count; - int woomera_port; - char audio_ip[WOOMERA_STRLEN]; - char context[WOOMERA_STRLEN]; - pthread_t thread; - unsigned int flags; - int thread_running; - int dtmf_enable; - int faxdetect; - int woomera_socket; - struct woomera_event_queue event_queue; - int jb_enable; - int progress_enable; - int coding; - float rxgain_val; - float txgain_val; - unsigned char rxgain[256]; - unsigned char txgain[256]; - int call_out; - int call_in; - int call_ok; - int call_end; - int call_abort; - char default_context[WOOMERA_STRLEN]; - char* tg_context [WOOMERA_MAX_TRUNKGROUPS+1]; - char language[WOOMERA_STRLEN]; - char* tg_language [WOOMERA_MAX_TRUNKGROUPS+1]; -}; - - -struct private_object { - ASTOBJ_COMPONENTS(struct private_object); - ast_mutex_t iolock; - struct ast_channel *owner; - struct sockaddr_in udpread; - struct sockaddr_in udpwrite; - int command_channel; - int udp_socket; - unsigned int flags; - struct ast_frame frame; - short fdata[FRAME_LEN + AST_FRIENDLY_OFFSET]; - struct woomera_message call_info; - struct woomera_profile *profile; - char dest[WOOMERA_STRLEN]; - char proto[WOOMERA_STRLEN]; - int port; - struct timeval started; - int timeout; - char dtmfbuf[WOOMERA_STRLEN]; - char cid_name[WOOMERA_STRLEN]; - char cid_num[WOOMERA_STRLEN]; - char mohinterpret[MAX_MUSICCLASS]; - char mohsuggest[MAX_MUSICCLASS]; - char *cid_rdnis; - int cid_pres; - char ds[WOOMERA_STRLEN]; - struct ast_dsp *dsp; - int ast_dsp; - int dsp_features; - int faxdetect; - int faxhandled; - int call_count; - char callid[WOOMERA_STRLEN]; - pthread_t thread; - unsigned int callno; - int refcnt; - struct woomera_event_queue event_queue; - unsigned int coding; - int pri_cause; -#ifdef AST_JB - struct ast_jb_conf jbconf; -#endif /* AST_JB */ - -}; - -typedef struct private_object private_object; -typedef struct woomera_message woomera_message; -typedef struct woomera_profile woomera_profile; -typedef struct woomera_event_queue woomera_event_queue; - - -static void my_ast_softhangup(struct ast_channel *chan, private_object *tech_pvt, int cause) -{ -#if 1 - ast_queue_hangup(chan); - //ast_softhangup(chan, AST_SOFTHANGUP_EXPLICIT); -#else - struct ast_frame f = { AST_FRAME_NULL }; - - if (chan) { - chan->_softhangup |= cause; - ast_queue_frame(chan, &f); - } - - ast_set_flag(tech_pvt, TFLAG_ABORT); -#endif - -#if 0 - if (tech_pvt->dsp) { - tech_pvt->dsp_features &= ~DSP_FEATURE_DTMF_DETECT; - ast_dsp_set_features(tech_pvt->dsp, tech_pvt->dsp_features); - tech_pvt->ast_dsp=0; - } -#endif - -} - -//static struct sched_context *sched; - -static struct private_object_container { - ASTOBJ_CONTAINER_COMPONENTS(private_object); -} private_object_list; - -static struct woomera_profile_container { - ASTOBJ_CONTAINER_COMPONENTS(woomera_profile); -} woomera_profile_list; - -static woomera_profile default_profile; - -/* some locks you will use for use count and for exclusive access to the main linked-list of private objects */ -AST_MUTEX_DEFINE_STATIC(usecnt_lock); -AST_MUTEX_DEFINE_STATIC(lock); - -/* local prototypes */ -static void woomera_close_socket(int *socket); -static void global_set_flag(int flags); -static void woomera_printf(woomera_profile *profile, int fd, char *fmt, ...); -static char *woomera_message_header(woomera_message *wmsg, char *key); -static int woomera_enqueue_event(woomera_event_queue *event_queue, woomera_message *wmsg); -static int woomera_dequeue_event(woomera_event_queue *event_queue, woomera_message *wmsg); -static int woomera_message_parse(int fd, woomera_message *wmsg, int timeout, woomera_profile *profile, woomera_event_queue *event_queue); -static int woomera_message_parse_wait(private_object *tech_pvt,woomera_message *wmsg); -static int waitfor_socket(int fd, int timeout); -static int woomera_profile_thread_running(woomera_profile *profile, int set, int new); -static int woomera_locate_socket(woomera_profile *profile, int *woomera_socket); -static void *woomera_thread_run(void *obj); -static void launch_woomera_thread(woomera_profile *profile); -static void destroy_woomera_profile(woomera_profile *profile); -static woomera_profile *clone_woomera_profile(woomera_profile *new_profile, woomera_profile *default_profile); -static woomera_profile *create_woomera_profile(woomera_profile *default_profile); -static int config_woomera(void); -static int create_udp_socket(char *ip, int port, struct sockaddr_in *sockaddr, int client); -static int connect_woomera(int *new_socket, woomera_profile *profile, int flags); -static int init_woomera(void); -static int woomera_cli(int fd, int argc, char *argv[]); -static void tech_destroy(private_object *tech_pvt, struct ast_channel *owner); -static struct ast_channel *woomera_new(const char *type, int format, void *data, int *cause, woomera_profile *profile); -static int launch_tech_thread(private_object *tech_pvt); -static int tech_create_read_socket(private_object *tech_pvt); -static int tech_activate(private_object *tech_pvt); -static int tech_init(private_object *tech_pvt, woomera_profile *profile, int flags); -static void *tech_monitor_thread(void *obj); -static void tech_monitor_in_one_thread(void); -static struct ast_channel * tech_get_owner( private_object *tech_pvt); -int usecount(void); -#if 0 -static char *key(void); -static char *description(void); -#endif -int load_module(void); -int unload_module(void); -int reload(void); - - - - -/********************CHANNEL METHOD PROTOTYPES******************* - * You may or may not need all of these methods, remove any unnecessary functions/protos/mappings as needed. - * - */ -static struct ast_channel *tech_requester(const char *type, int format, void *data, int *cause); -static int tech_send_digit(struct ast_channel *self, char digit); -#ifdef AST14 -static int tech_digit_end(struct ast_channel *ast, char digit, unsigned int duration); -#endif -static int tech_call(struct ast_channel *self, char *dest, int timeout); -static int tech_hangup(struct ast_channel *self); -static int tech_answer(struct ast_channel *self); -static struct ast_frame *tech_read(struct ast_channel *self); -static struct ast_frame *tech_exception(struct ast_channel *self); -static int tech_write(struct ast_channel *self, struct ast_frame *frame); -#ifdef USE_TECH_INDICATE -# ifdef AST14 -static int tech_indicate(struct ast_channel *self, int condition, const void *data, size_t datalen); -# else -static int tech_indicate(struct ast_channel *self, int condition); -# endif -#endif -static int tech_fixup(struct ast_channel *oldchan, struct ast_channel *newchan); -static int tech_send_html(struct ast_channel *self, int subclass, const char *data, int datalen); -static int tech_send_text(struct ast_channel *self, const char *text); -static int tech_send_image(struct ast_channel *self, struct ast_frame *frame); -static int tech_setoption(struct ast_channel *self, int option, void *data, int datalen); -static int tech_queryoption(struct ast_channel *self, int option, void *data, int *datalen); -//static enum ast_bridge_result tech_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms); -static int tech_transfer(struct ast_channel *self, const char *newdest); -static int tech_write_video(struct ast_channel *self, struct ast_frame *frame); -//static struct ast_channel *tech_bridged_channel(struct ast_channel *self, struct ast_channel *bridge); - -static int woomera_event_incoming (private_object *tech_pvt); -static int woomera_event_media (private_object *tech_pvt, woomera_message *wmsg); -static void woomera_check_event (private_object *tech_pvt, int res, woomera_message *wmsg); - -/******************************************************************************** - * Constant structure for mapping local methods to the core interface. - * This structure only needs to contain the methods the channel requires to operate - * Not every channel needs all of them defined. - */ - -static const struct ast_channel_tech technology = { - .type = WOOMERA_CHAN_NAME, - .description = tdesc, - .capabilities = (AST_FORMAT_SLINEAR | AST_FORMAT_ULAW | AST_FORMAT_ALAW), - .requester = tech_requester, -#ifdef AST14 - .send_digit_begin = tech_send_digit, - .send_digit_end = tech_digit_end, -#else - .send_digit = tech_send_digit, -#endif - .call = tech_call, - //.bridge = tech_bridge, - .hangup = tech_hangup, - .answer = tech_answer, - .transfer = tech_transfer, - .write_video = tech_write_video, - .read = tech_read, - .write = tech_write, - .exception = tech_exception, -#ifdef USE_TECH_INDICATE - .indicate = tech_indicate, -#endif - .fixup = tech_fixup, - .send_html = tech_send_html, - .send_text = tech_send_text, - .send_image = tech_send_image, - .setoption = tech_setoption, - .queryoption = tech_queryoption, - //.bridged_channel = tech_bridged_channel, - .transfer = tech_transfer, -}; - - -static void woomera_close_socket(int *socket) -{ - - if (*socket > -1) { - close(*socket); - } - *socket = -1; -} - -static int woomera_message_reply_ok(woomera_message *wmsg) -{ - - if (!(wmsg->mval >= 200 && wmsg->mval <= 299)) { - return -1; - } - - return 0; -} - - -static void global_set_flag(int flags) -{ - private_object *tech_pvt; - - ASTOBJ_CONTAINER_TRAVERSE(&private_object_list, 1, do { - ASTOBJ_RDLOCK(iterator); - tech_pvt = iterator; - ast_set_flag(tech_pvt, flags); - ASTOBJ_UNLOCK(iterator); - } while(0)); -} - -static void woomera_send_progress(private_object *tech_pvt) -{ - struct ast_channel *owner = tech_get_owner(tech_pvt); - - if (tech_pvt->profile->progress_enable && owner){ - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "Sending Progress %s\n",tech_pvt->callid); - } - - ast_queue_control(owner, - AST_CONTROL_PROGRESS); - } -} - - -static uint32_t string_to_release(char *code) -{ - if (code) { - if (!strcasecmp(code, "CHANUNAVAIL")) { - return AST_CAUSE_REQUESTED_CHAN_UNAVAIL; - } - - if (!strcasecmp(code, "INVALID")) { - return AST_CAUSE_NORMAL_CIRCUIT_CONGESTION; - } - - if (!strcasecmp(code, "ERROR")) { - return AST_CAUSE_NORMAL_CIRCUIT_CONGESTION; - } - - if (!strcasecmp(code, "CONGESTION")) { - return AST_CAUSE_NORMAL_CIRCUIT_CONGESTION; - } - - if (!strcasecmp(code, "BUSY")) { - return AST_CAUSE_USER_BUSY; - } - - if (!strcasecmp(code, "NOANSWER")) { - return AST_CAUSE_NO_ANSWER; - } - - if (!strcasecmp(code, "ANSWER")) { - return AST_CAUSE_NORMAL_CLEARING; - } - - if (!strcasecmp(code, "CANCEL")) { - return AST_CAUSE_NORMAL_CIRCUIT_CONGESTION; - } - - if (!strcasecmp(code, "UNKNOWN")) { - return AST_CAUSE_NORMAL_CIRCUIT_CONGESTION; - } - } - return AST_CAUSE_NORMAL_CLEARING; -} - - -static void woomera_printf(woomera_profile *profile, int fd, char *fmt, ...) -{ - char *stuff; - int res = 0; - - if (fd < 0) { - if (globals.debug > 4) { - ast_log(LOG_ERROR, "Not gonna write to fd %d\n", fd); - } - return; - } - - va_list ap; - va_start(ap, fmt); -#ifdef SOLARIS - stuff = (char *)malloc(10240); - vsnprintf(stuff, 10240, fmt, ap); -#else - res = vasprintf(&stuff, fmt, ap); -#endif - va_end(ap); - if (res == -1) { - ast_log(LOG_ERROR, "Out of memory\n"); - } else { - if (profile && globals.debug) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "Send Message: {%s} [%s/%d]\n%s\n%s", profile->name, profile->woomera_host, profile->woomera_port, WOOMERA_DEBUG_LINE, stuff); - } - } - ast_carefulwrite(fd, stuff, strlen(stuff), 100); - free(stuff); - } - -} - -static char *woomera_message_header(woomera_message *wmsg, char *key) -{ - int x = 0; - char *value = NULL; - - -#if 0 - if (!strcasecmp(wmsg->command,"HANGUP")) { - ast_log(LOG_NOTICE, "Message Header for HANGUP\n"); - for (x = 0 ; x < wmsg->last ; x++) { - ast_log(LOG_NOTICE, "Name=%s Value=%s\n", - wmsg->names[x],wmsg->values[x]); - if (!strcasecmp(wmsg->names[x], key)) { - value = wmsg->values[x]; - break; - } - } - } -#endif - - for (x = 0 ; x < wmsg->last ; x++) { - if (!strcasecmp(wmsg->names[x], key)) { - value = wmsg->values[x]; - break; - } - } - - return value; -} - -static int woomera_enqueue_event(woomera_event_queue *event_queue, woomera_message *wmsg) -{ - woomera_message *new, *mptr; - - if ((new = malloc(sizeof(woomera_message)))) { - ast_mutex_lock(&event_queue->lock); - memcpy(new, wmsg, sizeof(woomera_message)); - new->next = NULL; - if (!event_queue->head) { - event_queue->head = new; - } else { - for (mptr = event_queue->head; mptr && mptr->next ; mptr = mptr->next); - mptr->next = new; - } - ast_mutex_unlock(&event_queue->lock); - return 1; - } else { - ast_log(LOG_ERROR, "Memory Allocation Error!\n"); - } - - return 0; -} - -static int woomera_dequeue_event(woomera_event_queue *event_queue, woomera_message *wmsg) -{ - woomera_message *mptr = NULL; - - ast_mutex_lock(&event_queue->lock); - if (event_queue->head) { - mptr = event_queue->head; - event_queue->head = mptr->next; - } - - if (mptr) { - memcpy(wmsg, mptr, sizeof(woomera_message)); - } - ast_mutex_unlock(&event_queue->lock); - - if (mptr){ - free(mptr); - return 1; - } else { - memset(wmsg, 0, sizeof(woomera_message)); - } - - return 0; -} - - - - -static int woomera_message_parse(int fd, woomera_message *wmsg, int timeout, - woomera_profile *profile, woomera_event_queue *event_queue) -{ - char *cur, *cr, *next = NULL, *eor = NULL; - char buf[2048]; - int res = 0, bytes = 0, sanity = 0; - struct timeval started, ended; - int elapsed, loops = 0; - int failto = 0; - - memset(wmsg, 0, sizeof(woomera_message)); - - if (fd < 0) { - return -1; - } - - gettimeofday(&started, NULL); - memset(buf, 0, sizeof(buf)); - - if (timeout < 0) { - timeout = abs(timeout); - failto = 1; - } else if(timeout == 0) { - timeout = -1; - } - - while (!(eor = strstr(buf, WOOMERA_RECORD_SEPARATOR))) { - - if (!profile->thread_running) { - return -1; - } - - if (globals.panic > 2) { - return -1; - } - /* Keep things moving. - Stupid Sockets -Homer Simpson */ - woomera_printf(NULL, fd, "%s", WOOMERA_RECORD_SEPARATOR); - - if((res = waitfor_socket(fd, (timeout > 0 ? timeout : 100)) > 0)) { - res = recv(fd, buf, sizeof(buf), MSG_PEEK); - if (res == 0) { - sanity++; - } else if (res < 0) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "{%s} error during packet retry #%d\n", profile->name, loops); - } - - return res; - } else if (loops && globals.debug) { - //ast_verbose(WOOMERA_DEBUG_PREFIX "{%s} Didnt get complete packet retry #%d\n", profile->name, loops); - woomera_printf(NULL, fd, "%s", WOOMERA_RECORD_SEPARATOR); - usleep(100); - } - - if (res > 0) { - sanity=0; - } - - } - - gettimeofday(&ended, NULL); - elapsed = (((ended.tv_sec * 1000) + ended.tv_usec / 1000) - ((started.tv_sec * 1000) + started.tv_usec / 1000)); - - if (res < 0) { - return res; - } - - if (sanity > 1000) { - if (globals.debug > 2) { - ast_log(LOG_ERROR, "{%s} Failed Sanity Check! [errors] chfd=%d\n", - profile->name,fd); - } - return -100; - } - - if (timeout > 0 && (elapsed > timeout)) { - return failto ? -1 : 0; - } - - loops++; - } - *eor = '\0'; - bytes = strlen(buf) + 4; - - memset(buf, 0, sizeof(buf)); - res = read(fd, buf, bytes); - next = buf; - - if (globals.debug) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "Receive Message: {%s} [%s/%d]\n%s\n%s", profile->name, profile->woomera_host, profile->woomera_port, WOOMERA_DEBUG_LINE, buf); - } - } - - while((cur = next)) { - if ((cr = strstr(cur, WOOMERA_LINE_SEPARATOR))) { - *cr = '\0'; - next = cr + (sizeof(WOOMERA_LINE_SEPARATOR) - 1); - if (!strcmp(next, WOOMERA_RECORD_SEPARATOR)) { - break; - } - } - - if (ast_strlen_zero(cur)) { - break; - } - - if (!wmsg->last) { - ast_set_flag(wmsg, WFLAG_EXISTS); - if (!strncasecmp(cur, "EVENT", 5)) { - cur += 6; - ast_set_flag(wmsg, WFLAG_EVENT); - - if (cur && (cr = strchr(cur, ' '))) { - char *id; - - *cr = '\0'; - cr++; - id = cr; - if (cr && (cr = strchr(cr, ' '))) { - *cr = '\0'; - cr++; - strncpy(wmsg->command_args, cr, WOOMERA_STRLEN); - } - if(id) { - ast_copy_string(wmsg->callid, id, sizeof(wmsg->callid)); - } - } - } else { - if (cur && (cur = strchr(cur, ' '))) { - *cur = '\0'; - cur++; - wmsg->mval = atoi(buf); - } else { - ast_log(LOG_NOTICE, "Malformed Message!\n"); - break; - } - } - if (cur) { - strncpy(wmsg->command, cur, WOOMERA_STRLEN); - } else { - ast_log(LOG_NOTICE, "Malformed Message!\n"); - break; - } - } else { - char *name, *val; - name = cur; - if ((val = strchr(name, ':'))) { - *val = '\0'; - val++; - while (*val == ' ') { - *val = '\0'; - val++; - } - strncpy(wmsg->values[wmsg->last-1], val, WOOMERA_STRLEN); - } - strncpy(wmsg->names[wmsg->last-1], name, WOOMERA_STRLEN); - if (name && val && !strcasecmp(name, "content-type")) { - ast_set_flag(wmsg, WFLAG_CONTENT); - bytes = atoi(val); - } - - if (name && val && !strcasecmp(name, "content-length")) { - ast_set_flag(wmsg, WFLAG_CONTENT); - bytes = atoi(val); - } - - - } - wmsg->last++; - } - - wmsg->last--; - - if (bytes && ast_test_flag(wmsg, WFLAG_CONTENT)) { - read(fd, wmsg->body, (bytes > sizeof(wmsg->body)) ? sizeof(wmsg->body) : bytes); - if (globals.debug) { - if (option_verbose > 2) { - ast_verbose("%s\n", wmsg->body); - } - } - } - - if (event_queue && ast_test_flag(wmsg, WFLAG_EVENT)) { - if (globals.debug) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "Queue Event: {%s} [%s]\n", profile->name, wmsg->command); - } - } - /* we don't want events we want a reply so we will stash them for later */ - woomera_enqueue_event(event_queue, wmsg); - - /* call ourself recursively to find the reply. we'll keep doing this as long we get events. - * wmsg will be overwritten but it's ok we just queued it. - */ - return woomera_message_parse(fd, wmsg, timeout, profile, event_queue); - - } else if (wmsg->mval > 99 && wmsg->mval < 200) { - /* reply in the 100's are nice but we need to wait for another reply - call ourself recursively to find the reply > 199 and forget this reply. - */ - return woomera_message_parse(fd, wmsg, timeout, profile, event_queue); - } else { - return ast_test_flag(wmsg, WFLAG_EXISTS); - } -} - -static int woomera_message_parse_wait(private_object *tech_pvt, woomera_message *wmsg) -{ - int err=0; - - for (;;) { - - if (ast_test_flag(tech_pvt, TFLAG_ABORT)){ - return -1; - } - - err=woomera_message_parse(tech_pvt->command_channel, - wmsg, - 100, - tech_pvt->profile, - &tech_pvt->event_queue); - - if (err == 0) { - /* This is a timeout */ - continue; - } - - break; - } - - return err; -} - - - -static int tech_create_read_socket(private_object *tech_pvt) -{ - int retry=0; - -retry_udp: - - ast_mutex_lock(&globals.woomera_port_lock); - globals.next_woomera_port++; - if (globals.next_woomera_port >= WOOMERA_MAX_PORT) { - globals.next_woomera_port = WOOMERA_MIN_PORT; - } - tech_pvt->port = globals.next_woomera_port; - ast_mutex_unlock(&globals.woomera_port_lock); - - if ((tech_pvt->udp_socket = create_udp_socket(tech_pvt->profile->audio_ip, tech_pvt->port, &tech_pvt->udpread, 0)) > -1) { - struct ast_channel *owner = tech_get_owner(tech_pvt); - if (owner) { - owner->fds[0] = tech_pvt->udp_socket; - } else { - ast_log(LOG_ERROR, "Tech_pvt has no OWNER! %i\n",__LINE__); - } - - } else { - - retry++; - if (retry <= 1) { - goto retry_udp; - } - - - if (globals.debug > 2) { - ast_log(LOG_ERROR, - "Error CREATING READ udp socket %s/%i %s (%p) %s %s\n", - tech_pvt->profile->audio_ip,tech_pvt->port, strerror(errno),tech_pvt,tech_pvt->callid, - ast_test_flag(tech_pvt, TFLAG_OUTBOUND) ? "OUT":"IN"); - } - } - return tech_pvt->udp_socket; -} - -#define WOOMERA_MAX_CALLS 600 -static struct private_object *tech_pvt_idx[WOOMERA_MAX_CALLS]; -static ast_mutex_t tech_pvt_idx_lock[WOOMERA_MAX_CALLS]; - -static int tech_activate(private_object *tech_pvt) -{ - int retry_activate_call=0; - woomera_message wmsg; - char *callid; - int err=0; - memset(&wmsg,0,sizeof(wmsg)); - -retry_activate_again: - - if (!tech_pvt) { - ast_log(LOG_ERROR, "Critical Error: Where's my tech_pvt?\n"); - return -1; - } - - if((connect_woomera(&tech_pvt->command_channel, tech_pvt->profile, 0)) > -1) { - if (globals.debug > 2) { - ast_log(LOG_NOTICE, - "Connected to woomera! chfd=%i port=%i dir=%s callid=%s Count=%i tpvt=%p\n", - tech_pvt->command_channel, - tech_pvt->port, - ast_test_flag(tech_pvt, TFLAG_OUTBOUND)?"OUT":"IN", - ast_test_flag(tech_pvt, TFLAG_OUTBOUND)?"N/A" : - tech_pvt->callid, - tech_pvt->call_count, - tech_pvt); - } - } else { - - if (retry_activate_call <= 3) { - retry_activate_call++; - goto retry_activate_again; - } - - - if (globals.debug > 1 && option_verbose > 1) { - ast_log(LOG_ERROR, "Error: %s call connect to TCP/Woomera Server! tpvt=%p: %s\n", - ast_test_flag(tech_pvt, TFLAG_OUTBOUND)?"Out":"In", - tech_pvt,strerror(errno)); - } - goto tech_activate_failed; - } - - retry_activate_call=0; - - if (ast_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - - if (strlen(tech_pvt->proto) > 1) { - woomera_printf(tech_pvt->profile, - tech_pvt->command_channel, - "CALL %s:%s%s" - "Raw-Audio: %s:%d%s" - "Local-Name: %s!%s%s" - "Local-Number:%s%s" - "Presentation:%d%s" - "Screening:%d%s" - "RDNIS:%s%s", - tech_pvt->proto, - tech_pvt->dest, - WOOMERA_LINE_SEPARATOR, - tech_pvt->profile->audio_ip, - tech_pvt->port, - WOOMERA_LINE_SEPARATOR, - tech_pvt->cid_name, - tech_pvt->cid_num, - WOOMERA_LINE_SEPARATOR, - tech_pvt->cid_num, - WOOMERA_LINE_SEPARATOR, - (tech_pvt->cid_pres>>5)&0x7, - WOOMERA_LINE_SEPARATOR, - tech_pvt->cid_pres&0xF, - WOOMERA_LINE_SEPARATOR, - tech_pvt->cid_rdnis?tech_pvt->cid_rdnis:"", - WOOMERA_RECORD_SEPARATOR - ); - - } else { - woomera_printf(tech_pvt->profile, - tech_pvt->command_channel, - "CALL %s%s" - "Raw-Audio: %s:%d%s" - "Local-Name: %s!%s%s" - "Local-Number:%s%s" - "Presentation:%d%s" - "Screening:%d%s" - "RDNIS:%s%s", - tech_pvt->dest, - WOOMERA_LINE_SEPARATOR, - tech_pvt->profile->audio_ip, - tech_pvt->port, - WOOMERA_LINE_SEPARATOR, - tech_pvt->cid_name, - tech_pvt->cid_num, - WOOMERA_LINE_SEPARATOR, - tech_pvt->cid_num, - WOOMERA_LINE_SEPARATOR, - (tech_pvt->cid_pres>>5)&0x7, - WOOMERA_LINE_SEPARATOR, - tech_pvt->cid_pres&0xF, - WOOMERA_LINE_SEPARATOR, - tech_pvt->cid_rdnis?tech_pvt->cid_rdnis:"", - WOOMERA_RECORD_SEPARATOR - ); - } - - err=woomera_message_parse_wait(tech_pvt,&wmsg); - if (err < 0 || woomera_message_reply_ok(&wmsg) != 0) { - ast_set_flag(tech_pvt, TFLAG_ABORT); - } - - callid = woomera_message_header(&wmsg, "Unique-Call-Id"); - if (callid) { - ast_copy_string(tech_pvt->callid,callid,sizeof(wmsg.callid)); - } - - } else { - ast_set_flag(tech_pvt, TFLAG_PARSE_INCOMING); - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "%s:%d Incoming Call %s tpvt=%p\n", - __FUNCTION__,__LINE__, - tech_pvt->callid,tech_pvt); - } - - woomera_printf(tech_pvt->profile, - tech_pvt->command_channel, - "PROCEED %s%s" - "Unique-Call-Id: %s%s", - tech_pvt->callid, - WOOMERA_LINE_SEPARATOR, - tech_pvt->callid, - WOOMERA_RECORD_SEPARATOR); - - err=woomera_message_parse_wait(tech_pvt,&wmsg); - if (err < 0 || woomera_message_reply_ok(&wmsg) != 0) { - ast_set_flag(tech_pvt, TFLAG_ABORT); - /* Do not hangup on main because - * socket connection has been - * established */ - } - } - - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "TECH ACTIVATE OK tech_pvt=%p\n",tech_pvt); - } - return 0; - -tech_activate_failed: - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "TECH ACTIVATE FAILED tech_pvt=%p\n",tech_pvt); - } - - woomera_close_socket(&tech_pvt->command_channel); - ast_set_flag(tech_pvt, TFLAG_ABORT); - - /* At this point we cannot estabilsh a woomer - * socket to the smg. The SMG still doesnt know - * about the incoming call that is now pending. - * We must send a message to SMG to hangup the call */ - - - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "Error: %s Call %s tpvt=%p Failed!\n", - ast_test_flag(tech_pvt, TFLAG_OUTBOUND) ? "OUT":"IN", - tech_pvt->callid,tech_pvt); - } - - return -1; - -} - -static int tech_init(private_object *tech_pvt, woomera_profile *profile, int flags) -{ - struct ast_channel *self = tech_get_owner(tech_pvt); - - gettimeofday(&tech_pvt->started, NULL); - - if (profile) { - tech_pvt->profile = profile; - } else { - ast_log(LOG_ERROR, "ERROR: No Tech profile on init!\n"); - ast_set_flag(tech_pvt, TFLAG_ABORT); - return -1; - } - - ast_set_flag(tech_pvt, flags); - - if (tech_pvt->udp_socket < 0) { - int rc; - rc=tech_create_read_socket(tech_pvt); - if (rc < 0){ - if (globals.debug > 2) { - ast_log(LOG_ERROR, "ERROR: Failed to create UDP Socket (%p)!\n", - tech_pvt); - } - ast_set_flag(tech_pvt, TFLAG_ABORT); - return -1; - } - } - - ast_set_flag(tech_pvt, flags); - - tech_pvt->coding = profile->coding; - self->nativeformats = tech_pvt->coding; - self->writeformat = self->rawwriteformat = self->readformat = tech_pvt->coding; - tech_pvt->frame.subclass = tech_pvt->coding; - ast_clear_flag(tech_pvt, TFLAG_CONFIRM_ANSWER); - ast_clear_flag(tech_pvt, TFLAG_CONFIRM_ANSWER_ENABLED); - ast_clear_flag(tech_pvt, TFLAG_ANSWER_RECEIVED); - - if (profile->dtmf_enable) { - - tech_pvt->dsp_features=0; - tech_pvt->dsp = ast_dsp_new(); - if (tech_pvt->dsp) { -#if 0 - i->dsp_features = features & ~DSP_PROGRESS_TALK; - - /* We cannot do progress detection until receives PROGRESS message */ - if (i->outgoing && (i->sig == SIG_PRI)) { - /* Remember requested DSP features, don't treat - talking as ANSWER */ - features = 0; - } -#endif - tech_pvt->dsp_features |= DSP_FEATURE_DTMF_DETECT; - //tech_pvt->dsp_features |= DSP_FEATURE_BUSY_DETECT; - //tech_pvt->dsp_features |= DSP_FEATURE_CALL_PROGRESS; - //tech_pvt->dsp_features |= DSP_FEATURE_FAX_DETECT; - ast_dsp_set_features(tech_pvt->dsp, tech_pvt->dsp_features); - ast_dsp_digitmode(tech_pvt->dsp, DSP_DIGITMODE_DTMF | DSP_DIGITMODE_RELAXDTMF); - tech_pvt->ast_dsp=1; - -#if 0 - if (!ast_strlen_zero(progzone)) - ast_dsp_set_call_progress_zone(tech_pvt->dsp, progzone); - if (i->busydetect && CANBUSYDETECT(i)) { - ast_dsp_set_busy_count(tech_pvt->dsp, i->busycount); - ast_dsp_set_busy_pattern(tech_pvt->dsp, i->busy_tonelength, ->busy_quietlength); - } -#endif - } - } - - if (profile && profile->faxdetect) { - tech_pvt->faxdetect=1; - } - - - if (profile->jb_enable) { -#ifdef AST_JB - /* Assign default jb conf to the new zt_pvt */ - memcpy(&tech_pvt->jbconf, &global_jbconf, sizeof(struct ast_jb_conf)); -<<<<<<< .mine - ast_jb_configure(self, &tech_pvt->jbconf); -======= - ast_jb_configure(self, &tech_pvt->jbconf); - - if (globals.debug > 1 && option_verbose > 10) { - ast_log(LOG_NOTICE, "%s: Cfg JitterBuffer (F=%i MS=%li Rs=%li Impl=%s)\n", - self->name, - tech_pvt->jbconf.flags, - tech_pvt->jbconf.max_size, - tech_pvt->jbconf.resync_threshold, - tech_pvt->jbconf.impl); - } ->>>>>>> .r41 -#else - ast_log(LOG_ERROR, "Asterisk Jitter Buffer Not Compiled!\n"); -#endif - } - - - /* Asterisk being asterisk and all allows approx 1 nanosecond - * to try and establish a connetion here before it starts crying. - * Now asterisk, being unsure of it's self will not enforce a lock while we work - * and after even a 1 second delay it will give up on the lock and mess everything up - * This stems from the fact that asterisk will scan it's list of channels constantly for - * silly reasons like tab completion and cli output. - * - * Anyway, since we've already spent that nanosecond with the previous line of code - * tech_create_read_socket(tech_pvt); to setup a read socket - * which, by the way, asterisk insists we have before going any furthur. - * So, in short, we are between a rock and a hard place and asterisk wants us to open a socket here - * but it too impaitent to wait for us to make sure it's ready so in the case of outgoing calls - * we will defer the rest of the socket establishment process to the monitor thread. This is, of course, common - * knowledge since asterisk abounds in documentation right?, sorry to bother you with all this! - */ - if (globals.more_threads) { - int err; - ast_set_flag(tech_pvt, TFLAG_ACTIVATE); - /* we're gonna try "wasting" a thread to do a better realtime monitoring */ - err=launch_tech_thread(tech_pvt); - if (err) { - ast_log(LOG_ERROR, "Error: Failed to lauch tech control thread\n"); - ast_clear_flag(tech_pvt, TFLAG_ACTIVATE); - ast_set_flag(tech_pvt, TFLAG_ABORT); - return -1; - } - - } else { - if (ast_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - ast_set_flag(tech_pvt, TFLAG_ACTIVATE); - } else { - tech_activate(tech_pvt); - } - } - - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "TECH INIT tech_pvt=%p c=%p (use=%i)\n", - tech_pvt,tech_pvt->owner,usecount()); - } - - return 0; -} - - - -static void tech_destroy(private_object *tech_pvt, struct ast_channel *owner) -{ - - ASTOBJ_CONTAINER_UNLINK(&private_object_list, tech_pvt); - - ast_set_flag(tech_pvt, TFLAG_DESTROY); - ast_set_flag(tech_pvt, TFLAG_ABORT); - - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "Tech Destroy callid=%s tpvt=%p %s/%d\n", - tech_pvt->callid, - tech_pvt, - tech_pvt->profile ? tech_pvt->profile->audio_ip : "NA", - tech_pvt->port); - } - - - if (tech_pvt->profile && tech_pvt->command_channel > -1) { - - if (globals.debug > 1 && option_verbose > 1) { - ast_log(LOG_NOTICE, "+++DESTROY sent HANGUP %s\n", - tech_pvt->callid); - } - woomera_printf(tech_pvt->profile, tech_pvt->command_channel, - "hangup %s%scause: %s%sQ931-Cause-Code: %d%sUnique-Call-Id: %s%s", - tech_pvt->callid, - WOOMERA_LINE_SEPARATOR, - tech_pvt->ds, - WOOMERA_LINE_SEPARATOR, - tech_pvt->pri_cause, - WOOMERA_LINE_SEPARATOR, - tech_pvt->callid, - WOOMERA_RECORD_SEPARATOR); - woomera_printf(tech_pvt->profile, tech_pvt->command_channel, - "bye%s" - "Unique-Call-Id: %s%s", - WOOMERA_LINE_SEPARATOR, - tech_pvt->callid, - WOOMERA_RECORD_SEPARATOR); - woomera_close_socket(&tech_pvt->command_channel); - } - - woomera_close_socket(&tech_pvt->command_channel); - woomera_close_socket(&tech_pvt->udp_socket); - - if (owner) { - struct ast_channel *chan=owner; - - if (!ast_test_flag(tech_pvt, TFLAG_PBX) && - !chan->pbx && - !ast_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "DESTROY Destroying Owner %p: ast_hangup()\n", - tech_pvt); - } - chan->tech_pvt = NULL; - tech_pvt->owner=NULL; - ast_hangup(chan); - } else { - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "DESTROY Destroying Owner %p: softhangup\n", - tech_pvt); - } - /* softhangup needs tech_pvt pointer */ - chan->tech_pvt = NULL; - my_ast_softhangup(chan, tech_pvt, AST_SOFTHANGUP_EXPLICIT); - } - tech_pvt->owner=NULL; - }else{ - tech_pvt->owner=NULL; - } - - /* Tech profile is allowed to be null in case the call - * is blocked from the call_count */ - -#if 0 - ast_log(LOG_NOTICE, "---- Call END %p %s ----------------------------\n", - tech_pvt,tech_pvt->callid); -#endif - - tech_count--; - if (tech_pvt->dsp){ - tech_pvt->dsp_features &= ~DSP_FEATURE_DTMF_DETECT; - ast_dsp_set_features(tech_pvt->dsp, tech_pvt->dsp_features); - tech_pvt->ast_dsp=0; - - free(tech_pvt->dsp); - tech_pvt->dsp=NULL; - } - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "DESTROY Exit tech_pvt=%p (use=%i)\n", - tech_pvt,usecount()); - } - - ast_mutex_destroy(&tech_pvt->iolock); - ast_mutex_destroy(&tech_pvt->event_queue.lock); - - if (tech_pvt->cid_rdnis) { - free(tech_pvt->cid_rdnis); - tech_pvt->cid_rdnis=NULL; - } - - free(tech_pvt); - ast_mutex_lock(&usecnt_lock); - usecnt--; - if (usecnt < 0) { - usecnt = 0; - } - ast_mutex_unlock(&usecnt_lock); -} - -#if 0 - -static int waitfor_socket(int fd, int timeout) -{ - struct pollfd pfds[1]; - int res; - int errflags = (POLLERR | POLLHUP | POLLNVAL); - - if (fd < 0) { - return -1; - } - - memset(&pfds[0], 0, sizeof(pfds[0])); - pfds[0].fd = fd; - pfds[0].events = POLLIN | errflags; - res = poll(pfds, 1, timeout); - if (res > 0) { - if ((pfds[0].revents & errflags)) { - res = -1; - } else if ((pfds[0].revents & POLLIN)) { - res = 1; - } else { - ast_log(LOG_ERROR, "System Error: Poll Event Error no event!\n"); - res = -1; - } - } - - return res; -} - -#else - -static int waitfor_socket(int fd, int timeout) -{ - struct pollfd pfds[1]; - int res; - - if (fd < 0) { - return -1; - } - - memset(&pfds[0], 0, sizeof(pfds[0])); - pfds[0].fd = fd; - pfds[0].events = POLLIN | POLLERR; - res = poll(pfds, 1, timeout); - if (res > 0) { - if ((pfds[0].revents & POLLERR)) { - res = -1; - } else if((pfds[0].revents & POLLIN)) { - res = 1; - } else { - res = -1; - } - } - - return res; -} - -#endif - - -static void *tech_monitor_thread(void *obj) -{ - private_object *tech_pvt; - woomera_message wmsg; - char tcallid[WOOMERA_STRLEN]; - int aborted=0; - - int res = 0; - - tech_pvt = obj; - - if (ast_test_flag(tech_pvt, TFLAG_TECHHANGUP)) { - ast_log(LOG_NOTICE, "Tech Monitor: Call stopped before thread up!\n"); - return NULL; - } - - memset(tcallid,0,sizeof(tcallid)); - memset(&wmsg,0,sizeof(wmsg)); - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "IN THREAD %s rxgain=%f txtain=%f\n", - tech_pvt->callid, - tech_pvt->profile->rxgain_val, - tech_pvt->profile->txgain_val); - } - ast_mutex_lock(&tech_pvt->profile->call_count_lock); - if (ast_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - tech_pvt->profile->call_out++; - } else { - tech_pvt->profile->call_in++; - } - tech_pvt->profile->call_count++; - ast_mutex_unlock(&tech_pvt->profile->call_count_lock); - - for(;;) { - - if (globals.panic) { - ast_set_flag(tech_pvt, TFLAG_ABORT); - } - - if (!tech_pvt->owner) { - ast_set_flag(tech_pvt, TFLAG_ABORT); - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "Thread lost Owner Chan %s %p\n", - tech_pvt->callid, - tech_pvt); - } - } - - - /* finish the deferred crap asterisk won't allow us to do live */ - if (ast_test_flag(tech_pvt, TFLAG_ABORT)) { - int timeout_cnt=0; - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "ABORT GOT HANGUP CmdCh=%i %s %s/%i\n", - tech_pvt->command_channel, tech_pvt->callid, - tech_pvt->profile ? tech_pvt->profile->audio_ip : "N/A", - tech_pvt->port); - } - - aborted|=1; - - /* Check for queued events, looking for HANGUP messages, - so we can return proper hangup cause */ - for (;;) { - if ((res = woomera_dequeue_event(&tech_pvt->event_queue, &wmsg))) { - woomera_check_event (tech_pvt, res, &wmsg); - } else { - break; - } - } - - ast_mutex_lock(&tech_pvt->profile->call_count_lock); - tech_pvt->profile->call_count--; - ast_mutex_unlock(&tech_pvt->profile->call_count_lock); - - if (tech_pvt->profile && tech_pvt->command_channel > -1) { - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "ABORT sent HANGUP on %s %p\n", - tech_pvt->callid, - tech_pvt); - } - aborted|=2; - woomera_printf(tech_pvt->profile, tech_pvt->command_channel, - "hangup %s%scause: %s%sQ931-Cause-Code: %d%sUnique-Call-Id: %s%s", - tech_pvt->callid, - WOOMERA_LINE_SEPARATOR, - tech_pvt->ds, - WOOMERA_LINE_SEPARATOR, - tech_pvt->pri_cause, - WOOMERA_LINE_SEPARATOR, - tech_pvt->callid, - WOOMERA_RECORD_SEPARATOR); - woomera_printf(tech_pvt->profile, tech_pvt->command_channel, - "bye%s" - "Unique-Call-Id: %s%s", - WOOMERA_LINE_SEPARATOR, - tech_pvt->callid, - WOOMERA_RECORD_SEPARATOR); - woomera_close_socket(&tech_pvt->command_channel); - } - - if (tech_pvt->udp_socket > -1) { - woomera_close_socket(&tech_pvt->udp_socket); - } - - - if (!ast_test_flag(tech_pvt, TFLAG_TECHHANGUP) && - ast_test_flag(tech_pvt, TFLAG_PBX)) { - struct ast_channel *owner = tech_get_owner(tech_pvt); - - if (owner) { - aborted|=4; - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "ABORT calling hangup on %s t=%p c=%p UP=%d\n", - tech_pvt->callid, - tech_pvt, - owner, - ast_test_flag(tech_pvt, TFLAG_UP)); - } - - while(tech_pvt->owner && - ast_mutex_trylock(&tech_pvt->owner->lock)) { - usleep(1); - } - - if ((owner=tech_pvt->owner)) { - tech_pvt->owner=NULL; - /* Issue a softhangup */ - ast_softhangup(owner, AST_SOFTHANGUP_DEV); - ast_mutex_unlock(&owner->lock); - } - } - } - - - /* Wait for tech_hangup to set this, so there is on - * race condition with asterisk */ - //ast_set_flag(tech_pvt, TFLAG_DESTROY); - - if (ast_test_flag(tech_pvt, TFLAG_PBX)) { - //ast_log(LOG_NOTICE,"Waiting for PBX to hangup!\n"); - while (!ast_test_flag(tech_pvt, TFLAG_DESTROY)) { - timeout_cnt++; - if (timeout_cnt > 10000) { //10sec timeout - struct ast_channel *owner = tech_get_owner(tech_pvt); - if (owner) { - owner->tech_pvt=NULL; - } - /* Five second timeout */ - ast_log(LOG_ERROR, "ERROR: Wait on destroy timedout! %s tech_pvt=%p Dir=%s\n", - tech_pvt->callid, tech_pvt, - ast_test_flag(tech_pvt, TFLAG_OUTBOUND)?"OUT":"IN" ); - - - ast_set_flag(tech_pvt, TFLAG_DESTROY); - break; - } - usleep(5000); - sched_yield(); - } - //ast_log(LOG_NOTICE,"Got PBX hangup!\n"); - ast_mutex_lock(&tech_pvt->profile->call_count_lock); - tech_pvt->profile->call_end++; - ast_mutex_unlock(&tech_pvt->profile->call_count_lock); - } else { - ast_mutex_lock(&tech_pvt->profile->call_count_lock); - tech_pvt->profile->call_abort++; - ast_mutex_unlock(&tech_pvt->profile->call_count_lock); - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "NOTE: Skipping Wait on destroy timedout! %s tech_pvt=%p\n", - tech_pvt->callid, tech_pvt); - } - ast_set_flag(tech_pvt, TFLAG_DESTROY); - } - - aborted|=8; - tech_destroy(tech_pvt,tech_get_owner(tech_pvt)); - tech_pvt = NULL; - break; - } - - - if (ast_test_flag(tech_pvt, TFLAG_TECHHANGUP) || !tech_pvt->owner) { - ast_set_flag(tech_pvt, TFLAG_DESTROY); - ast_set_flag(tech_pvt, TFLAG_ABORT); - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "Thread got HANGUP or no owner %s %p tpvt=%p\n", - tech_pvt->callid,tech_pvt,tech_pvt->owner); - } - goto tech_thread_continue; - } - - if (ast_test_flag(tech_pvt, TFLAG_ACTIVATE)) { - - struct ast_channel *owner; - int err; - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "ACTIVATE %s tpvt=%p\n", - tech_pvt->callid,tech_pvt); - } - ast_clear_flag(tech_pvt, TFLAG_ACTIVATE); - err=tech_activate(tech_pvt); - if (err < 0 || ast_test_flag(tech_pvt, TFLAG_ABORT)) { - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "ACTIVATE ABORT Ch=%d\n", - tech_pvt->command_channel); - } - ast_set_flag(tech_pvt, TFLAG_ABORT); - goto tech_thread_continue; - } - - - owner = tech_get_owner(tech_pvt); - if (owner) { - owner->hangupcause = AST_CAUSE_NORMAL_CLEARING; - } - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "ACTIVATE DONE %s tpvt=%p\n", - tech_pvt->callid,tech_pvt); - } - } - - if (ast_test_flag(tech_pvt, TFLAG_PARSE_INCOMING)) { - int err; - - ast_clear_flag(tech_pvt, TFLAG_PARSE_INCOMING); - ast_set_flag(tech_pvt, TFLAG_INCOMING); - - err=woomera_event_incoming (tech_pvt); - - if (err != 0) { - - woomera_printf(tech_pvt->profile, tech_pvt->command_channel, - "hangup %s%s" - "cause: INVALID_CALL_REFERENCE%s" - "Q931-Cause-Code: 81%s" - "Unique-Call-Id: %s%s", - tech_pvt->callid, - WOOMERA_LINE_SEPARATOR, - WOOMERA_LINE_SEPARATOR, - WOOMERA_LINE_SEPARATOR, - tech_pvt->callid, - WOOMERA_RECORD_SEPARATOR); - - /* Wait for Ack */ - woomera_message_parse_wait(tech_pvt,&wmsg); - - woomera_close_socket(&tech_pvt->command_channel); - - ast_set_flag(tech_pvt, TFLAG_ABORT); - goto tech_thread_continue; - - } else { - - woomera_printf(tech_pvt->profile, tech_pvt->command_channel, - "%s %s%s" - "Raw-Audio: %s:%d%s" - "Request-Audio: Raw%s" - "Unique-Call-Id: %s%s", - MEDIA_ANSWER, - tech_pvt->callid, - WOOMERA_LINE_SEPARATOR, - tech_pvt->profile->audio_ip, - tech_pvt->port, - WOOMERA_LINE_SEPARATOR, - WOOMERA_LINE_SEPARATOR, - tech_pvt->callid, - WOOMERA_RECORD_SEPARATOR); - - } - - /* Wait for Ack */ - if (woomera_message_parse_wait(tech_pvt,&wmsg) < 0) { - ast_set_flag(tech_pvt, TFLAG_ABORT); - ast_log(LOG_NOTICE, "MEDIA ANSWER ABORT Ch=%d\n", - tech_pvt->command_channel); - ast_copy_string(tech_pvt->ds, "PROTOCOL_ERROR", sizeof(tech_pvt->ds)); - tech_pvt->pri_cause=111; - goto tech_thread_continue; - } - - /* Confirm that the Ack is OK otherwise - * hangup */ - if (woomera_message_reply_ok(&wmsg) != 0) { - ast_set_flag(tech_pvt, TFLAG_ABORT); - goto tech_thread_continue; - } - - /* It is possible for ACCEPT to have media info - * This is how Early Media is started */ - err=woomera_event_media (tech_pvt, &wmsg); - if (err < 0) { - ast_set_flag(tech_pvt, TFLAG_ABORT); - goto tech_thread_continue; - } - } - - if (ast_test_flag(tech_pvt, TFLAG_ACCEPT) && - ast_test_flag(tech_pvt, TFLAG_INCOMING)) { - - ast_set_flag(tech_pvt,TFLAG_ACCEPTED); - ast_clear_flag(tech_pvt,TFLAG_ACCEPT); - - woomera_printf(tech_pvt->profile, tech_pvt->command_channel, - "ACCEPT %s%s" - "Raw-Audio: %s:%d%s" - "Request-Audio: Raw%s" - "Unique-Call-Id: %s%s", - tech_pvt->callid, - WOOMERA_LINE_SEPARATOR, - tech_pvt->profile->audio_ip, - tech_pvt->port, - WOOMERA_LINE_SEPARATOR, - WOOMERA_LINE_SEPARATOR, - tech_pvt->callid, - WOOMERA_RECORD_SEPARATOR); - - if(woomera_message_parse_wait(tech_pvt,&wmsg) < 0) { - ast_set_flag(tech_pvt, TFLAG_ABORT); - ast_log(LOG_NOTICE, "ACCEPT ABORT Ch=%d\n", - tech_pvt->command_channel); - ast_copy_string(tech_pvt->ds, "PROTOCOL_ERROR", sizeof(tech_pvt->ds)); - tech_pvt->pri_cause=111; - goto tech_thread_continue; - continue; - } - - } - - - if (ast_test_flag(tech_pvt, TFLAG_ANSWER)) { - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "ANSWER %s tpvt=%p\n", - tech_pvt->callid,tech_pvt); - } - ast_clear_flag(tech_pvt, TFLAG_ANSWER); - - if (ast_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - ast_log(LOG_ERROR,"Error: ANSWER on OUTBOUND Call! (skipped) %s\n", - tech_pvt->callid); - } else { -#ifdef USE_ANSWER - woomera_printf(tech_pvt->profile, tech_pvt->command_channel, - "ANSWER %s%s" - "Unique-Call-Id: %s%s", - tech_pvt->callid, - WOOMERA_LINE_SEPARATOR, - tech_pvt->callid, - WOOMERA_RECORD_SEPARATOR); - - if(woomera_message_parse_wait(tech_pvt,&wmsg) < 0) { - ast_set_flag(tech_pvt, TFLAG_ABORT); - ast_log(LOG_NOTICE, "ANSWER ABORT Ch=%d\n", - tech_pvt->command_channel); - ast_copy_string(tech_pvt->ds, "PROTOCOL_ERROR", sizeof(tech_pvt->ds)); - tech_pvt->pri_cause=111; - goto tech_thread_continue; - continue; - } - - ast_mutex_lock(&tech_pvt->profile->call_count_lock); - tech_pvt->profile->call_ok++; - ast_mutex_unlock(&tech_pvt->profile->call_count_lock); -#endif - } - } - - if (ast_test_flag(tech_pvt, TFLAG_DTMF)) { - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "DTMF %s tpvt=%p %s\n", - tech_pvt->callid,tech_pvt,tech_pvt->dtmfbuf); - } - - //DIALECT - ast_mutex_lock(&tech_pvt->iolock); -#if 0 - woomera_printf(tech_pvt->profile, tech_pvt->command_channel, - "DTMF %s %s%s", - tech_pvt->callid, - tech_pvt->dtmfbuf, - WOOMERA_LINE_SEPARATOR); -#else - woomera_printf(tech_pvt->profile, tech_pvt->command_channel, - "DTMF %sUnique-Call-Id:%s%sContent-Length:%d%s%s%s%s", - WOOMERA_LINE_SEPARATOR, - tech_pvt->callid, - WOOMERA_LINE_SEPARATOR, - strlen(tech_pvt->dtmfbuf), - WOOMERA_LINE_SEPARATOR, - WOOMERA_LINE_SEPARATOR, - tech_pvt->dtmfbuf, - WOOMERA_RECORD_SEPARATOR); -#endif - - ast_clear_flag(tech_pvt, TFLAG_DTMF); - memset(tech_pvt->dtmfbuf, 0, sizeof(tech_pvt->dtmfbuf)); - ast_mutex_unlock(&tech_pvt->iolock); - - if (woomera_message_parse_wait(tech_pvt,&wmsg) < 0) { - ast_set_flag(tech_pvt, TFLAG_ABORT); - ast_log(LOG_NOTICE, "DTMF ABORT Ch=%d\n", - tech_pvt->command_channel); - ast_copy_string(tech_pvt->ds, "PROTOCOL_ERROR", sizeof(tech_pvt->ds)); - tech_pvt->pri_cause=111; - goto tech_thread_continue; - continue; - } - } - - if(tech_pvt->timeout) { - struct timeval now; - int elapsed; - gettimeofday(&now, NULL); - elapsed = (((now.tv_sec * 1000) + now.tv_usec / 1000) - - ((tech_pvt->started.tv_sec * 1000) + tech_pvt->started.tv_usec / 1000)); - if (elapsed > tech_pvt->timeout) { - /* call timed out! */ - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "CALL TIMED OUT %s tpvt=%p\n", - tech_pvt->callid,tech_pvt); - } - ast_set_flag(tech_pvt, TFLAG_ABORT); - ast_copy_string(tech_pvt->ds, "RECOVERY_ON_TIMER_EXPIRE", sizeof(tech_pvt->ds)); - tech_pvt->pri_cause=102; - } - } - - if (globals.debug > 2) { - if (tcallid[0] == 0) { - strncpy(tcallid,tech_pvt->callid,sizeof(tcallid)-1); - } - } - - if (tech_pvt->command_channel < 0) { - if (!globals.more_threads) { - goto tech_thread_continue; - continue; - } else { - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "No Command Channel %s tpvt=%p\n", - tech_pvt->callid,tech_pvt); - } - ast_copy_string(tech_pvt->ds, "REQUESTED_CHAN_UNAVAIL", sizeof(tech_pvt->ds)); - tech_pvt->pri_cause=44; - ast_set_flag(tech_pvt, TFLAG_ABORT); - goto tech_thread_continue; - continue; - } - } - /* Check for events */ - if((res = woomera_dequeue_event(&tech_pvt->event_queue, &wmsg)) || - (res = woomera_message_parse(tech_pvt->command_channel, - &wmsg, - 100, - tech_pvt->profile, - NULL - ))) { - - woomera_check_event (tech_pvt, res, &wmsg); - if (ast_test_flag(tech_pvt, TFLAG_ABORT)) { - continue; - } - - } - if (globals.debug > 4) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "CHECK {%s} (%d) %s\n", - tech_pvt->profile->name, - res,tech_pvt->callid); - } - } - -tech_thread_continue: - - if (!globals.more_threads) { - ast_log(LOG_NOTICE, "EXITING THREAD on more threads %s\n", - tcallid); - break; - } - - } - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "OUT THREAD %s 0x%X\n",tcallid,aborted); - } - - return NULL; -} - -static int woomera_profile_thread_running(woomera_profile *profile, int set, int new) -{ - int running = 0; - - ast_mutex_lock(&profile->iolock); - if (set) { - profile->thread_running = new; - } - running = profile->thread_running; - ast_mutex_unlock(&profile->iolock); - return running; - -} - -static int woomera_locate_socket(woomera_profile *profile, int *woomera_socket) -{ - woomera_message wmsg; - - memset(&wmsg,0,sizeof(wmsg)); - - for (;;) { - - while (connect_woomera(woomera_socket, profile, 0) < 0) { - if(!woomera_profile_thread_running(profile, 0, 0)) { - break; - } - if (globals.panic > 2) { - break; - } - ast_log(LOG_NOTICE, - "Woomera {%s} Cannot Reconnect! retry in 5 seconds...\n", - profile->name); - - /* When we establish connection update smg version */ - smgversion_init=0; - sleep(5); - } - - if (*woomera_socket > -1) { - if (ast_test_flag(profile, PFLAG_INBOUND)) { - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "Woomera Master Socket \n"); - } - woomera_printf(profile, *woomera_socket, "LISTEN MASTER%s", WOOMERA_RECORD_SEPARATOR); - if (woomera_message_parse(*woomera_socket, - &wmsg, - WOOMERA_HARD_TIMEOUT, - profile, - &profile->event_queue - ) < 0) { - ast_log(LOG_ERROR, "{%s} %s:%d HELP! Woomera is broken!\n", - profile->name,__FUNCTION__,__LINE__); - if (*woomera_socket > -1) { - woomera_close_socket(woomera_socket); - } - continue; - } - } - - } - usleep(100); - break; - } - return *woomera_socket; -} - -static void tech_monitor_in_one_thread(void) -{ - private_object *tech_pvt; - - ASTOBJ_CONTAINER_TRAVERSE(&private_object_list, 1, do { - ASTOBJ_RDLOCK(iterator); - tech_pvt = iterator; - tech_monitor_thread(tech_pvt); - ASTOBJ_UNLOCK(iterator); - } while(0)); -} - -static void *woomera_thread_run(void *obj) -{ - - int woomera_socket = -1, res = 0, res2=0; - woomera_message wmsg; - woomera_profile *profile; - - memset(&wmsg,0,sizeof(wmsg)); - - profile = obj; - ast_log(LOG_NOTICE, "Started Woomera Thread {%s}.\n", profile->name); - - profile->thread_running = 1; - - - while(woomera_profile_thread_running(profile, 0, 0)) { - /* listen on socket and handle events */ - - if (globals.panic > 2) { - break; - } - - if (globals.panic == 2) { - ast_log(LOG_NOTICE, "Woomera is disabled!\n"); - sleep(5); - continue; - } - - if (woomera_socket < 0) { - if (woomera_locate_socket(profile, &woomera_socket)) { - globals.panic = 0; - } - if (!woomera_profile_thread_running(profile, 0, 0)) { - break; - } - profile->woomera_socket=woomera_socket; - ast_log(LOG_NOTICE, "Woomera Thread Up {%s} %s/%d\n", - profile->name, profile->woomera_host, profile->woomera_port); - - } - - if (globals.panic) { - if (globals.panic != 2) { - ast_log(LOG_ERROR, "Help I'm in a state of panic!\n"); - } - if (woomera_socket > -1) { - woomera_close_socket(&woomera_socket); - } - continue; - } - if (!globals.more_threads) { - if (woomera_socket > -1) { - tech_monitor_in_one_thread(); - } - } - - if ((res = woomera_dequeue_event(&profile->event_queue, &wmsg) || - (res2 = woomera_message_parse(woomera_socket, - &wmsg, - /* if we are not stingy with threads we can block forever */ - globals.more_threads ? 0 : 500, - profile, - NULL - )))) { - - - if (res2 < 0) { - ast_log(LOG_ERROR, "{%s} HELP! I lost my connection to woomera!\n", profile->name); - if (woomera_socket > -1) { - woomera_close_socket(&woomera_socket); - } - global_set_flag(TFLAG_ABORT); - if (globals.panic > 2) { - break; - } - - continue; - - if (woomera_socket > -1) { - if (ast_test_flag(profile, PFLAG_INBOUND)) { - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "%s:%d Incoming Call \n",__FUNCTION__,__LINE__); - } - -#if 0 -/* We only want a single listener */ - woomera_printf(profile, woomera_socket, "LISTEN%s", WOOMERA_RECORD_SEPARATOR); - if(woomera_message_parse(woomera_socket, - &wmsg, - WOOMERA_HARD_TIMEOUT, - profile, - &profile->event_queue - ) < 0) { - ast_log(LOG_ERROR, "{%s} %s:%d HELP! Woomera is broken!\n", profile->name,__FUNCTION__,__LINE__); - woomera_close_socket(&woomera_socket); - } -#endif - } - if (woomera_socket > -1) { - ast_log(LOG_NOTICE, "Woomera Thread Up {%s} %s/%d\n", profile->name, profile->woomera_host, profile->woomera_port); - } - } - continue; - } - - if (!strcasecmp(wmsg.command, "INCOMING")) { - - int err=1; - int cause = 0; - struct ast_channel *inchan; - char *name = "Woomera"; - - if (!(name = woomera_message_header(&wmsg, "Channel-Name"))) { - name = woomera_message_header(&wmsg,"Remote-Address"); - } - - if (!name) { - name=wmsg.callid; - } - - if (!name) { - name="smg"; - } - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "NEW INBOUND CALL %s!\n",wmsg.callid); - } - - if ((inchan = woomera_new(WOOMERA_CHAN_NAME, profile->coding, name, &cause, profile))) { - private_object *tech_pvt; - char *callid; - tech_pvt = inchan->tech_pvt; - - /* Save the call id */ - tech_pvt->call_info = wmsg; - memcpy(tech_pvt->callid,wmsg.callid,sizeof(tech_pvt->callid)); - - callid = woomera_message_header(&wmsg, "Unique-Call-Id"); - if (callid) { - ast_copy_string(tech_pvt->callid, - callid,sizeof(wmsg.callid)); - } - - err=tech_init(tech_pvt, profile, TFLAG_INBOUND); - if (err) { - if(globals.debug > 2) { - ast_log(LOG_ERROR, "Error: Inbound Call Failed %s %p\n", - wmsg.callid, - tech_pvt); - } - tech_destroy(tech_pvt,inchan); - } - } else { - ast_log(LOG_ERROR, "Cannot Create new Inbound Channel!\n"); - } - - /* It is the job of the server to timeout on this call - if the call is not started */ - } - } - if(globals.debug > 4) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "Main Thread {%s} Select Return %d\n", profile->name, res); - } - } - usleep(100); - } - - - if (woomera_socket > -1) { - woomera_printf(profile, woomera_socket, "BYE%s", WOOMERA_RECORD_SEPARATOR); - if(woomera_message_parse(woomera_socket, - &wmsg, - WOOMERA_HARD_TIMEOUT, - profile, - &profile->event_queue - ) < 0) { - } - woomera_close_socket(&woomera_socket); - } - - ast_set_flag(profile, PFLAG_DISABLED); - - ast_log(LOG_NOTICE, "Ended Woomera Thread {%s}.\n", profile->name); - woomera_profile_thread_running(profile, 1, -1); - return NULL; -} - -static void launch_woomera_thread(woomera_profile *profile) -{ - pthread_attr_t attr; - int result = 0; - - result = pthread_attr_init(&attr); - pthread_attr_setschedpolicy(&attr, SCHED_RR); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - result = ast_pthread_create(&profile->thread, &attr, woomera_thread_run, profile); - result = pthread_attr_destroy(&attr); -} - - -static int launch_tech_thread(private_object *tech_pvt) -{ - pthread_attr_t attr; - int result = 0; - - if (globals.debug > 2) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++LAUCN TECH THREAD\n"); - } - } - - if (ast_test_flag(tech_pvt, TFLAG_TECHHANGUP)) { - /* Sanity check should never happen */ - ast_log(LOG_NOTICE,"Tech Thread failed call already hangup!\n"); - return -1; - } - - result = pthread_attr_init(&attr); - pthread_attr_setschedpolicy(&attr, SCHED_RR); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - ast_set_flag(tech_pvt, TFLAG_INTHREAD); - result = ast_pthread_create(&tech_pvt->thread, &attr, tech_monitor_thread, tech_pvt); - if (result) { - ast_clear_flag(tech_pvt, TFLAG_INTHREAD); - ast_log(LOG_ERROR, "Error: Failed to launch tech thread %s\n", - strerror(errno)); - } - pthread_attr_destroy(&attr); - - return result; -} - -static void woomera_config_gain(woomera_profile *profile, float gain_val, int rx) -{ - int j; - int k; - float linear_gain = pow(10.0, gain_val / 20.0); - unsigned char *gain; - - if (profile->coding == AST_FORMAT_SLINEAR){ - ast_log(LOG_WARNING, "Coding not specified, %s value ignored\n", (rx)? "rxgain":"txgain"); - return; - } - - - if (gain_val == 0) { - goto woomera_config_gain_skip; - } - if (rx) { - gain = profile->rxgain; - } else { - gain = profile->txgain; - } - - switch (profile->coding) { - - case AST_FORMAT_ALAW: - for (j = 0; j < 256; j++) { - if (gain_val) { - k = (int) (((float) alaw_to_linear(j)) * linear_gain); - if (k > 32767) k = 32767; - if (k < -32767) k = -32767; - gain[j] = linear_to_alaw(k); - } else { - gain[j] = j; - } - } - break; - case AST_FORMAT_ULAW: - for (j = 0; j < 256; j++) { - if (gain_val) { - k = (int) (((float) ulaw_to_linear(j)) * linear_gain); - if (k > 32767) k = 32767; - if (k < -32767) k = -32767; - gain[j] = linear_to_ulaw(k); - } else { - gain[j] = j; - } - } - break; - } - -woomera_config_gain_skip: - - if (rx) { - profile->rxgain_val=gain_val; - } else { - profile->txgain_val=gain_val; - } - -} - -static void destroy_woomera_profile(woomera_profile *profile) -{ - int i; - if (profile && ast_test_flag(profile, PFLAG_DYNAMIC)) { - for ( i = 0; i <= WOOMERA_MAX_TRUNKGROUPS; i++){ - if(profile->tg_context[i] != NULL){ - free(profile->tg_context[i]); - } - if(profile->tg_language[i] != NULL){ - free(profile->tg_language[i]); - } - } - ast_mutex_destroy(&profile->iolock); - ast_mutex_destroy(&profile->call_count_lock); - ast_mutex_destroy(&profile->event_queue.lock); - free(profile); - } -} - -static woomera_profile *clone_woomera_profile(woomera_profile *new_profile, woomera_profile *default_profile) -{ - return memcpy(new_profile, default_profile, sizeof(woomera_profile)); -} - -static woomera_profile *create_woomera_profile(woomera_profile *default_profile) -{ - woomera_profile *profile; - - if((profile = malloc(sizeof(woomera_profile)))) { - clone_woomera_profile(profile, default_profile); - ast_mutex_init(&profile->iolock); - ast_mutex_init(&profile->call_count_lock); - ast_mutex_init(&profile->event_queue.lock); - ast_set_flag(profile, PFLAG_DYNAMIC); - } - return profile; -} - -static int config_woomera(void) -{ - struct ast_config *cfg; - char *entry; - struct ast_variable *v; - woomera_profile *profile; - int default_context_set = 0; - int count = 0; - - memset(&default_profile, 0, sizeof(default_profile)); -#ifdef AST_JB - memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf)); -#endif - - default_profile.coding=0; - - if ((cfg = ast_config_load(configfile))) { - for (entry = ast_category_browse(cfg, NULL); entry != NULL; entry = ast_category_browse(cfg, entry)) { - if (strcmp(entry, "settings") == 0) { - - for (v = ast_variable_browse(cfg, entry); v ; v = v->next) { - - if (!strcmp(v->name, "debug")) { - globals.debug = atoi(v->value); - } else if (!strcmp(v->name, "more_threads")) { - globals.more_threads = ast_true(v->value); - } -#ifdef AST_JB - if (ast_jb_read_conf(&global_jbconf, v->name, v->value) == 0) { - ast_log(LOG_NOTICE, "Woomera AST JB Opt %s = %s \n", - v->name,v->value); - continue; - } -#endif - } - - - - } else { - int new = 0; - float gain; - count++; - if (!strcmp(entry, "default")) { - profile = &default_profile; - } else { - if((profile = ASTOBJ_CONTAINER_FIND(&woomera_profile_list, entry))) { - clone_woomera_profile(profile, &default_profile); - } else { - if((profile = create_woomera_profile(&default_profile))) { - new = 1; - } else { - ast_log(LOG_ERROR, "Memory Error!\n"); - } - } - } - strncpy(profile->name, entry, sizeof(profile->name) - 1); - profile->coding=AST_FORMAT_SLINEAR; - - /*default is inbound and outbound enabled */ - ast_set_flag(profile, PFLAG_INBOUND | PFLAG_OUTBOUND); - for (v = ast_variable_browse(cfg, entry); v ; v = v->next) { - if (!strcmp(v->name, "audio_ip")) { - strncpy(profile->audio_ip, v->value, sizeof(profile->audio_ip) - 1); - } else if (!strcmp(v->name, "host")) { - strncpy(profile->woomera_host, v->value, sizeof(profile->woomera_host) - 1); - } else if (!strcmp(v->name, "max_calls")) { - int max = atoi(v->value); - if (max > 0) { - profile->max_calls = max; - } - } else if (!strcmp(v->name, "port")) { - profile->woomera_port = atoi(v->value); - } else if (!strcmp(v->name, "disabled")) { - ast_set2_flag(profile, ast_true(v->value), PFLAG_DISABLED); - } else if (!strcmp(v->name, "inbound")) { - if (ast_false(v->value)) { - ast_clear_flag(profile, PFLAG_INBOUND); - } - } else if (!strcmp(v->name, "outbound")) { - if (ast_false(v->value)) { - ast_clear_flag(profile, PFLAG_OUTBOUND); - } - } else if (!strcmp(v->name, "context")) { - if(!default_context_set){ - default_context_set=1; - strncpy(profile->default_context, v->value, sizeof(profile->default_context) - 1); - } - strncpy(profile->context, v->value, sizeof(profile->context) - 1); - } else if (!strcmp(v->name, "default_context")) { - default_context_set=1; - strncpy(profile->default_context, v->value, sizeof(profile->default_context) - 1); - } else if (!strcmp(v->name, "group")) { - int group_num = atoi(v->value); - if (group_num < 0) { - ast_log(LOG_ERROR, "Invalid group:%d (less than zero) - ignoring\n", group_num); - } else if (group_num > WOOMERA_MAX_TRUNKGROUPS){ - ast_log(LOG_ERROR, "Invalid trunkgroup:%d (exceeds max:%d) -ignoring\n", group_num, WOOMERA_MAX_TRUNKGROUPS); - } else { - if(profile->tg_context[group_num] != NULL){ - free(profile->tg_context[group_num]); - } - profile->tg_context[group_num] = strdup(profile->context); - - if(profile->tg_language[group_num] != NULL){ - free(profile->tg_language[group_num]); - } - if(strlen(profile->language)){ - profile->tg_language[group_num] = strdup(profile->language); - } - } - } else if (!strcmp(v->name, "language")) { - strncpy(profile->language, v->value, sizeof(profile->language) - 1); - } else if (!strcmp(v->name, "dtmf_enable")) { - profile->dtmf_enable = atoi(v->value); - - } else if (!strcmp(v->name, "jb_enable")) { - profile->jb_enable = atoi(v->value); - ast_log(LOG_NOTICE, "Profile {%s} Jitter Buffer %s %p \n", - entry,profile->jb_enable?"Enabled":"Disabled",profile); - - } else if (!strcmp(v->name, "jbenable")) { - profile->jb_enable = atoi(v->value); - ast_log(LOG_NOTICE, "Profile {%s} Jitter Buffer %s %p\n", - entry,profile->jb_enable?"Enabled":"Disabled",profile); - - } else if (!strcmp(v->name, "progress_enable")) { - profile->progress_enable = atoi(v->value); - - } else if (!strcmp(v->name, "coding")) { - if (strcmp(v->value, "alaw") == 0) { - profile->coding=AST_FORMAT_ALAW; - } - if (strcmp(v->value, "ulaw") == 0) { - profile->coding=AST_FORMAT_ULAW; - } - } else if (!strcmp(v->name, "rxgain") && profile->coding) { - if (sscanf(v->value, "%f", &gain) != 1) { - ast_log(LOG_NOTICE, "Invalid rxgain: %s\n", v->value); - } else { - woomera_config_gain(profile,gain,1); - } - } else if (!strcmp(v->name, "txgain") && profile->coding) { - if (sscanf(v->value, "%f", &gain) != 1) { - ast_log(LOG_NOTICE, "Invalid txgain: %s\n", v->value); - } else { - woomera_config_gain(profile,gain,0); - } - } - } - - ASTOBJ_CONTAINER_LINK(&woomera_profile_list, profile); - } - } - ast_config_destroy(cfg); - } else { - return 0; - } - - return count; - -} - -static int create_udp_socket(char *ip, int port, struct sockaddr_in *sockaddr, int client) -{ - int rc, sd = -1; - struct sockaddr_in servAddr, *addr, cliAddr; - struct hostent hps, *hp; - struct hostent *result; - char buf[512]; - int err=0; - - memset(&hps,0,sizeof(hps)); - hp=&hps; - - - if(sockaddr) { - addr = sockaddr; - } else { - addr = &servAddr; - } - - - if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) > -1) { - - gethostbyname_r(ip, hp, buf, sizeof(buf), &result, &err); - if (result) { - - addr->sin_family = hp->h_addrtype; - memcpy((char *) &addr->sin_addr.s_addr, hp->h_addr_list[0], hp->h_length); - addr->sin_port = htons(port); - - if (globals.debug > 4) { - ast_log(LOG_NOTICE,"MEDIA UdpRead IP=%s/%d len=%i %d.%d.%d.%d\n", - ip,port, - hp->h_length, - hp->h_addr_list[0][0], - hp->h_addr_list[0][1], - hp->h_addr_list[0][2], - hp->h_addr_list[0][3]); - } - - if (client) { - cliAddr.sin_family = AF_INET; - cliAddr.sin_addr.s_addr = htonl(INADDR_ANY); - cliAddr.sin_port = htons(0); - rc = bind(sd, (struct sockaddr *) &cliAddr, sizeof(cliAddr)); - } else { - rc = bind(sd, (struct sockaddr *) addr, sizeof(cliAddr)); - } - if (rc < 0) { - - if (globals.debug > 2) { - ast_log(LOG_ERROR, - "Error opening udp socket %s/%i %s\n", - ip,port, strerror(errno)); - } - - woomera_close_socket(&sd); - - } else if (globals.debug > 2) { - - ast_log(LOG_NOTICE, "Socket Binded %s to %s/%d\n", - client ? "client" : "server", ip, port); - } - - } else { - if (globals.debug > 2) { - ast_log(LOG_ERROR, - "Error opening udp: gethostbyname failed %s/%i %s\n", - ip,port, strerror(errno)); - } - - woomera_close_socket(&sd); - } - } - - return sd; -} - - -static int connect_woomera(int *new_socket, woomera_profile *profile, int flags) -{ - struct sockaddr_in localAddr, remoteAddr; - struct hostent *hp, *result; - struct hostent ahp; - int res = 0, err=0; - hp=&ahp; - char buf[512]; - - *new_socket=-1; - - gethostbyname_r(profile->woomera_host, hp, buf, sizeof(buf), &result, &err); - if (result) { - remoteAddr.sin_family = hp->h_addrtype; - memcpy((char *) &remoteAddr.sin_addr.s_addr, hp->h_addr_list[0], hp->h_length); - remoteAddr.sin_port = htons(profile->woomera_port); - do { - /* create socket */ - *new_socket = socket(AF_INET, SOCK_STREAM, 0); - if (*new_socket < 0) { - ast_log(LOG_ERROR, "cannot open socket to %s/%d\n", profile->woomera_host, profile->woomera_port); - res = 0; - break; - } - - /* bind any port number */ - localAddr.sin_family = AF_INET; - localAddr.sin_addr.s_addr = htonl(INADDR_ANY); - localAddr.sin_port = htons(0); - - res = bind(*new_socket, (struct sockaddr *) &localAddr, sizeof(localAddr)); - if (res < 0) { - ast_log(LOG_ERROR, "cannot bind to %s/%d\n", profile->woomera_host, profile->woomera_port); - woomera_close_socket(new_socket); - res = 0; - break; - } - - /* connect to server */ - res = connect(*new_socket, (struct sockaddr *) &remoteAddr, sizeof(remoteAddr)); - if (res < 0) { - ast_log(LOG_ERROR, "cannot connect to {%s} %s/%d\n", profile->name, profile->woomera_host, profile->woomera_port); - res = 0; - woomera_close_socket(new_socket); - break; - } - res = 1; - } while(0); - - } else { - if (globals.debug > 2) { - ast_log(LOG_ERROR, "gethost failed connect to {%s} %s/%d\n", - profile->name, profile->woomera_host, profile->woomera_port); - } - res = 0; - } - if (res > 0) { - int flag = 1; - woomera_message wmsg; - memset(&wmsg,0,sizeof(wmsg)); - - /* disable nagle's algorythm */ - res = setsockopt(*new_socket, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int)); - - - if (!(flags & WCFLAG_NOWAIT)) { - /* kickstart the session waiting for a HELLO */ - woomera_printf(NULL, *new_socket, "%s", WOOMERA_RECORD_SEPARATOR); - - if ((res = woomera_message_parse(*new_socket, - &wmsg, - WOOMERA_HARD_TIMEOUT, - profile, - NULL - )) < 0) { - ast_log(LOG_ERROR, "{%s} Timed out waiting for a hello from woomera!\n", profile->name); - woomera_close_socket(new_socket); - } - - if (res > 0 && strcasecmp(wmsg.command, "HELLO")) { - ast_log(LOG_ERROR, "{%s} unexpected reply [%s] while waiting for a hello from woomera!\n", profile->name, wmsg.command); - woomera_close_socket(new_socket); - - }else{ - char *audio_format; - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "Woomera Got HELLO on connect! %s SMG Version %s\n", profile->name,woomera_message_header(&wmsg, "Version")); - } - if (!smgversion_init && woomera_message_header(&wmsg, "Version")) { - smgversion_init=1; - strncpy(smgversion, - woomera_message_header(&wmsg, "Version"), - sizeof(smgversion)-1); - } - - audio_format = woomera_message_header(&wmsg, "Raw-Format"); - if (!audio_format) { - audio_format = woomera_message_header(&wmsg, "Raw-Audio-Format"); - } - if (audio_format) { - - profile->coding=AST_FORMAT_SLINEAR; - - if (strncasecmp(audio_format,"PCM-16",20) == 0){ - profile->coding=AST_FORMAT_SLINEAR; - } else if (strncasecmp(audio_format,"ULAW",15) == 0) { - profile->coding=AST_FORMAT_ULAW; - } else if (strncasecmp(audio_format,"ALAW",15) == 0) { - profile->coding=AST_FORMAT_ALAW; - } else { - ast_log(LOG_ERROR, "Error: Invalid Raw-Format %s\n", - audio_format); - } - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "Setting RAW Format to %s %i (p%i:u%i:a%i)\n", - audio_format, profile->coding, - AST_FORMAT_SLINEAR,AST_FORMAT_ULAW,AST_FORMAT_ALAW); - } - } - } - } - - } else { - if (globals.debug > 2) { - ast_log(LOG_ERROR, "Woomera {%s} connection failed: %s/%d\n", - profile->name, profile->woomera_host, profile->woomera_port); - ast_log(LOG_ERROR, "Woomera {%s} connection failed: %s\n", - profile->name, strerror(errno)); - } - woomera_close_socket(new_socket); - } - - return *new_socket; -} - -static int init_woomera(void) -{ - woomera_profile *profile; - ast_mutex_lock(&lock); - - if (!config_woomera()) { - ast_mutex_unlock(&lock); - return 0; - } - - ASTOBJ_CONTAINER_TRAVERSE(&woomera_profile_list, 1, do { - ASTOBJ_RDLOCK(iterator); - profile = iterator; - if (!ast_test_flag(profile, PFLAG_DISABLED)) { - launch_woomera_thread(profile); - } - ASTOBJ_UNLOCK(iterator); - } while(0)); - - ast_mutex_unlock(&lock); - return 1; -} - -static struct ast_channel *woomera_new(const char *type, int format, - void *data, int *cause, - woomera_profile *parent_profile) -{ - private_object *tech_pvt; - struct ast_channel *chan = NULL; - char name[100]; - - snprintf(name, sizeof(name), "%s/%s-%04x", type, (char *)data, rand() & 0xffff); - - if (!(tech_pvt = malloc(sizeof(private_object)))) { - ast_log(LOG_ERROR, "Memory Error!\n"); - return NULL; - } - memset(tech_pvt, 0, sizeof(private_object)); - -#ifdef AST14 - chan = ast_channel_alloc(0, AST_STATE_DOWN, "", "", "", "", "", 0, "%s", name); -#else - chan = ast_channel_alloc(1); -#endif - if (chan) { - chan->nativeformats = WFORMAT; -#ifndef AST14 - chan->type = type; - snprintf(chan->name, sizeof(chan->name), "%s/%s-%04x", chan->type, (char *)data, rand() & 0xffff); -#endif - - chan->writeformat = chan->rawwriteformat = chan->readformat = WFORMAT; - chan->_state = AST_STATE_DOWN; - chan->_softhangup = 0; - - tech_count++; - tech_pvt->coding=WFORMAT; - - ast_mutex_init(&tech_pvt->iolock); - ast_mutex_init(&tech_pvt->event_queue.lock); - tech_pvt->command_channel = -1; - chan->tech_pvt = tech_pvt; - chan->tech = &technology; - tech_pvt->udp_socket = -1; - - ast_clear_flag(chan, AST_FLAGS_ALL); - memset(&tech_pvt->frame, 0, sizeof(tech_pvt->frame)); - tech_pvt->frame.frametype = AST_FRAME_VOICE; - tech_pvt->frame.subclass = WFORMAT; - tech_pvt->frame.offset = AST_FRIENDLY_OFFSET; - - tech_pvt->owner = chan; - - chan->nativeformats = tech_pvt->coding; - chan->writeformat = chan->rawwriteformat = chan->readformat = tech_pvt->coding; - tech_pvt->frame.subclass = tech_pvt->coding; - - tech_pvt->pri_cause=AST_CAUSE_NORMAL_CLEARING; - - ast_copy_string(tech_pvt->mohinterpret,mohinterpret,sizeof(tech_pvt->mohinterpret)); - ast_copy_string(tech_pvt->mohsuggest,mohsuggest,sizeof(tech_pvt->mohsuggest)); - - ASTOBJ_CONTAINER_LINK(&private_object_list, tech_pvt); - - ast_mutex_lock(&usecnt_lock); - usecnt++; - ast_mutex_unlock(&usecnt_lock); - - } else { - if (option_verbose > 1) { - ast_log(LOG_ERROR, "Can't allocate a channel\n"); - } - } - - - return chan; -} - - - - -/********************CHANNEL METHOD LIBRARY******************** - * This is the actual functions described by the prototypes above. - * - */ - - -/*--- tech_requester: parse 'data' a url-like destination string, allocate a channel and a private structure - * and return the newly-setup channel. - */ -static struct ast_channel *tech_requester(const char *type, int format, void *data, int *cause) -{ - struct ast_channel *chan = NULL; - - - if (globals.panic) { - return NULL; - } - - if ((chan = woomera_new(type, format, data, cause, NULL))) { - private_object *tech_pvt; - - tech_pvt = chan->tech_pvt; - - if (tech_pvt->owner) { - tech_pvt->owner->hangupcause = AST_CAUSE_NORMAL_CLEARING; - } - - ast_set_flag(tech_pvt, TFLAG_PBX); /* so we know we dont have to free the channel ourselves */ - - if (globals.debug > 1 && option_verbose > 1) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++REQ %s\n", chan->name); - } - } - - } else { - - if (option_verbose > 1) { - ast_log(LOG_ERROR, "Can't allocate a channel\n"); - } - } - - - return chan; -} - -#ifdef AST14 -static int tech_digit_end(struct ast_channel *ast, char digit, unsigned int duration) -{ - return 0; -} -#endif - -/*--- tech_senddigit: Send a DTMF character */ -static int tech_send_digit(struct ast_channel *self, char digit) -{ - private_object *tech_pvt = self->tech_pvt; - int res = 0; - - if (globals.debug > 1 && option_verbose > 1) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++DIGIT %s '%c'\n",self->name, digit); - } - } - - /* we don't have time to make sure the dtmf command is successful cos asterisk again - is much too impaitent... so we will cache the digits so the monitor thread can send - it for us when it has time to actually wait. - */ - ast_mutex_lock(&tech_pvt->iolock); - snprintf(tech_pvt->dtmfbuf + strlen(tech_pvt->dtmfbuf), sizeof(tech_pvt->dtmfbuf), "%c", digit); - ast_set_flag(tech_pvt, TFLAG_DTMF); - ast_mutex_unlock(&tech_pvt->iolock); - - return res; -} - -/*--- tech_call: Initiate a call on my channel - * 'dest' has been passed telling you where to call - * but you may already have that information from the requester method - * not sure why it sends it twice, maybe it changed since then *shrug* - * You also have timeout (in ms) so you can tell how long the caller - * is willing to wait for the call to be complete. - */ - -static int tech_call(struct ast_channel *self, char *dest, int timeout) -{ - private_object *tech_pvt = self->tech_pvt; - char *workspace; - char *p; - char *c; - - self->hangupcause = AST_CAUSE_NORMAL_CIRCUIT_CONGESTION; - - if (globals.panic) { - goto tech_call_failed; - } - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "TECH CALL %s (%s <%s>) pres=0x%02X dest=%s\n", - self->name, self->cid.cid_name, - self->cid.cid_num, - self->cid.cid_pres, - dest); - } - - - - if (self->cid.cid_name) { - strncpy(tech_pvt->cid_name, self->cid.cid_name, sizeof(tech_pvt->cid_name)-1); - } - if (self->cid.cid_num) { - strncpy(tech_pvt->cid_num, self->cid.cid_num, sizeof(tech_pvt->cid_num)-1); - } - tech_pvt->cid_pres = self->cid.cid_pres; - - - if (self->cid.cid_rdnis) { - tech_pvt->cid_rdnis=strdup(self->cid.cid_rdnis); - } - - if ((workspace = ast_strdupa(dest))) { - char *addr, *profile_name, *proto=NULL; - woomera_profile *profile; - int err; - - -#if 0 - int isprofile = 0; - - - if ((addr = strchr(workspace, ':'))) { - char *tst; - proto = workspace; - if ((tst = strchr(proto, '/'))){ - proto=tst+1; - } - *addr = '\0'; - addr++; - } else { - proto = NULL; - addr = workspace; - } - - - - - if ((profile_name = strchr(addr, ':'))) { - *profile_name = '\0'; - profile_name++; - isprofile = 1; - } else { - profile_name = "default"; - } -#else - profile_name = "default"; - proto = NULL; - if ((addr = strchr(workspace, ':'))) { - profile_name = workspace; - proto=profile_name; - *addr = '\0'; - addr++; - } else { - addr = workspace; - } - -#endif - - if (! (profile = ASTOBJ_CONTAINER_FIND(&woomera_profile_list, profile_name))) { - profile = ASTOBJ_CONTAINER_FIND(&woomera_profile_list, "default"); - } - - if (!profile) { - ast_log(LOG_ERROR, "Unable to find profile! Call Aborted!\n"); - goto tech_call_failed; - } - - if (!ast_test_flag(profile, PFLAG_OUTBOUND)) { - ast_log(LOG_ERROR, "This profile is not allowed to make outbound calls! Call Aborted!\n"); - goto tech_call_failed; - } - - if (profile->max_calls) { - if (profile->call_count >= profile->max_calls) { - if (globals.debug > 1 && option_verbose > 1) { - ast_log(LOG_ERROR, "This profile is at call limit of %d\n", - profile->max_calls); - } - goto tech_call_failed; - } - } - - - - - snprintf(tech_pvt->dest, sizeof(tech_pvt->dest), "%s", addr ? addr : ""); - snprintf(tech_pvt->proto, sizeof(tech_pvt->proto), "%s", proto ? proto : ""); - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "TECH CALL: proto=%s addr=%s profile=%s Coding=%i\n", - proto,addr,profile_name,profile->coding); - } - - tech_pvt->timeout = timeout; - err=tech_init(tech_pvt, profile, TFLAG_OUTBOUND); - if (err) { - if (globals.debug > 2) { - ast_log(LOG_ERROR, "Error: Outbound Call Failed \n"); - } - goto tech_call_failed; - } - -#if 1 - if ((p = strrchr(self->name, '/'))) { - c = p-1; - if(*c == 'c' || *c== 'C'){ - ast_set_flag(tech_pvt, TFLAG_CONFIRM_ANSWER_ENABLED); - ast_set_flag(tech_pvt, TFLAG_CONFIRM_ANSWER); - } - } -#endif - - woomera_send_progress(tech_pvt); - } - self->hangupcause = AST_CAUSE_NORMAL_CLEARING; - - - return 0; - -tech_call_failed: - if (globals.debug > 1 && option_verbose > 1) { - ast_log(LOG_ERROR, "Error: Outbound Call Failed %p \n",tech_pvt); - } - self->hangupcause = AST_CAUSE_NORMAL_CIRCUIT_CONGESTION; - my_ast_softhangup(self, tech_pvt, AST_SOFTHANGUP_EXPLICIT); - return -1; -} - - -/*--- tech_hangup: end a call on my channel - * Now is your chance to tear down and free the private object - * from the channel it's about to be freed so you must do so now - * or the object is lost. Well I guess you could tag it for reuse - * or for destruction and let a monitor thread deal with it too. - * during the load_module routine you have every right to start up - * your own fancy schmancy bunch of threads or whatever else - * you want to do. - */ -static int tech_hangup(struct ast_channel *self) -{ - const char *ds; - private_object *tech_pvt = self->tech_pvt; - int res = 0; - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "TECH HANGUP [%s] tech_pvt=%p c=%p\n",self->name,tech_pvt,self); - } - - - if (tech_pvt) { - - ast_mutex_lock(&tech_pvt->iolock); - ast_set_flag(tech_pvt, TFLAG_TECHHANGUP); - tech_pvt->owner=NULL; - self->tech_pvt=NULL; - ast_mutex_unlock(&tech_pvt->iolock); - - - - - if (!self || - (!(ds = pbx_builtin_getvar_helper(self, "DIALSTATUS")) && - !(ds = ast_cause2str(self->hangupcause)))) { - ds = "NOEXIST"; - } - - ast_copy_string(tech_pvt->ds, ds, sizeof(tech_pvt->ds)); - - ds=pbx_builtin_getvar_helper(self, "PRI_CAUSE"); - if (ds && atoi(ds)) { - tech_pvt->pri_cause=atoi(ds); - } else if (self->hangupcause) { - tech_pvt->pri_cause=self->hangupcause; - } else { - tech_pvt->pri_cause=AST_CAUSE_NORMAL_CLEARING; - } - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "TECH HANGUP [%s] Cause=%i HangCause=%i ds=%s\n", - self->name,tech_pvt->pri_cause, self->hangupcause, ds?ds:"N/A"); - } - - if (tech_pvt->dsp) { - tech_pvt->dsp_features &= ~DSP_FEATURE_DTMF_DETECT; - ast_dsp_set_features(tech_pvt->dsp, tech_pvt->dsp_features); - tech_pvt->ast_dsp=0; - } - - - if (ast_test_flag(tech_pvt, TFLAG_INTHREAD)) { - ast_set_flag(tech_pvt, TFLAG_ABORT); - ast_set_flag(tech_pvt, TFLAG_DESTROY); - - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "TECH HANGUP IN THREAD! tpvt=%p\n", - tech_pvt); - } - } else { - if (globals.debug > 2) { - ast_log(LOG_ERROR, "TECH HANGUP: Destroying tech not in thread! Callid=%s tech_pvt=%p Dir=%s\n", - tech_pvt->callid, tech_pvt, - ast_test_flag(tech_pvt, TFLAG_OUTBOUND)?"OUT":"IN" ); - } - - if (!ast_test_flag(tech_pvt, TFLAG_DESTROY)) { - tech_destroy(tech_pvt,NULL); - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "TECH HANGUP NOT IN THREAD!\n"); - } - }else{ - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "TECH HANGUP NOT IN THREAD ALREDAY HUNGUP! \n"); - } - } - } - } else { - if (globals.debug > 2) { - ast_log(LOG_NOTICE, "ERROR: NO TECH ON TECH HANGUP!\n"); - } - } - - self->tech_pvt = NULL; - - return res; -} - -/*--- tech_answer: answer a call on my channel - * if being 'answered' means anything special to your channel - * now is your chance to do it! - */ -static int tech_answer(struct ast_channel *self) -{ - private_object *tech_pvt; - int res = 0; - - tech_pvt = self->tech_pvt; - if (globals.debug > 1 && option_verbose > 1) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++ANSWER %s\n",self->name); - } - } - - if (!ast_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - /* Only answer the inbound calls */ - ast_set_flag(tech_pvt, TFLAG_ANSWER); - } else { - ast_log(LOG_ERROR, "Warning: AST trying to Answer OUTBOUND Call!\n"); - } - - ast_set_flag(tech_pvt, TFLAG_UP); - ast_setstate(self, AST_STATE_UP); - - return res; -} - - -#if 0 -static int woomera_tx2ast_frm(private_object *tech_pvt, char * buf, int len ) -{ - struct ast_frame frame; - - frame.frametype = AST_FRAME_VOICE; - frame.subclass = tech_pvt->coding; - frame.datalen = len; - frame.samples = len; - frame.mallocd =0 ; - frame.offset= 0 ; - frame.src = NULL; - frame.data = buf ; - - if (tech_pvt->faxdetect || tech_pvt->ast_dsp) { - struct ast_frame *f; - struct ast_channel *owner = tech_get_owner(tech_pvt); - - - if (!owner) { - return 0; - } - - f = ast_dsp_process(owner, tech_pvt->dsp, &frame); - if (f && (f->frametype == AST_FRAME_DTMF)) { - - ast_log(LOG_DEBUG, "Detected inband DTMF digit: %c\n", f->subclass); -#if 0 - if (f->subclass == 'f' && tech_pvt->faxdetect) { - /* Fax tone -- Handle and return NULL */ - struct ast_channel *ast = tech_pvt->owner; - if (!tech_pvt->faxhandled) { - tech_pvt->faxhandled++; - if (strcmp(ast->exten, "fax")) { - if (ast_exists_extension(ast, ast_strlen_zero(ast->macrocontext)? ast->context : ast->macrocontext, "fax", 1, AST_CID_P(ast))) { - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Redirecting %s to fax extension\n", ast->name); - /* Save the DID/DNIS when we transfer the fax call to a "fax" extension */ - pbx_builtin_setvar_helper(ast,"FAXEXTEN",ast->exten); - if (ast_async_goto(ast, ast->context, "fax", 1)) - ast_log(LOG_NOTICE, "Failed to async goto '%s' into fax of '%s'\n", ast->name, ast->context); - } else - ast_log(LOG_NOTICE, "Fax detected, but no fax extension ctx:%s exten:%s\n",ast->context, ast->exten); - } else - ast_log(LOG_DEBUG, "Already in a fax extension, not redirecting\n"); - } else - ast_log(LOG_DEBUG, "Fax already handled\n"); - frame.frametype = AST_FRAME_NULL; - frame.subclass = 0; - f = &frame; - - } else -#endif - - if (tech_pvt->ast_dsp && owner) { - struct ast_frame fr; - memset(&fr, 0 , sizeof(fr)); - fr.frametype = AST_FRAME_DTMF; - fr.subclass = f->subclass ; - fr.src=NULL; - fr.data = NULL ; - fr.datalen = 0; - fr.samples = 0 ; - fr.mallocd =0 ; - fr.offset= 0 ; - - ast_log(LOG_EVENT, "Received DTMF Sending 2 AST %c\n", - fr.subclass); - ast_queue_frame(owner, &fr); - - } - - } - - } - - return 0; -} -#endif - -/*--- tech_read: Read an audio frame from my channel. - * You need to read data from your channel and convert/transfer the - * data into a newly allocated struct ast_frame object - */ -static struct ast_frame *tech_read(struct ast_channel *self) -{ - private_object *tech_pvt = self->tech_pvt; - int res = 0; - struct ast_frame *f; - - - if (!tech_pvt || globals.panic || ast_test_flag(tech_pvt, TFLAG_ABORT)) { - return NULL; - } - -tech_read_again: - - res = waitfor_socket(tech_pvt->udp_socket, 1000); - - if (res < 1) { - return NULL; - - }else if (res == 0) { - goto tech_read_again; - } - - res = read(tech_pvt->udp_socket, tech_pvt->fdata + AST_FRIENDLY_OFFSET, FRAME_LEN); - - if (res < 1) { - return NULL; - } - - tech_pvt->frame.frametype = AST_FRAME_VOICE; - tech_pvt->frame.subclass = tech_pvt->coding; - tech_pvt->frame.offset = AST_FRIENDLY_OFFSET; - tech_pvt->frame.datalen = res; - tech_pvt->frame.samples = res; - tech_pvt->frame.data = tech_pvt->fdata + AST_FRIENDLY_OFFSET; - - f=&tech_pvt->frame; - - if (tech_pvt->profile->rxgain_val) { - int i; - unsigned char *data=tech_pvt->frame.data; - for (i=0;iframe.datalen;i++) { - data[i]=tech_pvt->profile->rxgain[data[i]]; - } - } - - if (tech_pvt->owner && (tech_pvt->faxdetect || tech_pvt->ast_dsp)) { - f = ast_dsp_process(tech_pvt->owner, tech_pvt->dsp, &tech_pvt->frame); - if (f && f->frametype == AST_FRAME_DTMF){ - int answer = 0; - if(ast_test_flag(tech_pvt, TFLAG_CONFIRM_ANSWER_ENABLED)){ - ast_mutex_lock(&tech_pvt->iolock); - if(ast_test_flag(tech_pvt, TFLAG_CONFIRM_ANSWER)){ - ast_clear_flag(tech_pvt, TFLAG_CONFIRM_ANSWER); - if(ast_test_flag(tech_pvt, TFLAG_ANSWER_RECEIVED)){ - answer = 1; - } - } - ast_mutex_unlock(&tech_pvt->iolock); - if(answer){ - struct ast_frame answer_frame = {AST_FRAME_CONTROL, AST_CONTROL_ANSWER}; - struct ast_channel *owner = tech_get_owner(tech_pvt); - ast_log(LOG_DEBUG, "Confirm answer on %s!\n", self->name); - - if (owner) { - ast_setstate(owner, AST_STATE_UP); - ast_queue_frame(owner, &answer_frame); - ast_set_flag(tech_pvt, TFLAG_UP); - - ast_mutex_lock(&tech_pvt->profile->call_count_lock); - tech_pvt->profile->call_ok++; - ast_mutex_unlock(&tech_pvt->profile->call_count_lock); - } else { - ast_copy_string(tech_pvt->ds, "REQUESTED_CHAN_UNAVAIL", sizeof(tech_pvt->ds)); - tech_pvt->pri_cause=44; - ast_set_flag(tech_pvt, TFLAG_ABORT); - - } - } - } - if (answer == 0 && globals.debug > 2) { - ast_log(LOG_NOTICE, "%s: Detected inband DTMF digit: %c\n", - self->name, - f->subclass); - } - } - - - //woomera_tx2ast_frm(tech_pvt, tech_pvt->frame.data, tech_pvt->frame.datalen); - } - - - if (globals.debug > 4) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++READ %s %d coding %d\n",self->name, res, - tech_pvt->coding); - } - } - - - return f; -} - -/*--- tech_write: Write an audio frame to my channel - * Yep, this is the opposite of tech_read, you need to examine - * a frame and transfer the data to your technology's audio stream. - * You do not have any responsibility to destroy this frame and you should - * consider it to be read-only. - */ -static int tech_write(struct ast_channel *self, struct ast_frame *frame) -{ - private_object *tech_pvt = self->tech_pvt; - int res = 0, i = 0; - - if (!tech_pvt || globals.panic || ast_test_flag(tech_pvt, TFLAG_ABORT)) { - return 0; - } - - if(ast_test_flag(tech_pvt, TFLAG_MEDIA) && frame->datalen) { - if (frame->frametype == AST_FRAME_VOICE) { - - if (tech_pvt->profile->txgain_val) { - unsigned char *data=frame->data; - for (i=0;idatalen;i++) { - data[i]=tech_pvt->profile->txgain[data[i]]; - } - } - - i = sendto(tech_pvt->udp_socket, frame->data, frame->datalen, 0, - (struct sockaddr *) &tech_pvt->udpwrite, sizeof(tech_pvt->udpwrite)); - if (i < 0) { - return i; - } - if (globals.debug > 4) { - if (option_verbose > 4) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++WRITE %s %d\n",self->name, i); - } - } - - - } else { - ast_log(LOG_NOTICE, "Invalid frame type %d sent\n", frame->frametype); - } - } - - return res; -} - -/*--- tech_write_video: Write a video frame to my channel ---*/ -static int tech_write_video(struct ast_channel *self, struct ast_frame *frame) -{ - private_object *tech_pvt; - int res = 0; - - tech_pvt = self->tech_pvt; - return res; -} - -/*--- tech_exception: Read an exception audio frame from my channel ---*/ -static struct ast_frame *tech_exception(struct ast_channel *self) -{ - private_object *tech_pvt; - struct ast_frame *new_frame = NULL; - - tech_pvt = self->tech_pvt; - if (globals.debug > 1 && option_verbose > 1) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++EXCEPT %s\n",self->name); - } - } - return new_frame; -} - -/*--- tech_indicate: Indicaate a condition to my channel ---*/ -#ifdef USE_TECH_INDICATE -#ifdef AST14 -static int tech_indicate(struct ast_channel *self, int condition, const void *data, size_t datalen) -#else -static int tech_indicate(struct ast_channel *self, int condition) -#endif -{ - private_object *tech_pvt; - int res = -1; - - tech_pvt = self->tech_pvt; - if (!tech_pvt) { - return res; - } - - switch(condition) { - - case AST_CONTROL_RINGING: - if (globals.debug > 3) { - ast_log(LOG_NOTICE, "TECH INDICATE: Ringing\n"); - } - if (!ast_test_flag(tech_pvt,TFLAG_ACCEPTED)) { - ast_set_flag(tech_pvt, TFLAG_ACCEPT); - } - break; - case AST_CONTROL_BUSY: - if (globals.debug > 3) { - ast_log(LOG_NOTICE, "TECH INDICATE: Busy\n"); - } - ast_copy_string(tech_pvt->ds, "BUSY", sizeof(tech_pvt->ds)); - tech_pvt->pri_cause=17; - ast_set_flag(tech_pvt, TFLAG_ABORT); - break; - case AST_CONTROL_CONGESTION: - if (globals.debug > 3) { - ast_log(LOG_NOTICE, "TECH INDICATE: Congestion\n"); - } - ast_copy_string(tech_pvt->ds, "BUSY", sizeof(tech_pvt->ds)); - tech_pvt->pri_cause=17; - ast_set_flag(tech_pvt, TFLAG_ABORT); - break; - case AST_CONTROL_PROCEEDING: - if (globals.debug > 3) { - ast_log(LOG_NOTICE, "TECH INDICATE: Proceeding\n"); - } - if (!ast_test_flag(tech_pvt,TFLAG_ACCEPTED)) { - ast_set_flag(tech_pvt, TFLAG_ACCEPT); - } - break; - case AST_CONTROL_PROGRESS: - if (globals.debug > 3) { - ast_log(LOG_NOTICE, "TECH INDICATE: Progress\n"); - } - if (!ast_test_flag(tech_pvt,TFLAG_ACCEPTED)) { - ast_set_flag(tech_pvt, TFLAG_ACCEPT); - } - break; - case AST_CONTROL_HOLD: - if (globals.debug > 3) { - ast_log(LOG_NOTICE, "TECH INDICATE: Hold\n"); - } - if (!ast_test_flag(tech_pvt,TFLAG_ACCEPTED)) { - ast_set_flag(tech_pvt, TFLAG_ACCEPT); - } -#ifdef AST14 - ast_mutex_lock(&self->lock); - ast_moh_start(self, data, tech_pvt->mohinterpret); - ast_mutex_unlock(&self->lock); -#endif - break; - case AST_CONTROL_UNHOLD: - if (globals.debug > 3) { - ast_log(LOG_NOTICE, "TECH INDICATE: UnHold\n"); - } - if (!ast_test_flag(tech_pvt,TFLAG_ACCEPTED)) { - ast_set_flag(tech_pvt, TFLAG_ACCEPT); - } -#ifdef AST14 - ast_mutex_lock(&self->lock); - ast_moh_stop(self); - ast_mutex_unlock(&self->lock); -#endif - break; - case AST_CONTROL_VIDUPDATE: - if (globals.debug > 3) { - ast_log(LOG_NOTICE, "TECH INDICATE: Vidupdate\n"); - } - if (!ast_test_flag(tech_pvt,TFLAG_ACCEPTED)) { - ast_set_flag(tech_pvt, TFLAG_ACCEPT); - } - break; - case -1: - res = -1; - break; - default: - ast_log(LOG_NOTICE, "Don't know how to indicate condition %d\n", condition); - res = -1; - break; - } - - return res; -} -#endif - -/*--- tech_fixup: add any finishing touches to my channel if it is masqueraded---*/ -static int tech_fixup(struct ast_channel *oldchan, struct ast_channel *newchan) -{ - int res = 0; - private_object *tech_pvt; - - if ((tech_pvt = oldchan->tech_pvt)) { - ast_mutex_lock(&tech_pvt->iolock); - tech_pvt->owner = newchan; - ast_mutex_unlock(&tech_pvt->iolock); - } - - if (globals.debug > 1 && option_verbose > 1) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++FIXUP %s\n",oldchan->name); - } - } - return res; -} - -/*--- tech_send_html: Send html data on my channel ---*/ -static int tech_send_html(struct ast_channel *self, int subclass, const char *data, int datalen) -{ - private_object *tech_pvt; - int res = 0; - - tech_pvt = self->tech_pvt; - - - return res; -} - -/*--- tech_send_text: Send plain text data on my channel ---*/ -static int tech_send_text(struct ast_channel *self, const char *text) -{ - int res = 0; - - return res; -} - -/*--- tech_send_image: Send image data on my channel ---*/ -static int tech_send_image(struct ast_channel *self, struct ast_frame *frame) -{ - int res = 0; - - return res; -} - - -/*--- tech_setoption: set options on my channel ---*/ -static int tech_setoption(struct ast_channel *self, int option, void *data, int datalen) -{ - int res = 0; - - if (globals.debug > 1 && option_verbose > 1) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++SETOPT %s\n",self->name); - } - } - return res; - -} - -/*--- tech_queryoption: get options from my channel ---*/ -static int tech_queryoption(struct ast_channel *self, int option, void *data, int *datalen) -{ - int res = 0; - - if (globals.debug > 1 && option_verbose > 1) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++GETOPT %s\n",self->name); - } - } - return res; -} - -/*--- tech_bridged_channel: return a pointer to a channel that may be bridged to our channel. ---*/ -#if 0 -static struct ast_channel *tech_bridged_channel(struct ast_channel *self, struct ast_channel *bridge) -{ - struct ast_channel *chan = NULL; - - if (globals.debug > 1 && option_verbose > 1) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++BRIDGED %s\n",self->name); - } - return chan; -} -#endif - - -/*--- tech_transfer: Technology-specific code executed to peform a transfer. ---*/ -static int tech_transfer(struct ast_channel *self, const char *newdest) -{ - int res = -1; - - if (globals.debug > 1 && option_verbose > 1) { - if (option_verbose > 2) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++TRANSFER %s\n",self->name); - } - } - return res; -} - -/*--- tech_bridge: Technology-specific code executed to natively bridge 2 of our channels ---*/ -#if 0 -static enum ast_bridge_result tech_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms) -{ - int res = -1; - - if (globals.debug > 1) { - ast_verbose(WOOMERA_DEBUG_PREFIX "+++BRIDGE %s\n",c0->name); - } - return res; -} -#endif - - -static int woomera_cli(int fd, int argc, char *argv[]) -{ - struct woomera_profile *profile; - char *profile_name="default"; - - if (argc > 2) { - - profile_name=argv[1]; - profile = ASTOBJ_CONTAINER_FIND(&woomera_profile_list, profile_name); - if (!profile) { - - if (strcmp(profile_name,"version") == 0) { - ast_cli(fd, "Woomera version %s : SMG Version %s \n", - WOOMERA_VERSION,smgversion); - return 0; - } - - ast_cli(fd, "Woomera: Invalid profile name %s\n", profile_name); - return 0; - } - - if (!strcmp(argv[2], "debug")) { - if (argc > 3) { - globals.debug = atoi(argv[3]); - } - ast_cli(fd, "Woomera debug=%d\n", globals.debug); - - - } else if (!strcmp(argv[2], "coding")) { - - switch (profile->coding) { - case AST_FORMAT_ALAW: - ast_cli(fd, " Woomera {%s} coding=ALAW\n",profile_name); - break; - case AST_FORMAT_ULAW: - ast_cli(fd, " Woomera {%s} coding=ULAW\n",profile_name); - break; - case AST_FORMAT_SLINEAR: - ast_cli(fd, " Woomera {%s} coding=PMC-16\n",profile_name); - break; - default: - ast_cli(fd, " Woomera {%s} invalid coding=%d {internal error}", - profile_name,profile->coding); - break; - - } - - } else if (!strcmp(argv[2], "call_status")) { - - ast_cli(fd, "Woomera {%s} calls=%d tcalls=%d (out=%d in=%d ok=%d end=%d abort=%d)\n", - profile->name, - profile->call_count, - profile->call_out+profile->call_in, - profile->call_out, - profile->call_in, - profile->call_ok, - profile->call_end, - profile->call_abort); - - } else if (!strcmp(argv[2], "version")) { - - ast_cli(fd, "Woomera version %s : SMG Version %s \n", - WOOMERA_VERSION,smgversion); - - } else if (!strcmp(argv[2], "panic")) { - if (argc > 3) { - globals.panic = atoi(argv[3]); - } - ast_cli(fd, "Woomera panic=%d \n", globals.panic); - - } else if (!strcmp(argv[2], "rxgain")) { - float gain; - if (argc > 3) { - if (sscanf(argv[3], "%f", &gain) != 1) { - ast_cli(fd, "Woomera Invalid rxgain: %s\n",argv[3]); - } else { - woomera_config_gain(profile,gain,1); - } - } - ast_cli(fd, "Woomera {%s} rxgain: %f\n",profile_name,profile->rxgain_val); - - } else if (!strcmp(argv[2], "txgain")) { - float gain; - if (argc > 3) { - if (sscanf(argv[3], "%f", &gain) != 1) { - ast_cli(fd, "Woomera Invalid txgain: %s\n",argv[3]); - } else { - woomera_config_gain(profile,gain,0); - } - } - ast_cli(fd, "Woomera {%s} txgain: %f\n",profile_name,profile->txgain_val); - - } else if (!strcmp(argv[2], "threads")) { - ast_cli(fd, "chan_woomera is using %s threads!\n", - globals.more_threads ? "more" : "less"); - - } else if (!strcmp(argv[2], "smgdebug")) { - if (argc > 2) { - int smgdebug; - if (sscanf(argv[3], "%d", &smgdebug) != 1) { - ast_cli(fd, "Woomera Invalid smgdebug level: %s\n",argv[3]); - } else { - - woomera_printf(NULL, profile->woomera_socket , "debug %d%s", - smgdebug, - WOOMERA_RECORD_SEPARATOR); - } - } - } else if (!strcmp(argv[2], "abort")) { - global_set_flag(TFLAG_ABORT); - } - - } else { - ast_cli(fd, "Usage: woomera